@drawo-app/drawo 2.0.19 → 2.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -214,7 +214,7 @@ The error may be correlated with this previous error:
214
214
  `.concat(n.current.stack,`
215
215
 
216
216
  `)),l}i.current=t,a.current=s,n.current=void 0;var A=H.useCallback(()=>{try{var l=i.current();if(e(a.current,l))return;a.current=l}catch(u){u instanceof Error?n.current=u:n.current=new Error(String(u))}r()},[]);return[s,A]}function One(t){return t instanceof Error}var eM=H.createContext({}),tM=(t,e)=>{var r=_o(),{decorate:n,addEventListener:i}=H.useContext(eM),a=()=>{var l=bt.findPath(r,t);return n([t,l])},s=De.isText(t)?qT:M7,[o,A]=kne(a,s);return CA(()=>{var l=i(A);return A(),l},[i,A]),H.useMemo(()=>[...o,...e],[o,e])},Tne=t=>{var e=H.useRef(new Set),r=H.useRef(t);CA(()=>{r.current=t,e.current.forEach(a=>a())},[t]);var n=H.useCallback(a=>r.current(a),[]),i=H.useCallback(a=>(e.current.add(a),()=>{e.current.delete(a)}),[]);return H.useMemo(()=>({decorate:n,addEventListener:i}),[n,i])};function Oy(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function rM(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Oy(Object(r),!0).forEach(function(n){Nn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Oy(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Mne=t=>H.createElement(Pne,rM({},t)),Nne=t=>{for(var{decorations:e,isLast:r,parent:n,renderPlaceholder:i,renderLeaf:a,renderText:s=Mne,text:o}=t,A=_o(),l=H.useRef(null),u=tM(o,e),c=pA.decorations(o,u),d=bt.findKey(A,o),f=[],v=0;v<c.length;v++){var{leaf:p,position:C}=c[v];f.push(H.createElement(Lne,{isLast:r&&v===c.length-1,key:"".concat(d.id,"-").concat(v),renderPlaceholder:i,leaf:p,leafPosition:C,text:o,parent:n,renderLeaf:a}))}var w=H.useCallback(b=>{var B=A5.get(A);b?(B?.set(d,b),eu.set(o,b),kf.set(b,o)):(B?.delete(d),eu.delete(o),l.current&&kf.delete(l.current)),l.current=b},[l,A,d,o]),g={"data-slate-node":"text",ref:w};return s({text:o,children:f,attributes:g})},nM=H.memo(Nne,(t,e)=>e.parent===t.parent&&e.isLast===t.isLast&&e.renderText===t.renderText&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&e.text===t.text&&qT(e.decorations,t.decorations)),Pne=t=>{var{attributes:e,children:r}=t;return H.createElement("span",rM({},e),r)};function Ty(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wm(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ty(Object(r),!0).forEach(function(n){Nn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ty(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Rne=t=>H.createElement(Qne,wm({},t)),Une=t=>{var{decorations:e,element:r,renderElement:n=Rne,renderChunk:i,renderPlaceholder:a,renderLeaf:s,renderText:o}=t,A=_o(),l=Yne(),u=A.isInline(r),c=tM(r,e),d=bt.findKey(A,r),f=H.useCallback(B=>{var E=A5.get(A);B?(E?.set(d,B),eu.set(r,B),kf.set(B,r)):(E?.delete(d),eu.delete(r))},[A,d,r]),v=sM({decorations:c,node:r,renderElement:n,renderChunk:i,renderPlaceholder:a,renderLeaf:s,renderText:o}),p={"data-slate-node":"element",ref:f};if(u&&(p["data-slate-inline"]=!0),!u&&z.hasInlines(A,r)){var C=De.string(r),w=IT(C);w==="rtl"&&(p.dir=w)}if(z.isVoid(A,r)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var g=u?"span":"div",[[b]]=De.texts(r);v=H.createElement(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},H.createElement(nM,{renderPlaceholder:a,decorations:[],isLast:!1,parent:r,text:b})),pc.set(b,0),tf.set(b,r)}return n({attributes:p,children:v,element:r})},_ne=H.memo(Une,(t,e)=>t.element===e.element&&t.renderElement===e.renderElement&&t.renderChunk===e.renderChunk&&t.renderText===e.renderText&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&M7(t.decorations,e.decorations)),Qne=t=>{var{attributes:e,children:r,element:n}=t,i=_o(),a=i.isInline(n)?"span":"div";return H.createElement(a,wm(wm({},e),{},{style:{position:"relative"}}),r)};class jne{constructor(e,r){var{chunkSize:n,debug:i}=r;Nn(this,"root",void 0),Nn(this,"chunkSize",void 0),Nn(this,"debug",void 0),Nn(this,"reachedEnd",void 0),Nn(this,"pointerChunk",void 0),Nn(this,"pointerIndex",void 0),Nn(this,"pointerIndexStack",void 0),Nn(this,"cachedPointerNode",void 0),this.root=e,this.chunkSize=n,this.debug=i??!1,this.pointerChunk=e,this.pointerIndex=-1,this.pointerIndexStack=[],this.reachedEnd=!1,this.validateState()}readLeaf(){if(this.reachedEnd)return null;for(;;)if(this.pointerIndex+1<this.pointerSiblings.length){this.pointerIndex++,this.cachedPointerNode=void 0;break}else{if(this.pointerChunk.type==="root")return this.reachedEnd=!0,null;this.exitChunk()}return this.validateState(),this.enterChunkUntilLeaf(!1),this.pointerNode}returnToPreviousLeaf(){if(this.reachedEnd){this.reachedEnd=!1,this.enterChunkUntilLeaf(!0);return}for(;;)if(this.pointerIndex>=1){this.pointerIndex--,this.cachedPointerNode=void 0;break}else if(this.pointerChunk.type==="root"){this.pointerIndex=-1;return}else this.exitChunk();this.validateState(),this.enterChunkUntilLeaf(!0)}insertBefore(e){this.returnToPreviousLeaf(),this.insertAfter(e),this.readLeaf()}insertAfter(e){if(e.length!==0){for(var r=0,n=0;this.pointerChunk.type==="chunk"&&this.pointerIndex===this.pointerSiblings.length-1;){var i=this.chunkSize-this.pointerSiblings.length,a=Math.min(i,e.length);if(a>0){var s=e.splice(0,a);this.rawInsertAfter(s,r)}this.exitChunk(),r++}if(e.length!==0){var o=this.savePointer(),A=null;if(this.readLeaf())for(;this.pointerChunk.type==="chunk"&&this.pointerIndex===0;){var l=this.chunkSize-this.pointerSiblings.length,u=Math.min(l,e.length);if(u>0){var c=e.splice(-u,u);this.pointerIndex=-1,this.cachedPointerNode=void 0,this.rawInsertAfter(c,n),A||(A=this.savePointer())}this.exitChunk(),n++}this.restorePointer(o);var d=Math.max(r,n);this.rawInsertAfter(e,d),A&&this.restorePointer(A),this.validateState()}}}remove(){this.pointerSiblings.splice(this.pointerIndex--,1),this.cachedPointerNode=void 0,this.pointerSiblings.length===0&&this.pointerChunk.type==="chunk"?(this.exitChunk(),this.remove()):this.invalidateChunk(),this.validateState()}invalidateChunk(){for(var e=this.pointerChunk;e.type==="chunk";e=e.parent)this.root.modifiedChunks.add(e)}get atStart(){return this.pointerChunk.type==="root"&&this.pointerIndex===-1}get pointerSiblings(){return this.pointerChunk.children}getPointerNode(){return this.reachedEnd||this.pointerIndex===-1?null:this.pointerSiblings[this.pointerIndex]}get pointerNode(){if(this.cachedPointerNode!==void 0)return this.cachedPointerNode;var e=this.getPointerNode();return this.cachedPointerNode=e,e}getChunkPath(e){for(var r=[],n=e;n.type==="chunk";n=n.parent){var i=n.parent.children.indexOf(n);if(i===-1)return null;r.unshift(i)}return r}savePointer(){if(this.atStart)return"start";if(!this.pointerNode)throw new Error("Cannot save pointer when pointerNode is null");return{chunk:this.pointerChunk,node:this.pointerNode}}restorePointer(e){if(e==="start"){this.pointerChunk=this.root,this.pointerIndex=-1,this.pointerIndexStack=[],this.reachedEnd=!1,this.cachedPointerNode=void 0;return}var{chunk:r,node:n}=e,i=r.children.indexOf(n);if(i===-1)throw new Error("Cannot restore point because saved node is no longer in saved chunk");var a=this.getChunkPath(r);if(!a)throw new Error("Cannot restore point because saved chunk is no longer connected to root");this.pointerChunk=r,this.pointerIndex=i,this.pointerIndexStack=a,this.reachedEnd=!1,this.cachedPointerNode=n,this.validateState()}enterChunk(e){var r;if(((r=this.pointerNode)===null||r===void 0?void 0:r.type)!=="chunk")throw new Error("Cannot enter non-chunk");if(this.pointerIndexStack.push(this.pointerIndex),this.pointerChunk=this.pointerNode,this.pointerIndex=e?this.pointerSiblings.length-1:0,this.cachedPointerNode=void 0,this.validateState(),this.pointerChunk.children.length===0)throw new Error("Cannot enter empty chunk")}enterChunkUntilLeaf(e){for(;((r=this.pointerNode)===null||r===void 0?void 0:r.type)==="chunk";){var r;this.enterChunk(e)}}exitChunk(){if(this.pointerChunk.type==="root")throw new Error("Cannot exit root");var e=this.pointerChunk;this.pointerChunk=e.parent,this.pointerIndex=this.pointerIndexStack.pop(),this.cachedPointerNode=void 0,this.validateState()}rawInsertAfter(e,r){if(e.length!==0){for(var n=(u,c,d)=>{if(d===1)return u;for(var f=[],v=0;v<this.chunkSize;v++){var p=u.slice(v*d,(v+1)*d);if(p.length===0)break;var C={type:"chunk",key:new _T,parent:c,children:[]};C.children=n(p,C,d/this.chunkSize),f.push(C)}return f},i=this.pointerSiblings.length+e.length,a=0,s=this.chunkSize;s<i;s*=this.chunkSize)a++;var o=Math.max(a,r),A=Math.pow(this.chunkSize,o),l=n(e,this.pointerChunk,A);this.pointerSiblings.splice(this.pointerIndex+1,0,...l),this.pointerIndex+=l.length,this.cachedPointerNode=void 0,this.invalidateChunk(),this.validateState()}}validateState(){if(this.debug){var e=n=>{if(n.type==="chunk"){var{parent:i,children:a}=n;if(!i.children.includes(n))throw new Error("Debug: Chunk ".concat(n.key.id," has an incorrect parent property"));a.forEach(e)}};if(this.root.children.forEach(e),this.cachedPointerNode!==void 0&&this.cachedPointerNode!==this.getPointerNode())throw new Error("Debug: The cached pointer is incorrect and has not been invalidated");var r=this.getChunkPath(this.pointerChunk);if(!r)throw new Error("Debug: The pointer chunk is not connected to the root");if(!xe.equals(this.pointerIndexStack,r))throw new Error("Debug: The cached index stack [".concat(this.pointerIndexStack.join(", "),"] does not match the path of the pointer chunk [").concat(r.join(", "),"]"))}}}class Hne{constructor(e,r){Nn(this,"editor",void 0),Nn(this,"children",void 0),Nn(this,"cachedKeys",void 0),Nn(this,"pointerIndex",void 0),this.editor=e,this.children=r,this.cachedKeys=new Array(r.length),this.pointerIndex=0}read(e){if(e===1)return[this.children[this.pointerIndex++]];var r=this.remaining(e);return this.pointerIndex+=e,r}remaining(e){return e===void 0?this.children.slice(this.pointerIndex):this.children.slice(this.pointerIndex,this.pointerIndex+e)}get reachedEnd(){return this.pointerIndex>=this.children.length}lookAhead(e,r){var n=this.children.indexOf(e,this.pointerIndex);if(n>-1)return n-this.pointerIndex;for(var i=this.pointerIndex;i<this.children.length;i++){var a=this.children[i],s=this.findKey(a,i);if(s===r)return i-this.pointerIndex}return-1}toChunkLeaves(e,r){return e.map((n,i)=>({type:"leaf",node:n,key:this.findKey(n,r+i),index:r+i}))}findKey(e,r){var n=this.cachedKeys[r];if(n)return n;var i=bt.findKey(this.editor,e);return this.cachedKeys[r]=i,i}}var Kne=(t,e)=>{for(var{chunkTree:r,children:n,chunkSize:i,rerenderChildren:a=[],onInsert:s,onUpdate:o,onIndexChange:A,debug:l}=e,u=new jne(r,{chunkSize:i,debug:l}),c=new Hne(t,n),d,f=function(){var w=c.lookAhead(d.node,d.key),g=w>0&&r.movedNodeKeys.has(d.key);if(w===-1||g)return u.remove(),1;var b=c.pointerIndex,B=c.read(w+1),E=B.pop();if(B.length){var F=c.toChunkLeaves(B,b);u.insertBefore(F),B.forEach((I,k)=>{s?.(I,b+k)})}var O=c.pointerIndex-1;d.node!==E&&(d.node=E,u.invalidateChunk(),o?.(E,O)),d.index!==O&&(d.index=O,A?.(E,O)),a.includes(O)&&u.invalidateChunk()};d=u.readLeaf();)f();if(!c.reachedEnd){var v=c.remaining(),p=c.toChunkLeaves(v,c.pointerIndex);u.returnToPreviousLeaf(),u.insertAfter(p),v.forEach((C,w)=>{s?.(C,c.pointerIndex+w)})}r.movedNodeKeys.clear()};function My(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vne(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?My(Object(r),!0).forEach(function(n){Nn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):My(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Ny=new WeakMap,iM=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=bt.findKey(e,r),a=Ny.get(i);return a||(a={type:"root",movedNodeKeys:new Set,modifiedChunks:new Set,children:[]},Ny.set(i,a)),n.reconcile&&Kne(e,Vne({chunkTree:a,children:r.children},n.reconcile)),a};function Py(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Wne(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Py(Object(r),!0).forEach(function(n){Nn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Py(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var qne=t=>{var{children:e}=t;return e},aM=t=>{var{root:e,ancestor:r,renderElement:n,renderChunk:i=qne}=t;return r.children.map(a=>{if(a.type==="chunk"){var s=a.key.id,o=i({highest:r===e,lowest:a.children.some(l=>l.type==="leaf"),attributes:{"data-slate-chunk":!0},children:H.createElement(Gne,{root:e,ancestor:a,renderElement:n,renderChunk:i})});return H.createElement(H.Fragment,{key:s},o)}var A=a.node;return n(A,a.index,a.key)})},zne=t=>(H.useEffect(()=>{t.root.modifiedChunks.clear()}),H.createElement(aM,Wne({},t))),Gne=H.memo(aM,(t,e)=>t.root===e.root&&t.renderElement===e.renderElement&&t.renderChunk===e.renderChunk&&!e.root.modifiedChunks.has(e.ancestor)),$ne=H.createContext(null),sM=t=>{var{decorations:e,node:r,renderElement:n,renderChunk:i,renderPlaceholder:a,renderText:s,renderLeaf:o}=t,A=_o();Ec.set(A,!1);var l=De.isElement(r)&&!A.isInline(r),u=l&&z.hasInlines(A,r),c=u?null:A.getChunkSize(r),d=!!c,{decorationsByChild:f,childrenToRedecorate:v}=Xne(A,r,e);d||r.children.forEach((g,b)=>{pc.set(g,b),tf.set(g,r)});var p=H.useCallback((g,b,B)=>{var E=B??bt.findKey(A,g);return H.createElement($ne.Provider,{key:"provider-".concat(E.id),value:g},H.createElement(_ne,{decorations:f[b],element:g,key:E.id,renderElement:n,renderChunk:i,renderPlaceholder:a,renderLeaf:o,renderText:s}))},[A,f,n,i,a,o,s]),C=(g,b)=>{var B=bt.findKey(A,g);return H.createElement(nM,{decorations:f[b],key:B.id,isLast:b===r.children.length-1,parent:r,renderPlaceholder:a,renderLeaf:o,renderText:s,text:g})};if(!d)return r.children.map((g,b)=>De.isText(g)?C(g,b):p(g,b));var w=iM(A,r,{reconcile:{chunkSize:c,rerenderChildren:v,onInsert:(g,b)=>{pc.set(g,b),tf.set(g,r)},onUpdate:(g,b)=>{pc.set(g,b),tf.set(g,r)},onIndexChange:(g,b)=>{pc.set(g,b)}}});return H.createElement(zne,{root:w,ancestor:w,renderElement:p,renderChunk:i})},Xne=(t,e,r)=>{var n=Qre(t,e,r),i=H.useRef(n).current,a=[];i.length=n.length;for(var s=0;s<n.length;s++){var o,A=n[s],l=(o=i[s])!==null&&o!==void 0?o:null;M7(l,A)||(i[s]=A,a.push(s))}return{decorationsByChild:i,childrenToRedecorate:a}},oM=H.createContext(!1),Yne=()=>H.useContext(oM),R7=H.createContext({});function Zne(){var t=H.useRef(new Set),e=H.useRef(new Set),r=H.useCallback(()=>{t.current.forEach(s=>s())},[]),n=H.useCallback(()=>{e.current.forEach(s=>s()),e.current.clear()},[]),i=H.useCallback(function(s){var{deferred:o=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=o?()=>e.current.add(s):s;return t.current.add(A),()=>{t.current.delete(A)}},[]),a=H.useMemo(()=>({addEventListener:i,flushDeferred:n}),[i,n]);return{selectorContext:a,onChange:r}}function Jne(){var{flushDeferred:t}=H.useContext(R7);CA(t)}var eie=()=>{var{addEventListener:t}=H.useContext(R7),[,e]=H.useReducer(r=>r+1,0);if(!t)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");return CA(()=>t(e),[t]),_o()};function tie(){var t=_o(),e=H.useRef(!1),r=H.useRef(0),n=H.useCallback(()=>{if(!e.current){e.current=!0;var i=bt.getWindow(t);i.cancelAnimationFrame(r.current),r.current=i.requestAnimationFrame(()=>{e.current=!1})}},[t]);return H.useEffect(()=>()=>cancelAnimationFrame(r.current),[]),{receivedUserInput:e,onUserInput:n}}var rie=(t,e)=>{var r=[],n=()=>{r=[]},i=s=>{if(e.current){var o=s.filter(A=>I7(t,A,s));r.push(...o)}};function a(){r.length>0&&(r.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),n())}return{registerMutations:i,restoreDOM:a,clear:n}},nie={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class AM extends H.Component{constructor(){super(...arguments),Nn(this,"context",null),Nn(this,"manager",null),Nn(this,"mutationObserver",null)}observe(){var e,{node:r}=this.props;if(!r.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(e=this.mutationObserver)===null||e===void 0||e.observe(r.current,nie)}componentDidMount(){var{receivedUserInput:e}=this.props,r=this.context;this.manager=rie(r,e),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var e,r,n,i=(e=this.mutationObserver)===null||e===void 0?void 0:e.takeRecords();if(i!=null&&i.length){var a;(a=this.manager)===null||a===void 0||a.registerMutations(i)}return(r=this.mutationObserver)===null||r===void 0||r.disconnect(),(n=this.manager)===null||n===void 0||n.restoreDOM(),null}componentDidUpdate(){var e;(e=this.manager)===null||e===void 0||e.clear(),this.observe()}componentWillUnmount(){var e;(e=this.mutationObserver)===null||e===void 0||e.disconnect()}render(){return this.props.children}}Nn(AM,"contextType",P7);var iie=Aa?AM:t=>{var{children:e}=t;return H.createElement(H.Fragment,null,e)},aie=H.createContext(!1),sie=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderChunk","renderLeaf","renderText","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],oie=["text"];function Ry(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Eo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ry(Object(r),!0).forEach(function(n){Nn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ry(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Aie=t=>H.createElement(H.Fragment,null,sM(t)),lie=H.forwardRef((t,e)=>{var r=H.useCallback(ee=>H.createElement(uie,Eo({},ee)),[]),{autoFocus:n,decorate:i=cie,onDOMBeforeInput:a,placeholder:s,readOnly:o=!1,renderElement:A,renderChunk:l,renderLeaf:u,renderText:c,renderPlaceholder:d=r,scrollSelectionIntoView:f=fie,style:v={},as:p="div",disableDefaultStyles:C=!1}=t,w=n2(t,sie),g=eie(),[b,B]=H.useState(!1),E=H.useRef(null),F=H.useRef([]),[O,I]=H.useState(),k=H.useRef(!1),{onUserInput:j,receivedUserInput:D}=tie(),[,L]=H.useReducer(ee=>ee+1,0);jT.set(g,L),dm.set(g,o);var P=H.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);H.useEffect(()=>{E.current&&n&&E.current.focus()},[n]);var R=H.useRef(),q=H.useMemo(()=>ere(()=>{if(Ec.get(g)){q();return}var ee=bt.toDOMNode(g,g),ue=ee.getRootNode();if(!k.current&&Hl&&ue instanceof ShadowRoot){k.current=!0;var de=hre();de?document.execCommand("indent"):ct.deselect(g),k.current=!1;return}var Ce=R.current;if((Aa||!bt.isComposing(g))&&(!P.isUpdatingSelection||Ce!=null&&Ce.isFlushing())&&!P.isDraggingInternally){var pe=bt.findDocumentOrShadowRoot(g),{activeElement:Oe}=pe,X=bt.toDOMNode(g,g),We=ef(pe);if(Oe===X?(P.latestElement=Oe,nl.set(g,!0)):nl.delete(g),!We)return ct.deselect(g);var{anchorNode:ft,focusNode:be}=We,Le=bt.hasEditableTarget(g,ft)||bt.isTargetInsideNonReadonlyVoid(g,ft),at=bt.hasTarget(g,be);if(Le&&at){var Me=bt.toSlateRange(g,We,{exactMatch:!1,suppressThrow:!0});Me&&(!bt.isComposing(g)&&!(Ce!=null&&Ce.hasPendingChanges())&&!(Ce!=null&&Ce.isFlushing())?ct.select(g,Me):Ce?.handleUserSelect(Me))}o&&(!Le||!at)&&ct.deselect(g)}},100),[g,o,P]),te=H.useMemo(()=>Yte(q,0),[q]);R.current=yne({node:E,onDOMSelectionChange:q,scheduleOnDOMSelectionChange:te}),CA(()=>{var ee,ue,de;E.current&&(de=L7(E.current))?(QT.set(g,de),rf.set(g,E.current),eu.set(g,E.current),kf.set(E.current,g)):eu.delete(g);var{selection:Ce}=g,pe=bt.findDocumentOrShadowRoot(g),Oe=ef(pe);if(!(!Oe||!bt.isFocused(g)||(ee=R.current)!==null&&ee!==void 0&&ee.hasPendingAction())){var X=Le=>{var at=Oe.type!=="None";if(!(!Ce&&!at)){var Me=Oe.focusNode,it;if(dc&&Oe.rangeCount>1){var mt=Oe.getRangeAt(0),ze=Oe.getRangeAt(Oe.rangeCount-1);mt.startContainer===Me?it=ze.endContainer:it=mt.startContainer}else it=Oe.anchorNode;var lt=rf.get(g),le=!1;if(Jl(lt,it)&&Jl(lt,Me)&&(le=!0),at&&le&&Ce&&!Le){var ge=bt.toSlateRange(g,Oe,{exactMatch:!0,suppressThrow:!0});if(ge&&rt.equals(ge,Ce)){var ve;if(!P.hasMarkPlaceholder||(ve=it)!==null&&ve!==void 0&&(ve=ve.parentElement)!==null&&ve!==void 0&&ve.hasAttribute("data-slate-mark-placeholder"))return}}if(Ce&&!bt.hasRange(g,Ce)){g.selection=bt.toSlateRange(g,Oe,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var Re=null;try{Re=Ce&&bt.toDOMRange(g,Ce)}catch{}return Re?(bt.isComposing(g)&&!Aa?Oe.collapseToEnd():rt.isBackward(Ce)?Oe.setBaseAndExtent(Re.endContainer,Re.endOffset,Re.startContainer,Re.startOffset):Oe.setBaseAndExtent(Re.startContainer,Re.startOffset,Re.endContainer,Re.endOffset),f(g,Re)):Oe.removeAllRanges(),Re}};Oe.rangeCount<=1&&X();var We=((ue=R.current)===null||ue===void 0?void 0:ue.isFlushing())==="action";if(!Aa||!We){setTimeout(()=>{P.isUpdatingSelection=!1});return}var ft=null,be=requestAnimationFrame(()=>{if(We){var Le=at=>{try{var Me=bt.toDOMNode(g,g);Me.focus(),X(at)}catch{}};Le(),ft=setTimeout(()=>{Le(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(be),ft&&clearTimeout(ft)}}});var ne=H.useCallback(ee=>{Uy(g,ee);var ue=bt.toDOMNode(g,g),de=ue.getRootNode();if(k!=null&&k.current&&Hl&&de instanceof ShadowRoot){var Ce=ee.getTargetRanges(),pe=Ce[0],Oe=new window.Range;Oe.setStart(pe.startContainer,pe.startOffset),Oe.setEnd(pe.endContainer,pe.endOffset);var X=bt.toSlateRange(g,Oe,{exactMatch:!1,suppressThrow:!1});ct.select(g,X),ee.preventDefault(),ee.stopImmediatePropagation();return}if(j(),!o&&bt.hasEditableTarget(g,ee.target)&&!hie(ee,a)){var We;if(R.current)return R.current.handleDOMBeforeInput(ee);te.flush(),q.flush();var{selection:ft}=g,{inputType:be}=ee,Le=ee.dataTransfer||ee.data||void 0,at=be==="insertCompositionText"||be==="deleteCompositionText";if(at&&bt.isComposing(g))return;var Me=!1;if(be==="insertText"&&ft&&rt.isCollapsed(ft)&&ee.data&&ee.data.length===1&&/[a-z ]/i.test(ee.data)&&ft.anchor.offset!==0&&(Me=!0,g.marks&&(Me=!1),!Ec.get(g))){var it,mt,{anchor:ze}=ft,[lt,le]=bt.toDOMPoint(g,ze),ge=(it=lt.parentElement)===null||it===void 0?void 0:it.closest("a"),ve=bt.getWindow(g);if(Me&&ge&&bt.hasDOMNode(g,ge)){var Re,Ke=ve?.document.createTreeWalker(ge,NodeFilter.SHOW_TEXT).lastChild();Ke===lt&&((Re=Ke.textContent)===null||Re===void 0?void 0:Re.length)===le&&(Me=!1)}if(Me&&lt.parentElement&&(ve==null||(mt=ve.getComputedStyle(lt.parentElement))===null||mt===void 0?void 0:mt.whiteSpace)==="pre"){var Se=z.above(g,{at:ze.path,match:wt=>De.isElement(wt)&&z.isBlock(g,wt)});Se&&De.string(Se[0]).includes(" ")&&(Me=!1)}}if((!be.startsWith("delete")||be.startsWith("deleteBy"))&&!Ec.get(g)){var[Ge]=ee.getTargetRanges();if(Ge){var Be=bt.toSlateRange(g,Ge,{exactMatch:!1,suppressThrow:!1});if(!ft||!rt.equals(ft,Be)){Me=!1;var qe=!at&&g.selection&&z.rangeRef(g,g.selection);ct.select(g,Be),qe&&nf.set(g,qe)}}}if(at)return;if(Me||ee.preventDefault(),ft&&rt.isExpanded(ft)&&be.startsWith("delete")){var Je=be.endsWith("Backward")?"backward":"forward";z.deleteFragment(g,{direction:Je});return}switch(be){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{z.deleteFragment(g);break}case"deleteContent":case"deleteContentForward":{z.deleteForward(g);break}case"deleteContentBackward":{z.deleteBackward(g);break}case"deleteEntireSoftLine":{z.deleteBackward(g,{unit:"line"}),z.deleteForward(g,{unit:"line"});break}case"deleteHardLineBackward":{z.deleteBackward(g,{unit:"block"});break}case"deleteSoftLineBackward":{z.deleteBackward(g,{unit:"line"});break}case"deleteHardLineForward":{z.deleteForward(g,{unit:"block"});break}case"deleteSoftLineForward":{z.deleteForward(g,{unit:"line"});break}case"deleteWordBackward":{z.deleteBackward(g,{unit:"word"});break}case"deleteWordForward":{z.deleteForward(g,{unit:"word"});break}case"insertLineBreak":z.insertSoftBreak(g);break;case"insertParagraph":{z.insertBreak(g);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{be==="insertFromComposition"&&bt.isComposing(g)&&(B(!1),$l.set(g,!1)),Le?.constructor.name==="DataTransfer"?bt.insertData(g,Le):typeof Le=="string"&&(Me?F.current.push(()=>z.insertText(g,Le)):z.insertText(g,Le));break}}var Pt=(We=nf.get(g))===null||We===void 0?void 0:We.unref();nf.delete(g),Pt&&(!g.selection||!rt.equals(g.selection,Pt))&&ct.select(g,Pt)}},[g,q,j,a,o,te]),Z=H.useCallback(ee=>{ee==null?(q.cancel(),te.cancel(),rf.delete(g),eu.delete(g),E.current&&HA&&E.current.removeEventListener("beforeinput",ne)):HA&&ee.addEventListener("beforeinput",ne),E.current=ee,typeof e=="function"?e(ee):e&&(e.current=ee)},[q,te,g,ne,e]);CA(()=>{var ee=bt.getWindow(g),ue=Ce=>{var{target:pe}=Ce,Oe=pe instanceof HTMLElement?pe:null,X=Oe?.tagName;X==="INPUT"||X==="TEXTAREA"||te()};ee.document.addEventListener("selectionchange",ue);var de=()=>{P.isDraggingInternally=!1};return ee.document.addEventListener("dragend",de),ee.document.addEventListener("drop",de),()=>{ee.document.removeEventListener("selectionchange",ue),ee.document.removeEventListener("dragend",de),ee.document.removeEventListener("drop",de)}},[te,P]);var W=i([g,[]]),se=Tne(i),J=s&&g.children.length===1&&Array.from(De.texts(g)).length===1&&De.string(g)===""&&!b,T=H.useCallback(ee=>{if(ee&&J){var ue;I((ue=ee.getBoundingClientRect())===null||ue===void 0?void 0:ue.height)}else I(void 0)},[J]);if(J){var _=z.start(g,[]);W.push({[Mc]:!0,placeholder:s,onPlaceholderResize:T,anchor:_,focus:_})}var{marks:G}=g;if(P.hasMarkPlaceholder=!1,g.selection&&rt.isCollapsed(g.selection)&&G){var{anchor:re}=g.selection,he=De.leaf(g,re.path),Ae=n2(he,oie);if(!pA.equals(he,G,{loose:!0})){P.hasMarkPlaceholder=!0;var Ee=Object.fromEntries(Object.keys(Ae).map(ee=>[ee,null]));W.push(Eo(Eo(Eo({[HT]:!0},Ee),G),{},{anchor:re,focus:re}))}}return H.useEffect(()=>{setTimeout(()=>{var{selection:ee}=g;if(ee){var{anchor:ue}=ee,de=De.leaf(g,ue.path);if(G&&!pA.equals(de,G,{loose:!0})){$s.set(g,G);return}}$s.delete(g)})}),Jne(),H.createElement(oM.Provider,{value:o},H.createElement(aie.Provider,{value:b},H.createElement(eM.Provider,{value:se},H.createElement(iie,{node:E,receivedUserInput:D},H.createElement(p,Eo(Eo({role:o?void 0:"textbox","aria-multiline":o?void 0:!0,translate:"no"},w),{},{spellCheck:HA||!v0?w.spellCheck:!1,autoCorrect:HA||!v0?w.autoCorrect:"false",autoCapitalize:HA||!v0?w.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!o,zindex:-1,suppressContentEditableWarning:!0,ref:Z,style:Eo(Eo({},C?{}:Eo({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},O?{minHeight:O}:{})),v),onBeforeInput:H.useCallback(ee=>{if(!HA&&!o&&!Ca(ee,w.onBeforeInput)&&bt.hasSelectableTarget(g,ee.target)&&(ee.preventDefault(),!bt.isComposing(g))){var ue=ee.data;z.insertText(g,ue)}},[w.onBeforeInput,g,o]),onInput:H.useCallback(ee=>{if(!Ca(ee,w.onInput)){if(R.current){R.current.handleInput();return}for(var ue of F.current)ue();F.current=[],bt.isFocused(g)||Uy(g,ee.nativeEvent)}},[w.onInput,g]),onBlur:H.useCallback(ee=>{if(!(o||P.isUpdatingSelection||!bt.hasSelectableTarget(g,ee.target)||Ca(ee,w.onBlur))){var ue=bt.findDocumentOrShadowRoot(g);if(P.latestElement!==ue.activeElement){var{relatedTarget:de}=ee,Ce=bt.toDOMNode(g,g);if(de!==Ce&&!(ms(de)&&de.hasAttribute("data-slate-spacer"))){if(de!=null&&dl(de)&&bt.hasDOMNode(g,de)){var pe=bt.toSlateNode(g,de);if(De.isElement(pe)&&!g.isVoid(pe))return}if(Hl){var Oe=ef(ue);Oe?.removeAllRanges()}nl.delete(g)}}}},[o,P.isUpdatingSelection,P.latestElement,g,w.onBlur]),onClick:H.useCallback(ee=>{if(bt.hasTarget(g,ee.target)&&!Ca(ee,w.onClick)&&dl(ee.target)){var ue=bt.toSlateNode(g,ee.target),de=bt.findPath(g,ue);if(!z.hasPath(g,de)||De.get(g,de)!==ue)return;if(ee.detail===Ore&&de.length>=1){var Ce=de;if(!(De.isElement(ue)&&z.isBlock(g,ue))){var pe,Oe=z.above(g,{match:Me=>De.isElement(Me)&&z.isBlock(g,Me),at:de});Ce=(pe=Oe?.[1])!==null&&pe!==void 0?pe:de.slice(0,1)}var X=z.range(g,Ce);ct.select(g,X);return}if(o)return;var We=z.start(g,de),ft=z.end(g,de),be=z.void(g,{at:We}),Le=z.void(g,{at:ft});if(be&&Le&&xe.equals(be[1],Le[1])){var at=z.range(g,We);ct.select(g,at)}}},[g,w.onClick,o]),onCompositionEnd:H.useCallback(ee=>{if(!g1(ee)&&bt.hasSelectableTarget(g,ee.target)){var ue;if(bt.isComposing(g)&&Promise.resolve().then(()=>{B(!1),$l.set(g,!1)}),(ue=R.current)===null||ue===void 0||ue.handleCompositionEnd(ee),Ca(ee,w.onCompositionEnd)||Aa)return;if(!Hl&&!mre&&!pre&&!Cre&&!wre&&ee.data){var de=$s.get(g);$s.delete(g),de!==void 0&&(hA.set(g,g.marks),g.marks=de),z.insertText(g,ee.data);var Ce=hA.get(g);hA.delete(g),Ce!==void 0&&(g.marks=Ce)}}},[w.onCompositionEnd,g]),onCompositionUpdate:H.useCallback(ee=>{bt.hasSelectableTarget(g,ee.target)&&!Ca(ee,w.onCompositionUpdate)&&!g1(ee)&&(bt.isComposing(g)||(B(!0),$l.set(g,!0)))},[w.onCompositionUpdate,g]),onCompositionStart:H.useCallback(ee=>{if(!g1(ee)&&bt.hasSelectableTarget(g,ee.target)){var ue;if((ue=R.current)===null||ue===void 0||ue.handleCompositionStart(ee),Ca(ee,w.onCompositionStart)||Aa)return;B(!0);var{selection:de}=g;if(de&&rt.isExpanded(de)){z.deleteFragment(g);return}}},[w.onCompositionStart,g]),onCopy:H.useCallback(ee=>{bt.hasSelectableTarget(g,ee.target)&&!Ca(ee,w.onCopy)&&!g1(ee)&&(ee.preventDefault(),bt.setFragmentData(g,ee.clipboardData,"copy"))},[w.onCopy,g]),onCut:H.useCallback(ee=>{if(!o&&bt.hasSelectableTarget(g,ee.target)&&!Ca(ee,w.onCut)&&!g1(ee)){ee.preventDefault(),bt.setFragmentData(g,ee.clipboardData,"cut");var{selection:ue}=g;if(ue)if(rt.isExpanded(ue))z.deleteFragment(g);else{var de=De.parent(g,ue.anchor.path);z.isVoid(g,de)&&ct.delete(g)}}},[o,g,w.onCut]),onDragOver:H.useCallback(ee=>{if(bt.hasTarget(g,ee.target)&&!Ca(ee,w.onDragOver)){var ue=bt.toSlateNode(g,ee.target);De.isElement(ue)&&z.isVoid(g,ue)&&ee.preventDefault()}},[w.onDragOver,g]),onDragStart:H.useCallback(ee=>{if(!o&&bt.hasTarget(g,ee.target)&&!Ca(ee,w.onDragStart)){var ue=bt.toSlateNode(g,ee.target),de=bt.findPath(g,ue),Ce=De.isElement(ue)&&z.isVoid(g,ue)||z.void(g,{at:de,voids:!0});if(Ce){var pe=z.range(g,de);ct.select(g,pe)}P.isDraggingInternally=!0,bt.setFragmentData(g,ee.dataTransfer,"drag")}},[o,g,w.onDragStart,P]),onDrop:H.useCallback(ee=>{if(!o&&bt.hasTarget(g,ee.target)&&!Ca(ee,w.onDrop)){ee.preventDefault();var ue=g.selection,de=bt.findEventRange(g,ee),Ce=ee.dataTransfer;ct.select(g,de),P.isDraggingInternally&&ue&&!rt.equals(ue,de)&&!z.void(g,{at:de,voids:!0})&&ct.delete(g,{at:ue}),bt.insertData(g,Ce),bt.isFocused(g)||bt.focus(g)}},[o,g,w.onDrop,P]),onDragEnd:H.useCallback(ee=>{!o&&P.isDraggingInternally&&w.onDragEnd&&bt.hasTarget(g,ee.target)&&w.onDragEnd(ee)},[o,P,w,g]),onFocus:H.useCallback(ee=>{if(!o&&!P.isUpdatingSelection&&bt.hasEditableTarget(g,ee.target)&&!Ca(ee,w.onFocus)){var ue=bt.toDOMNode(g,g),de=bt.findDocumentOrShadowRoot(g);if(P.latestElement=de.activeElement,dc&&ee.target!==ue){ue.focus();return}nl.set(g,!0)}},[o,P,g,w.onFocus]),onKeyDown:H.useCallback(ee=>{if(!o&&bt.hasEditableTarget(g,ee.target)){var ue;(ue=R.current)===null||ue===void 0||ue.handleKeyDown(ee);var{nativeEvent:de}=ee;if(bt.isComposing(g)&&de.isComposing===!1&&($l.set(g,!1),B(!1)),Ca(ee,w.onKeyDown)||bt.isComposing(g))return;var{selection:Ce}=g,pe=g.children[Ce!==null?Ce.focus.path[0]:0],Oe=IT(De.string(pe))==="rtl";if(ei.isRedo(de)){ee.preventDefault();var X=g;typeof X.redo=="function"&&X.redo();return}if(ei.isUndo(de)){ee.preventDefault();var We=g;typeof We.undo=="function"&&We.undo();return}if(ei.isMoveLineBackward(de)){ee.preventDefault(),ct.move(g,{unit:"line",reverse:!0});return}if(ei.isMoveLineForward(de)){ee.preventDefault(),ct.move(g,{unit:"line"});return}if(ei.isExtendLineBackward(de)){ee.preventDefault(),ct.move(g,{unit:"line",edge:"focus",reverse:!0});return}if(ei.isExtendLineForward(de)){ee.preventDefault(),ct.move(g,{unit:"line",edge:"focus"});return}if(ei.isMoveBackward(de)){ee.preventDefault(),Ce&&rt.isCollapsed(Ce)?ct.move(g,{reverse:!Oe}):ct.collapse(g,{edge:Oe?"end":"start"});return}if(ei.isMoveForward(de)){ee.preventDefault(),Ce&&rt.isCollapsed(Ce)?ct.move(g,{reverse:Oe}):ct.collapse(g,{edge:Oe?"start":"end"});return}if(ei.isMoveWordBackward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)&&ct.collapse(g,{edge:"focus"}),ct.move(g,{unit:"word",reverse:!Oe});return}if(ei.isMoveWordForward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)&&ct.collapse(g,{edge:"focus"}),ct.move(g,{unit:"word",reverse:Oe});return}if(HA){if((k7||Hl)&&Ce&&(ei.isDeleteBackward(de)||ei.isDeleteForward(de))&&rt.isCollapsed(Ce)){var ft=De.parent(g,Ce.anchor.path);if(De.isElement(ft)&&z.isVoid(g,ft)&&(z.isInline(g,ft)||z.isBlock(g,ft))){ee.preventDefault(),z.deleteBackward(g,{unit:"block"});return}}}else{if(ei.isBold(de)||ei.isItalic(de)||ei.isTransposeCharacter(de)){ee.preventDefault();return}if(ei.isSoftBreak(de)){ee.preventDefault(),z.insertSoftBreak(g);return}if(ei.isSplitBlock(de)){ee.preventDefault(),z.insertBreak(g);return}if(ei.isDeleteBackward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)?z.deleteFragment(g,{direction:"backward"}):z.deleteBackward(g);return}if(ei.isDeleteForward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)?z.deleteFragment(g,{direction:"forward"}):z.deleteForward(g);return}if(ei.isDeleteLineBackward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)?z.deleteFragment(g,{direction:"backward"}):z.deleteBackward(g,{unit:"line"});return}if(ei.isDeleteLineForward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)?z.deleteFragment(g,{direction:"forward"}):z.deleteForward(g,{unit:"line"});return}if(ei.isDeleteWordBackward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)?z.deleteFragment(g,{direction:"backward"}):z.deleteBackward(g,{unit:"word"});return}if(ei.isDeleteWordForward(de)){ee.preventDefault(),Ce&&rt.isExpanded(Ce)?z.deleteFragment(g,{direction:"forward"}):z.deleteForward(g,{unit:"word"});return}}}},[o,g,w.onKeyDown]),onPaste:H.useCallback(ee=>{!o&&bt.hasEditableTarget(g,ee.target)&&!Ca(ee,w.onPaste)&&(!HA||ore(ee.nativeEvent)||Hl)&&(ee.preventDefault(),bt.insertData(g,ee.clipboardData))},[o,g,w.onPaste])}),H.createElement(Aie,{decorations:W,node:g,renderElement:A,renderChunk:l,renderPlaceholder:d,renderLeaf:u,renderText:c}))))))}),uie=t=>{var{attributes:e,children:r}=t;return H.createElement("span",Eo({},e),r,Aa&&H.createElement("br",null))},cie=()=>[],fie=(t,e)=>{var r=!!t.selection&&rt.isBackward(t.selection),n=e.cloneRange();if(n.collapse(r),n.getBoundingClientRect){var i=n.startContainer.parentElement,a=n.getBoundingClientRect(),s=a.width===0&&a.height===0&&a.x===0&&a.y===0;if(s){var o=i.getBoundingClientRect(),A=o.width>0||o.height>0;if(A)return}i.getBoundingClientRect=n.getBoundingClientRect.bind(n),nre(i,{scrollMode:"if-needed"}),delete i.getBoundingClientRect}},Ca=(t,e)=>{if(!e)return!1;var r=e(t);return r??(t.isDefaultPrevented()||t.isPropagationStopped())},g1=t=>dl(t.target)&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement),hie=(t,e)=>{if(!e)return!1;var r=e(t);return r??t.defaultPrevented},Uy=(t,e)=>{var r=t;if(e.inputType==="historyUndo"&&typeof r.undo=="function"){r.undo();return}if(e.inputType==="historyRedo"&&typeof r.redo=="function"){r.redo();return}},die=H.createContext(!1),lM=parseInt(H.version.split(".")[0],10),pie=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],gie=t=>{var{editor:e,children:r,onChange:n,onSelectionChange:i,onValueChange:a,initialValue:s}=t,o=n2(t,pie);H.useState(()=>{if(!De.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ri.stringify(s)));if(!z.isEditor(e))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ri.stringify(e)));e.children=s,Object.assign(e,o)});var{selectorContext:A,onChange:l}=Zne(),u=H.useCallback(()=>{n&&n(e.children),i&&e.operations.find(f=>f.type==="set_selection")&&i(e.selection),a&&e.operations.find(f=>f.type!=="set_selection")&&a(e.children),l()},[e,l,n,i,a]);H.useEffect(()=>(pm.set(e,u),()=>{pm.set(e,()=>{})}),[e,u]);var[c,d]=H.useState(bt.isFocused(e));return H.useEffect(()=>{d(bt.isFocused(e))},[e]),CA(()=>{var f=()=>d(bt.isFocused(e));return lM>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),H.createElement(R7.Provider,{value:A},H.createElement(P7.Provider,{value:e},H.createElement(die.Provider,{value:c},r)))},vie=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",n=e;n=kre(n,r);var{onChange:i,apply:a,insertText:s}=n;return n.getChunkSize=()=>null,Aa&&(n.insertText=(o,A)=>(uA.delete(n),s(o,A))),n.onChange=o=>{var A=lM<18?m8.unstable_batchedUpdates:l=>l();A(()=>{i(o)})},n.apply=o=>{if(o.type==="move_node"){var A=De.parent(n,o.path),l=!!n.getChunkSize(A);if(l){var u=De.get(n,o.path),c=iM(n,A),d=bt.findKey(n,u);c.movedNodeKeys.add(d)}}a(o)},n};function _y(t){return Object.prototype.toString.call(t)==="[object Object]"}function mie(t){var e,r;return _y(t)===!1?!1:(e=t.constructor,e===void 0?!0:(r=e.prototype,!(_y(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}var wie={isHistory(t){return mie(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(t.redos.length===0||rl.isOperationList(t.redos[0].operations))&&(t.undos.length===0||rl.isOperationList(t.undos[0].operations))}},qp=new WeakMap,Nl=new WeakMap,dd=new WeakMap,Do={isHistoryEditor(t){return wie.isHistory(t.history)&&z.isEditor(t)},isMerging(t){return Nl.get(t)},isSplittingOnce(t){return dd.get(t)},setSplittingOnce(t,e){dd.set(t,e)},isSaving(t){return qp.get(t)},redo(t){t.redo()},undo(t){t.undo()},withMerging(t,e){var r=Do.isMerging(t);Nl.set(t,!0),e(),Nl.set(t,r)},withNewBatch(t,e){var r=Do.isMerging(t);Nl.set(t,!0),dd.set(t,!0),e(),Nl.set(t,r),dd.delete(t)},withoutMerging(t,e){var r=Do.isMerging(t);Nl.set(t,!1),e(),Nl.set(t,r)},withoutSaving(t,e){var r=Do.isSaving(t);qp.set(t,!1);try{e()}finally{qp.set(t,r)}}},Cie=t=>{var e=t,{apply:r}=e;return e.history={undos:[],redos:[]},e.redo=()=>{var{history:n}=e,{redos:i}=n;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&ct.setSelection(e,a.selectionBefore),Do.withoutSaving(e,()=>{z.withoutNormalizing(e,()=>{for(var s of a.operations)e.apply(s)})}),n.redos.pop(),e.writeHistory("undos",a)}},e.undo=()=>{var{history:n}=e,{undos:i}=n;if(i.length>0){var a=i[i.length-1];Do.withoutSaving(e,()=>{z.withoutNormalizing(e,()=>{var s=a.operations.map(rl.inverse).reverse();for(var o of s)e.apply(o);a.selectionBefore&&ct.setSelection(e,a.selectionBefore)})}),e.writeHistory("redos",a),n.undos.pop()}},e.apply=n=>{var{operations:i,history:a}=e,{undos:s}=a,o=s[s.length-1],A=o&&o.operations[o.operations.length-1],l=Do.isSaving(e),u=Do.isMerging(e);if(l==null&&(l=bie(n)),l){if(u==null&&(o==null?u=!1:i.length!==0?u=!0:u=yie(n,A)),Do.isSplittingOnce(e)&&(u=!1,Do.setSplittingOnce(e,void 0)),o&&u)o.operations.push(n);else{var c={operations:[n],selectionBefore:e.selection};e.writeHistory("undos",c)}for(;s.length>100;)s.shift();a.redos=[]}r(n)},e.writeHistory=(n,i)=>{e.history[n].push(i)},e},yie=(t,e)=>!!(e&&t.type==="insert_text"&&e.type==="insert_text"&&t.offset===e.offset+e.text.length&&xe.equals(t.path,e.path)||e&&t.type==="remove_text"&&e.type==="remove_text"&&t.offset+t.text.length===e.offset&&xe.equals(t.path,e.path)),bie=(t,e)=>t.type!=="set_selection";const zp=[{type:"paragraph",children:[{text:""}]}],Bie=t=>t!==null&&typeof t=="object"&&typeof t.text=="string",xie=t=>{if(t===null||typeof t!="object"||t.type!=="paragraph")return!1;const e=t.children;return Array.isArray(e)&&e.every(Bie)},Mf=t=>{if(!t.trim())return zp;try{const e=JSON.parse(t);if(Array.isArray(e)&&e.every(xie))return e.length>0?e:zp}catch{const e=t.split(`
217
- `);return(e.length>0?e:[""]).map(r=>({type:"paragraph",children:[{text:r}]}))}return zp},w0=t=>JSON.stringify(t),uM=()=>h.jsxs("svg",{height:"14vh",viewBox:"0 0 2551 599",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M97.4727 185.493L98.1824 196.042C98.2021 196.336 98.3215 196.614 98.5206 196.831C99.1163 197.48 100.172 197.358 100.604 196.591L104.463 189.742C104.647 189.415 104.857 189.104 105.091 188.811L124.535 164.444L163.624 120.469L178.566 105.907C181.707 102.847 185.198 100.167 188.966 97.9237L190.02 97.2965C192.546 95.7932 195.216 94.5487 197.992 93.582C202.61 91.9734 207.466 91.152 212.356 91.152H216.119L219.852 91.6643C225.803 92.4812 231.488 94.6532 236.468 98.0132C238.35 99.2833 240.119 100.714 241.754 102.29L242.13 102.653C247.108 107.451 250.92 113.324 253.275 119.824L255.96 127.234C258.371 134.551 259.788 142.159 260.173 149.854L260.345 153.294L262.062 165.924C262.086 166.105 262.145 166.281 262.234 166.441C262.756 167.381 264.076 167.463 264.711 166.595L272.874 155.424L315.221 97.4163L340.779 61.4591L353.156 40.9814C354.087 39.4405 355.245 38.0487 356.59 36.8526L358.652 35.0204C360.382 33.4822 361.533 31.3976 361.914 29.1138C362.023 28.4615 362.195 27.8213 362.429 27.2025L363.194 25.174C364.116 22.7302 365.352 20.4165 366.87 18.291C368.264 16.3398 369.885 14.5617 371.7 12.9944L375.25 9.92858C378.38 7.22562 382.025 5.18447 385.965 3.92821C387.743 3.3611 389.57 2.95779 391.422 2.72332L393.095 2.51158C396.706 2.05446 400.362 2.08739 403.964 2.60948C406.105 2.91983 408.218 3.40168 410.282 4.05038L411.152 4.32386C414.335 5.32418 417.357 6.7767 420.127 8.63687L420.412 8.82855C423.02 10.5803 425.36 12.7014 427.359 15.1254C429.266 17.4382 430.844 20.004 432.047 22.7496L432.665 24.1609C434.291 27.8711 435.313 31.8172 435.694 35.85L435.802 36.9936C436.179 40.9904 435.8 45.0224 434.685 48.879C433.81 51.904 432.493 54.7831 430.777 57.4233L428.479 60.9586C421.995 68.5236 416.576 76.9405 412.374 85.9749L411.19 88.5216L397.283 116.962L384.128 142.52L375.609 160.937L355.062 197.27L335.893 229.97L326.246 242.874L325.049 244.228C315.011 255.578 303.918 265.948 291.917 275.198L283.523 280.711L281.45 281.917C277.252 284.361 272.766 286.272 268.096 287.606L267.689 287.723C262.734 289.138 257.605 289.857 252.452 289.857L245.051 289.268C242.639 289.076 240.244 288.7 237.889 288.142C233.916 287.201 230.082 285.751 226.481 283.827L226.31 283.735C223.947 282.473 221.691 281.018 219.567 279.386L214.114 275.198L209.879 270.962C207.446 268.53 205.246 265.874 203.308 263.032C201.495 260.373 199.918 257.561 198.596 254.628L193.693 243.751L189.882 231.09C189.834 230.931 189.747 230.785 189.629 230.667C189.154 230.192 188.356 230.303 188.03 230.891L171.893 259.913L158.613 281.838L144.706 303.262L139.193 311.281L130.924 320.301L122.405 328.695L119.92 330.597C113.426 335.567 106.244 339.569 98.6004 342.477C91.946 344.224 85.0948 345.108 78.215 345.108H75.5477L70.4907 344.673C66.1148 344.297 61.8109 343.324 57.6986 341.782C54.4893 340.578 51.4175 339.036 48.5354 337.181L46.8387 336.089C43.6011 334.004 40.5721 331.613 37.7937 328.947C34.4095 325.7 31.4185 322.067 28.8823 318.122L27.7015 316.285C25.026 312.123 22.7504 307.717 20.9055 303.126L18.2918 296.622C13.788 284.362 10.2229 271.777 7.62738 258.976L6.01377 251.018L2.1299 224.958L0.877018 210.425L0 182.11L0.877018 166.074L3.63335 150.914L4.04047 149.092C5.51648 142.485 7.86538 136.104 11.0253 130.117L12.5537 127.843C14.9445 124.286 17.8771 121.125 21.2453 118.474L21.3289 118.408C22.9767 117.112 24.7245 115.948 26.556 114.927C29.8006 113.119 33.2827 111.774 36.9006 110.933L37.3853 110.82C40.5989 110.072 43.8875 109.695 47.1869 109.695H48.4125C53.1843 109.695 57.918 110.544 62.3926 112.201L67.1788 114.743C69.3282 115.885 71.359 117.238 73.2411 118.781C75.5222 120.652 77.5699 122.79 79.3399 125.15L80.4334 126.608C82.1846 128.943 83.7355 131.422 85.0695 134.018L85.1578 134.189C86.8484 137.479 88.1974 140.934 89.1835 144.499L90.9579 150.914L93.9648 165.072L95.3429 174.218L97.4727 185.493Z",fill:"var(--logoduotone-firstcolor)"}),h.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M398.287 263.487C420.774 251.477 432.017 245.471 433.905 237.605C434.793 233.904 434.485 230.016 433.025 226.501C429.922 219.03 417.903 214.881 393.866 206.583L366.132 197.009C336.381 186.739 321.506 181.604 313.555 189.4C305.605 197.196 310.447 212.169 320.131 242.116L329.407 270.8C337.139 294.708 341.005 306.663 348.175 309.964C351.915 311.685 356.131 312.073 360.122 311.063C367.774 309.125 373.756 298.076 385.719 275.979C387.529 272.635 388.435 270.963 389.643 269.537C390.304 268.758 391.029 268.036 391.812 267.38C393.245 266.18 394.926 265.282 398.287 263.487Z",fill:"var(--logoduotone-secondcolor)"}),h.jsx("path",{d:"M662.494 353.246C656.101 353.246 650.918 348.063 650.918 341.67V295.243C650.918 288.85 656.101 283.667 662.494 283.667H753.145C771.7 283.667 787.221 279.742 799.71 271.892C812.198 264.042 821.475 252.268 827.541 236.568C833.964 220.868 837.175 201.243 837.175 177.693C837.175 158.782 835.213 142.547 831.288 128.988C827.363 115.429 821.475 104.368 813.625 95.8046C806.132 86.8842 796.32 80.2832 784.188 76.0014C772.413 71.7196 758.498 69.5787 742.441 69.5787H662.494C656.101 69.5787 650.918 64.3959 650.918 58.0026C650.918 51.6093 650.918 11.5761 650.918 11.5761C650.918 5.18281 656.101 0 662.494 0H739.23C783.118 0 818.977 6.95787 846.809 20.8736C874.64 34.7894 894.979 54.771 907.824 80.8184C920.669 106.509 927.092 137.373 927.092 173.412C927.092 201.243 923.702 225.328 916.923 245.666C910.5 266.005 901.58 283.132 890.162 297.048C878.744 310.607 865.542 321.668 850.556 330.231C835.926 338.438 820.405 344.326 803.991 347.894C787.935 351.462 771.878 353.246 755.821 353.246H662.494ZM622.353 353.246C615.959 353.246 610.776 348.063 610.776 341.67V11.5761C610.776 5.18281 615.959 0 622.353 0H685.371C691.764 0 696.947 5.1828 696.947 11.5761V341.67C696.947 348.063 691.764 353.246 685.371 353.246H622.353Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M958.513 353.246C952.12 353.246 946.937 348.063 946.937 341.67V82.2253C946.937 75.832 952.12 70.6492 958.513 70.6492H1006.2C1012.52 70.6492 1017.67 75.7145 1017.78 82.0313L1019.1 160.88C1019.15 163.973 1021.67 166.454 1024.77 166.454C1027.68 166.454 1030.11 164.244 1030.44 161.351C1033.05 138.765 1037.5 120.663 1043.81 107.044C1050.95 92.058 1060.94 81.1752 1073.78 74.3957C1086.99 67.6163 1103.22 64.2265 1122.49 64.2265C1125.34 64.2265 1128.56 64.4049 1132.12 64.7617C1132.8 64.7617 1133.49 64.7745 1134.2 64.8C1140.07 65.0097 1144.28 70.2495 1144.08 76.113L1141.85 139.881C1141.56 148.306 1132.41 153.819 1124.05 152.722C1123.53 152.654 1123.01 152.593 1122.49 152.538C1116.07 151.468 1110.36 150.932 1105.36 150.932C1091.45 150.932 1079.32 153.608 1068.97 158.961C1058.98 164.313 1050.95 172.52 1044.88 183.581C1039.17 194.642 1035.43 208.558 1033.64 225.328V341.67C1033.64 348.063 1028.46 353.246 1022.07 353.246H958.513Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M1223.48 360.739C1207.78 360.739 1193.86 357.706 1181.73 351.64C1169.6 345.218 1160.14 336.119 1153.36 324.344C1146.58 312.212 1143.19 297.583 1143.19 280.456C1143.19 264.399 1146.23 251.197 1152.29 240.849C1158.71 230.145 1167.81 221.76 1179.59 215.694C1191.72 209.271 1206.17 204.098 1222.94 200.173C1239.71 195.891 1258.8 192.144 1280.21 188.933C1290.56 187.149 1299.12 185.543 1305.9 184.116C1313.04 182.332 1318.39 179.656 1321.96 176.088C1325.52 172.52 1327.31 167.346 1327.31 160.566C1327.31 151.646 1324.1 143.974 1317.67 137.552C1311.25 131.129 1300.9 127.918 1286.63 127.918C1276.64 127.918 1267.54 129.702 1259.34 133.27C1251.49 136.838 1244.71 142.012 1239 148.791C1235.56 152.875 1232.64 157.477 1230.23 162.596C1227.52 168.382 1221.19 171.943 1215.06 170.13L1161.39 154.257C1155.21 152.428 1151.66 145.871 1154.04 139.875C1158.17 129.446 1163.3 120.108 1169.42 111.861C1177.98 100.8 1188.15 91.7012 1199.93 84.5649C1211.7 77.0718 1225.08 71.7196 1240.07 68.5083C1255.41 64.9402 1271.65 63.1561 1288.77 63.1561C1317.32 63.1561 1340.51 67.7947 1358.35 77.0718C1376.55 85.9922 1389.93 100.086 1398.49 119.354C1407.41 138.265 1411.87 162.707 1411.87 192.68V236.033C1411.87 248.878 1412.05 261.902 1412.41 275.104C1413.12 287.949 1413.84 300.973 1414.55 314.175C1415.27 322.842 1416.08 331.591 1416.96 340.42C1417.65 347.272 1412.29 353.246 1405.4 353.246H1352.03C1346.4 353.246 1341.58 349.2 1340.73 343.636C1339.83 337.676 1338.92 331.067 1338.01 323.809C1336.82 313.926 1335.87 303.917 1335.17 293.783C1334.95 290.508 1332.24 287.949 1328.96 287.949C1326.36 287.949 1324.05 289.574 1323.07 291.979C1318.15 303.991 1311.36 315.136 1302.69 325.414C1293.41 336.476 1281.99 345.218 1268.43 351.64C1255.23 357.706 1240.25 360.739 1223.48 360.739ZM1262.55 299.724C1268.97 299.724 1275.39 298.653 1281.81 296.513C1288.59 294.015 1295.02 290.803 1301.08 286.879C1307.15 282.597 1312.68 277.423 1317.67 271.357C1322.2 265.858 1325.71 259.92 1328.18 253.541C1328.69 252.236 1328.9 250.836 1328.86 249.436L1327.95 213.472C1327.9 211.341 1329.86 209.73 1331.94 210.203C1334.78 210.847 1335.37 214.518 1332.78 215.842C1327.89 218.339 1322.68 220.431 1317.14 222.117C1308.93 224.614 1300.55 226.577 1291.98 228.004C1283.78 229.431 1275.57 231.037 1267.36 232.821C1259.51 234.248 1252.38 236.211 1245.96 238.709C1239.89 241.206 1235.07 244.596 1231.5 248.878C1227.94 253.16 1226.15 259.047 1226.15 266.54C1226.15 276.531 1229.54 284.559 1236.32 290.625C1243.1 296.691 1251.84 299.724 1262.55 299.724Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M1497.86 353.246C1492.52 353.246 1487.87 349.59 1486.61 344.397L1454.5 211.948L1423.72 84.9526C1421.95 77.6667 1427.47 70.6492 1434.97 70.6492H1500.31C1505.99 70.6492 1510.83 74.7703 1511.74 80.3775L1544.08 280.421C1544.59 283.526 1547.27 285.808 1550.41 285.808C1553.46 285.808 1556.09 283.656 1556.7 280.664L1597.14 79.9388C1598.23 74.5355 1602.98 70.6492 1608.49 70.6492H1691.83C1697.31 70.6492 1702.04 74.4927 1703.16 79.8576L1745.08 280.455C1745.73 283.574 1748.48 285.808 1751.67 285.808C1754.99 285.808 1757.81 283.386 1758.32 280.104L1789.11 80.4608C1789.98 74.8156 1794.84 70.6492 1800.55 70.6492H1864.22C1871.71 70.6492 1877.23 77.6667 1875.47 84.9526L1812.57 344.397C1811.31 349.59 1806.66 353.246 1801.32 353.246H1701.25C1695.66 353.246 1690.87 349.254 1689.87 343.758L1653.45 145.198C1652.92 142.319 1650.41 140.228 1647.48 140.228C1644.53 140.228 1642 142.358 1641.5 145.271L1607.62 343.619C1606.67 349.18 1601.85 353.246 1596.21 353.246H1497.86Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M2009.49 360.739C1980.94 360.739 1955.61 355.208 1933.49 344.147C1911.72 333.086 1894.6 316.494 1882.11 294.372C1869.62 272.249 1863.37 244.596 1863.37 211.412C1863.37 178.229 1869.62 150.754 1882.11 128.988C1894.6 106.866 1911.9 90.4524 1934.02 79.7479C1956.15 68.6867 1981.48 63.1561 2010.03 63.1561C2038.57 63.1561 2063.9 68.6867 2086.03 79.7479C2108.15 90.8092 2125.45 107.401 2137.94 129.524C2150.43 151.289 2156.68 178.764 2156.68 211.948C2156.68 245.845 2150.25 273.855 2137.41 295.977C2124.56 318.1 2106.9 334.513 2084.42 345.218C2062.3 355.565 2037.32 360.739 2009.49 360.739ZM2012.17 298.118C2025.01 298.118 2035.72 295.264 2044.28 289.555C2052.84 283.489 2059.27 274.39 2063.55 262.258C2067.83 250.127 2069.97 235.14 2069.97 217.3C2069.97 198.389 2067.65 182.51 2063.01 169.665C2058.37 156.463 2051.42 146.472 2042.14 139.693C2033.22 132.556 2021.62 128.988 2007.35 128.988C1995.22 128.988 1984.69 132.021 1975.77 138.087C1967.21 143.796 1960.79 152.716 1956.5 164.848C1952.22 176.98 1950.08 192.144 1950.08 210.342C1950.08 239.601 1955.43 261.545 1966.14 276.174C1977.2 290.803 1992.54 298.118 2012.17 298.118Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M2212.44 360.204C2193.88 360.204 2179.97 356.279 2170.69 348.429C2161.77 340.579 2157.31 328.447 2157.31 312.034C2157.31 295.264 2161.77 282.954 2170.69 275.104C2179.97 267.254 2193.88 263.329 2212.44 263.329C2231.35 263.329 2245.44 267.254 2254.72 275.104C2264 282.954 2268.63 295.264 2268.63 312.034C2268.63 344.147 2249.9 360.204 2212.44 360.204Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M603.674 565.71V469.556H609.355V509.699H609.918C611.045 506.6 612.641 503.752 614.707 501.154C616.773 498.556 619.34 496.474 622.407 494.909C625.474 493.313 629.058 492.515 633.159 492.515C638.949 492.515 644.004 494.127 648.324 497.351C652.643 500.543 655.992 504.957 658.371 510.591C660.75 516.193 661.939 522.61 661.939 529.84C661.939 537.133 660.75 543.597 658.371 549.231C655.992 554.834 652.659 559.231 648.371 562.424C644.082 565.617 639.027 567.213 633.206 567.213C629.105 567.213 625.521 566.43 622.454 564.865C619.387 563.269 616.82 561.172 614.754 558.574C612.688 555.945 611.076 553.081 609.918 549.982H609.261V565.71H603.674ZM609.308 529.793C609.308 535.928 610.231 541.421 612.078 546.273C613.956 551.093 616.648 554.912 620.153 557.729C623.659 560.515 627.853 561.907 632.736 561.907C637.682 561.907 641.907 560.499 645.413 557.682C648.918 554.834 651.595 550.984 653.441 546.132C655.319 541.281 656.258 535.834 656.258 529.793C656.258 523.752 655.319 518.322 653.441 513.502C651.595 508.681 648.918 504.878 645.413 502.093C641.907 499.276 637.682 497.867 632.736 497.867C627.853 497.867 623.659 499.26 620.153 502.046C616.648 504.8 613.956 508.587 612.078 513.408C610.231 518.197 609.308 523.659 609.308 529.793ZM673.147 592.754C671.707 592.754 670.283 592.597 668.875 592.284C667.466 591.971 666.199 591.564 665.072 591.064L666.762 586.04C669.704 587.167 672.365 587.574 674.744 587.261C677.154 586.948 679.282 585.852 681.129 583.974C682.976 582.096 684.541 579.342 685.824 575.711L689.11 566.696L662.677 493.595H668.828L691.74 558.339H692.209L715.121 493.595H721.272L690.848 577.965C689.69 581.22 688.234 583.943 686.481 586.134C684.728 588.325 682.725 589.968 680.472 591.064C678.249 592.19 675.808 592.754 673.147 592.754Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M886.198 490.56V463.005L804.95 500.439C785.564 509.37 773.147 528.764 773.147 550.108V575.76L853.416 540.668C873.329 531.963 886.198 512.293 886.198 490.56Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M885.734 490.561C885.734 512.109 872.975 531.613 853.231 540.244L773.61 575.052V550.107C773.611 528.944 785.923 509.715 805.144 500.859L885.734 463.729V490.561Z",stroke:"var(--logocolor)","stroke-opacity":"0.22","stroke-width":"0.926904"}),h.jsx("path",{d:"M970.151 576.816C961.375 576.816 952.974 575.585 944.947 573.124C936.92 570.555 930.553 567.291 925.844 563.331L933.068 547.117C937.563 550.649 943.128 553.592 949.763 555.947C956.398 558.301 963.194 559.478 970.151 559.478C976.037 559.478 980.799 558.836 984.438 557.552C988.077 556.268 990.752 554.555 992.465 552.415C994.177 550.167 995.033 547.652 995.033 544.87C995.033 541.445 993.802 538.716 991.341 536.683C988.879 534.542 985.669 532.883 981.709 531.706C977.856 530.422 973.522 529.245 968.706 528.174C963.997 527.104 959.234 525.873 954.418 524.482C949.71 522.984 945.375 521.111 941.415 518.864C937.563 516.509 934.405 513.405 931.944 509.553C929.482 505.7 928.252 500.777 928.252 494.784C928.252 488.683 929.857 483.118 933.068 478.088C936.385 472.951 941.362 468.884 947.997 465.888C954.74 462.784 963.248 461.232 973.522 461.232C980.264 461.232 986.953 462.089 993.588 463.801C1000.22 465.513 1006 467.975 1010.93 471.185L1004.34 487.399C999.314 484.403 994.124 482.209 988.772 480.817C983.421 479.319 978.284 478.57 973.361 478.57C967.582 478.57 962.873 479.266 959.234 480.657C955.703 482.048 953.081 483.868 951.368 486.115C949.763 488.362 948.96 490.931 948.96 493.821C948.96 497.245 950.138 500.028 952.492 502.168C954.954 504.202 958.111 505.807 961.964 506.984C965.923 508.161 970.311 509.339 975.127 510.516C979.943 511.586 984.706 512.817 989.415 514.208C994.231 515.599 998.565 517.419 1002.42 519.666C1006.38 521.914 1009.53 524.964 1011.89 528.817C1014.35 532.669 1015.58 537.539 1015.58 543.425C1015.58 549.418 1013.92 554.983 1010.6 560.12C1007.39 565.15 1002.42 569.217 995.675 572.321C988.933 575.317 980.425 576.816 970.151 576.816ZM1073.36 488.523C1080.21 488.523 1086.31 489.861 1091.66 492.536C1097.12 495.212 1101.4 499.332 1104.5 504.897C1107.6 510.355 1109.16 517.419 1109.16 526.088V575.21H1089.09V528.656C1089.09 521.058 1087.27 515.385 1083.63 511.64C1080.1 507.894 1075.12 506.021 1068.7 506.021C1063.99 506.021 1059.82 506.984 1056.18 508.911C1052.54 510.837 1049.71 513.727 1047.67 517.579C1045.75 521.325 1044.78 526.088 1044.78 531.867V575.21H1024.72V456.095H1044.78V512.603L1040.45 505.539C1043.45 500.081 1047.78 495.907 1053.45 493.018C1059.23 490.021 1065.87 488.523 1073.36 488.523ZM1177.8 575.21V557.873L1176.67 554.181V523.84C1176.67 517.954 1174.91 513.405 1171.37 510.195C1167.84 506.877 1162.49 505.218 1155.32 505.218C1150.51 505.218 1145.74 505.967 1141.03 507.466C1136.43 508.964 1132.53 511.051 1129.31 513.727L1121.45 499.118C1126.05 495.586 1131.51 492.964 1137.82 491.252C1144.24 489.433 1150.88 488.523 1157.73 488.523C1170.14 488.523 1179.72 491.52 1186.46 497.513C1193.31 503.399 1196.74 512.549 1196.74 524.964V575.21H1177.8ZM1150.83 576.334C1144.4 576.334 1138.79 575.264 1133.97 573.124C1129.15 570.876 1125.41 567.826 1122.73 563.973C1120.16 560.013 1118.88 555.572 1118.88 550.649C1118.88 545.833 1120 541.499 1122.25 537.646C1124.61 533.793 1128.41 530.743 1133.65 528.496C1138.89 526.248 1145.85 525.124 1154.52 525.124H1179.4V538.449H1155.96C1149.11 538.449 1144.51 539.572 1142.16 541.82C1139.8 543.96 1138.63 546.636 1138.63 549.846C1138.63 553.485 1140.07 556.375 1142.96 558.515C1145.85 560.656 1149.86 561.726 1155 561.726C1159.92 561.726 1164.31 560.602 1168.16 558.355C1172.12 556.107 1174.96 552.789 1176.67 548.402L1180.04 560.441C1178.12 565.471 1174.64 569.378 1169.61 572.16C1164.69 574.943 1158.42 576.334 1150.83 576.334ZM1212.86 575.21V489.486H1231.96V513.084L1229.72 506.182C1232.28 500.402 1236.3 496.014 1241.76 493.018C1247.32 490.021 1254.22 488.523 1262.46 488.523V507.626C1261.61 507.412 1260.81 507.305 1260.06 507.305C1259.31 507.198 1258.56 507.145 1257.81 507.145C1250.21 507.145 1244.16 509.392 1239.67 513.887C1235.17 518.275 1232.93 524.857 1232.93 533.633V575.21H1212.86ZM1305.35 576.334C1297.11 576.334 1289.67 574.515 1283.04 570.876C1276.51 567.13 1271.37 561.993 1267.63 555.465C1263.88 548.937 1262.01 541.231 1262.01 532.348C1262.01 523.466 1263.88 515.76 1267.63 509.232C1271.37 502.703 1276.51 497.62 1283.04 493.981C1289.67 490.342 1297.11 488.523 1305.35 488.523C1312.52 488.523 1318.94 490.128 1324.61 493.339C1330.29 496.443 1334.78 501.205 1338.1 507.626C1341.42 514.048 1343.08 522.288 1343.08 532.348C1343.08 542.301 1341.47 550.542 1338.26 557.07C1335.05 563.492 1330.61 568.308 1324.94 571.518C1319.26 574.729 1312.74 576.334 1305.35 576.334ZM1307.76 559.157C1312.58 559.157 1316.86 558.087 1320.6 555.947C1324.45 553.806 1327.5 550.703 1329.75 546.636C1332.11 542.569 1333.28 537.806 1333.28 532.348C1333.28 526.783 1332.11 522.021 1329.75 518.061C1327.5 513.994 1324.45 510.89 1320.6 508.75C1316.86 506.61 1312.58 505.539 1307.76 505.539C1302.94 505.539 1298.61 506.61 1294.76 508.75C1291.01 510.89 1287.96 513.994 1285.61 518.061C1283.36 522.021 1282.23 526.783 1282.23 532.348C1282.23 537.806 1283.36 542.569 1285.61 546.636C1287.96 550.703 1291.01 553.806 1294.76 555.947C1298.61 558.087 1302.94 559.157 1307.76 559.157ZM1333.77 575.21V554.983L1334.57 532.188L1332.96 509.392V456.095H1352.87V575.21H1333.77Z",fill:"var(--logocolor)"})]}),cM=()=>h.jsx("div",{className:"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 select-none flex-col items-center justify-center opacity-50",children:h.jsx(uM,{})}),fM=()=>h.jsx(h.Fragment,{});function kt(){return kt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kt.apply(null,arguments)}function Ds(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var gc=255,Xs=100,Q1=t=>{var{r:e,g:r,b:n,a:i}=t,a=Math.max(e,r,n),s=a-Math.min(e,r,n),o=s?a===e?(r-n)/s:a===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(o<0?o+6:o),s:a?s/a*Xs:0,v:a/gc*Xs,a:i}},hM=t=>{var{h:e,s:r,l:n,a:i}=U7(t);return"hsla("+e+", "+r+"%, "+n+"%, "+i+")"},pd=t=>{var{h:e,s:r,l:n,a:i}=t;return r*=(n<50?n:Xs-n)/Xs,{h:e,s:r>0?2*r/(n+r)*Xs:0,v:n+r,a:i}},U7=t=>{var{h:e,s:r,v:n,a:i}=t,a=(200-r)*n/Xs;return{h:e,s:a>0&&a<200?r*n/Xs/(a<=Xs?a:200-a)*Xs:0,l:a/2,a:i}},dM=t=>{var{r:e,g:r,b:n}=t,i=e<<16|r<<8|n;return"#"+(a=>new Array(7-a.length).join("0")+a)(i.toString(16))},pM=t=>{var{r:e,g:r,b:n,a:i}=t,a=typeof i=="number"&&(i*255|256).toString(16).slice(1);return""+dM({r:e,g:r,b:n})+(a||"")},nu=t=>Q1(Eie(t)),Eie=t=>{var e=t.replace("#","");/^#?/.test(t)&&e.length===3&&(t="#"+e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2));var r=new RegExp("[A-Za-z0-9]{2}","g"),[n,i,a=0,s]=t.match(r).map(o=>parseInt(o,16));return{r:n,g:i,b:a,a:(s??255)/gc}},ih=t=>{var{h:e,s:r,v:n,a:i}=t,a=e/60,s=r/Xs,o=n/Xs,A=Math.floor(a)%6,l=a-Math.floor(a),u=gc*o*(1-s),c=gc*o*(1-s*l),d=gc*o*(1-s*(1-l));o*=gc;var f={};switch(A){case 0:f.r=o,f.g=d,f.b=u;break;case 1:f.r=c,f.g=o,f.b=u;break;case 2:f.r=u,f.g=o,f.b=d;break;case 3:f.r=u,f.g=c,f.b=o;break;case 4:f.r=d,f.g=u,f.b=o;break;case 5:f.r=o,f.g=u,f.b=c;break}return f.r=Math.round(f.r),f.g=Math.round(f.g),f.b=Math.round(f.b),kt({},f,{a:i})},Sie=t=>{var{r:e,g:r,b:n,a:i}=ih(t);return"rgba("+e+", "+r+", "+n+", "+i+")"},Fie=t=>{var{r:e,g:r,b:n}=t;return{r:e,g:r,b:n}},Die=t=>{var{h:e,s:r,l:n}=t;return{h:e,s:r,l:n}},_7=t=>dM(ih(t)),Lie=t=>pM(ih(t)),Iie=t=>{var{h:e,s:r,v:n}=t;return{h:e,s:r,v:n}},kie=t=>{var{r:e,g:r,b:n}=t,i=function(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)},a=i(e/255),s=i(r/255),o=i(n/255),A={};return A.x=a*.4124+s*.3576+o*.1805,A.y=a*.2126+s*.7152+o*.0722,A.bri=a*.0193+s*.1192+o*.9505,A},Ys=t=>{var e,r,n,i,a,s,o,A,l;return typeof t=="string"&&Q7(t)?(s=nu(t),A=t):typeof t!="string"&&(s=t),s&&(n=Iie(s),a=U7(s),i=ih(s),l=pM(i),A=_7(s),r=Die(a),e=Fie(i),o=kie(e)),{rgb:e,hsl:r,hsv:n,rgba:i,hsla:a,hsva:s,hex:A,hexa:l,xy:o}},Q7=t=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(t);function Oie(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var Tie=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],gM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-swatch",className:n,color:i,colors:a=[],style:s,rectProps:o={},onChange:A,addonAfter:l,addonBefore:u,rectRender:c}=t,d=Ds(t,Tie),f=kt({"--swatch-background-color":"rgb(144, 19, 254)",background:"var(--swatch-background-color)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},o.style),v=(p,C)=>{A&&A(nu(p),Ys(nu(p)),C)};return h.jsxs("div",kt({ref:e},d,{className:[r,n||""].filter(Boolean).join(" "),style:kt({display:"flex",flexWrap:"wrap",position:"relative"},s),children:[u&&H.isValidElement(u)&&u,a&&Array.isArray(a)&&a.map((p,C)=>{var w="",g="";typeof p=="string"&&(w=p,g=p),typeof p=="object"&&p.color&&(w=p.title||p.color,g=p.color);var b=i&&i.toLocaleLowerCase()===g.toLocaleLowerCase(),B=c&&c({title:w,color:g,checked:!!b,style:kt({},f,{background:g}),onClick:F=>v(g,F)});if(B)return h.jsx(H.Fragment,{children:B},C);var E=o.children&&H.isValidElement(o.children)?H.cloneElement(o.children,{color:g,checked:b}):null;return h.jsx("div",kt({tabIndex:0,title:w,onClick:F=>v(g,F)},o,{children:E,style:kt({},f,{background:g})}),C)}),l&&H.isValidElement(l)&&l]}))});gM.displayName="Swatch";var Mie={marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25};function Nie(t){var{style:e,title:r,checked:n,color:i,onClick:a,rectProps:s}=t,o=H.useRef(null),A=H.useCallback(()=>{o.current.style.zIndex="2",o.current.style.outline="#fff solid 2px",o.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"},[]),l=H.useCallback(()=>{n||(o.current.style.zIndex="0",o.current.style.outline="initial",o.current.style.boxShadow="initial")},[n]),u=n?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0};return h.jsx("div",kt({ref:o,title:r},s,{onClick:a,onMouseEnter:A,onMouseLeave:l,style:kt({},e,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},Mie,u,s?.style)}))}var Pie=["prefixCls","placement","className","style","color","colors","showTriangle","rectProps","onChange","rectRender"],Rie=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],Si=(function(t){return t.Left="L",t.LeftTop="LT",t.LeftBottom="LB",t.Right="R",t.RightTop="RT",t.RightBottom="RB",t.Top="T",t.TopRight="TR",t.TopLeft="TL",t.Bottom="B",t.BottomLeft="BL",t.BottomRight="BR",t})({}),vM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-github",placement:n=Si.TopRight,className:i,style:a,color:s,colors:o=Rie,showTriangle:A=!0,rectProps:l={},onChange:u,rectRender:c}=t,d=Ds(t,Pie),f=typeof s=="string"&&Q7(s)?nu(s):s,v=s?_7(f):"",p=E=>u&&u(Ys(E)),C=kt({"--github-border":"1px solid rgba(0, 0, 0, 0.2)","--github-background-color":"#fff","--github-box-shadow":"rgb(0 0 0 / 15%) 0px 3px 12px","--github-arrow-border-color":"rgba(0, 0, 0, 0.15)",width:200,borderRadius:4,background:"var(--github-background-color)",boxShadow:"var(--github-box-shadow)",border:"var(--github-border)",position:"relative",padding:5},a),w={borderStyle:"solid",position:"absolute"},g=kt({},w),b=kt({},w);/^T/.test(n)&&(g.borderWidth="0 8px 8px",g.borderColor="transparent transparent var(--github-arrow-border-color)",b.borderWidth="0 7px 7px",b.borderColor="transparent transparent var(--github-background-color)"),n===Si.TopRight&&(g.top=-8,b.top=-7),n===Si.Top&&(g.top=-8,b.top=-7),n===Si.TopLeft&&(g.top=-8,b.top=-7),/^B/.test(n)&&(g.borderWidth="8px 8px 0",g.borderColor="var(--github-arrow-border-color) transparent transparent",b.borderWidth="7px 7px 0",b.borderColor="var(--github-background-color) transparent transparent",n===Si.BottomRight&&(g.top="100%",b.top="100%"),n===Si.Bottom&&(g.top="100%",b.top="100%"),n===Si.BottomLeft&&(g.top="100%",b.top="100%")),/^(B|T)/.test(n)&&((n===Si.Top||n===Si.Bottom)&&(g.left="50%",g.marginLeft=-8,b.left="50%",b.marginLeft=-7),(n===Si.TopRight||n===Si.BottomRight)&&(g.right=10,b.right=11),(n===Si.TopLeft||n===Si.BottomLeft)&&(g.left=7,b.left=8)),/^L/.test(n)&&(g.borderWidth="8px 8px 8px 0",g.borderColor="transparent var(--github-arrow-border-color) transparent transparent",b.borderWidth="7px 7px 7px 0",b.borderColor="transparent var(--github-background-color) transparent transparent",g.left=-8,b.left=-7),/^R/.test(n)&&(g.borderWidth="8px 0 8px 8px",g.borderColor="transparent transparent transparent var(--github-arrow-border-color)",b.borderWidth="7px 0 7px 7px",b.borderColor="transparent transparent transparent var(--github-background-color)",g.right=-8,b.right=-7),/^(L|R)/.test(n)&&((n===Si.RightTop||n===Si.LeftTop)&&(g.top=5,b.top=6),(n===Si.Left||n===Si.Right)&&(g.top="50%",b.top="50%",g.marginTop=-8,b.marginTop=-7),(n===Si.LeftBottom||n===Si.RightBottom)&&(g.top="100%",b.top="100%",g.marginTop=-21,b.marginTop=-20));var B=E=>{var F=kt({},(Oie(E),E)),O=c&&c(kt({},F));return O||h.jsx(Nie,kt({},F,{rectProps:l}))};return h.jsx(gM,kt({ref:e,className:[r,i].filter(Boolean).join(" "),colors:o,color:v,rectRender:B},d,{onChange:p,style:C,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:h.jsx(H.Fragment,{children:A&&h.jsxs(H.Fragment,{children:[h.jsx("div",{style:g}),h.jsx("div",{style:b})]})})}))});vM.displayName="Github";function Qy(t){var e=H.useRef(t);return H.useEffect(()=>{e.current=t}),H.useCallback((r,n)=>e.current&&e.current(r,n),[])}var sf=t=>"touches"in t,jy=t=>{!sf(t)&&t.preventDefault&&t.preventDefault()},Hy=function(e,r,n){return r===void 0&&(r=0),n===void 0&&(n=1),e>n?n:e<r?r:e},Ky=(t,e)=>{var r=t.getBoundingClientRect(),n=sf(e)?e.touches[0]:e;return{left:Hy((n.pageX-(r.left+window.pageXOffset))/r.width),top:Hy((n.pageY-(r.top+window.pageYOffset))/r.height),width:r.width,height:r.height,x:n.pageX-(r.left+window.pageXOffset),y:n.pageY-(r.top+window.pageYOffset)}},Uie=["prefixCls","className","onMove","onDown"],j7=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-interactive",className:n,onMove:i,onDown:a}=t,s=Ds(t,Uie),o=H.useRef(null),A=H.useRef(!1),[l,u]=H.useState(!1),c=Qy(i),d=Qy(a),f=g=>A.current&&!sf(g)?!1:(A.current=sf(g),!0),v=H.useCallback(g=>{if(jy(g),!!o.current){var b=sf(g)?g.touches.length>0:g.buttons>0;if(!b){u(!1);return}c?.(Ky(o.current,g),g)}},[c]),p=H.useCallback(()=>u(!1),[]),C=H.useCallback(g=>{g?(window.addEventListener(A.current?"touchmove":"mousemove",v),window.addEventListener(A.current?"touchend":"mouseup",p)):(window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",p),window.removeEventListener("touchmove",v),window.removeEventListener("touchend",p))},[v,p]);H.useEffect(()=>(C(l),()=>{C(!1)}),[l,v,p,C]);var w=H.useCallback(g=>{var b=document.activeElement;b?.blur(),jy(g.nativeEvent),f(g.nativeEvent)&&o.current&&(d?.(Ky(o.current,g.nativeEvent),g.nativeEvent),u(!0))},[d]);return h.jsx("div",kt({},s,{className:[r,n||""].filter(Boolean).join(" "),style:kt({},s.style,{touchAction:"none"}),ref:o,tabIndex:0,onMouseDown:w,onTouchStart:w}))});j7.displayName="Interactive";var _ie=t=>{var{className:e,color:r,left:n,top:i,prefixCls:a}=t,s={position:"absolute",top:i,left:n},o={"--saturation-pointer-box-shadow":"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",width:6,height:6,transform:"translate(-3px, -3px)",boxShadow:"var(--saturation-pointer-box-shadow)",borderRadius:"50%",backgroundColor:r};return H.useMemo(()=>h.jsx("div",{className:a+"-pointer "+(e||""),style:s,children:h.jsx("div",{className:a+"-fill",style:o})}),[i,n,r,e,a])},Qie=["prefixCls","radius","pointer","className","hue","style","hsva","onChange"],mM=H.forwardRef((t,e)=>{var r,{prefixCls:n="w-color-saturation",radius:i=0,pointer:a,className:s,hue:o=0,style:A,hsva:l,onChange:u}=t,c=Ds(t,Qie),d=kt({width:200,height:200,borderRadius:i},A,{position:"relative"}),f=H.useRef(null),v=H.useCallback(b=>{f.current=b,typeof e=="function"?e(b):e&&"current"in e&&(e.current=b)},[e]),p=H.useCallback((b,B)=>{u&&l&&u({h:l.h,s:b.left*100,v:(1-b.top)*100,a:l.a});var E=f.current;E&&E.focus()},[l,u]),C=H.useCallback(b=>{if(!(!l||!u)){var B=1,E=l.s,F=l.v,O=!1;switch(b.key){case"ArrowLeft":E=Math.max(0,l.s-B),O=!0,b.preventDefault();break;case"ArrowRight":E=Math.min(100,l.s+B),O=!0,b.preventDefault();break;case"ArrowUp":F=Math.min(100,l.v+B),O=!0,b.preventDefault();break;case"ArrowDown":F=Math.max(0,l.v-B),O=!0,b.preventDefault();break;default:return}O&&u({h:l.h,s:E,v:F,a:l.a})}},[l,u]),w=H.useMemo(()=>{if(!l)return null;var b={top:100-l.v+"%",left:l.s+"%",color:hM(l)};return a&&typeof a=="function"?a(kt({prefixCls:n},b)):h.jsx(_ie,kt({prefixCls:n},b))},[l,a,n]),g=H.useCallback(b=>{b.target.focus()},[]);return h.jsx(j7,kt({className:[n,s||""].filter(Boolean).join(" ")},c,{style:kt({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+((r=l?.h)!=null?r:o)+", 100%, 50%))"},d,{outline:"none"}),ref:v,onMove:p,onDown:p,onKeyDown:C,onClick:g,children:w}))});mM.displayName="Saturation";var jie=["className","prefixCls","left","top","style","fillProps"],Hie=t=>{var{className:e,prefixCls:r,left:n,top:i,style:a,fillProps:s}=t,o=Ds(t,jie),A=kt({},a,{position:"absolute",left:n,top:i}),l=kt({width:18,height:18,boxShadow:"var(--alpha-pointer-box-shadow)",borderRadius:"50%",backgroundColor:"var(--alpha-pointer-background-color)"},s?.style,{transform:n?"translate(-9px, -1px)":"translate(-1px, -9px)"});return h.jsx("div",kt({className:r+"-pointer "+(e||""),style:A},o,{children:h.jsx("div",kt({className:r+"-fill"},s,{style:l}))}))},Kie=["prefixCls","className","hsva","background","bgProps","innerProps","pointerProps","radius","width","height","direction","style","onChange","pointer"],Vie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",i2=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-alpha",className:n,hsva:i,background:a,bgProps:s={},innerProps:o={},pointerProps:A={},radius:l=0,width:u,height:c=16,direction:d="horizontal",style:f,onChange:v,pointer:p}=t,C=Ds(t,Kie),w=k=>{v&&v(kt({},i,{a:d==="horizontal"?k.left:k.top}),k)},g=hM(Object.assign({},i,{a:1})),b="linear-gradient(to "+(d==="horizontal"?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+g+" 100%)",B={};d==="horizontal"?B.left=i.a*100+"%":B.top=i.a*100+"%";var E=kt({"--alpha-background-color":"#fff","--alpha-pointer-background-color":"rgb(248, 248, 248)","--alpha-pointer-box-shadow":"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:l,background:"url("+Vie+") left center",backgroundColor:"var(--alpha-background-color)"},{width:u,height:c},f,{position:"relative"}),F=H.useCallback(k=>{var j=.01,D=i.a,L=D;switch(k.key){case"ArrowLeft":d==="horizontal"&&(L=Math.max(0,D-j),k.preventDefault());break;case"ArrowRight":d==="horizontal"&&(L=Math.min(1,D+j),k.preventDefault());break;case"ArrowUp":d==="vertical"&&(L=Math.max(0,D-j),k.preventDefault());break;case"ArrowDown":d==="vertical"&&(L=Math.min(1,D+j),k.preventDefault());break;default:return}if(L!==D){var P={left:d==="horizontal"?L:i.a,top:d==="vertical"?L:i.a,width:0,height:0,x:0,y:0};v&&v(kt({},i,{a:L}),P)}},[i,d,v]),O=H.useCallback(k=>{k.target.focus()},[]),I=p&&typeof p=="function"?p(kt({prefixCls:r},A,B)):h.jsx(Hie,kt({},A,{prefixCls:r},B));return h.jsxs("div",kt({},C,{className:[r,r+"-"+d,n||""].filter(Boolean).join(" "),style:E,ref:e,children:[h.jsx("div",kt({},s,{style:kt({inset:0,position:"absolute",background:a||b,borderRadius:l},s.style)})),h.jsx(j7,kt({},o,{style:kt({},o.style,{inset:0,zIndex:1,position:"absolute",outline:"none"}),onMove:w,onDown:w,onClick:O,onKeyDown:F,children:I}))]}))});i2.displayName="Alpha";var Wie=["prefixCls","className","hue","onChange","direction"],wM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-hue",className:n,hue:i=0,onChange:a,direction:s="horizontal"}=t,o=Ds(t,Wie);return h.jsx(i2,kt({ref:e,className:r+" "+(n||"")},o,{direction:s,background:"linear-gradient(to "+(s==="horizontal"?"right":"bottom")+", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",hsva:{h:i,s:100,v:100,a:i/360},onChange:(A,l)=>{a&&a({h:s==="horizontal"?360*l.left:360*l.top})}}))});wM.displayName="Hue";var qie=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur","renderInput"],zie=t=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(t),Gie=t=>Number(String(t).replace(/%/g,"")),vc=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-editable-input",placement:n="bottom",label:i,value:a,className:s,style:o,labelStyle:A,inputStyle:l,onChange:u,onBlur:c,renderInput:d}=t,f=Ds(t,qie),[v,p]=H.useState(a),C=H.useRef(!1);H.useEffect(()=>{t.value!==v&&(C.current||p(t.value))},[t.value]);function w(O,I){var k=(I||O.target.value).trim().replace(/^#/,"");zie(k)&&u&&u(O,k);var j=Gie(k);isNaN(j)||u&&u(O,j),p(k)}function g(O){C.current=!1,p(t.value),c&&c(O)}var b={};n==="bottom"&&(b.flexDirection="column"),n==="top"&&(b.flexDirection="column-reverse"),n==="left"&&(b.flexDirection="row-reverse");var B=kt({"--editable-input-label-color":"rgb(153, 153, 153)","--editable-input-box-shadow":"rgb(204 204 204) 0px 0px 0px 1px inset","--editable-input-color":"#666",position:"relative",alignItems:"center",display:"flex",fontSize:11},b,o),E=kt({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,background:"transparent",boxSizing:"border-box",border:"none",color:"var(--editable-input-color)",boxShadow:"var(--editable-input-box-shadow)"},l),F=kt({value:v,onChange:w,onBlur:g,autoComplete:"off",onFocus:()=>C.current=!0},f,{style:E,onFocusCapture:O=>{var I=O.target;I.setSelectionRange(I.value.length,I.value.length)}});return h.jsxs("div",{className:[r,s||""].filter(Boolean).join(" "),style:B,children:[d?d(F,e):h.jsx("input",kt({ref:e},F)),i&&h.jsx("span",{style:kt({color:"var(--editable-input-label-color)",textTransform:"capitalize"},A),children:i})]})});vc.displayName="EditableInput";var $ie=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],H7=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-editable-input-rgba",hsva:n,placement:i="bottom",rProps:a={},gProps:s={},bProps:o={},aProps:A={},className:l,style:u,onChange:c}=t,d=Ds(t,$ie),f=n?ih(n):{};function v(g){var b=Number(g.target.value);b&&b>255&&(g.target.value="255"),b&&b<0&&(g.target.value="0")}var p=g=>{var b=Number(g.target.value);b&&b>100&&(g.target.value="100"),b&&b<0&&(g.target.value="0")},C=(g,b,B)=>{typeof g=="number"&&(b==="a"&&(g<0&&(g=0),g>100&&(g=100),c&&c(Ys(Q1(kt({},f,{a:g/100}))))),g>255&&(g=255,B.target.value="255"),g<0&&(g=0,B.target.value="0"),b==="r"&&c&&c(Ys(Q1(kt({},f,{r:g})))),b==="g"&&c&&c(Ys(Q1(kt({},f,{g})))),b==="b"&&c&&c(Ys(Q1(kt({},f,{b:g})))))},w=f.a?Math.round(f.a*100)/100:0;return h.jsxs("div",kt({ref:e,className:[r,l||""].filter(Boolean).join(" ")},d,{style:kt({fontSize:11,display:"flex"},u),children:[h.jsx(vc,kt({label:"R",value:f.r||0,onBlur:v,placement:i,onChange:(g,b)=>C(b,"r",g)},a,{style:kt({},a.style)})),h.jsx(vc,kt({label:"G",value:f.g||0,onBlur:v,placement:i,onChange:(g,b)=>C(b,"g",g)},s,{style:kt({marginLeft:5},s.style)})),h.jsx(vc,kt({label:"B",value:f.b||0,onBlur:v,placement:i,onChange:(g,b)=>C(b,"b",g)},o,{style:kt({marginLeft:5},o.style)})),A&&h.jsx(vc,kt({label:"A",value:parseInt(String(w*100),10),onBlur:p,placement:i,onChange:(g,b)=>C(b,"a",g)},A,{style:kt({marginLeft:5},A.style)}))]}))});H7.displayName="EditableInputRGBA";var Xie=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],CM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-editable-input-hsla",hsva:n,hProps:i={},sProps:a={},lProps:s={},aProps:o={},className:A,onChange:l}=t,u=Ds(t,Xie),c=n?U7(n):{h:0,s:0,l:0,a:0},d=(v,p,C)=>{typeof v=="number"&&(p==="h"&&(v<0&&(v=0),v>360&&(v=360),l&&l(Ys(pd(kt({},c,{h:v}))))),p==="s"&&(v<0&&(v=0),v>100&&(v=100),l&&l(Ys(pd(kt({},c,{s:v}))))),p==="l"&&(v<0&&(v=0),v>100&&(v=100),l&&l(Ys(pd(kt({},c,{l:v}))))),p==="a"&&(v<0&&(v=0),v>1&&(v=1),l&&l(Ys(pd(kt({},c,{a:v}))))))},f=o==!1?!1:kt({label:"A",value:Math.round(c.a*100)/100},o,{onChange:(v,p)=>d(p,"a")});return h.jsx(H7,kt({ref:e,hsva:n,rProps:kt({label:"H",value:Math.round(c.h)},i,{onChange:(v,p)=>d(p,"h")}),gProps:kt({label:"S",value:Math.round(c.s)+"%"},a,{onChange:(v,p)=>d(p,"s")}),bProps:kt({label:"L",value:Math.round(c.l)+"%"},s,{onChange:(v,p)=>d(p,"l")}),aProps:f,className:[r,A||""].filter(Boolean).join(" ")},u))});CM.displayName="EditableInputHSLA";var Yie=["style"];function Zie(t){var{style:e}=t,r=Ds(t,Yie),n=H.useRef(null),i=H.useCallback(()=>{n.current.style.backgroundColor="var(--chrome-arrow-background-color)"},[]),a=H.useCallback(()=>{n.current.style.backgroundColor="transparent"},[]);return h.jsx("div",kt({ref:n,style:kt({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},e)},r,{onMouseEnter:i,onMouseLeave:a,children:h.jsx("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:h.jsx("path",{d:"M373.888 576h276.224c9.322667 0 14.293333 11.178667 9.173333 18.773333l-1.258666 1.557334-138.112 146.858666a10.709333 10.709333 0 0 1-14.293334 1.365334l-1.536-1.365334-138.112-146.858666c-6.592-6.997333-2.666667-18.645333 5.973334-20.16l1.941333-0.170667h276.224-276.224z m146.026667-295.189333l138.112 146.858666c7.04 7.509333 2.069333 20.330667-7.914667 20.330667H373.888c-9.984 0-14.976-12.821333-7.914667-20.330667l138.112-146.858666a10.730667 10.730667 0 0 1 15.829334 0z",fill:"var(--chrome-arrow-fill)"})})}))}function Jie(){return"EyeDropper"in window}function eae(t){var e=()=>{if("EyeDropper"in window){var r=new window.EyeDropper;r.open().then(n=>{t.onPickColor==null||t.onPickColor(n.sRGBHex)}).catch(n=>{n.name})}};return h.jsx("svg",{viewBox:"0 0 512 512",height:"1em",width:"1em",onClick:e,children:h.jsx("path",{fill:"currentColor",d:"M482.8 29.23c38.9 38.98 38.9 102.17 0 141.17L381.2 271.9l9.4 9.5c12.5 12.5 12.5 32.7 0 45.2s-32.7 12.5-45.2 0l-160-160c-12.5-12.5-12.5-32.7 0-45.2s32.7-12.5 45.2 0l9.5 9.4L341.6 29.23c39-38.974 102.2-38.974 141.2 0zM55.43 323.3 176.1 202.6l45.3 45.3-120.7 120.7c-3.01 3-4.7 7-4.7 11.3V416h36.1c4.3 0 8.3-1.7 11.3-4.7l120.7-120.7 45.3 45.3-120.7 120.7c-15 15-35.4 23.4-56.6 23.4H89.69l-39.94 26.6c-12.69 8.5-29.59 6.8-40.377-4-10.786-10.8-12.459-27.7-3.998-40.4L32 422.3v-42.4c0-21.2 8.43-41.6 23.43-56.6z"})})}var tae=["prefixCls","className","style","color","showEditableInput","showEyeDropper","showColorPreview","showHue","showAlpha","inputType","rectProps","onChange"],mo=(function(t){return t.HEXA="hexa",t.RGBA="rgba",t.HSLA="hsla",t})({}),gu=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-chrome",className:n,style:i,color:a,showEditableInput:s=!0,showEyeDropper:o=!0,showColorPreview:A=!0,showHue:l=!0,showAlpha:u=!0,inputType:c=mo.RGBA,rectProps:d={},onChange:f}=t,v=Ds(t,tae),p=typeof a=="string"&&Q7(a)?nu(a):a||{h:0,s:0,l:0,a:0},C=D=>f&&f(Ys(D)),[w,g]=H.useState(c),b=()=>{w===mo.RGBA&&g(mo.HSLA),w===mo.HSLA&&g(mo.HEXA),w===mo.HEXA&&g(mo.RGBA)},B={paddingTop:6},E={textAlign:"center",paddingTop:4,paddingBottom:4},F=kt({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:"column",width:230,padding:0},i),O={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:Sie(p),boxShadow:"var(--chrome-alpha-box-shadow)"},I=D=>{var L=nu(D);C(kt({},L))},k={height:14,width:14},j={style:kt({},k),fillProps:{style:k}};return h.jsx(vM,kt({ref:e,color:p,style:F,colors:void 0,className:[r,n].filter(Boolean).join(" "),placement:Si.TopLeft},v,{addonAfter:h.jsxs(H.Fragment,{children:[h.jsx(mM,{hsva:p,style:{width:"100%",height:130},onChange:D=>{C(kt({},p,D,{a:p.a}))}}),h.jsxs("div",{style:{padding:15,display:"flex",alignItems:"center",gap:10},children:[Jie()&&o&&h.jsx(eae,{onPickColor:I}),A&&h.jsx(i2,{width:28,height:28,hsva:p,radius:2,style:{borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:O},pointer:()=>h.jsx(H.Fragment,{})}),h.jsxs("div",{style:{flex:1},children:[l==!0&&h.jsx(wM,{hue:p.h,style:{width:"100%",height:12,borderRadius:2},pointerProps:j,bgProps:{style:{borderRadius:2}},onChange:D=>{C(kt({},p,D))}}),u==!0&&h.jsx(i2,{hsva:p,style:{marginTop:6,height:12,borderRadius:2},pointerProps:j,bgProps:{style:{borderRadius:2}},onChange:D=>{C(kt({},p,D))}})]})]}),s&&h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[h.jsxs("div",{style:{flex:1},children:[w==mo.RGBA&&h.jsx(H7,{hsva:p,rProps:{labelStyle:B,inputStyle:E},gProps:{labelStyle:B,inputStyle:E},bProps:{labelStyle:B,inputStyle:E},aProps:u==!1?!1:{labelStyle:B,inputStyle:E},onChange:D=>C(D.hsva)}),w===mo.HEXA&&h.jsx(vc,{label:"HEX",labelStyle:B,inputStyle:E,value:p.a>0&&p.a<1?Lie(p).toLocaleUpperCase():_7(p).toLocaleUpperCase(),onChange:(D,L)=>{typeof L=="string"&&C(nu(/^#/.test(L)?L:"#"+L))}}),w===mo.HSLA&&h.jsx(CM,{hsva:p,hProps:{labelStyle:B,inputStyle:E},sProps:{labelStyle:B,inputStyle:E},lProps:{labelStyle:B,inputStyle:E},aProps:u==!1?!1:{labelStyle:B,inputStyle:E},onChange:D=>C(D.hsva)})]}),h.jsx(Zie,{onClick:b})]})]}),rectRender:()=>h.jsx(H.Fragment,{})}))});gu.displayName="Chrome";const rae=t=>t.selectedIds.length>0?t.selectedIds:t.selectedId?[t.selectedId]:[],Cm=(t,e)=>t.filter(r=>e.includes(r.id)&&(r.type==="text"||r.type==="rectangle"||r.type==="circle")),yM=(t,e)=>t.filter(r=>e.includes(r.id)&&(r.type==="rectangle"||r.type==="circle"||r.type==="svg")),nae=(t,e)=>t.filter(r=>e.includes(r.id)&&r.type==="image"),bM=(t,e)=>t.filter(r=>e.includes(r.id)&&r.type==="draw"),iae=(t,e)=>t.filter(r=>e.includes(r.id)&&r.type==="line"),zi=(t,e)=>{if(t.length===0)return;const r=e(t[0]);return t.every(n=>e(n)===r)?r:void 0},Vy="inline-flex h-(--selectiontoolbar-height) items-center justify-between gap-0 rounded-none border-none bg-transparent px-2.5 text-sm font-medium text-[color:var(--popover-dark-text,#f3f4f6)] shadow-none outline-none transition-colors duration-150 hover:bg-[rgba(255,255,255,0.05)] [&>svg:last-child]:size-[14px] [&>svg:last-child]:ml-2 [&>svg:last-child]:pointer-events-none [&>svg:last-child]:text-[color:var(--popover-dark-text,#b8b8b8)]",Wy="w-fit! min-w-fit! [&_*]:flex-row!",gd="float-left w-fit shrink-0 cursor-pointer rounded-full bg-transparent p-[4px_1px]! transition-all duration-[0.1s] hover:scale-105",aae="my-auto ml-[5px] mr-1 h-5 w-px bg-[rgba(var(--darkborder-rgb,255,255,255),1)] opacity-20",qy="flex",qu="[&_span]:flex [&_span]:items-center [&_span]:gap-1.5",zy="mx-auto my-0.5 mt-2 h-px w-[95%] border-none bg-[rgba(var(--text-rgb),0.2)]",sae="flex flex-col items-center justify-center px-2 pb-2 pt-3",Gy="flex items-center justify-center [&_*]:p-0!",oae="[box-shadow:none]! [transform:translateY(138px)_translateX(18px)]!",Aae="[box-shadow:none]! [transform:translateY(145px)_translateX(26px)]!",BM=({scene:t,shapeColors:e,selectedIds:r,localeMessages:n,customDrawColorPickerWrapRef:i,customDrawColorPickerContentRef:a,customDrawColorPickerColor:s,setCustomDrawColorPickerColor:o,onShapeFillColorChange:A,onShapeFillStyleChange:l,onShapeStrokeColorChange:u,onShapeStrokeWidthChange:c,onShapeStrokeStyleChange:d,uniColor:f,activeSelectId:v,setActiveSelectId:p})=>{const C=yM(t.elements,r),w=C.map(W=>W.id),g=zi(C,W=>W.fill)??"multi",b=g==="multi"?C[0]?.fill??t.settings.shapeDefaults.fill:g,B=zi(C,W=>W.fillStyle)??"solid",E=[...e[0],...e[1]],F=E.some(W=>W!=="multi"&&W.toLowerCase()===b.toLowerCase())?b:"multi",O=E.some(W=>W!=="multi"&&W.toLowerCase()===b.toLowerCase()),I=zi(C,W=>W.stroke)??"multi",k=I==="multi"?C[0]?.stroke??t.settings.shapeDefaults.stroke:I,j=E.some(W=>W!=="multi"&&W.toLowerCase()===k.toLowerCase())?k:"multi",D=zi(C,W=>W.strokeStyle),L=D==="solid"||D==="dashed"||D==="none"?D:"solid",P=E.some(W=>W!=="multi"&&W.toLowerCase()===k.toLowerCase()),R=H.useRef(!1),q=H.useRef(!1),[te,ne]=H.useState(null),Z=W=>{const se=W==="fill"?b:k;ne(W),p(W==="fill"?"shape-fill-color":"shape-stroke-color"),o(r7(se))};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:i,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:v==="shape-fill-color",onOpenChange:W=>{if(W){ne(null),p("shape-fill-color");return}if(R.current){R.current=!1;return}te==="fill"&&ne(null),p(null)},value:String(F),onValueChange:W=>{if(["solid","hachure","none"].includes(W)){l(w,W);return}if(W==="multi"){Z("fill");return}p(null),A(w,W)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Vy,onPointerDown:W=>{F==="multi"&&(W.preventDefault(),W.stopPropagation(),Z("fill"))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:n.selectionBar.fillColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:f(b)}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:n.selectionBar.fillColor})})]}),h.jsxs(Ua,{position:"popper",className:Wy,children:[h.jsxs("div",{className:qy,children:[h.jsxs(qr,{className:qu+(B==="solid"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"solid",children:[h.jsx(AY,{})," Relleno"]}),h.jsxs(qr,{className:qu+(B==="hachure"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"hachure",children:[h.jsx(hY,{})," Hachure"]}),h.jsxs(qr,{className:qu+(B==="none"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"none",children:[h.jsx(fY,{})," Sin relleno"]})]}),h.jsx("hr",{className:zy}),h.jsxs("div",{className:sae,"data-disabled":B==="none"?"":void 0,children:[h.jsx("div",{className:Gy,children:h.jsx(ko,{colors:e[0],currentColor:b,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,children:J},W)})}),h.jsx("div",{className:Gy,children:h.jsx(ko,{colors:e[1],realTotalColors:E,currentColor:b,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,children:J},W)})})]})]})]})}),h.jsxs(Nr,{open:v==="shape-fill-color"&&(te==="fill"||!O),children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:aae})}),h.jsx(Rr,{className:oae,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:a,onPointerDown:W=>W.stopPropagation(),children:h.jsx(gu,{color:s,onChange:W=>{const se=W.hexa||W.hex;se&&(o(se),A(w,se))}})})})]}),h.jsxs(Pa,{open:v==="shape-stroke-color",onOpenChange:W=>{if(W){ne(null),p("shape-stroke-color");return}if(q.current){q.current=!1;return}te==="stroke"&&ne(null),p(null)},value:String(j),onValueChange:W=>{if(["solid","dashed","none"].includes(W)){d(w,W);return}if(W==="multi"){Z("stroke");return}p(null),u(w,W)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Vy,onPointerDown:W=>{j==="multi"&&(W.preventDefault(),W.stopPropagation(),Z("stroke"))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:n.selectionBar.strokeColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"3px",border:"2px solid "+f(k),height:"20px",background:"transparent"}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:n.selectionBar.strokeColor})})]}),h.jsxs(Ua,{position:"popper",className:Wy,children:[h.jsxs("div",{className:qy,children:[h.jsxs(qr,{className:qu+(L==="solid"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"solid",children:[h.jsx(uY,{})," Sólido"]}),h.jsxs(qr,{className:qu+(L==="dashed"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"dashed",children:[h.jsx(lY,{})," Discontinuo"]}),h.jsxs(qr,{className:qu+(L==="none"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"none",children:[h.jsx(cY,{})," Ninguno"]})]}),h.jsx("hr",{className:zy}),h.jsx("div",{children:h.jsx(ko,{colors:e[0],currentColor:k,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,children:J},W)})}),h.jsx("div",{children:h.jsx(ko,{colors:e[1],realTotalColors:E,currentColor:k,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,children:J},W)})})]})]}),h.jsxs(Nr,{open:v==="shape-stroke-color"&&(te==="stroke"||!P),children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{})}),h.jsx(Rr,{className:Aae,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:a,onPointerDown:W=>W.stopPropagation(),children:h.jsx(gu,{color:s,onChange:W=>{const se=W.hexa||W.hex;se&&(o(se),u(w,se))}})})})]})]})},lae="inline-flex h-(--selectiontoolbar-height) items-center justify-between gap-0 rounded-none border-none bg-transparent px-2.5 text-sm font-medium text-[color:var(--popover-dark-text,#f3f4f6)] shadow-none outline-none transition-colors duration-150 hover:bg-[rgba(255,255,255,0.05)] [&>svg:last-child]:size-[14px] [&>svg:last-child]:ml-2 [&>svg:last-child]:pointer-events-none [&>svg:last-child]:text-[color:var(--popover-dark-text,#b8b8b8)]",$y=`${lae} w-[78px] justify-center px-3`,Xy="w-fit! min-w-fit! [&_*]:flex-row!",Yy="float-left w-fit shrink-0 cursor-pointer rounded-full bg-transparent p-[4px_1px]! transition-all duration-[0.1s] hover:scale-105",vd="my-auto ml-[5px] mr-1 h-5 w-px bg-[rgba(var(--darkborder-rgb,255,255,255),1)] opacity-20",Zy="flex p-[7px_8px] [&_*]:w-full",md="flex items-center justify-center [&_svg]:h-auto [&_svg]:w-[180px]",Jy="[box-shadow:none]! [transform:translateY(60px)]!",wd=(t,e)=>{const r=t[e]??t[0];return r?h.jsx("svg",{width:r.width,height:r.height,viewBox:r.viewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:r.path,stroke:r.strokeWidth?"currentColor":void 0,strokeWidth:r.strokeWidth,strokeLinecap:r.strokeWidth?"round":void 0,fill:r.fill})}):null},xM=({scene:t,strokeColors:e,selectedIds:r,drawingTool:n,localeMessages:i,customDrawColorPickerWrapRef:a,customDrawColorPickerContentRef:s,isCustomDrawColorPickerOpen:o,setIsCustomDrawColorPickerOpen:A,customDrawColorPickerColor:l,setCustomDrawColorPickerColor:u,onDrawStrokeWidthChange:c,onDrawStrokeColorChange:d,onDrawDefaultStrokeColorChange:f,onLineStartCapChange:v,onLineEndCapChange:p,uniColor:C,activeSelectId:w,setActiveSelectId:g})=>{const b=bM(t.elements,r),B=iae(t.elements,r),E=zi(b,J=>J.drawMode??"draw")??"draw",F=E==="marker"?xf:JA,O=E==="marker"?lO:l0,I=E==="marker"?dz(zi(b,J=>J.strokeWidth)??xf[0]):tC(zi(b,J=>J.strokeWidth)??JA[1]),k=E==="marker"?t.settings.drawDefaults.markerStroke:E==="quill"?t.settings.drawDefaults.quillStroke:t.settings.drawDefaults.drawStroke,j=b[0]?.stroke||k,D=e.some(J=>J!=="multi"&&J.toLowerCase()===j.toLowerCase())?j:"multi",L=zi(B,J=>J.stroke)??"multi",P=L==="multi"?B[0]?.stroke??t.settings.shapeDefaults.lineStroke:L,R=e.some(J=>J!=="multi"&&J.toLowerCase()===L.toLowerCase())?L:"multi",q=tC(zi(B,J=>J.strokeWidth)??JA[1]),te=J=>{u(r7(J)),A(!0)},ne=()=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:a,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:w==="draw-stroke-color"||o||void 0,onOpenChange:J=>{J?g("draw-stroke-color"):w==="draw-stroke-color"&&g(null)},value:String(D),onValueChange:J=>{if(J==="multi"){te(j);return}if(A(!1),g(null),b.length===0){f(E,J);return}d(b.map(T=>T.id),J)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{onPointerDown:J=>{D==="multi"&&(J.preventDefault(),J.stopPropagation(),te(j))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:C(j||k)}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeColor})})]}),h.jsx(Ua,{position:"popper",className:Xy,children:h.jsx(ko,{colors:e,currentColor:j,uniColor:C,renderItem:({color:J,isMulti:T,swatch:_})=>h.jsx(qr,{value:J,className:Yy,check:!1,onPointerDown:T?G=>{G.preventDefault(),G.stopPropagation(),te(j)}:void 0,onSelect:T?G=>{G.preventDefault(),te(j)}:void 0,children:_},J)})})]})}),h.jsxs(Nr,{open:o,children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:vd})}),h.jsx(Rr,{className:Jy,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:s,onPointerDown:J=>J.stopPropagation(),children:h.jsx(gu,{color:l,onChange:J=>{const T=J.hexa||J.hex;if(T){if(u(T),b.length===0){f(E,T);return}d(b.map(_=>_.id),T)}}})})})]}),h.jsxs(Pa,{open:w==="draw-stroke-width",onOpenChange:J=>{J?g("draw-stroke-width"):w==="draw-stroke-width"&&g(null)},value:String(I),onValueChange:J=>{g(null),c(b.map(T=>T.id),Number(J))},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:$y,style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeWidth})}),h.jsx("span",{className:md,children:wd(O,Math.max(0,F.findIndex(J=>J===I)))})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeWidth})})]}),h.jsx(Ua,{position:"popper",children:F.map((J,T)=>h.jsx(qr,{check:!1,value:String(J),className:Zy,children:h.jsx("span",{className:md,children:wd(O,T)})},J))})]})]}),Z=()=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:a,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:w==="line-stroke-color"||o,onOpenChange:J=>{J?g("line-stroke-color"):w==="line-stroke-color"&&g(null)},value:String(R),onValueChange:J=>{if(J==="multi"){te(P);return}A(!1),g(null),d(B.map(T=>T.id),J)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{onPointerDown:J=>{R==="multi"&&(J.preventDefault(),J.stopPropagation(),te(P))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:C(P)}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeColor})})]}),h.jsx(Ua,{position:"popper",className:Xy,children:h.jsx(ko,{colors:e,currentColor:P,uniColor:C,renderItem:({color:J,isMulti:T,swatch:_})=>h.jsx(qr,{value:J,className:Yy,check:!1,onPointerDown:T?G=>{G.preventDefault(),G.stopPropagation(),te(P)}:void 0,onSelect:T?G=>{G.preventDefault(),te(P)}:void 0,children:_},J)})})]})}),h.jsxs(Nr,{open:o,children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:vd})}),h.jsx(Rr,{className:Jy,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:s,onPointerDown:J=>J.stopPropagation(),children:h.jsx(gu,{color:l,onChange:J=>{const T=J.hexa||J.hex;T&&(u(T),d(B.map(_=>_.id),T))}})})})]})]}),W=()=>{const J=zi(B,_=>_.startCap),T=zi(B,_=>_.endCap);return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsxs(Pa,{open:w==="line-start-cap",onOpenChange:_=>{_?g("line-start-cap"):w==="line-start-cap"&&g(null)},value:J||"",onValueChange:_=>{g(null),v(B.map(G=>G.id),_)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(Ra,{children:h.jsx(as,{placeholder:"Start cap"})})}),h.jsx(Rr,{children:h.jsx("p",{children:"Line start cap"})})]}),h.jsx(Ua,{position:"popper",children:Jw.map((_,G)=>{const re=eC[G];return h.jsx(qr,{className:"flex w-fit! items-center! justify-center! py-2!",check:!1,value:_,children:h.jsx("svg",{width:re.width/2,viewBox:re.viewBox,fill:"none",className:"scale-[0.8] -scale-x-100",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:re.path,strokeWidth:re.strokeWidth,strokeLinecap:re.strokeLinecap,fill:re.fill,stroke:re.stroke})})},`${_}-${G}-start`)})})]}),h.jsx("div",{className:vd}),h.jsxs(Pa,{open:w==="line-end-cap",onOpenChange:_=>{_?g("line-end-cap"):w==="line-end-cap"&&g(null)},value:T||"",onValueChange:_=>{g(null),p(B.map(G=>G.id),_)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(Ra,{children:h.jsx(as,{placeholder:"End cap"})})}),h.jsx(Rr,{children:h.jsx("p",{children:"Line end cap"})})]}),h.jsx(Ua,{position:"popper",children:Jw.map((_,G)=>{const re=eC[G];return h.jsx(qr,{className:"flex w-fit! items-center! justify-center! py-2!",check:!1,value:_,children:h.jsx("svg",{width:re.width/2,viewBox:re.viewBox,fill:"none",className:"scale-[0.8]",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:re.path,strokeWidth:re.strokeWidth,strokeLinecap:re.strokeLinecap,fill:re.fill,stroke:re.stroke})})},`${_}-${G}-end`)})})]})]})},se=()=>h.jsxs(Pa,{open:w==="line-stroke-width",onOpenChange:J=>{J?g("line-stroke-width"):w==="line-stroke-width"&&g(null)},value:String(q),onValueChange:J=>{g(null),c(B.map(T=>T.id),Number(J))},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:$y,style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeWidth})}),h.jsx("span",{className:md,children:wd(l0,Math.max(0,JA.findIndex(J=>J===q)))})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeWidth})})]}),h.jsx(Ua,{position:"popper",children:JA.map((J,T)=>h.jsx(qr,{check:!1,value:String(J),className:Zy,children:h.jsx("span",{className:md,children:wd(l0,T)})},J))})]});return r.length>1?b.length===r.length?ne():h.jsx(h.Fragment,{}):b.length>0?ne():B.length>0?h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[Z(),se(),h.jsx("div",{className:vd}),W()]}):n==="draw"||n==="marker"||n==="quill"?ne():h.jsx(h.Fragment,{})},uae="flex h-[var(--size)] items-center overflow-hidden rounded-lg border border-(--panel-border) [--size:32px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[18px] [&_svg]:size-3! [&_svg_*]:stroke-2",eb="flex size-[var(--size)] cursor-pointer items-center justify-center border-none bg-[rgba(var(--background-rgb),0.5)] text-[rgba(var(--text-rgb))] hover:brightness-125",cae="h-full w-[150px] border-x border-y-0 border-(--panel-border) bg-[rgba(var(--background-rgb),0.5)] pl-3 text-xs text-[rgba(var(--text-rgb))] font-[Inter,sans-serif] [appearance:textfield] [&::-webkit-inner-spin-button]:[-webkit-appearance:none] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:[-webkit-appearance:none] [&::-webkit-outer-spin-button]:m-0";function fae({className:t,type:e,value:r,onValueChange:n,...i}){const[a,s]=M.useState(typeof r=="number"&&Number.isFinite(r)?r:10);M.useEffect(()=>{typeof r=="number"&&Number.isFinite(r)&&s(r)},[r]);const o=A=>{Number.isFinite(A)&&(s(A),n(A))};return h.jsxs("div",{className:uae,children:[h.jsx("button",{className:eb,onClick:()=>{o((Number.isFinite(a)?a:10)-1)},children:h.jsx(sT,{})}),h.jsx("input",{type:e,"data-slot":"input",className:cae+(t?" "+t:""),...i,value:a,onChange:A=>{const l=Number.parseInt(A.target.value,10);Number.isFinite(l)&&o(l)}}),h.jsx("button",{className:eb,onClick:()=>{o((Number.isFinite(a)?a:10)+1)},children:h.jsx(oT,{})})]})}const Cd="inline-flex h-(--selectiontoolbar-height) items-center justify-between gap-0 rounded-none border-none bg-transparent px-2.5 text-sm font-medium text-[color:var(--popover-dark-text,#f3f4f6)] shadow-none outline-none transition-colors duration-150 hover:bg-[rgba(255,255,255,0.05)] [&>svg:last-child]:size-[14px] [&>svg:last-child]:ml-2 [&>svg:last-child]:pointer-events-none [&>svg:last-child]:text-[color:var(--popover-dark-text,#b8b8b8)]",tb="w-fit! min-w-fit! [&_*]:flex-row!",rb="float-left w-fit shrink-0 cursor-pointer rounded-full bg-transparent p-[4px_1px]! transition-all duration-[0.1s] hover:scale-105",yd="my-auto ml-[5px] mr-1 h-5 w-px bg-[rgba(var(--darkborder-rgb,255,255,255),1)] opacity-20",v1="flex items-center justify-between gap-0.5",Gp="float-left w-fit p-2! pb-[5px]! transition-all duration-[0.1s]",$p="flex h-(--selectiontoolbar-height) w-(--selectiontoolbar-height) items-center justify-center border-none p-0 text-[color:var(--popover-dark-text,white)] bg-transparent transition-colors duration-150 hover:bg-[rgba(var(--darkborder-rgb,255,255,255),0.05)] data-[active=true]:bg-[rgba(var(--accent-rgb),0.4)]",hae="[box-shadow:none]! [transform:translateY(92px)_translateX(18px)]!",EM=({scene:t,selectedIds:e,localeMessages:r,editor:n,editingText:i,setEditingText:a,worldToScreen:s,toggleEditorMark:o,onTextCommit:A,onTextFontFamilyChange:l,onTextFontSizeChange:u,onTextFontWeightChange:c,onTextFontStyleChange:d,onTextAlignChange:f,onTextColorChange:v,shapeColors:p,customDrawColorPickerWrapRef:C,customDrawColorPickerContentRef:w,customDrawColorPickerColor:g,setCustomDrawColorPickerColor:b,activeSelectId:B,setActiveSelectId:E})=>{const F=Cm(t.elements,e),O=zi(F,be=>be.textAlign),I=pz(O),k=zi(F,be=>be.fontFamily),j=zi(F,be=>be.fontSize),D=typeof j=="number"&&Number.isFinite(j),L=zi(F,be=>be.fontWeight),P=zi(F,be=>be.fontStyle),R=zi(F,be=>be.color)??"multi",q=R==="multi"?F[0]?.color??t.settings.shapeDefaults.textColor:R,te=[...p[0],...p[1]],ne=te.some(be=>be!=="multi"&&be.toLowerCase()===q.toLowerCase())?q:"multi",Z=te.some(be=>be!=="multi"&&be.toLowerCase()===q.toLowerCase()),W=H.useRef(!1),[se,J]=H.useState(!1),T=L==="bold"||L==="700"||L==="800"||L==="900",_=P==="italic",G=(()=>{if(!i)return null;try{return z.marks(n)??null}catch{return null}})(),re=i&&(i.style.fontWeight==="bold"||i.style.fontWeight==="700"||i.style.fontWeight==="800"||i.style.fontWeight==="900"),he=i?.style.fontStyle==="italic",Ae=G?.bold===!0||G?.bold!==!1&&re,Ee=G?.italic===!0||G?.italic!==!1&&he,ee=be=>Mf(be.text).every(at=>at.children.every(Me=>Me.strikethrough===!0)),ue=F.length>0&&F.every(be=>ee(be)),de=i?Ae:T,Ce=i?Ee:_,pe=i?G?.strikethrough===!0:ue,Oe=()=>{const be=!ue;for(const Le of F){const Me=Mf(Le.text).map(it=>({...it,children:it.children.map(mt=>({...mt,strikethrough:be}))}));A(Le.id,w0(Me))}},X=()=>{i&&requestAnimationFrame(()=>{try{bt.focus(n)}catch{return}})},We=be=>{J(!0),E("text-color"),b(r7(be))},ft=be=>{const Le=F.map(at=>at.id);v(Le,be),i&&Le.includes(i.id)&&a(at=>at&&{...at,style:{...at.style,color:be}}),X()};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:C,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:B==="text-color",onOpenChange:be=>{if(be){J(!1),E("text-color");return}if(W.current){W.current=!1;return}se&&J(!1),E(null)},value:String(ne),onValueChange:be=>{if(be==="multi"){We(q);return}E(null),ft(be)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,onPointerDown:be=>{ne==="multi"&&(be.preventDefault(),be.stopPropagation(),We(q))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:r.selectionBar.textColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:q}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textColor})})]}),h.jsxs(Ua,{position:"popper",className:tb,children:[h.jsx("div",{children:h.jsx(ko,{colors:p[0],currentColor:q,uniColor:be=>be,renderItem:({color:be,isMulti:Le,swatch:at})=>h.jsx(qr,{value:be,className:rb,check:!1,onPointerDown:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,onSelect:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,children:at},be)})}),h.jsx("div",{children:h.jsx(ko,{colors:p[1],realTotalColors:te,currentColor:q,uniColor:be=>be,renderItem:({color:be,isMulti:Le,swatch:at})=>h.jsx(qr,{value:be,className:rb,check:!1,onPointerDown:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,onSelect:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,children:at},be)})})]})]})}),h.jsxs(Nr,{open:B==="text-color"&&(se||!Z),children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:yd})}),h.jsx(Rr,{className:hae,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:w,onPointerDown:be=>be.stopPropagation(),children:h.jsx(gu,{color:g,onChange:be=>{const Le=be.hexa||be.hex;Le&&(b(Le),ft(Le))}})})})]}),h.jsxs(Pa,{open:B==="text-font-family",onOpenChange:be=>{be?E("text-font-family"):B==="text-font-family"&&E(null)},value:k,onValueChange:be=>{E(null),l(F.map(Le=>Le.id),be),X()},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,style:{gap:"0px"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:r.selectionBar.fontFamily})}),k==="Shantell Sans"?h.jsx(rY,{}):k==="Cascadia Code"?h.jsx(eY,{}):k==="Imbue"?h.jsx(tY,{}):h.jsx(ZX,{})]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.fontFamily})})]}),h.jsxs(Ua,{position:"popper",children:[h.jsx(qr,{check:!1,value:"Rubik",children:r.fontFamilies.simple}),h.jsx(qr,{check:!1,value:"Shantell Sans",children:r.fontFamilies.handwritten}),h.jsx(qr,{check:!1,value:"Imbue",children:r.fontFamilies.elegant}),h.jsx(qr,{check:!1,value:"Cascadia Code",children:r.fontFamilies.technical})]})]}),h.jsx("div",{className:yd}),h.jsxs(Pa,{open:B==="text-font-size",onOpenChange:be=>{be?E("text-font-size"):B==="text-font-size"&&E(null)},value:D?String(j):void 0,onValueChange:be=>{E(null);const Le=Number.parseInt(be,10);Number.isFinite(Le)&&(u(F.map(at=>at.id),Le),X())},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,style:{gap:"0px"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:""})}),D?j:"-"]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.fontSize})})]}),h.jsxs(Ua,{position:"popper",children:[h.jsxs(qr,{check:!1,className:v1,value:"16",children:[r.fontSizes.small,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"16"})]}),h.jsxs(qr,{check:!1,className:v1,value:"24",children:[r.fontSizes.medium,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"24"})]}),h.jsxs(qr,{check:!1,className:v1,value:"40",children:[r.fontSizes.large,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"40"})]}),h.jsxs(qr,{check:!1,className:v1,value:"64",children:[r.fontSizes.extraLarge,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"64"})]}),h.jsxs(qr,{check:!1,className:v1,value:"96",children:[r.fontSizes.huge,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"96"})]}),h.jsx(gJ,{}),h.jsx(fae,{value:j,onValueChange:be=>{Number.isFinite(be)&&(u(F.map(Le=>Le.id),be),X())},placeholder:r.fontSizes.placeholder,type:"number"})]})]}),h.jsx("div",{className:yd}),h.jsxs("div",{className:"flex",children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",onPointerDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>{if(i){o("bold"),bt.focus(n);return}c(F.map(be=>be.id),de?"200":"700")},className:$p,"data-active":de?"true":void 0,children:h.jsx(H$,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.bold})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",onPointerDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>{if(i){o("italic"),bt.focus(n);return}d(F.map(be=>be.id),Ce?"normal":"italic")},className:$p,"data-active":Ce?"true":void 0,children:h.jsx(sX,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.italic})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",onPointerDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>{if(i){o("strikethrough"),bt.focus(n);return}Oe()},className:$p,"data-active":pe?"true":void 0,children:h.jsx(EX,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.strikethrough||"Strikethrough (Ctrl+S)"})})]}),h.jsx("div",{className:yd}),h.jsxs(Pa,{open:B==="text-align",onOpenChange:be=>{be?E("text-align"):B==="text-align"&&E(null)},value:I,onValueChange:be=>{E(null);const Le=be==="center"?"center":be==="end"?"end":"left",at=F.map(it=>it.id);if(f(at,Le),!i||!at.includes(i.id)){X();return}const Me=t.elements.find(it=>it.id===i.id);a(it=>{if(!it)return it;const mt=Me&&(Me.type==="rectangle"||Me.type==="circle")?$1(Me,Le):it.anchorX,ze=qA(mt,it.width,Le),lt=s(ze,it.anchorY);return{...it,anchorX:mt,left:lt.x,style:{...it.style,textAlign:Le}}}),X()},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,style:{gap:"0px"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:""})}),I==="left"?h.jsx(TC,{}):I==="center"?h.jsx(OC,{}):h.jsx(MC,{})]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlign})})]}),h.jsxs(Ua,{position:"popper",className:tb,children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(qr,{check:!1,className:Gp,value:"left",children:h.jsx(TC,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlignDirection.left})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(qr,{check:!1,className:Gp,value:"center",children:h.jsx(OC,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlignDirection.center})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(qr,{check:!1,className:Gp,value:"end",children:h.jsx(MC,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlignDirection.right})})]})]})]})]})]})},SM=({left:t,top:e,toolbarKey:r,viewportWidth:n,children:i})=>{const a=H.useRef(null),[s,o]=H.useState(0);H.useEffect(()=>{const l=a.current;if(!l)return;const u=new ResizeObserver(c=>{const d=c[0]?.contentRect.width??l.offsetWidth;o(d)});return u.observe(l),o(l.offsetWidth),()=>{u.disconnect()}},[r]);const A=H.useMemo(()=>{const l=s/2,u=8,c=l+u,d=Math.max(c,n-l-u);return Math.min(Math.max(t,c),d)},[t,s,n]);return h.jsx("div",{ref:a,"data-selection-toolbar":"",className:"pointer-events-auto absolute z-20 flex h-[43px] -translate-x-1/2 -translate-y-2 animate-[selection-toolbar-in_180ms_ease-out] overflow-hidden rounded-xl border border-(--panel-border) bg-(--popover-dark) text-[13px] font-semibold tracking-[0.02em] text-white shadow-[var(--panel-shadow)] backdrop-blur-[24px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] dark:bg-(--popover-dark) dark:shadow-[var(--panel-shadow)] dark:backdrop-blur-[24px] [.drawo-presentation-mode_&]:hidden",onPointerDown:l=>{l.stopPropagation()},onMouseDown:l=>{l.stopPropagation()},style:{left:A,top:e},children:i},r)},FM=({editorWrapRef:t,editor:e,editingText:r,editingDocument:n,editorSessionKey:i,cameraZoom:a,setEditingDocument:s,setEditingText:o,toThemeColor:A,getTextLineHeight:l,onEditorChange:u,onCommitEditingText:c,onToggleEditorMark:d})=>{const f=w=>w instanceof HTMLElement?!!(w.closest("[data-selection-toolbar]")||w.closest(".select-content")||w.closest('[data-slot="select-content"]')||w.closest('[data-slot="select-trigger"]')):!1,v=()=>{requestAnimationFrame(()=>{const w=document.activeElement;t.current?.contains(w)||f(w)||c()})},p=w=>{if((w.ctrlKey||w.metaKey)&&w.key==="Enter"){w.preventDefault(),c();return}if((w.ctrlKey||w.metaKey)&&w.key.toLowerCase()==="b"){w.preventDefault(),d("bold");return}if((w.ctrlKey||w.metaKey)&&w.key.toLowerCase()==="i"){w.preventDefault(),d("italic");return}if((w.ctrlKey||w.metaKey)&&w.key.toLowerCase()==="s"){w.preventDefault(),d("strikethrough");return}w.key==="Escape"&&(s(null),o(null))},C=H.useCallback(({attributes:w,children:g,leaf:b})=>{const B=b;return h.jsx("span",{...w,style:{fontWeight:B.bold===!0?700:B.bold===!1?400:void 0,fontStyle:B.italic===!0?"italic":B.italic===!1?"normal":void 0,textDecorationLine:B.strikethrough===!0?"line-through":"none",textDecorationColor:B.strikethrough===!0?"currentColor":void 0,textDecorationThickness:B.strikethrough===!0?"0.05em":void 0},children:g})},[]);return r?h.jsx("div",{ref:t,style:{position:"absolute",left:r.left,top:r.top,width:r.width,height:r.height,maxWidth:r.maxWidth,margin:0,padding:0,border:"none",outline:"none",cursor:"var(--drawo-cursor-text), auto",background:"transparent",boxShadow:"none",color:A(r.style.color),fontFamily:r.style.fontFamily,fontSize:r.style.fontSize*a,fontWeight:r.style.fontWeight,fontStyle:r.style.fontStyle,textAlign:r.style.textAlign,lineHeight:`${l(r.style.fontSize)*a}px`},children:h.jsx(gie,{editor:e,initialValue:n??Mf(r.value),onChange:u,children:h.jsx(lie,{className:"[&::selection]:bg-[rgba(59,130,246,0.34)] [&::selection]:text-inherit [&::selection]:[-webkit-text-fill-color:currentColor] [&_*::selection]:bg-[rgba(59,130,246,0.34)] dark:[&::selection]:bg-[rgba(148,189,255,0.32)] dark:[&_*::selection]:bg-[rgba(148,189,255,0.32)]",renderLeaf:C,onBlur:v,onKeyDown:p,spellCheck:!1,style:{width:"100%",height:"100%",minHeight:`${r.style.fontSize*a}px`,outline:"none",whiteSpace:"pre",wordBreak:"normal",background:"transparent",color:"inherit",WebkitTextFillColor:"currentColor",caretColor:"currentColor"}})},`${r.id}-${i}`)}):null},dae=(t,e)=>{const r=Zf(1-t/e);return Math.pow(r,1.3)},Pl=(t,e)=>{const r=$2(t);return r?`rgba(${r.r}, ${r.g}, ${r.b}, ${Zf(r.a*e)})`:t},pae=typeof navigator<"u"&&/firefox/i.test(navigator.userAgent),gae=(t,e,r)=>{const i=[];let a=0,s=0;for(let o=0;o<t.length-1;o++){const A=t[o===0?0:o-1],l=t[o],u=t[o+1],c=t[o+2]||t[o+1];for(let d=0;d<=1;d+=1/3){const f=d*d,v=f*d,p=(u.x-A.x)*.5,C=(c.x-l.x)*.5,w=l.x+p*d+(3*(u.x-l.x)-2*p-C)*f+(2*(l.x-u.x)+p+C)*v,g=(u.y-A.y)*.5,b=(c.y-l.y)*.5,B=l.y+g*d+(3*(u.y-l.y)-2*g-b)*f+(2*(l.y-u.y)+g+b)*v,E=l.t+(u.t-l.t)*d,F=dae(e-E,r.lifetime),O=Math.max(r.minWidth,r.baseWidth*F);if(O<=r.minWidth+.01)continue;const I=i[i.length-1];I&&I.x===w&&I.y===B||(i.push({x:w,y:B,widthPx:O}),a+=O,s=Math.max(s,O))}}return{samples:i,maxWidthPx:s,avgWidthPx:i.length>0?a/i.length:r.minWidth}},vae=t=>{const e=new Path2D;e.moveTo(t[0].x,t[0].y);for(let r=1;r<t.length;r++){const n=t[r];e.lineTo(n.x,n.y)}return e},bd=(t,e,r,n)=>{t.strokeStyle=n.strokeColor,t.lineWidth=n.widthPx/r.zoom,t.shadowColor=n.shadowColor,t.shadowBlur=n.shadowBlurPx/r.zoom,t.shadowOffsetX=0,t.shadowOffsetY=0,t.stroke(e)},mae=(t,e,r,n,i)=>{t.shadowBlur=0,t.shadowColor="rgba(0, 0, 0, 0)",t.shadowOffsetX=0,t.shadowOffsetY=0,t.strokeStyle=n,t.lineWidth=i/r.zoom,t.stroke(e)},wae=(t,e,r,n,i)=>{if(e.length<2)return;const{samples:a,maxWidthPx:s,avgWidthPx:o}=gae(e,r,i);if(a.length<2)return;const A=vae(a);if(t.lineJoin="round",t.lineCap="round",i.shadow){const l=Math.max(i.minWidth,o),u=document.querySelector("html")?.classList.contains("dark");pae?bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:Pl(i.color,1),widthPx:l,shadowBlurPx:Math.max(18,s*2.5)}):(bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:Pl(i.color,.75),widthPx:l,shadowBlurPx:Math.max(60,s*7)}),bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:Pl(i.color,.9),widthPx:l,shadowBlurPx:Math.max(30,s*3.5)}),bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:u?"rgba(0,0,0,0.55)":"rgba(255, 255, 255, 0.55)",widthPx:l,shadowBlurPx:Math.max(12,s*1.2)}))}mae(t,A,n,i.color,Math.max(i.minWidth,o))},Cae=()=>`laser-${Ci("draw")}`,yae=600,a2=(t,e)=>t.map(r=>({...r,points:r.points.filter(n=>e-n.t<=yae)})).filter(r=>r.points.length>0),bae=(t,e,r,n)=>a2(e?t.map(i=>{if(i.id!==e)return i;const a=i.points[i.points.length-1],s=.3/n;return a&&Math.hypot(r.x-a.x,r.y-a.y)<s?i:{...i,points:[...i.points,r]}}):t,r.t),Bae=()=>{const[t,e]=H.useState([]),[r,n]=H.useState(()=>performance.now()),i=H.useRef(null),a=H.useCallback(A=>{const l=performance.now(),u=Cae();n(l),e(c=>[...a2(c,l),{id:u,points:[{x:A.x,y:A.y,t:l}]}]),i.current=u},[]),s=H.useCallback((A,l)=>{const u=performance.now();n(u),e(c=>bae(c,i.current,{x:A.x,y:A.y,t:u},l))},[]),o=H.useCallback(()=>{i.current=null},[]);return H.useEffect(()=>{if(t.length===0)return;let A=0;const l=()=>{const u=performance.now();n(u),e(c=>a2(c,u)),A=window.requestAnimationFrame(l)};return A=window.requestAnimationFrame(l),()=>{window.cancelAnimationFrame(A)}},[t.length]),{laserTrails:t,laserNow:r,startLaserTrail:a,appendLaserPoint:s,clearActiveLaserTrail:o}},xae="z-50 min-w-48 rounded-xl border border-(--panel-border) bg-[var(--panel-bg,#fff)] p-1 text-[rgb(var(--text-rgb))] shadow-[var(--panel-shadow)] backdrop-blur-[24px] font-[Inter] [transform-origin:var(--radix-context-menu-content-transform-origin)] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] dark:bg-[var(--popover-dark,#1f1f1f)]!",Eae="z-50 min-w-48 rounded-xl border border-(--panel-border) bg-[var(--panel-bg,#fff)] p-1 text-[rgb(var(--text-rgb))] shadow-[var(--panel-shadow)] font-[Inter] [transform-origin:var(--radix-context-menu-content-transform-origin)] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] dark:backdrop-blur-[24px] dark:bg-[var(--popover-dark,#1f1f1f)]!",DM="flex cursor-pointer select-none items-center gap-1.5 rounded-xl px-3 py-2 text-base outline-none [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] not-data-[disabled=true]:focus:bg-[rgba(var(--text-rgb),0.1)] not-data-[disabled=true]:data-[highlighted]:bg-[rgba(var(--text-rgb),0.1)] data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",Sae="data-[variant=accent]:text-[rgb(var(--accent-rgb))]! data-[variant=accent]:[filter:brightness(0.5)] data-[variant=accent]:hover:bg-[rgba(var(--accent-rgb),0.179)]! data-[variant=destructive]:text-[rgb(255,4,4)]! data-[variant=destructive]:hover:bg-[rgba(255,0,0,0.179)]! dark:data-[variant=destructive]:text-[rgb(255,126,126)]! dark:data-[variant=destructive]:hover:bg-[rgba(255,126,126,0.1)]!",Fae="ml-auto scale-90 stroke-[1.4]",Dae="my-[3px] mx-2 h-px bg-[rgba(var(--text-rgb),0.1)]";function Lae(t){return h.jsx(GH,{"data-slot":"context-menu",...t})}function Iae({className:t,...e}){return h.jsx($H,{"data-slot":"context-menu-trigger",className:"select-none"+(t?" "+t:""),...e})}function nb(t){return h.jsx(eK,{"data-slot":"context-menu-sub",...t})}function kae({className:t,...e}){return h.jsx(XH,{children:h.jsx(YH,{"data-slot":"context-menu-content",className:xae+" max-h-[var(--radix-context-menu-content-available-height)]"+(t?" "+t:""),...e})})}function Ta({className:t,inset:e,disabled:r=!1,variant:n="default",...i}){return h.jsx(ZH,{"data-slot":"context-menu-item","data-inset":e,"data-disabled":r,"data-variant":n,className:DM+" "+Sae+(t?" "+t:""),...i})}function ib({className:t,inset:e,children:r,...n}){return h.jsxs(tK,{"data-slot":"context-menu-sub-trigger","data-inset":e,className:DM+(t?" "+t:""),...n,children:[r,h.jsx(I$,{className:Fae})]})}function ab({className:t,...e}){return h.jsx(rK,{"data-slot":"context-menu-sub-content",className:Eae+(t?" "+t:""),...e})}function Xp({className:t,...e}){return h.jsx(JH,{"data-slot":"context-menu-separator",className:Dae+(t?" "+t:""),...e})}const wo="ml-auto flex items-center gap-0.5 pl-6 text-xs opacity-70 [.drawo-zen-mode_&]:hidden [&>span]:rounded-[5px] [&>span]:bg-[rgba(var(--text-rgb),0.1)] [&>span]:px-1 [&>span]:py-0.5 [&>span]:font-medium [&>span]:text-[rgba(var(--text-rgb),0.6)] [&>span]:[corner-shape:squircle] [&>span]:supports-[corner-shape:squircle]:rounded-[12px]",LM=({children:t,hasSelection:e,canFlipSelection:r,selectionType:n,selectionOpacity:i,hasElements:a,localeMessages:s,canUngroupSelection:o,onCut:A,onCopy:l,onPaste:u,onDuplicate:c,onDelete:d,onGroup:f,onUngroup:v,onSelectAll:p,onMoveForward:C,onBringToFront:w,onSendToBack:g,onMoveBackward:b,onFlipHorizontal:B,onFlipVertical:E,onSelectionOpacityChange:F})=>{const O=e&&n==="multiple",I=H.useMemo(()=>typeof i!="number"||!Number.isFinite(i)?100:Math.max(0,Math.min(100,Math.round(i))),[i]),[k,j]=H.useState(I),[D,L]=H.useState(String(I));H.useEffect(()=>{j(I),L(String(I))},[I,e]);const P=R=>{const q=Math.max(0,Math.min(100,Math.round(R)));j(q),L(String(q)),F(q)};return h.jsxs(Lae,{children:[h.jsx(Iae,{children:t}),h.jsxs(kae,{children:[e&&h.jsxs(h.Fragment,{children:[h.jsxs(Ta,{onClick:A,children:[h.jsx(yX,{}),s.contextMenu.cut,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"X"})]})]}),h.jsxs(Ta,{onClick:l,children:[h.jsx(G$,{}),s.contextMenu.copy,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"C"})]})]})]}),h.jsxs(Ta,{onClick:u,children:[h.jsx(xX,{}),s.contextMenu.paste,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"V"})]})]}),e&&h.jsxs(h.Fragment,{children:[h.jsxs(Ta,{onClick:c,children:[h.jsx($$,{}),s.contextMenu.duplicate,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()}),"+",h.jsx("span",{children:"D"})]})]}),h.jsxs(Ta,{onClick:d,variant:"destructive",children:[h.jsx(IX,{}),s.contextMenu.delete,h.jsx("span",{className:wo,children:h.jsx("span",{children:"Del"})})]})]}),(O||o||e)&&h.jsx(Xp,{}),(O||o)&&h.jsxs(h.Fragment,{children:[O&&h.jsxs(Ta,{onClick:f,children:[h.jsx(cT,{}),s.contextMenu.group,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()}),"+",h.jsx("span",{children:"G"})]})]}),o&&h.jsxs(Ta,{onClick:v,children:[h.jsx(z$,{}),s.contextMenu.ungroup,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()}),"+",h.jsx("span",{children:Bp()}),"+",h.jsx("span",{children:"G"})]})]})]}),e&&h.jsxs(h.Fragment,{children:[h.jsxs(nb,{children:[h.jsxs(ib,{children:[h.jsx(oX,{}),s.contextMenu.layers.text]}),h.jsxs(ab,{children:[h.jsxs(Ta,{onClick:w,children:[h.jsx(gY,{}),s.contextMenu.layers.bringToFront]}),h.jsxs(Ta,{onClick:C,children:[h.jsx(vY,{}),s.contextMenu.layers.bringForward]}),h.jsxs(Ta,{onClick:g,children:[h.jsx(dY,{}),s.contextMenu.layers.sendToBack]}),h.jsxs(Ta,{onClick:b,children:[h.jsx(pY,{}),s.contextMenu.layers.sendBackward]})]})]}),h.jsxs(nb,{children:[h.jsxs(ib,{children:[h.jsx(eX,{}),s.selectionBar.opacity,"..."]}),h.jsx(ab,{className:"min-w-[230px] p-1.5",children:h.jsxs("div",{className:"flex flex-col gap-2.5 rounded-[10px] p-1.5 [corner-shape:squircle]",onPointerDown:R=>R.stopPropagation(),onClick:R=>R.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between gap-2 text-[15px]",children:[h.jsx("span",{children:s.selectionBar.opacity}),h.jsxs("div",{className:"inline-flex items-center gap-1",children:[h.jsx("input",{className:"h-4 w-[54px] min-w-[54px] rounded-lg border border-(--panel-border) bg-[rgba(var(--text-rgb),0.1)] px-2 py-1 text-xs text-right [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[16px] transition-[border-color,box-shadow,background] duration-[120ms] [appearance:textfield] [&::-webkit-inner-spin-button]:[-webkit-appearance:none] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:[-webkit-appearance:none] [&::-webkit-outer-spin-button]:m-0",type:"number",min:0,max:100,step:1,value:D,onChange:R=>{const q=R.target.value.replace(/[^0-9]/g,"");L(q)},onBlur:()=>{const R=Number.parseInt(D,10);P(Number.isFinite(R)?R:k)},onKeyDown:R=>{if(R.key==="Enter"){const q=Number.parseInt(D,10);P(Number.isFinite(q)?q:k),R.currentTarget.blur();return}R.key==="Escape"&&(L(String(k)),R.currentTarget.blur())}}),h.jsx("span",{className:"text-xs opacity-65",children:"%"})]})]}),h.jsx(rc,{className:"drawo-contextmenu-opacity-slider",value:[k],min:0,max:100,step:1,onValueChange:R=>{const q=R[0]??k;j(q),L(String(Math.round(q)))},onValueCommit:R=>{P(R[0]??k)}})]})})]}),h.jsx(Xp,{}),h.jsxs(Ta,{disabled:!r,onClick:B,children:[h.jsx(LX,{}),"Voltear horizontalmente",h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Bp()}),"+",h.jsx("span",{children:"H"})]})]}),h.jsxs(Ta,{disabled:!r,onClick:E,children:[h.jsx(DX,{}),"Voltear verticalmente",h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Bp()}),"+",h.jsx("span",{children:"V"})]})]})]}),h.jsx(Xp,{}),h.jsxs(Ta,{disabled:!a,onClick:p,children:[h.jsx(Y$,{}),s.contextMenu.selectEverything,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"A"})]})]})]})]})},m1=()=>performance.now(),Oae=220,Tae=4,Mae=4,sb=t=>t.type!=="text",Nae=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,ob=(t,e,r)=>t+(e-t)*r,Ab=(t,e,r,n,i)=>{const a=6/n;t.save(),t.strokeStyle=i,t.lineWidth=1/n,t.lineCap="round",t.setLineDash([]),t.beginPath(),t.moveTo(e-a/2,r-a/2),t.lineTo(e+a/2,r+a/2),t.moveTo(e+a/2,r-a/2),t.lineTo(e-a/2,r+a/2),t.stroke(),t.restore()},Pae=(t,e,r,n)=>{if(e.length!==0){t.save(),t.strokeStyle=n,t.fillStyle=n,t.lineWidth=1/r,t.setLineDash([6/r,4/r]);for(const i of e)t.beginPath(),i.kind==="spacing"&&i.segmentStart&&i.segmentEnd?(t.moveTo(i.segmentStart.x,i.segmentStart.y),t.lineTo(i.segmentEnd.x,i.segmentEnd.y)):i.axis==="x"?(t.moveTo(i.value,i.start),t.lineTo(i.value,i.end)):(t.moveTo(i.start,i.value),t.lineTo(i.end,i.value)),t.stroke(),Ab(t,i.movingPoint.x,i.movingPoint.y,r,n),Ab(t,i.targetPoint.x,i.targetPoint.y,r,n);t.restore()}},ym=(t,e,r)=>{if(e.type==="circle"){t.beginPath(),t.ellipse(e.x+e.width/2,e.y+e.height/2,e.width/2,e.height/2,0,0,Math.PI*2);return}ns(t,e.x,e.y,e.width,e.height,r)},Rae=(t,e,r,n)=>{if(e.fillStyle==="none")return;const i=n(e.fill);if(t.save(),e.fillStyle==="solid"){t.fillStyle=i,ym(t,e,r),t.fill(),t.restore();return}const a=8,s=Math.max(1,e.strokeWidth),o=Math.hypot(e.width,e.height)+Math.max(e.width,e.height)*2;ym(t,e,r),t.clip(),t.strokeStyle=i,t.lineWidth=s,t.lineCap="round",t.lineJoin="round";for(let A=e.x-o;A<=e.x+e.width+o;A+=a)t.beginPath(),t.moveTo(A,e.y+e.height+o),t.lineTo(A+o,e.y-o),t.stroke();t.restore()},Uae=(t,e,r,n)=>{e.strokeStyle!=="none"&&(t.save(),t.strokeStyle=n(e.stroke),t.lineCap="round",t.lineJoin="round",t.lineWidth=Math.max(1,e.strokeWidth),e.strokeStyle==="dashed"?t.setLineDash([8,4]):t.setLineDash([]),ym(t,e,r),t.stroke(),t.restore())},IM=({scene:t,showDefaultEmptyState:e=!0,shapeColors:r,strokeColors:n,alignmentGuides:i,interactionMode:a,drawingTool:s,localeMessages:o,onPointerDown:A,onPointerMove:l,onPointerUp:u,onWheelPan:c,onWheelZoom:d,onCreateElement:f,onCreateDrawElement:v,onCreateLinePathElement:p,onDrawingToolComplete:C,onDropImageFiles:w,onSelectElements:g,onCopySelection:b,onCutSelection:B,onPasteAt:E,onDuplicateSelection:F,onDeleteSelection:O,onGroupSelection:I,onUngroupSelection:k,onSelectGroupForElement:j,onReorderSelection:D,onFlipSelection:L,onTextFontFamilyChange:P,onTextFontSizeChange:R,onTextFontWeightChange:q,onTextFontStyleChange:te,onTextAlignChange:ne,onTextColorChange:Z,onDrawStrokeWidthChange:W,onDrawStrokeColorChange:se,onShapeFillColorChange:J,onShapeFillStyleChange:T,onElementsOpacityChange:_,onShapeStrokeColorChange:G,onShapeStrokeWidthChange:re,onShapeStrokeStyleChange:he,onDrawDefaultStrokeColorChange:Ae,onLineStartCapChange:Ee,onLineEndCapChange:ee,onLineEditStart:ue,onLineGeometryChange:de,onRectangleBorderRadiusChange:Ce,onGroupResizeStart:pe,onGroupRotateStart:Oe,onResizeStart:X,onRotateStart:We,onTextCommit:ft})=>{const be=H.useRef(null),Le=H.useRef(null),at=H.useRef(null),[Me,it]=H.useState(null),[mt,ze]=H.useState(null),[lt,le]=H.useState(0),ge=H.useMemo(()=>Cie(vie(Rte())),[lt]),ve=H.useRef(new Map),Re=H.useRef(null),[Ke,Se]=H.useState(()=>({width:window.innerWidth,height:window.innerHeight})),[Ge,Be]=H.useState("default"),[qe,Je]=H.useState(null),[Pt,wt]=H.useState(null),[Xt,dt]=H.useState(null),[Bt,Et]=H.useState(!1),[Ct,ut]=H.useState(!1),[Yt,Kr]=H.useState(null),[or,nr]=H.useState([]),[Fr,yt]=H.useState(null),[Ft,sn]=H.useState(null),[zr,$r]=H.useState(null),Mt=H.useRef(!1),[,tr]=H.useState(0),[Gt,on]=H.useState(null),{laserTrails:Jt,laserNow:lr,startLaserTrail:Er,appendLaserPoint:Tr,clearActiveLaserTrail:Jr}=Bae(),hn=H.useRef(null),zn=H.useRef(null),[Ln,Ot]=H.useState(!1),[we,st]=H.useState(!1),[It,Mr]=H.useState(t.settings.drawDefaults.drawStroke),[Vr,_r]=H.useState(null),[wn,Qr]=H.useState(null),[ri,ni]=H.useState(null),[dn,Li]=H.useState(null),[$e,St]=H.useState(null),[Dt,ur]=H.useState(null),[dr,_t]=H.useState(null),$t=U=>{if(!U)return null;const Q=ve.current.get(U);if(Q)return Q;const Ve=new window.Image;Ve.decoding="async",Ve.onload=()=>{tr(ke=>ke+1)},Ve.onerror=()=>{tr(ke=>ke+1)};const Pe=Re.current;return Pe&&(Ve.style.cssText="position:absolute;width:1px;height:1px;",Pe.appendChild(Ve)),Ve.src=U,ve.current.set(U,Ve),Ve},Sr=H.useRef(null),kr=H.useRef(null),Gn=H.useRef(null),An=H.useRef(null),Is=H.useRef(null),In=H.useRef(null),bn=H.useRef(!1),ks=H.useRef(!1),Os=H.useRef(!1),Ha=H.useRef(null),cr=rae(t),Ii=cr.length>0,Ia=cr.length===1,Bn=Ia?cr[0]:null,_i=t.elements.filter(U=>cr.includes(U.id)),SA=U=>{const Q=U.opacity;return typeof Q!="number"||!Number.isFinite(Q)?100:Math.max(0,Math.min(100,Q))},FA=_i.map(SA),Jc=FA.length===0?100:FA.every(U=>U===FA[0])?FA[0]:null,DA=_i.some(U=>sb(U)),co=cr.length===1&&(_i[0]?.type==="draw"||_i[0]?.type==="image")?_i[0].type:"multiple",ku=_i.some(U=>U.groupId),As=_i.length>0&&_i.every(U=>U.groupId&&U.groupId===_i[0]?.groupId)?_i[0]?.groupId??null:null,LA=As?t.elements.filter(U=>U.groupId===As).map(U=>U.id):[],Wo=!!As&&LA.length>1&&LA.length===cr.length&&LA.every(U=>cr.includes(U)),fr=cr.length===1&&!!_i[0]?.groupId,At=t.camera,qo=t.settings.theme==="dark"||t.settings.theme==="system"&&document.documentElement.classList.contains("dark"),Ou=qo&&t.settings.colorScheme==="drawo",zo=H.useCallback(U=>!U||U.points.length<2?!1:(p(U.points),$r(null),Gn.current=null,yt(null),Be("crosshair"),!0),[p]),e1=U=>{const Q=bM(t.elements,cr).filter(ke=>(ke.drawMode??"draw")===U);if(Q.length===0){const ke=U==="marker"?t.settings.drawDefaults.markerStroke:U==="quill"?t.settings.drawDefaults.quillStroke:t.settings.drawDefaults.drawStroke;return{drawMode:U,stroke:ke,strokeWidth:U==="marker"?t.settings.drawDefaults.markerStrokeWidth:U==="quill"?t.settings.drawDefaults.quillStrokeWidth:t.settings.drawDefaults.drawStrokeWidth}}const Ve=Q[0].stroke,Pe=Q[0].strokeWidth;return{drawMode:U,stroke:typeof Ve=="string"&&Ve.trim().length>0?Ve:U==="marker"?t.settings.drawDefaults.markerStroke:U==="quill"?t.settings.drawDefaults.quillStroke:t.settings.drawDefaults.drawStroke,strokeWidth:typeof Pe=="number"&&Number.isFinite(Pe)?Math.max(1,Pe):U==="marker"?t.settings.drawDefaults.markerStrokeWidth:U==="quill"?t.settings.drawDefaults.quillStrokeWidth:t.settings.drawDefaults.drawStrokeWidth}},tn=U=>{const Q=typeof U=="string"&&U.trim().length>0?U:t.settings.shapeDefaults.textColor;return Ou?z0(Q):Q},$n=H.useCallback((U,Q)=>({x:U/At.zoom+At.x,y:Q/At.zoom+At.y}),[At.x,At.y,At.zoom]),ls=H.useCallback((U,Q)=>({x:(U-At.x)*At.zoom,y:(Q-At.y)*At.zoom}),[At.x,At.y,At.zoom]),Ka=H.useCallback((U,Q,Ve)=>{const Pe=Xf(Q),ke=Pe.map(_e=>qk(U,Ve,_e)),Ne=Math.max(16,...ke),Xe=j0(Ve.fontSize),He=Ve.fontSize+(Pe.length-1)*Xe;return{lines:Pe,lineWidths:ke,width:Ne,height:He,lineHeight:Xe}},[]),us=H.useRef(new Map),Go=(U,Q,Ve,Pe)=>{const ke=`${Ve}::${Pe.fontFamily}::${Pe.fontSize}::${Pe.fontWeight}::${Pe.fontStyle}`,Ne=us.current.get(Q);if(Ne&&Ne.cacheKey===ke)return Ne.layout;const Xe=Ka(U,Ve,Pe);if(us.current.set(Q,{cacheKey:ke,layout:Xe}),us.current.size>6e3){const He=us.current.keys().next().value;typeof He=="string"&&us.current.delete(He)}return Xe},cs=(U,Q,Ve,Pe,ke,Ne)=>{const Xe=Ne?Go(U,Ne,Q,ke):Ka(U,Q,ke);return Xe.lines.forEach((He,_e)=>{const nt=Xe.lineWidths[_e]??0,Rt=qA(Ve,nt,ke.textAlign),gt=Pe+_e*Xe.lineHeight;let ir=Rt;for(const Wt of He.runs){if(!Wt.text)continue;U.font=bf(ke,Wt);const Dr=U.measureText(Wt.text).width;if(U.fillText(Wt.text,ir,gt),Wt.strikethrough){const ye=U.strokeStyle,sr=U.lineWidth;if(U.strokeStyle=U.fillStyle,U.lineWidth=Math.max(ke.fontSize*.04,.75),Wt.strikethrough){const Vt=gt-ke.fontSize*.3;U.beginPath(),U.moveTo(ir,Vt),U.lineTo(ir+Dr,Vt),U.stroke()}U.strokeStyle=ye,U.lineWidth=sr}ir+=Dr}}),Xe},t1=(U,Q,Ve,Pe,ke,Ne)=>{const Xe=Ne?Go(U,Ne,Q,ke):Ka(U,Q,ke),He=Pe-Xe.height/2;return Xe.lines.forEach((_e,nt)=>{const Rt=Xe.lineWidths[nt]??0;let gt=qA(Ve,Rt,ke.textAlign);const ir=He+ke.fontSize+nt*Xe.lineHeight;for(const Wt of _e.runs){if(!Wt.text)continue;U.font=bf(ke,Wt);const Dr=U.measureText(Wt.text).width;if(U.fillText(Wt.text,gt,ir),Wt.strikethrough){const ye=U.strokeStyle,sr=U.lineWidth;if(U.strokeStyle=U.fillStyle,U.lineWidth=Math.max(ke.fontSize*.04,.75),Wt.strikethrough){const Vt=ir-ke.fontSize*.3;U.beginPath(),U.moveTo(gt,Vt),U.lineTo(gt+Dr,Vt),U.stroke()}U.strokeStyle=ye,U.lineWidth=sr}gt+=Dr}}),Xe};H.useEffect(()=>{if(!(Ln||we||Vr==="shape-fill-color"||Vr==="shape-stroke-color"||Vr==="text-color"))return;const Q=Pe=>{const ke=Pe.target;ke&&(hn.current?.contains(ke)||zn.current?.contains(ke)||(Ot(!1),st(!1),_r(null)))},Ve=Pe=>{Pe.key==="Escape"&&(Ot(!1),st(!1),_r(null))};return window.addEventListener("pointerdown",Q),window.addEventListener("keydown",Ve),()=>{window.removeEventListener("pointerdown",Q),window.removeEventListener("keydown",Ve)}},[Vr,Ln,we]);const $o=(U,Q,Ve,Pe)=>{if(Gs(U))return null;const{start:ke,end:Ne,throughPoint:Xe}=t7(U),He=Math.max(7/Pe,G1/(2.3*Pe));return Math.hypot(Q-ke.x,Ve-ke.y)<=He?"start":Math.hypot(Q-Ne.x,Ve-Ne.y)<=He?"end":Math.hypot(Q-Xe.x,Ve-Xe.y)<=He?"control":null},Tu=(U,Q,Ve,Pe)=>{if(!Gs(U)||!U.points)return null;const ke=Math.max(7/Pe,G1/(2.15*Pe));let Ne=null,Xe=Number.POSITIVE_INFINITY;for(let He=0;He<U.points.length;He++){const _e=U.points[He],nt=Math.hypot(Q-_e.x,Ve-_e.y);nt<=ke&&nt<Xe&&(Ne=He,Xe=nt)}return Ne},IA=(U,Q,Ve=!0)=>{if(U.type==="rectangle"||U.type==="circle"||U.type==="image"||U.type==="svg")return{x:U.x,y:U.y,width:U.width,height:U.height};if(U.type==="draw")return mz(U);if(U.type==="line")return X1(U);const Pe=Q?Ka(Q,U.text,{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle}).width:Math.max(16,yl(U)),ke=qA(U.x,Pe,U.textAlign),Ne=yu(U),Xe={x:ke,y:U.y-U.fontSize,width:Pe,height:Ne};if(!Ve)return Xe;const He=cz/At.zoom;return{x:Xe.x-He,y:Xe.y-He,width:Xe.width+He*2,height:Xe.height+He*2}},Yi=(U,Q,Ve=!0)=>{const Pe=t.elements.find(ke=>ke.id===U);return Pe?IA(Pe,Q,Ve):null},Ts=(U,Q,Ve,Pe)=>{const ke=G1/Ve,Ne=uz/Ve,Xe=["nw","ne","se","sw"],He=_e=>{const nt=uO(Q,_e),Rt=Pt===_e,gt=qe===_e;let ir=1,Wt=2/Ve,ar=.1,Dr=1/Ve;gt?(ir=1.35,Wt=8/Ve,ar=.25,Dr=2.5/Ve):Rt&&(ir=1.2,Wt=5/Ve,ar=.18,Dr=1.5/Ve);const ye=ke*ir,sr=ye/2,Vt=nt.x-sr,Ar=nt.y-sr;if(U.save(),U.shadowColor=`rgba(0, 0, 0, ${ar})`,U.shadowBlur=Wt,U.shadowOffsetX=0,U.shadowOffsetY=1.5/Ve,U.fillStyle=gt?Pe:tn(t.settings.shapeDefaults.fill),U.strokeStyle=Pe,U.lineWidth=Dr,ns(U,Vt,Ar,ye,ye,Ne*ir),U.fill(),U.stroke(),(Rt||gt)&&(U.strokeStyle=Pe,U.globalAlpha=gt?.15:.08,U.lineWidth=(4+(gt?2:0))/Ve,ns(U,Vt,Ar,ye,ye,Ne*ir),U.stroke(),U.globalAlpha=1),Rt||gt){U.fillStyle=gt?"rgba(255, 255, 255, 0.25)":"rgba(255, 255, 255, 0.15)";const Rn=ye*.5;U.beginPath(),U.arc(nt.x,nt.y,Rn/2,0,Math.PI*2),U.fill()}U.restore()};for(const _e of Xe)He(_e)},Va=(U,Q,Ve=!0)=>{if(U.length===0)return null;const Pe=U.map(_e=>Yi(_e,Q,Ve)).filter(_e=>_e!==null);if(Pe.length===0)return null;const ke=Math.min(...Pe.map(_e=>_e.x)),Ne=Math.min(...Pe.map(_e=>_e.y)),Xe=Math.max(...Pe.map(_e=>_e.x+_e.width)),He=Math.max(...Pe.map(_e=>_e.y+_e.height));return{x:ke,y:Ne,width:Xe-ke,height:He-Ne}},Ms=U=>{if(Gt)return;const Q=t.elements.filter(_e=>cr.includes(_e.id)&&sb(_e));if(Q.length===0)return;const Ve=Q.map(_e=>({id:_e.id,bounds:IA(_e)})),Pe=Math.min(...Ve.map(_e=>_e.bounds.x)),ke=Math.min(...Ve.map(_e=>_e.bounds.y)),Ne=Math.max(...Ve.map(_e=>_e.bounds.x+_e.bounds.width)),Xe=Math.max(...Ve.map(_e=>_e.bounds.y+_e.bounds.height)),He=new Map;for(const _e of Ve){const nt=_s(_e.bounds),Rt=U==="horizontal"?Pe+Ne-(_e.bounds.x+_e.bounds.width):_e.bounds.x,gt=U==="vertical"?ke+Xe-(_e.bounds.y+_e.bounds.height):_e.bounds.y;He.set(_e.id,{fromCenterX:nt.x,fromCenterY:nt.y,toCenterX:nt.x+(Rt-_e.bounds.x),toCenterY:nt.y+(gt-_e.bounds.y)})}on({axis:U,startedAt:m1(),durationMs:Oae,items:He})};H.useEffect(()=>{if(!Gt)return;let U=0;const Q=()=>{if(m1()-Gt.startedAt>=Gt.durationMs){on(null),L(Gt.axis);return}tr(Pe=>Pe+1),U=requestAnimationFrame(Q)};return U=requestAnimationFrame(Q),()=>{cancelAnimationFrame(U)}},[Gt,L]);const Xo=t.elements.some(U=>U.type==="image"&&U.isAnimated===!0);H.useEffect(()=>{if(!Xo)return;let U=0;const Q=()=>{tr(Ve=>Ve+1),U=requestAnimationFrame(Q)};return U=requestAnimationFrame(Q),()=>{cancelAnimationFrame(U)}},[Xo]),H.useEffect(()=>{kr.current=zr},[zr]),H.useEffect(()=>{s!=="line"&&(kr.current&&zo(kr.current),Gn.current&&(Gn.current=null,$r(null)))},[zo,s]);const fo=(()=>{if(cr.length===0||Bt||qe||Xt||$e||dr!==null)return null;const U=Va(cr,void 0,!0);if(!U)return null;const Q=ls(U.x,U.y),Ve=ls(U.x+U.width,U.y+U.height),Pe=(Q.x+Ve.x)/2,ke=Math.max(8,Math.min(Q.y-42,Ke.height-46));return{left:Pe,top:ke,key:cr.join("|")}})(),kA=(U,Q)=>{if(Me)return null;const Ve=be.current;if(!Ve)return null;const Pe=Ve.getContext("2d");if(!Pe)return null;if(cr.length>1){const nt=Va(cr,Pe,!0);return nt?Wh(nt,U,Q,At.zoom):null}if(!Bn)return null;const ke=t.elements.find(nt=>nt.id===Bn);if(ke?.type==="line")return null;ke?.type==="text"&&(Pe.font=l1(ke));const Ne=Yi(Bn,Pe);if(!Ne)return null;const Xe=(ke?.rotation??0)*Math.PI/180,He=_s(Ne),_e=N1(U,Q,He.x,He.y,-Xe);return Wh(Ne,_e.x,_e.y,At.zoom)},xl=(U,Q,Ve,Pe)=>{const ke=Math.min(U.width,U.height)/2,Xe=Math.max(0,Math.min(Q,ke))+Zw/Ve;return Pe==="nw"?{x:U.x+Xe,y:U.y+Xe}:Pe==="ne"?{x:U.x+U.width-Xe,y:U.y+Xe}:Pe==="se"?{x:U.x+U.width-Xe,y:U.y+U.height-Xe}:{x:U.x+Xe,y:U.y+U.height-Xe}},Ns=()=>{if(!Bn)return null;const U=t.elements.find(Q=>Q.id===Bn);return!U||U.type!=="rectangle"?null:U},Wa=(U,Q,Ve,Pe)=>{const ke={x:U.x,y:U.y,width:U.width,height:U.height},Ne=["nw","ne","se","sw"],Xe=Yw/(2*Pe);for(const He of Ne){const _e=xl(ke,U.borderRadius,Pe,He);if(Math.hypot(Q-_e.x,Ve-_e.y)<=Xe)return He}return null},Mu=()=>Cm(t.elements,cr).some(ke=>ke.type==="text")||Me?h.jsx(EM,{scene:t,selectedIds:cr,localeMessages:o,editor:ge,editingText:Me,setEditingText:it,worldToScreen:ls,toggleEditorMark:en,onTextCommit:ft,onTextFontFamilyChange:P,onTextFontSizeChange:R,onTextFontWeightChange:q,onTextFontStyleChange:te,onTextAlignChange:ne,onTextColorChange:Z,shapeColors:r,customDrawColorPickerWrapRef:hn,customDrawColorPickerContentRef:zn,customDrawColorPickerColor:It,setCustomDrawColorPickerColor:Mr,activeSelectId:Vr,setActiveSelectId:_r}):nae(t.elements,cr).length>0?h.jsx(fM,{}):yM(t.elements,cr).length>0?h.jsx(BM,{scene:t,shapeColors:r,selectedIds:cr,localeMessages:o,customDrawColorPickerWrapRef:hn,customDrawColorPickerContentRef:zn,customDrawColorPickerColor:It,setCustomDrawColorPickerColor:Mr,onShapeFillColorChange:J,onShapeFillStyleChange:T,onShapeStrokeColorChange:G,onShapeStrokeWidthChange:re,onShapeStrokeStyleChange:he,uniColor:pn,activeSelectId:Vr,setActiveSelectId:_r}):h.jsx(xM,{scene:t,strokeColors:n,selectedIds:cr,drawingTool:s,localeMessages:o,customDrawColorPickerWrapRef:hn,customDrawColorPickerContentRef:zn,isCustomDrawColorPickerOpen:Ln,setIsCustomDrawColorPickerOpen:Ot,customDrawColorPickerColor:It,setCustomDrawColorPickerColor:Mr,onDrawStrokeWidthChange:W,onDrawStrokeColorChange:se,onDrawDefaultStrokeColorChange:Ae,onLineStartCapChange:Ee,onLineEndCapChange:ee,uniColor:pn,activeSelectId:Vr,setActiveSelectId:_r}),qa=(U,Q,Ve)=>{if(ks.current&&!Me)return"grab";if(s&&s!=="image")return"crosshair";const Pe=Ns();if(Pe){const Xe={x:Pe.x,y:Pe.y,width:Pe.width,height:Pe.height},He=_s(Xe),_e=N1(U,Q,He.x,He.y,-Pe.rotation*Math.PI/180);if(Wa(Pe,_e.x,_e.y,At.zoom))return"pointer"}if(a==="pan")return"grab";if(Bn){const Xe=t.elements.find(He=>He.id===Bn&&He.type==="line");if(Xe){const He=hp(Xe,U,Q);if(Gs(Xe)){const _e=Tu(Xe,He.x,He.y,At.zoom);if(ur(_e),Li(null),_e!==null)return"pointer"}else{const _e=$o(Xe,He.x,He.y,At.zoom);if(Li(_e),ur(null),_e)return"pointer"}}else Li(null),ur(null)}else Li(null),ur(null);const ke=kA(U,Q);return ke?(wt(ke.mode==="resize"?ke.handle:null),ke.mode==="resize"?c1(ke.handle):f1(ke.handle)):(wt(null),M1(t.elements,U,Q)?Ve?"clone":"grab":"default")},El=U=>{const Q=Math.min(U.startX,U.currentX),Ve=Math.min(U.startY,U.currentY),Pe=Math.abs(U.currentX-U.startX),ke=Math.abs(U.currentY-U.startY);return{x:Q,y:Ve,width:Pe,height:ke}},ho=U=>{const Q=U.currentX-U.startX,Ve=U.currentY-U.startY;if(U.fromCenter){let Pe=Math.abs(Q),ke=Math.abs(Ve);if(U.lockAspect){const Ne=Math.max(Pe,ke);Pe=Ne,ke=Ne}return{x:U.startX-Pe,y:U.startY-ke,width:Pe*2,height:ke*2}}if(U.lockAspect){const Pe=Math.max(Math.abs(Q),Math.abs(Ve));return{x:Q>=0?U.startX:U.startX-Pe,y:Ve>=0?U.startY:U.startY-Pe,width:Pe,height:Pe}}return{x:Math.min(U.startX,U.currentX),y:Math.min(U.startY,U.currentY),width:Math.abs(Q),height:Math.abs(Ve)}},fs=(U,Q,Ve,Pe)=>{const ke=Ve-U,Ne=Pe-Q;if(ke===0&&Ne===0)return{x:Ve,y:Pe};const Xe=Math.atan2(Ne,ke),He=Math.round(Xe/(Math.PI/4))*(Math.PI/4),_e=Math.hypot(ke,Ne);return{x:U+Math.cos(He)*_e,y:Q+Math.sin(He)*_e}},x=U=>{if(U.lockAspect){const Q=fs(U.startX,U.startY,U.currentX,U.currentY);return{startX:U.startX,startY:U.startY,endX:Q.x,endY:Q.y}}return{startX:U.startX,startY:U.startY,endX:U.currentX,endY:U.currentY}},K=(U,Q)=>U.x<Q.x+Q.width&&U.x+U.width>Q.x&&U.y<Q.y+Q.height&&U.y+U.height>Q.y,oe=U=>{const Ve=be.current?.getContext("2d"),Pe=El(U),ke=new Set;for(const Ne of t.elements){Ne.type==="text"&&Ve&&(Ve.font=l1(Ne));const Xe=Yi(Ne.id,Ve,!0);if(!(!Xe||!K(Pe,Xe))){if(!Ne.groupId){ke.add(Ne.id);continue}for(const He of t.elements)He.groupId===Ne.groupId&&ke.add(He.id)}}return[...ke]},me=H.useCallback(U=>{const Q=be.current;if(!Q)return;const Ve=Q.getContext("2d");if(!Ve)return;if(le(gt=>gt+1),U.type==="text"){ze(Mf(U.text));const gt=Ka(Ve,U.text,{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle}),ir=qA(U.x,gt.width,U.textAlign),Wt=ls(ir,U.y-U.fontSize);it({id:U.id,value:U.text,anchorX:U.x,anchorY:U.y-U.fontSize,left:Wt.x,top:Wt.y,width:gt.width*At.zoom,height:gt.height*At.zoom,style:{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle,color:U.color,textAlign:U.textAlign}});return}const Pe={id:U.id,x:$1(U,U.textAlign),y:U.y+U.height/2,text:U.text,fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle,color:U.color,textAlign:U.textAlign},ke=Ka(Ve,Pe.text,{fontFamily:Pe.fontFamily,fontSize:Pe.fontSize,fontWeight:Pe.fontWeight,fontStyle:Pe.fontStyle}),Ne=Math.max(16,U.width-Gv*2),Xe=Math.min(ke.width,Ne),He=$1(U,U.textAlign),_e=U.y+U.height/2-ke.height/2,nt=qA(He,Xe,U.textAlign),Rt=ls(nt,_e);ze(Mf(U.text)),it({id:U.id,value:U.text,anchorX:He,anchorY:_e,left:Rt.x,top:Rt.y,width:Xe*At.zoom,height:ke.height*At.zoom,maxWidth:Ne*At.zoom,style:{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle,color:U.color,textAlign:U.textAlign}})},[At.zoom,Ka,ls]),Te=U=>{if(!Me)return;const Q=mt?w0(mt):Me.value;ft(Me.id,Q);try{ct.deselect(ge)}catch{}ze(null),it(null)};H.useEffect(()=>{const U=()=>{Se({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U)}},[]),H.useEffect(()=>{const U=be.current;if(!U)return;const Q=Ve=>{if(Me){Ve.preventDefault();return}const Pe=U.getBoundingClientRect(),ke=Ve.clientX-Pe.left,Ne=Ve.clientY-Pe.top;if(Ve.preventDefault(),Ve.ctrlKey||Ve.metaKey){d(ke,Ne,Ve.deltaY);return}const Xe=Ve.shiftKey&&Math.abs(Ve.deltaX)<Math.abs(Ve.deltaY)?Ve.deltaY:Ve.deltaX,He=Ve.shiftKey&&Math.abs(Ve.deltaX)<Math.abs(Ve.deltaY)?0:Ve.deltaY;c(Xe,He)};return U.addEventListener("wheel",Q,{passive:!1}),()=>{U.removeEventListener("wheel",Q)}},[Me,c,d]),H.useEffect(()=>{const U=be.current;if(!U)return;const Q=U.getContext("2d");if(!Q)return;const Ve=getComputedStyle(U),Pe=Ve.getPropertyValue("--accent").trim()||"#7c5cff",ke=aC(Ve.getPropertyValue("--accent-rgb"))||aC(Pe)||"124, 92, 255",Ne=`rgba(${ke}, 0.45)`,Xe=`rgba(${ke}, 0.12)`,He=qo?"#ff9b9b":"#ff7a7a",_e=Gt?Math.min(1,Math.max(0,(m1()-Gt.startedAt)/Gt.durationMs)):null,nt=_e===null?null:Nae(_e),Rt=(ye,sr,Vt)=>{if(!Gt||nt===null)return;const Ar=Gt.items.get(Vt);if(!Ar)return;const Rn=ob(Ar.fromCenterX,Ar.toCenterX,nt),ki=ob(Ar.fromCenterY,Ar.toCenterY,nt),Yn=Gt.axis==="horizontal"?1-nt*2:1,ha=Gt.axis==="vertical"?1-nt*2:1,Zn=Math.abs(Yn)<.001?Yn<0?-.001:.001:Yn,ui=Math.abs(ha)<.001?ha<0?-.001:.001:ha,gn=_s(sr);ye.translate(Rn,ki),ye.scale(Zn,ui),ye.translate(-gn.x,-gn.y)};if(Q.fillStyle=t.settings.drawDefaults.canvas,Q.fillRect(0,0,U.width,U.height),Q.save(),Q.setTransform(At.zoom,0,0,At.zoom,-At.x*At.zoom,-At.y*At.zoom),t.settings.showGrid){const ye=Math.max(4,t.settings.gridSize),sr=Math.max(1,Math.ceil(fz/(ye*At.zoom))),Vt=ye*sr,Ar=At.x,Rn=At.y,ki=At.x+U.width/At.zoom,Yn=At.y+U.height/At.zoom,ha=Math.floor(Ar/Vt)*Vt,Zn=Math.floor(Rn/Vt)*Vt,ui=qo?"#ffffff10":"#B3B2B370";if(t.settings.gridStyle==="squares"){Q.strokeStyle=ui,Q.lineWidth=1/At.zoom,Q.beginPath();for(let gn=ha;gn<=ki;gn+=Vt)Q.moveTo(gn,Rn),Q.lineTo(gn,Yn);for(let gn=Zn;gn<=Yn;gn+=Vt)Q.moveTo(Ar,gn),Q.lineTo(ki,gn);Q.stroke()}else{const gn=2/At.zoom,za=gn/2;Q.fillStyle=ui;for(let xt=ha;xt<=ki;xt+=Vt)for(let vn=Zn;vn<=Yn;vn+=Vt)Q.fillRect(xt-za,vn-za,gn,gn)}}const gt=new Set(cr),ir=Yt!==null?new Set(or):null,Wt=Math.max(160/At.zoom,48),ar={x:At.x-Wt,y:At.y-Wt,width:U.width/At.zoom+Wt*2,height:U.height/At.zoom+Wt*2},Dr=ye=>!(ye.x+ye.width<ar.x||ye.x>ar.x+ar.width||ye.y+ye.height<ar.y||ye.y>ar.y+ar.height);for(const ye of t.elements){const sr=gt.has(ye.id),Vt=sr&&(!Wo||cr.length===1),Ar=Yt!==null&&ir?.has(ye.id)&&!sr,Rn=cr.length>1,ki=ye.rotation*Math.PI/180,Yn=SA(ye)/100;if(!sr&&!Ar&&Me?.id!==ye.id){let xt=null;if(ye.type==="draw"||ye.type==="image"||ye.type==="rectangle"||ye.type==="circle"?xt={x:ye.x,y:ye.y,width:ye.width,height:ye.height}:ye.type==="line"&&(xt=X1(ye)),xt&&!Dr(xt))continue}if(ye.type==="draw"){const xt=ye.drawMode??"draw",vn={x:ye.x,y:ye.y,width:ye.width,height:ye.height},rn={x:vn.x-ye.x,y:vn.y-ye.y,width:vn.width,height:vn.height},Xr=_s(vn);if(Q.save(),Rt(Q,vn,ye.id),Q.translate(Xr.x,Xr.y),Q.rotate(ki),Q.translate(-Xr.x,-Xr.y),Q.translate(ye.x,ye.y),ye.points.length>0){const Un=Yv(xt,qo),da=Q.globalCompositeOperation,pa=Q.globalAlpha;Q.globalCompositeOperation=Un.compositeOperation,Q.globalAlpha*=Un.opacity*Yn;const Zi=Xv(ye.strokeWidth);Q.strokeStyle=tn(ye.stroke),Q.fillStyle=tn(ye.stroke),Q.lineWidth=Zi,Q.lineJoin="round",Q.lineCap=Zv();const Hi=ye.points;Hi.length===1?xt==="marker"?Ac(Q,Hi,Zi):xt==="quill"?lc(Q,Hi,Zi,t.settings.quillDrawOptimizations):(Q.beginPath(),Q.arc(Hi[0].x,Hi[0].y,Q.lineWidth/2,0,Math.PI*2),Q.fillStyle=tn(ye.stroke),Q.fill()):Hi.length>1&&(xt==="marker"?Ac(Q,Hi,Zi):xt==="quill"?lc(Q,Hi,Zi,t.settings.quillDrawOptimizations):(Q.beginPath(),G0(Q,Hi),Q.stroke())),Q.globalCompositeOperation=da,Q.globalAlpha=pa}Vt?(Q.strokeStyle=Rn?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(rn.x,rn.y,rn.width,rn.height),Ia&&Ts(Q,rn,At.zoom,Pe)):Ar&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(rn.x,rn.y,rn.width,rn.height)),Q.restore();continue}if(ye.type==="image"){const xt=ye,vn={x:xt.x,y:xt.y,width:xt.width,height:xt.height},rn=_s(vn),Xr=xt.src?$t(xt.src):null,Un=Math.min(16/At.zoom,Math.min(xt.width,xt.height)/6);Q.save(),Rt(Q,vn,xt.id),Q.translate(rn.x,rn.y),Q.rotate(ki),Q.translate(-rn.x,-rn.y);const da=Q.globalAlpha;Q.globalAlpha*=Yn,(xt.flipX||xt.flipY)&&(Q.translate(rn.x,rn.y),Q.scale(xt.flipX?-1:1,xt.flipY?-1:1),Q.translate(-rn.x,-rn.y)),Q.shadowColor="rgba(15, 23, 42, 0.14)",Q.shadowBlur=18/At.zoom,Q.shadowOffsetY=6/At.zoom,Q.fillStyle=tn(t.settings.shapeDefaults.fill),ns(Q,xt.x,xt.y,xt.width,xt.height,Un),Q.fill(),Q.save(),ns(Q,xt.x,xt.y,xt.width,xt.height,Un),Q.clip(),Xr&&Xr.complete&&Xr.naturalWidth>0&&Xr.naturalHeight>0?Q.drawImage(Xr,xt.x,xt.y,xt.width,xt.height):(Q.fillStyle=tn("#e6e7e8"),Q.fillRect(xt.x,xt.y,xt.width,xt.height)),Q.restore(),Q.shadowColor="transparent",Q.strokeStyle=tn("rgba(15, 23, 42, 0.08)"),Q.lineWidth=1/At.zoom,ns(Q,xt.x,xt.y,xt.width,xt.height,Un),Q.stroke(),Q.globalAlpha=da,Vt?(Q.strokeStyle=Rn?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height)):Ar&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height)),Vt&&Ia&&Ts(Q,vn,At.zoom,Pe),Q.restore();continue}if(ye.type==="rectangle"||ye.type==="circle"){const xt={x:ye.x,y:ye.y,width:ye.width,height:ye.height},vn=_s(xt),rn=ye.type==="rectangle"?Math.max(0,Math.min(ye.borderRadius,Math.min(ye.width,ye.height)/2)):0;Q.save(),Rt(Q,xt,ye.id),Q.translate(vn.x,vn.y),Q.rotate(ki),Q.translate(-vn.x,-vn.y);const Xr=Q.globalAlpha;if(Q.globalAlpha*=Yn,Rae(Q,ye,rn,tn),Uae(Q,ye,rn,tn),Me?.id!==ye.id&&ye.text.trim().length>0){const Un={id:`${ye.id}-shape-text`,x:$1(ye,ye.textAlign),y:ye.y+ye.height/2,text:ye.text,fontFamily:ye.fontFamily,fontSize:ye.fontSize,fontWeight:ye.fontWeight,fontStyle:ye.fontStyle,color:ye.color,textAlign:ye.textAlign};Q.save(),ye.type==="circle"?(Q.beginPath(),Q.ellipse(ye.x+ye.width/2,ye.y+ye.height/2,ye.width/2,ye.height/2,0,0,Math.PI*2),Q.clip()):(ns(Q,ye.x,ye.y,ye.width,ye.height,rn),Q.clip()),Q.font=l1(Un),Q.fillStyle=tn(Un.color),Q.textAlign="left",Q.textBaseline="alphabetic",t1(Q,Un.text,Un.x,ye.y+ye.height/2,{fontFamily:Un.fontFamily,fontSize:Un.fontSize,fontWeight:Un.fontWeight,fontStyle:Un.fontStyle,textAlign:Un.textAlign},`shape:${ye.id}`),Q.restore()}if(Q.globalAlpha=Xr,Vt?(Q.strokeStyle=Rn?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(ye.x,ye.y,ye.width,ye.height)):Ar&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(ye.x,ye.y,ye.width,ye.height)),Vt&&Ia&&(Ts(Q,xt,At.zoom,Pe),ye.type==="rectangle")){const Un=An.current;if(Un&&Wk(ye,Un.x,Un.y)){const pa=["nw","ne","se","sw"],Zi=Yw/(2*At.zoom);for(const Hi of pa){const po=xl(xt,ye.borderRadius,At.zoom,Hi);Q.fillStyle=Pe,Q.beginPath(),Q.arc(po.x,po.y,Zi,0,Math.PI*2),Q.fill(),Q.strokeStyle=tn(t.settings.shapeDefaults.fill),Q.lineWidth=1/At.zoom,Q.beginPath(),Q.arc(po.x,po.y,Zi,0,Math.PI*2),Q.stroke()}}}Q.restore();continue}if(ye.type==="line"){const xt=ye,vn=X1(xt);Q.save(),Rt(Q,vn,xt.id),fO({ctx:Q,lineElement:xt,elementOpacity:Yn,zoom:At.zoom,accentColor:Pe,accentSelectionColor:Ne,toThemeColor:tn,shouldShowElementSelection:Vt,isMultiSelection:Rn,isMarqueePreview:Ar,canTransformSelection:Ia,hoveredLineHandle:dn,activeLineHandle:$e,hoveredLinePointIndex:Dt,activeLinePointIndex:dr}),Q.restore();continue}if(Me?.id===ye.id||ye.type==="svg")continue;const ha=Go(Q,`text:${ye.id}`,ye.text,{fontFamily:ye.fontFamily,fontSize:ye.fontSize,fontWeight:ye.fontWeight,fontStyle:ye.fontStyle}),Zn=ha.width,ui={x:qA(ye.x,Zn,ye.textAlign),y:ye.y-ye.fontSize,width:Zn,height:ha.height},gn=_s(ui);Q.save(),Q.translate(gn.x,gn.y),Q.rotate(ki),Q.translate(-gn.x,-gn.y);const za=Q.globalAlpha;if(Q.globalAlpha*=Yn,Q.fillStyle=tn(ye.color),Q.textAlign="left",Q.textBaseline="alphabetic",cs(Q,ye.text,ye.x,ye.y,{fontFamily:ye.fontFamily,fontSize:ye.fontSize,fontWeight:ye.fontWeight,fontStyle:ye.fontStyle,textAlign:ye.textAlign},`text:${ye.id}`),Q.globalAlpha=za,Vt){const xt=Yi(ye.id,Q,!0);if(!xt){Q.restore();continue}Q.strokeStyle=cr.length>1?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height),Ia&&Ts(Q,xt,At.zoom,Pe)}else if(Ar){const xt=Yi(ye.id,Q,!0);xt&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height))}Q.restore()}if(cr.length>1&&!Gt){const ye=Va(cr,Q,!0);ye&&(Q.save(),Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.setLineDash([6/At.zoom,4/At.zoom]),Q.strokeRect(ye.x,ye.y,ye.width,ye.height),Q.setLineDash([]),Ts(Q,ye,At.zoom,Pe),Q.restore())}if(fr&&!Gt){const ye=Va(LA,Q,!0);ye&&(Q.save(),Q.strokeStyle=Ne,Q.lineWidth=1/At.zoom,Q.setLineDash([6/At.zoom,4/At.zoom]),Q.strokeRect(ye.x,ye.y,ye.width,ye.height),Q.setLineDash([]),Q.restore())}if(Pae(Q,i,At.zoom,He),Yt){const ye=El(Yt),sr=8/At.zoom;Q.fillStyle=Xe,Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,ns(Q,ye.x,ye.y,ye.width,ye.height,sr),Q.fill(),Q.stroke()}if(Fr){const ye=ho(Fr);if(Fr.type==="rectangle")Q.fillStyle=tn(t.settings.shapeDefaults.fill),Q.fillRect(ye.x,ye.y,ye.width,ye.height),Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(ye.x,ye.y,ye.width,ye.height);else if(Fr.type==="circle"){const sr=ye.x+ye.width/2,Vt=ye.y+ye.height/2;Q.fillStyle=tn(t.settings.shapeDefaults.fill),Q.beginPath(),Q.ellipse(sr,Vt,ye.width/2,ye.height/2,0,0,Math.PI*2),Q.fill(),Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.beginPath(),Q.ellipse(sr,Vt,ye.width/2,ye.height/2,0,0,Math.PI*2),Q.stroke()}else if(Fr.type==="line"){const sr=x(Fr);Q.strokeStyle=Pe,Q.lineWidth=2/At.zoom,Q.lineCap="round",Q.lineJoin="round",Q.beginPath(),Q.moveTo(sr.startX,sr.startY),Q.lineTo(sr.endX,sr.endY),Q.stroke()}else{const sr=Math.max(10,Math.round(ye.height)),Vt={x:ye.x,y:ye.y+sr,text:o.canvas.newText,fontFamily:"Shantell Sans, sans-serif",fontSize:sr,fontWeight:"200",fontStyle:"normal",color:t.settings.shapeDefaults.textColor};Q.font=l1(Vt),Q.fillStyle=tn(Vt.color),Q.textAlign="left",Q.textBaseline="alphabetic",Q.fillText(Vt.text,Vt.x,Vt.y)}}if(zr&&zr.points.length>0&&zr.preview){const ye=[...zr.points,zr.preview];if(Q.strokeStyle=Pe,Q.lineWidth=2/At.zoom,Q.lineCap="round",Q.lineJoin="round",Q.beginPath(),cO(Q,ye),Q.stroke(),ye.length>1){const sr=Math.max(Q.lineWidth*.52,1/At.zoom);Q.fillStyle=Pe;for(let Vt=0;Vt<ye.length;Vt++){const Ar=ye[Vt];Q.beginPath(),Q.arc(Ar.x,Ar.y,sr,0,Math.PI*2),Q.fill()}}}if(Ft&&Ft.points.length>0){const ye=Yv(Ft.drawMode,qo),sr=Q.globalCompositeOperation,Vt=Q.globalAlpha;Q.globalCompositeOperation=ye.compositeOperation,Q.globalAlpha*=ye.opacity,Q.save();const Ar=Xv(Ft.strokeWidth);Q.strokeStyle=tn(Ft.stroke),Q.fillStyle=tn(Ft.stroke),Q.lineWidth=Ar,Q.lineJoin="round",Q.lineCap=Zv(),Ft.points.length===1?Ft.drawMode==="marker"?Ac(Q,Ft.points,Ar):Ft.drawMode==="quill"?lc(Q,Ft.points,Ar,t.settings.quillDrawOptimizations):(Q.beginPath(),Q.arc(Ft.points[0].x,Ft.points[0].y,Q.lineWidth/2,0,Math.PI*2),Q.fillStyle=tn(Ft.stroke),Q.fill()):Ft.drawMode==="marker"?Ac(Q,Ft.points,Ar):Ft.drawMode==="quill"?lc(Q,Ft.points,Ar,t.settings.quillDrawOptimizations):(Q.beginPath(),G0(Q,Ft.points),Q.stroke()),Q.restore(),Q.globalCompositeOperation=sr,Q.globalAlpha=Vt}if(Jt.length>0){Q.save();const ye=t.settings.laserSettings;Q.fillStyle=ye.color;for(const sr of Jt)sr.points.length!==0&&wae(Q,sr.points,lr,At,ye);Q.restore()}Q.restore()}),H.useEffect(()=>{if(!Me){at.current=null;return}at.current!==Me.id&&(at.current=Me.id,requestAnimationFrame(()=>{try{bt.focus(ge);const U=z.end(ge,[]);ct.select(ge,U)}catch(U){console.warn("Failed to focus text editor:",U)}}))},[ge,Me]),H.useEffect(()=>{const U=Q=>{if(Q.target instanceof HTMLElement){const ke=Q.target.tagName.toLowerCase();if(Q.target.isContentEditable||ke==="input"||ke==="textarea"||ke==="select")return}if(Q.key==="Escape"&&(kr.current||Gn.current)){Q.preventDefault(),Gn.current=null,$r(null),yt(null);return}if((Q.key===" "||Q.code==="Space")&&Q.target instanceof HTMLElement&&!Q.target.isContentEditable&&Q.target.tagName.toLowerCase()!=="input"&&Q.target.tagName.toLowerCase()!=="textarea"&&(ks.current=!0),Q.key==="Enter"&&!Me&&zo(kr.current)){Q.preventDefault();return}const Ve=Q.key.toLowerCase();if(Q.shiftKey&&!Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!Me){if(Ve==="h"){if(!DA)return;Q.preventDefault(),Ms("horizontal");return}if(Ve==="v"){if(!DA)return;Q.preventDefault(),Ms("vertical");return}}if(Q.ctrlKey||Q.metaKey){const ke=Ve;if(ke==="b"||ke==="i"){if(Me)return;const Ne=Cm(t.elements,cr);if(Ne.length===0)return;if(Q.preventDefault(),ke==="b"){const He=Ne.every(_e=>_e.fontWeight==="700"||_e.fontWeight==="800"||_e.fontWeight==="900"||_e.fontWeight==="bold");q(Ne.map(_e=>_e.id),He?"200":"700");return}const Xe=Ne.every(He=>He.fontStyle==="italic");te(Ne.map(He=>He.id),Xe?"normal":"italic");return}}if(Q.key!=="Enter"||Me)return;const Pe=t.elements.find(ke=>ke.id===Bn);!Pe||Pe.type!=="text"&&Pe.type!=="rectangle"&&Pe.type!=="circle"||(Q.preventDefault(),me(Pe))};return window.addEventListener("keydown",U),()=>{window.removeEventListener("keydown",U)}},[me,DA,At.zoom,zo,Ms,Ka,ls,t.elements,Bn,cr,Me,q,te]),H.useEffect(()=>{const U=Q=>{(Q.key===" "||Q.code==="Space")&&(ks.current=!1,Os.current=!1)};return window.addEventListener("keyup",U),()=>{window.removeEventListener("keyup",U)}},[]),H.useEffect(()=>{if(!Me)return;const U=24,Q=1,Ve=Me.left+Me.width-Ke.width,Pe=-Me.left,ke=Me.top+Me.height-Ke.height,Ne=-Me.top;let Xe=0,He=0;Ve>-U+Q?Xe=Ve+U:Pe>-U+Q&&(Xe=-(Pe+U)),ke>-U+Q?He=ke+U:Ne>-U+Q&&(He=-(Ne+U)),Math.abs(Xe)<=Q&&(Xe=0),Math.abs(He)<=Q&&(He=0),(Xe!==0||He!==0)&&c(Xe,He)},[At.zoom,Ke.height,Ke.width,Me,c]),H.useEffect(()=>{const U=()=>{Mt.current||(Mt.current=!0,setTimeout(()=>{tr(Q=>Q+1)},0))};return window.__FONTS_LOADED__&&(Mt.current=!0),window.addEventListener("fontsLoaded",U),()=>{window.removeEventListener("fontsLoaded",U)}},[]);const Ye=U=>{Array.from(U.dataTransfer.items).some(Q=>Q.kind==="file")&&(U.preventDefault(),U.dataTransfer.dropEffect="copy")},ot=U=>{const Q=Array.from(U.dataTransfer.files).filter(He=>He.type.startsWith("image/"));if(Q.length===0)return;U.preventDefault();const Ve=be.current;if(!Ve)return;const Pe=Ve.getBoundingClientRect(),ke=U.clientX-Pe.left,Ne=U.clientY-Pe.top,Xe=$n(ke,Ne);w(Q,Xe.x,Xe.y)},Kt=U=>{const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke);if(An.current=Ne,Ha.current=null,U.button===1){U.preventDefault(),bn.current=!0,In.current={screenX:Pe,screenY:ke},Sr.current=null,St(null),_t(null),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Be("grabbing"),Q.setPointerCapture(U.pointerId);return}if(a==="pan"){In.current={screenX:Pe,screenY:ke},Sr.current=null,St(null),_t(null),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Be("grabbing"),Q.setPointerCapture(U.pointerId);return}if(ks.current&&!Me&&!s&&!bn.current){Os.current=!0,In.current={screenX:Pe,screenY:ke},Sr.current=null,St(null),_t(null),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Be("grabbing"),Q.setPointerCapture(U.pointerId);return}if(s&&s!=="image"){if(Me&&Te(),Sr.current=null,St(null),_t(null),s==="laser")Er(Ne);else if(s==="draw"||s==="marker"||s==="quill"){const Rt=m1(),gt=s,ir=e1(gt);sn({points:[{...Ne,t:Rt}],stroke:ir.stroke,strokeWidth:ir.strokeWidth,drawMode:gt,isLine:U.shiftKey})}else if(s==="line"){const Rt=kr.current;Rt&&Rt.points.length>0?Gn.current=null:Gn.current={screenX:Pe,screenY:ke,startX:Ne.x,startY:Ne.y},yt(null)}else yt({type:s,startX:Ne.x,startY:Ne.y,currentX:Ne.x,currentY:Ne.y,fromCenter:U.altKey,lockAspect:U.shiftKey});Be(s==="laser"?"laser":s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair"),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Q.setPointerCapture(U.pointerId);return}if(cr.length>1&&!Me){const Rt=Q.getContext("2d");if(Rt){const gt=Va(cr,Rt,!0);if(gt){const ir=Wh(gt,Ne.x,Ne.y,At.zoom);if(ir?.mode==="resize"){pe(ir.handle,Ne.x,Ne.y,gt,cr),Je(ir.handle),dt(null),Et(!1),ut(!1),Kr(null),nr([]),Be(c1(ir.handle)),Q.setPointerCapture(U.pointerId);return}const Wt=$v(gt,Ne.x,Ne.y,At.zoom);if(Wt?.mode==="rotate"){const ar=_s(gt);Oe(ar.x,ar.y,Ne.x,Ne.y,cr),dt(Wt.handle),Je(null),Et(!1),ut(!1),Kr(null),nr([]),Be(f1(Wt.handle)),Q.setPointerCapture(U.pointerId);return}}}}if(Bn&&!Me){const Rt=Q.getContext("2d");if(Rt){const gt=t.elements.find(Wt=>Wt.id===Bn);if(gt?.type==="line"){const Wt=hp(gt,Ne.x,Ne.y);if(Gs(gt)){const Dr=Tu(gt,Wt.x,Wt.y,At.zoom);if(Dr!==null){ue(),Sr.current={id:gt.id,handle:"point",pointIndex:Dr,startLine:{x:gt.x,y:gt.y,width:gt.width,height:gt.height,controlPoint:null,points:gt.points?[...gt.points]:[]}},_t(Dr),ur(Dr),St(null),Li(null),dt(null),Je(null),Et(!1),ut(!1),Kr(null),Be("pointer"),Q.setPointerCapture(U.pointerId);return}}const ar=$o(gt,Wt.x,Wt.y,At.zoom);if(ar){ue(),Sr.current={id:gt.id,handle:ar,startLine:{x:gt.x,y:gt.y,width:gt.width,height:gt.height,controlPoint:gt.controlPoint??null,points:gt.points?[...gt.points]:void 0}},St(ar),Li(ar),_t(null),ur(null),dt(null),Je(null),Et(!1),ut(!1),Kr(null),Be("pointer"),Q.setPointerCapture(U.pointerId);return}}gt?.type==="text"&&(Rt.font=l1(gt));const ir=gt?.type==="line"?null:Yi(Bn,Rt,!0);if(ir){const Wt=t.elements.find(Ar=>Ar.id===Bn),ar=(Wt?.rotation??0)*Math.PI/180,Dr=_s(ir),ye=N1(Ne.x,Ne.y,Dr.x,Dr.y,-ar);if(Wt?.type==="rectangle"&&Wa(Wt,ye.x,ye.y,At.zoom)){const Ar=Wa(Wt,ye.x,ye.y,At.zoom);if(!Ar)return;Qr(Wt.id),ni(Ar),dt(null),Je(null),Et(!1),ut(!1),Kr(null),Be("pointer"),Q.setPointerCapture(U.pointerId);return}const sr=Wh(ir,ye.x,ye.y,At.zoom);if(sr?.mode==="resize"){const Ar=Yi(Bn,Rt,!1);X(Bn,sr.handle,Ne.x,Ne.y,Ar??ir),Je(sr.handle),dt(null),Et(!1),ut(!1),Be(c1(sr.handle)),Q.setPointerCapture(U.pointerId);return}const Vt=$v(ir,ye.x,ye.y,At.zoom);if(Vt?.mode==="rotate"){We(Bn,Dr.x,Dr.y,Ne.x,Ne.y),dt(Vt.handle),Je(null),Et(!1),ut(!1),Be(f1(Vt.handle)),Q.setPointerCapture(U.pointerId);return}}}}Me&&Te();const Xe=M1(t.elements,Ne.x,Ne.y);if(!Xe){dt(null),Je(null),Et(!1),ut(!1),Kr({startX:Ne.x,startY:Ne.y,currentX:Ne.x,currentY:Ne.y}),Be("default"),Q.setPointerCapture(U.pointerId);return}U.shiftKey&&!U.altKey&&cr.length>1&&cr.includes(Xe)&&(Ha.current={hitId:Xe,selectedIds:[...cr],startScreenX:Pe,startScreenY:ke,shouldDeselect:!0});const He=!!Xe,_e=t.elements.find(Rt=>Rt.id===Xe),nt=He&&U.altKey&&!_e?.groupId;dt(null),Je(null),Kr(null),Et(He),ut(nt),Be(He?nt?"clone":"grabbing":"default"),A(Ne.x,Ne.y,U.altKey,U.shiftKey,U.ctrlKey||U.metaKey),Q.setPointerCapture(U.pointerId)},Qt=U=>{const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke);An.current=Ne;const Xe=Ha.current;if(Xe?.shouldDeselect&&Math.hypot(Pe-Xe.startScreenX,ke-Xe.startScreenY)>Tae&&(Ha.current={...Xe,shouldDeselect:!1}),bn.current){const _e=In.current;if(_e){const nt=Pe-_e.screenX,Rt=ke-_e.screenY;(nt!==0||Rt!==0)&&(c(-nt,-Rt),In.current={screenX:Pe,screenY:ke})}Be("grabbing");return}if(Os.current){const _e=In.current;if(_e){const nt=Pe-_e.screenX,Rt=ke-_e.screenY;(nt!==0||Rt!==0)&&(c(-nt,-Rt),In.current={screenX:Pe,screenY:ke})}Be("grabbing");return}if(a==="pan"){const _e=In.current;if(_e){const nt=Pe-_e.screenX,Rt=ke-_e.screenY;(nt!==0||Rt!==0)&&(c(-nt,-Rt),In.current={screenX:Pe,screenY:ke}),Be("grabbing")}else Be("grab");return}if(s){if(s==="line"){const _e=kr.current;if(_e&&_e.points.length>0){const Rt=_e.points[_e.points.length-1],gt=U.shiftKey?fs(Rt.x,Rt.y,Ne.x,Ne.y):Ne;$r({points:_e.points,preview:gt}),Be("crosshair");return}const nt=Gn.current;nt&&Math.hypot(Pe-nt.screenX,ke-nt.screenY)>=Mae&&(yt({type:"line",startX:nt.startX,startY:nt.startY,currentX:Ne.x,currentY:Ne.y,fromCenter:!1,lockAspect:U.shiftKey}),Gn.current=null)}if(s==="laser")Tr(Ne,At.zoom);else if(s==="draw"||s==="marker"||s==="quill"){const _e=m1();sn(nt=>{if(!nt)return nt;const Rt=U.shiftKey;let gt={...Ne,t:_e};if(Rt&&nt.points.length>0){const ar=nt.points[0],Dr=Math.abs(Ne.x-ar.x),ye=Math.abs(Ne.y-ar.y);Dr>ye?gt={x:Ne.x,y:ar.y,t:_e}:gt={x:ar.x,y:Ne.y,t:_e};const sr=nt.points.length>1?nt.points[1]:null,Vt=.5/At.zoom;return sr&&Math.hypot(gt.x-sr.x,gt.y-sr.y)<Vt?nt:{...nt,isLine:!0,points:[ar,gt]}}typeof gt.t!="number"&&(gt={...gt,t:_e});const ir=nt.points[nt.points.length-1],Wt=2/At.zoom;return ir&&Math.hypot(gt.x-ir.x,gt.y-ir.y)<Wt?nt:{...nt,isLine:!1,points:[...nt.points,gt]}})}else Fr&&yt(_e=>{if(!_e)return _e;if(_e.type==="line"){const nt=U.shiftKey?fs(_e.startX,_e.startY,Ne.x,Ne.y):Ne;return{..._e,currentX:nt.x,currentY:nt.y,lockAspect:U.shiftKey}}return{..._e,currentX:Ne.x,currentY:Ne.y,fromCenter:U.altKey,lockAspect:U.shiftKey}});Be(s==="laser"?"laser":s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair");return}const He=Sr.current;if(He){const _e=t.elements.find(nt=>nt.id===He.id&&nt.type==="line");if(_e){const nt=hp(_e,Ne.x,Ne.y),Rt={x:He.startLine.x,y:He.startLine.y},gt={x:He.startLine.x+He.startLine.width,y:He.startLine.y+He.startLine.height};let ir=Rt,Wt=gt,ar=He.startLine.controlPoint;if(He.handle==="start"||He.handle==="point")ir=U.shiftKey?fs(gt.x,gt.y,nt.x,nt.y):nt;else if(He.handle==="end")Wt=U.shiftKey?fs(Rt.x,Rt.y,nt.x,nt.y):nt;else if(He.handle==="control"){const Ar=(Rt.x+gt.x)/2,Rn=(Rt.y+gt.y)/2;ar=U.shiftKey?fs(Ar,Rn,nt.x,nt.y):{x:nt.x,y:nt.y}}const Dr=Ar=>t.settings.snapToGrid?Math.round(Ar/t.settings.gridSize)*t.settings.gridSize:Ar,ye={x:Dr(ir.x),y:Dr(ir.y)},sr={x:Dr(Wt.x),y:Dr(Wt.y)},Vt=ar?{x:Dr(ar.x),y:Dr(ar.y)}:null;if(He.handle==="point"&&typeof He.pointIndex=="number"&&He.startLine.points&&He.startLine.points.length>He.pointIndex){const Ar=He.startLine.points.map((ki,Yn)=>Yn===He.pointIndex?{x:ye.x,y:ye.y}:ki),Rn=kc(Ar);de(He.id,{x:Rn.x,y:Rn.y,width:Rn.width,height:Rn.height,controlPoint:null,points:Ar})}else de(He.id,{x:ye.x,y:ye.y,width:sr.x-ye.x,height:sr.y-ye.y,controlPoint:Vt})}Be("pointer");return}if(wn){const _e=t.elements.find(nt=>nt.id===wn);if(_e&&_e.type==="rectangle"&&ri){const nt={x:_e.x,y:_e.y,width:_e.width,height:_e.height},Rt=_s(nt),gt=N1(Ne.x,Ne.y,Rt.x,Rt.y,-_e.rotation*Math.PI/180),ir=Zw/At.zoom,Wt=_e.x+_e.width,ar=_e.y+_e.height;let Dr;ri==="nw"?Dr=Math.min(gt.x-_e.x-ir,gt.y-_e.y-ir):ri==="ne"?Dr=Math.min(Wt-gt.x-ir,gt.y-_e.y-ir):ri==="se"?Dr=Math.min(Wt-gt.x-ir,ar-gt.y-ir):Dr=Math.min(gt.x-_e.x-ir,ar-gt.y-ir);const ye=Math.max(0,Math.min(Dr,Math.min(_e.width,_e.height)/2));Ce([_e.id],ye)}Be("pointer");return}if(Yt){Kr(_e=>{if(!_e)return _e;const nt={..._e,currentX:Ne.x,currentY:Ne.y};return nr(oe(nt)),nt}),Be("default");return}if(l(Ne.x,Ne.y,U.shiftKey,U.altKey),Xt){Be(f1(Xt));return}if(qe){Be(c1(qe));return}if(Bt){Be(Ct?"clone":"grabbing");return}Be(qa(Ne.x,Ne.y,U.altKey))},hr=U=>{const Q=be.current;Q?.hasPointerCapture(U.pointerId)&&Q.releasePointerCapture(U.pointerId);const Ve=Ha.current;if(Ha.current=null,a==="pan"){In.current=null,Qr(null),ni(null),Be("grab");return}if(bn.current){bn.current=!1,In.current=null,Qr(null),ni(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(Os.current){Os.current=!1,In.current=null,Qr(null),ni(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(s){if(s==="line"){const ke=Gn.current;if(ke){Gn.current=null,yt(null),$r({points:[{x:ke.startX,y:ke.startY}],preview:{x:ke.startX,y:ke.startY}}),Qr(null),ni(null),Be("crosshair");return}const Ne=kr.current;if(Ne&&Ne.points.length>0){const Xe=Q?.getBoundingClientRect();if(Xe){const He=U.clientX-Xe.left,_e=U.clientY-Xe.top,nt=$n(He,_e),Rt=Ne.points[Ne.points.length-1],gt=U.shiftKey?fs(Rt.x,Rt.y,nt.x,nt.y):nt;Math.hypot(gt.x-Rt.x,gt.y-Rt.y)>=1?$r({points:[...Ne.points,gt],preview:gt}):$r({points:Ne.points,preview:gt})}Qr(null),ni(null),Be("crosshair");return}}if(s==="laser")Jr();else if(s==="draw"||s==="marker"||s==="quill")Ft&&Ft.points.length>=1&&v(Ft.points,{drawMode:Ft.drawMode,stroke:Ft.stroke}),sn(null);else if(Fr){if(Fr.type==="line"){const ke=x(Fr);Math.hypot(ke.endX-ke.startX,ke.endY-ke.startY)>=1&&f("line",ke.startX,ke.startY,o,{x:ke.startX,y:ke.startY,width:ke.endX-ke.startX,height:ke.endY-ke.startY})}else{const ke=ho(Fr);f(Fr.type,ke.x,ke.y,o,ke)}yt(null),C()}Qr(null),ni(null),Be(s==="laser"?"laser":s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair");return}if(Sr.current){u(),Sr.current=null,St(null),_t(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(wn){Qr(null),ni(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(Yt){const ke=oe(Yt),Ne=U.shiftKey?Array.from(new Set([...cr,...ke])):ke;g(Ne),Kr(null),nr([]),dt(null),Je(null),Et(!1),ut(!1);const Xe=Q?.getBoundingClientRect();if(Xe){const He=U.clientX-Xe.left,_e=U.clientY-Xe.top,nt=$n(He,_e);An.current=nt,Be(qa(nt.x,nt.y,U.altKey))}else Be("default");return}if(Ve?.shouldDeselect&&!U.altKey){u(),g(Ve.selectedIds.filter(Ne=>Ne!==Ve.hitId)),dt(null),Je(null),wt(null),Sr.current=null,St(null),_t(null),Li(null),ur(null),Et(!1),ut(!1);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}u(),dt(null),Je(null),wt(null),Sr.current=null,St(null),_t(null),Li(null),ur(null),Et(!1),ut(!1);const Pe=Q?.getBoundingClientRect();if(Pe){const ke=U.clientX-Pe.left,Ne=U.clientY-Pe.top,Xe=$n(ke,Ne);An.current=Xe,Be(qa(Xe.x,Xe.y,U.altKey))}else Be("default")},gr=()=>{if(An.current=null,bn.current){Be("grabbing");return}if(a==="pan"){Be(In.current?"grabbing":"grab");return}if(s){s==="laser"?(Jr(),Be("laser")):Be(s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair");return}if(Sr.current||$e||dr!==null){Be("pointer");return}if(wn){Be("pointer");return}if(Yt){Be("default");return}if(wt(null),Li(null),ur(null),Xt){Be(f1(Xt));return}if(qe){Be(c1(qe));return}if(Bt){Be(Ct?"clone":"grabbing");return}Be("default")},jr=U=>{if(s==="line"&&zo(kr.current)){U.preventDefault();return}if(a==="pan"||s)return;const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke),Xe=M1(t.elements,Ne.x,Ne.y);if(!Xe)return;const He=t.elements.find(_e=>_e.id===Xe);if(He?.groupId&&cr.length>1&&cr.includes(He.id)){g([He.id]);return}if(!(!He||He.type!=="text"&&He.type!=="rectangle"&&He.type!=="circle")){if(Me&&Me.id!==He.id){Te(),requestAnimationFrame(()=>{me(He)});return}me(He)}},Xn=U=>{it(Q=>{if(!Q)return Q;const Pe=be.current?.getContext("2d");if(!Pe)return Q.value===U?Q:{...Q,value:U};const ke=Ka(Pe,U,{fontFamily:Q.style.fontFamily,fontSize:Q.style.fontSize,fontWeight:Q.style.fontWeight,fontStyle:Q.style.fontStyle}),Ne=Q.maxWidth?Math.min(ke.width*At.zoom,Q.maxWidth):ke.width*At.zoom,Xe=qA(Q.anchorX,Ne/At.zoom,Q.style.textAlign),He=ls(Xe,Q.anchorY),_e=ke.height*At.zoom,nt=Math.abs(Q.left-He.x)<.001&&Math.abs(Q.top-He.y)<.001&&Math.abs(Q.width-Ne)<.001&&Math.abs(Q.height-_e)<.001;return Q.value===U&&nt?Q:{...Q,value:U,left:He.x,top:He.y,width:Ne,height:_e}})};H.useEffect(()=>{if(!Me)return;const U=mt!==null?w0(mt):Me.value;Xn(U)},[At.x,At.y,At.zoom,mt,Me?.id]);const ln=U=>{try{if(ge.selection)try{z.node(ge,ge.selection.anchor.path),z.node(ge,ge.selection.focus.path)}catch{ct.deselect(ge)}const Q=U;for(const Pe of Q)if(!Pe||typeof Pe!="object")return;if(ze(Q),!ge.operations.some(Pe=>Pe.type!=="set_selection"))return;Xn(w0(Q))}catch(Q){console.warn("Editor change failed:",Q)}},en=U=>{let Q=null;try{Q=z.marks(ge)}catch{return}const Ve=Q?.[U];if(U==="bold"||U==="italic"){if(U==="bold"?!!Me&&(Me.style.fontWeight==="bold"||Me.style.fontWeight==="700"||Me.style.fontWeight==="800"||Me.style.fontWeight==="900"):!!Me&&Me.style.fontStyle==="italic"){z.addMark(ge,U,Ve===!1);return}if(Ve===!0){z.removeMark(ge,U);return}z.addMark(ge,U,!0);return}Ve===!0?z.removeMark(ge,U):z.addMark(ge,U,!0)},pn=U=>Ou?z0(U):U,kn=U=>{const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke);Is.current=Ne,An.current=Ne;const Xe=M1(t.elements,Ne.x,Ne.y);if(!Xe){g([]);return}const He=t.elements.find(nt=>nt.id===Xe);if(!He)return;const _e=U.ctrlKey||U.metaKey;if(He.groupId&&!_e){j(He.id);return}(!cr.includes(Xe)||_e)&&g([Xe])},On=()=>{const U=Is.current;U&&E(U.x,U.y)};return h.jsxs("div",{style:{position:"relative",width:Ke.width,height:Ke.height},children:[h.jsx("div",{ref:Re,style:{position:"fixed",top:0,left:0,pointerEvents:"none",opacity:0,zIndex:-9999},"aria-hidden":"true"}),h.jsx(LM,{hasSelection:Ii,canFlipSelection:DA,selectionType:co,selectionOpacity:Jc,hasElements:t.elements.length>0,canUngroupSelection:ku,onCut:B,localeMessages:o,onCopy:b,onPaste:On,onDuplicate:F,onSelectionOpacityChange:U=>{Ii&&_(cr,U)},onDelete:O,onGroup:I,onUngroup:k,onSelectAll:()=>{t.elements.length!==0&&g(t.elements.map(U=>U.id))},onMoveForward:()=>D("forward"),onBringToFront:()=>D("front"),onSendToBack:()=>D("back"),onMoveBackward:()=>D("backward"),onFlipHorizontal:()=>Ms("horizontal"),onFlipVertical:()=>Ms("vertical"),children:h.jsx("canvas",{ref:be,width:Ke.width,height:Ke.height,onDragOver:Ye,onDrop:ot,onPointerDown:Kt,onPointerMove:Qt,onPointerUp:hr,onPointerCancel:hr,onPointerLeave:gr,onDoubleClick:jr,onContextMenu:kn,onMouseDown:U=>{U.button===1&&U.preventDefault()},onAuxClick:U=>{U.button===1&&U.preventDefault()},style:{display:"block",cursor:`var(--drawo-cursor-${Ge}, var(--drawo-cursor-default)), auto`,touchAction:"none"}})}),e&&t.elements.length===0&&!Fr&&!Ft&&!zr&&h.jsx(cM,{}),h.jsx(FM,{editorWrapRef:Le,editor:ge,editingText:Me,editingDocument:mt,editorSessionKey:lt,cameraZoom:At.zoom,setEditingDocument:ze,setEditingText:it,toThemeColor:tn,getTextLineHeight:j0,onEditorChange:ln,onCommitEditingText:()=>Te(),onToggleEditorMark:en}),fo&&h.jsx(SM,{toolbarKey:fo.key,left:fo.left,top:fo.top,viewportWidth:Ke.width,children:Mu()})]})};function s2({showDefaultEmptyState:t=!0}){const e=xA(),{scene:r,resolvedTheme:n,isPresentationMode:i,interactionMode:a,drawingTool:s,messages:o,handlers:A,setDrawingTool:l}=e,u={scene:r,showDefaultEmptyState:t,strokeColors:n.preset.strokeColors,shapeColors:n.preset.shapeColors,alignmentGuides:[],interactionMode:a,drawingTool:s,localeMessages:o,onPointerDown:A.handlePointerDown,onPointerMove:A.handlePointerMove,onPointerUp:A.handlePointerUp,onResizeStart:A.handleResizeStart,onRotateStart:A.handleRotateStart,onTextCommit:A.handleTextCommit,onWheelPan:A.handleWheelPan,onWheelZoom:A.handleWheelZoom,onCreateElement:A.handleCreateElement,onCreateDrawElement:A.handleCreateDrawElement,onCreateLinePathElement:A.handleCreateLinePathElement,onDrawingToolComplete:()=>l(null),onDropImageFiles:A.handleInsertImageFiles,onSelectElements:A.handleSelectElements,onGroupResizeStart:A.handleGroupResizeStart,onGroupRotateStart:A.handleGroupRotateStart,onTextFontFamilyChange:A.handleTextFontFamilyChange,onTextFontSizeChange:A.handleTextFontSizeChange,onTextFontWeightChange:A.handleTextFontWeightChange,onTextFontStyleChange:A.handleTextFontStyleChange,onTextAlignChange:A.handleTextAlignChange,onTextColorChange:A.handleTextColorChange,onDrawStrokeWidthChange:A.handleDrawStrokeWidthChange,onDrawStrokeColorChange:A.handleDrawStrokeColorChange,onShapeFillColorChange:A.handleShapeFillColorChange,onShapeFillStyleChange:A.handleShapeFillStyleChange,onElementsOpacityChange:A.handleElementsOpacityChange,onShapeStrokeColorChange:A.handleShapeStrokeColorChange,onShapeStrokeWidthChange:A.handleShapeStrokeWidthChange,onShapeStrokeStyleChange:A.handleShapeStrokeStyleChange,onDrawDefaultStrokeColorChange:A.handleDrawDefaultStrokeColorChange,onDrawDefaultStrokeWidthChange:A.handleDrawDefaultStrokeWidthChange,onLineStartCapChange:A.handleLineStartCapChange,onLineEndCapChange:A.handleLineEndCapChange,onLineEditStart:A.handleLineEditStart,onLineGeometryChange:A.handleLineGeometryChange,onRectangleBorderRadiusChange:A.handleRectangleBorderRadiusChange,onCopySelection:A.handleCopySelection,onCutSelection:A.handleCutSelection,onPasteAt:A.handlePasteAt,onDuplicateSelection:A.handleDuplicateSelection,onDeleteSelection:A.handleDeleteSelection,onGroupSelection:A.handleGroupSelection,onUngroupSelection:A.handleUngroupSelection,onSelectGroupForElement:A.handleSelectGroupForElement,onReorderSelection:A.handleReorderSelection,onFlipSelection:A.handleFlipSelection};return h.jsx(IM,{...u})}function _ae({className:t,color:e}){return h.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("g",{"clip-path":"url(#clip0_1539_179)",children:h.jsxs("g",{"clip-path":"url(#clip1_1539_179)",children:[h.jsx("path",{d:"M7.99556 10.0703C8.19978 9.56757 8.68826 9.23877 9.23085 9.23877H14.7692C15.3118 9.23877 15.8003 9.56757 16.0045 10.0703L19.2157 17.9747C19.7337 19.2498 20.0001 20.6131 20.0001 21.9895V45.2389H4V21.9895C4 20.6131 4.26635 19.2498 4.78436 17.9747L7.99556 10.0703Z",fill:"white"}),h.jsx("path",{d:"M7.99556 10.0703C8.19978 9.56757 8.68826 9.23877 9.23085 9.23877H14.7692C15.3118 9.23877 15.8003 9.56757 16.0045 10.0703L19.2157 17.9747C19.7337 19.2498 20.0001 20.6131 20.0001 21.9895V45.2389H4V21.9895C4 20.6131 4.26635 19.2498 4.78436 17.9747L7.99556 10.0703Z",fill:"url(#paint0_linear_1539_179)","fill-opacity":"0.6"}),h.jsx("path",{d:"M9.23047 9.48877H14.7695C15.1552 9.48887 15.5071 9.6934 15.7002 10.0181L15.7725 10.1645L18.9844 18.0688C19.4902 19.314 19.75 20.6457 19.75 21.9897V44.9888H4.25V21.9897C4.25 20.6457 4.50979 19.314 5.01562 18.0688L8.22754 10.1645C8.39342 9.75622 8.78976 9.48892 9.23047 9.48877Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.5"}),h.jsx("g",{opacity:"0.2",filter:"url(#filter0_f_1539_179)",children:h.jsx("path",{d:"M18.6635 20.6615V44.3282H12.3301V10.3281L14.6634 10.2388L18.6635 20.6615Z",fill:"url(#paint1_linear_1539_179)"})}),h.jsx("g",{filter:"url(#filter1_i_1539_179)",children:h.jsx("path",{d:"M11.383 3.74726C11.6089 3.19493 12.3911 3.19493 12.6171 3.74725L15 9.57232H9L11.383 3.74726Z",fill:e||"#1E1E1E"})}),h.jsx("path",{d:"M11.6143 3.84158C11.7556 3.49681 12.2444 3.49682 12.3857 3.84158L14.6279 9.32205H9.37207L11.6143 3.84158Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.5"}),h.jsx("path",{d:"M4.33008 23.9058H19.6635",stroke:"black","stroke-opacity":"0.15","stroke-width":"0.66667"})]})}),h.jsxs("defs",{children:[h.jsxs("filter",{id:"filter0_f_1539_179",x:"10.3301",y:"8.23875",width:"10.3335",height:"38.0894",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"1.00001",result:"effect1_foregroundBlur_1539_179"})]}),h.jsxs("filter",{id:"filter1_i_1539_179",x:"7.55999",y:"3.33301",width:"7.44001",height:"6.95926",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),h.jsx("feOffset",{dx:"-1.44001",dy:"0.720004"}),h.jsx("feGaussianBlur",{stdDeviation:"1.08001"}),h.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),h.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"}),h.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_1539_179"})]}),h.jsxs("linearGradient",{id:"paint0_linear_1539_179",x1:"4",y1:"38.2389",x2:"20.0001",y2:"38.2389",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-opacity":"0.1"}),h.jsx("stop",{offset:"0.4","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-opacity":"0.15"})]}),h.jsxs("linearGradient",{id:"paint1_linear_1539_179",x1:"12.3301",y1:"1.57206",x2:"17.1673",y2:"36.2341",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-opacity":"0.2"}),h.jsx("stop",{offset:"1","stop-opacity":"0.4"})]}),h.jsx("clipPath",{id:"clip0_1539_179",children:h.jsx("rect",{width:"24",height:"24",fill:"white"})}),h.jsx("clipPath",{id:"clip1_1539_179",children:h.jsx("rect",{width:"16",height:"34",fill:"white",transform:"translate(4 2.57227)"})})]})]})}function Qae({className:t,color:e}){return h.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("g",{"clip-path":"url(#clip0_1571_205)",children:h.jsxs("g",{"clip-path":"url(#clip1_1571_205)",children:[h.jsx("path",{opacity:"0.75",d:"M12 9.66211C12.5694 9.66211 13.1156 9.88833 13.5182 10.291C13.9209 10.6937 14.1471 11.2398 14.1471 11.8093C14.1471 12.3787 13.9209 12.9249 13.5182 13.3276C13.1156 13.7302 12.5694 13.9565 12 13.9565C11.4305 13.9565 10.8843 13.7302 10.4817 13.3276C10.079 12.9249 9.85278 12.3787 9.85278 11.8093C9.85278 11.2398 10.079 10.6937 10.4817 10.291C10.8843 9.88833 11.4305 9.66211 12 9.66211Z",fill:e||"#1E1E1E"}),h.jsx("path",{d:"M12.6409 1.61035C12.9169 1.61035 13.1466 1.8197 13.1863 2.09347C13.6442 5.2482 15.4741 7.95793 18.0518 9.59891C18.2558 9.72882 18.3578 9.97413 18.2961 10.2076L15.5418 20.5366C15.5112 20.6509 15.4438 20.752 15.3499 20.824C15.2561 20.896 15.141 20.935 15.0227 20.9349H8.97679C8.85856 20.9349 8.74364 20.8958 8.64988 20.8238C8.55611 20.7518 8.48875 20.6508 8.45825 20.5366L5.7045 10.2076C5.67486 10.0934 5.68253 9.97277 5.72638 9.86325C5.77022 9.75373 5.84795 9.6611 5.9482 9.59891C8.52588 7.95793 10.3558 5.2482 10.8142 2.09293C10.854 1.82024 11.0832 1.61035 11.3591 1.61035H12.6409ZM12 9.66225C11.4305 9.66225 10.8844 9.88847 10.4817 10.2911C10.0791 10.6938 9.85284 11.24 9.85284 11.8094C9.85284 12.3789 10.0791 12.925 10.4817 13.3277C10.8844 13.7304 11.4305 13.9566 12 13.9566C12.5695 13.9566 13.1156 13.7304 13.5183 13.3277C13.921 12.925 14.1472 12.3789 14.1472 11.8094C14.1472 11.24 13.921 10.6938 13.5183 10.2911C13.1156 9.88847 12.5695 9.66225 12 9.66225Z",fill:"white"}),h.jsxs("mask",{id:"mask0_1571_205",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"5",y:"1",width:"15",height:"21",children:[h.jsx("path",{d:"M5.14941 1.07373H19.106V21.4719H5.14941V1.07373Z",fill:"white"}),h.jsx("path",{d:"M12.6409 1.61035C12.9169 1.61035 13.1466 1.8197 13.1863 2.09347C13.6442 5.2482 15.4741 7.95793 18.0518 9.59891C18.2558 9.72882 18.3578 9.97413 18.2961 10.2076L15.5418 20.5366C15.5112 20.6509 15.4438 20.752 15.3499 20.824C15.2561 20.896 15.141 20.935 15.0227 20.9349H8.97679C8.85856 20.9349 8.74364 20.8958 8.64988 20.8238C8.55611 20.7518 8.48875 20.6508 8.45825 20.5366L5.7045 10.2076C5.67486 10.0934 5.68253 9.97277 5.72638 9.86325C5.77022 9.75373 5.84795 9.6611 5.9482 9.59891C8.52588 7.95793 10.3558 5.2482 10.8142 2.09293C10.854 1.82024 11.0832 1.61035 11.3591 1.61035H12.6409ZM12 9.66225C11.4305 9.66225 10.8844 9.88847 10.4817 10.2911C10.0791 10.6938 9.85284 11.24 9.85284 11.8094C9.85284 12.3789 10.0791 12.925 10.4817 13.3277C10.8844 13.7304 11.4305 13.9566 12 13.9566C12.5695 13.9566 13.1156 13.7304 13.5183 13.3277C13.921 12.925 14.1472 12.3789 14.1472 11.8094C14.1472 11.24 13.921 10.6938 13.5183 10.2911C13.1156 9.88847 12.5695 9.66225 12 9.66225Z",fill:"black"})]}),h.jsx("g",{mask:"url(#mask0_1571_205)",children:h.jsx("path",{d:"M13.1863 2.09331L12.9206 2.13196C13.3903 5.36667 15.2664 8.14404 17.9074 9.82582L18.0523 9.59929L18.1962 9.37276C15.6824 7.77312 13.8986 5.12995 13.452 2.05466L13.1863 2.09331ZM18.296 10.208L18.0367 10.1388L15.2825 20.4677L15.5417 20.537L15.801 20.6057L18.5548 10.2773L18.296 10.208ZM15.0221 20.9348V20.6664H8.97675V21.2032H15.0227L15.0221 20.9348ZM8.45713 20.5365L8.71694 20.4667L5.96319 10.1382L5.70392 10.2075L5.44465 10.2767L8.1984 20.6052L8.45713 20.5365ZM5.9487 9.59822L6.09309 9.82528C8.73412 8.14351 10.6107 5.36614 11.0799 2.13142L10.8147 2.09277L10.549 2.05412C10.1024 5.12995 8.3181 7.77205 5.80483 9.37276L5.9487 9.59822ZM11.359 1.61019V1.87859H12.6409V1.3418H11.359V1.61019ZM12 9.66209V9.3937C11.3593 9.3937 10.7449 9.6482 10.2919 10.1012C9.83889 10.5542 9.5844 11.1686 9.5844 11.8093H10.1212C10.1212 11.311 10.3191 10.8331 10.6715 10.4808C11.0238 10.1284 11.5017 9.93049 12 9.93049V9.66209ZM9.85279 11.8093H9.5844C9.5844 12.4499 9.83889 13.0643 10.2919 13.5173C10.7449 13.9703 11.3593 14.2248 12 14.2248V13.688C11.5017 13.688 11.0238 13.4901 10.6715 13.1378C10.3191 12.7854 10.1212 12.3076 10.1212 11.8093H9.85279ZM12 13.9564V14.2248C12.6406 14.2248 13.255 13.9703 13.708 13.5173C14.161 13.0643 14.4155 12.4499 14.4155 11.8093H13.8787C13.8787 12.3076 13.6808 12.7854 13.3285 13.1378C12.9761 13.4901 12.4983 13.688 12 13.688V13.9564ZM14.1471 11.8093H14.4155C14.4155 11.1686 14.161 10.5542 13.708 10.1012C13.255 9.6482 12.6406 9.3937 12 9.3937V9.93049C12.4983 9.93049 12.9761 10.1284 13.3285 10.4808C13.6808 10.8331 13.8787 11.311 13.8787 11.8093H14.1471ZM10.8137 2.09331L11.0799 2.13142C11.0887 2.06294 11.1216 1.99985 11.1728 1.9535C11.224 1.90715 11.29 1.88059 11.359 1.87859V1.3418C10.9425 1.3418 10.6065 1.65689 10.5485 2.05412L10.8137 2.09331ZM5.70499 10.2069L5.96426 10.1377C5.9494 10.0786 5.95389 10.0163 5.97708 9.95998C6.00028 9.90364 6.04094 9.85624 6.09309 9.82474L5.9487 9.59822L5.80483 9.37169C5.65629 9.46442 5.54128 9.6022 5.47658 9.76492C5.41187 9.92764 5.40088 10.1068 5.44518 10.2762L5.70499 10.2069ZM8.97675 20.9348V20.6664C8.91763 20.6664 8.86017 20.6468 8.81329 20.6108C8.76641 20.5748 8.73273 20.5243 8.71748 20.4672L8.45821 20.5365L8.1984 20.6052C8.24408 20.7767 8.34569 20.9283 8.48646 21.0365C8.62722 21.1446 8.79978 21.2032 8.97728 21.2032L8.97675 20.9348ZM15.5417 20.537L15.2825 20.4667C15.2673 20.524 15.2336 20.5746 15.1866 20.6108C15.1396 20.6469 15.0819 20.6664 15.0227 20.6664V21.2032C15.2002 21.2032 15.3727 21.1446 15.5135 21.0365C15.6542 20.9283 15.7553 20.7772 15.801 20.6057L15.5417 20.537ZM18.0518 9.59875L17.9079 9.82528C18.018 9.89506 18.0668 10.0239 18.0367 10.1382L18.296 10.208L18.5553 10.2767C18.5995 10.1074 18.5884 9.92837 18.5237 9.76576C18.459 9.60315 18.3446 9.46546 18.1962 9.37276L18.0518 9.59875ZM13.1863 2.09331L13.452 2.05466C13.3946 1.65743 13.058 1.3418 12.6409 1.3418V1.87859C12.7762 1.87859 12.8991 1.98326 12.9206 2.13196L13.1863 2.09331Z",fill:"black","fill-opacity":"0.15"})}),h.jsx("mask",{id:"mask1_1571_205",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"5",y:"1",width:"14",height:"20",children:h.jsx("path",{d:"M12.6409 1.61035C12.9169 1.61035 13.1466 1.8197 13.1863 2.09347C13.6442 5.2482 15.4741 7.95793 18.0518 9.59891C18.2558 9.72882 18.3578 9.97413 18.2961 10.2076L15.5418 20.5366C15.5112 20.6509 15.4438 20.752 15.3499 20.824C15.2561 20.896 15.141 20.935 15.0227 20.9349H8.97679C8.85856 20.9349 8.74364 20.8958 8.64988 20.8238C8.55611 20.7518 8.48875 20.6508 8.45825 20.5366L5.7045 10.2076C5.67486 10.0934 5.68253 9.97277 5.72638 9.86325C5.77022 9.75373 5.84795 9.6611 5.9482 9.59891C8.52588 7.95793 10.3558 5.2482 10.8142 2.09293C10.854 1.82024 11.0832 1.61035 11.3591 1.61035H12.6409ZM12 9.66225C11.4305 9.66225 10.8844 9.88847 10.4817 10.2911C10.0791 10.6938 9.85284 11.24 9.85284 11.8094C9.85284 12.3789 10.0791 12.925 10.4817 13.3277C10.8844 13.7304 11.4305 13.9566 12 13.9566C12.5695 13.9566 13.1156 13.7304 13.5183 13.3277C13.921 12.925 14.1472 12.3789 14.1472 11.8094C14.1472 11.24 13.921 10.6938 13.5183 10.2911C13.1156 9.88847 12.5695 9.66225 12 9.66225Z",fill:"white"})}),h.jsxs("g",{mask:"url(#mask1_1571_205)",children:[h.jsxs("g",{opacity:"0.75",filter:"url(#filter0_f_1571_205)",children:[h.jsx("path",{d:"M13.1272 1.61035C13.4745 5.11347 15.5062 8.12058 18.4006 9.81256L15.4354 20.9349H8.56442L5.59863 9.81256C8.49356 8.12005 10.5253 5.11293 10.8726 1.61035H11.4631V9.17914C10.8114 9.31217 10.2323 9.68243 9.83812 10.2182C9.44391 10.7539 9.26267 11.4169 9.32952 12.0786C9.39637 12.7404 9.70656 13.3538 10.1999 13.7998C10.6933 14.2459 11.3348 14.4928 11.9999 14.4928C12.665 14.4928 13.3065 14.2459 13.7998 13.7998C14.2932 13.3538 14.6034 12.7404 14.6703 12.0786C14.7371 11.4169 14.5559 10.7539 14.1617 10.2182C13.7675 9.68243 13.1884 9.31217 12.5367 9.17914V1.61035H13.1272Z",fill:"url(#paint0_linear_1571_205)"}),h.jsx("path",{d:"M13.1272 1.61035C13.4745 5.11347 15.5062 8.12058 18.4006 9.81256L15.4354 20.9349H8.56442L5.59863 9.81256C8.49356 8.12005 10.5253 5.11293 10.8726 1.61035H11.4631V9.17914C10.8114 9.31217 10.2323 9.68243 9.83812 10.2182C9.44391 10.7539 9.26267 11.4169 9.32952 12.0786C9.39637 12.7404 9.70656 13.3538 10.1999 13.7998C10.6933 14.2459 11.3348 14.4928 11.9999 14.4928C12.665 14.4928 13.3065 14.2459 13.7998 13.7998C14.2932 13.3538 14.6034 12.7404 14.6703 12.0786C14.7371 11.4169 14.5559 10.7539 14.1617 10.2182C13.7675 9.68243 13.1884 9.31217 12.5367 9.17914V1.61035H13.1272Z",fill:"url(#paint1_linear_1571_205)"}),h.jsx("mask",{id:"mask2_1571_205",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"5",y:"1",width:"14",height:"20",children:h.jsx("path",{d:"M13.1272 1.61035C13.4745 5.11347 15.5062 8.12058 18.4006 9.81256L15.4354 20.9349H8.56442L5.59863 9.81256C8.49356 8.12005 10.5253 5.11293 10.8726 1.61035H11.4631V9.17914C10.8114 9.31217 10.2323 9.68243 9.83812 10.2182C9.44391 10.7539 9.26267 11.4169 9.32952 12.0786C9.39637 12.7404 9.70656 13.3538 10.1999 13.7998C10.6933 14.2459 11.3348 14.4928 11.9999 14.4928C12.665 14.4928 13.3065 14.2459 13.7998 13.7998C14.2932 13.3538 14.6034 12.7404 14.6703 12.0786C14.7371 11.4169 14.5559 10.7539 14.1617 10.2182C13.7675 9.68243 13.1884 9.31217 12.5367 9.17914V1.61035H13.1272Z",fill:"white"})}),h.jsx("g",{mask:"url(#mask2_1571_205)",children:h.jsx("path",{d:"M13.1272 1.61052L13.6608 1.55738L13.6124 1.07373H13.1272V1.61052ZM18.4006 9.81273L18.9197 9.95068L19.0249 9.5556L18.6717 9.34894L18.4006 9.81273ZM15.4354 20.9351V21.4719H15.8477L15.9539 21.0736L15.4354 20.9351ZM8.56444 20.9351L8.0459 21.0736L8.15218 21.4719H8.56444V20.9351ZM5.59866 9.81273L5.32758 9.34894L4.97437 9.55507L5.08011 9.95068L5.59866 9.81273ZM10.8727 1.61052V1.07373H10.3863L10.3385 1.55738L10.8727 1.61052ZM11.4631 1.61052H11.9999V1.07373H11.4631V1.61052ZM11.4631 9.17931L11.5699 9.70537L11.9994 9.61787V9.17931H11.4631ZM12.5367 9.17931H11.9994V9.61787L12.4294 9.70537L12.5367 9.17931ZM12.5367 1.61052V1.07373H11.9999V1.61052H12.5367ZM13.1272 1.61052L12.5925 1.66367C12.9576 5.34339 15.0918 8.50027 18.1301 10.276L18.4006 9.81219L18.6717 9.34894C15.9207 7.74124 13.9909 4.88389 13.6608 1.55738L13.1272 1.61052ZM18.4006 9.81273L17.8821 9.67423L14.9169 20.7966L15.4354 20.9351L15.9539 21.0736L18.9197 9.95068L18.4006 9.81273ZM15.4354 20.9351V20.3983H8.56444V21.4719H15.4354V20.9351ZM8.56444 20.9351L9.08298 20.7966L6.1172 9.67423L5.59866 9.81219L5.08011 9.95068L8.0459 21.0736L8.56444 20.9351ZM5.59866 9.81273L5.8692 10.276C8.90745 8.50027 11.0423 5.34339 11.4073 1.66367L10.8732 1.61052L10.3391 1.55738C10.009 4.88389 8.07918 7.74124 5.32758 9.34894L5.59866 9.81273ZM10.8727 1.61052V2.14732H11.4631V1.07373H10.8727V1.61052ZM11.4631 1.61052H10.9263V9.17931H11.9994L11.9999 1.61052H11.4631ZM11.4631 9.17931L11.3558 8.65325C10.6283 8.80175 9.97445 9.19704 9.50492 9.77221C9.03539 10.3474 8.77901 11.0671 8.77916 11.8096H9.85274C9.85262 11.3147 10.0235 10.8349 10.3364 10.4515C10.6493 10.068 11.0851 9.80447 11.5699 9.70537L11.4631 9.17931ZM9.31595 11.8096H8.77916C8.77916 12.6638 9.11849 13.483 9.7225 14.087C10.3265 14.691 11.1457 15.0304 11.9999 15.0304V13.9568C11.4305 13.9568 10.8843 13.7306 10.4816 13.3279C10.079 12.9252 9.85274 12.3791 9.85274 11.8096H9.31595ZM11.9999 14.4936V15.0304C12.8541 15.0304 13.6733 14.691 14.2773 14.087C14.8813 13.483 15.2207 12.6638 15.2207 11.8096H14.1471C14.1471 12.3791 13.9209 12.9252 13.5182 13.3279C13.1155 13.7306 12.5694 13.9568 11.9999 13.9568V14.4936ZM14.6839 11.8096H15.2207C15.2208 11.067 14.9643 10.3472 14.4947 9.77206C14.0251 9.19688 13.3711 8.80164 12.6435 8.65325L12.5367 9.17931L12.4299 9.70537C12.9148 9.80447 13.3505 10.068 13.6635 10.4515C13.9764 10.8349 14.1472 11.3147 14.1471 11.8096H14.6839ZM12.5367 9.17931H13.0735V1.61052H11.9999L11.9994 9.17931H12.5367ZM12.5367 1.61052V2.14732H13.1272V1.07373H12.5367V1.61052Z",fill:"white","fill-opacity":"0.5"})})]}),h.jsx("path",{d:"M12.0001 0.805176C12.0713 0.805176 12.1395 0.833453 12.1899 0.883787C12.2402 0.934121 12.2685 1.00239 12.2685 1.07357V10.7359C12.2685 10.807 12.2402 10.8753 12.1899 10.9256C12.1395 10.976 12.0713 11.0043 12.0001 11.0043C11.9289 11.0043 11.8606 10.976 11.8103 10.9256C11.76 10.8753 11.7317 10.807 11.7317 10.7359V1.07357C11.7317 1.00239 11.76 0.934121 11.8103 0.883787C11.8606 0.833453 11.9289 0.805176 12.0001 0.805176Z",fill:"black","fill-opacity":"0.15"}),h.jsxs("mask",{id:"mask3_1571_205",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"11",y:"0",width:"2",height:"12",children:[h.jsx("path",{d:"M11.1948 0.268555H12.8052V11.5412H11.1948V0.268555Z",fill:"white"}),h.jsx("path",{d:"M12.0001 0.805176C12.0713 0.805176 12.1395 0.833453 12.1899 0.883787C12.2402 0.934121 12.2685 1.00239 12.2685 1.07357V10.7359C12.2685 10.807 12.2402 10.8753 12.1899 10.9256C12.1395 10.976 12.0713 11.0043 12.0001 11.0043C11.9289 11.0043 11.8606 10.976 11.8103 10.9256C11.76 10.8753 11.7317 10.807 11.7317 10.7359V1.07357C11.7317 1.00239 11.76 0.934121 11.8103 0.883787C11.8606 0.833453 11.9289 0.805176 12.0001 0.805176Z",fill:"black"})]}),h.jsx("g",{mask:"url(#mask3_1571_205)",children:h.jsx("path",{d:"M12 0.805348V1.34214C11.9288 1.34214 11.8606 1.31386 11.8102 1.26353C11.7599 1.2132 11.7316 1.14493 11.7316 1.07374H12.8052C12.8052 0.860195 12.7204 0.655392 12.5694 0.504389C12.4184 0.353387 12.2136 0.268555 12 0.268555V0.805348ZM12.2684 1.07374H11.7316V10.736H12.8052V1.07374H12.2684ZM12.2684 10.736H11.7316C11.7316 10.6648 11.7599 10.5966 11.8102 10.5462C11.8606 10.4959 11.9288 10.4676 12 10.4676V11.5412C12.2136 11.5412 12.4184 11.4564 12.5694 11.3054C12.7204 11.1544 12.8052 10.9496 12.8052 10.736H12.2684ZM12 11.0044V10.4676C12.0712 10.4676 12.1395 10.4959 12.1898 10.5462C12.2401 10.5966 12.2684 10.6648 12.2684 10.736H11.1948C11.1948 10.9496 11.2797 11.1544 11.4307 11.3054C11.5817 11.4564 11.7865 11.5412 12 11.5412V11.0044ZM11.7316 10.736H12.2684V1.07374H11.1948V10.736H11.7316ZM11.7316 1.07374H12.2684C12.2684 1.14493 12.2401 1.2132 12.1898 1.26353C12.1395 1.31386 12.0712 1.34214 12 1.34214V0.268555C11.7865 0.268555 11.5817 0.353387 11.4307 0.504389C11.2797 0.655392 11.1948 0.860195 11.1948 1.07374H11.7316Z",fill:"white"})})]}),h.jsx("path",{d:"M5.55859 20.9348C5.55859 20.3653 5.78481 19.8192 6.18749 19.4165C6.59016 19.0138 7.1363 18.7876 7.70577 18.7876H16.2945C16.8639 18.7876 17.4101 19.0138 17.8127 19.4165C18.2154 19.8192 18.4416 20.3653 18.4416 20.9348V35.965H5.55859V20.9348Z",fill:"white"}),h.jsx("path",{d:"M16.2944 18.6538L16.4119 18.657C16.9958 18.6872 17.5459 18.9403 17.9485 19.3642C18.3512 19.7882 18.5757 20.3505 18.5758 20.9352V36.0996H5.42432V20.9352C5.42432 20.3301 5.66467 19.7498 6.09251 19.322C6.52036 18.8942 7.10063 18.6538 7.70569 18.6538H16.2944Z",stroke:"black","stroke-opacity":"0.15","stroke-width":"0.268397"}),h.jsx("mask",{id:"mask4_1571_205",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"5",y:"18",width:"14",height:"18",children:h.jsx("path",{d:"M5.55859 20.9353C5.55859 20.3658 5.78481 19.8197 6.18749 19.417C6.59016 19.0143 7.1363 18.7881 7.70577 18.7881H16.2945C16.8639 18.7881 17.4101 19.0143 17.8127 19.417C18.2154 19.8197 18.4416 20.3658 18.4416 20.9353V35.9655H5.55859V20.9353Z",fill:"white"})}),h.jsxs("g",{mask:"url(#mask4_1571_205)",children:[h.jsxs("g",{filter:"url(#filter1_dd_1571_205)",children:[h.jsx("path",{d:"M5.55859 20.9353C5.55859 20.3658 5.78481 19.8197 6.18749 19.417C6.59016 19.0143 7.1363 18.7881 7.70577 18.7881H16.2945C16.8639 18.7881 17.4101 19.0143 17.8127 19.417C18.2154 19.8197 18.4416 20.3658 18.4416 20.9353V35.9655H5.55859V20.9353Z",fill:"white"}),h.jsx("path",{d:"M16.2944 18.6543L16.4119 18.6575C16.9958 18.6876 17.5459 18.9408 17.9485 19.3647C18.3512 19.7887 18.5757 20.351 18.5758 20.9357V36.1001H5.42432V20.9357C5.42432 20.3306 5.66467 19.7503 6.09251 19.3225C6.52036 18.8947 7.10063 18.6543 7.70569 18.6543H16.2944Z",stroke:"black","stroke-opacity":"0.15","stroke-width":"0.268397"})]}),h.jsxs("g",{opacity:"0.75",filter:"url(#filter2_f_1571_205)",children:[h.jsx("path",{d:"M5.55859 20.9353C5.55859 20.3658 5.78481 19.8197 6.18749 19.417C6.59016 19.0143 7.1363 18.7881 7.70577 18.7881H16.2945C16.8639 18.7881 17.4101 19.0143 17.8127 19.417C18.2154 19.8197 18.4416 20.3658 18.4416 20.9353V35.9655H5.55859V20.9353Z",fill:"url(#paint2_linear_1571_205)"}),h.jsx("path",{d:"M7.70568 19.0566H16.2944C16.7927 19.0566 17.2705 19.2546 17.6229 19.6069C17.9752 19.9593 18.1732 20.4371 18.1732 20.9354V35.6972H5.8269V20.9354C5.82695 20.4539 6.01189 19.9908 6.34352 19.6417C6.67515 19.2925 7.12817 19.0841 7.60906 19.0593L7.70568 19.0566Z",stroke:"white","stroke-opacity":"0.5","stroke-width":"0.536793"})]})]})]})}),h.jsxs("defs",{children:[h.jsxs("filter",{id:"filter0_f_1571_205",x:"4.52505",y:"0.536765",width:"14.9492",height:"21.4719",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"0.536793",result:"effect1_foregroundBlur_1571_205"})]}),h.jsxs("filter",{id:"filter1_dd_1571_205",x:"3.14287",y:"17.4464",width:"17.7143",height:"22.0087",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),h.jsx("feOffset",{dy:"0.536793"}),h.jsx("feGaussianBlur",{stdDeviation:"0.536793"}),h.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"}),h.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_1571_205"}),h.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),h.jsx("feOffset",{dy:"1.07359"}),h.jsx("feGaussianBlur",{stdDeviation:"1.07359"}),h.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),h.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"}),h.jsx("feBlend",{mode:"normal",in2:"effect1_dropShadow_1571_205",result:"effect2_dropShadow_1571_205"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect2_dropShadow_1571_205",result:"shape"})]}),h.jsxs("filter",{id:"filter2_f_1571_205",x:"4.48501",y:"17.7145",width:"15.0302",height:"19.3249",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"0.536793",result:"effect1_foregroundBlur_1571_205"})]}),h.jsxs("linearGradient",{id:"paint0_linear_1571_205",x1:"4.53739",y1:"10.1244",x2:"19.4624",y2:"10.1244",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{offset:"0.49","stop-color":"#999999","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-color":"#999999"})]}),h.jsxs("linearGradient",{id:"paint1_linear_1571_205",x1:"10.134",y1:"1.36987",x2:"13.2506",y2:"18.9257",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{offset:"0.726","stop-color":"#999999","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-color":"#999999"})]}),h.jsxs("linearGradient",{id:"paint2_linear_1571_205",x1:"5.55859",y1:"27.3768",x2:"18.4416",y2:"27.3768",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-color":"#AAAAAA","stop-opacity":"0.5"}),h.jsx("stop",{offset:"0.394","stop-color":"#AAAAAA","stop-opacity":"0"}),h.jsx("stop",{offset:"0.832","stop-color":"#999999"})]}),h.jsx("clipPath",{id:"clip0_1571_205",children:h.jsx("rect",{width:"24",height:"24",fill:"white"})}),h.jsx("clipPath",{id:"clip1_1571_205",children:h.jsx("rect",{width:"18.251",height:"36.502",fill:"white",transform:"translate(2.87451)"})})]})]})}function jae({className:t,color:e}){return h.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsxs("g",{"clip-path":"url(#clip0_1538_150)",children:[h.jsx("path",{d:"M7.95337 5.71142C7.95337 5.36004 8.16295 5.04253 8.48605 4.9044L13.7522 2.65314C14.3313 2.40559 14.9748 2.83041 14.9748 3.46017L14.9748 10.9073L7.95337 10.9073L7.95337 5.71142Z",fill:e||"#FFEE00"}),h.jsx("path",{d:"M7.95337 5.71142C7.95337 5.36004 8.16295 5.04253 8.48605 4.9044L13.7522 2.65314C14.3313 2.40559 14.9748 2.83041 14.9748 3.46017L14.9748 10.9073L7.95337 10.9073L7.95337 5.71142Z",fill:"url(#paint0_linear_1538_150)"}),h.jsx("path",{d:"M14.0947 2.62097C14.4884 2.45264 14.9256 2.74131 14.9259 3.16947L14.9259 10.9171L8.00098 10.9171L8.00098 5.61955L8.00798 5.53139C8.03836 5.32877 8.17118 5.15321 8.36338 5.07104L14.0947 2.62097Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.1"}),h.jsx("path",{d:"M8.21993 10.3188C7.31667 10.3188 6.58444 11.0468 6.58444 11.9446C6.58444 17.2642 4.51919 21.2529 0.638381 24.8865C0.238494 25.2609 0.000244048 25.7803 0.000244045 26.3283L0.000244012 31.8114C0.000244008 32.6027 0.641734 33.2442 1.43307 33.2444L21.4927 33.2444C22.2841 33.2444 22.9255 32.6029 22.9255 31.8115L22.9255 26.3283C22.9255 25.7805 22.6873 25.2611 22.2874 24.8867C18.4065 21.253 16.3414 17.2643 16.3414 11.9447C16.3414 11.0469 15.6091 10.3189 14.7059 10.3189L8.21993 10.3188Z",fill:"url(#paint1_linear_1538_150)","fill-opacity":"0.6"}),h.jsx("path",{d:"M8.24279 10.6406C7.34604 10.6406 6.61908 11.3633 6.61908 12.2547C6.61908 17.536 4.56869 21.496 0.715818 25.1035C0.31881 25.4752 0.0822753 25.9908 0.0822753 26.5348L0.0822753 31.9784C0.0822753 32.7641 0.719147 33.4009 1.50478 33.4011L21.42 33.4011C22.2057 33.4011 22.8425 32.7642 22.8425 31.9786L22.8425 26.5348C22.8425 25.991 22.606 25.4753 22.2089 25.1036C18.3561 21.4961 16.3058 17.5361 16.3058 12.2548C16.3058 11.3634 15.5788 10.6407 14.682 10.6407L8.24279 10.6406Z",fill:"white"}),h.jsx("path",{d:"M8.22911 10.9165L14.716 10.9165C15.4232 10.9167 15.9935 11.4863 15.9935 12.1842C15.9935 17.6193 18.1121 21.6982 22.0522 25.3875C22.3839 25.698 22.5768 26.1242 22.5769 26.567L22.5769 32.0507C22.5769 32.6442 22.0958 33.1253 21.5023 33.1253L1.44278 33.1253L1.33224 33.1197C0.790689 33.0643 0.368164 32.6068 0.368164 32.0507L0.368164 26.567C0.368322 26.1795 0.516175 25.8049 0.775344 25.5093L0.892879 25.3875C4.83304 21.6982 6.95297 17.6193 6.95299 12.1842C6.95299 11.5297 7.45337 10.9885 8.09898 10.9235L8.22911 10.9165Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.5"}),h.jsx("g",{opacity:"0.1",filter:"url(#filter0_f_1538_150)",children:h.jsx("path",{d:"M15.2885 12.2295L11.9453 12.2295L11.9453 31.8116L21.4975 31.8116L21.4975 26.0801C18.6319 23.2145 15.2885 20.8266 15.2885 12.2295Z",fill:"black"})})]}),h.jsxs("defs",{children:[h.jsxs("filter",{id:"filter0_f_1538_150",x:"9.94529",y:"10.2295",width:"13.5523",height:"23.5821",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"1.00001",result:"effect1_foregroundBlur_1538_150"})]}),h.jsxs("linearGradient",{id:"paint0_linear_1538_150",x1:"11.4641",y1:"3.00812",x2:"11.4641",y2:"8.71307",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-color":"white","stop-opacity":"0.8"}),h.jsx("stop",{offset:"1","stop-color":"white","stop-opacity":"0"})]}),h.jsxs("linearGradient",{id:"paint1_linear_1538_150",x1:"0.000244031",y1:"28.7867",x2:"22.9255",y2:"28.7867",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-opacity":"0.1"}),h.jsx("stop",{offset:"0.4","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-opacity":"0.15"})]}),h.jsx("clipPath",{id:"clip0_1538_150",children:h.jsx("rect",{width:"24",height:"24",fill:"white"})})]})]})}const kM="flex h-10 w-10 cursor-[var(--drawo-cursor-pointer),auto] items-center justify-center rounded-[10px] border-none bg-transparent p-[10px] text-[13px] font-medium text-black shadow-none outline-none transition-[0.1s] hover:bg-[rgba(var(--text-rgb),0.1)] dark:text-[#e5e7eb] [&_svg]:size-5",Hae="bg-(--accent) text-white dark:bg-(--accent-dark)",Hs=t=>kM+(t?" "+Hae:""),Bd="mx-1 my-auto h-5 w-px border-l border-[rgb(var(--text-rgb))] opacity-30",lb="flex items-center justify-center [&_svg]:h-auto [&_svg]:w-[180px]",OM=({interactionMode:t,drawingTool:e,isPresentationMode:r,messages:n,setInteractionMode:i,setDrawingTool:a,drawDefaults:s,invertPaletteInDarkMode:o,strokeColors:A,onDrawDefaultStrokeColorChange:l,onDrawDefaultStrokeWidthChange:u,onSelectImageFiles:c})=>{const[d,f]=H.useState(!1),v=H.useRef(null),p=D=>{r&&D!=="pan"||i(D)},C=D=>{r||a(D)},w=()=>e==="marker"?"marker":e==="quill"?"quill":"draw",[g,b]=H.useState(e==="marker"?s.markerStroke:e==="quill"?s.quillStroke:s.drawStroke),B=e==="marker"?xf:JA,E=e==="marker"?lO:l0,F=D=>o?z0(D):D,O=e==="marker"?s.markerStroke:e==="quill"?s.quillStroke:s.drawStroke;H.useEffect(()=>{b(O)},[O]);const I=D=>{const L=D.hexa||D.hex;if(L){b(L);const P=w();l(P,L)}},k=(D,L)=>{const P=D[L]??D[0];return P?h.jsx("svg",{width:P.width,height:P.height,viewBox:P.viewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:P.path,stroke:P.strokeWidth?"currentColor":void 0,strokeWidth:P.strokeWidth,strokeLinecap:P.strokeWidth?"round":void 0,fill:P.fill})}):null},j=["draw","marker","quill"];return h.jsxs("div",{className:"absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center gap-px rounded-[15px] border border-(--panel-border) bg-(--panel-bg) p-2 shadow-(--panel-shadow) backdrop-blur-3xl [corner-shape:squircle] [.drawo-presentation-mode_&]:translate-y-[200%]",children:[h.jsx("input",{ref:v,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:D=>{const L=Array.from(D.target.files??[]).filter(P=>P.type.startsWith("image/"));L.length>0&&c(L),D.currentTarget.value=""}}),j.includes(e)?h.jsxs("div",{className:"absolute bottom-full left-1/2 z-10 flex -translate-x-1/2 -translate-y-2 items-center gap-px rounded-[15px] border border-(--panel-border) bg-(--panel-bg) p-1 shadow-(--panel-shadow) backdrop-blur-3xl [corner-shape:squircle]",children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:`${Hs(e==="draw")} group overflow-hidden`,onClick:()=>{p("select"),C("draw"),f(!1)},children:h.jsx(_ae,{color:F(s.drawStroke),className:"scale-[2] translate-y-[2px] transition-[0.1s] group-hover:translate-y-0"})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.pen})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:`${Hs(e==="quill")} group overflow-hidden`,onClick:()=>{p("select"),C("quill"),f(!1)},children:h.jsx(Qae,{color:F(s.quillStroke),className:"scale-[2] translate-y-[2px] transition-[0.1s] group-hover:translate-y-0"})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.quill})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:`${Hs(e==="marker")} group overflow-hidden`,onClick:()=>{p("select"),C("marker"),f(!1)},children:h.jsx(jae,{color:F(s.markerStroke),className:"scale-[2] translate-y-[2px] transition-[0.1s] group-hover:translate-y-0"})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.marker})})]}),h.jsx("div",{className:Bd}),h.jsx(ko,{colors:A,currentColor:O,uniColor:F,renderItem:({color:D,swatch:L})=>h.jsx("div",{className:"float-left w-fit shrink-0 rounded-full bg-transparent p-[4px_1px]! transition-[0.1s] hover:scale-105",onClick:()=>{if(D==="multi"){f(P=>!P);return}f(!1),I({hex:D})},children:L},D)}),h.jsxs(Nr,{open:d,children:[h.jsx(Pr,{asChild:!0,children:h.jsx("span",{style:{opacity:0},children:"."})}),h.jsx(Rr,{className:"drawo-content-color inferior shadow-none ![transform:translateY(-20px)]",side:"bottom",style:{background:"transparent",padding:0},onPointerDown:D=>D.stopPropagation(),children:h.jsx(gu,{color:g,onChange:I})})]}),h.jsx("div",{className:Bd}),h.jsxs(Pa,{value:String(e==="marker"?s.markerStrokeWidth:e==="quill"?s.quillStrokeWidth:s.drawStrokeWidth),onValueChange:D=>{const L=w();u(L,Number(D))},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(Ra,{noArrow:!0,className:"flex h-10 w-[94.7px] cursor-[var(--drawo-cursor-pointer),auto] items-center justify-center gap-0 rounded-[24px] border-none bg-transparent p-3 text-current shadow-none outline-none transition-[0.1s] hover:bg-[rgba(var(--text-rgb),0.1)] [corner-shape:squircle]",children:h.jsx("span",{className:`${lb} [&_svg]:[transform:scaleX(0.4)_translateX(-76%)]`,children:(()=>{const D=e==="marker"?s.markerStrokeWidth:e==="quill"?s.quillStrokeWidth:s.drawStrokeWidth,L=Math.max(0,B.findIndex(P=>P===D));return k(E,L)})()})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.selectionBar?.strokeWidth||"Stroke Width"})})]}),h.jsx(Ua,{position:"popper",children:B.map((D,L)=>h.jsx(qr,{check:!1,value:String(D),className:"flex p-[7px_8px]! [&_*]:w-full",children:h.jsx("span",{className:lb,children:k(E,L)})},D))})]})]}):h.jsx(h.Fragment,{}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(t==="select"&&!e),onClick:()=>{p("select"),C(null)},children:h.jsx(vT,{style:{transform:"translateY(-2px) translateX(-3px) rotate(-46deg)"},strokeWidth:.1})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.selection})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(t==="pan"),onClick:()=>{p("pan"),C(null)},children:h.jsx(nY,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.pan})})]}),h.jsx("div",{className:Bd}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="text"),onClick:()=>{p("select"),C("text")},children:h.jsx(y7,{strokeWidth:.1})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.text})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="rectangle"),onClick:()=>{p("select"),C("rectangle")},children:h.jsx(aY,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.rectangle})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="circle"),onClick:()=>{p("select"),C("circle")},children:h.jsx(O$,{strokeWidth:1.5})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.ellipse})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="line"),onClick:()=>{p("select"),C("line")},children:h.jsx(oY,{style:{scale:"1.2"}})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.line})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(j.includes(e)),onClick:()=>{p("select"),C("draw")},children:h.jsx(mT,{strokeWidth:1.5})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.draw})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:kM,onClick:()=>{p("select"),C(null),v.current?.click()},children:h.jsx(sY,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.image})})]}),h.jsx("div",{className:Bd}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="laser"),onClick:()=>{p("select"),C("laser")},children:h.jsx(iY,{strokeWidth:1.5})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.laser})})]})]})};function o2(){const t=xA(),{scene:e,resolvedTheme:r,isDarkMode:n,isPresentationMode:i,interactionMode:a,drawingTool:s,messages:o,setInteractionMode:A,setDrawingTool:l,handlers:u}=t;return h.jsx(OM,{interactionMode:a,drawingTool:s,isPresentationMode:i,messages:o,setInteractionMode:A,setDrawingTool:l,drawDefaults:e.settings.drawDefaults,invertPaletteInDarkMode:n&&e.settings.colorScheme==="drawo",strokeColors:r.preset.strokeColors,onDrawDefaultStrokeColorChange:u.handleDrawDefaultStrokeColorChange,onDrawDefaultStrokeWidthChange:u.handleDrawDefaultStrokeWidthChange,onSelectImageFiles:c=>u.handleInsertImageFiles?.(c)})}function TM({canUndo:t,canRedo:e,onUndo:r,onRedo:n}){return h.jsxs("div",{className:"zoom-bar flex overflow-hidden gap-0 rounded-xl border border-(--panel-border) bg-white text-[rgb(var(--text-rgb))] shadow-(--panel-shadow) [corner-shape:squircle] transition-[0.4s_ease-in-out] dark:bg-(--popover-dark,#1f1f1f) dark:backdrop-blur-3xl [&_button]:flex [&_button]:size-9 [&_button]:items-center [&_button]:justify-center [&_button]:border-none [&_button]:bg-transparent [&_button]:p-2 [&_button]:transition-[0.1s] [&_button:hover:not([disabled])]:bg-[rgba(var(--text-rgb),0.06)] [&_button:active:not([disabled])_svg]:scale-90 [&_button:disabled]:cursor-not-allowed [&_button:disabled]:opacity-50 [&_button:disabled]:backdrop-blur-[brightness(0.8)] [&_svg]:size-[18px] [&_svg]:transition-[0.1s]",children:[h.jsx("button",{type:"button",onClick:r,disabled:!t,"aria-label":"Undo",children:h.jsx(Q$,{})}),h.jsx("button",{type:"button",onClick:n,disabled:!e,"aria-label":"Redo",children:h.jsx(j$,{})})]})}function A2(){const t=xA(),{canUndo:e,canRedo:r,undo:n,redo:i}=t;return h.jsx("div",{className:"drawo-bottomleft-bar",children:h.jsx(TM,{canUndo:e,canRedo:r,onUndo:n,onRedo:i})})}function MM({zoomPercent:t,canZoomOut:e,canZoomIn:r,onZoomOut:n,onZoomIn:i,onZoomReset:a}){const s=Math.max(0,Math.min(200,t));return h.jsxs("div",{className:"zoom-bar flex overflow-hidden gap-0 rounded-xl border border-(--panel-border) bg-white text-[rgb(var(--text-rgb))] shadow-(--panel-shadow) [corner-shape:squircle] transition-[0.2s_ease-in-out] dark:bg-(--popover-dark,#1f1f1f) dark:backdrop-blur-3xl [&_button]:flex [&_button]:size-9 [&_button]:items-center [&_button]:justify-center [&_button]:border-none [&_button]:bg-transparent [&_button]:p-2 [&_button]:transition-[0.1s] [&_button:hover:not([disabled])]:bg-[rgba(var(--text-rgb),0.06)] [&_button:active:not([disabled])_svg]:scale-90 [&_button:disabled]:cursor-not-allowed [&_button:disabled]:opacity-50 [&_svg]:size-[18px] [&_svg]:transition-[0.1s]",children:[h.jsx("button",{type:"button",onClick:n,disabled:!e,"aria-label":"Zoom out",children:h.jsx(sT,{strokeWidth:1})}),h.jsx("div",{className:"my-auto flex h-[70%] w-px border-l border-[rgba(var(--text-rgb),0.1)]"}),h.jsx("button",{type:"button",onClick:a,"aria-label":"Reset zoom",children:h.jsxs("span",{children:[s,"%"]})}),h.jsx("div",{className:"my-auto flex h-[70%] w-px border-l border-[rgba(var(--text-rgb),0.1)]"}),h.jsx("button",{type:"button",onClick:i,disabled:!r,"aria-label":"Zoom in",children:h.jsx(oT,{strokeWidth:1})})]})}function l2(){const t=xA(),{scene:e,handlers:r}=t;return h.jsx("div",{className:"drawo-bottomright-bar",children:h.jsx(MM,{zoomPercent:Math.round(e.camera.zoom*100),canZoomOut:e.camera.zoom>z2,canZoomIn:e.camera.zoom<G2,onZoomOut:r.handleZoomOut,onZoomIn:r.handleZoomIn,onZoomReset:r.handleZoomReset})})}function K7({children:t,config:e}){const r=xA(),{scene:n,messages:i,handlers:a}=r;if(n.elements.length>0||!(e?.enabled??!0))return null;const o=e?.render;return o?h.jsx("div",{style:e?.style,className:e?.className,children:o({messages:i,onInsertImage:()=>{const A=document.createElement("input");A.type="file",A.accept="image/*",A.multiple=!0,A.onchange=l=>{const u=Array.from(l.target.files??[]);u.length>0&&a.handleInsertImageFiles?.(u)},A.click()}})}):h.jsx("div",{style:{...e?.style,position:"absolute",left:"50%",top:"50%",display:"flex",justifyContent:"center",alignItems:"center",opacity:.5,flexDirection:"column",transform:"translate(-50%, -50%)",userSelect:"none"},className:e?.className,children:t??h.jsx(cM,{})})}const Kae=[{id:"basic",name:"Basic",description:"General shapes and utilities"},{id:"flowchart",name:"Flowchart",description:"Flowchart symbols"},{id:"bpmn",name:"BPMN",description:"BPMN process symbols"},{id:"network",name:"Network",description:"Network infrastructure"},{id:"cloud",name:"Cloud",description:"Cloud services"},{id:"devops",name:"DevOps",description:"DevOps tools"},{id:"security",name:"Security",description:"Security & access"},{id:"devices",name:"Devices",description:"Hardware devices"},{id:"data",name:"Data",description:"Data storage & databases"},{id:"people",name:"People",description:"Users and roles"},{id:"communication",name:"Communication",description:"Messaging & APIs"},{id:"programs",name:"Programs",description:"Software & IDEs"},{id:"languages",name:"Languages",description:"Programming languages"},{id:"aws",name:"AWS",description:"Amazon Web Services"},{id:"custom",name:"Custom",description:"Custom assets"}],NM=[],Yp={categories:Kae,assets:NM};function Vae(t,e){const r=t.toLowerCase().trim();let n=NM;return e?.categoryId&&(n=n.filter(i=>i.categoryId===e.categoryId)),r?n.filter(i=>i.name.toLowerCase().includes(r)||i.tags.some(a=>a.toLowerCase().includes(r))):n}const ub=t=>null,Wae=(t,e,r,n,i)=>{const a=ub(),s=ub();if(!a&&!s&&null===null)return;const A=l=>{a&&l.getAttribute("fill")!=="none"&&l.setAttribute("fill",a),s&&i!=="none"&&l.getAttribute("stroke")!=="none"&&l.setAttribute("stroke",s)};A(t),t.querySelectorAll("*").forEach(l=>A(l))},qae=(t,e)=>{if(typeof window>"u")return"";const i=new window.DOMParser().parseFromString(t,"image/svg+xml").documentElement;if(!(i instanceof window.SVGElement)||i.tagName.toLowerCase()!=="svg")return"";Wae(i,e?.fill,e?.stroke,e?.strokeWidth,e?.strokeStyle);const a=i.outerHTML;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(a)}`},bm=t=>t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),cb=t=>Xf(t).map(e=>e.runs.map(r=>r.text).join("")).join(`
217
+ `);return(e.length>0?e:[""]).map(r=>({type:"paragraph",children:[{text:r}]}))}return zp},w0=t=>JSON.stringify(t),uM=()=>h.jsxs("svg",{height:"14vh",viewBox:"0 0 2551 599",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M97.4727 185.493L98.1824 196.042C98.2021 196.336 98.3215 196.614 98.5206 196.831C99.1163 197.48 100.172 197.358 100.604 196.591L104.463 189.742C104.647 189.415 104.857 189.104 105.091 188.811L124.535 164.444L163.624 120.469L178.566 105.907C181.707 102.847 185.198 100.167 188.966 97.9237L190.02 97.2965C192.546 95.7932 195.216 94.5487 197.992 93.582C202.61 91.9734 207.466 91.152 212.356 91.152H216.119L219.852 91.6643C225.803 92.4812 231.488 94.6532 236.468 98.0132C238.35 99.2833 240.119 100.714 241.754 102.29L242.13 102.653C247.108 107.451 250.92 113.324 253.275 119.824L255.96 127.234C258.371 134.551 259.788 142.159 260.173 149.854L260.345 153.294L262.062 165.924C262.086 166.105 262.145 166.281 262.234 166.441C262.756 167.381 264.076 167.463 264.711 166.595L272.874 155.424L315.221 97.4163L340.779 61.4591L353.156 40.9814C354.087 39.4405 355.245 38.0487 356.59 36.8526L358.652 35.0204C360.382 33.4822 361.533 31.3976 361.914 29.1138C362.023 28.4615 362.195 27.8213 362.429 27.2025L363.194 25.174C364.116 22.7302 365.352 20.4165 366.87 18.291C368.264 16.3398 369.885 14.5617 371.7 12.9944L375.25 9.92858C378.38 7.22562 382.025 5.18447 385.965 3.92821C387.743 3.3611 389.57 2.95779 391.422 2.72332L393.095 2.51158C396.706 2.05446 400.362 2.08739 403.964 2.60948C406.105 2.91983 408.218 3.40168 410.282 4.05038L411.152 4.32386C414.335 5.32418 417.357 6.7767 420.127 8.63687L420.412 8.82855C423.02 10.5803 425.36 12.7014 427.359 15.1254C429.266 17.4382 430.844 20.004 432.047 22.7496L432.665 24.1609C434.291 27.8711 435.313 31.8172 435.694 35.85L435.802 36.9936C436.179 40.9904 435.8 45.0224 434.685 48.879C433.81 51.904 432.493 54.7831 430.777 57.4233L428.479 60.9586C421.995 68.5236 416.576 76.9405 412.374 85.9749L411.19 88.5216L397.283 116.962L384.128 142.52L375.609 160.937L355.062 197.27L335.893 229.97L326.246 242.874L325.049 244.228C315.011 255.578 303.918 265.948 291.917 275.198L283.523 280.711L281.45 281.917C277.252 284.361 272.766 286.272 268.096 287.606L267.689 287.723C262.734 289.138 257.605 289.857 252.452 289.857L245.051 289.268C242.639 289.076 240.244 288.7 237.889 288.142C233.916 287.201 230.082 285.751 226.481 283.827L226.31 283.735C223.947 282.473 221.691 281.018 219.567 279.386L214.114 275.198L209.879 270.962C207.446 268.53 205.246 265.874 203.308 263.032C201.495 260.373 199.918 257.561 198.596 254.628L193.693 243.751L189.882 231.09C189.834 230.931 189.747 230.785 189.629 230.667C189.154 230.192 188.356 230.303 188.03 230.891L171.893 259.913L158.613 281.838L144.706 303.262L139.193 311.281L130.924 320.301L122.405 328.695L119.92 330.597C113.426 335.567 106.244 339.569 98.6004 342.477C91.946 344.224 85.0948 345.108 78.215 345.108H75.5477L70.4907 344.673C66.1148 344.297 61.8109 343.324 57.6986 341.782C54.4893 340.578 51.4175 339.036 48.5354 337.181L46.8387 336.089C43.6011 334.004 40.5721 331.613 37.7937 328.947C34.4095 325.7 31.4185 322.067 28.8823 318.122L27.7015 316.285C25.026 312.123 22.7504 307.717 20.9055 303.126L18.2918 296.622C13.788 284.362 10.2229 271.777 7.62738 258.976L6.01377 251.018L2.1299 224.958L0.877018 210.425L0 182.11L0.877018 166.074L3.63335 150.914L4.04047 149.092C5.51648 142.485 7.86538 136.104 11.0253 130.117L12.5537 127.843C14.9445 124.286 17.8771 121.125 21.2453 118.474L21.3289 118.408C22.9767 117.112 24.7245 115.948 26.556 114.927C29.8006 113.119 33.2827 111.774 36.9006 110.933L37.3853 110.82C40.5989 110.072 43.8875 109.695 47.1869 109.695H48.4125C53.1843 109.695 57.918 110.544 62.3926 112.201L67.1788 114.743C69.3282 115.885 71.359 117.238 73.2411 118.781C75.5222 120.652 77.5699 122.79 79.3399 125.15L80.4334 126.608C82.1846 128.943 83.7355 131.422 85.0695 134.018L85.1578 134.189C86.8484 137.479 88.1974 140.934 89.1835 144.499L90.9579 150.914L93.9648 165.072L95.3429 174.218L97.4727 185.493Z",fill:"var(--logoduotone-firstcolor)"}),h.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M398.287 263.487C420.774 251.477 432.017 245.471 433.905 237.605C434.793 233.904 434.485 230.016 433.025 226.501C429.922 219.03 417.903 214.881 393.866 206.583L366.132 197.009C336.381 186.739 321.506 181.604 313.555 189.4C305.605 197.196 310.447 212.169 320.131 242.116L329.407 270.8C337.139 294.708 341.005 306.663 348.175 309.964C351.915 311.685 356.131 312.073 360.122 311.063C367.774 309.125 373.756 298.076 385.719 275.979C387.529 272.635 388.435 270.963 389.643 269.537C390.304 268.758 391.029 268.036 391.812 267.38C393.245 266.18 394.926 265.282 398.287 263.487Z",fill:"var(--logoduotone-secondcolor)"}),h.jsx("path",{d:"M662.494 353.246C656.101 353.246 650.918 348.063 650.918 341.67V295.243C650.918 288.85 656.101 283.667 662.494 283.667H753.145C771.7 283.667 787.221 279.742 799.71 271.892C812.198 264.042 821.475 252.268 827.541 236.568C833.964 220.868 837.175 201.243 837.175 177.693C837.175 158.782 835.213 142.547 831.288 128.988C827.363 115.429 821.475 104.368 813.625 95.8046C806.132 86.8842 796.32 80.2832 784.188 76.0014C772.413 71.7196 758.498 69.5787 742.441 69.5787H662.494C656.101 69.5787 650.918 64.3959 650.918 58.0026C650.918 51.6093 650.918 11.5761 650.918 11.5761C650.918 5.18281 656.101 0 662.494 0H739.23C783.118 0 818.977 6.95787 846.809 20.8736C874.64 34.7894 894.979 54.771 907.824 80.8184C920.669 106.509 927.092 137.373 927.092 173.412C927.092 201.243 923.702 225.328 916.923 245.666C910.5 266.005 901.58 283.132 890.162 297.048C878.744 310.607 865.542 321.668 850.556 330.231C835.926 338.438 820.405 344.326 803.991 347.894C787.935 351.462 771.878 353.246 755.821 353.246H662.494ZM622.353 353.246C615.959 353.246 610.776 348.063 610.776 341.67V11.5761C610.776 5.18281 615.959 0 622.353 0H685.371C691.764 0 696.947 5.1828 696.947 11.5761V341.67C696.947 348.063 691.764 353.246 685.371 353.246H622.353Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M958.513 353.246C952.12 353.246 946.937 348.063 946.937 341.67V82.2253C946.937 75.832 952.12 70.6492 958.513 70.6492H1006.2C1012.52 70.6492 1017.67 75.7145 1017.78 82.0313L1019.1 160.88C1019.15 163.973 1021.67 166.454 1024.77 166.454C1027.68 166.454 1030.11 164.244 1030.44 161.351C1033.05 138.765 1037.5 120.663 1043.81 107.044C1050.95 92.058 1060.94 81.1752 1073.78 74.3957C1086.99 67.6163 1103.22 64.2265 1122.49 64.2265C1125.34 64.2265 1128.56 64.4049 1132.12 64.7617C1132.8 64.7617 1133.49 64.7745 1134.2 64.8C1140.07 65.0097 1144.28 70.2495 1144.08 76.113L1141.85 139.881C1141.56 148.306 1132.41 153.819 1124.05 152.722C1123.53 152.654 1123.01 152.593 1122.49 152.538C1116.07 151.468 1110.36 150.932 1105.36 150.932C1091.45 150.932 1079.32 153.608 1068.97 158.961C1058.98 164.313 1050.95 172.52 1044.88 183.581C1039.17 194.642 1035.43 208.558 1033.64 225.328V341.67C1033.64 348.063 1028.46 353.246 1022.07 353.246H958.513Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M1223.48 360.739C1207.78 360.739 1193.86 357.706 1181.73 351.64C1169.6 345.218 1160.14 336.119 1153.36 324.344C1146.58 312.212 1143.19 297.583 1143.19 280.456C1143.19 264.399 1146.23 251.197 1152.29 240.849C1158.71 230.145 1167.81 221.76 1179.59 215.694C1191.72 209.271 1206.17 204.098 1222.94 200.173C1239.71 195.891 1258.8 192.144 1280.21 188.933C1290.56 187.149 1299.12 185.543 1305.9 184.116C1313.04 182.332 1318.39 179.656 1321.96 176.088C1325.52 172.52 1327.31 167.346 1327.31 160.566C1327.31 151.646 1324.1 143.974 1317.67 137.552C1311.25 131.129 1300.9 127.918 1286.63 127.918C1276.64 127.918 1267.54 129.702 1259.34 133.27C1251.49 136.838 1244.71 142.012 1239 148.791C1235.56 152.875 1232.64 157.477 1230.23 162.596C1227.52 168.382 1221.19 171.943 1215.06 170.13L1161.39 154.257C1155.21 152.428 1151.66 145.871 1154.04 139.875C1158.17 129.446 1163.3 120.108 1169.42 111.861C1177.98 100.8 1188.15 91.7012 1199.93 84.5649C1211.7 77.0718 1225.08 71.7196 1240.07 68.5083C1255.41 64.9402 1271.65 63.1561 1288.77 63.1561C1317.32 63.1561 1340.51 67.7947 1358.35 77.0718C1376.55 85.9922 1389.93 100.086 1398.49 119.354C1407.41 138.265 1411.87 162.707 1411.87 192.68V236.033C1411.87 248.878 1412.05 261.902 1412.41 275.104C1413.12 287.949 1413.84 300.973 1414.55 314.175C1415.27 322.842 1416.08 331.591 1416.96 340.42C1417.65 347.272 1412.29 353.246 1405.4 353.246H1352.03C1346.4 353.246 1341.58 349.2 1340.73 343.636C1339.83 337.676 1338.92 331.067 1338.01 323.809C1336.82 313.926 1335.87 303.917 1335.17 293.783C1334.95 290.508 1332.24 287.949 1328.96 287.949C1326.36 287.949 1324.05 289.574 1323.07 291.979C1318.15 303.991 1311.36 315.136 1302.69 325.414C1293.41 336.476 1281.99 345.218 1268.43 351.64C1255.23 357.706 1240.25 360.739 1223.48 360.739ZM1262.55 299.724C1268.97 299.724 1275.39 298.653 1281.81 296.513C1288.59 294.015 1295.02 290.803 1301.08 286.879C1307.15 282.597 1312.68 277.423 1317.67 271.357C1322.2 265.858 1325.71 259.92 1328.18 253.541C1328.69 252.236 1328.9 250.836 1328.86 249.436L1327.95 213.472C1327.9 211.341 1329.86 209.73 1331.94 210.203C1334.78 210.847 1335.37 214.518 1332.78 215.842C1327.89 218.339 1322.68 220.431 1317.14 222.117C1308.93 224.614 1300.55 226.577 1291.98 228.004C1283.78 229.431 1275.57 231.037 1267.36 232.821C1259.51 234.248 1252.38 236.211 1245.96 238.709C1239.89 241.206 1235.07 244.596 1231.5 248.878C1227.94 253.16 1226.15 259.047 1226.15 266.54C1226.15 276.531 1229.54 284.559 1236.32 290.625C1243.1 296.691 1251.84 299.724 1262.55 299.724Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M1497.86 353.246C1492.52 353.246 1487.87 349.59 1486.61 344.397L1454.5 211.948L1423.72 84.9526C1421.95 77.6667 1427.47 70.6492 1434.97 70.6492H1500.31C1505.99 70.6492 1510.83 74.7703 1511.74 80.3775L1544.08 280.421C1544.59 283.526 1547.27 285.808 1550.41 285.808C1553.46 285.808 1556.09 283.656 1556.7 280.664L1597.14 79.9388C1598.23 74.5355 1602.98 70.6492 1608.49 70.6492H1691.83C1697.31 70.6492 1702.04 74.4927 1703.16 79.8576L1745.08 280.455C1745.73 283.574 1748.48 285.808 1751.67 285.808C1754.99 285.808 1757.81 283.386 1758.32 280.104L1789.11 80.4608C1789.98 74.8156 1794.84 70.6492 1800.55 70.6492H1864.22C1871.71 70.6492 1877.23 77.6667 1875.47 84.9526L1812.57 344.397C1811.31 349.59 1806.66 353.246 1801.32 353.246H1701.25C1695.66 353.246 1690.87 349.254 1689.87 343.758L1653.45 145.198C1652.92 142.319 1650.41 140.228 1647.48 140.228C1644.53 140.228 1642 142.358 1641.5 145.271L1607.62 343.619C1606.67 349.18 1601.85 353.246 1596.21 353.246H1497.86Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M2009.49 360.739C1980.94 360.739 1955.61 355.208 1933.49 344.147C1911.72 333.086 1894.6 316.494 1882.11 294.372C1869.62 272.249 1863.37 244.596 1863.37 211.412C1863.37 178.229 1869.62 150.754 1882.11 128.988C1894.6 106.866 1911.9 90.4524 1934.02 79.7479C1956.15 68.6867 1981.48 63.1561 2010.03 63.1561C2038.57 63.1561 2063.9 68.6867 2086.03 79.7479C2108.15 90.8092 2125.45 107.401 2137.94 129.524C2150.43 151.289 2156.68 178.764 2156.68 211.948C2156.68 245.845 2150.25 273.855 2137.41 295.977C2124.56 318.1 2106.9 334.513 2084.42 345.218C2062.3 355.565 2037.32 360.739 2009.49 360.739ZM2012.17 298.118C2025.01 298.118 2035.72 295.264 2044.28 289.555C2052.84 283.489 2059.27 274.39 2063.55 262.258C2067.83 250.127 2069.97 235.14 2069.97 217.3C2069.97 198.389 2067.65 182.51 2063.01 169.665C2058.37 156.463 2051.42 146.472 2042.14 139.693C2033.22 132.556 2021.62 128.988 2007.35 128.988C1995.22 128.988 1984.69 132.021 1975.77 138.087C1967.21 143.796 1960.79 152.716 1956.5 164.848C1952.22 176.98 1950.08 192.144 1950.08 210.342C1950.08 239.601 1955.43 261.545 1966.14 276.174C1977.2 290.803 1992.54 298.118 2012.17 298.118Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M2212.44 360.204C2193.88 360.204 2179.97 356.279 2170.69 348.429C2161.77 340.579 2157.31 328.447 2157.31 312.034C2157.31 295.264 2161.77 282.954 2170.69 275.104C2179.97 267.254 2193.88 263.329 2212.44 263.329C2231.35 263.329 2245.44 267.254 2254.72 275.104C2264 282.954 2268.63 295.264 2268.63 312.034C2268.63 344.147 2249.9 360.204 2212.44 360.204Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M603.674 565.71V469.556H609.355V509.699H609.918C611.045 506.6 612.641 503.752 614.707 501.154C616.773 498.556 619.34 496.474 622.407 494.909C625.474 493.313 629.058 492.515 633.159 492.515C638.949 492.515 644.004 494.127 648.324 497.351C652.643 500.543 655.992 504.957 658.371 510.591C660.75 516.193 661.939 522.61 661.939 529.84C661.939 537.133 660.75 543.597 658.371 549.231C655.992 554.834 652.659 559.231 648.371 562.424C644.082 565.617 639.027 567.213 633.206 567.213C629.105 567.213 625.521 566.43 622.454 564.865C619.387 563.269 616.82 561.172 614.754 558.574C612.688 555.945 611.076 553.081 609.918 549.982H609.261V565.71H603.674ZM609.308 529.793C609.308 535.928 610.231 541.421 612.078 546.273C613.956 551.093 616.648 554.912 620.153 557.729C623.659 560.515 627.853 561.907 632.736 561.907C637.682 561.907 641.907 560.499 645.413 557.682C648.918 554.834 651.595 550.984 653.441 546.132C655.319 541.281 656.258 535.834 656.258 529.793C656.258 523.752 655.319 518.322 653.441 513.502C651.595 508.681 648.918 504.878 645.413 502.093C641.907 499.276 637.682 497.867 632.736 497.867C627.853 497.867 623.659 499.26 620.153 502.046C616.648 504.8 613.956 508.587 612.078 513.408C610.231 518.197 609.308 523.659 609.308 529.793ZM673.147 592.754C671.707 592.754 670.283 592.597 668.875 592.284C667.466 591.971 666.199 591.564 665.072 591.064L666.762 586.04C669.704 587.167 672.365 587.574 674.744 587.261C677.154 586.948 679.282 585.852 681.129 583.974C682.976 582.096 684.541 579.342 685.824 575.711L689.11 566.696L662.677 493.595H668.828L691.74 558.339H692.209L715.121 493.595H721.272L690.848 577.965C689.69 581.22 688.234 583.943 686.481 586.134C684.728 588.325 682.725 589.968 680.472 591.064C678.249 592.19 675.808 592.754 673.147 592.754Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M886.198 490.56V463.005L804.95 500.439C785.564 509.37 773.147 528.764 773.147 550.108V575.76L853.416 540.668C873.329 531.963 886.198 512.293 886.198 490.56Z",fill:"var(--logocolor)"}),h.jsx("path",{d:"M885.734 490.561C885.734 512.109 872.975 531.613 853.231 540.244L773.61 575.052V550.107C773.611 528.944 785.923 509.715 805.144 500.859L885.734 463.729V490.561Z",stroke:"var(--logocolor)","stroke-opacity":"0.22","stroke-width":"0.926904"}),h.jsx("path",{d:"M970.151 576.816C961.375 576.816 952.974 575.585 944.947 573.124C936.92 570.555 930.553 567.291 925.844 563.331L933.068 547.117C937.563 550.649 943.128 553.592 949.763 555.947C956.398 558.301 963.194 559.478 970.151 559.478C976.037 559.478 980.799 558.836 984.438 557.552C988.077 556.268 990.752 554.555 992.465 552.415C994.177 550.167 995.033 547.652 995.033 544.87C995.033 541.445 993.802 538.716 991.341 536.683C988.879 534.542 985.669 532.883 981.709 531.706C977.856 530.422 973.522 529.245 968.706 528.174C963.997 527.104 959.234 525.873 954.418 524.482C949.71 522.984 945.375 521.111 941.415 518.864C937.563 516.509 934.405 513.405 931.944 509.553C929.482 505.7 928.252 500.777 928.252 494.784C928.252 488.683 929.857 483.118 933.068 478.088C936.385 472.951 941.362 468.884 947.997 465.888C954.74 462.784 963.248 461.232 973.522 461.232C980.264 461.232 986.953 462.089 993.588 463.801C1000.22 465.513 1006 467.975 1010.93 471.185L1004.34 487.399C999.314 484.403 994.124 482.209 988.772 480.817C983.421 479.319 978.284 478.57 973.361 478.57C967.582 478.57 962.873 479.266 959.234 480.657C955.703 482.048 953.081 483.868 951.368 486.115C949.763 488.362 948.96 490.931 948.96 493.821C948.96 497.245 950.138 500.028 952.492 502.168C954.954 504.202 958.111 505.807 961.964 506.984C965.923 508.161 970.311 509.339 975.127 510.516C979.943 511.586 984.706 512.817 989.415 514.208C994.231 515.599 998.565 517.419 1002.42 519.666C1006.38 521.914 1009.53 524.964 1011.89 528.817C1014.35 532.669 1015.58 537.539 1015.58 543.425C1015.58 549.418 1013.92 554.983 1010.6 560.12C1007.39 565.15 1002.42 569.217 995.675 572.321C988.933 575.317 980.425 576.816 970.151 576.816ZM1073.36 488.523C1080.21 488.523 1086.31 489.861 1091.66 492.536C1097.12 495.212 1101.4 499.332 1104.5 504.897C1107.6 510.355 1109.16 517.419 1109.16 526.088V575.21H1089.09V528.656C1089.09 521.058 1087.27 515.385 1083.63 511.64C1080.1 507.894 1075.12 506.021 1068.7 506.021C1063.99 506.021 1059.82 506.984 1056.18 508.911C1052.54 510.837 1049.71 513.727 1047.67 517.579C1045.75 521.325 1044.78 526.088 1044.78 531.867V575.21H1024.72V456.095H1044.78V512.603L1040.45 505.539C1043.45 500.081 1047.78 495.907 1053.45 493.018C1059.23 490.021 1065.87 488.523 1073.36 488.523ZM1177.8 575.21V557.873L1176.67 554.181V523.84C1176.67 517.954 1174.91 513.405 1171.37 510.195C1167.84 506.877 1162.49 505.218 1155.32 505.218C1150.51 505.218 1145.74 505.967 1141.03 507.466C1136.43 508.964 1132.53 511.051 1129.31 513.727L1121.45 499.118C1126.05 495.586 1131.51 492.964 1137.82 491.252C1144.24 489.433 1150.88 488.523 1157.73 488.523C1170.14 488.523 1179.72 491.52 1186.46 497.513C1193.31 503.399 1196.74 512.549 1196.74 524.964V575.21H1177.8ZM1150.83 576.334C1144.4 576.334 1138.79 575.264 1133.97 573.124C1129.15 570.876 1125.41 567.826 1122.73 563.973C1120.16 560.013 1118.88 555.572 1118.88 550.649C1118.88 545.833 1120 541.499 1122.25 537.646C1124.61 533.793 1128.41 530.743 1133.65 528.496C1138.89 526.248 1145.85 525.124 1154.52 525.124H1179.4V538.449H1155.96C1149.11 538.449 1144.51 539.572 1142.16 541.82C1139.8 543.96 1138.63 546.636 1138.63 549.846C1138.63 553.485 1140.07 556.375 1142.96 558.515C1145.85 560.656 1149.86 561.726 1155 561.726C1159.92 561.726 1164.31 560.602 1168.16 558.355C1172.12 556.107 1174.96 552.789 1176.67 548.402L1180.04 560.441C1178.12 565.471 1174.64 569.378 1169.61 572.16C1164.69 574.943 1158.42 576.334 1150.83 576.334ZM1212.86 575.21V489.486H1231.96V513.084L1229.72 506.182C1232.28 500.402 1236.3 496.014 1241.76 493.018C1247.32 490.021 1254.22 488.523 1262.46 488.523V507.626C1261.61 507.412 1260.81 507.305 1260.06 507.305C1259.31 507.198 1258.56 507.145 1257.81 507.145C1250.21 507.145 1244.16 509.392 1239.67 513.887C1235.17 518.275 1232.93 524.857 1232.93 533.633V575.21H1212.86ZM1305.35 576.334C1297.11 576.334 1289.67 574.515 1283.04 570.876C1276.51 567.13 1271.37 561.993 1267.63 555.465C1263.88 548.937 1262.01 541.231 1262.01 532.348C1262.01 523.466 1263.88 515.76 1267.63 509.232C1271.37 502.703 1276.51 497.62 1283.04 493.981C1289.67 490.342 1297.11 488.523 1305.35 488.523C1312.52 488.523 1318.94 490.128 1324.61 493.339C1330.29 496.443 1334.78 501.205 1338.1 507.626C1341.42 514.048 1343.08 522.288 1343.08 532.348C1343.08 542.301 1341.47 550.542 1338.26 557.07C1335.05 563.492 1330.61 568.308 1324.94 571.518C1319.26 574.729 1312.74 576.334 1305.35 576.334ZM1307.76 559.157C1312.58 559.157 1316.86 558.087 1320.6 555.947C1324.45 553.806 1327.5 550.703 1329.75 546.636C1332.11 542.569 1333.28 537.806 1333.28 532.348C1333.28 526.783 1332.11 522.021 1329.75 518.061C1327.5 513.994 1324.45 510.89 1320.6 508.75C1316.86 506.61 1312.58 505.539 1307.76 505.539C1302.94 505.539 1298.61 506.61 1294.76 508.75C1291.01 510.89 1287.96 513.994 1285.61 518.061C1283.36 522.021 1282.23 526.783 1282.23 532.348C1282.23 537.806 1283.36 542.569 1285.61 546.636C1287.96 550.703 1291.01 553.806 1294.76 555.947C1298.61 558.087 1302.94 559.157 1307.76 559.157ZM1333.77 575.21V554.983L1334.57 532.188L1332.96 509.392V456.095H1352.87V575.21H1333.77Z",fill:"var(--logocolor)"})]}),cM=()=>h.jsx("div",{className:"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 select-none flex-col items-center justify-center opacity-50",children:h.jsx(uM,{})}),fM=()=>h.jsx(h.Fragment,{});function kt(){return kt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kt.apply(null,arguments)}function Ds(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var gc=255,Xs=100,Q1=t=>{var{r:e,g:r,b:n,a:i}=t,a=Math.max(e,r,n),s=a-Math.min(e,r,n),o=s?a===e?(r-n)/s:a===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(o<0?o+6:o),s:a?s/a*Xs:0,v:a/gc*Xs,a:i}},hM=t=>{var{h:e,s:r,l:n,a:i}=U7(t);return"hsla("+e+", "+r+"%, "+n+"%, "+i+")"},pd=t=>{var{h:e,s:r,l:n,a:i}=t;return r*=(n<50?n:Xs-n)/Xs,{h:e,s:r>0?2*r/(n+r)*Xs:0,v:n+r,a:i}},U7=t=>{var{h:e,s:r,v:n,a:i}=t,a=(200-r)*n/Xs;return{h:e,s:a>0&&a<200?r*n/Xs/(a<=Xs?a:200-a)*Xs:0,l:a/2,a:i}},dM=t=>{var{r:e,g:r,b:n}=t,i=e<<16|r<<8|n;return"#"+(a=>new Array(7-a.length).join("0")+a)(i.toString(16))},pM=t=>{var{r:e,g:r,b:n,a:i}=t,a=typeof i=="number"&&(i*255|256).toString(16).slice(1);return""+dM({r:e,g:r,b:n})+(a||"")},nu=t=>Q1(Eie(t)),Eie=t=>{var e=t.replace("#","");/^#?/.test(t)&&e.length===3&&(t="#"+e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2));var r=new RegExp("[A-Za-z0-9]{2}","g"),[n,i,a=0,s]=t.match(r).map(o=>parseInt(o,16));return{r:n,g:i,b:a,a:(s??255)/gc}},ih=t=>{var{h:e,s:r,v:n,a:i}=t,a=e/60,s=r/Xs,o=n/Xs,A=Math.floor(a)%6,l=a-Math.floor(a),u=gc*o*(1-s),c=gc*o*(1-s*l),d=gc*o*(1-s*(1-l));o*=gc;var f={};switch(A){case 0:f.r=o,f.g=d,f.b=u;break;case 1:f.r=c,f.g=o,f.b=u;break;case 2:f.r=u,f.g=o,f.b=d;break;case 3:f.r=u,f.g=c,f.b=o;break;case 4:f.r=d,f.g=u,f.b=o;break;case 5:f.r=o,f.g=u,f.b=c;break}return f.r=Math.round(f.r),f.g=Math.round(f.g),f.b=Math.round(f.b),kt({},f,{a:i})},Sie=t=>{var{r:e,g:r,b:n,a:i}=ih(t);return"rgba("+e+", "+r+", "+n+", "+i+")"},Fie=t=>{var{r:e,g:r,b:n}=t;return{r:e,g:r,b:n}},Die=t=>{var{h:e,s:r,l:n}=t;return{h:e,s:r,l:n}},_7=t=>dM(ih(t)),Lie=t=>pM(ih(t)),Iie=t=>{var{h:e,s:r,v:n}=t;return{h:e,s:r,v:n}},kie=t=>{var{r:e,g:r,b:n}=t,i=function(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)},a=i(e/255),s=i(r/255),o=i(n/255),A={};return A.x=a*.4124+s*.3576+o*.1805,A.y=a*.2126+s*.7152+o*.0722,A.bri=a*.0193+s*.1192+o*.9505,A},Ys=t=>{var e,r,n,i,a,s,o,A,l;return typeof t=="string"&&Q7(t)?(s=nu(t),A=t):typeof t!="string"&&(s=t),s&&(n=Iie(s),a=U7(s),i=ih(s),l=pM(i),A=_7(s),r=Die(a),e=Fie(i),o=kie(e)),{rgb:e,hsl:r,hsv:n,rgba:i,hsla:a,hsva:s,hex:A,hexa:l,xy:o}},Q7=t=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(t);function Oie(t){if(t==null)throw new TypeError("Cannot destructure "+t)}var Tie=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],gM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-swatch",className:n,color:i,colors:a=[],style:s,rectProps:o={},onChange:A,addonAfter:l,addonBefore:u,rectRender:c}=t,d=Ds(t,Tie),f=kt({"--swatch-background-color":"rgb(144, 19, 254)",background:"var(--swatch-background-color)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},o.style),v=(p,C)=>{A&&A(nu(p),Ys(nu(p)),C)};return h.jsxs("div",kt({ref:e},d,{className:[r,n||""].filter(Boolean).join(" "),style:kt({display:"flex",flexWrap:"wrap",position:"relative"},s),children:[u&&H.isValidElement(u)&&u,a&&Array.isArray(a)&&a.map((p,C)=>{var w="",g="";typeof p=="string"&&(w=p,g=p),typeof p=="object"&&p.color&&(w=p.title||p.color,g=p.color);var b=i&&i.toLocaleLowerCase()===g.toLocaleLowerCase(),B=c&&c({title:w,color:g,checked:!!b,style:kt({},f,{background:g}),onClick:F=>v(g,F)});if(B)return h.jsx(H.Fragment,{children:B},C);var E=o.children&&H.isValidElement(o.children)?H.cloneElement(o.children,{color:g,checked:b}):null;return h.jsx("div",kt({tabIndex:0,title:w,onClick:F=>v(g,F)},o,{children:E,style:kt({},f,{background:g})}),C)}),l&&H.isValidElement(l)&&l]}))});gM.displayName="Swatch";var Mie={marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25};function Nie(t){var{style:e,title:r,checked:n,color:i,onClick:a,rectProps:s}=t,o=H.useRef(null),A=H.useCallback(()=>{o.current.style.zIndex="2",o.current.style.outline="#fff solid 2px",o.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"},[]),l=H.useCallback(()=>{n||(o.current.style.zIndex="0",o.current.style.outline="initial",o.current.style.boxShadow="initial")},[n]),u=n?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0};return h.jsx("div",kt({ref:o,title:r},s,{onClick:a,onMouseEnter:A,onMouseLeave:l,style:kt({},e,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},Mie,u,s?.style)}))}var Pie=["prefixCls","placement","className","style","color","colors","showTriangle","rectProps","onChange","rectRender"],Rie=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],Si=(function(t){return t.Left="L",t.LeftTop="LT",t.LeftBottom="LB",t.Right="R",t.RightTop="RT",t.RightBottom="RB",t.Top="T",t.TopRight="TR",t.TopLeft="TL",t.Bottom="B",t.BottomLeft="BL",t.BottomRight="BR",t})({}),vM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-github",placement:n=Si.TopRight,className:i,style:a,color:s,colors:o=Rie,showTriangle:A=!0,rectProps:l={},onChange:u,rectRender:c}=t,d=Ds(t,Pie),f=typeof s=="string"&&Q7(s)?nu(s):s,v=s?_7(f):"",p=E=>u&&u(Ys(E)),C=kt({"--github-border":"1px solid rgba(0, 0, 0, 0.2)","--github-background-color":"#fff","--github-box-shadow":"rgb(0 0 0 / 15%) 0px 3px 12px","--github-arrow-border-color":"rgba(0, 0, 0, 0.15)",width:200,borderRadius:4,background:"var(--github-background-color)",boxShadow:"var(--github-box-shadow)",border:"var(--github-border)",position:"relative",padding:5},a),w={borderStyle:"solid",position:"absolute"},g=kt({},w),b=kt({},w);/^T/.test(n)&&(g.borderWidth="0 8px 8px",g.borderColor="transparent transparent var(--github-arrow-border-color)",b.borderWidth="0 7px 7px",b.borderColor="transparent transparent var(--github-background-color)"),n===Si.TopRight&&(g.top=-8,b.top=-7),n===Si.Top&&(g.top=-8,b.top=-7),n===Si.TopLeft&&(g.top=-8,b.top=-7),/^B/.test(n)&&(g.borderWidth="8px 8px 0",g.borderColor="var(--github-arrow-border-color) transparent transparent",b.borderWidth="7px 7px 0",b.borderColor="var(--github-background-color) transparent transparent",n===Si.BottomRight&&(g.top="100%",b.top="100%"),n===Si.Bottom&&(g.top="100%",b.top="100%"),n===Si.BottomLeft&&(g.top="100%",b.top="100%")),/^(B|T)/.test(n)&&((n===Si.Top||n===Si.Bottom)&&(g.left="50%",g.marginLeft=-8,b.left="50%",b.marginLeft=-7),(n===Si.TopRight||n===Si.BottomRight)&&(g.right=10,b.right=11),(n===Si.TopLeft||n===Si.BottomLeft)&&(g.left=7,b.left=8)),/^L/.test(n)&&(g.borderWidth="8px 8px 8px 0",g.borderColor="transparent var(--github-arrow-border-color) transparent transparent",b.borderWidth="7px 7px 7px 0",b.borderColor="transparent var(--github-background-color) transparent transparent",g.left=-8,b.left=-7),/^R/.test(n)&&(g.borderWidth="8px 0 8px 8px",g.borderColor="transparent transparent transparent var(--github-arrow-border-color)",b.borderWidth="7px 0 7px 7px",b.borderColor="transparent transparent transparent var(--github-background-color)",g.right=-8,b.right=-7),/^(L|R)/.test(n)&&((n===Si.RightTop||n===Si.LeftTop)&&(g.top=5,b.top=6),(n===Si.Left||n===Si.Right)&&(g.top="50%",b.top="50%",g.marginTop=-8,b.marginTop=-7),(n===Si.LeftBottom||n===Si.RightBottom)&&(g.top="100%",b.top="100%",g.marginTop=-21,b.marginTop=-20));var B=E=>{var F=kt({},(Oie(E),E)),O=c&&c(kt({},F));return O||h.jsx(Nie,kt({},F,{rectProps:l}))};return h.jsx(gM,kt({ref:e,className:[r,i].filter(Boolean).join(" "),colors:o,color:v,rectRender:B},d,{onChange:p,style:C,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:h.jsx(H.Fragment,{children:A&&h.jsxs(H.Fragment,{children:[h.jsx("div",{style:g}),h.jsx("div",{style:b})]})})}))});vM.displayName="Github";function Qy(t){var e=H.useRef(t);return H.useEffect(()=>{e.current=t}),H.useCallback((r,n)=>e.current&&e.current(r,n),[])}var sf=t=>"touches"in t,jy=t=>{!sf(t)&&t.preventDefault&&t.preventDefault()},Hy=function(e,r,n){return r===void 0&&(r=0),n===void 0&&(n=1),e>n?n:e<r?r:e},Ky=(t,e)=>{var r=t.getBoundingClientRect(),n=sf(e)?e.touches[0]:e;return{left:Hy((n.pageX-(r.left+window.pageXOffset))/r.width),top:Hy((n.pageY-(r.top+window.pageYOffset))/r.height),width:r.width,height:r.height,x:n.pageX-(r.left+window.pageXOffset),y:n.pageY-(r.top+window.pageYOffset)}},Uie=["prefixCls","className","onMove","onDown"],j7=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-interactive",className:n,onMove:i,onDown:a}=t,s=Ds(t,Uie),o=H.useRef(null),A=H.useRef(!1),[l,u]=H.useState(!1),c=Qy(i),d=Qy(a),f=g=>A.current&&!sf(g)?!1:(A.current=sf(g),!0),v=H.useCallback(g=>{if(jy(g),!!o.current){var b=sf(g)?g.touches.length>0:g.buttons>0;if(!b){u(!1);return}c?.(Ky(o.current,g),g)}},[c]),p=H.useCallback(()=>u(!1),[]),C=H.useCallback(g=>{g?(window.addEventListener(A.current?"touchmove":"mousemove",v),window.addEventListener(A.current?"touchend":"mouseup",p)):(window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",p),window.removeEventListener("touchmove",v),window.removeEventListener("touchend",p))},[v,p]);H.useEffect(()=>(C(l),()=>{C(!1)}),[l,v,p,C]);var w=H.useCallback(g=>{var b=document.activeElement;b?.blur(),jy(g.nativeEvent),f(g.nativeEvent)&&o.current&&(d?.(Ky(o.current,g.nativeEvent),g.nativeEvent),u(!0))},[d]);return h.jsx("div",kt({},s,{className:[r,n||""].filter(Boolean).join(" "),style:kt({},s.style,{touchAction:"none"}),ref:o,tabIndex:0,onMouseDown:w,onTouchStart:w}))});j7.displayName="Interactive";var _ie=t=>{var{className:e,color:r,left:n,top:i,prefixCls:a}=t,s={position:"absolute",top:i,left:n},o={"--saturation-pointer-box-shadow":"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",width:6,height:6,transform:"translate(-3px, -3px)",boxShadow:"var(--saturation-pointer-box-shadow)",borderRadius:"50%",backgroundColor:r};return H.useMemo(()=>h.jsx("div",{className:a+"-pointer "+(e||""),style:s,children:h.jsx("div",{className:a+"-fill",style:o})}),[i,n,r,e,a])},Qie=["prefixCls","radius","pointer","className","hue","style","hsva","onChange"],mM=H.forwardRef((t,e)=>{var r,{prefixCls:n="w-color-saturation",radius:i=0,pointer:a,className:s,hue:o=0,style:A,hsva:l,onChange:u}=t,c=Ds(t,Qie),d=kt({width:200,height:200,borderRadius:i},A,{position:"relative"}),f=H.useRef(null),v=H.useCallback(b=>{f.current=b,typeof e=="function"?e(b):e&&"current"in e&&(e.current=b)},[e]),p=H.useCallback((b,B)=>{u&&l&&u({h:l.h,s:b.left*100,v:(1-b.top)*100,a:l.a});var E=f.current;E&&E.focus()},[l,u]),C=H.useCallback(b=>{if(!(!l||!u)){var B=1,E=l.s,F=l.v,O=!1;switch(b.key){case"ArrowLeft":E=Math.max(0,l.s-B),O=!0,b.preventDefault();break;case"ArrowRight":E=Math.min(100,l.s+B),O=!0,b.preventDefault();break;case"ArrowUp":F=Math.min(100,l.v+B),O=!0,b.preventDefault();break;case"ArrowDown":F=Math.max(0,l.v-B),O=!0,b.preventDefault();break;default:return}O&&u({h:l.h,s:E,v:F,a:l.a})}},[l,u]),w=H.useMemo(()=>{if(!l)return null;var b={top:100-l.v+"%",left:l.s+"%",color:hM(l)};return a&&typeof a=="function"?a(kt({prefixCls:n},b)):h.jsx(_ie,kt({prefixCls:n},b))},[l,a,n]),g=H.useCallback(b=>{b.target.focus()},[]);return h.jsx(j7,kt({className:[n,s||""].filter(Boolean).join(" ")},c,{style:kt({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+((r=l?.h)!=null?r:o)+", 100%, 50%))"},d,{outline:"none"}),ref:v,onMove:p,onDown:p,onKeyDown:C,onClick:g,children:w}))});mM.displayName="Saturation";var jie=["className","prefixCls","left","top","style","fillProps"],Hie=t=>{var{className:e,prefixCls:r,left:n,top:i,style:a,fillProps:s}=t,o=Ds(t,jie),A=kt({},a,{position:"absolute",left:n,top:i}),l=kt({width:18,height:18,boxShadow:"var(--alpha-pointer-box-shadow)",borderRadius:"50%",backgroundColor:"var(--alpha-pointer-background-color)"},s?.style,{transform:n?"translate(-9px, -1px)":"translate(-1px, -9px)"});return h.jsx("div",kt({className:r+"-pointer "+(e||""),style:A},o,{children:h.jsx("div",kt({className:r+"-fill"},s,{style:l}))}))},Kie=["prefixCls","className","hsva","background","bgProps","innerProps","pointerProps","radius","width","height","direction","style","onChange","pointer"],Vie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",i2=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-alpha",className:n,hsva:i,background:a,bgProps:s={},innerProps:o={},pointerProps:A={},radius:l=0,width:u,height:c=16,direction:d="horizontal",style:f,onChange:v,pointer:p}=t,C=Ds(t,Kie),w=k=>{v&&v(kt({},i,{a:d==="horizontal"?k.left:k.top}),k)},g=hM(Object.assign({},i,{a:1})),b="linear-gradient(to "+(d==="horizontal"?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+g+" 100%)",B={};d==="horizontal"?B.left=i.a*100+"%":B.top=i.a*100+"%";var E=kt({"--alpha-background-color":"#fff","--alpha-pointer-background-color":"rgb(248, 248, 248)","--alpha-pointer-box-shadow":"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:l,background:"url("+Vie+") left center",backgroundColor:"var(--alpha-background-color)"},{width:u,height:c},f,{position:"relative"}),F=H.useCallback(k=>{var j=.01,D=i.a,L=D;switch(k.key){case"ArrowLeft":d==="horizontal"&&(L=Math.max(0,D-j),k.preventDefault());break;case"ArrowRight":d==="horizontal"&&(L=Math.min(1,D+j),k.preventDefault());break;case"ArrowUp":d==="vertical"&&(L=Math.max(0,D-j),k.preventDefault());break;case"ArrowDown":d==="vertical"&&(L=Math.min(1,D+j),k.preventDefault());break;default:return}if(L!==D){var P={left:d==="horizontal"?L:i.a,top:d==="vertical"?L:i.a,width:0,height:0,x:0,y:0};v&&v(kt({},i,{a:L}),P)}},[i,d,v]),O=H.useCallback(k=>{k.target.focus()},[]),I=p&&typeof p=="function"?p(kt({prefixCls:r},A,B)):h.jsx(Hie,kt({},A,{prefixCls:r},B));return h.jsxs("div",kt({},C,{className:[r,r+"-"+d,n||""].filter(Boolean).join(" "),style:E,ref:e,children:[h.jsx("div",kt({},s,{style:kt({inset:0,position:"absolute",background:a||b,borderRadius:l},s.style)})),h.jsx(j7,kt({},o,{style:kt({},o.style,{inset:0,zIndex:1,position:"absolute",outline:"none"}),onMove:w,onDown:w,onClick:O,onKeyDown:F,children:I}))]}))});i2.displayName="Alpha";var Wie=["prefixCls","className","hue","onChange","direction"],wM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-hue",className:n,hue:i=0,onChange:a,direction:s="horizontal"}=t,o=Ds(t,Wie);return h.jsx(i2,kt({ref:e,className:r+" "+(n||"")},o,{direction:s,background:"linear-gradient(to "+(s==="horizontal"?"right":"bottom")+", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",hsva:{h:i,s:100,v:100,a:i/360},onChange:(A,l)=>{a&&a({h:s==="horizontal"?360*l.left:360*l.top})}}))});wM.displayName="Hue";var qie=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur","renderInput"],zie=t=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(t),Gie=t=>Number(String(t).replace(/%/g,"")),vc=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-editable-input",placement:n="bottom",label:i,value:a,className:s,style:o,labelStyle:A,inputStyle:l,onChange:u,onBlur:c,renderInput:d}=t,f=Ds(t,qie),[v,p]=H.useState(a),C=H.useRef(!1);H.useEffect(()=>{t.value!==v&&(C.current||p(t.value))},[t.value]);function w(O,I){var k=(I||O.target.value).trim().replace(/^#/,"");zie(k)&&u&&u(O,k);var j=Gie(k);isNaN(j)||u&&u(O,j),p(k)}function g(O){C.current=!1,p(t.value),c&&c(O)}var b={};n==="bottom"&&(b.flexDirection="column"),n==="top"&&(b.flexDirection="column-reverse"),n==="left"&&(b.flexDirection="row-reverse");var B=kt({"--editable-input-label-color":"rgb(153, 153, 153)","--editable-input-box-shadow":"rgb(204 204 204) 0px 0px 0px 1px inset","--editable-input-color":"#666",position:"relative",alignItems:"center",display:"flex",fontSize:11},b,o),E=kt({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,background:"transparent",boxSizing:"border-box",border:"none",color:"var(--editable-input-color)",boxShadow:"var(--editable-input-box-shadow)"},l),F=kt({value:v,onChange:w,onBlur:g,autoComplete:"off",onFocus:()=>C.current=!0},f,{style:E,onFocusCapture:O=>{var I=O.target;I.setSelectionRange(I.value.length,I.value.length)}});return h.jsxs("div",{className:[r,s||""].filter(Boolean).join(" "),style:B,children:[d?d(F,e):h.jsx("input",kt({ref:e},F)),i&&h.jsx("span",{style:kt({color:"var(--editable-input-label-color)",textTransform:"capitalize"},A),children:i})]})});vc.displayName="EditableInput";var $ie=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],H7=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-editable-input-rgba",hsva:n,placement:i="bottom",rProps:a={},gProps:s={},bProps:o={},aProps:A={},className:l,style:u,onChange:c}=t,d=Ds(t,$ie),f=n?ih(n):{};function v(g){var b=Number(g.target.value);b&&b>255&&(g.target.value="255"),b&&b<0&&(g.target.value="0")}var p=g=>{var b=Number(g.target.value);b&&b>100&&(g.target.value="100"),b&&b<0&&(g.target.value="0")},C=(g,b,B)=>{typeof g=="number"&&(b==="a"&&(g<0&&(g=0),g>100&&(g=100),c&&c(Ys(Q1(kt({},f,{a:g/100}))))),g>255&&(g=255,B.target.value="255"),g<0&&(g=0,B.target.value="0"),b==="r"&&c&&c(Ys(Q1(kt({},f,{r:g})))),b==="g"&&c&&c(Ys(Q1(kt({},f,{g})))),b==="b"&&c&&c(Ys(Q1(kt({},f,{b:g})))))},w=f.a?Math.round(f.a*100)/100:0;return h.jsxs("div",kt({ref:e,className:[r,l||""].filter(Boolean).join(" ")},d,{style:kt({fontSize:11,display:"flex"},u),children:[h.jsx(vc,kt({label:"R",value:f.r||0,onBlur:v,placement:i,onChange:(g,b)=>C(b,"r",g)},a,{style:kt({},a.style)})),h.jsx(vc,kt({label:"G",value:f.g||0,onBlur:v,placement:i,onChange:(g,b)=>C(b,"g",g)},s,{style:kt({marginLeft:5},s.style)})),h.jsx(vc,kt({label:"B",value:f.b||0,onBlur:v,placement:i,onChange:(g,b)=>C(b,"b",g)},o,{style:kt({marginLeft:5},o.style)})),A&&h.jsx(vc,kt({label:"A",value:parseInt(String(w*100),10),onBlur:p,placement:i,onChange:(g,b)=>C(b,"a",g)},A,{style:kt({marginLeft:5},A.style)}))]}))});H7.displayName="EditableInputRGBA";var Xie=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],CM=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-editable-input-hsla",hsva:n,hProps:i={},sProps:a={},lProps:s={},aProps:o={},className:A,onChange:l}=t,u=Ds(t,Xie),c=n?U7(n):{h:0,s:0,l:0,a:0},d=(v,p,C)=>{typeof v=="number"&&(p==="h"&&(v<0&&(v=0),v>360&&(v=360),l&&l(Ys(pd(kt({},c,{h:v}))))),p==="s"&&(v<0&&(v=0),v>100&&(v=100),l&&l(Ys(pd(kt({},c,{s:v}))))),p==="l"&&(v<0&&(v=0),v>100&&(v=100),l&&l(Ys(pd(kt({},c,{l:v}))))),p==="a"&&(v<0&&(v=0),v>1&&(v=1),l&&l(Ys(pd(kt({},c,{a:v}))))))},f=o==!1?!1:kt({label:"A",value:Math.round(c.a*100)/100},o,{onChange:(v,p)=>d(p,"a")});return h.jsx(H7,kt({ref:e,hsva:n,rProps:kt({label:"H",value:Math.round(c.h)},i,{onChange:(v,p)=>d(p,"h")}),gProps:kt({label:"S",value:Math.round(c.s)+"%"},a,{onChange:(v,p)=>d(p,"s")}),bProps:kt({label:"L",value:Math.round(c.l)+"%"},s,{onChange:(v,p)=>d(p,"l")}),aProps:f,className:[r,A||""].filter(Boolean).join(" ")},u))});CM.displayName="EditableInputHSLA";var Yie=["style"];function Zie(t){var{style:e}=t,r=Ds(t,Yie),n=H.useRef(null),i=H.useCallback(()=>{n.current.style.backgroundColor="var(--chrome-arrow-background-color)"},[]),a=H.useCallback(()=>{n.current.style.backgroundColor="transparent"},[]);return h.jsx("div",kt({ref:n,style:kt({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},e)},r,{onMouseEnter:i,onMouseLeave:a,children:h.jsx("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:h.jsx("path",{d:"M373.888 576h276.224c9.322667 0 14.293333 11.178667 9.173333 18.773333l-1.258666 1.557334-138.112 146.858666a10.709333 10.709333 0 0 1-14.293334 1.365334l-1.536-1.365334-138.112-146.858666c-6.592-6.997333-2.666667-18.645333 5.973334-20.16l1.941333-0.170667h276.224-276.224z m146.026667-295.189333l138.112 146.858666c7.04 7.509333 2.069333 20.330667-7.914667 20.330667H373.888c-9.984 0-14.976-12.821333-7.914667-20.330667l138.112-146.858666a10.730667 10.730667 0 0 1 15.829334 0z",fill:"var(--chrome-arrow-fill)"})})}))}function Jie(){return"EyeDropper"in window}function eae(t){var e=()=>{if("EyeDropper"in window){var r=new window.EyeDropper;r.open().then(n=>{t.onPickColor==null||t.onPickColor(n.sRGBHex)}).catch(n=>{n.name})}};return h.jsx("svg",{viewBox:"0 0 512 512",height:"1em",width:"1em",onClick:e,children:h.jsx("path",{fill:"currentColor",d:"M482.8 29.23c38.9 38.98 38.9 102.17 0 141.17L381.2 271.9l9.4 9.5c12.5 12.5 12.5 32.7 0 45.2s-32.7 12.5-45.2 0l-160-160c-12.5-12.5-12.5-32.7 0-45.2s32.7-12.5 45.2 0l9.5 9.4L341.6 29.23c39-38.974 102.2-38.974 141.2 0zM55.43 323.3 176.1 202.6l45.3 45.3-120.7 120.7c-3.01 3-4.7 7-4.7 11.3V416h36.1c4.3 0 8.3-1.7 11.3-4.7l120.7-120.7 45.3 45.3-120.7 120.7c-15 15-35.4 23.4-56.6 23.4H89.69l-39.94 26.6c-12.69 8.5-29.59 6.8-40.377-4-10.786-10.8-12.459-27.7-3.998-40.4L32 422.3v-42.4c0-21.2 8.43-41.6 23.43-56.6z"})})}var tae=["prefixCls","className","style","color","showEditableInput","showEyeDropper","showColorPreview","showHue","showAlpha","inputType","rectProps","onChange"],mo=(function(t){return t.HEXA="hexa",t.RGBA="rgba",t.HSLA="hsla",t})({}),gu=H.forwardRef((t,e)=>{var{prefixCls:r="w-color-chrome",className:n,style:i,color:a,showEditableInput:s=!0,showEyeDropper:o=!0,showColorPreview:A=!0,showHue:l=!0,showAlpha:u=!0,inputType:c=mo.RGBA,rectProps:d={},onChange:f}=t,v=Ds(t,tae),p=typeof a=="string"&&Q7(a)?nu(a):a||{h:0,s:0,l:0,a:0},C=D=>f&&f(Ys(D)),[w,g]=H.useState(c),b=()=>{w===mo.RGBA&&g(mo.HSLA),w===mo.HSLA&&g(mo.HEXA),w===mo.HEXA&&g(mo.RGBA)},B={paddingTop:6},E={textAlign:"center",paddingTop:4,paddingBottom:4},F=kt({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:"column",width:230,padding:0},i),O={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:Sie(p),boxShadow:"var(--chrome-alpha-box-shadow)"},I=D=>{var L=nu(D);C(kt({},L))},k={height:14,width:14},j={style:kt({},k),fillProps:{style:k}};return h.jsx(vM,kt({ref:e,color:p,style:F,colors:void 0,className:[r,n].filter(Boolean).join(" "),placement:Si.TopLeft},v,{addonAfter:h.jsxs(H.Fragment,{children:[h.jsx(mM,{hsva:p,style:{width:"100%",height:130},onChange:D=>{C(kt({},p,D,{a:p.a}))}}),h.jsxs("div",{style:{padding:15,display:"flex",alignItems:"center",gap:10},children:[Jie()&&o&&h.jsx(eae,{onPickColor:I}),A&&h.jsx(i2,{width:28,height:28,hsva:p,radius:2,style:{borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:O},pointer:()=>h.jsx(H.Fragment,{})}),h.jsxs("div",{style:{flex:1},children:[l==!0&&h.jsx(wM,{hue:p.h,style:{width:"100%",height:12,borderRadius:2},pointerProps:j,bgProps:{style:{borderRadius:2}},onChange:D=>{C(kt({},p,D))}}),u==!0&&h.jsx(i2,{hsva:p,style:{marginTop:6,height:12,borderRadius:2},pointerProps:j,bgProps:{style:{borderRadius:2}},onChange:D=>{C(kt({},p,D))}})]})]}),s&&h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[h.jsxs("div",{style:{flex:1},children:[w==mo.RGBA&&h.jsx(H7,{hsva:p,rProps:{labelStyle:B,inputStyle:E},gProps:{labelStyle:B,inputStyle:E},bProps:{labelStyle:B,inputStyle:E},aProps:u==!1?!1:{labelStyle:B,inputStyle:E},onChange:D=>C(D.hsva)}),w===mo.HEXA&&h.jsx(vc,{label:"HEX",labelStyle:B,inputStyle:E,value:p.a>0&&p.a<1?Lie(p).toLocaleUpperCase():_7(p).toLocaleUpperCase(),onChange:(D,L)=>{typeof L=="string"&&C(nu(/^#/.test(L)?L:"#"+L))}}),w===mo.HSLA&&h.jsx(CM,{hsva:p,hProps:{labelStyle:B,inputStyle:E},sProps:{labelStyle:B,inputStyle:E},lProps:{labelStyle:B,inputStyle:E},aProps:u==!1?!1:{labelStyle:B,inputStyle:E},onChange:D=>C(D.hsva)})]}),h.jsx(Zie,{onClick:b})]})]}),rectRender:()=>h.jsx(H.Fragment,{})}))});gu.displayName="Chrome";const rae=t=>t.selectedIds.length>0?t.selectedIds:t.selectedId?[t.selectedId]:[],Cm=(t,e)=>t.filter(r=>e.includes(r.id)&&(r.type==="text"||r.type==="rectangle"||r.type==="circle")),yM=(t,e)=>t.filter(r=>e.includes(r.id)&&(r.type==="rectangle"||r.type==="circle"||r.type==="svg")),nae=(t,e)=>t.filter(r=>e.includes(r.id)&&r.type==="image"),bM=(t,e)=>t.filter(r=>e.includes(r.id)&&r.type==="draw"),iae=(t,e)=>t.filter(r=>e.includes(r.id)&&r.type==="line"),zi=(t,e)=>{if(t.length===0)return;const r=e(t[0]);return t.every(n=>e(n)===r)?r:void 0},Vy="inline-flex h-(--selectiontoolbar-height) items-center justify-between gap-0 rounded-none border-none bg-transparent px-2.5 text-sm font-medium text-[color:var(--popover-dark-text,#f3f4f6)] shadow-none outline-none transition-colors duration-150 hover:bg-[rgba(255,255,255,0.05)] [&>svg:last-child]:size-[14px] [&>svg:last-child]:ml-2 [&>svg:last-child]:pointer-events-none [&>svg:last-child]:text-[color:var(--popover-dark-text,#b8b8b8)]",Wy="w-fit! min-w-fit! [&_*]:flex-row!",gd="float-left w-fit shrink-0 cursor-pointer rounded-full bg-transparent p-[4px_1px]! transition-all duration-[0.1s] hover:scale-105",aae="my-auto ml-[5px] mr-1 h-5 w-px bg-[rgba(var(--darkborder-rgb,255,255,255),1)] opacity-20",qy="flex",qu="[&_span]:flex [&_span]:items-center [&_span]:gap-1.5",zy="mx-auto my-0.5 mt-2 h-px w-[95%] border-none bg-[rgba(var(--text-rgb),0.2)]",sae="flex flex-col items-center justify-center px-2 pb-2 pt-3",Gy="flex items-center justify-center [&_*]:p-0!",oae="[box-shadow:none]! [transform:translateY(138px)_translateX(18px)]!",Aae="[box-shadow:none]! [transform:translateY(145px)_translateX(26px)]!",BM=({scene:t,shapeColors:e,selectedIds:r,localeMessages:n,customDrawColorPickerWrapRef:i,customDrawColorPickerContentRef:a,customDrawColorPickerColor:s,setCustomDrawColorPickerColor:o,onShapeFillColorChange:A,onShapeFillStyleChange:l,onShapeStrokeColorChange:u,onShapeStrokeWidthChange:c,onShapeStrokeStyleChange:d,uniColor:f,activeSelectId:v,setActiveSelectId:p})=>{const C=yM(t.elements,r),w=C.map(W=>W.id),g=zi(C,W=>W.fill)??"multi",b=g==="multi"?C[0]?.fill??t.settings.shapeDefaults.fill:g,B=zi(C,W=>W.fillStyle)??"solid",E=[...e[0],...e[1]],F=E.some(W=>W!=="multi"&&W.toLowerCase()===b.toLowerCase())?b:"multi",O=E.some(W=>W!=="multi"&&W.toLowerCase()===b.toLowerCase()),I=zi(C,W=>W.stroke)??"multi",k=I==="multi"?C[0]?.stroke??t.settings.shapeDefaults.stroke:I,j=E.some(W=>W!=="multi"&&W.toLowerCase()===k.toLowerCase())?k:"multi",D=zi(C,W=>W.strokeStyle),L=D==="solid"||D==="dashed"||D==="none"?D:"solid",P=E.some(W=>W!=="multi"&&W.toLowerCase()===k.toLowerCase()),R=H.useRef(!1),q=H.useRef(!1),[te,ne]=H.useState(null),Z=W=>{const se=W==="fill"?b:k;ne(W),p(W==="fill"?"shape-fill-color":"shape-stroke-color"),o(r7(se))};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:i,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:v==="shape-fill-color",onOpenChange:W=>{if(W){ne(null),p("shape-fill-color");return}if(R.current){R.current=!1;return}te==="fill"&&ne(null),p(null)},value:String(F),onValueChange:W=>{if(["solid","hachure","none"].includes(W)){l(w,W);return}if(W==="multi"){Z("fill");return}p(null),A(w,W)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Vy,onPointerDown:W=>{F==="multi"&&(W.preventDefault(),W.stopPropagation(),Z("fill"))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:n.selectionBar.fillColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:f(b)}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:n.selectionBar.fillColor})})]}),h.jsxs(Ua,{position:"popper",className:Wy,children:[h.jsxs("div",{className:qy,children:[h.jsxs(qr,{className:qu+(B==="solid"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"solid",children:[h.jsx(AY,{})," Relleno"]}),h.jsxs(qr,{className:qu+(B==="hachure"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"hachure",children:[h.jsx(hY,{})," Hachure"]}),h.jsxs(qr,{className:qu+(B==="none"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"none",children:[h.jsx(fY,{})," Sin relleno"]})]}),h.jsx("hr",{className:zy}),h.jsxs("div",{className:sae,"data-disabled":B==="none"?"":void 0,children:[h.jsx("div",{className:Gy,children:h.jsx(ko,{colors:e[0],currentColor:b,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,children:J},W)})}),h.jsx("div",{className:Gy,children:h.jsx(ko,{colors:e[1],realTotalColors:E,currentColor:b,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),R.current=!0,Z("fill")}:void 0,children:J},W)})})]})]})]})}),h.jsxs(Nr,{open:v==="shape-fill-color"&&(te==="fill"||!O),children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:aae})}),h.jsx(Rr,{className:oae,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:a,onPointerDown:W=>W.stopPropagation(),children:h.jsx(gu,{color:s,onChange:W=>{const se=W.hexa||W.hex;se&&(o(se),A(w,se))}})})})]}),h.jsxs(Pa,{open:v==="shape-stroke-color",onOpenChange:W=>{if(W){ne(null),p("shape-stroke-color");return}if(q.current){q.current=!1;return}te==="stroke"&&ne(null),p(null)},value:String(j),onValueChange:W=>{if(["solid","dashed","none"].includes(W)){d(w,W);return}if(W==="multi"){Z("stroke");return}p(null),u(w,W)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Vy,onPointerDown:W=>{j==="multi"&&(W.preventDefault(),W.stopPropagation(),Z("stroke"))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:n.selectionBar.strokeColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"3px",border:"2px solid "+f(k),height:"20px",background:"transparent"}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:n.selectionBar.strokeColor})})]}),h.jsxs(Ua,{position:"popper",className:Wy,children:[h.jsxs("div",{className:qy,children:[h.jsxs(qr,{className:qu+(L==="solid"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"solid",children:[h.jsx(uY,{})," Sólido"]}),h.jsxs(qr,{className:qu+(L==="dashed"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"dashed",children:[h.jsx(lY,{})," Discontinuo"]}),h.jsxs(qr,{className:qu+(L==="none"?" bg-[rgba(var(--accent-rgb),0.5)]":""),value:"none",children:[h.jsx(cY,{})," Ninguno"]})]}),h.jsx("hr",{className:zy}),h.jsx("div",{children:h.jsx(ko,{colors:e[0],currentColor:k,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,children:J},W)})}),h.jsx("div",{children:h.jsx(ko,{colors:e[1],realTotalColors:E,currentColor:k,uniColor:f,renderItem:({color:W,isMulti:se,swatch:J})=>h.jsx(qr,{value:W,className:gd,check:!1,onPointerDown:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,onSelect:se?T=>{T.preventDefault(),T.stopPropagation(),q.current=!0,Z("stroke")}:void 0,children:J},W)})})]})]}),h.jsxs(Nr,{open:v==="shape-stroke-color"&&(te==="stroke"||!P),children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{})}),h.jsx(Rr,{className:Aae,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:a,onPointerDown:W=>W.stopPropagation(),children:h.jsx(gu,{color:s,onChange:W=>{const se=W.hexa||W.hex;se&&(o(se),u(w,se))}})})})]})]})},lae="inline-flex h-(--selectiontoolbar-height) items-center justify-between gap-0 rounded-none border-none bg-transparent px-2.5 text-sm font-medium text-[color:var(--popover-dark-text,#f3f4f6)] shadow-none outline-none transition-colors duration-150 hover:bg-[rgba(255,255,255,0.05)] [&>svg:last-child]:size-[14px] [&>svg:last-child]:ml-2 [&>svg:last-child]:pointer-events-none [&>svg:last-child]:text-[color:var(--popover-dark-text,#b8b8b8)]",$y=`${lae} w-[78px] justify-center px-3`,Xy="w-fit! min-w-fit! [&_*]:flex-row!",Yy="float-left w-fit shrink-0 cursor-pointer rounded-full bg-transparent p-[4px_1px]! transition-all duration-[0.1s] hover:scale-105",vd="my-auto ml-[5px] mr-1 h-5 w-px bg-[rgba(var(--darkborder-rgb,255,255,255),1)] opacity-20",Zy="flex p-[7px_8px] [&_*]:w-full",md="flex items-center justify-center [&_svg]:h-auto [&_svg]:w-[180px]",Jy="[box-shadow:none]! [transform:translateY(60px)]!",wd=(t,e)=>{const r=t[e]??t[0];return r?h.jsx("svg",{width:r.width,height:r.height,viewBox:r.viewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:r.path,stroke:r.strokeWidth?"currentColor":void 0,strokeWidth:r.strokeWidth,strokeLinecap:r.strokeWidth?"round":void 0,fill:r.fill})}):null},xM=({scene:t,strokeColors:e,selectedIds:r,drawingTool:n,localeMessages:i,customDrawColorPickerWrapRef:a,customDrawColorPickerContentRef:s,isCustomDrawColorPickerOpen:o,setIsCustomDrawColorPickerOpen:A,customDrawColorPickerColor:l,setCustomDrawColorPickerColor:u,onDrawStrokeWidthChange:c,onDrawStrokeColorChange:d,onDrawDefaultStrokeColorChange:f,onLineStartCapChange:v,onLineEndCapChange:p,uniColor:C,activeSelectId:w,setActiveSelectId:g})=>{const b=bM(t.elements,r),B=iae(t.elements,r),E=zi(b,J=>J.drawMode??"draw")??"draw",F=E==="marker"?xf:JA,O=E==="marker"?lO:l0,I=E==="marker"?dz(zi(b,J=>J.strokeWidth)??xf[0]):tC(zi(b,J=>J.strokeWidth)??JA[1]),k=E==="marker"?t.settings.drawDefaults.markerStroke:E==="quill"?t.settings.drawDefaults.quillStroke:t.settings.drawDefaults.drawStroke,j=b[0]?.stroke||k,D=e.some(J=>J!=="multi"&&J.toLowerCase()===j.toLowerCase())?j:"multi",L=zi(B,J=>J.stroke)??"multi",P=L==="multi"?B[0]?.stroke??t.settings.shapeDefaults.lineStroke:L,R=e.some(J=>J!=="multi"&&J.toLowerCase()===L.toLowerCase())?L:"multi",q=tC(zi(B,J=>J.strokeWidth)??JA[1]),te=J=>{u(r7(J)),A(!0)},ne=()=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:a,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:w==="draw-stroke-color"||o||void 0,onOpenChange:J=>{J?g("draw-stroke-color"):w==="draw-stroke-color"&&g(null)},value:String(D),onValueChange:J=>{if(J==="multi"){te(j);return}if(A(!1),g(null),b.length===0){f(E,J);return}d(b.map(T=>T.id),J)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{onPointerDown:J=>{D==="multi"&&(J.preventDefault(),J.stopPropagation(),te(j))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:C(j||k)}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeColor})})]}),h.jsx(Ua,{position:"popper",className:Xy,children:h.jsx(ko,{colors:e,currentColor:j,uniColor:C,renderItem:({color:J,isMulti:T,swatch:_})=>h.jsx(qr,{value:J,className:Yy,check:!1,onPointerDown:T?G=>{G.preventDefault(),G.stopPropagation(),te(j)}:void 0,onSelect:T?G=>{G.preventDefault(),te(j)}:void 0,children:_},J)})})]})}),h.jsxs(Nr,{open:o,children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:vd})}),h.jsx(Rr,{className:Jy,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:s,onPointerDown:J=>J.stopPropagation(),children:h.jsx(gu,{color:l,onChange:J=>{const T=J.hexa||J.hex;if(T){if(u(T),b.length===0){f(E,T);return}d(b.map(_=>_.id),T)}}})})})]}),h.jsxs(Pa,{open:w==="draw-stroke-width",onOpenChange:J=>{J?g("draw-stroke-width"):w==="draw-stroke-width"&&g(null)},value:String(I),onValueChange:J=>{g(null),c(b.map(T=>T.id),Number(J))},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:$y,style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeWidth})}),h.jsx("span",{className:md,children:wd(O,Math.max(0,F.findIndex(J=>J===I)))})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeWidth})})]}),h.jsx(Ua,{position:"popper",children:F.map((J,T)=>h.jsx(qr,{check:!1,value:String(J),className:Zy,children:h.jsx("span",{className:md,children:wd(O,T)})},J))})]})]}),Z=()=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:a,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:w==="line-stroke-color"||o,onOpenChange:J=>{J?g("line-stroke-color"):w==="line-stroke-color"&&g(null)},value:String(R),onValueChange:J=>{if(J==="multi"){te(P);return}A(!1),g(null),d(B.map(T=>T.id),J)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{onPointerDown:J=>{R==="multi"&&(J.preventDefault(),J.stopPropagation(),te(P))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:C(P)}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeColor})})]}),h.jsx(Ua,{position:"popper",className:Xy,children:h.jsx(ko,{colors:e,currentColor:P,uniColor:C,renderItem:({color:J,isMulti:T,swatch:_})=>h.jsx(qr,{value:J,className:Yy,check:!1,onPointerDown:T?G=>{G.preventDefault(),G.stopPropagation(),te(P)}:void 0,onSelect:T?G=>{G.preventDefault(),te(P)}:void 0,children:_},J)})})]})}),h.jsxs(Nr,{open:o,children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:vd})}),h.jsx(Rr,{className:Jy,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:s,onPointerDown:J=>J.stopPropagation(),children:h.jsx(gu,{color:l,onChange:J=>{const T=J.hexa||J.hex;T&&(u(T),d(B.map(_=>_.id),T))}})})})]})]}),W=()=>{const J=zi(B,_=>_.startCap),T=zi(B,_=>_.endCap);return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsxs(Pa,{open:w==="line-start-cap",onOpenChange:_=>{_?g("line-start-cap"):w==="line-start-cap"&&g(null)},value:J||"",onValueChange:_=>{g(null),v(B.map(G=>G.id),_)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(Ra,{children:h.jsx(as,{placeholder:"Start cap"})})}),h.jsx(Rr,{children:h.jsx("p",{children:"Line start cap"})})]}),h.jsx(Ua,{position:"popper",children:Jw.map((_,G)=>{const re=eC[G];return h.jsx(qr,{className:"flex w-fit! items-center! justify-center! py-2!",check:!1,value:_,children:h.jsx("svg",{width:re.width/2,viewBox:re.viewBox,fill:"none",className:"scale-[0.8] -scale-x-100",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:re.path,strokeWidth:re.strokeWidth,strokeLinecap:re.strokeLinecap,fill:re.fill,stroke:re.stroke})})},`${_}-${G}-start`)})})]}),h.jsx("div",{className:vd}),h.jsxs(Pa,{open:w==="line-end-cap",onOpenChange:_=>{_?g("line-end-cap"):w==="line-end-cap"&&g(null)},value:T||"",onValueChange:_=>{g(null),p(B.map(G=>G.id),_)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(Ra,{children:h.jsx(as,{placeholder:"End cap"})})}),h.jsx(Rr,{children:h.jsx("p",{children:"Line end cap"})})]}),h.jsx(Ua,{position:"popper",children:Jw.map((_,G)=>{const re=eC[G];return h.jsx(qr,{className:"flex w-fit! items-center! justify-center! py-2!",check:!1,value:_,children:h.jsx("svg",{width:re.width/2,viewBox:re.viewBox,fill:"none",className:"scale-[0.8]",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:re.path,strokeWidth:re.strokeWidth,strokeLinecap:re.strokeLinecap,fill:re.fill,stroke:re.stroke})})},`${_}-${G}-end`)})})]})]})},se=()=>h.jsxs(Pa,{open:w==="line-stroke-width",onOpenChange:J=>{J?g("line-stroke-width"):w==="line-stroke-width"&&g(null)},value:String(q),onValueChange:J=>{g(null),c(B.map(T=>T.id),Number(J))},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:$y,style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:i.selectionBar.strokeWidth})}),h.jsx("span",{className:md,children:wd(l0,Math.max(0,JA.findIndex(J=>J===q)))})]})}),h.jsx(Rr,{children:h.jsx("p",{children:i.selectionBar.strokeWidth})})]}),h.jsx(Ua,{position:"popper",children:JA.map((J,T)=>h.jsx(qr,{check:!1,value:String(J),className:Zy,children:h.jsx("span",{className:md,children:wd(l0,T)})},J))})]});return r.length>1?b.length===r.length?ne():h.jsx(h.Fragment,{}):b.length>0?ne():B.length>0?h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[Z(),se(),h.jsx("div",{className:vd}),W()]}):n==="draw"||n==="marker"||n==="quill"?ne():h.jsx(h.Fragment,{})},uae="flex h-[var(--size)] items-center overflow-hidden rounded-lg border border-(--panel-border) [--size:32px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[18px] [&_svg]:size-3! [&_svg_*]:stroke-2",eb="flex size-[var(--size)] cursor-pointer items-center justify-center border-none bg-[rgba(var(--background-rgb),0.5)] text-[rgba(var(--text-rgb))] hover:brightness-125",cae="h-full w-[150px] border-x border-y-0 border-(--panel-border) bg-[rgba(var(--background-rgb),0.5)] pl-3 text-xs text-[rgba(var(--text-rgb))] font-[Inter,sans-serif] [appearance:textfield] [&::-webkit-inner-spin-button]:[-webkit-appearance:none] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:[-webkit-appearance:none] [&::-webkit-outer-spin-button]:m-0";function fae({className:t,type:e,value:r,onValueChange:n,...i}){const[a,s]=M.useState(typeof r=="number"&&Number.isFinite(r)?r:10);M.useEffect(()=>{typeof r=="number"&&Number.isFinite(r)&&s(r)},[r]);const o=A=>{Number.isFinite(A)&&(s(A),n(A))};return h.jsxs("div",{className:uae,children:[h.jsx("button",{className:eb,onClick:()=>{o((Number.isFinite(a)?a:10)-1)},children:h.jsx(sT,{})}),h.jsx("input",{type:e,"data-slot":"input",className:cae+(t?" "+t:""),...i,value:a,onChange:A=>{const l=Number.parseInt(A.target.value,10);Number.isFinite(l)&&o(l)}}),h.jsx("button",{className:eb,onClick:()=>{o((Number.isFinite(a)?a:10)+1)},children:h.jsx(oT,{})})]})}const Cd="inline-flex h-(--selectiontoolbar-height) items-center justify-between gap-0 rounded-none border-none bg-transparent px-2.5 text-sm font-medium text-[color:var(--popover-dark-text,#f3f4f6)] shadow-none outline-none transition-colors duration-150 hover:bg-[rgba(255,255,255,0.05)] [&>svg:last-child]:size-[14px] [&>svg:last-child]:ml-2 [&>svg:last-child]:pointer-events-none [&>svg:last-child]:text-[color:var(--popover-dark-text,#b8b8b8)]",tb="w-fit! min-w-fit! [&_*]:flex-row!",rb="float-left w-fit shrink-0 cursor-pointer rounded-full bg-transparent p-[4px_1px]! transition-all duration-[0.1s] hover:scale-105",yd="my-auto ml-[5px] mr-1 h-5 w-px bg-[rgba(var(--darkborder-rgb,255,255,255),1)] opacity-20",v1="flex items-center justify-between gap-0.5",Gp="float-left w-fit p-2! pb-[5px]! transition-all duration-[0.1s]",$p="flex h-(--selectiontoolbar-height) w-(--selectiontoolbar-height) items-center justify-center border-none p-0 text-[color:var(--popover-dark-text,white)] bg-transparent transition-colors duration-150 hover:bg-[rgba(var(--darkborder-rgb,255,255,255),0.05)] data-[active=true]:bg-[rgba(var(--accent-rgb),0.4)]",hae="[box-shadow:none]! [transform:translateY(92px)_translateX(18px)]!",EM=({scene:t,selectedIds:e,localeMessages:r,editor:n,editingText:i,setEditingText:a,worldToScreen:s,toggleEditorMark:o,onTextCommit:A,onTextFontFamilyChange:l,onTextFontSizeChange:u,onTextFontWeightChange:c,onTextFontStyleChange:d,onTextAlignChange:f,onTextColorChange:v,shapeColors:p,customDrawColorPickerWrapRef:C,customDrawColorPickerContentRef:w,customDrawColorPickerColor:g,setCustomDrawColorPickerColor:b,activeSelectId:B,setActiveSelectId:E})=>{const F=Cm(t.elements,e),O=zi(F,be=>be.textAlign),I=pz(O),k=zi(F,be=>be.fontFamily),j=zi(F,be=>be.fontSize),D=typeof j=="number"&&Number.isFinite(j),L=zi(F,be=>be.fontWeight),P=zi(F,be=>be.fontStyle),R=zi(F,be=>be.color)??"multi",q=R==="multi"?F[0]?.color??t.settings.shapeDefaults.textColor:R,te=[...p[0],...p[1]],ne=te.some(be=>be!=="multi"&&be.toLowerCase()===q.toLowerCase())?q:"multi",Z=te.some(be=>be!=="multi"&&be.toLowerCase()===q.toLowerCase()),W=H.useRef(!1),[se,J]=H.useState(!1),T=L==="bold"||L==="700"||L==="800"||L==="900",_=P==="italic",G=(()=>{if(!i)return null;try{return z.marks(n)??null}catch{return null}})(),re=i&&(i.style.fontWeight==="bold"||i.style.fontWeight==="700"||i.style.fontWeight==="800"||i.style.fontWeight==="900"),he=i?.style.fontStyle==="italic",Ae=G?.bold===!0||G?.bold!==!1&&re,Ee=G?.italic===!0||G?.italic!==!1&&he,ee=be=>Mf(be.text).every(at=>at.children.every(Me=>Me.strikethrough===!0)),ue=F.length>0&&F.every(be=>ee(be)),de=i?Ae:T,Ce=i?Ee:_,pe=i?G?.strikethrough===!0:ue,Oe=()=>{const be=!ue;for(const Le of F){const Me=Mf(Le.text).map(it=>({...it,children:it.children.map(mt=>({...mt,strikethrough:be}))}));A(Le.id,w0(Me))}},X=()=>{i&&requestAnimationFrame(()=>{try{bt.focus(n)}catch{return}})},We=be=>{J(!0),E("text-color"),b(r7(be))},ft=be=>{const Le=F.map(at=>at.id);v(Le,be),i&&Le.includes(i.id)&&a(at=>at&&{...at,style:{...at.style,color:be}}),X()};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[h.jsx("div",{ref:C,style:{position:"relative",display:"inline-flex"},children:h.jsxs(Pa,{open:B==="text-color",onOpenChange:be=>{if(be){J(!1),E("text-color");return}if(W.current){W.current=!1;return}se&&J(!1),E(null)},value:String(ne),onValueChange:be=>{if(be==="multi"){We(q);return}E(null),ft(be)},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,onPointerDown:be=>{ne==="multi"&&(be.preventDefault(),be.stopPropagation(),We(q))},style:{gap:"0px",width:"fit-content"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:r.selectionBar.textColor})}),h.jsx("div",{style:{width:"20px",borderRadius:"100%",border:"1px solid #ffffff20",height:"20px",background:q}})]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textColor})})]}),h.jsxs(Ua,{position:"popper",className:tb,children:[h.jsx("div",{children:h.jsx(ko,{colors:p[0],currentColor:q,uniColor:be=>be,renderItem:({color:be,isMulti:Le,swatch:at})=>h.jsx(qr,{value:be,className:rb,check:!1,onPointerDown:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,onSelect:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,children:at},be)})}),h.jsx("div",{children:h.jsx(ko,{colors:p[1],realTotalColors:te,currentColor:q,uniColor:be=>be,renderItem:({color:be,isMulti:Le,swatch:at})=>h.jsx(qr,{value:be,className:rb,check:!1,onPointerDown:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,onSelect:Le?Me=>{Me.preventDefault(),Me.stopPropagation(),W.current=!0,We(q)}:void 0,children:at},be)})})]})]})}),h.jsxs(Nr,{open:B==="text-color"&&(se||!Z),children:[h.jsx(Pr,{asChild:!0,children:h.jsx("div",{className:yd})}),h.jsx(Rr,{className:hae,side:"bottom",style:{background:"transparent"},children:h.jsx("div",{ref:w,onPointerDown:be=>be.stopPropagation(),children:h.jsx(gu,{color:g,onChange:be=>{const Le=be.hexa||be.hex;Le&&(b(Le),ft(Le))}})})})]}),h.jsxs(Pa,{open:B==="text-font-family",onOpenChange:be=>{be?E("text-font-family"):B==="text-font-family"&&E(null)},value:k,onValueChange:be=>{E(null),l(F.map(Le=>Le.id),be),X()},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,style:{gap:"0px"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:r.selectionBar.fontFamily})}),k==="Shantell Sans"?h.jsx(rY,{}):k==="Cascadia Code"?h.jsx(eY,{}):k==="Imbue"?h.jsx(tY,{}):h.jsx(ZX,{})]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.fontFamily})})]}),h.jsxs(Ua,{position:"popper",children:[h.jsx(qr,{check:!1,value:"Rubik",children:r.fontFamilies.simple}),h.jsx(qr,{check:!1,value:"Shantell Sans",children:r.fontFamilies.handwritten}),h.jsx(qr,{check:!1,value:"Imbue",children:r.fontFamilies.elegant}),h.jsx(qr,{check:!1,value:"Cascadia Code",children:r.fontFamilies.technical})]})]}),h.jsx("div",{className:yd}),h.jsxs(Pa,{open:B==="text-font-size",onOpenChange:be=>{be?E("text-font-size"):B==="text-font-size"&&E(null)},value:D?String(j):void 0,onValueChange:be=>{E(null);const Le=Number.parseInt(be,10);Number.isFinite(Le)&&(u(F.map(at=>at.id),Le),X())},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,style:{gap:"0px"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:""})}),D?j:"-"]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.fontSize})})]}),h.jsxs(Ua,{position:"popper",children:[h.jsxs(qr,{check:!1,className:v1,value:"16",children:[r.fontSizes.small,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"16"})]}),h.jsxs(qr,{check:!1,className:v1,value:"24",children:[r.fontSizes.medium,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"24"})]}),h.jsxs(qr,{check:!1,className:v1,value:"40",children:[r.fontSizes.large,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"40"})]}),h.jsxs(qr,{check:!1,className:v1,value:"64",children:[r.fontSizes.extraLarge,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"64"})]}),h.jsxs(qr,{check:!1,className:v1,value:"96",children:[r.fontSizes.huge,h.jsx("span",{style:{opacity:.5,marginLeft:"auto",display:"flex"},children:"96"})]}),h.jsx(gJ,{}),h.jsx(fae,{value:j,onValueChange:be=>{Number.isFinite(be)&&(u(F.map(Le=>Le.id),be),X())},placeholder:r.fontSizes.placeholder,type:"number"})]})]}),h.jsx("div",{className:yd}),h.jsxs("div",{className:"flex",children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",onPointerDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>{if(i){o("bold"),bt.focus(n);return}c(F.map(be=>be.id),de?"200":"700")},className:$p,"data-active":de?"true":void 0,children:h.jsx(H$,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.bold})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",onPointerDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>{if(i){o("italic"),bt.focus(n);return}d(F.map(be=>be.id),Ce?"normal":"italic")},className:$p,"data-active":Ce?"true":void 0,children:h.jsx(sX,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.italic})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",onPointerDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>{if(i){o("strikethrough"),bt.focus(n);return}Oe()},className:$p,"data-active":pe?"true":void 0,children:h.jsx(EX,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.strikethrough||"Strikethrough (Ctrl+S)"})})]}),h.jsx("div",{className:yd}),h.jsxs(Pa,{open:B==="text-align",onOpenChange:be=>{be?E("text-align"):B==="text-align"&&E(null)},value:I,onValueChange:be=>{E(null);const Le=be==="center"?"center":be==="end"?"end":"left",at=F.map(it=>it.id);if(f(at,Le),!i||!at.includes(i.id)){X();return}const Me=t.elements.find(it=>it.id===i.id);a(it=>{if(!it)return it;const mt=Me&&(Me.type==="rectangle"||Me.type==="circle")?$1(Me,Le):it.anchorX,ze=qA(mt,it.width,Le),lt=s(ze,it.anchorY);return{...it,anchorX:mt,left:lt.x,style:{...it.style,textAlign:Le}}}),X()},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsxs(Ra,{className:Cd,style:{gap:"0px"},children:[h.jsx("span",{style:{width:"0px",overflow:"hidden"},children:h.jsx(as,{placeholder:""})}),I==="left"?h.jsx(TC,{}):I==="center"?h.jsx(OC,{}):h.jsx(MC,{})]})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlign})})]}),h.jsxs(Ua,{position:"popper",className:tb,children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(qr,{check:!1,className:Gp,value:"left",children:h.jsx(TC,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlignDirection.left})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(qr,{check:!1,className:Gp,value:"center",children:h.jsx(OC,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlignDirection.center})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(qr,{check:!1,className:Gp,value:"end",children:h.jsx(MC,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:r.selectionBar.textAlignDirection.right})})]})]})]})]})]})},SM=({left:t,top:e,toolbarKey:r,viewportWidth:n,children:i})=>{const a=H.useRef(null),[s,o]=H.useState(0);H.useEffect(()=>{const l=a.current;if(!l)return;const u=new ResizeObserver(c=>{const d=c[0]?.contentRect.width??l.offsetWidth;o(d)});return u.observe(l),o(l.offsetWidth),()=>{u.disconnect()}},[r]);const A=H.useMemo(()=>{const l=s/2,u=8,c=l+u,d=Math.max(c,n-l-u);return Math.min(Math.max(t,c),d)},[t,s,n]);return h.jsx("div",{ref:a,"data-selection-toolbar":"",className:"pointer-events-auto absolute z-20 flex h-[43px] -translate-x-1/2 -translate-y-2 animate-[selection-toolbar-in_180ms_ease-out] overflow-hidden rounded-xl border border-(--panel-border) bg-(--popover-dark) text-[13px] font-semibold tracking-[0.02em] text-white shadow-[var(--panel-shadow)] backdrop-blur-[24px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] dark:bg-(--popover-dark) dark:shadow-[var(--panel-shadow)] dark:backdrop-blur-[24px] [.drawo-presentation-mode_&]:hidden",onPointerDown:l=>{l.stopPropagation()},onMouseDown:l=>{l.stopPropagation()},style:{left:A,top:e},children:i},r)},FM=({editorWrapRef:t,editor:e,editingText:r,editingDocument:n,editorSessionKey:i,cameraZoom:a,setEditingDocument:s,setEditingText:o,toThemeColor:A,getTextLineHeight:l,onEditorChange:u,onCommitEditingText:c,onToggleEditorMark:d})=>{const f=w=>w instanceof HTMLElement?!!(w.closest("[data-selection-toolbar]")||w.closest(".select-content")||w.closest('[data-slot="select-content"]')||w.closest('[data-slot="select-trigger"]')):!1,v=()=>{requestAnimationFrame(()=>{const w=document.activeElement;t.current?.contains(w)||f(w)||c()})},p=w=>{if((w.ctrlKey||w.metaKey)&&w.key==="Enter"){w.preventDefault(),c();return}if((w.ctrlKey||w.metaKey)&&w.key.toLowerCase()==="b"){w.preventDefault(),d("bold");return}if((w.ctrlKey||w.metaKey)&&w.key.toLowerCase()==="i"){w.preventDefault(),d("italic");return}if((w.ctrlKey||w.metaKey)&&w.key.toLowerCase()==="s"){w.preventDefault(),d("strikethrough");return}w.key==="Escape"&&(s(null),o(null))},C=H.useCallback(({attributes:w,children:g,leaf:b})=>{const B=b;return h.jsx("span",{...w,style:{fontWeight:B.bold===!0?700:B.bold===!1?400:void 0,fontStyle:B.italic===!0?"italic":B.italic===!1?"normal":void 0,textDecorationLine:B.strikethrough===!0?"line-through":"none",textDecorationColor:B.strikethrough===!0?"currentColor":void 0,textDecorationThickness:B.strikethrough===!0?"0.05em":void 0},children:g})},[]);return r?h.jsx("div",{ref:t,style:{position:"absolute",left:r.left,top:r.top,width:r.width,height:r.height,maxWidth:r.maxWidth,margin:0,padding:0,border:"none",outline:"none",cursor:"var(--drawo-cursor-text), auto",background:"transparent",boxShadow:"none",color:A(r.style.color),fontFamily:r.style.fontFamily,fontSize:r.style.fontSize*a,fontWeight:r.style.fontWeight,fontStyle:r.style.fontStyle,textAlign:r.style.textAlign,lineHeight:`${l(r.style.fontSize)*a}px`},children:h.jsx(gie,{editor:e,initialValue:n??Mf(r.value),onChange:u,children:h.jsx(lie,{className:"[&::selection]:bg-[rgba(59,130,246,0.34)] [&::selection]:text-inherit [&::selection]:[-webkit-text-fill-color:currentColor] [&_*::selection]:bg-[rgba(59,130,246,0.34)] dark:[&::selection]:bg-[rgba(148,189,255,0.32)] dark:[&_*::selection]:bg-[rgba(148,189,255,0.32)]",renderLeaf:C,onBlur:v,onKeyDown:p,spellCheck:!1,style:{width:"100%",height:"100%",minHeight:`${r.style.fontSize*a}px`,outline:"none",whiteSpace:"pre",wordBreak:"normal",background:"transparent",color:"inherit",WebkitTextFillColor:"currentColor",caretColor:"currentColor"}})},`${r.id}-${i}`)}):null},dae=(t,e)=>{const r=Zf(1-t/e);return Math.pow(r,1.3)},Pl=(t,e)=>{const r=$2(t);return r?`rgba(${r.r}, ${r.g}, ${r.b}, ${Zf(r.a*e)})`:t},pae=typeof navigator<"u"&&/firefox/i.test(navigator.userAgent),gae=(t,e,r)=>{const i=[];let a=0,s=0;for(let o=0;o<t.length-1;o++){const A=t[o===0?0:o-1],l=t[o],u=t[o+1],c=t[o+2]||t[o+1];for(let d=0;d<=1;d+=1/3){const f=d*d,v=f*d,p=(u.x-A.x)*.5,C=(c.x-l.x)*.5,w=l.x+p*d+(3*(u.x-l.x)-2*p-C)*f+(2*(l.x-u.x)+p+C)*v,g=(u.y-A.y)*.5,b=(c.y-l.y)*.5,B=l.y+g*d+(3*(u.y-l.y)-2*g-b)*f+(2*(l.y-u.y)+g+b)*v,E=l.t+(u.t-l.t)*d,F=dae(e-E,r.lifetime),O=Math.max(r.minWidth,r.baseWidth*F);if(O<=r.minWidth+.01)continue;const I=i[i.length-1];I&&I.x===w&&I.y===B||(i.push({x:w,y:B,widthPx:O}),a+=O,s=Math.max(s,O))}}return{samples:i,maxWidthPx:s,avgWidthPx:i.length>0?a/i.length:r.minWidth}},vae=t=>{const e=new Path2D;e.moveTo(t[0].x,t[0].y);for(let r=1;r<t.length;r++){const n=t[r];e.lineTo(n.x,n.y)}return e},bd=(t,e,r,n)=>{t.strokeStyle=n.strokeColor,t.lineWidth=n.widthPx/r.zoom,t.shadowColor=n.shadowColor,t.shadowBlur=n.shadowBlurPx/r.zoom,t.shadowOffsetX=0,t.shadowOffsetY=0,t.stroke(e)},mae=(t,e,r,n,i)=>{t.shadowBlur=0,t.shadowColor="rgba(0, 0, 0, 0)",t.shadowOffsetX=0,t.shadowOffsetY=0,t.strokeStyle=n,t.lineWidth=i/r.zoom,t.stroke(e)},wae=(t,e,r,n,i)=>{if(e.length<2)return;const{samples:a,maxWidthPx:s,avgWidthPx:o}=gae(e,r,i);if(a.length<2)return;const A=vae(a);if(t.lineJoin="round",t.lineCap="round",i.shadow){const l=Math.max(i.minWidth,o),u=document.querySelector("html")?.classList.contains("dark");pae?bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:Pl(i.color,1),widthPx:l,shadowBlurPx:Math.max(18,s*2.5)}):(bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:Pl(i.color,.75),widthPx:l,shadowBlurPx:Math.max(60,s*7)}),bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:Pl(i.color,.9),widthPx:l,shadowBlurPx:Math.max(30,s*3.5)}),bd(t,A,n,{strokeColor:Pl(i.color,1),shadowColor:u?"rgba(0,0,0,0.55)":"rgba(255, 255, 255, 0.55)",widthPx:l,shadowBlurPx:Math.max(12,s*1.2)}))}mae(t,A,n,i.color,Math.max(i.minWidth,o))},Cae=()=>`laser-${Ci("draw")}`,yae=600,a2=(t,e)=>t.map(r=>({...r,points:r.points.filter(n=>e-n.t<=yae)})).filter(r=>r.points.length>0),bae=(t,e,r,n)=>a2(e?t.map(i=>{if(i.id!==e)return i;const a=i.points[i.points.length-1],s=.3/n;return a&&Math.hypot(r.x-a.x,r.y-a.y)<s?i:{...i,points:[...i.points,r]}}):t,r.t),Bae=()=>{const[t,e]=H.useState([]),[r,n]=H.useState(()=>performance.now()),i=H.useRef(null),a=H.useCallback(A=>{const l=performance.now(),u=Cae();n(l),e(c=>[...a2(c,l),{id:u,points:[{x:A.x,y:A.y,t:l}]}]),i.current=u},[]),s=H.useCallback((A,l)=>{const u=performance.now();n(u),e(c=>bae(c,i.current,{x:A.x,y:A.y,t:u},l))},[]),o=H.useCallback(()=>{i.current=null},[]);return H.useEffect(()=>{if(t.length===0)return;let A=0;const l=()=>{const u=performance.now();n(u),e(c=>a2(c,u)),A=window.requestAnimationFrame(l)};return A=window.requestAnimationFrame(l),()=>{window.cancelAnimationFrame(A)}},[t.length]),{laserTrails:t,laserNow:r,startLaserTrail:a,appendLaserPoint:s,clearActiveLaserTrail:o}},xae="z-50 min-w-48 rounded-xl border border-(--panel-border) bg-[var(--panel-bg,#fff)] p-1 text-[rgb(var(--text-rgb))] shadow-[var(--panel-shadow)] backdrop-blur-[24px] font-[Inter] [transform-origin:var(--radix-context-menu-content-transform-origin)] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] dark:bg-[var(--popover-dark,#1f1f1f)]!",Eae="z-50 min-w-48 rounded-xl border border-(--panel-border) bg-[var(--panel-bg,#fff)] p-1 text-[rgb(var(--text-rgb))] shadow-[var(--panel-shadow)] font-[Inter] [transform-origin:var(--radix-context-menu-content-transform-origin)] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] dark:backdrop-blur-[24px] dark:bg-[var(--popover-dark,#1f1f1f)]!",DM="flex cursor-pointer select-none items-center gap-1.5 rounded-xl px-3 py-2 text-base outline-none [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[24px] not-data-[disabled=true]:focus:bg-[rgba(var(--text-rgb),0.1)] not-data-[disabled=true]:data-[highlighted]:bg-[rgba(var(--text-rgb),0.1)] data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",Sae="data-[variant=accent]:text-[rgb(var(--accent-rgb))]! data-[variant=accent]:[filter:brightness(0.5)] data-[variant=accent]:hover:bg-[rgba(var(--accent-rgb),0.179)]! data-[variant=destructive]:text-[rgb(255,4,4)]! data-[variant=destructive]:hover:bg-[rgba(255,0,0,0.179)]! dark:data-[variant=destructive]:text-[rgb(255,126,126)]! dark:data-[variant=destructive]:hover:bg-[rgba(255,126,126,0.1)]!",Fae="ml-auto scale-90 stroke-[1.4]",Dae="my-[3px] mx-2 h-px bg-[rgba(var(--text-rgb),0.1)]";function Lae(t){return h.jsx(GH,{"data-slot":"context-menu",...t})}function Iae({className:t,...e}){return h.jsx($H,{"data-slot":"context-menu-trigger",className:"select-none"+(t?" "+t:""),...e})}function nb(t){return h.jsx(eK,{"data-slot":"context-menu-sub",...t})}function kae({className:t,...e}){return h.jsx(XH,{children:h.jsx(YH,{"data-slot":"context-menu-content",className:xae+" max-h-[var(--radix-context-menu-content-available-height)]"+(t?" "+t:""),...e})})}function Ta({className:t,inset:e,disabled:r=!1,variant:n="default",...i}){return h.jsx(ZH,{"data-slot":"context-menu-item","data-inset":e,"data-disabled":r,"data-variant":n,className:DM+" "+Sae+(t?" "+t:""),...i})}function ib({className:t,inset:e,children:r,...n}){return h.jsxs(tK,{"data-slot":"context-menu-sub-trigger","data-inset":e,className:DM+(t?" "+t:""),...n,children:[r,h.jsx(I$,{className:Fae})]})}function ab({className:t,...e}){return h.jsx(rK,{"data-slot":"context-menu-sub-content",className:Eae+(t?" "+t:""),...e})}function Xp({className:t,...e}){return h.jsx(JH,{"data-slot":"context-menu-separator",className:Dae+(t?" "+t:""),...e})}const wo="ml-auto flex items-center gap-0.5 pl-6 text-xs opacity-70 [.drawo-zen-mode_&]:hidden [&>span]:rounded-[5px] [&>span]:bg-[rgba(var(--text-rgb),0.1)] [&>span]:px-1 [&>span]:py-0.5 [&>span]:font-medium [&>span]:text-[rgba(var(--text-rgb),0.6)] [&>span]:[corner-shape:squircle] [&>span]:supports-[corner-shape:squircle]:rounded-[12px]",LM=({children:t,hasSelection:e,canFlipSelection:r,selectionType:n,selectionOpacity:i,hasElements:a,localeMessages:s,canUngroupSelection:o,onCut:A,onCopy:l,onPaste:u,onDuplicate:c,onDelete:d,onGroup:f,onUngroup:v,onSelectAll:p,onMoveForward:C,onBringToFront:w,onSendToBack:g,onMoveBackward:b,onFlipHorizontal:B,onFlipVertical:E,onSelectionOpacityChange:F})=>{const O=e&&n==="multiple",I=H.useMemo(()=>typeof i!="number"||!Number.isFinite(i)?100:Math.max(0,Math.min(100,Math.round(i))),[i]),[k,j]=H.useState(I),[D,L]=H.useState(String(I));H.useEffect(()=>{j(I),L(String(I))},[I,e]);const P=R=>{const q=Math.max(0,Math.min(100,Math.round(R)));j(q),L(String(q)),F(q)};return h.jsxs(Lae,{children:[h.jsx(Iae,{children:t}),h.jsxs(kae,{children:[e&&h.jsxs(h.Fragment,{children:[h.jsxs(Ta,{onClick:A,children:[h.jsx(yX,{}),s.contextMenu.cut,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"X"})]})]}),h.jsxs(Ta,{onClick:l,children:[h.jsx(G$,{}),s.contextMenu.copy,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"C"})]})]})]}),h.jsxs(Ta,{onClick:u,children:[h.jsx(xX,{}),s.contextMenu.paste,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"V"})]})]}),e&&h.jsxs(h.Fragment,{children:[h.jsxs(Ta,{onClick:c,children:[h.jsx($$,{}),s.contextMenu.duplicate,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()}),"+",h.jsx("span",{children:"D"})]})]}),h.jsxs(Ta,{onClick:d,variant:"destructive",children:[h.jsx(IX,{}),s.contextMenu.delete,h.jsx("span",{className:wo,children:h.jsx("span",{children:"Del"})})]})]}),(O||o||e)&&h.jsx(Xp,{}),(O||o)&&h.jsxs(h.Fragment,{children:[O&&h.jsxs(Ta,{onClick:f,children:[h.jsx(cT,{}),s.contextMenu.group,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()}),"+",h.jsx("span",{children:"G"})]})]}),o&&h.jsxs(Ta,{onClick:v,children:[h.jsx(z$,{}),s.contextMenu.ungroup,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()}),"+",h.jsx("span",{children:Bp()}),"+",h.jsx("span",{children:"G"})]})]})]}),e&&h.jsxs(h.Fragment,{children:[h.jsxs(nb,{children:[h.jsxs(ib,{children:[h.jsx(oX,{}),s.contextMenu.layers.text]}),h.jsxs(ab,{children:[h.jsxs(Ta,{onClick:w,children:[h.jsx(gY,{}),s.contextMenu.layers.bringToFront]}),h.jsxs(Ta,{onClick:C,children:[h.jsx(vY,{}),s.contextMenu.layers.bringForward]}),h.jsxs(Ta,{onClick:g,children:[h.jsx(dY,{}),s.contextMenu.layers.sendToBack]}),h.jsxs(Ta,{onClick:b,children:[h.jsx(pY,{}),s.contextMenu.layers.sendBackward]})]})]}),h.jsxs(nb,{children:[h.jsxs(ib,{children:[h.jsx(eX,{}),s.selectionBar.opacity,"..."]}),h.jsx(ab,{className:"min-w-[230px] p-1.5",children:h.jsxs("div",{className:"flex flex-col gap-2.5 rounded-[10px] p-1.5 [corner-shape:squircle]",onPointerDown:R=>R.stopPropagation(),onClick:R=>R.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between gap-2 text-[15px]",children:[h.jsx("span",{children:s.selectionBar.opacity}),h.jsxs("div",{className:"inline-flex items-center gap-1",children:[h.jsx("input",{className:"h-4 w-[54px] min-w-[54px] rounded-lg border border-(--panel-border) bg-[rgba(var(--text-rgb),0.1)] px-2 py-1 text-xs text-right [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[16px] transition-[border-color,box-shadow,background] duration-[120ms] [appearance:textfield] [&::-webkit-inner-spin-button]:[-webkit-appearance:none] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:[-webkit-appearance:none] [&::-webkit-outer-spin-button]:m-0",type:"number",min:0,max:100,step:1,value:D,onChange:R=>{const q=R.target.value.replace(/[^0-9]/g,"");L(q)},onBlur:()=>{const R=Number.parseInt(D,10);P(Number.isFinite(R)?R:k)},onKeyDown:R=>{if(R.key==="Enter"){const q=Number.parseInt(D,10);P(Number.isFinite(q)?q:k),R.currentTarget.blur();return}R.key==="Escape"&&(L(String(k)),R.currentTarget.blur())}}),h.jsx("span",{className:"text-xs opacity-65",children:"%"})]})]}),h.jsx(rc,{className:"drawo-contextmenu-opacity-slider",value:[k],min:0,max:100,step:1,onValueChange:R=>{const q=R[0]??k;j(q),L(String(Math.round(q)))},onValueCommit:R=>{P(R[0]??k)}})]})})]}),h.jsx(Xp,{}),h.jsxs(Ta,{disabled:!r,onClick:B,children:[h.jsx(LX,{}),"Voltear horizontalmente",h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Bp()}),"+",h.jsx("span",{children:"H"})]})]}),h.jsxs(Ta,{disabled:!r,onClick:E,children:[h.jsx(DX,{}),"Voltear verticalmente",h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Bp()}),"+",h.jsx("span",{children:"V"})]})]})]}),h.jsx(Xp,{}),h.jsxs(Ta,{disabled:!a,onClick:p,children:[h.jsx(Y$,{}),s.contextMenu.selectEverything,h.jsxs("span",{className:wo,children:[h.jsx("span",{children:Ml()})," + ",h.jsx("span",{children:"A"})]})]})]})]})},m1=()=>performance.now(),Oae=220,Tae=4,Mae=4,sb=t=>t.type!=="text",Nae=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,ob=(t,e,r)=>t+(e-t)*r,Ab=(t,e,r,n,i)=>{const a=6/n;t.save(),t.strokeStyle=i,t.lineWidth=1/n,t.lineCap="round",t.setLineDash([]),t.beginPath(),t.moveTo(e-a/2,r-a/2),t.lineTo(e+a/2,r+a/2),t.moveTo(e+a/2,r-a/2),t.lineTo(e-a/2,r+a/2),t.stroke(),t.restore()},Pae=(t,e,r,n)=>{if(e.length!==0){t.save(),t.strokeStyle=n,t.fillStyle=n,t.lineWidth=1/r,t.setLineDash([6/r,4/r]);for(const i of e)t.beginPath(),i.kind==="spacing"&&i.segmentStart&&i.segmentEnd?(t.moveTo(i.segmentStart.x,i.segmentStart.y),t.lineTo(i.segmentEnd.x,i.segmentEnd.y)):i.axis==="x"?(t.moveTo(i.value,i.start),t.lineTo(i.value,i.end)):(t.moveTo(i.start,i.value),t.lineTo(i.end,i.value)),t.stroke(),Ab(t,i.movingPoint.x,i.movingPoint.y,r,n),Ab(t,i.targetPoint.x,i.targetPoint.y,r,n);t.restore()}},ym=(t,e,r)=>{if(e.type==="circle"){t.beginPath(),t.ellipse(e.x+e.width/2,e.y+e.height/2,e.width/2,e.height/2,0,0,Math.PI*2);return}ns(t,e.x,e.y,e.width,e.height,r)},Rae=(t,e,r,n)=>{if(e.fillStyle==="none")return;const i=n(e.fill);if(t.save(),e.fillStyle==="solid"){t.fillStyle=i,ym(t,e,r),t.fill(),t.restore();return}const a=8,s=Math.max(1,e.strokeWidth),o=Math.hypot(e.width,e.height)+Math.max(e.width,e.height)*2;ym(t,e,r),t.clip(),t.strokeStyle=i,t.lineWidth=s,t.lineCap="round",t.lineJoin="round";for(let A=e.x-o;A<=e.x+e.width+o;A+=a)t.beginPath(),t.moveTo(A,e.y+e.height+o),t.lineTo(A+o,e.y-o),t.stroke();t.restore()},Uae=(t,e,r,n)=>{e.strokeStyle!=="none"&&(t.save(),t.strokeStyle=n(e.stroke),t.lineCap="round",t.lineJoin="round",t.lineWidth=Math.max(1,e.strokeWidth),e.strokeStyle==="dashed"?t.setLineDash([8,4]):t.setLineDash([]),ym(t,e,r),t.stroke(),t.restore())},IM=({scene:t,showDefaultEmptyState:e=!0,shapeColors:r,strokeColors:n,alignmentGuides:i,interactionMode:a,drawingTool:s,localeMessages:o,onPointerDown:A,onPointerMove:l,onPointerUp:u,onWheelPan:c,onWheelZoom:d,onCreateElement:f,onCreateDrawElement:v,onCreateLinePathElement:p,onDrawingToolComplete:C,onDropImageFiles:w,onSelectElements:g,onCopySelection:b,onCutSelection:B,onPasteAt:E,onDuplicateSelection:F,onDeleteSelection:O,onGroupSelection:I,onUngroupSelection:k,onSelectGroupForElement:j,onReorderSelection:D,onFlipSelection:L,onTextFontFamilyChange:P,onTextFontSizeChange:R,onTextFontWeightChange:q,onTextFontStyleChange:te,onTextAlignChange:ne,onTextColorChange:Z,onDrawStrokeWidthChange:W,onDrawStrokeColorChange:se,onShapeFillColorChange:J,onShapeFillStyleChange:T,onElementsOpacityChange:_,onShapeStrokeColorChange:G,onShapeStrokeWidthChange:re,onShapeStrokeStyleChange:he,onDrawDefaultStrokeColorChange:Ae,onLineStartCapChange:Ee,onLineEndCapChange:ee,onLineEditStart:ue,onLineGeometryChange:de,onRectangleBorderRadiusChange:Ce,onGroupResizeStart:pe,onGroupRotateStart:Oe,onResizeStart:X,onRotateStart:We,onTextCommit:ft})=>{const be=H.useRef(null),Le=H.useRef(null),at=H.useRef(null),[Me,it]=H.useState(null),[mt,ze]=H.useState(null),[lt,le]=H.useState(0),ge=H.useMemo(()=>Cie(vie(Rte())),[lt]),ve=H.useRef(new Map),Re=H.useRef(null),[Ke,Se]=H.useState(()=>({width:window.innerWidth,height:window.innerHeight})),[Ge,Be]=H.useState("default"),[qe,Je]=H.useState(null),[Pt,wt]=H.useState(null),[Xt,dt]=H.useState(null),[Bt,Et]=H.useState(!1),[Ct,ut]=H.useState(!1),[Yt,Kr]=H.useState(null),[or,nr]=H.useState([]),[Fr,yt]=H.useState(null),[Ft,sn]=H.useState(null),[zr,$r]=H.useState(null),Mt=H.useRef(!1),[,tr]=H.useState(0),[Gt,on]=H.useState(null),{laserTrails:Jt,laserNow:lr,startLaserTrail:Er,appendLaserPoint:Tr,clearActiveLaserTrail:Jr}=Bae(),hn=H.useRef(null),zn=H.useRef(null),[Ln,Ot]=H.useState(!1),[we,st]=H.useState(!1),[It,Mr]=H.useState(t.settings.drawDefaults.drawStroke),[Vr,_r]=H.useState(null),[wn,Qr]=H.useState(null),[ri,ni]=H.useState(null),[dn,Li]=H.useState(null),[$e,St]=H.useState(null),[Dt,ur]=H.useState(null),[dr,_t]=H.useState(null),$t=U=>{if(!U)return null;const Q=ve.current.get(U);if(Q)return Q;const Ve=new window.Image;Ve.decoding="async",Ve.onload=()=>{tr(ke=>ke+1)},Ve.onerror=()=>{tr(ke=>ke+1)};const Pe=Re.current;return Pe&&(Ve.style.cssText="position:absolute;width:1px;height:1px;",Pe.appendChild(Ve)),Ve.src=U,ve.current.set(U,Ve),Ve},Sr=H.useRef(null),kr=H.useRef(null),Gn=H.useRef(null),An=H.useRef(null),Is=H.useRef(null),In=H.useRef(null),bn=H.useRef(!1),ks=H.useRef(!1),Os=H.useRef(!1),Ha=H.useRef(null),cr=rae(t),Ii=cr.length>0,Ia=cr.length===1,Bn=Ia?cr[0]:null,_i=t.elements.filter(U=>cr.includes(U.id)),SA=U=>{const Q=U.opacity;return typeof Q!="number"||!Number.isFinite(Q)?100:Math.max(0,Math.min(100,Q))},FA=_i.map(SA),Jc=FA.length===0?100:FA.every(U=>U===FA[0])?FA[0]:null,DA=_i.some(U=>sb(U)),co=cr.length===1&&(_i[0]?.type==="draw"||_i[0]?.type==="image")?_i[0].type:"multiple",ku=_i.some(U=>U.groupId),As=_i.length>0&&_i.every(U=>U.groupId&&U.groupId===_i[0]?.groupId)?_i[0]?.groupId??null:null,LA=As?t.elements.filter(U=>U.groupId===As).map(U=>U.id):[],Wo=!!As&&LA.length>1&&LA.length===cr.length&&LA.every(U=>cr.includes(U)),fr=cr.length===1&&!!_i[0]?.groupId,At=t.camera,qo=t.settings.theme==="dark"||t.settings.theme==="system"&&document.documentElement.classList.contains("dark"),Ou=qo&&t.settings.colorScheme==="drawo",zo=H.useCallback(U=>!U||U.points.length<2?!1:(p(U.points),$r(null),Gn.current=null,yt(null),Be("crosshair"),!0),[p]),e1=U=>{const Q=bM(t.elements,cr).filter(ke=>(ke.drawMode??"draw")===U);if(Q.length===0){const ke=U==="marker"?t.settings.drawDefaults.markerStroke:U==="quill"?t.settings.drawDefaults.quillStroke:t.settings.drawDefaults.drawStroke;return{drawMode:U,stroke:ke,strokeWidth:U==="marker"?t.settings.drawDefaults.markerStrokeWidth:U==="quill"?t.settings.drawDefaults.quillStrokeWidth:t.settings.drawDefaults.drawStrokeWidth}}const Ve=Q[0].stroke,Pe=Q[0].strokeWidth;return{drawMode:U,stroke:typeof Ve=="string"&&Ve.trim().length>0?Ve:U==="marker"?t.settings.drawDefaults.markerStroke:U==="quill"?t.settings.drawDefaults.quillStroke:t.settings.drawDefaults.drawStroke,strokeWidth:typeof Pe=="number"&&Number.isFinite(Pe)?Math.max(1,Pe):U==="marker"?t.settings.drawDefaults.markerStrokeWidth:U==="quill"?t.settings.drawDefaults.quillStrokeWidth:t.settings.drawDefaults.drawStrokeWidth}},tn=U=>{const Q=typeof U=="string"&&U.trim().length>0?U:t.settings.shapeDefaults.textColor;return Ou?z0(Q):Q},$n=H.useCallback((U,Q)=>({x:U/At.zoom+At.x,y:Q/At.zoom+At.y}),[At.x,At.y,At.zoom]),ls=H.useCallback((U,Q)=>({x:(U-At.x)*At.zoom,y:(Q-At.y)*At.zoom}),[At.x,At.y,At.zoom]),Ka=H.useCallback((U,Q,Ve)=>{const Pe=Xf(Q),ke=Pe.map(_e=>qk(U,Ve,_e)),Ne=Math.max(16,...ke),Xe=j0(Ve.fontSize),He=Ve.fontSize+(Pe.length-1)*Xe;return{lines:Pe,lineWidths:ke,width:Ne,height:He,lineHeight:Xe}},[]),us=H.useRef(new Map),Go=(U,Q,Ve,Pe)=>{const ke=`${Ve}::${Pe.fontFamily}::${Pe.fontSize}::${Pe.fontWeight}::${Pe.fontStyle}`,Ne=us.current.get(Q);if(Ne&&Ne.cacheKey===ke)return Ne.layout;const Xe=Ka(U,Ve,Pe);if(us.current.set(Q,{cacheKey:ke,layout:Xe}),us.current.size>6e3){const He=us.current.keys().next().value;typeof He=="string"&&us.current.delete(He)}return Xe},cs=(U,Q,Ve,Pe,ke,Ne)=>{const Xe=Ne?Go(U,Ne,Q,ke):Ka(U,Q,ke);return Xe.lines.forEach((He,_e)=>{const nt=Xe.lineWidths[_e]??0,Rt=qA(Ve,nt,ke.textAlign),gt=Pe+_e*Xe.lineHeight;let ir=Rt;for(const Wt of He.runs){if(!Wt.text)continue;U.font=bf(ke,Wt);const Dr=U.measureText(Wt.text).width;if(U.fillText(Wt.text,ir,gt),Wt.strikethrough){const ye=U.strokeStyle,sr=U.lineWidth;if(U.strokeStyle=U.fillStyle,U.lineWidth=Math.max(ke.fontSize*.04,.75),Wt.strikethrough){const Vt=gt-ke.fontSize*.3;U.beginPath(),U.moveTo(ir,Vt),U.lineTo(ir+Dr,Vt),U.stroke()}U.strokeStyle=ye,U.lineWidth=sr}ir+=Dr}}),Xe},t1=(U,Q,Ve,Pe,ke,Ne)=>{const Xe=Ne?Go(U,Ne,Q,ke):Ka(U,Q,ke),He=Pe-Xe.height/2;return Xe.lines.forEach((_e,nt)=>{const Rt=Xe.lineWidths[nt]??0;let gt=qA(Ve,Rt,ke.textAlign);const ir=He+ke.fontSize+nt*Xe.lineHeight;for(const Wt of _e.runs){if(!Wt.text)continue;U.font=bf(ke,Wt);const Dr=U.measureText(Wt.text).width;if(U.fillText(Wt.text,gt,ir),Wt.strikethrough){const ye=U.strokeStyle,sr=U.lineWidth;if(U.strokeStyle=U.fillStyle,U.lineWidth=Math.max(ke.fontSize*.04,.75),Wt.strikethrough){const Vt=ir-ke.fontSize*.3;U.beginPath(),U.moveTo(gt,Vt),U.lineTo(gt+Dr,Vt),U.stroke()}U.strokeStyle=ye,U.lineWidth=sr}gt+=Dr}}),Xe};H.useEffect(()=>{if(!(Ln||we||Vr==="shape-fill-color"||Vr==="shape-stroke-color"||Vr==="text-color"))return;const Q=Pe=>{const ke=Pe.target;ke&&(hn.current?.contains(ke)||zn.current?.contains(ke)||(Ot(!1),st(!1),_r(null)))},Ve=Pe=>{Pe.key==="Escape"&&(Ot(!1),st(!1),_r(null))};return window.addEventListener("pointerdown",Q),window.addEventListener("keydown",Ve),()=>{window.removeEventListener("pointerdown",Q),window.removeEventListener("keydown",Ve)}},[Vr,Ln,we]);const $o=(U,Q,Ve,Pe)=>{if(Gs(U))return null;const{start:ke,end:Ne,throughPoint:Xe}=t7(U),He=Math.max(7/Pe,G1/(2.3*Pe));return Math.hypot(Q-ke.x,Ve-ke.y)<=He?"start":Math.hypot(Q-Ne.x,Ve-Ne.y)<=He?"end":Math.hypot(Q-Xe.x,Ve-Xe.y)<=He?"control":null},Tu=(U,Q,Ve,Pe)=>{if(!Gs(U)||!U.points)return null;const ke=Math.max(7/Pe,G1/(2.15*Pe));let Ne=null,Xe=Number.POSITIVE_INFINITY;for(let He=0;He<U.points.length;He++){const _e=U.points[He],nt=Math.hypot(Q-_e.x,Ve-_e.y);nt<=ke&&nt<Xe&&(Ne=He,Xe=nt)}return Ne},IA=(U,Q,Ve=!0)=>{if(U.type==="rectangle"||U.type==="circle"||U.type==="image"||U.type==="svg")return{x:U.x,y:U.y,width:U.width,height:U.height};if(U.type==="draw")return mz(U);if(U.type==="line")return X1(U);const Pe=Q?Ka(Q,U.text,{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle}).width:Math.max(16,yl(U)),ke=qA(U.x,Pe,U.textAlign),Ne=yu(U),Xe={x:ke,y:U.y-U.fontSize,width:Pe,height:Ne};if(!Ve)return Xe;const He=cz/At.zoom;return{x:Xe.x-He,y:Xe.y-He,width:Xe.width+He*2,height:Xe.height+He*2}},Yi=(U,Q,Ve=!0)=>{const Pe=t.elements.find(ke=>ke.id===U);return Pe?IA(Pe,Q,Ve):null},Ts=(U,Q,Ve,Pe)=>{const ke=G1/Ve,Ne=uz/Ve,Xe=["nw","ne","se","sw"],He=_e=>{const nt=uO(Q,_e),Rt=Pt===_e,gt=qe===_e;let ir=1,Wt=2/Ve,ar=.1,Dr=1/Ve;gt?(ir=1.35,Wt=8/Ve,ar=.25,Dr=2.5/Ve):Rt&&(ir=1.2,Wt=5/Ve,ar=.18,Dr=1.5/Ve);const ye=ke*ir,sr=ye/2,Vt=nt.x-sr,Ar=nt.y-sr;if(U.save(),U.shadowColor=`rgba(0, 0, 0, ${ar})`,U.shadowBlur=Wt,U.shadowOffsetX=0,U.shadowOffsetY=1.5/Ve,U.fillStyle=gt?Pe:tn(t.settings.shapeDefaults.fill),U.strokeStyle=Pe,U.lineWidth=Dr,ns(U,Vt,Ar,ye,ye,Ne*ir),U.fill(),U.stroke(),(Rt||gt)&&(U.strokeStyle=Pe,U.globalAlpha=gt?.15:.08,U.lineWidth=(4+(gt?2:0))/Ve,ns(U,Vt,Ar,ye,ye,Ne*ir),U.stroke(),U.globalAlpha=1),Rt||gt){U.fillStyle=gt?"rgba(255, 255, 255, 0.25)":"rgba(255, 255, 255, 0.15)";const Rn=ye*.5;U.beginPath(),U.arc(nt.x,nt.y,Rn/2,0,Math.PI*2),U.fill()}U.restore()};for(const _e of Xe)He(_e)},Va=(U,Q,Ve=!0)=>{if(U.length===0)return null;const Pe=U.map(_e=>Yi(_e,Q,Ve)).filter(_e=>_e!==null);if(Pe.length===0)return null;const ke=Math.min(...Pe.map(_e=>_e.x)),Ne=Math.min(...Pe.map(_e=>_e.y)),Xe=Math.max(...Pe.map(_e=>_e.x+_e.width)),He=Math.max(...Pe.map(_e=>_e.y+_e.height));return{x:ke,y:Ne,width:Xe-ke,height:He-Ne}},Ms=U=>{if(Gt)return;const Q=t.elements.filter(_e=>cr.includes(_e.id)&&sb(_e));if(Q.length===0)return;const Ve=Q.map(_e=>({id:_e.id,bounds:IA(_e)})),Pe=Math.min(...Ve.map(_e=>_e.bounds.x)),ke=Math.min(...Ve.map(_e=>_e.bounds.y)),Ne=Math.max(...Ve.map(_e=>_e.bounds.x+_e.bounds.width)),Xe=Math.max(...Ve.map(_e=>_e.bounds.y+_e.bounds.height)),He=new Map;for(const _e of Ve){const nt=_s(_e.bounds),Rt=U==="horizontal"?Pe+Ne-(_e.bounds.x+_e.bounds.width):_e.bounds.x,gt=U==="vertical"?ke+Xe-(_e.bounds.y+_e.bounds.height):_e.bounds.y;He.set(_e.id,{fromCenterX:nt.x,fromCenterY:nt.y,toCenterX:nt.x+(Rt-_e.bounds.x),toCenterY:nt.y+(gt-_e.bounds.y)})}on({axis:U,startedAt:m1(),durationMs:Oae,items:He})};H.useEffect(()=>{if(!Gt)return;let U=0;const Q=()=>{if(m1()-Gt.startedAt>=Gt.durationMs){on(null),L(Gt.axis);return}tr(Pe=>Pe+1),U=requestAnimationFrame(Q)};return U=requestAnimationFrame(Q),()=>{cancelAnimationFrame(U)}},[Gt,L]);const Xo=t.elements.some(U=>U.type==="image"&&U.isAnimated===!0);H.useEffect(()=>{if(!Xo)return;let U=0;const Q=()=>{tr(Ve=>Ve+1),U=requestAnimationFrame(Q)};return U=requestAnimationFrame(Q),()=>{cancelAnimationFrame(U)}},[Xo]),H.useEffect(()=>{kr.current=zr},[zr]),H.useEffect(()=>{s!=="line"&&(kr.current&&zo(kr.current),Gn.current&&(Gn.current=null,$r(null)))},[zo,s]);const fo=(()=>{if(cr.length===0||Bt||qe||Xt||$e||dr!==null)return null;const U=Va(cr,void 0,!0);if(!U)return null;const Q=ls(U.x,U.y),Ve=ls(U.x+U.width,U.y+U.height),Pe=(Q.x+Ve.x)/2,ke=Math.max(8,Math.min(Q.y-42,Ke.height-46));return{left:Pe,top:ke,key:cr.join("|")}})(),kA=(U,Q)=>{if(Me)return null;const Ve=be.current;if(!Ve)return null;const Pe=Ve.getContext("2d");if(!Pe)return null;if(cr.length>1){const nt=Va(cr,Pe,!0);return nt?Wh(nt,U,Q,At.zoom):null}if(!Bn)return null;const ke=t.elements.find(nt=>nt.id===Bn);if(ke?.type==="line")return null;ke?.type==="text"&&(Pe.font=l1(ke));const Ne=Yi(Bn,Pe);if(!Ne)return null;const Xe=(ke?.rotation??0)*Math.PI/180,He=_s(Ne),_e=N1(U,Q,He.x,He.y,-Xe);return Wh(Ne,_e.x,_e.y,At.zoom)},xl=(U,Q,Ve,Pe)=>{const ke=Math.min(U.width,U.height)/2,Xe=Math.max(0,Math.min(Q,ke))+Zw/Ve;return Pe==="nw"?{x:U.x+Xe,y:U.y+Xe}:Pe==="ne"?{x:U.x+U.width-Xe,y:U.y+Xe}:Pe==="se"?{x:U.x+U.width-Xe,y:U.y+U.height-Xe}:{x:U.x+Xe,y:U.y+U.height-Xe}},Ns=()=>{if(!Bn)return null;const U=t.elements.find(Q=>Q.id===Bn);return!U||U.type!=="rectangle"?null:U},Wa=(U,Q,Ve,Pe)=>{const ke={x:U.x,y:U.y,width:U.width,height:U.height},Ne=["nw","ne","se","sw"],Xe=Yw/(2*Pe);for(const He of Ne){const _e=xl(ke,U.borderRadius,Pe,He);if(Math.hypot(Q-_e.x,Ve-_e.y)<=Xe)return He}return null},Mu=()=>Cm(t.elements,cr).some(ke=>ke.type==="text")||Me?h.jsx(EM,{scene:t,selectedIds:cr,localeMessages:o,editor:ge,editingText:Me,setEditingText:it,worldToScreen:ls,toggleEditorMark:en,onTextCommit:ft,onTextFontFamilyChange:P,onTextFontSizeChange:R,onTextFontWeightChange:q,onTextFontStyleChange:te,onTextAlignChange:ne,onTextColorChange:Z,shapeColors:r,customDrawColorPickerWrapRef:hn,customDrawColorPickerContentRef:zn,customDrawColorPickerColor:It,setCustomDrawColorPickerColor:Mr,activeSelectId:Vr,setActiveSelectId:_r}):nae(t.elements,cr).length>0?h.jsx(fM,{}):yM(t.elements,cr).length>0?h.jsx(BM,{scene:t,shapeColors:r,selectedIds:cr,localeMessages:o,customDrawColorPickerWrapRef:hn,customDrawColorPickerContentRef:zn,customDrawColorPickerColor:It,setCustomDrawColorPickerColor:Mr,onShapeFillColorChange:J,onShapeFillStyleChange:T,onShapeStrokeColorChange:G,onShapeStrokeWidthChange:re,onShapeStrokeStyleChange:he,uniColor:pn,activeSelectId:Vr,setActiveSelectId:_r}):h.jsx(xM,{scene:t,strokeColors:n,selectedIds:cr,drawingTool:s,localeMessages:o,customDrawColorPickerWrapRef:hn,customDrawColorPickerContentRef:zn,isCustomDrawColorPickerOpen:Ln,setIsCustomDrawColorPickerOpen:Ot,customDrawColorPickerColor:It,setCustomDrawColorPickerColor:Mr,onDrawStrokeWidthChange:W,onDrawStrokeColorChange:se,onDrawDefaultStrokeColorChange:Ae,onLineStartCapChange:Ee,onLineEndCapChange:ee,uniColor:pn,activeSelectId:Vr,setActiveSelectId:_r}),qa=(U,Q,Ve)=>{if(ks.current&&!Me)return"grab";if(s&&s!=="image")return"crosshair";const Pe=Ns();if(Pe){const Xe={x:Pe.x,y:Pe.y,width:Pe.width,height:Pe.height},He=_s(Xe),_e=N1(U,Q,He.x,He.y,-Pe.rotation*Math.PI/180);if(Wa(Pe,_e.x,_e.y,At.zoom))return"pointer"}if(a==="pan")return"grab";if(Bn){const Xe=t.elements.find(He=>He.id===Bn&&He.type==="line");if(Xe){const He=hp(Xe,U,Q);if(Gs(Xe)){const _e=Tu(Xe,He.x,He.y,At.zoom);if(ur(_e),Li(null),_e!==null)return"pointer"}else{const _e=$o(Xe,He.x,He.y,At.zoom);if(Li(_e),ur(null),_e)return"pointer"}}else Li(null),ur(null)}else Li(null),ur(null);const ke=kA(U,Q);return ke?(wt(ke.mode==="resize"?ke.handle:null),ke.mode==="resize"?c1(ke.handle):f1(ke.handle)):(wt(null),M1(t.elements,U,Q)?Ve?"clone":"grab":"default")},El=U=>{const Q=Math.min(U.startX,U.currentX),Ve=Math.min(U.startY,U.currentY),Pe=Math.abs(U.currentX-U.startX),ke=Math.abs(U.currentY-U.startY);return{x:Q,y:Ve,width:Pe,height:ke}},ho=U=>{const Q=U.currentX-U.startX,Ve=U.currentY-U.startY;if(U.fromCenter){let Pe=Math.abs(Q),ke=Math.abs(Ve);if(U.lockAspect){const Ne=Math.max(Pe,ke);Pe=Ne,ke=Ne}return{x:U.startX-Pe,y:U.startY-ke,width:Pe*2,height:ke*2}}if(U.lockAspect){const Pe=Math.max(Math.abs(Q),Math.abs(Ve));return{x:Q>=0?U.startX:U.startX-Pe,y:Ve>=0?U.startY:U.startY-Pe,width:Pe,height:Pe}}return{x:Math.min(U.startX,U.currentX),y:Math.min(U.startY,U.currentY),width:Math.abs(Q),height:Math.abs(Ve)}},fs=(U,Q,Ve,Pe)=>{const ke=Ve-U,Ne=Pe-Q;if(ke===0&&Ne===0)return{x:Ve,y:Pe};const Xe=Math.atan2(Ne,ke),He=Math.round(Xe/(Math.PI/4))*(Math.PI/4),_e=Math.hypot(ke,Ne);return{x:U+Math.cos(He)*_e,y:Q+Math.sin(He)*_e}},x=U=>{if(U.lockAspect){const Q=fs(U.startX,U.startY,U.currentX,U.currentY);return{startX:U.startX,startY:U.startY,endX:Q.x,endY:Q.y}}return{startX:U.startX,startY:U.startY,endX:U.currentX,endY:U.currentY}},K=(U,Q)=>U.x<Q.x+Q.width&&U.x+U.width>Q.x&&U.y<Q.y+Q.height&&U.y+U.height>Q.y,oe=U=>{const Ve=be.current?.getContext("2d"),Pe=El(U),ke=new Set;for(const Ne of t.elements){Ne.type==="text"&&Ve&&(Ve.font=l1(Ne));const Xe=Yi(Ne.id,Ve,!0);if(!(!Xe||!K(Pe,Xe))){if(!Ne.groupId){ke.add(Ne.id);continue}for(const He of t.elements)He.groupId===Ne.groupId&&ke.add(He.id)}}return[...ke]},me=H.useCallback(U=>{const Q=be.current;if(!Q)return;const Ve=Q.getContext("2d");if(!Ve)return;if(le(gt=>gt+1),U.type==="text"){ze(Mf(U.text));const gt=Ka(Ve,U.text,{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle}),ir=qA(U.x,gt.width,U.textAlign),Wt=ls(ir,U.y-U.fontSize);it({id:U.id,value:U.text,anchorX:U.x,anchorY:U.y-U.fontSize,left:Wt.x,top:Wt.y,width:gt.width*At.zoom,height:gt.height*At.zoom,style:{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle,color:U.color,textAlign:U.textAlign}});return}const Pe={id:U.id,x:$1(U,U.textAlign),y:U.y+U.height/2,text:U.text,fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle,color:U.color,textAlign:U.textAlign},ke=Ka(Ve,Pe.text,{fontFamily:Pe.fontFamily,fontSize:Pe.fontSize,fontWeight:Pe.fontWeight,fontStyle:Pe.fontStyle}),Ne=Math.max(16,U.width-Gv*2),Xe=Math.min(ke.width,Ne),He=$1(U,U.textAlign),_e=U.y+U.height/2-ke.height/2,nt=qA(He,Xe,U.textAlign),Rt=ls(nt,_e);ze(Mf(U.text)),it({id:U.id,value:U.text,anchorX:He,anchorY:_e,left:Rt.x,top:Rt.y,width:Xe*At.zoom,height:ke.height*At.zoom,maxWidth:Ne*At.zoom,style:{fontFamily:U.fontFamily,fontSize:U.fontSize,fontWeight:U.fontWeight,fontStyle:U.fontStyle,color:U.color,textAlign:U.textAlign}})},[At.zoom,Ka,ls]),Te=U=>{if(!Me)return;const Q=mt?w0(mt):Me.value;ft(Me.id,Q);try{ct.deselect(ge)}catch{}ze(null),it(null)};H.useEffect(()=>{const U=()=>{Se({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U)}},[]),H.useEffect(()=>{const U=be.current;if(!U)return;const Q=Ve=>{if(Me){Ve.preventDefault();return}const Pe=U.getBoundingClientRect(),ke=Ve.clientX-Pe.left,Ne=Ve.clientY-Pe.top;if(Ve.preventDefault(),Ve.ctrlKey||Ve.metaKey){d(ke,Ne,Ve.deltaY);return}const Xe=Ve.shiftKey&&Math.abs(Ve.deltaX)<Math.abs(Ve.deltaY)?Ve.deltaY:Ve.deltaX,He=Ve.shiftKey&&Math.abs(Ve.deltaX)<Math.abs(Ve.deltaY)?0:Ve.deltaY;c(Xe,He)};return U.addEventListener("wheel",Q,{passive:!1}),()=>{U.removeEventListener("wheel",Q)}},[Me,c,d]),H.useEffect(()=>{const U=be.current;if(!U)return;const Q=U.getContext("2d");if(!Q)return;const Ve=getComputedStyle(U),Pe=Ve.getPropertyValue("--accent").trim()||"#7c5cff",ke=aC(Ve.getPropertyValue("--accent-rgb"))||aC(Pe)||"124, 92, 255",Ne=`rgba(${ke}, 0.45)`,Xe=`rgba(${ke}, 0.12)`,He=qo?"#ff9b9b":"#ff7a7a",_e=Gt?Math.min(1,Math.max(0,(m1()-Gt.startedAt)/Gt.durationMs)):null,nt=_e===null?null:Nae(_e),Rt=(ye,sr,Vt)=>{if(!Gt||nt===null)return;const Ar=Gt.items.get(Vt);if(!Ar)return;const Rn=ob(Ar.fromCenterX,Ar.toCenterX,nt),ki=ob(Ar.fromCenterY,Ar.toCenterY,nt),Yn=Gt.axis==="horizontal"?1-nt*2:1,ha=Gt.axis==="vertical"?1-nt*2:1,Zn=Math.abs(Yn)<.001?Yn<0?-.001:.001:Yn,ui=Math.abs(ha)<.001?ha<0?-.001:.001:ha,gn=_s(sr);ye.translate(Rn,ki),ye.scale(Zn,ui),ye.translate(-gn.x,-gn.y)};if(Q.fillStyle=t.settings.drawDefaults.canvas,Q.fillRect(0,0,U.width,U.height),Q.save(),Q.setTransform(At.zoom,0,0,At.zoom,-At.x*At.zoom,-At.y*At.zoom),t.settings.showGrid){const ye=Math.max(4,t.settings.gridSize),sr=Math.max(1,Math.ceil(fz/(ye*At.zoom))),Vt=ye*sr,Ar=At.x,Rn=At.y,ki=At.x+U.width/At.zoom,Yn=At.y+U.height/At.zoom,ha=Math.floor(Ar/Vt)*Vt,Zn=Math.floor(Rn/Vt)*Vt,ui=qo?"#ffffff10":"#B3B2B370";if(t.settings.gridStyle==="squares"){Q.strokeStyle=ui,Q.lineWidth=1/At.zoom,Q.beginPath();for(let gn=ha;gn<=ki;gn+=Vt)Q.moveTo(gn,Rn),Q.lineTo(gn,Yn);for(let gn=Zn;gn<=Yn;gn+=Vt)Q.moveTo(Ar,gn),Q.lineTo(ki,gn);Q.stroke()}else{const gn=2/At.zoom,za=gn/2;Q.fillStyle=ui;for(let xt=ha;xt<=ki;xt+=Vt)for(let vn=Zn;vn<=Yn;vn+=Vt)Q.fillRect(xt-za,vn-za,gn,gn)}}const gt=new Set(cr),ir=Yt!==null?new Set(or):null,Wt=Math.max(160/At.zoom,48),ar={x:At.x-Wt,y:At.y-Wt,width:U.width/At.zoom+Wt*2,height:U.height/At.zoom+Wt*2},Dr=ye=>!(ye.x+ye.width<ar.x||ye.x>ar.x+ar.width||ye.y+ye.height<ar.y||ye.y>ar.y+ar.height);for(const ye of t.elements){const sr=gt.has(ye.id),Vt=sr&&(!Wo||cr.length===1),Ar=Yt!==null&&ir?.has(ye.id)&&!sr,Rn=cr.length>1,ki=ye.rotation*Math.PI/180,Yn=SA(ye)/100;if(!sr&&!Ar&&Me?.id!==ye.id){let xt=null;if(ye.type==="draw"||ye.type==="image"||ye.type==="rectangle"||ye.type==="circle"?xt={x:ye.x,y:ye.y,width:ye.width,height:ye.height}:ye.type==="line"&&(xt=X1(ye)),xt&&!Dr(xt))continue}if(ye.type==="draw"){const xt=ye.drawMode??"draw",vn={x:ye.x,y:ye.y,width:ye.width,height:ye.height},rn={x:vn.x-ye.x,y:vn.y-ye.y,width:vn.width,height:vn.height},Xr=_s(vn);if(Q.save(),Rt(Q,vn,ye.id),Q.translate(Xr.x,Xr.y),Q.rotate(ki),Q.translate(-Xr.x,-Xr.y),Q.translate(ye.x,ye.y),ye.points.length>0){const Un=Yv(xt,qo),da=Q.globalCompositeOperation,pa=Q.globalAlpha;Q.globalCompositeOperation=Un.compositeOperation,Q.globalAlpha*=Un.opacity*Yn;const Zi=Xv(ye.strokeWidth);Q.strokeStyle=tn(ye.stroke),Q.fillStyle=tn(ye.stroke),Q.lineWidth=Zi,Q.lineJoin="round",Q.lineCap=Zv();const Hi=ye.points;Hi.length===1?xt==="marker"?Ac(Q,Hi,Zi):xt==="quill"?lc(Q,Hi,Zi,t.settings.quillDrawOptimizations):(Q.beginPath(),Q.arc(Hi[0].x,Hi[0].y,Q.lineWidth/2,0,Math.PI*2),Q.fillStyle=tn(ye.stroke),Q.fill()):Hi.length>1&&(xt==="marker"?Ac(Q,Hi,Zi):xt==="quill"?lc(Q,Hi,Zi,t.settings.quillDrawOptimizations):(Q.beginPath(),G0(Q,Hi),Q.stroke())),Q.globalCompositeOperation=da,Q.globalAlpha=pa}Vt?(Q.strokeStyle=Rn?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(rn.x,rn.y,rn.width,rn.height),Ia&&Ts(Q,rn,At.zoom,Pe)):Ar&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(rn.x,rn.y,rn.width,rn.height)),Q.restore();continue}if(ye.type==="image"){const xt=ye,vn={x:xt.x,y:xt.y,width:xt.width,height:xt.height},rn=_s(vn),Xr=xt.src?$t(xt.src):null,Un=Math.min(16/At.zoom,Math.min(xt.width,xt.height)/6);Q.save(),Rt(Q,vn,xt.id),Q.translate(rn.x,rn.y),Q.rotate(ki),Q.translate(-rn.x,-rn.y);const da=Q.globalAlpha;Q.globalAlpha*=Yn,(xt.flipX||xt.flipY)&&(Q.translate(rn.x,rn.y),Q.scale(xt.flipX?-1:1,xt.flipY?-1:1),Q.translate(-rn.x,-rn.y)),Q.shadowColor="rgba(15, 23, 42, 0.14)",Q.shadowBlur=18/At.zoom,Q.shadowOffsetY=6/At.zoom,Q.fillStyle=tn(t.settings.shapeDefaults.fill),ns(Q,xt.x,xt.y,xt.width,xt.height,Un),Q.fill(),Q.save(),ns(Q,xt.x,xt.y,xt.width,xt.height,Un),Q.clip(),Xr&&Xr.complete&&Xr.naturalWidth>0&&Xr.naturalHeight>0?Q.drawImage(Xr,xt.x,xt.y,xt.width,xt.height):(Q.fillStyle=tn("#e6e7e8"),Q.fillRect(xt.x,xt.y,xt.width,xt.height)),Q.restore(),Q.shadowColor="transparent",Q.strokeStyle=tn("rgba(15, 23, 42, 0.08)"),Q.lineWidth=1/At.zoom,ns(Q,xt.x,xt.y,xt.width,xt.height,Un),Q.stroke(),Q.globalAlpha=da,Vt?(Q.strokeStyle=Rn?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height)):Ar&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height)),Vt&&Ia&&Ts(Q,vn,At.zoom,Pe),Q.restore();continue}if(ye.type==="rectangle"||ye.type==="circle"){const xt={x:ye.x,y:ye.y,width:ye.width,height:ye.height},vn=_s(xt),rn=ye.type==="rectangle"?Math.max(0,Math.min(ye.borderRadius,Math.min(ye.width,ye.height)/2)):0;Q.save(),Rt(Q,xt,ye.id),Q.translate(vn.x,vn.y),Q.rotate(ki),Q.translate(-vn.x,-vn.y);const Xr=Q.globalAlpha;if(Q.globalAlpha*=Yn,Rae(Q,ye,rn,tn),Uae(Q,ye,rn,tn),Me?.id!==ye.id&&ye.text.trim().length>0){const Un={id:`${ye.id}-shape-text`,x:$1(ye,ye.textAlign),y:ye.y+ye.height/2,text:ye.text,fontFamily:ye.fontFamily,fontSize:ye.fontSize,fontWeight:ye.fontWeight,fontStyle:ye.fontStyle,color:ye.color,textAlign:ye.textAlign};Q.save(),ye.type==="circle"?(Q.beginPath(),Q.ellipse(ye.x+ye.width/2,ye.y+ye.height/2,ye.width/2,ye.height/2,0,0,Math.PI*2),Q.clip()):(ns(Q,ye.x,ye.y,ye.width,ye.height,rn),Q.clip()),Q.font=l1(Un),Q.fillStyle=tn(Un.color),Q.textAlign="left",Q.textBaseline="alphabetic",t1(Q,Un.text,Un.x,ye.y+ye.height/2,{fontFamily:Un.fontFamily,fontSize:Un.fontSize,fontWeight:Un.fontWeight,fontStyle:Un.fontStyle,textAlign:Un.textAlign},`shape:${ye.id}`),Q.restore()}if(Q.globalAlpha=Xr,Vt?(Q.strokeStyle=Rn?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(ye.x,ye.y,ye.width,ye.height)):Ar&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(ye.x,ye.y,ye.width,ye.height)),Vt&&Ia&&(Ts(Q,xt,At.zoom,Pe),ye.type==="rectangle")){const Un=An.current;if(Un&&Wk(ye,Un.x,Un.y)){const pa=["nw","ne","se","sw"],Zi=Yw/(2*At.zoom);for(const Hi of pa){const po=xl(xt,ye.borderRadius,At.zoom,Hi);Q.fillStyle=Pe,Q.beginPath(),Q.arc(po.x,po.y,Zi,0,Math.PI*2),Q.fill(),Q.strokeStyle=tn(t.settings.shapeDefaults.fill),Q.lineWidth=1/At.zoom,Q.beginPath(),Q.arc(po.x,po.y,Zi,0,Math.PI*2),Q.stroke()}}}Q.restore();continue}if(ye.type==="line"){const xt=ye,vn=X1(xt);Q.save(),Rt(Q,vn,xt.id),fO({ctx:Q,lineElement:xt,elementOpacity:Yn,zoom:At.zoom,accentColor:Pe,accentSelectionColor:Ne,toThemeColor:tn,shouldShowElementSelection:Vt,isMultiSelection:Rn,isMarqueePreview:Ar,canTransformSelection:Ia,hoveredLineHandle:dn,activeLineHandle:$e,hoveredLinePointIndex:Dt,activeLinePointIndex:dr}),Q.restore();continue}if(Me?.id===ye.id||ye.type==="svg")continue;const ha=Go(Q,`text:${ye.id}`,ye.text,{fontFamily:ye.fontFamily,fontSize:ye.fontSize,fontWeight:ye.fontWeight,fontStyle:ye.fontStyle}),Zn=ha.width,ui={x:qA(ye.x,Zn,ye.textAlign),y:ye.y-ye.fontSize,width:Zn,height:ha.height},gn=_s(ui);Q.save(),Q.translate(gn.x,gn.y),Q.rotate(ki),Q.translate(-gn.x,-gn.y);const za=Q.globalAlpha;if(Q.globalAlpha*=Yn,Q.fillStyle=tn(ye.color),Q.textAlign="left",Q.textBaseline="alphabetic",cs(Q,ye.text,ye.x,ye.y,{fontFamily:ye.fontFamily,fontSize:ye.fontSize,fontWeight:ye.fontWeight,fontStyle:ye.fontStyle,textAlign:ye.textAlign},`text:${ye.id}`),Q.globalAlpha=za,Vt){const xt=Yi(ye.id,Q,!0);if(!xt){Q.restore();continue}Q.strokeStyle=cr.length>1?Ne:Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height),Ia&&Ts(Q,xt,At.zoom,Pe)}else if(Ar){const xt=Yi(ye.id,Q,!0);xt&&(Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(xt.x,xt.y,xt.width,xt.height))}Q.restore()}if(cr.length>1&&!Gt){const ye=Va(cr,Q,!0);ye&&(Q.save(),Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.setLineDash([6/At.zoom,4/At.zoom]),Q.strokeRect(ye.x,ye.y,ye.width,ye.height),Q.setLineDash([]),Ts(Q,ye,At.zoom,Pe),Q.restore())}if(fr&&!Gt){const ye=Va(LA,Q,!0);ye&&(Q.save(),Q.strokeStyle=Ne,Q.lineWidth=1/At.zoom,Q.setLineDash([6/At.zoom,4/At.zoom]),Q.strokeRect(ye.x,ye.y,ye.width,ye.height),Q.setLineDash([]),Q.restore())}if(Pae(Q,i,At.zoom,He),Yt){const ye=El(Yt),sr=8/At.zoom;Q.fillStyle=Xe,Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,ns(Q,ye.x,ye.y,ye.width,ye.height,sr),Q.fill(),Q.stroke()}if(Fr){const ye=ho(Fr);if(Fr.type==="rectangle")Q.fillStyle=tn(t.settings.shapeDefaults.fill),Q.fillRect(ye.x,ye.y,ye.width,ye.height),Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.strokeRect(ye.x,ye.y,ye.width,ye.height);else if(Fr.type==="circle"){const sr=ye.x+ye.width/2,Vt=ye.y+ye.height/2;Q.fillStyle=tn(t.settings.shapeDefaults.fill),Q.beginPath(),Q.ellipse(sr,Vt,ye.width/2,ye.height/2,0,0,Math.PI*2),Q.fill(),Q.strokeStyle=Pe,Q.lineWidth=1/At.zoom,Q.beginPath(),Q.ellipse(sr,Vt,ye.width/2,ye.height/2,0,0,Math.PI*2),Q.stroke()}else if(Fr.type==="line"){const sr=x(Fr);Q.strokeStyle=Pe,Q.lineWidth=2/At.zoom,Q.lineCap="round",Q.lineJoin="round",Q.beginPath(),Q.moveTo(sr.startX,sr.startY),Q.lineTo(sr.endX,sr.endY),Q.stroke()}else{const sr=Math.max(10,Math.round(ye.height)),Vt={x:ye.x,y:ye.y+sr,text:o.canvas.newText,fontFamily:"Shantell Sans, sans-serif",fontSize:sr,fontWeight:"200",fontStyle:"normal",color:t.settings.shapeDefaults.textColor};Q.font=l1(Vt),Q.fillStyle=tn(Vt.color),Q.textAlign="left",Q.textBaseline="alphabetic",Q.fillText(Vt.text,Vt.x,Vt.y)}}if(zr&&zr.points.length>0&&zr.preview){const ye=[...zr.points,zr.preview];if(Q.strokeStyle=Pe,Q.lineWidth=2/At.zoom,Q.lineCap="round",Q.lineJoin="round",Q.beginPath(),cO(Q,ye),Q.stroke(),ye.length>1){const sr=Math.max(Q.lineWidth*.52,1/At.zoom);Q.fillStyle=Pe;for(let Vt=0;Vt<ye.length;Vt++){const Ar=ye[Vt];Q.beginPath(),Q.arc(Ar.x,Ar.y,sr,0,Math.PI*2),Q.fill()}}}if(Ft&&Ft.points.length>0){const ye=Yv(Ft.drawMode,qo),sr=Q.globalCompositeOperation,Vt=Q.globalAlpha;Q.globalCompositeOperation=ye.compositeOperation,Q.globalAlpha*=ye.opacity,Q.save();const Ar=Xv(Ft.strokeWidth);Q.strokeStyle=tn(Ft.stroke),Q.fillStyle=tn(Ft.stroke),Q.lineWidth=Ar,Q.lineJoin="round",Q.lineCap=Zv(),Ft.points.length===1?Ft.drawMode==="marker"?Ac(Q,Ft.points,Ar):Ft.drawMode==="quill"?lc(Q,Ft.points,Ar,t.settings.quillDrawOptimizations):(Q.beginPath(),Q.arc(Ft.points[0].x,Ft.points[0].y,Q.lineWidth/2,0,Math.PI*2),Q.fillStyle=tn(Ft.stroke),Q.fill()):Ft.drawMode==="marker"?Ac(Q,Ft.points,Ar):Ft.drawMode==="quill"?lc(Q,Ft.points,Ar,t.settings.quillDrawOptimizations):(Q.beginPath(),G0(Q,Ft.points),Q.stroke()),Q.restore(),Q.globalCompositeOperation=sr,Q.globalAlpha=Vt}if(Jt.length>0){Q.save();const ye=t.settings.laserSettings;Q.fillStyle=ye.color;for(const sr of Jt)sr.points.length!==0&&wae(Q,sr.points,lr,At,ye);Q.restore()}Q.restore()}),H.useEffect(()=>{if(!Me){at.current=null;return}at.current!==Me.id&&(at.current=Me.id,requestAnimationFrame(()=>{try{bt.focus(ge);const U=z.end(ge,[]);ct.select(ge,U)}catch(U){console.warn("Failed to focus text editor:",U)}}))},[ge,Me]),H.useEffect(()=>{const U=Q=>{if(Q.target instanceof HTMLElement){const ke=Q.target.tagName.toLowerCase();if(Q.target.isContentEditable||ke==="input"||ke==="textarea"||ke==="select")return}if(Q.key==="Escape"&&(kr.current||Gn.current)){Q.preventDefault(),Gn.current=null,$r(null),yt(null);return}if((Q.key===" "||Q.code==="Space")&&Q.target instanceof HTMLElement&&!Q.target.isContentEditable&&Q.target.tagName.toLowerCase()!=="input"&&Q.target.tagName.toLowerCase()!=="textarea"&&(ks.current=!0),Q.key==="Enter"&&!Me&&zo(kr.current)){Q.preventDefault();return}const Ve=Q.key.toLowerCase();if(Q.shiftKey&&!Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!Me){if(Ve==="h"){if(!DA)return;Q.preventDefault(),Ms("horizontal");return}if(Ve==="v"){if(!DA)return;Q.preventDefault(),Ms("vertical");return}}if(Q.ctrlKey||Q.metaKey){const ke=Ve;if(ke==="b"||ke==="i"){if(Me)return;const Ne=Cm(t.elements,cr);if(Ne.length===0)return;if(Q.preventDefault(),ke==="b"){const He=Ne.every(_e=>_e.fontWeight==="700"||_e.fontWeight==="800"||_e.fontWeight==="900"||_e.fontWeight==="bold");q(Ne.map(_e=>_e.id),He?"200":"700");return}const Xe=Ne.every(He=>He.fontStyle==="italic");te(Ne.map(He=>He.id),Xe?"normal":"italic");return}}if(Q.key!=="Enter"||Me)return;const Pe=t.elements.find(ke=>ke.id===Bn);!Pe||Pe.type!=="text"&&Pe.type!=="rectangle"&&Pe.type!=="circle"||(Q.preventDefault(),me(Pe))};return window.addEventListener("keydown",U),()=>{window.removeEventListener("keydown",U)}},[me,DA,At.zoom,zo,Ms,Ka,ls,t.elements,Bn,cr,Me,q,te]),H.useEffect(()=>{const U=Q=>{(Q.key===" "||Q.code==="Space")&&(ks.current=!1,Os.current=!1)};return window.addEventListener("keyup",U),()=>{window.removeEventListener("keyup",U)}},[]),H.useEffect(()=>{if(!Me)return;const U=24,Q=1,Ve=Me.left+Me.width-Ke.width,Pe=-Me.left,ke=Me.top+Me.height-Ke.height,Ne=-Me.top;let Xe=0,He=0;Ve>-U+Q?Xe=Ve+U:Pe>-U+Q&&(Xe=-(Pe+U)),ke>-U+Q?He=ke+U:Ne>-U+Q&&(He=-(Ne+U)),Math.abs(Xe)<=Q&&(Xe=0),Math.abs(He)<=Q&&(He=0),(Xe!==0||He!==0)&&c(Xe,He)},[At.zoom,Ke.height,Ke.width,Me,c]),H.useEffect(()=>{const U=()=>{Mt.current||(Mt.current=!0,setTimeout(()=>{tr(Q=>Q+1)},0))};return window.__FONTS_LOADED__&&(Mt.current=!0),window.addEventListener("fontsLoaded",U),()=>{window.removeEventListener("fontsLoaded",U)}},[]);const Ye=U=>{Array.from(U.dataTransfer.items).some(Q=>Q.kind==="file")&&(U.preventDefault(),U.dataTransfer.dropEffect="copy")},ot=U=>{const Q=Array.from(U.dataTransfer.files).filter(He=>He.type.startsWith("image/"));if(Q.length===0)return;U.preventDefault();const Ve=be.current;if(!Ve)return;const Pe=Ve.getBoundingClientRect(),ke=U.clientX-Pe.left,Ne=U.clientY-Pe.top,Xe=$n(ke,Ne);w(Q,Xe.x,Xe.y)},Kt=U=>{const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke);if(An.current=Ne,Ha.current=null,U.button===1){U.preventDefault(),bn.current=!0,In.current={screenX:Pe,screenY:ke},Sr.current=null,St(null),_t(null),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Be("grabbing"),Q.setPointerCapture(U.pointerId);return}if(a==="pan"){In.current={screenX:Pe,screenY:ke},Sr.current=null,St(null),_t(null),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Be("grabbing"),Q.setPointerCapture(U.pointerId);return}if(ks.current&&!Me&&!s&&!bn.current){Os.current=!0,In.current={screenX:Pe,screenY:ke},Sr.current=null,St(null),_t(null),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Be("grabbing"),Q.setPointerCapture(U.pointerId);return}if(s&&s!=="image"){if(Me&&Te(),Sr.current=null,St(null),_t(null),s==="laser")Er(Ne);else if(s==="draw"||s==="marker"||s==="quill"){const Rt=m1(),gt=s,ir=e1(gt);sn({points:[{...Ne,t:Rt}],stroke:ir.stroke,strokeWidth:ir.strokeWidth,drawMode:gt,isLine:U.shiftKey})}else if(s==="line"){const Rt=kr.current;Rt&&Rt.points.length>0?Gn.current=null:Gn.current={screenX:Pe,screenY:ke,startX:Ne.x,startY:Ne.y},yt(null)}else yt({type:s,startX:Ne.x,startY:Ne.y,currentX:Ne.x,currentY:Ne.y,fromCenter:U.altKey,lockAspect:U.shiftKey});Be(s==="laser"?"laser":s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair"),dt(null),Je(null),Kr(null),Et(!1),ut(!1),Q.setPointerCapture(U.pointerId);return}if(cr.length>1&&!Me){const Rt=Q.getContext("2d");if(Rt){const gt=Va(cr,Rt,!0);if(gt){const ir=Wh(gt,Ne.x,Ne.y,At.zoom);if(ir?.mode==="resize"){pe(ir.handle,Ne.x,Ne.y,gt,cr),Je(ir.handle),dt(null),Et(!1),ut(!1),Kr(null),nr([]),Be(c1(ir.handle)),Q.setPointerCapture(U.pointerId);return}const Wt=$v(gt,Ne.x,Ne.y,At.zoom);if(Wt?.mode==="rotate"){const ar=_s(gt);Oe(ar.x,ar.y,Ne.x,Ne.y,cr),dt(Wt.handle),Je(null),Et(!1),ut(!1),Kr(null),nr([]),Be(f1(Wt.handle)),Q.setPointerCapture(U.pointerId);return}}}}if(Bn&&!Me){const Rt=Q.getContext("2d");if(Rt){const gt=t.elements.find(Wt=>Wt.id===Bn);if(gt?.type==="line"){const Wt=hp(gt,Ne.x,Ne.y);if(Gs(gt)){const Dr=Tu(gt,Wt.x,Wt.y,At.zoom);if(Dr!==null){ue(),Sr.current={id:gt.id,handle:"point",pointIndex:Dr,startLine:{x:gt.x,y:gt.y,width:gt.width,height:gt.height,controlPoint:null,points:gt.points?[...gt.points]:[]}},_t(Dr),ur(Dr),St(null),Li(null),dt(null),Je(null),Et(!1),ut(!1),Kr(null),Be("pointer"),Q.setPointerCapture(U.pointerId);return}}const ar=$o(gt,Wt.x,Wt.y,At.zoom);if(ar){ue(),Sr.current={id:gt.id,handle:ar,startLine:{x:gt.x,y:gt.y,width:gt.width,height:gt.height,controlPoint:gt.controlPoint??null,points:gt.points?[...gt.points]:void 0}},St(ar),Li(ar),_t(null),ur(null),dt(null),Je(null),Et(!1),ut(!1),Kr(null),Be("pointer"),Q.setPointerCapture(U.pointerId);return}}gt?.type==="text"&&(Rt.font=l1(gt));const ir=gt?.type==="line"?null:Yi(Bn,Rt,!0);if(ir){const Wt=t.elements.find(Ar=>Ar.id===Bn),ar=(Wt?.rotation??0)*Math.PI/180,Dr=_s(ir),ye=N1(Ne.x,Ne.y,Dr.x,Dr.y,-ar);if(Wt?.type==="rectangle"&&Wa(Wt,ye.x,ye.y,At.zoom)){const Ar=Wa(Wt,ye.x,ye.y,At.zoom);if(!Ar)return;Qr(Wt.id),ni(Ar),dt(null),Je(null),Et(!1),ut(!1),Kr(null),Be("pointer"),Q.setPointerCapture(U.pointerId);return}const sr=Wh(ir,ye.x,ye.y,At.zoom);if(sr?.mode==="resize"){const Ar=Yi(Bn,Rt,!1);X(Bn,sr.handle,Ne.x,Ne.y,Ar??ir),Je(sr.handle),dt(null),Et(!1),ut(!1),Be(c1(sr.handle)),Q.setPointerCapture(U.pointerId);return}const Vt=$v(ir,ye.x,ye.y,At.zoom);if(Vt?.mode==="rotate"){We(Bn,Dr.x,Dr.y,Ne.x,Ne.y),dt(Vt.handle),Je(null),Et(!1),ut(!1),Be(f1(Vt.handle)),Q.setPointerCapture(U.pointerId);return}}}}Me&&Te();const Xe=M1(t.elements,Ne.x,Ne.y);if(!Xe){dt(null),Je(null),Et(!1),ut(!1),Kr({startX:Ne.x,startY:Ne.y,currentX:Ne.x,currentY:Ne.y}),Be("default"),Q.setPointerCapture(U.pointerId);return}U.shiftKey&&!U.altKey&&cr.length>1&&cr.includes(Xe)&&(Ha.current={hitId:Xe,selectedIds:[...cr],startScreenX:Pe,startScreenY:ke,shouldDeselect:!0});const He=!!Xe,_e=t.elements.find(Rt=>Rt.id===Xe),nt=He&&U.altKey&&!_e?.groupId;dt(null),Je(null),Kr(null),Et(He),ut(nt),Be(He?nt?"clone":"grabbing":"default"),A(Ne.x,Ne.y,U.altKey,U.shiftKey,U.ctrlKey||U.metaKey),Q.setPointerCapture(U.pointerId)},Qt=U=>{const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke);An.current=Ne;const Xe=Ha.current;if(Xe?.shouldDeselect&&Math.hypot(Pe-Xe.startScreenX,ke-Xe.startScreenY)>Tae&&(Ha.current={...Xe,shouldDeselect:!1}),bn.current){const _e=In.current;if(_e){const nt=Pe-_e.screenX,Rt=ke-_e.screenY;(nt!==0||Rt!==0)&&(c(-nt,-Rt),In.current={screenX:Pe,screenY:ke})}Be("grabbing");return}if(Os.current){const _e=In.current;if(_e){const nt=Pe-_e.screenX,Rt=ke-_e.screenY;(nt!==0||Rt!==0)&&(c(-nt,-Rt),In.current={screenX:Pe,screenY:ke})}Be("grabbing");return}if(a==="pan"){const _e=In.current;if(_e){const nt=Pe-_e.screenX,Rt=ke-_e.screenY;(nt!==0||Rt!==0)&&(c(-nt,-Rt),In.current={screenX:Pe,screenY:ke}),Be("grabbing")}else Be("grab");return}if(s){if(s==="line"){const _e=kr.current;if(_e&&_e.points.length>0){const Rt=_e.points[_e.points.length-1],gt=U.shiftKey?fs(Rt.x,Rt.y,Ne.x,Ne.y):Ne;$r({points:_e.points,preview:gt}),Be("crosshair");return}const nt=Gn.current;nt&&Math.hypot(Pe-nt.screenX,ke-nt.screenY)>=Mae&&(yt({type:"line",startX:nt.startX,startY:nt.startY,currentX:Ne.x,currentY:Ne.y,fromCenter:!1,lockAspect:U.shiftKey}),Gn.current=null)}if(s==="laser")Tr(Ne,At.zoom);else if(s==="draw"||s==="marker"||s==="quill"){const _e=m1();sn(nt=>{if(!nt)return nt;const Rt=U.shiftKey;let gt={...Ne,t:_e};if(Rt&&nt.points.length>0){const ar=nt.points[0],Dr=Math.abs(Ne.x-ar.x),ye=Math.abs(Ne.y-ar.y);Dr>ye?gt={x:Ne.x,y:ar.y,t:_e}:gt={x:ar.x,y:Ne.y,t:_e};const sr=nt.points.length>1?nt.points[1]:null,Vt=.5/At.zoom;return sr&&Math.hypot(gt.x-sr.x,gt.y-sr.y)<Vt?nt:{...nt,isLine:!0,points:[ar,gt]}}typeof gt.t!="number"&&(gt={...gt,t:_e});const ir=nt.points[nt.points.length-1],Wt=2/At.zoom;return ir&&Math.hypot(gt.x-ir.x,gt.y-ir.y)<Wt?nt:{...nt,isLine:!1,points:[...nt.points,gt]}})}else Fr&&yt(_e=>{if(!_e)return _e;if(_e.type==="line"){const nt=U.shiftKey?fs(_e.startX,_e.startY,Ne.x,Ne.y):Ne;return{..._e,currentX:nt.x,currentY:nt.y,lockAspect:U.shiftKey}}return{..._e,currentX:Ne.x,currentY:Ne.y,fromCenter:U.altKey,lockAspect:U.shiftKey}});Be(s==="laser"?"laser":s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair");return}const He=Sr.current;if(He){const _e=t.elements.find(nt=>nt.id===He.id&&nt.type==="line");if(_e){const nt=hp(_e,Ne.x,Ne.y),Rt={x:He.startLine.x,y:He.startLine.y},gt={x:He.startLine.x+He.startLine.width,y:He.startLine.y+He.startLine.height};let ir=Rt,Wt=gt,ar=He.startLine.controlPoint;if(He.handle==="start"||He.handle==="point")ir=U.shiftKey?fs(gt.x,gt.y,nt.x,nt.y):nt;else if(He.handle==="end")Wt=U.shiftKey?fs(Rt.x,Rt.y,nt.x,nt.y):nt;else if(He.handle==="control"){const Ar=(Rt.x+gt.x)/2,Rn=(Rt.y+gt.y)/2;ar=U.shiftKey?fs(Ar,Rn,nt.x,nt.y):{x:nt.x,y:nt.y}}const Dr=Ar=>t.settings.snapToGrid?Math.round(Ar/t.settings.gridSize)*t.settings.gridSize:Ar,ye={x:Dr(ir.x),y:Dr(ir.y)},sr={x:Dr(Wt.x),y:Dr(Wt.y)},Vt=ar?{x:Dr(ar.x),y:Dr(ar.y)}:null;if(He.handle==="point"&&typeof He.pointIndex=="number"&&He.startLine.points&&He.startLine.points.length>He.pointIndex){const Ar=He.startLine.points.map((ki,Yn)=>Yn===He.pointIndex?{x:ye.x,y:ye.y}:ki),Rn=kc(Ar);de(He.id,{x:Rn.x,y:Rn.y,width:Rn.width,height:Rn.height,controlPoint:null,points:Ar})}else de(He.id,{x:ye.x,y:ye.y,width:sr.x-ye.x,height:sr.y-ye.y,controlPoint:Vt})}Be("pointer");return}if(wn){const _e=t.elements.find(nt=>nt.id===wn);if(_e&&_e.type==="rectangle"&&ri){const nt={x:_e.x,y:_e.y,width:_e.width,height:_e.height},Rt=_s(nt),gt=N1(Ne.x,Ne.y,Rt.x,Rt.y,-_e.rotation*Math.PI/180),ir=Zw/At.zoom,Wt=_e.x+_e.width,ar=_e.y+_e.height;let Dr;ri==="nw"?Dr=Math.min(gt.x-_e.x-ir,gt.y-_e.y-ir):ri==="ne"?Dr=Math.min(Wt-gt.x-ir,gt.y-_e.y-ir):ri==="se"?Dr=Math.min(Wt-gt.x-ir,ar-gt.y-ir):Dr=Math.min(gt.x-_e.x-ir,ar-gt.y-ir);const ye=Math.max(0,Math.min(Dr,Math.min(_e.width,_e.height)/2));Ce([_e.id],ye)}Be("pointer");return}if(Yt){Kr(_e=>{if(!_e)return _e;const nt={..._e,currentX:Ne.x,currentY:Ne.y};return nr(oe(nt)),nt}),Be("default");return}if(l(Ne.x,Ne.y,U.shiftKey,U.altKey),Xt){Be(f1(Xt));return}if(qe){Be(c1(qe));return}if(Bt){Be(Ct?"clone":"grabbing");return}Be(qa(Ne.x,Ne.y,U.altKey))},hr=U=>{const Q=be.current;Q?.hasPointerCapture(U.pointerId)&&Q.releasePointerCapture(U.pointerId);const Ve=Ha.current;if(Ha.current=null,a==="pan"){In.current=null,Qr(null),ni(null),Be("grab");return}if(bn.current){bn.current=!1,In.current=null,Qr(null),ni(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(Os.current){Os.current=!1,In.current=null,Qr(null),ni(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(s){if(s==="line"){const ke=Gn.current;if(ke){Gn.current=null,yt(null),$r({points:[{x:ke.startX,y:ke.startY}],preview:{x:ke.startX,y:ke.startY}}),Qr(null),ni(null),Be("crosshair");return}const Ne=kr.current;if(Ne&&Ne.points.length>0){const Xe=Q?.getBoundingClientRect();if(Xe){const He=U.clientX-Xe.left,_e=U.clientY-Xe.top,nt=$n(He,_e),Rt=Ne.points[Ne.points.length-1],gt=U.shiftKey?fs(Rt.x,Rt.y,nt.x,nt.y):nt;Math.hypot(gt.x-Rt.x,gt.y-Rt.y)>=1?$r({points:[...Ne.points,gt],preview:gt}):$r({points:Ne.points,preview:gt})}Qr(null),ni(null),Be("crosshair");return}}if(s==="laser")Jr();else if(s==="draw"||s==="marker"||s==="quill")Ft&&Ft.points.length>=1&&v(Ft.points,{drawMode:Ft.drawMode,stroke:Ft.stroke}),sn(null);else if(Fr){if(Fr.type==="line"){const ke=x(Fr);Math.hypot(ke.endX-ke.startX,ke.endY-ke.startY)>=1&&f("line",ke.startX,ke.startY,o,{x:ke.startX,y:ke.startY,width:ke.endX-ke.startX,height:ke.endY-ke.startY})}else{const ke=ho(Fr);f(Fr.type,ke.x,ke.y,o,ke)}yt(null),C()}Qr(null),ni(null),Be(s==="laser"?"laser":s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair");return}if(Sr.current){u(),Sr.current=null,St(null),_t(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(wn){Qr(null),ni(null);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);Be(qa(He.x,He.y,U.altKey))}else Be("default");return}if(Yt){const ke=oe(Yt),Ne=U.shiftKey?Array.from(new Set([...cr,...ke])):ke;g(Ne),Kr(null),nr([]),dt(null),Je(null),Et(!1),ut(!1);const Xe=Q?.getBoundingClientRect();if(Xe){const He=U.clientX-Xe.left,_e=U.clientY-Xe.top,nt=$n(He,_e);An.current=nt,Be(qa(nt.x,nt.y,U.altKey))}else Be("default");return}if(Ve?.shouldDeselect&&!U.altKey){u(),g(Ve.selectedIds.filter(Ne=>Ne!==Ve.hitId)),dt(null),Je(null),wt(null),Sr.current=null,St(null),_t(null),Li(null),ur(null),Et(!1),ut(!1);const ke=Q?.getBoundingClientRect();if(ke){const Ne=U.clientX-ke.left,Xe=U.clientY-ke.top,He=$n(Ne,Xe);An.current=He,Be(qa(He.x,He.y,U.altKey))}else Be("default");return}u(),dt(null),Je(null),wt(null),Sr.current=null,St(null),_t(null),Li(null),ur(null),Et(!1),ut(!1);const Pe=Q?.getBoundingClientRect();if(Pe){const ke=U.clientX-Pe.left,Ne=U.clientY-Pe.top,Xe=$n(ke,Ne);An.current=Xe,Be(qa(Xe.x,Xe.y,U.altKey))}else Be("default")},gr=()=>{if(An.current=null,bn.current){Be("grabbing");return}if(a==="pan"){Be(In.current?"grabbing":"grab");return}if(s){s==="laser"?(Jr(),Be("laser")):Be(s==="draw"?"pencil":s==="quill"?"quill":s==="marker"?"marker":"crosshair");return}if(Sr.current||$e||dr!==null){Be("pointer");return}if(wn){Be("pointer");return}if(Yt){Be("default");return}if(wt(null),Li(null),ur(null),Xt){Be(f1(Xt));return}if(qe){Be(c1(qe));return}if(Bt){Be(Ct?"clone":"grabbing");return}Be("default")},jr=U=>{if(s==="line"&&zo(kr.current)){U.preventDefault();return}if(a==="pan"||s)return;const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke),Xe=M1(t.elements,Ne.x,Ne.y);if(!Xe)return;const He=t.elements.find(_e=>_e.id===Xe);if(He?.groupId&&cr.length>1&&cr.includes(He.id)){g([He.id]);return}if(!(!He||He.type!=="text"&&He.type!=="rectangle"&&He.type!=="circle")){if(Me&&Me.id!==He.id){Te(),requestAnimationFrame(()=>{me(He)});return}me(He)}},Xn=U=>{it(Q=>{if(!Q)return Q;const Pe=be.current?.getContext("2d");if(!Pe)return Q.value===U?Q:{...Q,value:U};const ke=Ka(Pe,U,{fontFamily:Q.style.fontFamily,fontSize:Q.style.fontSize,fontWeight:Q.style.fontWeight,fontStyle:Q.style.fontStyle}),Ne=Q.maxWidth?Math.min(ke.width*At.zoom,Q.maxWidth):ke.width*At.zoom,Xe=qA(Q.anchorX,Ne/At.zoom,Q.style.textAlign),He=ls(Xe,Q.anchorY),_e=ke.height*At.zoom,nt=Math.abs(Q.left-He.x)<.001&&Math.abs(Q.top-He.y)<.001&&Math.abs(Q.width-Ne)<.001&&Math.abs(Q.height-_e)<.001;return Q.value===U&&nt?Q:{...Q,value:U,left:He.x,top:He.y,width:Ne,height:_e}})};H.useEffect(()=>{if(!Me)return;const U=mt!==null?w0(mt):Me.value;Xn(U)},[At.x,At.y,At.zoom,mt,Me?.id]);const ln=U=>{try{if(ge.selection)try{z.node(ge,ge.selection.anchor.path),z.node(ge,ge.selection.focus.path)}catch{ct.deselect(ge)}const Q=U;for(const Pe of Q)if(!Pe||typeof Pe!="object")return;if(ze(Q),!ge.operations.some(Pe=>Pe.type!=="set_selection"))return;Xn(w0(Q))}catch(Q){console.warn("Editor change failed:",Q)}},en=U=>{let Q=null;try{Q=z.marks(ge)}catch{return}const Ve=Q?.[U];if(U==="bold"||U==="italic"){if(U==="bold"?!!Me&&(Me.style.fontWeight==="bold"||Me.style.fontWeight==="700"||Me.style.fontWeight==="800"||Me.style.fontWeight==="900"):!!Me&&Me.style.fontStyle==="italic"){z.addMark(ge,U,Ve===!1);return}if(Ve===!0){z.removeMark(ge,U);return}z.addMark(ge,U,!0);return}Ve===!0?z.removeMark(ge,U):z.addMark(ge,U,!0)},pn=U=>Ou?z0(U):U,kn=U=>{const Q=be.current;if(!Q)return;const Ve=Q.getBoundingClientRect(),Pe=U.clientX-Ve.left,ke=U.clientY-Ve.top,Ne=$n(Pe,ke);Is.current=Ne,An.current=Ne;const Xe=M1(t.elements,Ne.x,Ne.y);if(!Xe){g([]);return}const He=t.elements.find(nt=>nt.id===Xe);if(!He)return;const _e=U.ctrlKey||U.metaKey;if(He.groupId&&!_e){j(He.id);return}(!cr.includes(Xe)||_e)&&g([Xe])},On=()=>{const U=Is.current;U&&E(U.x,U.y)};return h.jsxs("div",{style:{position:"relative",width:Ke.width,height:Ke.height},children:[h.jsx("div",{ref:Re,style:{position:"fixed",top:0,left:0,pointerEvents:"none",opacity:0,zIndex:-9999},"aria-hidden":"true"}),h.jsx(LM,{hasSelection:Ii,canFlipSelection:DA,selectionType:co,selectionOpacity:Jc,hasElements:t.elements.length>0,canUngroupSelection:ku,onCut:B,localeMessages:o,onCopy:b,onPaste:On,onDuplicate:F,onSelectionOpacityChange:U=>{Ii&&_(cr,U)},onDelete:O,onGroup:I,onUngroup:k,onSelectAll:()=>{t.elements.length!==0&&g(t.elements.map(U=>U.id))},onMoveForward:()=>D("forward"),onBringToFront:()=>D("front"),onSendToBack:()=>D("back"),onMoveBackward:()=>D("backward"),onFlipHorizontal:()=>Ms("horizontal"),onFlipVertical:()=>Ms("vertical"),children:h.jsx("canvas",{ref:be,width:Ke.width,height:Ke.height,onDragOver:Ye,onDrop:ot,onPointerDown:Kt,onPointerMove:Qt,onPointerUp:hr,onPointerCancel:hr,onPointerLeave:gr,onDoubleClick:jr,onContextMenu:kn,onMouseDown:U=>{U.button===1&&U.preventDefault()},onAuxClick:U=>{U.button===1&&U.preventDefault()},style:{display:"block",cursor:`var(--drawo-cursor-${Ge}, var(--drawo-cursor-default)), auto`,touchAction:"none"}})}),e&&t.elements.length===0&&!Fr&&!Ft&&!zr&&h.jsx(cM,{}),h.jsx(FM,{editorWrapRef:Le,editor:ge,editingText:Me,editingDocument:mt,editorSessionKey:lt,cameraZoom:At.zoom,setEditingDocument:ze,setEditingText:it,toThemeColor:tn,getTextLineHeight:j0,onEditorChange:ln,onCommitEditingText:()=>Te(),onToggleEditorMark:en}),fo&&h.jsx(SM,{toolbarKey:fo.key,left:fo.left,top:fo.top,viewportWidth:Ke.width,children:Mu()})]})};function s2({showDefaultEmptyState:t=!0}){const e=xA(),{scene:r,resolvedTheme:n,isPresentationMode:i,interactionMode:a,drawingTool:s,messages:o,handlers:A,setDrawingTool:l}=e,u={scene:r,showDefaultEmptyState:t,strokeColors:n.preset.strokeColors,shapeColors:n.preset.shapeColors,alignmentGuides:[],interactionMode:a,drawingTool:s,localeMessages:o,onPointerDown:A.handlePointerDown,onPointerMove:A.handlePointerMove,onPointerUp:A.handlePointerUp,onResizeStart:A.handleResizeStart,onRotateStart:A.handleRotateStart,onTextCommit:A.handleTextCommit,onWheelPan:A.handleWheelPan,onWheelZoom:A.handleWheelZoom,onCreateElement:A.handleCreateElement,onCreateDrawElement:A.handleCreateDrawElement,onCreateLinePathElement:A.handleCreateLinePathElement,onDrawingToolComplete:()=>l(null),onDropImageFiles:A.handleInsertImageFiles,onSelectElements:A.handleSelectElements,onGroupResizeStart:A.handleGroupResizeStart,onGroupRotateStart:A.handleGroupRotateStart,onTextFontFamilyChange:A.handleTextFontFamilyChange,onTextFontSizeChange:A.handleTextFontSizeChange,onTextFontWeightChange:A.handleTextFontWeightChange,onTextFontStyleChange:A.handleTextFontStyleChange,onTextAlignChange:A.handleTextAlignChange,onTextColorChange:A.handleTextColorChange,onDrawStrokeWidthChange:A.handleDrawStrokeWidthChange,onDrawStrokeColorChange:A.handleDrawStrokeColorChange,onShapeFillColorChange:A.handleShapeFillColorChange,onShapeFillStyleChange:A.handleShapeFillStyleChange,onElementsOpacityChange:A.handleElementsOpacityChange,onShapeStrokeColorChange:A.handleShapeStrokeColorChange,onShapeStrokeWidthChange:A.handleShapeStrokeWidthChange,onShapeStrokeStyleChange:A.handleShapeStrokeStyleChange,onDrawDefaultStrokeColorChange:A.handleDrawDefaultStrokeColorChange,onDrawDefaultStrokeWidthChange:A.handleDrawDefaultStrokeWidthChange,onLineStartCapChange:A.handleLineStartCapChange,onLineEndCapChange:A.handleLineEndCapChange,onLineEditStart:A.handleLineEditStart,onLineGeometryChange:A.handleLineGeometryChange,onRectangleBorderRadiusChange:A.handleRectangleBorderRadiusChange,onCopySelection:A.handleCopySelection,onCutSelection:A.handleCutSelection,onPasteAt:A.handlePasteAt,onDuplicateSelection:A.handleDuplicateSelection,onDeleteSelection:A.handleDeleteSelection,onGroupSelection:A.handleGroupSelection,onUngroupSelection:A.handleUngroupSelection,onSelectGroupForElement:A.handleSelectGroupForElement,onReorderSelection:A.handleReorderSelection,onFlipSelection:A.handleFlipSelection};return h.jsx(IM,{...u})}function _ae({className:t,color:e}){return h.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("g",{"clip-path":"url(#clip0_1539_179)",children:h.jsxs("g",{"clip-path":"url(#clip1_1539_179)",children:[h.jsx("path",{d:"M7.99556 10.0703C8.19978 9.56757 8.68826 9.23877 9.23085 9.23877H14.7692C15.3118 9.23877 15.8003 9.56757 16.0045 10.0703L19.2157 17.9747C19.7337 19.2498 20.0001 20.6131 20.0001 21.9895V45.2389H4V21.9895C4 20.6131 4.26635 19.2498 4.78436 17.9747L7.99556 10.0703Z",fill:"white"}),h.jsx("path",{d:"M7.99556 10.0703C8.19978 9.56757 8.68826 9.23877 9.23085 9.23877H14.7692C15.3118 9.23877 15.8003 9.56757 16.0045 10.0703L19.2157 17.9747C19.7337 19.2498 20.0001 20.6131 20.0001 21.9895V45.2389H4V21.9895C4 20.6131 4.26635 19.2498 4.78436 17.9747L7.99556 10.0703Z",fill:"url(#paint0_linear_1539_179)","fill-opacity":"0.6"}),h.jsx("path",{d:"M9.23047 9.48877H14.7695C15.1552 9.48887 15.5071 9.6934 15.7002 10.0181L15.7725 10.1645L18.9844 18.0688C19.4902 19.314 19.75 20.6457 19.75 21.9897V44.9888H4.25V21.9897C4.25 20.6457 4.50979 19.314 5.01562 18.0688L8.22754 10.1645C8.39342 9.75622 8.78976 9.48892 9.23047 9.48877Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.5"}),h.jsx("g",{opacity:"0.2",filter:"url(#filter0_f_1539_179)",children:h.jsx("path",{d:"M18.6635 20.6615V44.3282H12.3301V10.3281L14.6634 10.2388L18.6635 20.6615Z",fill:"url(#paint1_linear_1539_179)"})}),h.jsx("g",{filter:"url(#filter1_i_1539_179)",children:h.jsx("path",{d:"M11.383 3.74726C11.6089 3.19493 12.3911 3.19493 12.6171 3.74725L15 9.57232H9L11.383 3.74726Z",fill:e||"#1E1E1E"})}),h.jsx("path",{d:"M11.6143 3.84158C11.7556 3.49681 12.2444 3.49682 12.3857 3.84158L14.6279 9.32205H9.37207L11.6143 3.84158Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.5"}),h.jsx("path",{d:"M4.33008 23.9058H19.6635",stroke:"black","stroke-opacity":"0.15","stroke-width":"0.66667"})]})}),h.jsxs("defs",{children:[h.jsxs("filter",{id:"filter0_f_1539_179",x:"10.3301",y:"8.23875",width:"10.3335",height:"38.0894",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"1.00001",result:"effect1_foregroundBlur_1539_179"})]}),h.jsxs("filter",{id:"filter1_i_1539_179",x:"7.55999",y:"3.33301",width:"7.44001",height:"6.95926",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),h.jsx("feOffset",{dx:"-1.44001",dy:"0.720004"}),h.jsx("feGaussianBlur",{stdDeviation:"1.08001"}),h.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),h.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"}),h.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_1539_179"})]}),h.jsxs("linearGradient",{id:"paint0_linear_1539_179",x1:"4",y1:"38.2389",x2:"20.0001",y2:"38.2389",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-opacity":"0.1"}),h.jsx("stop",{offset:"0.4","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-opacity":"0.15"})]}),h.jsxs("linearGradient",{id:"paint1_linear_1539_179",x1:"12.3301",y1:"1.57206",x2:"17.1673",y2:"36.2341",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-opacity":"0.2"}),h.jsx("stop",{offset:"1","stop-opacity":"0.4"})]}),h.jsx("clipPath",{id:"clip0_1539_179",children:h.jsx("rect",{width:"24",height:"24",fill:"white"})}),h.jsx("clipPath",{id:"clip1_1539_179",children:h.jsx("rect",{width:"16",height:"34",fill:"white",transform:"translate(4 2.57227)"})})]})]})}function Qae({className:t,color:e}){return h.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("g",{"clip-path":"url(#clip0_1571_205)",children:h.jsxs("g",{"clip-path":"url(#clip1_1571_205)",children:[h.jsx("path",{opacity:"0.75",d:"M12 9.66211C12.5694 9.66211 13.1156 9.88833 13.5182 10.291C13.9209 10.6937 14.1471 11.2398 14.1471 11.8093C14.1471 12.3787 13.9209 12.9249 13.5182 13.3276C13.1156 13.7302 12.5694 13.9565 12 13.9565C11.4305 13.9565 10.8843 13.7302 10.4817 13.3276C10.079 12.9249 9.85278 12.3787 9.85278 11.8093C9.85278 11.2398 10.079 10.6937 10.4817 10.291C10.8843 9.88833 11.4305 9.66211 12 9.66211Z",fill:e||"#1E1E1E"}),h.jsx("path",{d:"M12.6409 1.61035C12.9169 1.61035 13.1466 1.8197 13.1863 2.09347C13.6442 5.2482 15.4741 7.95793 18.0518 9.59891C18.2558 9.72882 18.3578 9.97413 18.2961 10.2076L15.5418 20.5366C15.5112 20.6509 15.4438 20.752 15.3499 20.824C15.2561 20.896 15.141 20.935 15.0227 20.9349H8.97679C8.85856 20.9349 8.74364 20.8958 8.64988 20.8238C8.55611 20.7518 8.48875 20.6508 8.45825 20.5366L5.7045 10.2076C5.67486 10.0934 5.68253 9.97277 5.72638 9.86325C5.77022 9.75373 5.84795 9.6611 5.9482 9.59891C8.52588 7.95793 10.3558 5.2482 10.8142 2.09293C10.854 1.82024 11.0832 1.61035 11.3591 1.61035H12.6409ZM12 9.66225C11.4305 9.66225 10.8844 9.88847 10.4817 10.2911C10.0791 10.6938 9.85284 11.24 9.85284 11.8094C9.85284 12.3789 10.0791 12.925 10.4817 13.3277C10.8844 13.7304 11.4305 13.9566 12 13.9566C12.5695 13.9566 13.1156 13.7304 13.5183 13.3277C13.921 12.925 14.1472 12.3789 14.1472 11.8094C14.1472 11.24 13.921 10.6938 13.5183 10.2911C13.1156 9.88847 12.5695 9.66225 12 9.66225Z",fill:"white"}),h.jsxs("mask",{id:"mask0_1571_205",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"5",y:"1",width:"15",height:"21",children:[h.jsx("path",{d:"M5.14941 1.07373H19.106V21.4719H5.14941V1.07373Z",fill:"white"}),h.jsx("path",{d:"M12.6409 1.61035C12.9169 1.61035 13.1466 1.8197 13.1863 2.09347C13.6442 5.2482 15.4741 7.95793 18.0518 9.59891C18.2558 9.72882 18.3578 9.97413 18.2961 10.2076L15.5418 20.5366C15.5112 20.6509 15.4438 20.752 15.3499 20.824C15.2561 20.896 15.141 20.935 15.0227 20.9349H8.97679C8.85856 20.9349 8.74364 20.8958 8.64988 20.8238C8.55611 20.7518 8.48875 20.6508 8.45825 20.5366L5.7045 10.2076C5.67486 10.0934 5.68253 9.97277 5.72638 9.86325C5.77022 9.75373 5.84795 9.6611 5.9482 9.59891C8.52588 7.95793 10.3558 5.2482 10.8142 2.09293C10.854 1.82024 11.0832 1.61035 11.3591 1.61035H12.6409ZM12 9.66225C11.4305 9.66225 10.8844 9.88847 10.4817 10.2911C10.0791 10.6938 9.85284 11.24 9.85284 11.8094C9.85284 12.3789 10.0791 12.925 10.4817 13.3277C10.8844 13.7304 11.4305 13.9566 12 13.9566C12.5695 13.9566 13.1156 13.7304 13.5183 13.3277C13.921 12.925 14.1472 12.3789 14.1472 11.8094C14.1472 11.24 13.921 10.6938 13.5183 10.2911C13.1156 9.88847 12.5695 9.66225 12 9.66225Z",fill:"black"})]}),h.jsx("g",{mask:"url(#mask0_1571_205)",children:h.jsx("path",{d:"M13.1863 2.09331L12.9206 2.13196C13.3903 5.36667 15.2664 8.14404 17.9074 9.82582L18.0523 9.59929L18.1962 9.37276C15.6824 7.77312 13.8986 5.12995 13.452 2.05466L13.1863 2.09331ZM18.296 10.208L18.0367 10.1388L15.2825 20.4677L15.5417 20.537L15.801 20.6057L18.5548 10.2773L18.296 10.208ZM15.0221 20.9348V20.6664H8.97675V21.2032H15.0227L15.0221 20.9348ZM8.45713 20.5365L8.71694 20.4667L5.96319 10.1382L5.70392 10.2075L5.44465 10.2767L8.1984 20.6052L8.45713 20.5365ZM5.9487 9.59822L6.09309 9.82528C8.73412 8.14351 10.6107 5.36614 11.0799 2.13142L10.8147 2.09277L10.549 2.05412C10.1024 5.12995 8.3181 7.77205 5.80483 9.37276L5.9487 9.59822ZM11.359 1.61019V1.87859H12.6409V1.3418H11.359V1.61019ZM12 9.66209V9.3937C11.3593 9.3937 10.7449 9.6482 10.2919 10.1012C9.83889 10.5542 9.5844 11.1686 9.5844 11.8093H10.1212C10.1212 11.311 10.3191 10.8331 10.6715 10.4808C11.0238 10.1284 11.5017 9.93049 12 9.93049V9.66209ZM9.85279 11.8093H9.5844C9.5844 12.4499 9.83889 13.0643 10.2919 13.5173C10.7449 13.9703 11.3593 14.2248 12 14.2248V13.688C11.5017 13.688 11.0238 13.4901 10.6715 13.1378C10.3191 12.7854 10.1212 12.3076 10.1212 11.8093H9.85279ZM12 13.9564V14.2248C12.6406 14.2248 13.255 13.9703 13.708 13.5173C14.161 13.0643 14.4155 12.4499 14.4155 11.8093H13.8787C13.8787 12.3076 13.6808 12.7854 13.3285 13.1378C12.9761 13.4901 12.4983 13.688 12 13.688V13.9564ZM14.1471 11.8093H14.4155C14.4155 11.1686 14.161 10.5542 13.708 10.1012C13.255 9.6482 12.6406 9.3937 12 9.3937V9.93049C12.4983 9.93049 12.9761 10.1284 13.3285 10.4808C13.6808 10.8331 13.8787 11.311 13.8787 11.8093H14.1471ZM10.8137 2.09331L11.0799 2.13142C11.0887 2.06294 11.1216 1.99985 11.1728 1.9535C11.224 1.90715 11.29 1.88059 11.359 1.87859V1.3418C10.9425 1.3418 10.6065 1.65689 10.5485 2.05412L10.8137 2.09331ZM5.70499 10.2069L5.96426 10.1377C5.9494 10.0786 5.95389 10.0163 5.97708 9.95998C6.00028 9.90364 6.04094 9.85624 6.09309 9.82474L5.9487 9.59822L5.80483 9.37169C5.65629 9.46442 5.54128 9.6022 5.47658 9.76492C5.41187 9.92764 5.40088 10.1068 5.44518 10.2762L5.70499 10.2069ZM8.97675 20.9348V20.6664C8.91763 20.6664 8.86017 20.6468 8.81329 20.6108C8.76641 20.5748 8.73273 20.5243 8.71748 20.4672L8.45821 20.5365L8.1984 20.6052C8.24408 20.7767 8.34569 20.9283 8.48646 21.0365C8.62722 21.1446 8.79978 21.2032 8.97728 21.2032L8.97675 20.9348ZM15.5417 20.537L15.2825 20.4667C15.2673 20.524 15.2336 20.5746 15.1866 20.6108C15.1396 20.6469 15.0819 20.6664 15.0227 20.6664V21.2032C15.2002 21.2032 15.3727 21.1446 15.5135 21.0365C15.6542 20.9283 15.7553 20.7772 15.801 20.6057L15.5417 20.537ZM18.0518 9.59875L17.9079 9.82528C18.018 9.89506 18.0668 10.0239 18.0367 10.1382L18.296 10.208L18.5553 10.2767C18.5995 10.1074 18.5884 9.92837 18.5237 9.76576C18.459 9.60315 18.3446 9.46546 18.1962 9.37276L18.0518 9.59875ZM13.1863 2.09331L13.452 2.05466C13.3946 1.65743 13.058 1.3418 12.6409 1.3418V1.87859C12.7762 1.87859 12.8991 1.98326 12.9206 2.13196L13.1863 2.09331Z",fill:"black","fill-opacity":"0.15"})}),h.jsx("mask",{id:"mask1_1571_205",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"5",y:"1",width:"14",height:"20",children:h.jsx("path",{d:"M12.6409 1.61035C12.9169 1.61035 13.1466 1.8197 13.1863 2.09347C13.6442 5.2482 15.4741 7.95793 18.0518 9.59891C18.2558 9.72882 18.3578 9.97413 18.2961 10.2076L15.5418 20.5366C15.5112 20.6509 15.4438 20.752 15.3499 20.824C15.2561 20.896 15.141 20.935 15.0227 20.9349H8.97679C8.85856 20.9349 8.74364 20.8958 8.64988 20.8238C8.55611 20.7518 8.48875 20.6508 8.45825 20.5366L5.7045 10.2076C5.67486 10.0934 5.68253 9.97277 5.72638 9.86325C5.77022 9.75373 5.84795 9.6611 5.9482 9.59891C8.52588 7.95793 10.3558 5.2482 10.8142 2.09293C10.854 1.82024 11.0832 1.61035 11.3591 1.61035H12.6409ZM12 9.66225C11.4305 9.66225 10.8844 9.88847 10.4817 10.2911C10.0791 10.6938 9.85284 11.24 9.85284 11.8094C9.85284 12.3789 10.0791 12.925 10.4817 13.3277C10.8844 13.7304 11.4305 13.9566 12 13.9566C12.5695 13.9566 13.1156 13.7304 13.5183 13.3277C13.921 12.925 14.1472 12.3789 14.1472 11.8094C14.1472 11.24 13.921 10.6938 13.5183 10.2911C13.1156 9.88847 12.5695 9.66225 12 9.66225Z",fill:"white"})}),h.jsxs("g",{mask:"url(#mask1_1571_205)",children:[h.jsxs("g",{opacity:"0.75",filter:"url(#filter0_f_1571_205)",children:[h.jsx("path",{d:"M13.1272 1.61035C13.4745 5.11347 15.5062 8.12058 18.4006 9.81256L15.4354 20.9349H8.56442L5.59863 9.81256C8.49356 8.12005 10.5253 5.11293 10.8726 1.61035H11.4631V9.17914C10.8114 9.31217 10.2323 9.68243 9.83812 10.2182C9.44391 10.7539 9.26267 11.4169 9.32952 12.0786C9.39637 12.7404 9.70656 13.3538 10.1999 13.7998C10.6933 14.2459 11.3348 14.4928 11.9999 14.4928C12.665 14.4928 13.3065 14.2459 13.7998 13.7998C14.2932 13.3538 14.6034 12.7404 14.6703 12.0786C14.7371 11.4169 14.5559 10.7539 14.1617 10.2182C13.7675 9.68243 13.1884 9.31217 12.5367 9.17914V1.61035H13.1272Z",fill:"url(#paint0_linear_1571_205)"}),h.jsx("path",{d:"M13.1272 1.61035C13.4745 5.11347 15.5062 8.12058 18.4006 9.81256L15.4354 20.9349H8.56442L5.59863 9.81256C8.49356 8.12005 10.5253 5.11293 10.8726 1.61035H11.4631V9.17914C10.8114 9.31217 10.2323 9.68243 9.83812 10.2182C9.44391 10.7539 9.26267 11.4169 9.32952 12.0786C9.39637 12.7404 9.70656 13.3538 10.1999 13.7998C10.6933 14.2459 11.3348 14.4928 11.9999 14.4928C12.665 14.4928 13.3065 14.2459 13.7998 13.7998C14.2932 13.3538 14.6034 12.7404 14.6703 12.0786C14.7371 11.4169 14.5559 10.7539 14.1617 10.2182C13.7675 9.68243 13.1884 9.31217 12.5367 9.17914V1.61035H13.1272Z",fill:"url(#paint1_linear_1571_205)"}),h.jsx("mask",{id:"mask2_1571_205",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"5",y:"1",width:"14",height:"20",children:h.jsx("path",{d:"M13.1272 1.61035C13.4745 5.11347 15.5062 8.12058 18.4006 9.81256L15.4354 20.9349H8.56442L5.59863 9.81256C8.49356 8.12005 10.5253 5.11293 10.8726 1.61035H11.4631V9.17914C10.8114 9.31217 10.2323 9.68243 9.83812 10.2182C9.44391 10.7539 9.26267 11.4169 9.32952 12.0786C9.39637 12.7404 9.70656 13.3538 10.1999 13.7998C10.6933 14.2459 11.3348 14.4928 11.9999 14.4928C12.665 14.4928 13.3065 14.2459 13.7998 13.7998C14.2932 13.3538 14.6034 12.7404 14.6703 12.0786C14.7371 11.4169 14.5559 10.7539 14.1617 10.2182C13.7675 9.68243 13.1884 9.31217 12.5367 9.17914V1.61035H13.1272Z",fill:"white"})}),h.jsx("g",{mask:"url(#mask2_1571_205)",children:h.jsx("path",{d:"M13.1272 1.61052L13.6608 1.55738L13.6124 1.07373H13.1272V1.61052ZM18.4006 9.81273L18.9197 9.95068L19.0249 9.5556L18.6717 9.34894L18.4006 9.81273ZM15.4354 20.9351V21.4719H15.8477L15.9539 21.0736L15.4354 20.9351ZM8.56444 20.9351L8.0459 21.0736L8.15218 21.4719H8.56444V20.9351ZM5.59866 9.81273L5.32758 9.34894L4.97437 9.55507L5.08011 9.95068L5.59866 9.81273ZM10.8727 1.61052V1.07373H10.3863L10.3385 1.55738L10.8727 1.61052ZM11.4631 1.61052H11.9999V1.07373H11.4631V1.61052ZM11.4631 9.17931L11.5699 9.70537L11.9994 9.61787V9.17931H11.4631ZM12.5367 9.17931H11.9994V9.61787L12.4294 9.70537L12.5367 9.17931ZM12.5367 1.61052V1.07373H11.9999V1.61052H12.5367ZM13.1272 1.61052L12.5925 1.66367C12.9576 5.34339 15.0918 8.50027 18.1301 10.276L18.4006 9.81219L18.6717 9.34894C15.9207 7.74124 13.9909 4.88389 13.6608 1.55738L13.1272 1.61052ZM18.4006 9.81273L17.8821 9.67423L14.9169 20.7966L15.4354 20.9351L15.9539 21.0736L18.9197 9.95068L18.4006 9.81273ZM15.4354 20.9351V20.3983H8.56444V21.4719H15.4354V20.9351ZM8.56444 20.9351L9.08298 20.7966L6.1172 9.67423L5.59866 9.81219L5.08011 9.95068L8.0459 21.0736L8.56444 20.9351ZM5.59866 9.81273L5.8692 10.276C8.90745 8.50027 11.0423 5.34339 11.4073 1.66367L10.8732 1.61052L10.3391 1.55738C10.009 4.88389 8.07918 7.74124 5.32758 9.34894L5.59866 9.81273ZM10.8727 1.61052V2.14732H11.4631V1.07373H10.8727V1.61052ZM11.4631 1.61052H10.9263V9.17931H11.9994L11.9999 1.61052H11.4631ZM11.4631 9.17931L11.3558 8.65325C10.6283 8.80175 9.97445 9.19704 9.50492 9.77221C9.03539 10.3474 8.77901 11.0671 8.77916 11.8096H9.85274C9.85262 11.3147 10.0235 10.8349 10.3364 10.4515C10.6493 10.068 11.0851 9.80447 11.5699 9.70537L11.4631 9.17931ZM9.31595 11.8096H8.77916C8.77916 12.6638 9.11849 13.483 9.7225 14.087C10.3265 14.691 11.1457 15.0304 11.9999 15.0304V13.9568C11.4305 13.9568 10.8843 13.7306 10.4816 13.3279C10.079 12.9252 9.85274 12.3791 9.85274 11.8096H9.31595ZM11.9999 14.4936V15.0304C12.8541 15.0304 13.6733 14.691 14.2773 14.087C14.8813 13.483 15.2207 12.6638 15.2207 11.8096H14.1471C14.1471 12.3791 13.9209 12.9252 13.5182 13.3279C13.1155 13.7306 12.5694 13.9568 11.9999 13.9568V14.4936ZM14.6839 11.8096H15.2207C15.2208 11.067 14.9643 10.3472 14.4947 9.77206C14.0251 9.19688 13.3711 8.80164 12.6435 8.65325L12.5367 9.17931L12.4299 9.70537C12.9148 9.80447 13.3505 10.068 13.6635 10.4515C13.9764 10.8349 14.1472 11.3147 14.1471 11.8096H14.6839ZM12.5367 9.17931H13.0735V1.61052H11.9999L11.9994 9.17931H12.5367ZM12.5367 1.61052V2.14732H13.1272V1.07373H12.5367V1.61052Z",fill:"white","fill-opacity":"0.5"})})]}),h.jsx("path",{d:"M12.0001 0.805176C12.0713 0.805176 12.1395 0.833453 12.1899 0.883787C12.2402 0.934121 12.2685 1.00239 12.2685 1.07357V10.7359C12.2685 10.807 12.2402 10.8753 12.1899 10.9256C12.1395 10.976 12.0713 11.0043 12.0001 11.0043C11.9289 11.0043 11.8606 10.976 11.8103 10.9256C11.76 10.8753 11.7317 10.807 11.7317 10.7359V1.07357C11.7317 1.00239 11.76 0.934121 11.8103 0.883787C11.8606 0.833453 11.9289 0.805176 12.0001 0.805176Z",fill:"black","fill-opacity":"0.15"}),h.jsxs("mask",{id:"mask3_1571_205",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"11",y:"0",width:"2",height:"12",children:[h.jsx("path",{d:"M11.1948 0.268555H12.8052V11.5412H11.1948V0.268555Z",fill:"white"}),h.jsx("path",{d:"M12.0001 0.805176C12.0713 0.805176 12.1395 0.833453 12.1899 0.883787C12.2402 0.934121 12.2685 1.00239 12.2685 1.07357V10.7359C12.2685 10.807 12.2402 10.8753 12.1899 10.9256C12.1395 10.976 12.0713 11.0043 12.0001 11.0043C11.9289 11.0043 11.8606 10.976 11.8103 10.9256C11.76 10.8753 11.7317 10.807 11.7317 10.7359V1.07357C11.7317 1.00239 11.76 0.934121 11.8103 0.883787C11.8606 0.833453 11.9289 0.805176 12.0001 0.805176Z",fill:"black"})]}),h.jsx("g",{mask:"url(#mask3_1571_205)",children:h.jsx("path",{d:"M12 0.805348V1.34214C11.9288 1.34214 11.8606 1.31386 11.8102 1.26353C11.7599 1.2132 11.7316 1.14493 11.7316 1.07374H12.8052C12.8052 0.860195 12.7204 0.655392 12.5694 0.504389C12.4184 0.353387 12.2136 0.268555 12 0.268555V0.805348ZM12.2684 1.07374H11.7316V10.736H12.8052V1.07374H12.2684ZM12.2684 10.736H11.7316C11.7316 10.6648 11.7599 10.5966 11.8102 10.5462C11.8606 10.4959 11.9288 10.4676 12 10.4676V11.5412C12.2136 11.5412 12.4184 11.4564 12.5694 11.3054C12.7204 11.1544 12.8052 10.9496 12.8052 10.736H12.2684ZM12 11.0044V10.4676C12.0712 10.4676 12.1395 10.4959 12.1898 10.5462C12.2401 10.5966 12.2684 10.6648 12.2684 10.736H11.1948C11.1948 10.9496 11.2797 11.1544 11.4307 11.3054C11.5817 11.4564 11.7865 11.5412 12 11.5412V11.0044ZM11.7316 10.736H12.2684V1.07374H11.1948V10.736H11.7316ZM11.7316 1.07374H12.2684C12.2684 1.14493 12.2401 1.2132 12.1898 1.26353C12.1395 1.31386 12.0712 1.34214 12 1.34214V0.268555C11.7865 0.268555 11.5817 0.353387 11.4307 0.504389C11.2797 0.655392 11.1948 0.860195 11.1948 1.07374H11.7316Z",fill:"white"})})]}),h.jsx("path",{d:"M5.55859 20.9348C5.55859 20.3653 5.78481 19.8192 6.18749 19.4165C6.59016 19.0138 7.1363 18.7876 7.70577 18.7876H16.2945C16.8639 18.7876 17.4101 19.0138 17.8127 19.4165C18.2154 19.8192 18.4416 20.3653 18.4416 20.9348V35.965H5.55859V20.9348Z",fill:"white"}),h.jsx("path",{d:"M16.2944 18.6538L16.4119 18.657C16.9958 18.6872 17.5459 18.9403 17.9485 19.3642C18.3512 19.7882 18.5757 20.3505 18.5758 20.9352V36.0996H5.42432V20.9352C5.42432 20.3301 5.66467 19.7498 6.09251 19.322C6.52036 18.8942 7.10063 18.6538 7.70569 18.6538H16.2944Z",stroke:"black","stroke-opacity":"0.15","stroke-width":"0.268397"}),h.jsx("mask",{id:"mask4_1571_205",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"5",y:"18",width:"14",height:"18",children:h.jsx("path",{d:"M5.55859 20.9353C5.55859 20.3658 5.78481 19.8197 6.18749 19.417C6.59016 19.0143 7.1363 18.7881 7.70577 18.7881H16.2945C16.8639 18.7881 17.4101 19.0143 17.8127 19.417C18.2154 19.8197 18.4416 20.3658 18.4416 20.9353V35.9655H5.55859V20.9353Z",fill:"white"})}),h.jsxs("g",{mask:"url(#mask4_1571_205)",children:[h.jsxs("g",{filter:"url(#filter1_dd_1571_205)",children:[h.jsx("path",{d:"M5.55859 20.9353C5.55859 20.3658 5.78481 19.8197 6.18749 19.417C6.59016 19.0143 7.1363 18.7881 7.70577 18.7881H16.2945C16.8639 18.7881 17.4101 19.0143 17.8127 19.417C18.2154 19.8197 18.4416 20.3658 18.4416 20.9353V35.9655H5.55859V20.9353Z",fill:"white"}),h.jsx("path",{d:"M16.2944 18.6543L16.4119 18.6575C16.9958 18.6876 17.5459 18.9408 17.9485 19.3647C18.3512 19.7887 18.5757 20.351 18.5758 20.9357V36.1001H5.42432V20.9357C5.42432 20.3306 5.66467 19.7503 6.09251 19.3225C6.52036 18.8947 7.10063 18.6543 7.70569 18.6543H16.2944Z",stroke:"black","stroke-opacity":"0.15","stroke-width":"0.268397"})]}),h.jsxs("g",{opacity:"0.75",filter:"url(#filter2_f_1571_205)",children:[h.jsx("path",{d:"M5.55859 20.9353C5.55859 20.3658 5.78481 19.8197 6.18749 19.417C6.59016 19.0143 7.1363 18.7881 7.70577 18.7881H16.2945C16.8639 18.7881 17.4101 19.0143 17.8127 19.417C18.2154 19.8197 18.4416 20.3658 18.4416 20.9353V35.9655H5.55859V20.9353Z",fill:"url(#paint2_linear_1571_205)"}),h.jsx("path",{d:"M7.70568 19.0566H16.2944C16.7927 19.0566 17.2705 19.2546 17.6229 19.6069C17.9752 19.9593 18.1732 20.4371 18.1732 20.9354V35.6972H5.8269V20.9354C5.82695 20.4539 6.01189 19.9908 6.34352 19.6417C6.67515 19.2925 7.12817 19.0841 7.60906 19.0593L7.70568 19.0566Z",stroke:"white","stroke-opacity":"0.5","stroke-width":"0.536793"})]})]})]})}),h.jsxs("defs",{children:[h.jsxs("filter",{id:"filter0_f_1571_205",x:"4.52505",y:"0.536765",width:"14.9492",height:"21.4719",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"0.536793",result:"effect1_foregroundBlur_1571_205"})]}),h.jsxs("filter",{id:"filter1_dd_1571_205",x:"3.14287",y:"17.4464",width:"17.7143",height:"22.0087",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),h.jsx("feOffset",{dy:"0.536793"}),h.jsx("feGaussianBlur",{stdDeviation:"0.536793"}),h.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"}),h.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_1571_205"}),h.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),h.jsx("feOffset",{dy:"1.07359"}),h.jsx("feGaussianBlur",{stdDeviation:"1.07359"}),h.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),h.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"}),h.jsx("feBlend",{mode:"normal",in2:"effect1_dropShadow_1571_205",result:"effect2_dropShadow_1571_205"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect2_dropShadow_1571_205",result:"shape"})]}),h.jsxs("filter",{id:"filter2_f_1571_205",x:"4.48501",y:"17.7145",width:"15.0302",height:"19.3249",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"0.536793",result:"effect1_foregroundBlur_1571_205"})]}),h.jsxs("linearGradient",{id:"paint0_linear_1571_205",x1:"4.53739",y1:"10.1244",x2:"19.4624",y2:"10.1244",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{offset:"0.49","stop-color":"#999999","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-color":"#999999"})]}),h.jsxs("linearGradient",{id:"paint1_linear_1571_205",x1:"10.134",y1:"1.36987",x2:"13.2506",y2:"18.9257",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{offset:"0.726","stop-color":"#999999","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-color":"#999999"})]}),h.jsxs("linearGradient",{id:"paint2_linear_1571_205",x1:"5.55859",y1:"27.3768",x2:"18.4416",y2:"27.3768",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-color":"#AAAAAA","stop-opacity":"0.5"}),h.jsx("stop",{offset:"0.394","stop-color":"#AAAAAA","stop-opacity":"0"}),h.jsx("stop",{offset:"0.832","stop-color":"#999999"})]}),h.jsx("clipPath",{id:"clip0_1571_205",children:h.jsx("rect",{width:"24",height:"24",fill:"white"})}),h.jsx("clipPath",{id:"clip1_1571_205",children:h.jsx("rect",{width:"18.251",height:"36.502",fill:"white",transform:"translate(2.87451)"})})]})]})}function jae({className:t,color:e}){return h.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsxs("g",{"clip-path":"url(#clip0_1538_150)",children:[h.jsx("path",{d:"M7.95337 5.71142C7.95337 5.36004 8.16295 5.04253 8.48605 4.9044L13.7522 2.65314C14.3313 2.40559 14.9748 2.83041 14.9748 3.46017L14.9748 10.9073L7.95337 10.9073L7.95337 5.71142Z",fill:e||"#FFEE00"}),h.jsx("path",{d:"M7.95337 5.71142C7.95337 5.36004 8.16295 5.04253 8.48605 4.9044L13.7522 2.65314C14.3313 2.40559 14.9748 2.83041 14.9748 3.46017L14.9748 10.9073L7.95337 10.9073L7.95337 5.71142Z",fill:"url(#paint0_linear_1538_150)"}),h.jsx("path",{d:"M14.0947 2.62097C14.4884 2.45264 14.9256 2.74131 14.9259 3.16947L14.9259 10.9171L8.00098 10.9171L8.00098 5.61955L8.00798 5.53139C8.03836 5.32877 8.17118 5.15321 8.36338 5.07104L14.0947 2.62097Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.1"}),h.jsx("path",{d:"M8.21993 10.3188C7.31667 10.3188 6.58444 11.0468 6.58444 11.9446C6.58444 17.2642 4.51919 21.2529 0.638381 24.8865C0.238494 25.2609 0.000244048 25.7803 0.000244045 26.3283L0.000244012 31.8114C0.000244008 32.6027 0.641734 33.2442 1.43307 33.2444L21.4927 33.2444C22.2841 33.2444 22.9255 32.6029 22.9255 31.8115L22.9255 26.3283C22.9255 25.7805 22.6873 25.2611 22.2874 24.8867C18.4065 21.253 16.3414 17.2643 16.3414 11.9447C16.3414 11.0469 15.6091 10.3189 14.7059 10.3189L8.21993 10.3188Z",fill:"url(#paint1_linear_1538_150)","fill-opacity":"0.6"}),h.jsx("path",{d:"M8.24279 10.6406C7.34604 10.6406 6.61908 11.3633 6.61908 12.2547C6.61908 17.536 4.56869 21.496 0.715818 25.1035C0.31881 25.4752 0.0822753 25.9908 0.0822753 26.5348L0.0822753 31.9784C0.0822753 32.7641 0.719147 33.4009 1.50478 33.4011L21.42 33.4011C22.2057 33.4011 22.8425 32.7642 22.8425 31.9786L22.8425 26.5348C22.8425 25.991 22.606 25.4753 22.2089 25.1036C18.3561 21.4961 16.3058 17.5361 16.3058 12.2548C16.3058 11.3634 15.5788 10.6407 14.682 10.6407L8.24279 10.6406Z",fill:"white"}),h.jsx("path",{d:"M8.22911 10.9165L14.716 10.9165C15.4232 10.9167 15.9935 11.4863 15.9935 12.1842C15.9935 17.6193 18.1121 21.6982 22.0522 25.3875C22.3839 25.698 22.5768 26.1242 22.5769 26.567L22.5769 32.0507C22.5769 32.6442 22.0958 33.1253 21.5023 33.1253L1.44278 33.1253L1.33224 33.1197C0.790689 33.0643 0.368164 32.6068 0.368164 32.0507L0.368164 26.567C0.368322 26.1795 0.516175 25.8049 0.775344 25.5093L0.892879 25.3875C4.83304 21.6982 6.95297 17.6193 6.95299 12.1842C6.95299 11.5297 7.45337 10.9885 8.09898 10.9235L8.22911 10.9165Z",stroke:"black","stroke-opacity":"0.3","stroke-width":"0.5"}),h.jsx("g",{opacity:"0.1",filter:"url(#filter0_f_1538_150)",children:h.jsx("path",{d:"M15.2885 12.2295L11.9453 12.2295L11.9453 31.8116L21.4975 31.8116L21.4975 26.0801C18.6319 23.2145 15.2885 20.8266 15.2885 12.2295Z",fill:"black"})})]}),h.jsxs("defs",{children:[h.jsxs("filter",{id:"filter0_f_1538_150",x:"9.94529",y:"10.2295",width:"13.5523",height:"23.5821",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB",children:[h.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),h.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),h.jsx("feGaussianBlur",{stdDeviation:"1.00001",result:"effect1_foregroundBlur_1538_150"})]}),h.jsxs("linearGradient",{id:"paint0_linear_1538_150",x1:"11.4641",y1:"3.00812",x2:"11.4641",y2:"8.71307",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-color":"white","stop-opacity":"0.8"}),h.jsx("stop",{offset:"1","stop-color":"white","stop-opacity":"0"})]}),h.jsxs("linearGradient",{id:"paint1_linear_1538_150",x1:"0.000244031",y1:"28.7867",x2:"22.9255",y2:"28.7867",gradientUnits:"userSpaceOnUse",children:[h.jsx("stop",{"stop-opacity":"0.1"}),h.jsx("stop",{offset:"0.4","stop-opacity":"0"}),h.jsx("stop",{offset:"1","stop-opacity":"0.15"})]}),h.jsx("clipPath",{id:"clip0_1538_150",children:h.jsx("rect",{width:"24",height:"24",fill:"white"})})]})]})}const kM="flex h-10 w-10 cursor-[var(--drawo-cursor-pointer),auto] items-center justify-center rounded-[10px] border-none bg-transparent p-[10px] text-[13px] font-medium text-black shadow-none outline-none transition-[0.1s] hover:bg-[rgba(var(--text-rgb),0.1)] dark:text-[#e5e7eb] [&_svg]:size-5",Hae="bg-(--accent) text-white dark:bg-(--accent-dark)",Hs=t=>kM+(t?" "+Hae:""),Bd="mx-1 my-auto h-5 w-px border-l border-[rgb(var(--text-rgb))] opacity-30",lb="flex items-center justify-center [&_svg]:h-auto [&_svg]:w-[180px]",OM=({interactionMode:t,drawingTool:e,isPresentationMode:r,messages:n,setInteractionMode:i,setDrawingTool:a,drawDefaults:s,invertPaletteInDarkMode:o,strokeColors:A,onDrawDefaultStrokeColorChange:l,onDrawDefaultStrokeWidthChange:u,onSelectImageFiles:c})=>{const[d,f]=H.useState(!1),v=H.useRef(null),p=D=>{r&&D!=="pan"||i(D)},C=D=>{r||a(D)},w=()=>e==="marker"?"marker":e==="quill"?"quill":"draw",[g,b]=H.useState(e==="marker"?s.markerStroke:e==="quill"?s.quillStroke:s.drawStroke),B=e==="marker"?xf:JA,E=e==="marker"?lO:l0,F=D=>o?z0(D):D,O=e==="marker"?s.markerStroke:e==="quill"?s.quillStroke:s.drawStroke;H.useEffect(()=>{b(O)},[O]);const I=D=>{const L=D.hexa||D.hex;if(L){b(L);const P=w();l(P,L)}},k=(D,L)=>{const P=D[L]??D[0];return P?h.jsx("svg",{width:P.width,height:P.height,viewBox:P.viewBox,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:P.path,stroke:P.strokeWidth?"currentColor":void 0,strokeWidth:P.strokeWidth,strokeLinecap:P.strokeWidth?"round":void 0,fill:P.fill})}):null},j=["draw","marker","quill"];return h.jsxs("div",{className:"absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center gap-px rounded-[15px] border border-(--panel-border) bg-(--panel-bg) p-2 shadow-(--panel-shadow) backdrop-blur-3xl [corner-shape:squircle] [.drawo-presentation-mode_&]:translate-y-[200%]",children:[h.jsx("input",{ref:v,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:D=>{const L=Array.from(D.target.files??[]).filter(P=>P.type.startsWith("image/"));L.length>0&&c(L),D.currentTarget.value=""}}),j.includes(e)?h.jsxs("div",{className:"absolute bottom-full left-1/2 z-10 flex -translate-x-1/2 -translate-y-2 items-center gap-px rounded-[15px] border border-(--panel-border) bg-(--panel-bg) p-1 shadow-(--panel-shadow) backdrop-blur-3xl [corner-shape:squircle]",children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:`${Hs(e==="draw")} group overflow-hidden`,onClick:()=>{p("select"),C("draw"),f(!1)},children:h.jsx(_ae,{color:F(s.drawStroke),className:"scale-[2] translate-y-[2px] transition-[0.1s] group-hover:translate-y-0"})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.pen})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:`${Hs(e==="quill")} group overflow-hidden`,onClick:()=>{p("select"),C("quill"),f(!1)},children:h.jsx(Qae,{color:F(s.quillStroke),className:"scale-[2] translate-y-[2px] transition-[0.1s] group-hover:translate-y-0"})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.quill})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:`${Hs(e==="marker")} group overflow-hidden`,onClick:()=>{p("select"),C("marker"),f(!1)},children:h.jsx(jae,{color:F(s.markerStroke),className:"scale-[2] translate-y-[2px] transition-[0.1s] group-hover:translate-y-0"})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.marker})})]}),h.jsx("div",{className:Bd}),h.jsx(ko,{colors:A,currentColor:O,uniColor:F,renderItem:({color:D,swatch:L})=>h.jsx("div",{className:"float-left w-fit shrink-0 rounded-full bg-transparent p-[4px_1px]! transition-[0.1s] hover:scale-105",onClick:()=>{if(D==="multi"){f(P=>!P);return}f(!1),I({hex:D})},children:L},D)}),h.jsxs(Nr,{open:d,children:[h.jsx(Pr,{asChild:!0,children:h.jsx("span",{style:{opacity:0},children:"."})}),h.jsx(Rr,{className:"drawo-content-color inferior shadow-none ![transform:translateY(-20px)]",side:"bottom",style:{background:"transparent",padding:0},onPointerDown:D=>D.stopPropagation(),children:h.jsx(gu,{color:g,onChange:I})})]}),h.jsx("div",{className:Bd}),h.jsxs(Pa,{value:String(e==="marker"?s.markerStrokeWidth:e==="quill"?s.quillStrokeWidth:s.drawStrokeWidth),onValueChange:D=>{const L=w();u(L,Number(D))},children:[h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx(Ra,{noArrow:!0,className:"flex h-10 w-[94.7px] cursor-[var(--drawo-cursor-pointer),auto] items-center justify-center gap-0 rounded-[24px] border-none bg-transparent p-3 text-current shadow-none outline-none transition-[0.1s] hover:bg-[rgba(var(--text-rgb),0.1)] [corner-shape:squircle]",children:h.jsx("span",{className:`${lb} [&_svg]:[transform:scaleX(0.4)_translateX(-76%)]`,children:(()=>{const D=e==="marker"?s.markerStrokeWidth:e==="quill"?s.quillStrokeWidth:s.drawStrokeWidth,L=Math.max(0,B.findIndex(P=>P===D));return k(E,L)})()})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.selectionBar?.strokeWidth||"Stroke Width"})})]}),h.jsx(Ua,{position:"popper",children:B.map((D,L)=>h.jsx(qr,{check:!1,value:String(D),className:"flex p-[7px_8px]! [&_*]:w-full",children:h.jsx("span",{className:lb,children:k(E,L)})},D))})]})]}):h.jsx(h.Fragment,{}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(t==="select"&&!e),onClick:()=>{p("select"),C(null)},children:h.jsx(vT,{style:{transform:"translateY(-2px) translateX(-3px) rotate(-46deg)"},strokeWidth:.1})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.selection})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(t==="pan"),onClick:()=>{p("pan"),C(null)},children:h.jsx(nY,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.pan})})]}),h.jsx("div",{className:Bd}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="text"),onClick:()=>{p("select"),C("text")},children:h.jsx(y7,{strokeWidth:.1})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.text})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="rectangle"),onClick:()=>{p("select"),C("rectangle")},children:h.jsx(aY,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.rectangle})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="circle"),onClick:()=>{p("select"),C("circle")},children:h.jsx(O$,{strokeWidth:1.5})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.ellipse})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="line"),onClick:()=>{p("select"),C("line")},children:h.jsx(oY,{style:{scale:"1.2"}})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.line})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(j.includes(e)),onClick:()=>{p("select"),C("draw")},children:h.jsx(mT,{strokeWidth:1.5})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.draw})})]}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:kM,onClick:()=>{p("select"),C(null),v.current?.click()},children:h.jsx(sY,{})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.image})})]}),h.jsx("div",{className:Bd}),h.jsxs(Nr,{children:[h.jsx(Pr,{asChild:!0,children:h.jsx("button",{type:"button",className:Hs(e==="laser"),onClick:()=>{p("select"),C("laser")},children:h.jsx(iY,{strokeWidth:1.5})})}),h.jsx(Rr,{children:h.jsx("p",{children:n.toolNames.laser})})]})]})};function o2(){const t=xA(),{scene:e,resolvedTheme:r,isDarkMode:n,isPresentationMode:i,interactionMode:a,drawingTool:s,messages:o,setInteractionMode:A,setDrawingTool:l,handlers:u}=t;return h.jsx(OM,{interactionMode:a,drawingTool:s,isPresentationMode:i,messages:o,setInteractionMode:A,setDrawingTool:l,drawDefaults:e.settings.drawDefaults,invertPaletteInDarkMode:n&&e.settings.colorScheme==="drawo",strokeColors:r.preset.strokeColors,onDrawDefaultStrokeColorChange:u.handleDrawDefaultStrokeColorChange,onDrawDefaultStrokeWidthChange:u.handleDrawDefaultStrokeWidthChange,onSelectImageFiles:c=>u.handleInsertImageFiles?.(c)})}function TM({canUndo:t,canRedo:e,onUndo:r,onRedo:n}){return h.jsxs("div",{className:"undo-bar flex overflow-hidden gap-0 rounded-xl border border-(--panel-border) bg-white text-[rgb(var(--text-rgb))] shadow-(--panel-shadow) [corner-shape:squircle] transition-[0.4s_ease-in-out] dark:bg-(--popover-dark,#1f1f1f) dark:backdrop-blur-3xl [&_button]:flex [&_button]:size-9 [&_button]:items-center [&_button]:justify-center [&_button]:border-none [&_button]:bg-transparent [&_button]:p-2 [&_button]:transition-[0.1s] [&_button:hover:not([disabled])]:bg-[rgba(var(--text-rgb),0.06)] [&_button:active:not([disabled])_svg]:scale-90 [&_button:disabled]:cursor-not-allowed [&_button:disabled]:opacity-50 [&_button:disabled]:backdrop-blur-[brightness(0.8)] [&_svg]:size-[18px] [&_svg]:transition-[0.1s]",children:[h.jsx("button",{type:"button",onClick:r,disabled:!t,"aria-label":"Undo",children:h.jsx(Q$,{})}),h.jsx("button",{type:"button",onClick:n,disabled:!e,"aria-label":"Redo",children:h.jsx(j$,{})})]})}function A2(){const t=xA(),{canUndo:e,canRedo:r,undo:n,redo:i}=t;return h.jsx("div",{className:"drawo-bottomleft-bar",children:h.jsx(TM,{canUndo:e,canRedo:r,onUndo:n,onRedo:i})})}function MM({zoomPercent:t,canZoomOut:e,canZoomIn:r,onZoomOut:n,onZoomIn:i,onZoomReset:a}){const s=Math.max(0,Math.min(200,t));return h.jsxs("div",{className:"zoom-bar flex overflow-hidden gap-0 rounded-xl border border-(--panel-border) bg-white text-[rgb(var(--text-rgb))] shadow-(--panel-shadow) [corner-shape:squircle] transition-[0.2s_ease-in-out] dark:bg-(--popover-dark,#1f1f1f) dark:backdrop-blur-3xl [&_button]:flex [&_button]:size-9 [&_button]:items-center [&_button]:justify-center [&_button]:border-none [&_button]:bg-transparent [&_button]:p-2 [&_button]:transition-[0.1s] [&_button:hover:not([disabled])]:bg-[rgba(var(--text-rgb),0.06)] [&_button:active:not([disabled])_svg]:scale-90 [&_button:disabled]:cursor-not-allowed [&_button:disabled]:opacity-50 [&_svg]:size-[18px] [&_svg]:transition-[0.1s]",children:[h.jsx("button",{type:"button",onClick:n,disabled:!e,"aria-label":"Zoom out",children:h.jsx(sT,{strokeWidth:1})}),h.jsx("div",{className:"my-auto flex h-[70%] w-px border-l border-[rgba(var(--text-rgb),0.1)]"}),h.jsx("button",{type:"button",onClick:a,"aria-label":"Reset zoom",children:h.jsxs("span",{children:[s,"%"]})}),h.jsx("div",{className:"my-auto flex h-[70%] w-px border-l border-[rgba(var(--text-rgb),0.1)]"}),h.jsx("button",{type:"button",onClick:i,disabled:!r,"aria-label":"Zoom in",children:h.jsx(oT,{strokeWidth:1})})]})}function l2(){const t=xA(),{scene:e,handlers:r}=t;return h.jsx("div",{className:"drawo-bottomright-bar",children:h.jsx(MM,{zoomPercent:Math.round(e.camera.zoom*100),canZoomOut:e.camera.zoom>z2,canZoomIn:e.camera.zoom<G2,onZoomOut:r.handleZoomOut,onZoomIn:r.handleZoomIn,onZoomReset:r.handleZoomReset})})}function K7({children:t,config:e}){const r=xA(),{scene:n,messages:i,handlers:a}=r;if(n.elements.length>0||!(e?.enabled??!0))return null;const o=e?.render;return o?h.jsx("div",{style:e?.style,className:e?.className,children:o({messages:i,onInsertImage:()=>{const A=document.createElement("input");A.type="file",A.accept="image/*",A.multiple=!0,A.onchange=l=>{const u=Array.from(l.target.files??[]);u.length>0&&a.handleInsertImageFiles?.(u)},A.click()}})}):h.jsx("div",{style:{...e?.style,position:"absolute",left:"50%",top:"50%",display:"flex",justifyContent:"center",alignItems:"center",opacity:.5,flexDirection:"column",transform:"translate(-50%, -50%)",userSelect:"none"},className:e?.className,children:t??h.jsx(cM,{})})}const Kae=[{id:"basic",name:"Basic",description:"General shapes and utilities"},{id:"flowchart",name:"Flowchart",description:"Flowchart symbols"},{id:"bpmn",name:"BPMN",description:"BPMN process symbols"},{id:"network",name:"Network",description:"Network infrastructure"},{id:"cloud",name:"Cloud",description:"Cloud services"},{id:"devops",name:"DevOps",description:"DevOps tools"},{id:"security",name:"Security",description:"Security & access"},{id:"devices",name:"Devices",description:"Hardware devices"},{id:"data",name:"Data",description:"Data storage & databases"},{id:"people",name:"People",description:"Users and roles"},{id:"communication",name:"Communication",description:"Messaging & APIs"},{id:"programs",name:"Programs",description:"Software & IDEs"},{id:"languages",name:"Languages",description:"Programming languages"},{id:"aws",name:"AWS",description:"Amazon Web Services"},{id:"custom",name:"Custom",description:"Custom assets"}],NM=[],Yp={categories:Kae,assets:NM};function Vae(t,e){const r=t.toLowerCase().trim();let n=NM;return e?.categoryId&&(n=n.filter(i=>i.categoryId===e.categoryId)),r?n.filter(i=>i.name.toLowerCase().includes(r)||i.tags.some(a=>a.toLowerCase().includes(r))):n}const ub=t=>null,Wae=(t,e,r,n,i)=>{const a=ub(),s=ub();if(!a&&!s&&null===null)return;const A=l=>{a&&l.getAttribute("fill")!=="none"&&l.setAttribute("fill",a),s&&i!=="none"&&l.getAttribute("stroke")!=="none"&&l.setAttribute("stroke",s)};A(t),t.querySelectorAll("*").forEach(l=>A(l))},qae=(t,e)=>{if(typeof window>"u")return"";const i=new window.DOMParser().parseFromString(t,"image/svg+xml").documentElement;if(!(i instanceof window.SVGElement)||i.tagName.toLowerCase()!=="svg")return"";Wae(i,e?.fill,e?.stroke,e?.strokeWidth,e?.strokeStyle);const a=i.outerHTML;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(a)}`},bm=t=>t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),cb=t=>Xf(t).map(e=>e.runs.map(r=>r.text).join("")).join(`
218
218
  `).trim(),zae=t=>{if(t.type==="text"){const e=cb(t.text);return e?{id:t.id,label:"Text",typeLabel:"Text",text:e}:null}if(t.type==="rectangle"||t.type==="circle"){const e=cb(t.text);return e?{id:t.id,label:t.type==="rectangle"?"Rectángulo":"Círculo",typeLabel:"Shape",text:e}:null}return null},Gae=(t,e)=>{if(!e)return t;const n=bm(t).indexOf(e);if(n<0)return t;const i=Math.max(0,n-28),a=Math.min(t.length,n+e.length+48),s=i>0?"...":"",o=a<t.length?"...":"";return`${s}${t.slice(i,a)}${o}`},$ae=`@keyframes drawo-sidebar-page-in {
219
219
  from {
220
220
  opacity: 0;