@baique/pi-web-sky 0.1.36 → 0.1.38
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +11 -11
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +2 -2
- package/.next/required-server-files.js +2 -2
- package/.next/required-server-files.json +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/app-update/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +11 -11
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{5315.7e72d26a3ad3bd9a.js → 5315.dba7515ae6e139ae.js} +1 -1
- package/.next/static/chunks/{7999.f4ab221861378788.js → 7999.879d5a20e8641752.js} +1 -1
- package/.next/static/chunks/app/{layout-ebbc0d287267b07b.js → layout-8d43a5f5cb228adb.js} +1 -1
- package/.next/static/chunks/app/{page-e568623a44c67606.js → page-c18559cf60413a65.js} +2 -2
- package/.next/static/chunks/{webpack-2e4e348867a555cd.js → webpack-4bbf04891e910713.js} +1 -1
- package/.next/trace +48 -8
- package/.next/trace-build +1 -1
- package/README.md +12 -1
- package/THIRD_PARTY_NOTICES.md +113 -0
- package/package.json +3 -1
- package/public/icons/apple-touch-icon.png +0 -0
- package/public/icons/icon-192.png +0 -0
- package/public/icons/icon-512.png +0 -0
- /package/.next/static/{EoBw3VYlygpr1EqlVOa5b → uMxGf7jVVswENHUfDPlFN}/_buildManifest.js +0 -0
- /package/.next/static/{EoBw3VYlygpr1EqlVOa5b → uMxGf7jVVswENHUfDPlFN}/_ssgManifest.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7999],{1015:(e,t,n)=>{"use strict";n.d(t,{p:()=>a,t:()=>s});var r=n(95155),i=n(12115);let o={error:null};class s extends i.Component{static getDerivedStateFromError(e){return{error:e}}state=o;componentDidCatch(e){this.props.onError?.(e)}render(){let{error:e}=this.state;if(null!==e){let{fallback:t}=this.props;return(0,r.jsx)(t,{error:e})}return this.props.children}}function a({children:e,fallback:t,...n}){return null===t?e:(0,r.jsx)(s,{fallback:t,...n,children:e})}},1793:(e,t,n)=>{"use strict";n.d(t,{V:()=>s});var r=n(83102),i=n(24167);function o(e){let t=e.get(),n=new Map;for(let e of t){let{fromId:t,toId:r}=e,i=n.get(t);i?i.push(e):n.set(t,[e]);let o=n.get(r);o?o.push(e):n.set(r,[e])}return n}function s(e){let{store:t}=e,n=t.query.filterHistory("binding"),s=t.query.records("binding");return(0,r.EW)("arrowBindingsIndex",(e,t)=>{let a;if((0,r._O)(e))return o(s);let l=n.getDiffSince(t);if(l===r.c2)return o(s);function d(t){let n=(a??=new Map(e)).get(t.fromId),r=n?.filter(e=>e.id!==t.id);r?.length?a.set(t.fromId,r):a.delete(t.fromId);let i=a.get(t.toId),o=i?.filter(e=>e.id!==t.id);o?.length?a.set(t.toId,o):a.delete(t.toId)}function c(t){let n=(a??=new Map(e)).get(t);return n?n===e.get(t)&&(n=n.slice(0),a.set(t,n)):(n=[],a.set(t,n)),n}function h(e){c(e.fromId).push(e),c(e.toId).push(e)}for(let e of l){for(let t of(0,i.Ic)(e.added))h(t);for(let[t,n]of(0,i.Ic)(e.updated))d(t),h(n);for(let t of(0,i.Ic)(e.removed))d(t)}return a??e})}},1933:(e,t,n)=>{"use strict";n.d(t,{jH:()=>s});var r=n(12115);n(95155);var i=Object.defineProperty,o=r.createContext(void 0);function s(e){let t=r.useContext(o);return e||t||"ltr"}i(s,"name",{value:"useDirection",configurable:!0})},2311:(e,t,n)=>{"use strict";let r;n.d(t,{W:()=>ei});var i=n(24167),o=n(47650),s=n(12669),a=n(48077);function l(e,t){let n=new i.Qn(100);return async function(r){let o=n.get(r);if(o)return o;let s=(async()=>{try{let n=await (0,i.hd)(r,t);return(0,i.vA)(n.ok),await e(n)}catch(e){return console.error(e),null}})();return n.set(r,s),s}}let d=l(async e=>await i.Sm.blobToDataUrl(await e.blob()));function c(e,t){return e.replaceWith(t),t}async function h(e,t,n){let r=e.createElement("img");n&&Array.from(n.attributes).forEach(e=>{r.setAttribute(e.name,e.value)}),r.setAttribute("src",t??"data:"),r.setAttribute("decoding","sync"),r.setAttribute("loading","eager");try{await r.decode()}catch{}return r}async function u(e){let t=e.ownerDocument;try{let n=e.toDataURL();return await h(t,n,e)}catch{return await h(t,null,e)}}async function p(e){let t=e.ownerDocument;try{let n=await i.K4.getVideoFrameAsDataUrl(e);return h(t,n,e)}catch(e){console.error("Could not get video frame",e)}return e.poster?h(t,await d(e.poster),e):h(t,null,e)}async function f(e){let t=(0,a.mD)(e);if(e instanceof t.HTMLCanvasElement)return c(e,await u(e));if(e instanceof t.HTMLVideoElement)return c(e,await p(e));if(e instanceof t.HTMLImageElement){let t=e.currentSrc||e.src,n=await d(t);e.setAttribute("src",n??"data:"),e.setAttribute("decoding","sync"),e.setAttribute("loading","eager");try{await e.decode()}catch{}return e}e instanceof t.HTMLInputElement?e.setAttribute("value",e.value):e instanceof t.HTMLTextAreaElement&&(e.textContent=e.value);await Promise.all(Array.from((0,a.$3)(e),e=>f(e)))}let g=/@import\s+(?:"([^"]+)"|'([^']+)'|url\s*\(\s*(?:"([^"]+)"|'([^']+)'|([^'")]+))\s*\))([^;]+);/gi,m=/@font-face\s*{([^}]+)}/gi,y=/url\s*\(\s*(?:"([^"]+)"|'([^']+)'|([^'")]+))\s*\)/gi,b=/(?:^|;)\s*font-family\s*:\s*(?:([^'"][^;\n]+)|"([^"]+)"|'([^']+)')\s*(?:;|$)/gi;function x(e,t){return Array.from(e.matchAll(m),e=>{let n=e[1],r=Array.from(n.matchAll(y),e=>{let n=e[1]||e[2]||e[3];return{original:n,resolved:(0,i.yC)(n,t)?.href??null}}),o=new Set(Array.from(n.matchAll(b),e=>(e[1]||e[2]||e[3]).toLowerCase()));return{fontFace:n,urls:r,fontFamilies:o}})}function w(e){return!(e.startsWith("-")||e.startsWith("animation")||e.startsWith("transition"))&&"cursor"!==e&&"pointer-events"!==e&&"user-select"!==e&&"touch-action"!==e}var v=Object.defineProperty,S=Object.getOwnPropertyDescriptor;let C="tldraw-svg-export";class k{fontFacesPromise=null;foundFontNames=new Set;fontFacesToEmbed=new Set;pendingPromises=[];startFindingDocumentFontFaces(e){(0,i.vA)(!this.fontFacesPromise,"FontEmbedder already started"),this.fontFacesPromise=P(e)}onFontFamilyValue(e){for(let t of((0,i.vA)(this.fontFacesPromise,"FontEmbedder not started"),function(e){let t=/\s*(?:([^'"][^;\n\s,]+)|"([^"]+)"|'([^']+)')\s*/gi,n=/\s*,\s*/gi,r=new Set;for(;;){let i=t.exec(e);if(!i)break;let o=i[1]||i[2]||i[3];if(r.add(o.toLowerCase()),n.lastIndex=t.lastIndex,!n.exec(e))break;t.lastIndex=n.lastIndex}return r}(e))){if(this.foundFontNames.has(t))return;this.foundFontNames.add(t),this.pendingPromises.push(this.fontFacesPromise.then(e=>{for(let n of e.filter(e=>e.fontFamilies.has(t)))if(!this.fontFacesToEmbed.has(n))for(let e of(this.fontFacesToEmbed.add(n),n.urls))e.resolved&&!e.embedded&&(e.embedded=d(e.resolved))}))}}async createCss(){await Promise.all(this.pendingPromises);let e="";for(let t of this.fontFacesToEmbed){let n=`@font-face {${t.fontFace}}`;for(let e of t.urls){if(!e.embedded)continue;let t=await e.embedded;t&&(n=n.replace(e.original,t))}e+=n}return e}}async function P(e){let t=e.defaultView??globalThis,n=[];for(let r of Array.from(e.styleSheets).filter(e=>!e.ownerNode?.closest(`.${C}`))){let i;try{i=r.cssRules}catch{}if(i){for(let i of r.cssRules)if(i instanceof t.CSSFontFaceRule)n.push(x(i.cssText,r.href??e.baseURI));else if(i instanceof t.CSSImportRule){let t=new URL(i.href,i.parentStyleSheet?.href??e.baseURI);n.push(T(t.href))}}else r.href&&n.push(T(r.href))}return(0,i.oE)(await Promise.all(n)).flat()}((e,t,n)=>{for(var r,i=S(t,n),o=e.length-1;o>=0;o--)(r=e[o])&&(i=r(t,n,i)||i);return i&&v(t,n,i)})([i.oI],k.prototype,"onFontFamilyValue");let T=l(async e=>{var t,n;let r=(t=await e.text(),n=e.url,{imports:Array.from(t.matchAll(g),e=>({url:e[1]||e[2]||e[3]||e[4]||e[5],extras:e[6]})),fontFaces:x(t,n)}),o=await Promise.all(r.imports.map(({url:t})=>T(new URL(t,e.url).href)));return[...r.fontFaces,...(0,i.oE)(o).flat()]});var E=n(95155),I=n(27394),_=n(12115),M=n(1015),A=n(22036),j=n(19743),O=n(50585),D=n(67863),L=n(18314),R=n(73352),F=n(59830),z=n(54939),N=Object.defineProperty,$=Object.getOwnPropertyDescriptor;class B{constructor(e){this.maxDelayTimeMs=e}maxDelayTimeMs;isResolved=!1;promisesToWaitFor=[];waitUntil(e){if(this.isResolved)throw Error("Cannot `waitUntil` - the export has already been resolved. Make sure to call `waitUntil` as soon as possible during an export - ie within the first react effect after rendering.");this.promisesToWaitFor.push(e.catch(e=>console.error("Error while waiting for export:",e)))}async resolvePromises(){let e=null;for(;this.promisesToWaitFor.length!==e;)e=this.promisesToWaitFor.length,await Promise.allSettled(this.promisesToWaitFor),await (0,i.yy)(0)}async resolve(){let e=(0,i.yy)(this.maxDelayTimeMs).then(()=>"timeout"),t=this.resolvePromises().then(()=>"resolved");"timeout"===await Promise.race([e,t])&&console.warn("[tldraw] Export delay timed out after ${this.maxDelayTimeMs}ms"),this.isResolved=!0}}function H({editor:e,preserveAspectRatio:t,scale:n,pixelRatio:r,bbox:s,background:a,singleFrameShapeId:l,isDarkMode:d,colorMode:c,renderingShapes:h,onMount:u,waitUntil:p}){let f=(0,R.Ls)(),g=e.getCurrentTheme(),m=(0,I.fp)("export state",{defsById:{},shapeElements:null}),{defsById:y,shapeElements:b}=(0,I.h)(m),x=(0,L._)(e=>{m.update(t=>{if((0,i.mQ)(t.defsById,e.key))return t;let n=Promise.resolve(e.getElement());return p(n.then(t=>{m.update(n=>({...n,defsById:{...n.defsById,[e.key]:{pending:!1,element:t}}}))})),{...t,defsById:{...t.defsById,[e.key]:{pending:!0,element:n}}}})}),w=(0,_.useMemo)(()=>({isDarkMode:d,colorMode:c,waitUntil:p,addExportDef:x,scale:n,pixelRatio:r,async resolveAssetUrl(t,i){let o=e.getAsset(t);return o&&("image"===o.type||"video"===o.type)?await e.resolveAssetUrl(t,{screenScale:n*(i/o.props.w),shouldResolveToOriginal:null===r,dpr:r??void 0}):null}}),[d,c,p,x,n,r,e]),v=(0,_.useRef)(!1);(0,_.useLayoutEffect)(()=>{if(v.current)throw Error("SvgExport should only render once - do not use with react strict mode");v.current=!0,(async()=>{let t={},n=h.map(async({id:n,opacity:r,index:i,backgroundIndex:o})=>{if(n===l)return[];let a=e.getShape(n);if(e.isShapeOfType(a,"group"))return[];let d=[],c=e.getShapeUtil(a);if(c.toSvg||c.toBackgroundSvg){let[n,s]=await Promise.all([c.toSvg?.(a,w),c.toBackgroundSvg?.(a,w)]),l=e.getShapePageTransform(a),h=l.toCssString(),u=1;"scale"in a.props&&1!==a.props.scale&&(u=a.props.scale,h=`${h} scale(${a.props.scale}, ${a.props.scale})`);let p=e.getShapeMask(a.id),g=p?z.V.From(z.V.Inverse(l)).applyToPoints(p):null,m=(0,R.oX)(f,a.id);g&&(t[m]={pending:!1,element:(0,E.jsx)("clipPath",{id:m,children:(0,E.jsx)("path",{d:`M${g.map(({x:e,y:t})=>`${e/u},${t/u}`).join("L")}Z`})})}),n&&d.push({zIndex:i,element:(0,E.jsx)("g",{transform:h,opacity:r,clipPath:p?`url(#${m})`:void 0,children:n},`fg_${a.id}`)}),s&&d.push({zIndex:o,element:(0,E.jsx)("g",{transform:h,opacity:r,clipPath:p?`url(#${m})`:void 0,children:s},`bg_${a.id}`)})}else d.push({zIndex:i,element:(0,E.jsx)(U,{shape:a,util:c,component:A.Gq,className:"tl-shape",bbox:s,opacity:r},`fg_${a.id}`)}),c.backgroundComponent&&d.push({zIndex:o,element:(0,E.jsx)(U,{shape:a,util:c,component:A.u0,className:"tl-shape tl-shape-background",bbox:s,opacity:r},`bg_${a.id}`)});return d}),r=(await Promise.all(n)).flat();(0,o.flushSync)(()=>{m.update(e=>({...e,shapeElements:r.sort((e,t)=>e.zIndex-t.zIndex).map(({element:e})=>e),defsById:{...e.defsById,...t}}))})})()},[s,e,w,f,h,l,m]),(0,_.useEffect)(()=>{let t=new Set;for(let{id:n}of h)for(let r of e.fonts.getShapeFontFaces(n))t.add(r);for(let n of t)x({key:(0,i.NF)(),getElement:async()=>{let t=await e.fonts.toEmbeddedCssDeclaration(n);return(0,E.jsx)("style",{nonce:e.options.nonce,children:t})}})},[e,h,x]),(0,_.useEffect)(()=>{null!==b&&u()},[u,b]);let S=g.colors[c],C=a?S.background:"transparent";if(l&&a){let t=e.getShapeUtil("frame");if(t?.options.showColors){let t=e.getShape(l);C=(0,j.F)(S,t.props.color,"frameFill")}else C=S.solid}return(0,E.jsx)(O.Bb,{editor:e,context:w,children:(0,E.jsxs)("svg",{preserveAspectRatio:t,direction:"ltr",width:s.width*n,height:s.height*n,viewBox:`${s.minX} ${s.minY} ${s.width} ${s.height}`,strokeLinecap:"round",strokeLinejoin:"round",style:{backgroundColor:C},"data-color-mode":d?"dark":"light",className:`tl-container tl-theme__force-sRGB ${d?"tl-theme__dark":"tl-theme__light"}`,children:[(0,E.jsx)("defs",{children:Object.entries(y).map(([e,t])=>t.pending?null:(0,E.jsx)(_.Fragment,{children:t.element},e))}),b]})})}function U({shape:e,util:t,className:n,component:r,bbox:i,opacity:o}){let s=(0,D.hG)(),a=z.V.Translate(-i.minX,-i.minY).multiply(s.getShapePageTransform(e.id)),l=s.getShapeGeometry(e.id).bounds,d=Math.max(l.width,1),c=Math.max(l.height,1);return(0,E.jsx)(M.t,{fallback:()=>null,children:(0,E.jsx)("foreignObject",{x:i.minX,y:i.minY,width:i.w,height:i.h,className:"tl-shape-foreign-object tl-export-embed-styles",children:(0,E.jsx)("div",{className:n,"data-shape-type":e.type,style:{clipPath:s.getShapeClipPath(e.id),transform:a.toCssString(),width:d,height:c,opacity:o},children:(0,E.jsx)(r,{shape:e,util:t})})})})}((e,t,n)=>{for(var r,i=$(t,n),o=e.length-1;o>=0;o--)(r=e[o])&&(i=r(t,n,i)||i);return i&&N(t,n,i)})([i.oI],B.prototype,"waitUntil");let K=(e,t,{currentColor:n})=>"currentColor"===e||e===n,W=(e,t,{parentStyles:n})=>n[t]===e,V=e=>(t,n,{getStyle:r})=>{let i=r(`border-${e}-width`),o=r(`border-${e}-style`);return"0px"===i||"none"===o},Y={"border-block-end-color":K,"border-block-start-color":K,"border-bottom-color":K,"border-inline-end-color":K,"border-inline-start-color":K,"border-left-color":K,"border-right-color":K,"border-top-color":K,"caret-color":K,"column-rule-color":K,"outline-color":K,"text-decoration":(e,t,{currentColor:n})=>"none solid currentColor"===e||e==="none solid "+n,"text-decoration-color":K,"text-emphasis-color":K,"border-collapse":W,"border-spacing":W,"caption-side":W,cursor:W,direction:W,"empty-cells":W,"font-family":W,"font-size":W,"font-style":W,"font-variant":W,"font-weight":W,"font-size-adjust":W,"font-stretch":W,font:W,"letter-spacing":W,"line-height":W,"list-style-image":W,"list-style-position":W,"list-style-type":W,"list-style":W,orphans:W,"overflow-wrap":W,quotes:W,"stroke-linecap":W,"stroke-linejoin":W,"tab-size":W,"text-align":W,"text-align-last":W,"text-indent":W,"text-justify":W,"text-shadow":W,"text-transform":W,visibility:W,"white-space":W,"white-space-collapse":W,widows:W,"word-break":W,"word-spacing":W,"word-wrap":W,"border-top":V("top"),"border-right":V("right"),"border-bottom":V("bottom"),"border-left":V("left"),"border-block-end":V("block-end"),"border-block-start":V("block-start"),"border-inline-end":V("inline-end"),"border-inline-start":V("inline-start"),"border-top-style":V("top"),"border-right-style":V("right"),"border-bottom-style":V("bottom"),"border-left-style":V("left"),"border-block-end-style":V("block-end"),"border-block-start-style":V("block-start"),"border-inline-end-style":V("inline-end"),"border-inline-start-style":V("inline-start"),"border-top-width":V("top"),"border-right-width":V("right"),"border-bottom-width":V("bottom"),"border-left-width":V("left"),"border-block-end-width":V("block-end"),"border-block-start-width":V("block-start"),"border-inline-end-width":V("inline-end")},G={};class q{constructor(e){this.root=e}root;styles=new Map;fonts=new k;readRootElementStyles(e){this.readElementStyles(e,{shouldRespectDefaults:!1,shouldSkipInheritedParentStyles:!1});let t=Array.from((0,a.$3)(e));for(;t.length;){let e=t.pop();t.push(...(0,a.$3)(e)),this.readElementStyles(e,{shouldRespectDefaults:!0,shouldSkipInheritedParentStyles:!0})}}readElementStyles(e,{shouldRespectDefaults:t=!0,shouldSkipInheritedParentStyles:n=!0}){let o=t?function(e,t){let n=ee[t];if(!n){let{foreignObject:o,document:s}=function(e){if(!r||r.ownerDocument!==e){et();let t=e.createElement("iframe");t.style.display="none",e.body.appendChild(t);let n=(0,i.Z1)(t.contentDocument,"frame must have a document"),o=n.createElementNS("http://www.w3.org/2000/svg","svg"),s=n.createElementNS("http://www.w3.org/2000/svg","foreignObject");o.appendChild(s),n.body.appendChild(o),r={iframe:t,foreignObject:s,document:n,ownerDocument:e}}return r}(e),l=s.createElement(t);o.appendChild(l),n=l.computedStyleMap?J(l.computedStyleMap(),en):Z((0,a.L9)(l),en),o.removeChild(l),ee[t]=n}return n}(e.ownerDocument,e.tagName.toLowerCase()):G,s=Object.assign({},G);if(n){let t=e.parentElement;for(;t;){let e=this.styles.get(t)?.self;for(let t in e)s[t]||(s[t]=e[t]);t=t.parentElement}}let l={self:function(e,{defaultStyles:t,parentStyles:n}){return e.computedStyleMap?J(e.computedStyleMap(),{defaultStyles:t,parentStyles:n}):Z((0,a.L9)(e),{defaultStyles:t,parentStyles:n})}(e,{defaultStyles:o,parentStyles:s}),before:X(e,"::before"),after:X(e,"::after")};this.styles.set(e,l)}fetchResources(){let e=[];for(let t of this.styles.values())for(let n of(0,i.Ic)(t))if(n)for(let[t,r]of Object.entries(n)){if(!r)continue;"font-family"===t&&this.fonts.onFontFamilyValue(r);let i=Array.from(r.matchAll(y),e=>({original:e[0],url:e[1]||e[2]||e[3]})).filter(e=>!e.url.startsWith("#"));0!==i.length&&e.push(...i.map(async({url:e,original:i})=>{let o=await d(e)??"data:";n[t]=r.replace(i,`url("${o}")`)}))}return Promise.all(e)}unwrapCustomElements(){let e=new Set,t=(n,r)=>{if(e.has(n))return;e.add(n);let i=n.shadowRoot;if(i){let e=n.ownerDocument.createElement("div");for(let o of(this.styles.set(e,this.styles.get(n)),e.setAttribute("data-tl-custom-element",n.tagName),(r??n.parentElement).appendChild(e),i.childNodes))(0,a.vq)(o)?t(o,e):e.appendChild(o.cloneNode(!0));n.remove()}else if(r){if("style"===n.tagName.toLowerCase())return;let e=n.cloneNode(!1);for(let i of(this.styles.set(e,this.styles.get(n)),r.appendChild(e),(0,a.XH)(n)))(0,a.vq)(i)?t(i,e):e.appendChild(i.cloneNode(!0))}};for(let e of this.styles.keys())t(e,null)}embedStyles(){let e="";for(let[t,n]of this.styles){if(n.after||n.before){let r=`pseudo-${(0,i.NF)()}`;t.classList.add(r),n.before&&(e+=`.${r}::before {${Q(n.before)}}
|
|
2
2
|
`),n.after&&(e+=`.${r}::after {${Q(n.after)}}
|
|
3
3
|
`)}let r=(0,a.EV)(t);for(let[e,t]of Object.entries(n.self))t&&r.setProperty(e,t);"auto"===r.fontKerning&&(r.fontKerning="normal")}return e}async getFontFaceCss(){return await this.fonts.createCss()}dispose(){et()}}function X(e,t){let n=(0,a.L9)(e,t),r=n.getPropertyValue("content");if(""!==r&&"none"!==r)return Z(n,{defaultStyles:G,parentStyles:G})}function J(e,{defaultStyles:t,parentStyles:n}){let r={},o={currentColor:e.get("color")?.toString()||"",parentStyles:n,defaultStyles:t,getStyle:t=>e.get(t)?.toString()??""};for(let n of e.keys()){if(!w(n))continue;let s=e.get(n).toString();if(t[n]===s)continue;let a=(0,i.g5)(Y,n);a&&a(s,n,o)||(r[n]=s)}return r}function Z(e,{defaultStyles:t,parentStyles:n}){let r={},o={currentColor:e.color,parentStyles:n,defaultStyles:t,getStyle:t=>e.getPropertyValue(t)};for(let n in e){if(!w(n))continue;let s=e.getPropertyValue(n);if(t[n]===s)continue;let a=(0,i.g5)(Y,n);a&&a(s,n,o)||(r[n]=s)}return r}function Q(e){let t="";for(let[n,r]of Object.entries(e))t+=`${n}: ${r};`;return t}let ee={};function et(){for(let e in r&&(r.iframe.remove(),r=void 0),ee)delete ee[e]}let en={defaultStyles:G,parentStyles:G},er=1;async function ei(e,t,n={}){let r=function(e,t,n={}){let r=e.getContainerDocument();if(!r)throw Error("No document");let{scale:o=1,background:s=e.getInstanceState().exportBackground,preserveAspectRatio:a}=n,l="number"!=typeof n.padding,d="number"==typeof n.padding?n.padding:e.options.defaultSvgPadding,c=void 0!==n.darkMode?n.darkMode?"dark":"light":e.getColorMode(),h=e.getShapeAndDescendantIds(t),u=e.getUnorderedRenderingShapes(!1).filter(({id:e})=>h.has(e)),p=1===t.length?e.getShape(t[0]):null,f=p&&e.isShapeFrameLike(p)?t[0]:null,g=null,m=!1;if(n.bounds)g=l?n.bounds.clone():n.bounds.clone().expandBy(d);else{let t=function(e,t,n,r){let i=!1,o=null;for(let{id:n}of t){let t=e.getShapeMaskedPageBounds(n);if(!t)continue;let r=e.getShape(n),s=e.getShapeUtil(r).isExportBoundsContainer(r);o?s&&F.az.ContainsApproximately(t,o)?(i=!0,o=t.clone()):(i&&!F.az.ContainsApproximately(o,t)&&(i=!1),o.union(t)):(i=s,o=t.clone())}if(!o)return{box:null,paddingApplied:!1};let s=!r&&!i;return s&&o.expandBy(n),{box:o,paddingApplied:s}}(e,u,d,f);g=t.box,m=t.paddingApplied}if(!g)return;let y=l&&m?d:0,b=g.width*o,x=g.height*o;try{r.body.focus?.()}catch{}let w=new B(e.options.maxExportDelayMs),v=(0,i.il)();return w.waitUntil(v),{jsx:(0,E.jsx)(H,{editor:e,preserveAspectRatio:a,scale:o,pixelRatio:n.pixelRatio??null,bbox:g,background:s,singleFrameShapeId:f,isDarkMode:"dark"===c,colorMode:c,renderingShapes:u,onMount:v.resolve,waitUntil:w.waitUntil}),width:b,height:x,exportDelay:w,trimPadding:y}}(e,t,n);if(!r)return;let l=e.getContainer(),d=l.ownerDocument.createElement("div");d.className=C,d.inert=!0,d.tabIndex=-1,Object.assign(d.style,{position:"absolute",top:"0px",left:"0px",width:r.width+"px",height:r.height+"px",pointerEvents:"none",opacity:0}),l.appendChild(d);let c=(0,s.createRoot)(d,{identifierPrefix:`export_${er++}_`});try{await Promise.resolve(),(0,o.flushSync)(()=>{c.render(r.jsx)}),await r.exportDelay.resolve();let e=d.firstElementChild;return(0,i.vA)(e instanceof(0,a.mD)(l).SVGSVGElement,"Expected an SVG element"),await eo(e),{svg:e,width:r.width,height:r.height,trimPadding:r.trimPadding}}finally{setTimeout(()=>{c.unmount(),l.removeChild(d)},0)}}async function eo(e){let t=[...e.querySelectorAll("foreignObject.tl-export-embed-styles > *")];if(!t.length)return;let n=new q(e);try{for(let r of(n.fonts.startFindingDocumentFontFaces(e.ownerDocument),await Promise.all(t.map(e=>f(e))),t))n.readRootElementStyles(r);await n.fetchResources();let r=await n.getFontFaceCss();n.unwrapCustomElements();let i=n.embedStyles();if(r||i){let t=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","style");t.textContent=`${r}
|
|
4
|
-
${i}`,e.prepend(t)}}finally{n.dispose()}}},2642:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var r=n(83102),i=n(81467),o=n(24167),s=n(59830),a=n(82246);class l extends a{}class d{rBush;elementsInTree;constructor(){this.rBush=new l,this.elementsInTree=new Map}search(e){return new Set(this.rBush.search({minX:e.minX,minY:e.minY,maxX:e.maxX,maxY:e.maxY}).map(e=>e.id))}remove(e){let t=this.elementsInTree.get(e);t&&(this.rBush.remove(t),this.elementsInTree.delete(e))}applyBatch(e,t){for(let t of e)this.remove(t);for(let e of t){let t=this.elementsInTree.get(e.id);t&&this.rBush.remove(t),this.rBush.insert(e),this.elementsInTree.set(e.id,e)}}bulkLoad(e){for(let t of(this.rBush.load(e),e))this.elementsInTree.set(t.id,t)}clear(){this.rBush.clear(),this.elementsInTree.clear()}has(e){return this.elementsInTree.has(e)}getSize(){return this.elementsInTree.size}getElement(e){return this.elementsInTree.get(e)}dispose(){this.clear()}}class c{constructor(e){this.editor=e,this.rbush=new d,this.spatialIndexComputed=this.createSpatialIndexComputed()}editor;rbush;spatialIndexComputed;lastPageId=null;_boundsEpoch=0;rebuildAndBumpEpoch(){return this.buildFromScratch(),this._boundsEpoch++,this._boundsEpoch}createSpatialIndexComputed(){let e=this.editor.store.query.filterHistory("shape"),t=this.editor.store.query.filterHistory("binding");return(0,r.EW)("spatialIndex",(n,i)=>{let o=e.getDiffSince(i),s=t.getDiffSince(i),a=this.editor.getCurrentPageId();return(0,r._O)(n)||o===r.c2||s===r.c2||this.lastPageId!==a?(0,r.Pm)(()=>this.rebuildAndBumpEpoch()):(0===o.length&&0===s.length||(0,r.Pm)(()=>this.processIncrementalUpdate(o,s))&&this._boundsEpoch++,this._boundsEpoch)})}buildFromScratch(){this.rbush.clear(),this.lastPageId=this.editor.getCurrentPageId();let e=[];for(let t of this.editor.getCurrentPageShapes()){let n=this.editor.getShapePageBounds(t.id);n&&n.isValid()&&e.push({minX:n.minX,minY:n.minY,maxX:n.maxX,maxY:n.maxY,id:t.id})}this.rbush.bulkLoad(e)}processIncrementalUpdate(e,t){let n=new Set,r=[],s=new Set,a=new Set,l=[],d=e=>{a.has(e)||(a.add(e),l.push(e))};for(let t of e){for(let e of(0,o.Ic)(t.added))(0,i.o2)(e)&&(s.add(e.id),d(e.id));for(let e of(0,o.Ic)(t.removed))(0,i.o2)(e)&&(this.rbush.has(e.id)&&n.add(e.id),(0,i.xh)(e.parentId)||d(e.parentId));for(let[e,n]of(0,o.Ic)(t.updated))(0,i.o2)(n)&&(s.add(n.id),d(n.id),(0,i.o2)(e)&&e.parentId!==n.parentId&&!(0,i.xh)(e.parentId)&&d(e.parentId))}for(let e of t){for(let t of(0,o.Ic)(e.added))(0,i.OT)(t)&&(d(t.fromId),d(t.toId));for(let t of(0,o.Ic)(e.removed))(0,i.OT)(t)&&(d(t.fromId),d(t.toId));for(let[t,n]of(0,o.Ic)(e.updated))(0,i.OT)(n)&&(d(n.fromId),d(n.toId),(0,i.OT)(t)&&(t.fromId!==n.fromId||t.toId!==n.toId)&&(d(t.fromId),d(t.toId)))}let c=[...s];for(;c.length;){let e=c.pop();for(let t of this.editor.getSortedChildIdsForParent(e))s.has(t)||(s.add(t),c.push(t)),d(t)}for(;l.length;){let e=l.pop(),t=this.editor.store.unsafeGetWithoutCapture(e);for(let n of(t&&(0,i.o2)(t)&&!(0,i.xh)(t.parentId)&&d(t.parentId),this.editor.getBindingsInvolvingShape(e)))d(n.fromId),d(n.toId)}for(let e of a){let t=n.has(e)?void 0:this.rbush.getElement(e),o=this.editor.store.unsafeGetWithoutCapture(e);if(!o||!(0,i.o2)(o)||this.editor.getAncestorPageId(o)!==this.lastPageId){this.rbush.has(e)&&n.add(e);continue}let s=this.editor.getShapePageBounds(e);s&&s.isValid()?this.areBoundsEqualToSpatialElement(s,t)||(n.delete(e),r.push({minX:s.minX,minY:s.minY,maxX:s.maxX,maxY:s.maxY,id:e})):this.rbush.has(e)&&n.add(e)}return(0!==n.size||0!==r.length)&&(this.rbush.applyBatch(n,r),!0)}areBoundsEqualToSpatialElement(e,t){return!e&&!t||!!e&&!!t&&e.minX===t.minX&&e.minY===t.minY&&e.maxX===t.maxX&&e.maxY===t.maxY}getShapeIdsInsideBounds(e){return this.spatialIndexComputed.get(),this.rbush.search(e)}getShapeIdsAtPoint(e,t=0){return this.spatialIndexComputed.get(),this.rbush.search(new s.az(e.x-t,e.y-t,2*t,2*t))}dispose(){this.rbush.dispose(),this.lastPageId=null}}},3510:(e,t,n)=>{"use strict";n.d(t,{D:()=>r});var r=!1},4343:(e,t,n)=>{"use strict";n.d(t,{H:()=>a,w:()=>s});var r=n(81467),i=n(24167),o=n(59830);function s(e){switch(e.type){case"shapes":{let t=e.shapeIds.map(e=>l(e.slice(6)));return`s${t.join(".")}`}case"page":return"p"+l(r.tv.parseId(e.pageId));case"viewport":{let{bounds:t,pageId:n}=e,i=`v${Math.round(t.x)}.${Math.round(t.y)}.${Math.round(t.w)}.${Math.round(t.h)}`;return n&&(i+="."+l(r.tv.parseId(n))),i}default:(0,i.h6)(e)}}function a(e){switch(e[0]){case"s":return{type:"shapes",shapeIds:e.slice(1).split(".").filter(Boolean).map(e=>(0,r.n6)(decodeURIComponent(e)))};case"p":return{type:"page",pageId:r.tv.createId(decodeURIComponent(e.slice(1)))};case"v":{let[t,n,i,s,a]=e.slice(1).split(".");return{type:"viewport",bounds:new o.az(Number(t),Number(n),Number(i),Number(s)),pageId:a?r.tv.createId(decodeURIComponent(a)):void 0}}default:throw Error("Invalid deep link string")}}function l(e){return encodeURIComponent(e).replace(/\./g,"%2E")}},4467:(e,t,n)=>{var r,i=function(){var e=String.fromCharCode,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function i(e,t){if(!r[e]){r[e]={};for(var n=0;n<e.length;n++)r[e][e.charAt(n)]=n}return r[e][t]}var o={compressToBase64:function(e){if(null==e)return"";var n=o._compress(e,6,function(e){return t.charAt(e)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(e){return null==e?"":""==e?null:o._decompress(e.length,32,function(n){return i(t,e.charAt(n))})},compressToUTF16:function(t){return null==t?"":o._compress(t,15,function(t){return e(t+32)})+" "},decompressFromUTF16:function(e){return null==e?"":""==e?null:o._decompress(e.length,16384,function(t){return e.charCodeAt(t)-32})},compressToUint8Array:function(e){for(var t=o.compress(e),n=new Uint8Array(2*t.length),r=0,i=t.length;r<i;r++){var s=t.charCodeAt(r);n[2*r]=s>>>8,n[2*r+1]=s%256}return n},decompressFromUint8Array:function(t){if(null==t)return o.decompress(t);for(var n=Array(t.length/2),r=0,i=n.length;r<i;r++)n[r]=256*t[2*r]+t[2*r+1];var s=[];return n.forEach(function(t){s.push(e(t))}),o.decompress(s.join(""))},compressToEncodedURIComponent:function(e){return null==e?"":o._compress(e,6,function(e){return n.charAt(e)})},decompressFromEncodedURIComponent:function(e){return null==e?"":""==e?null:(e=e.replace(/ /g,"+"),o._decompress(e.length,32,function(t){return i(n,e.charAt(t))}))},compress:function(t){return o._compress(t,16,function(t){return e(t)})},_compress:function(e,t,n){if(null==e)return"";var r,i,o,s={},a={},l="",d="",c="",h=2,u=3,p=2,f=[],g=0,m=0;for(o=0;o<e.length;o+=1)if(l=e.charAt(o),Object.prototype.hasOwnProperty.call(s,l)||(s[l]=u++,a[l]=!0),d=c+l,Object.prototype.hasOwnProperty.call(s,d))c=d;else{if(Object.prototype.hasOwnProperty.call(a,c)){if(256>c.charCodeAt(0)){for(r=0;r<p;r++)g<<=1,m==t-1?(m=0,f.push(n(g)),g=0):m++;for(i=c.charCodeAt(0),r=0;r<8;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}else{for(r=0,i=1;r<p;r++)g=g<<1|i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i=0;for(i=c.charCodeAt(0),r=0;r<16;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}0==--h&&(h=Math.pow(2,p),p++),delete a[c]}else for(i=s[c],r=0;r<p;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1;0==--h&&(h=Math.pow(2,p),p++),s[d]=u++,c=String(l)}if(""!==c){if(Object.prototype.hasOwnProperty.call(a,c)){if(256>c.charCodeAt(0)){for(r=0;r<p;r++)g<<=1,m==t-1?(m=0,f.push(n(g)),g=0):m++;for(i=c.charCodeAt(0),r=0;r<8;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}else{for(r=0,i=1;r<p;r++)g=g<<1|i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i=0;for(i=c.charCodeAt(0),r=0;r<16;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}0==--h&&(h=Math.pow(2,p),p++),delete a[c]}else for(i=s[c],r=0;r<p;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1;0==--h&&(h=Math.pow(2,p),p++)}for(r=0,i=2;r<p;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1;for(;;){if(g<<=1,m==t-1){f.push(n(g));break}m++}return f.join("")},decompress:function(e){return null==e?"":""==e?null:o._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(t,n,r){var i,o,s,a,l,d,c,h=[],u=4,p=4,f=3,g="",m=[],y={val:r(0),position:n,index:1};for(i=0;i<3;i+=1)h[i]=i;for(s=0,l=4,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;switch(s){case 0:for(s=0,l=256,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;c=e(s);break;case 1:for(s=0,l=65536,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;c=e(s);break;case 2:return""}for(h[3]=c,o=c,m.push(c);;){if(y.index>t)return"";for(s=0,l=Math.pow(2,f),d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;switch(c=s){case 0:for(s=0,l=256,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;h[p++]=e(s),c=p-1,u--;break;case 1:for(s=0,l=65536,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;h[p++]=e(s),c=p-1,u--;break;case 2:return m.join("")}if(0==u&&(u=Math.pow(2,f),f++),h[c])g=h[c];else{if(c!==p)return null;g=o+o.charAt(0)}m.push(g),h[p++]=o+g.charAt(0),u--,o=g,0==u&&(u=Math.pow(2,f),f++)}}};return o}();void 0===(r=(function(){return i}).call(t,n,t,e))||(e.exports=r)},4599:(e,t,n)=>{"use strict";n.d(t,{I:()=>s,d:()=>a});var r=n(83102),i=n(24167),o=n(81962);function s(e,t,n){let s=new Set;for(let n of t){let t=e.getShape(n);if(!t)continue;s.add(t);let r=e.getShape(t.parentId);r&&s.add(r)}let l=new Map;for(let t of s){let i=e.getSortedChildIdsForParent(t);if(n?.filter&&!n.filter(t))l.set(t,i);else{let n=function(e,t,n){if(0===n.length)return r.Ml;let i=e.getShapePageBounds(t);if(!i)return r.Ml;let s=e.getShape(t);if(!s)return r.Ml;let a=e.getShapeGeometry(t),l=e.getShapePageTransform(t),d=l.applyToPoints(a.vertices),c=e.getShapeUtil(s.type).getClipPath?.(s),h=c?l.applyToPoints(c):void 0,u=h?(0,o.oQ)(h,d):d;return u?n.filter(t=>{let n=e.getShapePageBounds(t);if(!n||!i.includes(n))return!1;let r=e.getShapePageTransform(t).clone().invert().applyToPoints(u);return e.getShapeGeometry(t).overlapsPolygon(r)}):r.Ml}(e,t.id,i);if(n.length<i.length){let r=e.getShapeUtil(t),o=i.filter(i=>{if(n.includes(i))return!1;let o=e.getShape(i);return!!o&&r.canRemoveChildrenOfType(t,o.type)});o.length>0&&l.set(t,o)}}}let d=e.getCurrentPageShapesSorted().map(e=>e.id),c={};for(let[t,r]of l){let o=(0,i.oE)(r.map(t=>e.getShape(t))),{reparenting:s,remainingShapesToReparent:l}=a(e,o,(e,r)=>(!n?.filter||!!n.filter(r))&&r.id!==t.id&&d.indexOf(r.id)<d.indexOf(e.id));if(s.forEach((e,t)=>{0!==e.length&&(c[t]||(c[t]={parentId:t,shapeIds:[]}),c[t].shapeIds.push(...e.map(e=>e.id)))}),l.size>0){let n=e.findShapeAncestor(t,t=>e.isShapeOfType(t,"group"))?.id??e.getCurrentPageId();l.forEach(r=>{if(!c[n]){let r,o=e.getSortedChildIdsForParent(n),s=o.indexOf(t.id);if(s>-1){let n=o[s+1],a=n?e.getShape(n).index:void 0,l=a&&a>t.index?a:(0,i.AQ)(t.index);r=(0,i.HE)(t.index,l)}c[n]={parentId:n,shapeIds:[],index:r}}c[n].shapeIds.push(r.id)})}}e.run(()=>{Object.values(c).forEach(({parentId:t,shapeIds:n,index:r})=>{0!==n.length&&(n.sort((e,t)=>d.indexOf(e)<d.indexOf(t)?-1:1),e.reparentShapes(n,t,r))})})}function a(e,t,n){let r=new Set(t),s=new Set;for(let n of t){let t=e.getShapeParent(n);t&&e.isShapeOfType(t,"group")&&!s.has(t)&&s.add(t)}for(let t of s){for(let n of(0,i.oE)(e.getSortedChildIdsForParent(t).map(t=>e.getShape(t))))r.delete(n);r.add(t)}let a=new Map,l=new Map,d=new Set(r),c=e.getCurrentPageShapesSorted().filter(t=>{if(d.has(t))return!1;let n=e.getShapeUtil(t);for(let e of d)if(n.canReceiveNewChildrenOfType(t,e.type))return!0;return!1});for(let t=c.length-1;t>=0;t--){let r=c[t],i=e.findShapeAncestor(r,t=>e.isShapeOfType(t,"group"))?.id,s=e.getShapeGeometry(r),h=e.getShapePageTransform(r),u=e.getShapeMask(r),p=h.applyToPoints(s.vertices),f=u?(0,o.oQ)(u,p):p;if(!f)continue;let g=[];for(let t of d){if(r.id===t.id||n&&!n(t,r)||(a.has(t.id)||a.set(t.id,e.findShapeAncestor(t,t=>e.isShapeOfType(t,"group"))?.id),a.get(t.id)!==i||e.findShapeAncestor(r,e=>t.id===e.id)))continue;let o=e.getShapePageTransform(t).clone().invert().applyToPoints(f);if(e.getShapeGeometry(t).overlapsPolygon(o)){if(!e.getShapeUtil(r).canReceiveNewChildrenOfType?.(r,t.type))continue;t.parentId!==r.id&&g.push(t),d.delete(t);continue}}g.length&&l.set(r.id,g)}return{reparenting:l,remainingShapesToReparent:d}}},5174:(e,t,n)=>{"use strict";n.d(t,{A:()=>X});var r,i,o,s,a,l,d,c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var u=("function"==typeof SuppressedError&&SuppressedError,n(12115)),p="right-scroll-bar-position",f="width-before-scroll-bar";function g(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var m="u">typeof window?u.useLayoutEffect:u.useEffect,y=new WeakMap,b=(void 0===r&&(r={}),(void 0===i&&(i=function(e){return e}),o=[],s=!1,a={read:function(){if(s)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:null},useMedium:function(e){var t=i(e,s);return o.push(t),function(){o=o.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(s=!0;o.length;){var t=o;o=[],t.forEach(e)}o={push:function(t){return e(t)},filter:function(){return o}}},assignMedium:function(e){s=!0;var t=[];if(o.length){var n=o;o=[],n.forEach(e),t=o}var r=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(r)};i(),o={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),o}}}}).options=c({async:!0,ssr:!1},r),a),x=function(){},w=u.forwardRef(function(e,t){var n,r,i,o,s=u.useRef(null),a=u.useState({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:x}),l=a[0],d=a[1],p=e.forwardProps,f=e.children,w=e.className,v=e.removeScrollBar,S=e.enabled,C=e.shards,k=e.sideCar,P=e.noRelative,T=e.noIsolation,E=e.inert,I=e.allowPinchZoom,_=e.as,M=e.gapMode,A=h(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=(n=[s,t],r=function(e){return n.forEach(function(t){return g(t,e)})},(i=(0,u.useState)(function(){return{value:null,callback:r,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=r,o=i.facade,m(function(){var e=y.get(o);if(e){var t=new Set(e),r=new Set(n),i=o.current;t.forEach(function(e){r.has(e)||g(e,null)}),r.forEach(function(e){t.has(e)||g(e,i)})}y.set(o,n)},[n]),o),O=c(c({},A),l);return u.createElement(u.Fragment,null,S&&u.createElement(k,{sideCar:b,removeScrollBar:v,shards:C,noRelative:P,noIsolation:T,inert:E,setCallbacks:d,allowPinchZoom:!!I,lockRef:s,gapMode:M}),p?u.cloneElement(u.Children.only(f),c(c({},O),{ref:j})):u.createElement(void 0===_?"div":_,c({},O,{className:w,ref:j}),f))});w.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},w.classNames={fullWidth:f,zeroRight:p};var v=function(e){var t=e.sideCar,n=h(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return u.createElement(r,c({},n))};v.isSideCarExport=!0;var S=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=d||n.nc;return t&&e.setAttribute("nonce",t),e}())){var i,o;(i=t).styleSheet?i.styleSheet.cssText=r:i.appendChild(document.createTextNode(r)),o=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},C=function(){var e=S();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},k=function(){var e=C();return function(t){return e(t.styles,t.dynamic),null}},P={left:0,top:0,right:0,gap:0},T=function(e){return parseInt(e||"",10)||0},E=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[T(n),T(r),T(i)]},I=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return P;var t=E(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},_=k(),M="data-scroll-locked",A=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(M,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(p," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(f," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(p," .").concat(p," {\n right: 0 ").concat(r,";\n }\n \n .").concat(f," .").concat(f," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(M,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},j=function(){var e=parseInt(document.body.getAttribute(M)||"0",10);return isFinite(e)?e:0},O=function(){u.useEffect(function(){return document.body.setAttribute(M,(j()+1).toString()),function(){var e=j()-1;e<=0?document.body.removeAttribute(M):document.body.setAttribute(M,e.toString())}},[])},D=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;O();var o=u.useMemo(function(){return I(i)},[i]);return u.createElement(_,{styles:A(o,!t,i,n?"":"!important")})},L=!1;if("u">typeof window)try{var R=Object.defineProperty({},"passive",{get:function(){return L=!0,!0}});window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch(e){L=!1}var F=!!L&&{passive:!1},z=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},N=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),$(e,r)){var i=B(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$=function(e,t){return"v"===e?z(t,"overflowY"):z(t,"overflowX")},B=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},H=function(e,t,n,r,i){var o,s=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),a=s*r,l=n.target,d=t.contains(l),c=!1,h=a>0,u=0,p=0;do{if(!l)break;var f=B(e,l),g=f[0],m=f[1]-f[2]-s*g;(g||m)&&$(e,l)&&(u+=m,p+=g);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!d&&l!==document.body||d&&(t.contains(l)||t===l));return h&&(i&&1>Math.abs(u)||!i&&a>u)?c=!0:!h&&(i&&1>Math.abs(p)||!i&&-a>p)&&(c=!0),c},U=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},K=function(e){return[e.deltaX,e.deltaY]},W=function(e){return e&&"current"in e?e.current:e},V=0,Y=[];let G=(l=function(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),i=u.useState(V++)[0],o=u.useState(k)[0],s=u.useRef(e);u.useEffect(function(){s.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(function(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(W),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=u.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var i,o=U(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-o[0],d="deltaY"in e?e.deltaY:a[1]-o[1],c=e.target,h=Math.abs(l)>Math.abs(d)?"h":"v";if("touches"in e&&"h"===h&&"range"===c.type)return!1;var u=window.getSelection(),p=u&&u.anchorNode;if(p&&(p===c||p.contains(c)))return!1;var f=N(h,c);if(!f)return!0;if(f?i=h:(i="v"===h?"h":"v",f=N(h,c)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||d)&&(r.current=i),!i)return!0;var g=r.current||i;return H(g,t,e,"h"===g?l:d,!0)},[]),l=u.useCallback(function(e){if(Y.length&&Y[Y.length-1]===o){var n="deltaY"in e?K(e):U(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var i=(s.current.shards||[]).map(W).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),d=u.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),c=u.useCallback(function(e){n.current=U(e),r.current=void 0},[]),h=u.useCallback(function(t){d(t.type,K(t),t.target,a(t,e.lockRef.current))},[]),p=u.useCallback(function(t){d(t.type,U(t),t.target,a(t,e.lockRef.current))},[]);u.useEffect(function(){return Y.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",l,F),document.addEventListener("touchmove",l,F),document.addEventListener("touchstart",c,F),function(){Y=Y.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,F),document.removeEventListener("touchmove",l,F),document.removeEventListener("touchstart",c,F)}},[]);var f=e.removeScrollBar,g=e.inert;return u.createElement(u.Fragment,null,g?u.createElement(o,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,f?u.createElement(D,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},b.useMedium(l),v);var q=u.forwardRef(function(e,t){return u.createElement(w,c({},e,{ref:t,sideCar:G}))});q.classNames=w.classNames;let X=q},8242:(e,t,n)=>{"use strict";n.d(t,{$L:()=>_,Ln:()=>g,N0:()=>E,Um:()=>I,Wg:()=>m,X9:()=>s,Ys:()=>u,dL:()=>$,jP:()=>x,n9:()=>P,oM:()=>w,zy:()=>k});var r=n(27050);class i{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class o{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&o.empty)return o.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let d=this.ranges[a+o],c=this.ranges[a+s],h=l+d;if(e<=h){let o=d?e==l?-1:e==h?1:t:t,s=l+r+(o<0?0:c);if(n)return s;let u=e==(t<0?l:h)?null:a/3+(e-l)*65536,p=e==l?2:e==h?1:4;return(t<0?e!=l:e!=h)&&(p|=8),new i(s,p,u)}r+=c-d}return n?e+r:new i(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],d=this.ranges[r+n];e(s,s+l,a,a+d),i+=d-l}}invert(){return new o(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?o.empty:new o(e<0?[0,-e,0]:[0,0,e])}}o.empty=new o([]);class s{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new s(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new s;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new i(e,r,null)}}let a=Object.create(null);class l{getMap(){return o.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=a[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in a)throw RangeError("Duplicate use of step JSON ID "+e);return a[e]=t,t.prototype.jsonID=e,t}}class d{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new d(e,null)}static fail(e){return new d(null,e)}static fromReplace(e,t,n,i){try{return d.ok(e.replace(t,n,i))}catch(e){if(e instanceof r.vI)return d.fail(e.message);throw e}}}function c(e,t,n){let i=[];for(let r=0;r<e.childCount;r++){let o=e.child(r);o.content.size&&(o=o.copy(c(o.content,t,o))),o.isInline&&(o=t(o,n,r)),i.push(o)}return r.FK.fromArray(i)}class h extends l{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),o=new r.Ji(c(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,i),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,o)}invert(){return new u(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new h(t.pos,n.pos,this.mark)}merge(e){return e instanceof h&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new h(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new h(t.from,t.to,e.markFromJSON(t.mark))}}l.jsonID("addMark",h);class u extends l{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.Ji(c(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,n)}invert(){return new h(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new u(t.pos,n.pos,this.mark)}merge(e){return e instanceof u&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new u(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new u(t.from,t.to,e.markFromJSON(t.mark))}}l.jsonID("removeMark",u);class p extends l{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new p(this.pos,t.marks[n]);return new p(this.pos,this.mark)}}return new f(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new p(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new p(t.pos,e.markFromJSON(t.mark))}}l.jsonID("addNodeMark",p);class f extends l{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new p(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new f(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new f(t.pos,e.markFromJSON(t.mark))}}l.jsonID("removeNodeMark",f);class g extends l{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&y(e,this.from,this.to)?d.fail("Structure replace would overwrite content"):d.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new o([this.from,this.to-this.from,this.slice.size])}invert(e){return new g(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&g.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new g(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof g)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new g(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new g(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new g(t.from,t.to,r.Ji.fromJSON(e,t.slice),!!t.structure)}}g.MAP_BIAS=1,l.jsonID("replace",g);class m extends l{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(y(e,this.from,this.gapFrom)||y(e,this.gapTo,this.to)))return d.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return d.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?d.fromReplace(e,this.from,this.to,n):d.fail("Content does not fit in gap")}getMap(){return new o([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new m(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new m(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new m(t.from,t.to,t.gapFrom,t.gapTo,r.Ji.fromJSON(e,t.slice),t.insert,!!t.structure)}}function y(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function b(e,t,n,i=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),a=[],l=t+1;for(let t=0;t<s.childCount;t++){let d=s.child(t),c=l+d.nodeSize,h=i.matchType(d.type);if(h){i=h;for(let t=0;t<d.marks.length;t++)n.allowsMarkType(d.marks[t].type)||e.step(new u(l,c,d.marks[t]));if(o&&d.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,i;for(;e=t.exec(d.text);)i||(i=new r.Ji(r.FK.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),a.push(new g(l+e.index,l+e.index+e[0].length,i))}}else a.push(new g(l,c,r.Ji.empty));l=c}if(!i.validEnd){let t=i.fillBefore(r.FK.empty,!0);e.replace(l,l,new r.Ji(t,0,0))}for(let t=a.length-1;t>=0;t--)e.step(a[t])}function x(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function w(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(v).concat({type:t,attrs:n}).concat(o.map(v)):null}function v(e){return{type:e,attrs:null}}function S(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function C(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function k(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function P(e,t){let n=e.resolve(t),r=n.index();return T(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function T(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function E(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&T(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function I(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function _(e,t,n=t,i=r.Ji.empty){if(t==n&&!i.size)return null;let o=e.resolve(t),s=e.resolve(n);return M(o,s,i)?new g(t,n,i):new A(o,s,i).fit()}function M(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}l.jsonID("replaceAround",m);class A{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.FK.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=r.FK.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let o=this.placed,s=n.depth,a=i.depth;for(;s&&a&&1==o.childCount;)o=o.firstChild.content,s--,a--;let l=new r.Ji(o,s,a);return e>-1?new m(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new g(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,i=(n?(e=D(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:a}=this.frontier[o],l,d=null;if(1==t&&(i?a.matchType(i.type)||(d=a.fillBefore(r.FK.from(i),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:o,parent:e,inject:d};if(2==t&&i&&(l=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:o,parent:e,wrap:l};if(e&&a.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=D(e,t);return!!i.childCount&&!i.firstChild.isLeaf&&(this.unplaced=new r.Ji(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=D(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new r.Ji(j(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new r.Ji(j(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,d=0,c=[],{match:h,type:u}=this.frontier[t];if(i){for(let e=0;e<i.childCount;e++)c.push(i.child(e));h=h.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;d<a.childCount;){let e=a.child(d),t=h.matchType(e.type);if(!t)break;(++d>1||0==l||e.content.size)&&(h=t,c.push(function e(t,n,i){if(n<=0)return t;let o=t.content;return n>1&&(o=o.replaceChild(0,e(o.firstChild,n-1,1==o.childCount?i-1:0))),n>0&&(o=t.type.contentMatch.fillBefore(o).append(o),i<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(r.FK.empty,!0)))),t.copy(o)}(e.mark(u.allowedMarks(e.marks)),1==d?l:0,d==a.childCount?p:-1)))}let f=d==a.childCount;f||(p=-1),this.placed=O(this.placed,t,r.FK.from(c)),this.frontier[t].match=h,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=f?0==e?r.Ji.empty:new r.Ji(j(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new r.Ji(j(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!L(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=L(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=L(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=O(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=O(this.placed,this.depth,r.FK.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.FK.empty,!0);e.childCount&&(this.placed=O(this.placed,this.frontier.length,e))}}function j(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(j(e.firstChild.content,t-1,n)))}function O(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(O(e.lastChild.content,t-1,n)))}function D(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function L(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function R(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class F extends l{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(i),0,+!t.isLeaf))}getMap(){return o.empty}invert(e){return new F(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new F(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new F(t.pos,t.attr,t.value)}}l.jsonID("attr",F);class z extends l{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return d.ok(n)}getMap(){return o.empty}invert(e){return new z(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new z(t.attr,t.value)}}l.jsonID("docAttr",z);let N=class extends Error{};(N=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),N.prototype.constructor=N,N.prototype.name="TransformError";class ${constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new s}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new N(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r.Ji.empty){let i=_(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new r.Ji(r.FK.from(n),0,0))}delete(e,t){return this.replace(e,t,r.Ji.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,i){if(!i.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(M(o,s,i))return e.step(new g(t,n,i));let a=R(o,s);0==a[a.length-1]&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:o.before(e)==t&&a.splice(1,0,-e)}let d=a.indexOf(l),c=[],h=i.openStart;for(let e=i.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==i.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var u;let t=c[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(l)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=i.openStart;t>=0;t--){let l=(t+h+1)%(i.openStart+1),u=c[l];if(u)for(let t=0;t<a.length;t++){let c=a[(t+d)%a.length],h=!0;c<0&&(h=!1,c=-c);let p=o.node(c-1),f=o.index(c-1);if(p.canReplaceWith(f,f,u.type,u.marks))return e.replace(o.before(c),h?s.after(c):n,new r.Ji(function e(t,n,i,o,s){if(n<i){let r=t.firstChild;t=t.replaceChild(0,r.copy(e(r.content,n+1,i,o,r)))}if(n>o){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(r.FK.empty,!0))}return t}(i.content,0,i.openStart,l),l,i.openEnd))}}let p=e.steps.length;for(let r=a.length-1;r>=0&&(e.replace(t,n,i),!(e.steps.length>p));r--){let e=a[r];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var i=e,o=t;if(!n.isInline&&i==o&&this.doc.resolve(i).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,i,n.type);null!=e&&(i=o=e)}return this.replaceRange(i,o,new r.Ji(r.FK.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=R(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:i,$to:o,depth:s}=t,a=i.before(s+1),l=o.after(s+1),d=a,c=l,h=r.FK.empty,u=0;for(let e=s,t=!1;e>n;e--)t||i.index(e)>0?(t=!0,h=r.FK.from(i.node(e).copy(h)),u++):d--;let p=r.FK.empty,f=0;for(let e=s,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,p=r.FK.from(o.node(e).copy(p)),f++):c++;e.step(new m(d,c,a,l,new r.Ji(h.append(p),u,f),h.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let i=null,{linebreakReplacement:o}=e.doc.type.schema,s=e.doc.resolve(t-n),a=s.node().type;if(o&&a.inlineContent){let e="pre"==a.whitespace,t=!!a.contentMatch.matchType(o);e&&!t?i=!1:!e&&t&&(i=!0)}let l=e.steps.length;if(!1===i){let r=e.doc.resolve(t+n);C(e,r.node(),r.before(),l)}a.inlineContent&&b(e,t+n-1,a,s.node().contentMatchAt(s.index()),null==i);let d=e.mapping.slice(l),c=d.map(t-n);if(e.step(new g(c,d.map(t+n,-1),r.Ji.empty,!0)),!0===i){let t=e.doc.resolve(c);S(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let i=r.FK.empty;for(let e=n.length-1;e>=0;e--){if(i.size){let t=n[e].type.contentMatch.matchFragment(i);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=r.FK.from(n[e].type.create(n[e].attrs,i))}let o=t.start,s=t.end;e.step(new m(o,s,o,s,new r.Ji(i,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,i=null){var o=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var a,l,d;let c,h,u="function"==typeof i?i(e):i;if(e.isTextblock&&!e.hasMarkup(n,u)&&(a=o.doc,l=o.mapping.slice(s).map(t),d=n,h=(c=a.resolve(l)).index(),c.parent.canReplaceWith(h,h+1,d))){let i=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}!1===i&&C(o,e,t,s),b(o,o.mapping.slice(s).map(t,1),n,void 0,null===i);let a=o.mapping.slice(s),l=a.map(t,1),d=a.map(t+e.nodeSize,1);return o.step(new m(l,d,l+1,d-1,new r.Ji(r.FK.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===i&&S(o,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,i){return!function(e,t,n,i,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let a=n.create(i,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new m(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.Ji(r.FK.from(a),0,0),1,!0))}(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new F(e,t,n)),this}setDocAttribute(e,t){return this.step(new z(e,t)),this}addNodeMark(e,t){return this.step(new p(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof r.CU)t.isInSet(n.marks)&&this.step(new f(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new f(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,i){let o=e.doc.resolve(t),s=r.FK.empty,a=r.FK.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){s=r.FK.from(o.node(e).copy(s));let t=i&&i[l];a=r.FK.from(t?t.type.create(t.attrs,a):o.node(e).copy(a))}e.step(new g(t,t,new r.Ji(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,d)=>{if(!r.isInline)return;let c=r.marks;if(!n.isInSet(c)&&d.type.allowsMarkType(n.type)){let d=Math.max(l,e),p=Math.min(l+r.nodeSize,t),f=n.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(f)||(i&&i.to==d&&i.mark.eq(c[e])?i.to=p:s.push(i=new u(d,p,c[e])));o&&o.to==d?o.to=p:a.push(o=new h(d,p,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var i;let o,s;return i=this,o=[],s=0,i.doc.nodesBetween(e,t,(i,a)=>{if(!i.isInline)return;s++;let l=null;if(n instanceof r.sX){let e=i.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(i.marks)&&(l=[n]):l=i.marks;if(l&&l.length){let n=Math.min(a+i.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],i;for(let e=0;e<o.length;e++){let t=o[e];t.step==s-1&&r.eq(o[e].style)&&(i=t)}i?(i.to=n,i.step=s):o.push({style:r,from:Math.max(a,e),to:n,step:s})}}}),o.forEach(e=>i.step(new u(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return b(this,e,t,n),this}}},8810:(e,t,n)=>{"use strict";n.d(t,{c:()=>d});var r=n(83102),i=n(54530),o=n(24167);let s="recording",a="recordingPreserveRedoStack",l="paused";class d{store;dispose;state=s;pendingDiff=new h;stacks=(0,r.eU)("HistoryManager.stacks",{undos:f,redos:f},{isEqual:(e,t)=>e.undos===t.undos&&e.redos===t.redos});annotateError;constructor(e){this.store=e.store,this.annotateError=e.annotateError??o.lQ,this.dispose=this.store.addHistoryInterceptor((e,t)=>{if("user"===t)switch(this.state){case s:this.pendingDiff.apply(e.changes),this.stacks.get().redos.length>0&&this.stacks.update(({undos:e})=>({undos:e,redos:f}));break;case a:this.pendingDiff.apply(e.changes);break;case l:break;default:(0,o.h6)(this.state)}})}flushPendingDiff(){if(this.pendingDiff.isEmpty())return;let e=this.pendingDiff.clear();this.stacks.update(({undos:t,redos:n})=>({undos:t.push({type:"diff",diff:e}),redos:n}))}getNumUndos(){return this.stacks.get().undos.length+ +!this.pendingDiff.isEmpty()}getNumRedos(){return this.stacks.get().redos.length}_isReplaying=!1;isReplaying(){return this._isReplaying}_isInBatch=!1;batch(e,t){let n=this.state;n!==l&&t?.history&&(this.state=c[t.history]);try{if(this._isInBatch)return(0,r.hL)(e),this;this._isInBatch=!0;try{(0,r.hL)(e)}catch(e){throw this.annotateError(e),e}finally{this._isInBatch=!1}return this}finally{this.state=n}}_undo({pushToRedoStack:e,toMark:t}){let n=this.state,r=this._isReplaying;this.state=l,this._isReplaying=!0;try{let{undos:n,redos:r}=this.stacks.get(),s=this.pendingDiff.clear(),a=(0,i.RF)(s),l=(0,i.E8)(s);e&&!a&&(r=r.push({type:"diff",diff:s}));let d=!1;if(a)for(;n.head?.type==="stop";){let i=n.head;if(n=n.tail,e&&(r=r.push(i)),i.id===t){d=!0;break}}if(!d)t:for(;n.head;){let s=n.head;switch(n=n.tail,e&&(r=r.push(s)),s.type){case"diff":(0,i.Fl)(l,[(0,i.E8)(s.diff)]);break;case"stop":if(!t)break t;if(s.id===t){d=!0;break t}break;default:(0,o.h6)(s)}}if(!d&&t)return this.pendingDiff.restore(s),this;this.store.applyDiff(l,{ignoreEphemeralKeys:!0}),this.store.ensureStoreIsUsable(),this.stacks.set({undos:n,redos:r})}finally{this._isReplaying=r,this.state=n}return this}undo(){return this._undo({pushToRedoStack:!0}),this}redo(){let e=this.state,t=this._isReplaying;this.state=l,this._isReplaying=!0;try{this.flushPendingDiff();let{undos:e,redos:t}=this.stacks.get();if(0===t.length)return this;for(;t.head?.type==="stop";)e=e.push(t.head),t=t.tail;let n=(0,i.L4)();for(;t.head;){let r=t.head;if(e=e.push(r),t=t.tail,"diff"===r.type)(0,i.Fl)(n,[r.diff]);else break}this.store.applyDiff(n,{ignoreEphemeralKeys:!0}),this.store.ensureStoreIsUsable(),this.stacks.set({undos:e,redos:t})}finally{this._isReplaying=t,this.state=e}return this}bail(){return this._undo({pushToRedoStack:!1}),this}bailToMark(e){return e&&this._undo({pushToRedoStack:!1,toMark:e}),this}squashToMark(e){let t=this.stacks.get().undos,n=[];for(;t.head&&("stop"!==t.head.type||t.head.id!==e);)"diff"===t.head.type&&n.push(t.head.diff),t=t.tail;if(!t.head||t.head?.id!==e)return console.error("Could not find mark to squash to: ",e),this;if(0===n.length)return this;let r=(0,i.L4)();return(0,i.Fl)(r,n.reverse()),this.stacks.update(({redos:e})=>({undos:t.push({type:"diff",diff:r}),redos:e})),this}_mark(e){(0,r.hL)(()=>{this.flushPendingDiff(),this.stacks.update(({undos:t,redos:n})=>({undos:t.push({type:"stop",id:e}),redos:n}))})}clear(){this.stacks.set({undos:f,redos:f}),this.pendingDiff.clear()}getMarkIdMatching(e){let t=this.stacks.get().undos;for(;t.head;){if("stop"===t.head.type&&t.head.id.includes(e))return t.head.id;t=t.tail}return null}debug(){let{undos:e,redos:t}=this.stacks.get();return{undos:m(e),redos:m(t),pendingDiff:this.pendingDiff.debug(),state:this.state}}}let c={record:s,"record-preserveRedoStack":a,ignore:l};class h{diff=(0,i.L4)();isEmptyAtom=(0,r.eU)("PendingDiff.isEmpty",!0);clear(){let e=this.diff;return this.diff=(0,i.L4)(),this.isEmptyAtom.set(!0),e}restore(e){this.diff=e,this.isEmptyAtom.set((0,i.RF)(e))}isEmpty(){return this.isEmptyAtom.get()}apply(e){(0,i.Fl)(this.diff,[e]),u(e.added)||u(e.removed)?this.isEmptyAtom.set((0,i.RF)(this.diff)):this.isEmptyAtom.__unsafe__getWithoutCapture()&&this.isEmptyAtom.set(!u(e.updated))}debug(){return{diff:this.diff,isEmpty:this.isEmpty()}}}function u(e){for(let t in e)return!0;return!1}class p{length=0;head=null;tail=this;push(e){return new g(e,this)}}let f=new p;class g{constructor(e,t){this.head=e,this.tail=t,this.length=t.length+1}head;tail;length;push(e){return new g(e,this)}}function m(e){if(!e.length)return r.Ml;let t=[];for(;e.length;)t.push(e.head),e=e.tail;return t}},11421:(e,t,n)=>{"use strict";n.d(t,{YO:()=>a,bG:()=>l,of:()=>s});var r=n(83102),i=n(24167),o=n(41463);let s={},a=d("pointerCaptureTrackingObject",{defaults:{all:new Map},shouldStoreForSession:!1}),l={logPreventDefaults:d("logPreventDefaults",{defaults:{all:!1}}),logPointerCaptures:d("logPointerCaptures",{defaults:{all:!1}}),logElementRemoves:d("logElementRemoves",{defaults:{all:!1}}),debugSvg:d("debugSvg",{defaults:{all:!1}}),showFps:d("showFps",{defaults:{all:!1}}),measurePerformance:d("measurePerformance",{defaults:{all:!1}}),throwToBlob:d("throwToBlob",{defaults:{all:!1}}),reconnectOnPing:d("reconnectOnPing",{defaults:{all:!1}}),debugCursors:d("debugCursors",{defaults:{all:!1}}),forceSrgb:d("forceSrgbColors",{defaults:{all:!1}}),debugGeometry:d("debugGeometry",{defaults:{all:!1}}),hideShapes:d("hideShapes",{defaults:{all:!1}}),editOnType:d("editOnType",{defaults:{all:!1}}),a11y:d("a11y",{defaults:{all:!1}}),debugElbowArrows:d("debugElbowArrows",{defaults:{all:!1}})};if("u">typeof Element){let e=Element.prototype.removeChild;(0,r.wv)("element removal logging",()=>{l.logElementRemoves.get()?Element.prototype.removeChild=function(t){return console.warn("[tldraw] removing child:",t),e.call(this,t)}:Element.prototype.removeChild=e})}function d(e,{defaults:t,shouldStoreForSession:n=!0}){var s;let a,l,h;return a=function(e){switch(c(()=>o.env.TLDRAW_ENV)??c(()=>o.env.VERCEL_PUBLIC_TLDRAW_ENV)??c(()=>o.env.NEXT_PUBLIC_TLDRAW_ENV)??"production"){case"production":return e.defaults.production??e.defaults.all;case"preview":case"staging":return e.defaults.staging??e.defaults.all;default:return e.defaults.development??e.defaults.all}}(s={name:e,defaults:t,shouldStoreForSession:n}),l=s.shouldStoreForSession?function(e){try{return JSON.parse((0,i._9)(`tldraw_debug:${e}`)??"null")}catch{return null}}(s.name):null,h=(0,r.eU)(`debug:${s.name}`,l??a),"u">typeof window&&(s.shouldStoreForSession&&(0,r.wv)(`debug:${s.name}`,()=>{let e=h.get();e===a?(0,i.ZJ)(`tldraw_debug:${s.name}`):(0,i.dQ)(`tldraw_debug:${s.name}`,JSON.stringify(e))}),Object.defineProperty(window,`tldraw${s.name.replace(/^[a-z]/,e=>e.toUpperCase())}`,{get:()=>h.get(),set(e){h.set(e)},configurable:!0})),Object.assign(h,s,{reset:()=>h.set(a)})}function c(e){try{return e()}catch{return null}}},12318:(e,t,n)=>{"use strict";n.d(t,{v:()=>f});var r=n(83102),i=n(54530),o=n(81467),s=n(24167),a=n(15727),l=n(46195),d=n(50139),c=n(38335),h=Object.defineProperty,u=Object.getOwnPropertyDescriptor,p=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?u(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&h(t,n,o),o};class f extends c.r{constructor(e){super(e),this.addEditorEvent("frame",this._onFrame)}_onFrame(e){this.updatePointerVelocity(e)}_originPagePoint=(0,r.eU)("originPagePoint",new l.l);getOriginPagePoint(){return this._originPagePoint.get()}get originPagePoint(){return this.getOriginPagePoint()}_originScreenPoint=(0,r.eU)("originScreenPoint",new l.l);getOriginScreenPoint(){return this._originScreenPoint.get()}get originScreenPoint(){return this.getOriginScreenPoint()}_previousPagePoint=(0,r.eU)("previousPagePoint",new l.l);getPreviousPagePoint(){return this._previousPagePoint.get()}get previousPagePoint(){return this.getPreviousPagePoint()}_previousScreenPoint=(0,r.eU)("previousScreenPoint",new l.l);getPreviousScreenPoint(){return this._previousScreenPoint.get()}get previousScreenPoint(){return this.getPreviousScreenPoint()}_currentPagePoint=(0,r.eU)("currentPagePoint",new l.l);getCurrentPagePoint(){return this._currentPagePoint.get()}get currentPagePoint(){return this.getCurrentPagePoint()}_currentScreenPoint=(0,r.eU)("currentScreenPoint",new l.l);getCurrentScreenPoint(){return this._currentScreenPoint.get()}get currentScreenPoint(){return this.getCurrentScreenPoint()}_pointerVelocity=(0,r.eU)("pointerVelocity",new l.l);getPointerVelocity(){return this._pointerVelocity.get()}get pointerVelocity(){return this.getPointerVelocity()}setPointerVelocity(e){this._pointerVelocity.set(e)}keys=new i.uw("keys");buttons=new i.uw("buttons");_isPen=(0,r.eU)("isPen",!1);getIsPen(){return this._isPen.get()}get isPen(){return this.getIsPen()}set isPen(e){this.setIsPen(e)}setIsPen(e){this._isPen.set(e)}_shiftKey=(0,r.eU)("shiftKey",!1);getShiftKey(){return this._shiftKey.get()}get shiftKey(){return this.getShiftKey()}set shiftKey(e){this.setShiftKey(e)}setShiftKey(e){this._shiftKey.set(e)}_metaKey=(0,r.eU)("metaKey",!1);getMetaKey(){return this._metaKey.get()}get metaKey(){return this.getMetaKey()}set metaKey(e){this.setMetaKey(e)}setMetaKey(e){this._metaKey.set(e)}_ctrlKey=(0,r.eU)("ctrlKey",!1);getCtrlKey(){return this._ctrlKey.get()}get ctrlKey(){return this.getCtrlKey()}set ctrlKey(e){this.setCtrlKey(e)}setCtrlKey(e){this._ctrlKey.set(e)}_altKey=(0,r.eU)("altKey",!1);getAltKey(){return this._altKey.get()}get altKey(){return this.getAltKey()}set altKey(e){this.setAltKey(e)}setAltKey(e){this._altKey.set(e)}getAccelKey(){return(0,d.g)({metaKey:this.getMetaKey(),ctrlKey:this.getCtrlKey()})}get accelKey(){return this.getAccelKey()}_isDragging=(0,r.eU)("isDragging",!1);getIsDragging(){return this._isDragging.get()}get isDragging(){return this.getIsDragging()}set isDragging(e){this.setIsDragging(e)}setIsDragging(e){this._isDragging.set(e)}_isPointing=(0,r.eU)("isPointing",!1);getIsPointing(){return this._isPointing.get()}get isPointing(){return this.getIsPointing()}set isPointing(e){this.setIsPointing(e)}setIsPointing(e){this._isPointing.set(e)}_isRightPointing=(0,r.eU)("isRightPointing",!1);getIsRightPointing(){return this._isRightPointing.get()}setIsRightPointing(e){this._isRightPointing.set(e)}_isPinching=(0,r.eU)("isPinching",!1);getIsPinching(){return this._isPinching.get()}get isPinching(){return this.getIsPinching()}set isPinching(e){this.setIsPinching(e)}setIsPinching(e){this._isPinching.set(e)}_isEditing=(0,r.eU)("isEditing",!1);getIsEditing(){return this._isEditing.get()}get isEditing(){return this.getIsEditing()}set isEditing(e){this.setIsEditing(e)}setIsEditing(e){this._isEditing.set(e)}_isPanning=(0,r.eU)("isPanning",!1);getIsPanning(){return this._isPanning.get()}get isPanning(){return this.getIsPanning()}set isPanning(e){this.setIsPanning(e)}setIsPanning(e){this._isPanning.set(e)}_isSpacebarPanning=(0,r.eU)("isSpacebarPanning",!1);getIsSpacebarPanning(){return this._isSpacebarPanning.get()}get isSpacebarPanning(){return this.getIsSpacebarPanning()}set isSpacebarPanning(e){this.setIsSpacebarPanning(e)}setIsSpacebarPanning(e){this._isSpacebarPanning.set(e)}_getHasCollaborators(){return this.editor.getCollaborators().length>0}_velocityPrevPoint=new l.l;updatePointerVelocity(e){let t=this.getCurrentScreenPoint(),n=this.getPointerVelocity();if(0===e)return;let r=l.l.Sub(t,this._velocityPrevPoint);this._velocityPrevPoint=t.clone();let i=r.len(),o=i?r.div(i):new l.l(0,0),s=1-Math.pow(.5,e/16),a=n.clone().lrp(o.mul(i/e),s);.01>Math.abs(a.x)&&(a.x=0),.01>Math.abs(a.y)&&(a.y=0),n.equals(a)||this._pointerVelocity.set(a)}updateFromEvent(e){let t=this._currentScreenPoint.__unsafe__getWithoutCapture(),n=this._currentPagePoint.__unsafe__getWithoutCapture(),i=this._isPinching.__unsafe__getWithoutCapture(),{screenBounds:s}=this.editor.store.unsafeGetWithoutCapture(o.O9),{x:d,y:c,z:h}=(0,r.Pm)(()=>this.editor.getCamera()),u=e.point.x-s.x,p=e.point.y-s.y,f=e.point.z??.5;this._previousScreenPoint.set(t),this._previousPagePoint.set(n),this._currentScreenPoint.set(new l.l(u,p));let g=u/h-d,m=p/h-c;isFinite(g)&&isFinite(m)&&this._currentPagePoint.set(new l.l(g,m,f)),this._isPen.set("pointer"===e.type&&e.isPen),("pointer_down"===e.name||i)&&(this._pointerVelocity.set(new l.l),this._originScreenPoint.set(this._currentScreenPoint.__unsafe__getWithoutCapture()),this._originPagePoint.set(this._currentPagePoint.__unsafe__getWithoutCapture())),this._getHasCollaborators()&&this.editor.run(()=>{let t=this._currentPagePoint.__unsafe__getWithoutCapture();this.editor.store.put([{id:o.G1,typeName:"pointer",x:t.x,y:t.y,lastActivityTimestamp:"pointer"===e.type&&e.pointerId===a.zm.CAMERA_MOVE?this.editor.store.unsafeGetWithoutCapture(o.G1)?.lastActivityTimestamp??Date.now():Date.now(),meta:{}}])},{history:"ignore"})}toJson(){return{originPagePoint:this._originPagePoint.get().toJson(),originScreenPoint:this._originScreenPoint.get().toJson(),previousPagePoint:this._previousPagePoint.get().toJson(),previousScreenPoint:this._previousScreenPoint.get().toJson(),currentPagePoint:this._currentPagePoint.get().toJson(),currentScreenPoint:this._currentScreenPoint.get().toJson(),pointerVelocity:this._pointerVelocity.get().toJson(),shiftKey:this._shiftKey.get(),metaKey:this._metaKey.get(),ctrlKey:this._ctrlKey.get(),altKey:this._altKey.get(),isPen:this._isPen.get(),isDragging:this._isDragging.get(),isPointing:this._isPointing.get(),isPinching:this._isPinching.get(),isEditing:this._isEditing.get(),isPanning:this._isPanning.get(),isSpacebarPanning:this._isSpacebarPanning.get(),keys:Array.from(this.keys.keys()),buttons:Array.from(this.buttons.keys())}}}p([s.oI],f.prototype,"_onFrame",1),p([r.EW],f.prototype,"_getHasCollaborators",1)},12894:(e,t,n)=>{"use strict";n.d(t,{K:()=>f,w:()=>p});for(var r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o="u">typeof navigator&&/Mac/.test(navigator.platform),s="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)r[48+a]=r[96+a]=String(a);for(var a=1;a<=24;a++)r[a+111]="F"+a;for(var a=65;a<=90;a++)r[a]=String.fromCharCode(a+32),i[a]=String.fromCharCode(a);for(var l in r)i.hasOwnProperty(l)||(i[l]=r[l]);var d=n(76865);let c="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),h="u">typeof navigator&&/Win/.test(navigator.platform);function u(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function p(e){return new d.k_({props:{handleKeyDown:f(e)}})}function f(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))c?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var a;let l=("Esc"==(a=!(o&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||s&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?i:r)[n.keyCode]||n.key||"Unidentified")&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a),d,c=t[u(l,n)];if(c&&c(e.state,e.dispatch,e))return!0;if(1==l.length&&" "!=l){if(n.shiftKey){let r=t[u(l,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(h&&n.ctrlKey&&n.altKey)&&(d=r[n.keyCode])&&d!=l){let r=t[u(d,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}},13004:(e,t,n)=>{"use strict";n.d(t,{f:()=>c});var r=n(83102),i=n(81467),o=n(97156),s=n(16038),a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?l(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&a(t,n,o),o};class c{constructor(e,t){if(this.user=e,this.colorScheme=t,"u"<typeof window||!(0,s.CM)().matchMedia)return;const n=(0,s.CM)().matchMedia("(prefers-color-scheme: dark)");n?.matches&&this.systemColorScheme.set("dark");const r=e=>{e.matches?this.systemColorScheme.set("dark"):this.systemColorScheme.set("light")};n?.addEventListener("change",r),this.disposables.add(()=>n?.removeEventListener("change",r))}user;colorScheme;systemColorScheme=(0,r.eU)("systemColorScheme","light");disposables=new Set;dispose(){this.disposables.forEach(e=>e())}updateUserPreferences(e){this.user.setUserPreferences({...this.user.userPreferences.get(),...e})}getUserPreferences(){return{id:this.getExternalId(),name:this.getName(),locale:this.getLocale(),color:this.getColor(),animationSpeed:this.getAnimationSpeed(),areKeyboardShortcutsEnabled:this.getAreKeyboardShortcutsEnabled(),isSnapMode:this.getIsSnapMode(),colorScheme:this.user.userPreferences.get().colorScheme,isDarkMode:this.getIsDarkMode(),isWrapMode:this.getIsWrapMode(),isDynamicResizeMode:this.getIsDynamicResizeMode(),enhancedA11yMode:this.getEnhancedA11yMode(),inputMode:this.getInputMode(),isZoomDirectionInverted:this.getIsZoomDirectionInverted()}}getIsDarkMode(){switch(this.user.userPreferences.get().colorScheme??this.colorScheme){case"dark":return!0;case"light":default:return!1;case"system":return"dark"===this.systemColorScheme.get()}}getEdgeScrollSpeed(){return this.user.userPreferences.get().edgeScrollSpeed??o.Tj.edgeScrollSpeed}getAnimationSpeed(){return this.user.userPreferences.get().animationSpeed??o.Tj.animationSpeed}getAreKeyboardShortcutsEnabled(){return this.user.userPreferences.get().areKeyboardShortcutsEnabled??o.Tj.areKeyboardShortcutsEnabled}getExternalId(){return this.user.userPreferences.get().id}getId(){return this.getExternalId()}getRecordId(){return(0,i.dB)(this.getExternalId())}getName(){return this.user.userPreferences.get().name?.trim()??o.Tj.name}getLocale(){return this.user.userPreferences.get().locale??o.Tj.locale}getColor(){return this.user.userPreferences.get().color??o.Tj.color}getIsSnapMode(){return this.user.userPreferences.get().isSnapMode??o.Tj.isSnapMode}getIsWrapMode(){return this.user.userPreferences.get().isWrapMode??o.Tj.isWrapMode}getIsDynamicResizeMode(){return this.user.userPreferences.get().isDynamicSizeMode??o.Tj.isDynamicSizeMode}getIsPasteAtCursorMode(){return this.user.userPreferences.get().isPasteAtCursorMode??o.Tj.isPasteAtCursorMode}getEnhancedA11yMode(){return this.user.userPreferences.get().enhancedA11yMode??o.Tj.enhancedA11yMode}getInputMode(){return this.user.userPreferences.get().inputMode??o.Tj.inputMode}getIsZoomDirectionInverted(){return this.user.userPreferences.get().isZoomDirectionInverted??o.Tj.isZoomDirectionInverted}}d([r.EW],c.prototype,"getUserPreferences",1),d([r.EW],c.prototype,"getIsDarkMode",1),d([r.EW],c.prototype,"getEdgeScrollSpeed",1),d([r.EW],c.prototype,"getAnimationSpeed",1),d([r.EW],c.prototype,"getAreKeyboardShortcutsEnabled",1),d([r.EW],c.prototype,"getExternalId",1),d([r.EW],c.prototype,"getId",1),d([r.EW],c.prototype,"getRecordId",1),d([r.EW],c.prototype,"getName",1),d([r.EW],c.prototype,"getLocale",1),d([r.EW],c.prototype,"getColor",1),d([r.EW],c.prototype,"getIsSnapMode",1),d([r.EW],c.prototype,"getIsWrapMode",1),d([r.EW],c.prototype,"getIsDynamicResizeMode",1),d([r.EW],c.prototype,"getIsPasteAtCursorMode",1),d([r.EW],c.prototype,"getEnhancedA11yMode",1),d([r.EW],c.prototype,"getInputMode",1),d([r.EW],c.prototype,"getIsZoomDirectionInverted",1)},13248:(e,t,n)=>{"use strict";n.d(t,{sanitizeSvg:()=>k});let r=new Set(["svg","a","altglyph","altglyphdef","altglyphitem","animate","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","fedistantlight","fedropshadow","feflood","fefunca","fefuncb","fefuncg","fefuncr","fegaussianblur","feimage","femerge","femergenode","femorphology","feoffset","fepointlight","fespecularlighting","fespotlight","fetile","feturbulence","filter","font","foreignobject","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","set","stop","style","switch","symbol","text","textpath","title","tref","tspan","use","view","vkern"]),i=new Set(["a","b","blockquote","body","br","code","del","div","em","h1","h2","h3","h4","h5","h6","i","li","mark","ol","p","pre","span","strong","s","sub","sup","table","tbody","td","th","thead","tr","u","ul"]),o=new Set(["script","iframe","object","embed","form","input","textarea","select","button","link","meta","base","img","video","audio","source","picture","svg"]),s=new Set(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clip-path","clip-rule","clippathunits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","diffuseconstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","from","fx","fy","g1","g2","glyph-name","glyphref","gradienttransform","gradientunits","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","kernelmatrix","kernelunitlength","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","mask","mask-type","maskcontentunits","maskunits","max","media","method","min","mode","name","numoctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","radius","refx","refy","repeatcount","repeatdur","requiredfeatures","restart","result","role","rotate","rx","ry","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","text-anchor","text-decoration","text-rendering","textlength","to","transform","transform-origin","type","u1","u2","unicode","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewbox","visibility","width","word-spacing","wrap","writing-mode","x","x1","x2","xchannelselector","xlink:href","xml:id","xml:space","xlink:title","xmlns","xmlns:xlink","y","y1","y2","z","zoomandpan"]),a=new Set(["class","dir","href","id","lang","role","style","tabindex","title"]),l=/^data-/,d=/^aria-/,c=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,h=/^(?:https?:|mailto:)/i,u=/^data:/i,p=/^data:image\/(?:png|jpeg|jpg|gif|webp|avif|bmp|tiff|x-icon|vnd\.microsoft\.icon)[;,]/i,f=/^data:image\/svg\+xml[;,]/i,g=/^#/,m=/^data:(?:image\/(?:png|jpeg|jpg|gif|webp|avif)|font\/(?:woff2?|opentype|truetype|sfnt)|application\/(?:x-font-woff|font-woff2?|x-font-ttf|x-font-opentype|font-sfnt))[;,]/i;function y(e){let t=e.replace(/\\([0-9a-fA-F]{1,6})\s?|\\([^\n])/g,(e,t,n)=>{if(t){let e=parseInt(t,16);return e>1114111||0===e?"�":String.fromCodePoint(e)}return n});return(t=(t=(t=(t=t.replace(/@import\s+(?:url\s*\([^)]*\)|"[^"]*"|'[^']*')[^;]*;?|@import\b[^;]*;?/gi,"")).replace(/expression\s*\([^)]*\)/gi,"")).replace(/-moz-binding\s*:[^;]*/gi,"")).replace(/behavior\s*:[^;]*/gi,"")).replace(/url\s*\(\s*(['"]?)(.*?)\1\s*\)/gis,(e,t,n)=>{let r=n.replace(c,"");return m.test(r)||g.test(r)?e:""})}let b=new Set(["animate","set","animatecolor","animatetransform"]),x=/^(?:href|xlink:href|on)/i,w=/^on/i,v=new Set(["clip-path","cursor","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"]);function S(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n],i=r.name.toLowerCase(),o=i.replace(c,"");if(w.test(o)){e.removeAttribute(r.name);continue}if(!(l.test(i)||d.test(i))){if(!s.has(i)){e.removeAttribute(r.name);continue}if("href"===i||"xlink:href"===i){let n=function(e,t,n){let r=t.replace(c,""),i=e.tagName.toLowerCase();if("image"===i||"feimage"===i){if(p.test(r))return t;if(f.test(r)){let e;if(n>=10)return console.warn("Embedded SVG data URI recursion depth limit (10) reached"),null;try{let t=function(e){let t=e.search(/;base64,/i);if(t>=0){let n=e.slice(t+8),r=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return new TextDecoder().decode(r)}let n=e.indexOf(",");return n<0?null:decodeURIComponent(e.slice(n+1))}(r);if(null===t)return null;e=t}catch{return null}let t=C(e,n+1);return t?"data:image/svg+xml;base64,"+btoa(Array.from(new TextEncoder().encode(t),e=>String.fromCharCode(e)).join("")):null}return null}return"use"===i?g.test(r)?t:null:"a"===i?h.test(r)?t:null:u.test(r)||g.test(r)?t:null}(e,r.value,t);null===n?e.removeAttribute(r.name):n!==r.value&&(r.value=n);continue}if("style"===i){r.value=y(r.value);continue}v.has(i)&&/url\s*\(/i.test(r.value)&&(r.value=y(r.value))}}}function C(e,t){let n=new DOMParser().parseFromString(e,"image/svg+xml");if(n.querySelector("parsererror"))return"";let s=n.documentElement;return"svg"!==s.tagName.toLowerCase()||(S(s,t),!function e(t,n,s){for(let u=t.children.length-1;u>=0;u--){let p=t.children[u],f=p.tagName.toLowerCase();"svg"===n?"foreignobject"===f?(S(p,s),e(p,"html",s)):"style"===f?(S(p,s),p.textContent&&(p.textContent=y(p.textContent))):b.has(f)&&function(e){let t=e.getAttribute("attributeName");return!!t&&x.test(t.replace(c,""))}(p)?p.remove():r.has(f)?(S(p,s),e(p,"svg",s)):p.remove():o.has(f)?p.remove():i.has(f)?(!function(e){let t=e.tagName.toLowerCase();for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n],i=r.name.toLowerCase(),o=i.replace(c,"");if(w.test(o)){e.removeAttribute(r.name);continue}if(!(l.test(i)||d.test(i))){if(!a.has(i)){e.removeAttribute(r.name);continue}if("href"===i){if("a"!==t){e.removeAttribute(r.name);continue}let n=r.value.replace(c,"");h.test(n)||e.removeAttribute(r.name);continue}"style"===i&&(r.value=y(r.value))}}}(p),e(p,"html",s)):p.remove()}}(s,"svg",t),0===s.children.length)?"":new XMLSerializer().serializeToString(s)}function k(e){return C(e,0)}},13656:(e,t,n)=>{"use strict";n.d(t,{p:()=>i,r:()=>r});let r="5.3.2",i={major:"2026-05-06T16:28:18.473Z",minor:"2026-08-05T11:39:54.978Z",patch:"2026-08-18T09:59:40.172Z"}},13982:(e,t,n)=>{"use strict";n.d(t,{$:()=>a,Y:()=>o});var r=n(83102),i=n(16038);let o={isSafari:!1,isIos:!1,isChromeForIos:!1,isFirefox:!1,isAndroid:!1,isWebview:!1,isDarwin:!1,hasCanvasSupport:!1,isTouchDevice:!1},s=!1;"u">typeof window&&("navigator"in window&&(o.isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o.isIos=!!navigator.userAgent.match(/iPad/i)||!!navigator.userAgent.match(/iPhone/i),o.isChromeForIos=/crios.*safari/i.test(navigator.userAgent),o.isFirefox=/firefox/i.test(navigator.userAgent),o.isAndroid=/android/i.test(navigator.userAgent),o.isDarwin=(0,i.CM)().navigator.userAgent.toLowerCase().indexOf("mac")>-1),o.hasCanvasSupport="Promise"in window&&"HTMLCanvasElement"in window,s=o.isFirefox&&!o.isAndroid&&!o.isIos,o.isTouchDevice="navigator"in window&&window.navigator.maxTouchPoints>0||"function"==typeof window.matchMedia&&window.matchMedia("(any-pointer: coarse)").matches);let a=(0,r.eU)("tlenvReactive",{isCoarsePointer:!1,supportsP3ColorSpace:!1});if("u">typeof window&&"u">typeof CSS&&CSS.supports("color","color(display-p3 1 1 1)")){let e=window.matchMedia("(color-gamut: p3)"),t=()=>{let t=e.matches;t!==a.__unsafe__getWithoutCapture().supportsP3ColorSpace&&a.update(e=>({...e,supportsP3ColorSpace:t}))};t(),e.addEventListener("change",t)}if("u">typeof window&&!s){let e=(0,i.CM)().matchMedia&&(0,i.CM)().matchMedia("(any-pointer: coarse)");if(e){let t=()=>{let t=e.matches;t!==a.__unsafe__getWithoutCapture().isCoarsePointer&&a.update(e=>({...e,isCoarsePointer:t}))};t(),e.addEventListener("change",t)}(0,i.CM)().addEventListener("pointerdown",e=>{let t="mouse"!==e.pointerType;t!==a.__unsafe__getWithoutCapture().isCoarsePointer&&a.update(e=>({...e,isCoarsePointer:t}))},{capture:!0})}},15727:(e,t,n)=>{"use strict";n.d(t,{BV:()=>a,EI:()=>d,R_:()=>c,Tf:()=>h,bH:()=>l,mp:()=>o,zd:()=>i,zm:()=>s});var r=n(58347);let i={isLocked:!1,wheelBehavior:"pan",panSpeed:1,zoomSpeed:1,zoomSteps:[.05,.1,.25,.5,1,2,4,8]},o={duration:0,easing:r.Z.easeInOutCubic},s={CAMERA_MOVE:-10},a=["top","right","bottom","left"],l=0,d=2,c=1,h=5},16038:(e,t,n)=>{"use strict";n.d(t,{$h:()=>a,CM:()=>h,MM:()=>l,YY:()=>o,gh:()=>u,hP:()=>s,jL:()=>c,oO:()=>d,wo:()=>i});var r=n(11421);function i(e){"cancelable"in e&&!e.cancelable||(e.preventDefault(),r.bG.logPreventDefaults.get()&&console.warn("preventDefault called on event:",e))}function o(e,t){if(e.setPointerCapture(t.pointerId),r.bG.logPointerCaptures.get()){let n=r.YO.get();n.set(e,(n.get(e)??0)+1),console.warn("setPointerCapture called on element:",e,t)}}function s(e,t){if(e.hasPointerCapture(t.pointerId)&&(e.releasePointerCapture(t.pointerId),r.bG.logPointerCaptures.get())){let n=r.YO.get();1===n.get(e)?n.delete(e):n.has(e)?n.set(e,n.get(e)-1):console.warn("Release without capture"),console.warn("releasePointerCapture called on element:",e,t)}}function a(e,t,n){e&&e.style.setProperty(t,String(n))}function l(e,t){if(t.isConnected&&e.isConnected&&"function"==typeof e.moveBefore&&t.ownerDocument===e.ownerDocument)try{e.moveBefore(t,null);return}catch{}e.appendChild(t)}function d(e,t=!0){if(!e)return!1;let n=e.tagName.toLowerCase();return e.isContentEditable||"input"===n||"textarea"===n||t&&"select"===n||t&&"button"===n||e.classList.contains("tlui-slider__thumb")}function c(){return"u">typeof document?document:globalThis.document}function h(){return"u">typeof window?window:globalThis}function u(e=!0,t){return d((t??c()).activeElement,e)}},16398:(e,t,n)=>{"use strict";n.d(t,{O:()=>r});let r={wheel:"onWheel",pointer_down:"onPointerDown",pointer_move:"onPointerMove",long_press:"onLongPress",pointer_up:"onPointerUp",right_click:"onRightClick",middle_click:"onMiddleClick",key_down:"onKeyDown",key_up:"onKeyUp",key_repeat:"onKeyRepeat",cancel:"onCancel",complete:"onComplete",interrupt:"onInterrupt",double_click:"onDoubleClick",tick:"onTick"}},17347:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var r=n(12115);function i(e){let t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...e)=>t.current?.(...e),[])}(0,Object.defineProperty)(i,"name",{value:"useCallbackRef",configurable:!0})},17357:(e,t,n)=>{"use strict";n.d(t,{pX:()=>T});var r=n(24167),i=n(83102),o=n(54530);let s="patch",a="remove";function l(e){let t=null;for(let[n,i]of(0,r.iA)(e.added))t||(t={}),t[n]=["put",i];for(let[n,i]of(0,r.Ic)(e.updated)){let e=u(n,i);e&&(t||(t={}),t[i.id]=[s,e])}for(let n of Object.keys(e.removed))t||(t={}),t[n]=[a];return t}let d="delete",c="append",h="patch";function u(e,t,n=!1){return p(e,t,new Set(["props","meta"]),n)}function p(e,t,n,i){if(e===t)return null;let o=null;for(let s of Object.keys(e)){if(!(s in t)){o||(o={}),o[s]=[d];continue}let a=e[s],l=t[s];if(n?.has(s)||Array.isArray(a)&&Array.isArray(l)||"string"==typeof a&&"string"==typeof l){let e=function e(t,n,i){if(Object.is(t,n))return null;if(Array.isArray(t)&&Array.isArray(n))return function(t,n,i){if(Object.is(t,n))return null;if(t.length===n.length){let o=Math.max(t.length/5,1),s=[];for(let e=0;e<t.length;e++)if(!(0,r.n4)(t[e],n[e])&&(s.push(e),s.length>o))return["put",n];if(0===s.length)return null;let a={};for(let r of s){let o=t[r],s=n[r];if(o&&s)if("object"==typeof o&&"object"==typeof s){let t=e(o,s,i);t&&(a[r]=t)}else a[r]=["put",s];else a[r]=["put",s]}return[h,a]}for(let e=0;e<t.length;e++)if(!(0,r.n4)(t[e],n[e]))return["put",n];return[c,n.slice(t.length),t.length]}(t,n,i);if("string"==typeof t&&"string"==typeof n)return!i&&n.startsWith(t)?[c,n.slice(t.length),t.length]:["put",n];{if(!t||!n||"object"!=typeof t||"object"!=typeof n)return(0,r.n4)(t,n)?null:["put",n];let e=p(t,n,void 0,i);return e?[h,e]:null}}(a,l,i);e&&(o||(o={}),o[s]=e)}else(0,r.n4)(a,l)||(o||(o={}),o[s]=["put",l])}for(let n of Object.keys(t))n in e||(o||(o={}),o[n]=["put",t[n]]);return o}function f(e,t){let n=setInterval(e,t);return()=>clearInterval(n)}class g{lastServerClock=-1;lastServerInteractionTimestamp=Date.now();pendingPushRequests=[];unsentChanges={nextDiff:void 0,nextPresence:void 0};speculativeChanges={added:{},updated:{},removed:{}};disposables=[];fpsScheduler;sendUnsentChanges;scheduleRebase;store;socket;presenceState;presenceMode;isConnectedToRoom=!1;clientClock=0;onAfterConnect;onCustomMessageReceived;isDebugging=!1;debug(...e){this.isDebugging&&console.debug(...e)}presenceType;didCancel;constructor(e){this.didCancel=e.didCancel,this.presenceType=e.store.scopedTypes.presence.values().next().value??null,this.fpsScheduler=new r.$3(30),this.sendUnsentChanges=this.fpsScheduler.fpsThrottle(()=>{if(this.debug("sending unsent changes",{isConnectedToRoom:this.isConnectedToRoom,unsentChanges:this.unsentChanges}),!this.isConnectedToRoom||this.store.isPossiblyCorrupted()||!this.unsentChanges.nextDiff&&!this.unsentChanges.nextPresence)return;let e=this.unsentChanges.nextDiff?l(this.unsentChanges.nextDiff)??void 0:void 0,t=this.unsentChanges.nextPresence?function(e,t){if(!e&&t)return["put",t];if(e&&t){let n=u(e,t);if(!n)return;return[s,n]}}(this.lastPushedPresenceState,this.unsentChanges.nextPresence):void 0;if(!e&&!t)return;let n={type:"push",clientClock:this.clientClock,diff:e,presence:t};this.debug("sending push request",n),this.socket.sendMessage(n),this.unsentChanges.nextPresence&&(this.lastPushedPresenceState=this.unsentChanges.nextPresence),this.clientClock++,this.pendingPushRequests.push(n),this.unsentChanges.nextDiff=void 0,this.unsentChanges.nextPresence=void 0}),this.scheduleRebase=this.fpsScheduler.fpsThrottle(this.rebase),"u">typeof window&&(window.tlsync=this),this.store=e.store,this.socket=e.socket,this.onAfterConnect=e.onAfterConnect,this.onCustomMessageReceived=e.onCustomMessageReceived;let t=!1;this.presenceState=e.presence,this.presenceMode=e.presenceMode,this.disposables.push(this.store.listen(({changes:e})=>{if(this.didCancel?.())return this.close();this.debug("received store changes",{changes:e}),this.push(e)},{source:"user",scope:"document"}),this.socket.onReceiveMessage(n=>{if(this.didCancel?.())return this.close();this.debug("received message from server",n),this.handleServerEvent(n),t||(t=!0,e.onLoad(this))}),this.socket.onStatusChange(n=>{if(this.didCancel?.())return this.close();this.debug("socket status changed",n.status),"online"===n.status?this.sendConnectMessage():(this.resetConnection(),"error"===n.status&&(t=!0,e.onSyncError(n.reason),this.close()))}),f(()=>{if(this.didCancel?.())return this.close();if(this.debug("ping loop",{isConnectedToRoom:this.isConnectedToRoom}),this.isConnectedToRoom)try{this.socket.sendMessage({type:"ping"})}catch(e){console.warn("ping failed, resetting",e),this.resetConnection()}},5e3),f(()=>{if(this.didCancel?.())return this.close();if(this.debug("health check loop",{isConnectedToRoom:this.isConnectedToRoom}),!this.isConnectedToRoom)return;let e=Date.now()-this.lastServerInteractionTimestamp;e<1e4?this.debug("health check passed",{timeSinceLastServerInteraction:e}):(console.warn("Haven't heard from the server in a while, resetting connection..."),this.resetConnection())},1e4)),this.presenceState&&this.disposables.push((0,i.wv)("pushPresence",()=>{if(this.didCancel?.())return this.close();let e=this.presenceMode?.get();this.fpsScheduler.updateTargetFps(this.getSyncFps()),"full"===e&&this.pushPresence(this.presenceState.get())})),"online"===this.socket.connectionStatus&&this.sendConnectMessage()}latestConnectRequestId=null;sendConnectMessage(){this.isConnectedToRoom?console.error("sendConnectMessage called while already connected"):(this.debug("sending connect message"),this.latestConnectRequestId=(0,r.NF)(),this.socket.sendMessage({type:"connect",connectRequestId:this.latestConnectRequestId,schema:this.store.schema.serialize(),protocolVersion:8,lastServerClock:this.lastServerClock}))}resetConnection(e=!1){this.debug("resetting connection"),e&&(this.lastServerClock=0);let t=Object.keys(this.store.serialize("presence"));t.length>0&&this.store.mergeRemoteChanges(()=>{this.store.remove(t)}),this.lastPushedPresenceState=null,this.isConnectedToRoom=!1,this.pendingPushRequests=[],this.incomingDiffBuffer=[],this.unsentChanges.nextDiff=void 0,this.unsentChanges.nextPresence=void 0,"online"===this.socket.connectionStatus&&this.socket.restart()}didReconnect(e){if(this.debug("did reconnect",e),e.connectRequestId===this.latestConnectRequestId){if(this.latestConnectRequestId=null,this.isConnectedToRoom){console.error("didReconnect called while already connected"),this.resetConnection(!0);return}if(this.pendingPushRequests.length>0){console.error("pendingPushRequests should already be empty when we reconnect"),this.resetConnection(!0);return}(0,i.hL)(()=>{let t=this.speculativeChanges;this.speculativeChanges={added:{},updated:{},removed:{}},this.store.mergeRemoteChanges(()=>{let n={},i="wipe_all"===e.hydrationType;for(let[e,s]of(i||this.store.applyDiff((0,o.E8)(t),{runCallbacks:!1}),(0,r.iA)(this.store.serialize("all"))))(i&&this.store.scopedTypes.document.has(s.typeName)||s.typeName===this.presenceType)&&(n[e]=[a]);this.applyNetworkDiff({...n,...e.diff},!0),this.isConnectedToRoom=!0;let s=l(t);if(!s)return;let d=this.store.filterChangesByScope(this.store.extractingChanges(()=>{this.applyNetworkDiff(s,!0)}),"document");d&&this.push(d)}),this.onAfterConnect?.(this,{isReadonly:e.isReadonly,objectAccess:e.objectAccess??"write"});let n=this.presenceState?.get();n&&this.pushPresence(n)}),this.lastServerClock=e.serverClock}}incomingDiffBuffer=[];handleServerEvent(e){switch(this.debug("received server event",e),this.lastServerInteractionTimestamp=Date.now(),e.type){case"connect":this.didReconnect(e);break;case"patch":case"push_result":if(!this.isConnectedToRoom)break;this.incomingDiffBuffer.push(e),this.scheduleRebase();break;case"data":if(!this.isConnectedToRoom)break;this.incomingDiffBuffer.push(...e.data),this.scheduleRebase();break;case"incompatibility_error":console.error("incompatibility error is legacy and should no longer be sent by the server");break;case"pong":break;case"custom":this.onCustomMessageReceived?.call(null,e.data);break;default:(0,r.h6)(e)}}close(){this.debug("closing"),this.disposables.forEach(e=>e()),this.sendUnsentChanges.cancel?.(),this.scheduleRebase.cancel?.(),"u">typeof window&&window.tlsync===this&&delete window.tlsync}lastPushedPresenceState=null;pushPresence(e){this.store._flushHistory(),this.isConnectedToRoom&&(this.unsentChanges.nextPresence=e,this.sendUnsentChanges())}push(e){this.debug("push",e),(0,o.Fl)(this.speculativeChanges,[e]),this.isConnectedToRoom&&(this.unsentChanges.nextDiff||(this.unsentChanges.nextDiff={added:{},updated:{},removed:{}}),(0,o.Fl)(this.unsentChanges.nextDiff,[e]),this.sendUnsentChanges())}getSyncFps(){return this.presenceMode?.get()==="solo"?1:30}applyNetworkDiff(e,t){this.debug("applyNetworkDiff",e);let n={added:{},updated:{},removed:{}},i=!1;for(let[t,o]of(0,r.iA)(e))if("put"===o[0]){let e=this.store.get(t);e&&!(0,r.n4)(e,o[1])?(i=!0,n.updated[t]=[e,o[1]]):(i=!0,n.added[t]=o[1])}else if(o[0]===s){let e=this.store.get(t);if(!e)continue;let s=function e(t,n){let i;if(!t||"object"!=typeof t)return t;let o=Array.isArray(t),s=(e,n)=>{i||(i=o?[...t]:{...t}),o?i[Number(e)]=n:i[e]=n};for(let[a,l]of Object.entries(n))switch(l[0]){case"put":{let e=l[1];(0,r.n4)(t[a],e)||s(a,e);break}case c:{let e=l[1],n=l[2],r=t[a];Array.isArray(r)&&Array.isArray(e)&&r.length===n?s(a,[...r,...e]):"string"==typeof r&&"string"==typeof e&&r.length===n&&s(a,r+e);break}case h:if(t[a]&&"object"==typeof t[a]){let n=l[1],r=e(t[a],n);r!==t[a]&&s(a,r)}break;case d:a in t&&(i||(o?(console.error("Can't delete array item yet (this should never happen)"),i=[...t]):i={...t}),delete i[a])}return i??t}(e,o[1]);i=!0,n.updated[t]=[e,s]}else o[0]===a&&this.store.has(t)&&(i=!0,n.removed[t]=this.store.get(t));i&&this.store.applyDiff(n,{runCallbacks:t})}rebase=()=>{if(this.store._flushHistory(),0===this.incomingDiffBuffer.length)return;let e=this.incomingDiffBuffer;this.incomingDiffBuffer=[];try{this.store.mergeRemoteChanges(()=>{for(let t of(this.store.applyDiff((0,o.E8)(this.speculativeChanges),{runCallbacks:!1}),e)){if("patch"===t.type){this.applyNetworkDiff(t.diff,!0);continue}if(0===this.pendingPushRequests.length)throw Error("Received push_result but there are no pending push requests");if(this.pendingPushRequests[0].clientClock!==t.clientClock)throw Error("Received push_result for a push request that is not at the front of the queue");if("discard"===t.action)this.pendingPushRequests.shift();else if("commit"===t.action){let e=this.pendingPushRequests.shift();"diff"in e&&e.diff&&this.applyNetworkDiff(e.diff,!0)}else this.applyNetworkDiff(t.action.rebaseWithDiff,!0),this.pendingPushRequests.shift()}try{this.speculativeChanges=this.store.extractingChanges(()=>{for(let e of this.pendingPushRequests)"diff"in e&&e.diff&&this.applyNetworkDiff(e.diff,!0);if(!this.unsentChanges.nextDiff)return;let e=l(this.unsentChanges.nextDiff);e&&this.applyNetworkDiff(e,!0)})}catch(e){console.error(e),this.speculativeChanges={added:{},updated:{},removed:{}},this.resetConnection()}}),this.lastServerClock=e.at(-1)?.serverClock??this.lastServerClock}catch(e){console.error(e),this.store.ensureStoreIsUsable(),this.resetConnection()}}}function m(e,t,n){return e.addEventListener(t,n),()=>{e.removeEventListener(t,n)}}function y(...e){if("u">typeof window&&window.__tldraw_socket_debug){let t=new Date;console.log(`${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}.${t.getMilliseconds()}`,...e)}}class b{_ws=null;isDisposed=!1;_reconnectManager;close(){this.isDisposed=!0,this._reconnectManager.close(),this._ws?.close()}constructor(e){this._reconnectManager=new x(this,e)}_handleConnect(){y("handleConnect"),this._connectionStatus.set("online"),this.statusListeners.forEach(e=>e({status:"online"})),this._reconnectManager.connected()}_handleDisconnect(e,t,n,i){let o;switch(i=i||"UNKNOWN_ERROR",y("handleDisconnect",{currentStatus:this.connectionStatus,closeCode:t,reason:e}),e){case"closed":o=4099===t?"error":"offline";break;case"manual":o="offline"}1006!==t||n||(0,r.mc)("Could not open WebSocket connection. This might be because you're trying to load a URL that doesn't support websockets. Check the URL you're trying to connect to."),this.connectionStatus!==o&&("error"!==o||"offline"!==this.connectionStatus)&&(this._connectionStatus.set(o),this.statusListeners.forEach(e=>e("error"===o?{status:"error",reason:i}:{status:o}))),this._reconnectManager.disconnected()}_setNewSocket(e){(0,r.vA)(!this.isDisposed,"Tried to set a new websocket on a disposed socket"),(0,r.vA)(null===this._ws||this._ws.readyState===WebSocket.CLOSED||this._ws.readyState===WebSocket.CLOSING,`Tried to set a new websocket in when the existing one was ${this._ws?.readyState}`);let t=!1;e.onopen=()=>{y("ws.onopen"),(0,r.vA)(this._ws===e,"sockets must only be orphaned when they are CLOSING or CLOSED, so they can't open"),t=!0,this._handleConnect()},e.onclose=n=>{y("ws.onclose",n),this._ws===e?this._handleDisconnect("closed",n.code,t,n.reason):y("ignoring onclose for an orphaned socket")},e.onerror=t=>{y("ws.onerror",t),this._ws===e?this._handleDisconnect("closed"):y("ignoring onerror for an orphaned socket")},e.onmessage=t=>{let n;(0,r.vA)(this._ws===e,"sockets must only be orphaned when they are CLOSING or CLOSED, so they can't receive messages");try{n=JSON.parse(t.data.toString())}catch{(0,r.mc)("Received malformed WebSocket message. Restarting the connection."),this.restart();return}this.messageListeners.forEach(e=>e(n))},this._ws=e}_closeSocket(){null!==this._ws&&(this._ws.close(),this._ws=null,this._handleDisconnect("manual"))}_connectionStatus=(0,i.eU)("websocket connection status","initial");get connectionStatus(){let e=this._connectionStatus.get();return"initial"===e?"offline":e}sendMessage(e){if((0,r.vA)(!this.isDisposed,"Tried to send message on a disposed socket"),this._ws)if("online"===this.connectionStatus)for(let t of function(e,t=262144){if(e.length<t)return[e];{let n=[],r=0,i=e.length;for(;i>0;){let o=`${r}_`,s=Math.max(Math.min(t-o.length,i),1);n.unshift(o+e.slice(i-s,i)),i-=s,r++}return n}}(JSON.stringify(e)))this._ws.send(t);else console.warn("Tried to send message while "+this.connectionStatus)}messageListeners=new Set;onReceiveMessage(e){return(0,r.vA)(!this.isDisposed,"Tried to add message listener on a disposed socket"),this.messageListeners.add(e),()=>{this.messageListeners.delete(e)}}statusListeners=new Set;onStatusChange(e){return(0,r.vA)(!this.isDisposed,"Tried to add status listener on a disposed socket"),this.statusListeners.add(e),()=>{this.statusListeners.delete(e)}}restart(){(0,r.vA)(!this.isDisposed,"Tried to restart a disposed socket"),y("restarting"),this._closeSocket(),this._reconnectManager.maybeReconnected()}}class x{constructor(e,t){this.socketAdapter=e,this.getUri=t,this.subscribeToReconnectHints(),this.disposables.push(m(window,"offline",()=>{y("window went offline"),this.socketAdapter._closeSocket()})),this.state="pendingAttempt",this.intendedDelay=500,this.scheduleAttempt()}socketAdapter;getUri;isDisposed=!1;disposables=[()=>{this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.recheckConnectingTimeout&&clearTimeout(this.recheckConnectingTimeout)}];reconnectTimeout=null;recheckConnectingTimeout=null;lastAttemptStart=null;intendedDelay=500;state;subscribeToReconnectHints(){if(this.disposables.push(m(window,"online",()=>{y("window went online"),this.maybeReconnected()}),m(document,"visibilitychange",()=>{document.hidden||(y("document became visible"),this.maybeReconnected())})),Object.prototype.hasOwnProperty.call(navigator,"connection")){let e=navigator.connection;this.disposables.push(m(e,"change",()=>{y("navigator.connection change"),this.maybeReconnected()}))}}scheduleAttempt(){(0,r.vA)("pendingAttempt"===this.state),y("scheduling a connection attempt"),Promise.resolve(this.getUri()).then(e=>{"pendingAttempt"!==this.state||this.isDisposed||((0,r.vA)(this.socketAdapter._ws?.readyState!==WebSocket.OPEN,"There should be no connection attempts while already connected"),this.lastAttemptStart=Date.now(),this.socketAdapter._setNewSocket(new WebSocket(e.replace(/^http(s)?:/,"ws$1:"))),this.state="pendingAttemptResult")})}getMaxDelay(){return document.hidden?3e5:2e3}getMinDelay(){return document.hidden?1e3:500}clearReconnectTimeout(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}clearRecheckConnectingTimeout(){this.recheckConnectingTimeout&&(clearTimeout(this.recheckConnectingTimeout),this.recheckConnectingTimeout=null)}maybeReconnected(){if(y("ReconnectManager.maybeReconnected"),this.clearRecheckConnectingTimeout(),this.socketAdapter._ws?.readyState===WebSocket.OPEN)return void y("ReconnectManager.maybeReconnected: already connected");if(this.socketAdapter._ws?.readyState===WebSocket.CONNECTING){y("ReconnectManager.maybeReconnected: connecting"),(0,r.vA)(this.lastAttemptStart,"ReadyState=CONNECTING without lastAttemptStart should be impossible");let e=Date.now()-this.lastAttemptStart;e<1e3?(y("ReconnectManager.maybeReconnected: connecting, rechecking later"),this.recheckConnectingTimeout=setTimeout(()=>this.maybeReconnected(),1e3-e)):(y("ReconnectManager.maybeReconnected: connecting, but for too long, retry now"),this.clearRecheckConnectingTimeout(),this.socketAdapter._closeSocket());return}y("ReconnectManager.maybeReconnected: closing/closed/null, retry now"),this.intendedDelay=500,this.disconnected()}disconnected(){if(y("ReconnectManager.disconnected"),this.socketAdapter._ws?.readyState!==WebSocket.OPEN&&this.socketAdapter._ws?.readyState!==WebSocket.CONNECTING){let e;y("ReconnectManager.disconnected: websocket is not OPEN or CONNECTING"),this.clearReconnectTimeout(),"connected"===this.state?(this.intendedDelay=this.getMinDelay(),e=this.intendedDelay):e=null!==this.lastAttemptStart?this.lastAttemptStart+this.intendedDelay-Date.now():0,e>0?(y("ReconnectManager.disconnected: delaying, delayLeft",e),this.state="delay",this.reconnectTimeout=setTimeout(()=>this.disconnected(),e)):(this.state="pendingAttempt",this.intendedDelay=Math.min(this.getMaxDelay(),1.5*Math.max(this.getMinDelay(),this.intendedDelay)),y("ReconnectManager.disconnected: attempting a connection, next delay",this.intendedDelay),this.scheduleAttempt())}}connected(){y("ReconnectManager.connected"),this.socketAdapter._ws?.readyState===WebSocket.OPEN&&(y("ReconnectManager.connected: websocket is OPEN"),this.state="connected",this.clearReconnectTimeout(),this.intendedDelay=500)}close(){this.disposables.forEach(e=>e()),this.isDisposed=!0}}var w=n(81467);(0,w.Wt)().serialize(),w.tS.create({id:w.yI}),w.tv.create({id:"page:page",name:"Page 1",index:"a1"});new TextEncoder,new TextDecoder;class v extends Error{constructor(e){super(`sync error: ${e}`),this.reason=e}reason;name="RemoteSyncError"}(0,r.lF)("@tldraw/sync-core","5.3.2","esm");var S=n(12115),C=n(23312);let k="multiplayer.client",P=()=>{};function T(e){let[t,n]=(0,C.oqt)(null),{uri:r,roomId:o="default",assets:s,users:a,onMount:l,connect:d,trackAnalyticsEvent:c,getUserPresence:h,onCustomMessageReceived:u,themes:p,...f}=e,m=(0,C.P1V)(p);(0,C.Mcl)(m),(0,C.AFA)(m);let y=(0,C.K4z)(f),x=(0,C.lIP)(h??C.Cho),w=(0,C._q_)(u??P);return(0,S.useEffect)(()=>{let e,t=(0,C.NF7)(),h=a?{currentUser:a.currentUser,resolve:a.resolve??(0,C.gP_)(e=>{let t=a.currentUser.get();return t&&t.id===(0,C.dBl)(e)?t:null})}:{currentUser:C.iPZ.currentUser,resolve:(0,C.gP_)(e=>{let t=C.iPZ.currentUser.get();if(t&&t.id===(0,C.dBl)(e))return t;let n=T.query.records("instance_presence").get().find(t=>t.userId===(0,C.dBl)(e));return n?C.XAu.create({id:(0,C.dBl)(e),name:n.userName,color:n.color}):null})},u=(0,C.EWP)("currentUser",()=>{let e=h.currentUser.get();if(e)return e;let t=(0,C.oEU)();return C.XAu.create({id:(0,C.dBl)(t.id),name:t.name??"",color:t.color??C.TjI.color})});if(d){if(r)throw Error("uri and connect cannot be used together");e=d({sessionId:C.OsR,storeId:t})}else if(r){if(d)throw Error("uri and connect cannot be used together");e=new b(async()=>{let e=new URL("string"==typeof r?r:await r());if(e.searchParams.has("sessionId"))throw Error('useSync. "sessionId" is a reserved query param name. Please use a different name');if(e.searchParams.has("storeId"))throw Error('useSync. "storeId" is a reserved query param name. Please use a different name');return e.searchParams.set("sessionId",C.OsR),e.searchParams.set("storeId",t),e.toString()})}else throw Error("uri or connect must be provided");let p=!1;function f(){return"error"===e.connectionStatus?"offline":e.connectionStatus}let m=(0,i.eU)("collaboration status",f()),S=e.onStatusChange(()=>{m.set(f())}),P=(0,i.eU)("sync mode","readwrite"),T=(0,C._zD)({id:t,schema:y,assets:s,users:h,onMount:l,collaboration:{status:m,mode:P}}),E=(0,C.S6A)(u,{getUserPresence:x})(T),I=T.query.ids("instance_presence"),_=(0,C.EWP)("presenceMode",()=>0===I.get().size?"solo":"full"),M=new g({store:T,socket:e,didCancel:()=>p,onLoad(e){c?.(k,{name:"load",roomId:o}),n(t=>({...t,readyClient:e}))},onSyncError(t){switch(console.error("sync error",t),t){case"NOT_FOUND":c?.(k,{name:"room-not-found",roomId:o});break;case"FORBIDDEN":c?.(k,{name:"forbidden",roomId:o});break;case"NOT_AUTHENTICATED":c?.(k,{name:"not-authenticated",roomId:o});break;case"RATE_LIMITED":c?.(k,{name:"rate-limited",roomId:o});break;default:c?.(k,{name:"sync-error:"+t,roomId:o})}e.restart?.(),n({error:new v(t)})},onAfterConnect(e,{isReadonly:t,objectAccess:r}){n(e=>({...e,objectAccess:r})),(0,i.hL)(()=>{P.set(t?"readonly":"readwrite"),T.ensureStoreIsUsable()})},onCustomMessageReceived:w,presence:E,presenceMode:_});return()=>{p=!0,S(),M.close(),e.close()}},[s,l,d,a,o,y,n,c,r,x,w]),(0,C.hau)("remote synced store",()=>{if(!t)return{status:"loading"};if(t.error)return{status:"error",error:t.error};if(!t.readyClient)return{status:"loading"};let e=t.readyClient.socket.connectionStatus;return{status:"synced-remote",connectionStatus:"error"===e?"offline":e,store:t.readyClient.store,objectAccess:t.objectAccess??"write"}},[t])}var E=n(41463);function I(e){try{return e()}catch{return}}I(()=>"https://demo.tldraw.xyz"),I(()=>E.env.TLDRAW_IMAGE_URL),(0,r.lF)("@tldraw/sync","5.3.2","esm")},17858:(e,t,n)=>{"use strict";n.d(t,{m:()=>c});var r=n(83102),i=n(81467),o=n(58929),s=n(66122),a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?l(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&a(t,n,o),o};class c{constructor(e){this.editor=e,this.shapeBounds=new o.N(this),this.handles=new s.O(this)}editor;shapeBounds;handles;_snapIndicators=(0,r.eU)("snapLines",void 0);getIndicators(){return this._snapIndicators.get()??r.Ml}clearIndicators(){this.getIndicators().length&&this._snapIndicators.set(void 0)}setIndicators(e){this._snapIndicators.set(e)}getSnapThreshold(){return this.editor.options.snapThreshold/this.editor.getZoomLevel()}getSnappableShapes(){let{editor:e}=this,t=e.getViewportPageBounds(),n=e.getSelectedShapeIds(),r=new Set,o=s=>{if((0,i.vc)(s)){let t=e.getShape(s);t&&e.isShapeFrameLike(t)&&r.add(s)}for(let i of e.getSortedChildIdsForParent(s)){if(n.includes(i))continue;let s=e.getShape(i);if(!s||!e.getShapeUtil(s).canSnap(s))continue;let a=e.getShapePageBounds(i);if(a&&t.includes(a)){if(e.isShapeOfType(s,"group")){o(i);continue}r.add(i)}}};return o(this.getCurrentCommonAncestor()??e.getCurrentPageId()),r}getCurrentCommonAncestor(){return this.editor.findCommonAncestor(this.editor.getSelectedShapes())}}d([r.EW],c.prototype,"getSnapThreshold",1),d([r.EW],c.prototype,"getSnappableShapes",1),d([r.EW],c.prototype,"getCurrentCommonAncestor",1)},18314:(e,t,n)=>{"use strict";n.d(t,{_:()=>s,l:()=>a});var r=n(27394),i=n(24167),o=n(12115);function s(e){let t=(0,o.useRef)(void 0);return(0,o.useLayoutEffect)(()=>{t.current=e}),(0,o.useDebugValue)(e),(0,o.useCallback)((...e)=>{let n=t.current;return(0,i.vA)(n,"fn does not exist"),n(...e)},[])}function a(e){let t=(0,r.fp)("useReactiveEvent",()=>e);return(0,o.useLayoutEffect)(()=>{t.set(e)}),(0,o.useDebugValue)(e),(0,o.useCallback)((...e)=>{let n=t.get();return(0,i.vA)(n,"fn does not exist"),n(...e)},[t])}},19040:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(12115),i=n(47650),o=n(55897),s=n(66294),a=n(95155),l=Object.defineProperty,d=r.forwardRef(l(function(e,t){let{container:n,...l}=e,[d,c]=r.useState(!1);(0,s.N)(()=>c(!0),[]);let h=n||d&&globalThis?.document?.body;return h?i.createPortal((0,a.jsx)(o.sG.div,{...l,ref:t}),h):null},"name",{value:"Portal",configurable:!0}))},19065:(e,t,n)=>{"use strict";n.d(t,{XN:()=>h,q1:()=>l});var r=n(24167),i=n(13982),o=n(65009),s=n(11421),a=n(16038);async function l(e,t){let{type:n,width:i,height:l,quality:h=1,pixelRatio:u=2,trimPadding:p=0,scale:f=1}=t;if(i<=0||l<=0)return null;let[g,m]=(0,o.A)(i*u,l*u);g=Math.floor(g),m=Math.floor(m);let y=g/i,b=await d(e,g,m);if(!b)return null;let x=p>0?function(e,t){let n=e.width,r=e.height,i=c(e,t);if(!i)return{canvas:e,width:n,height:r};let{cropLeft:o,cropTop:s,cropRight:l,cropBottom:d}=i,h=l-o,u=d-s,p=(0,a.jL)().createElement("canvas");return p.width=h,p.height=u,p.getContext("2d").drawImage(e,o,s,h,u,0,0,h,u),{canvas:p,width:h,height:u}}(b,p*f*y):{canvas:b,width:g,height:m},w=await new Promise(e=>x.canvas.toBlob(t=>{(!t||s.bG.throwToBlob.get())&&e(null),e(t)},"image/"+n,h));return w?{blob:"png"===n?r.ZA.setPhysChunk(new DataView(await w.arrayBuffer()),y,{type:"image/"+n}):w,width:x.width/y,height:x.height/y}:null}async function d(e,t,n){let o=await r.Sm.blobToDataUrl(new Blob([e],{type:"image/svg+xml"}));return new Promise(e=>{let s=(0,r._V)();s.crossOrigin="anonymous",s.onload=async()=>{i.Y.isSafari&&await (0,r.yy)(250);let o=(0,a.jL)().createElement("canvas"),l=o.getContext("2d");o.width=t,o.height=n,l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,t,n),e(o)},s.onerror=()=>{e(null)},s.src=o})}function c(e,t){let n=e.width,r=e.height,i=e.getContext("2d"),o=Math.ceil(t);if(o<=0||2*o>=n||2*o>=r)return null;let s=i.getImageData(0,0,n,r).data,a=s[0],l=s[1],d=s[2],c=s[3],h=0===c;function u(e){if(h)return s[e+3]>0;{if(s[e+3]!==c)return!0;let t=s[e],n=s[e+1],r=s[e+2];return t!==a||n!==l||r!==d}}let p=n-o,f=r-o,g=o;for(let e=0;e<o;e++){let t=!1;for(let r=0;r<n;r++)if(u((e*n+r)*4)){t=!0;break}if(t){g=e;break}}let m=f;for(let e=r-1;e>=f;e--){let t=!1;for(let r=0;r<n;r++)if(u((e*n+r)*4)){t=!0;break}if(t){m=e+1;break}}let y=o;for(let e=0;e<o;e++){let t=!1;for(let r=g;r<m;r++)if(u((r*n+e)*4)){t=!0;break}if(t){y=e;break}}let b=p;for(let e=n-1;e>=p;e--){let t=!1;for(let r=g;r<m;r++)if(u((r*n+e)*4)){t=!0;break}if(t){b=e+1;break}}return 0===y&&0===g&&b===n&&m===r?null:{cropLeft:y,cropTop:g,cropRight:b,cropBottom:m}}async function h(e,t){let{width:n,height:r,trimPadding:i,scale:o}=t;if(i<=0)return null;let s=Math.floor(n),a=Math.floor(r);if(s<=0||a<=0)return null;let l=await d(e,s,a);if(!l)return null;let h=c(l,i*o);if(!h)return null;let{cropLeft:u,cropTop:p,cropRight:f,cropBottom:g}=h,m=new DOMParser().parseFromString(e,"image/svg+xml").documentElement,y=m.getAttribute("viewBox");if(!y)return null;let[b,x,w,v]=y.split(/\s+/).map(Number),S=b+u/s*w,C=x+p/a*v,k=(f-u)/s*w,P=(g-p)/a*v,T=k*o,E=P*o;return m.setAttribute("viewBox",`${S} ${C} ${k} ${P}`),m.setAttribute("width",String(T)),m.setAttribute("height",String(E)),{svg:new XMLSerializer().serializeToString(m),width:T,height:E}}},19416:(e,t,n)=>{"use strict";n.d(t,{bL:()=>S,e0:()=>m,lg:()=>C,qW:()=>f});var r,i=n(12115),o=n(70379),s=n(55897),a=n(47527),l=n(17347),d=n(95155),c=Object.defineProperty,h=(e,t)=>c(e,"name",{value:t,configurable:!0}),u="dismissableLayer.update",p=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),f=i.forwardRef(h(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:m,onInteractOutside:y,onDismiss:v,...S}=e,C=i.useContext(p),[k,P]=i.useState(null),T=k?.ownerDocument??globalThis?.document,[,E]=i.useState({}),I=(0,a.s)(t,P),_=Array.from(C.layers),[M]=[...C.layersWithOutsidePointerEventsDisabled].slice(-1),A=M?_.indexOf(M):-1,j=k?_.indexOf(k):-1,O=C.layersWithOutsidePointerEventsDisabled.size>0,D=j>=A,L=i.useRef(!1),R=b(e=>{g?.(e),y?.(e),e.defaultPrevented||v?.()},{ownerDocument:T,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:C.dismissableSurfaces,shouldHandlePointerDownOutside:i.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...C.branches].some(t=>t.contains(e));return D&&!t},[C.branches,D])}),F=x(e=>{if(c&&L.current)return;let t=e.target;![...C.branches].some(e=>e.contains(t))&&(m?.(e),y?.(e),e.defaultPrevented||v?.())},T),z=!!k&&j===_.length-1,N=(0,l.c)(e=>{"Escape"===e.key&&(f?.(e),!e.defaultPrevented&&v&&(e.preventDefault(),v()))});return i.useEffect(()=>{if(z)return T.addEventListener("keydown",N,{capture:!0}),()=>T.removeEventListener("keydown",N,{capture:!0})},[T,z,N]),i.useEffect(()=>{if(k)return n&&(0===C.layersWithOutsidePointerEventsDisabled.size&&(r=T.body.style.pointerEvents,T.body.style.pointerEvents="none"),C.layersWithOutsidePointerEventsDisabled.add(k)),C.layers.add(k),w(),()=>{n&&(C.layersWithOutsidePointerEventsDisabled.delete(k),0===C.layersWithOutsidePointerEventsDisabled.size&&(T.body.style.pointerEvents=r))}},[k,T,n,C]),i.useEffect(()=>()=>{k&&(C.layers.delete(k),C.layersWithOutsidePointerEventsDisabled.delete(k),w())},[k,C]),i.useEffect(()=>{let e=h(()=>E({}),"handleUpdate");return document.addEventListener(u,e),()=>document.removeEventListener(u,e)},[]),(0,d.jsx)(s.sG.div,{...S,ref:I,style:{pointerEvents:O?D?"auto":"none":void 0,...e.style},onFocusCapture:(0,o.mK)(e.onFocusCapture,F.onFocusCapture),onBlurCapture:(0,o.mK)(e.onBlurCapture,F.onBlurCapture),onPointerDownCapture:(0,o.mK)(e.onPointerDownCapture,R.onPointerDownCapture)})},"DismissableLayer")),g=i.forwardRef(h(function(e,t){let n=i.useContext(p),r=i.useRef(null),o=(0,a.s)(t,r);return i.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,d.jsx)(s.sG.div,{...e,ref:o})},"DismissableLayerBranch"));function m(){let e=i.useContext(p),[t,n]=i.useState(null);return i.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}h(m,"useDismissableLayerSurface");var y=h(()=>!0,"IS_TRUE");function b(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=y}=t,d=(0,l.c)(e),c=i.useRef(!1),u=i.useRef(!1),p=i.useRef(new Map),f=i.useRef(()=>{});return i.useEffect(()=>{function e(){u.current=!1,o.current=!1,p.current.clear()}function t(){return Array.from(p.current.values()).some(Boolean)}function i(e){if(!u.current)return;let t=e.target;t instanceof Node&&[...s].some(e=>e.contains(t))||p.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{u.current&&f.current()},0)}function l(e){u.current&&p.current.set(e.type,!1)}h(e,"resetOutsideInteraction"),h(t,"isOutsideInteractionIntercepted"),h(i,"handleInteractionCapture"),h(l,"handleInteractionBubble");let g=h(i=>{if(i.target&&!c.current){let s=function(){n.removeEventListener("click",f.current);let r=t();e(),r||v("dismissableLayer.pointerDownOutside",d,l,{discrete:!0})};if(h(s,"handleAndDispatchPointerDownOutsideEvent"),!a(i.target)){n.removeEventListener("click",f.current),e(),c.current=!1;return}let l={originalEvent:i};u.current=!0,o.current=r&&0===i.button,p.current.clear(),r&&0===i.button?(n.removeEventListener("click",f.current),f.current=s,n.addEventListener("click",f.current,{once:!0})):s()}else n.removeEventListener("click",f.current),e();c.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)n.addEventListener(e,i,!0),n.addEventListener(e,l);let y=window.setTimeout(()=>{n.addEventListener("pointerdown",g)},0);return()=>{for(let e of(window.clearTimeout(y),n.removeEventListener("pointerdown",g),n.removeEventListener("click",f.current),m))n.removeEventListener(e,i,!0),n.removeEventListener(e,l)}},[n,d,r,o,s,a]),{onPointerDownCapture:h(()=>c.current=!0,"onPointerDownCapture")}}function x(e,t=globalThis?.document){let n=(0,l.c)(e),r=i.useRef(!1);return i.useEffect(()=>{let e=h(e=>{e.target&&!r.current&&v("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:h(()=>r.current=!0,"onFocusCapture"),onBlurCapture:h(()=>r.current=!1,"onBlurCapture")}}function w(){let e=new CustomEvent(u);document.dispatchEvent(e)}function v(e,t,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?(0,s.hO)(i,o):i.dispatchEvent(o)}h(b,"usePointerDownOutside"),h(x,"useFocusOutside"),h(w,"dispatchUpdate"),h(v,"handleAndDispatchCustomEvent");var S=f,C=g},19743:(e,t,n)=>{"use strict";n.d(t,{F:()=>o,S:()=>i});var r=n(81467);let i={id:"default",fontSize:16,lineHeight:1.35,strokeWidth:2,fonts:{draw:{fontFamily:r.xX.draw,faces:[{family:"tldraw_draw",src:{url:"tldraw_draw",format:"woff2"},weight:"normal"},{family:"tldraw_draw",src:{url:"tldraw_draw_bold",format:"woff2"},weight:"bold"},{family:"tldraw_draw",src:{url:"tldraw_draw_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_draw",src:{url:"tldraw_draw_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]},sans:{fontFamily:r.xX.sans,faces:[{family:"tldraw_sans",src:{url:"tldraw_sans",format:"woff2"},weight:"normal",style:"normal"},{family:"tldraw_sans",src:{url:"tldraw_sans_bold",format:"woff2"},weight:"bold",style:"normal"},{family:"tldraw_sans",src:{url:"tldraw_sans_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_sans",src:{url:"tldraw_sans_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]},serif:{fontFamily:r.xX.serif,faces:[{family:"tldraw_serif",src:{url:"tldraw_serif",format:"woff2"},weight:"normal",style:"normal"},{family:"tldraw_serif",src:{url:"tldraw_serif_bold",format:"woff2"},weight:"bold",style:"normal"},{family:"tldraw_serif",src:{url:"tldraw_serif_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_serif",src:{url:"tldraw_serif_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]},mono:{fontFamily:r.xX.mono,faces:[{family:"tldraw_mono",src:{url:"tldraw_mono",format:"woff2"},weight:"normal",style:"normal"},{family:"tldraw_mono",src:{url:"tldraw_mono_bold",format:"woff2"},weight:"bold",style:"normal"},{family:"tldraw_mono",src:{url:"tldraw_mono_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_mono",src:{url:"tldraw_mono_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]}},colors:{light:{text:"#000000",background:"#f9fafb",negativeSpace:"#f9fafb",solid:"#fcfffe",cursor:"black",noteBorder:"rgb(144, 144, 144)",snap:"hsl(0, 76%, 60%)",selectionStroke:"hsl(214, 84%, 56%)",selectionFill:"hsl(210, 100%, 56%, 24%)",brushFill:"hsl(0, 0%, 56%, 10.2%)",brushStroke:"hsl(0, 0%, 56%, 25.1%)",selectedContrast:"#ffffff",laser:"hsl(0, 100%, 50%)",black:{solid:"#1d1d1d",fill:"#1d1d1d",linedFill:"#363636",frameHeadingStroke:"#717171",frameHeadingFill:"#ffffff",frameStroke:"#717171",frameFill:"#ffffff",frameText:"#000000",noteFill:"#FCE19C",noteText:"#000000",semi:"#e8e8e8",pattern:"#494949",highlightSrgb:"#fddd00",highlightP3:"color(display-p3 0.972 0.8205 0.05)"},blue:{solid:"#4465e9",fill:"#4465e9",linedFill:"#6580ec",frameHeadingStroke:"#6681ec",frameHeadingFill:"#f9fafe",frameStroke:"#6681ec",frameFill:"#f9fafe",frameText:"#000000",noteFill:"#8AA3FF",noteText:"#000000",semi:"#dce1f8",pattern:"#6681ee",highlightSrgb:"#10acff",highlightP3:"color(display-p3 0.308 0.6632 0.9996)"},green:{solid:"#099268",fill:"#099268",linedFill:"#0bad7c",frameHeadingStroke:"#37a684",frameHeadingFill:"#f8fcfa",frameStroke:"#37a684",frameFill:"#f8fcfa",frameText:"#000000",noteFill:"#6FC896",noteText:"#000000",semi:"#d3e9e3",pattern:"#39a785",highlightSrgb:"#00ffc8",highlightP3:"color(display-p3 0.2536 0.984 0.7981)"},grey:{solid:"#9fa8b2",fill:"#9fa8b2",linedFill:"#bbc1c9",frameHeadingStroke:"#aaaaab",frameHeadingFill:"#fbfcfc",frameStroke:"#aaaaab",frameFill:"#fcfcfd",frameText:"#000000",noteFill:"#C0CAD3",noteText:"#000000",semi:"#eceef0",pattern:"#bcc3c9",highlightSrgb:"#cbe7f1",highlightP3:"color(display-p3 0.8163 0.9023 0.9416)"},"light-blue":{solid:"#4ba1f1",fill:"#4ba1f1",linedFill:"#7abaf5",frameHeadingStroke:"#6cb2f3",frameHeadingFill:"#f8fbfe",frameStroke:"#6cb2f3",frameFill:"#fafcff",frameText:"#000000",noteFill:"#9BC4FD",noteText:"#000000",semi:"#ddedfa",pattern:"#6fbbf8",highlightSrgb:"#00f4ff",highlightP3:"color(display-p3 0.1512 0.9414 0.9996)"},"light-green":{solid:"#4cb05e",fill:"#4cb05e",linedFill:"#7ec88c",frameHeadingStroke:"#6dbe7c",frameHeadingFill:"#f8fcf9",frameStroke:"#6dbe7c",frameFill:"#fafdfa",frameText:"#000000",noteFill:"#98D08A",noteText:"#000000",semi:"#dbf0e0",pattern:"#65cb78",highlightSrgb:"#65f641",highlightP3:"color(display-p3 0.563 0.9495 0.3857)"},"light-red":{solid:"#f87777",fill:"#f87777",linedFill:"#f99a9a",frameHeadingStroke:"#f89090",frameHeadingFill:"#fffafa",frameStroke:"#f89090",frameFill:"#fffbfb",frameText:"#000000",noteFill:"#F7A5A1",noteText:"#000000",semi:"#f4dadb",pattern:"#fe9e9e",highlightSrgb:"#ff7fa3",highlightP3:"color(display-p3 0.9988 0.5301 0.6397)"},"light-violet":{solid:"#e085f4",fill:"#e085f4",linedFill:"#e9abf7",frameHeadingStroke:"#e59bf5",frameHeadingFill:"#fefaff",frameStroke:"#e59bf5",frameFill:"#fefbff",frameText:"#000000",noteFill:"#DFB0F9",noteText:"#000000",semi:"#f5eafa",pattern:"#e9acf8",highlightSrgb:"#ff88ff",highlightP3:"color(display-p3 0.9676 0.5652 0.9999)"},orange:{solid:"#e16919",fill:"#e16919",linedFill:"#ea8643",frameHeadingStroke:"#e68544",frameHeadingFill:"#fef9f6",frameStroke:"#e68544",frameFill:"#fef9f6",frameText:"#000000",noteFill:"#FAA475",noteText:"#000000",semi:"#f8e2d4",pattern:"#f78438",highlightSrgb:"#ffa500",highlightP3:"color(display-p3 0.9988 0.6905 0.266)"},red:{solid:"#e03131",fill:"#e03131",linedFill:"#e75f5f",frameHeadingStroke:"#e55757",frameHeadingFill:"#fef7f7",frameStroke:"#e55757",frameFill:"#fef9f9",frameText:"#000000",noteFill:"#FC8282",noteText:"#000000",semi:"#f4dadb",pattern:"#e55959",highlightSrgb:"#ff636e",highlightP3:"color(display-p3 0.9992 0.4376 0.45)"},violet:{solid:"#ae3ec9",fill:"#ae3ec9",linedFill:"#be68d4",frameHeadingStroke:"#bc62d3",frameHeadingFill:"#fcf7fd",frameStroke:"#bc62d3",frameFill:"#fdf9fd",frameText:"#000000",noteFill:"#DB91FD",noteText:"#000000",semi:"#ecdcf2",pattern:"#bd63d3",highlightSrgb:"#c77cff",highlightP3:"color(display-p3 0.7469 0.5089 0.9995)"},yellow:{solid:"#f1ac4b",fill:"#f1ac4b",linedFill:"#f5c27a",frameHeadingStroke:"#f3bb6c",frameHeadingFill:"#fefcf8",frameStroke:"#f3bb6c",frameFill:"#fffdfa",frameText:"#000000",noteFill:"#FED49A",noteText:"#000000",semi:"#f9f0e6",pattern:"#fecb92",highlightSrgb:"#fddd00",highlightP3:"color(display-p3 0.972 0.8705 0.05)"},white:{solid:"#FFFFFF",fill:"#FFFFFF",linedFill:"#ffffff",semi:"#f5f5f5",pattern:"#f9f9f9",frameHeadingStroke:"#7d7d7d",frameHeadingFill:"#ffffff",frameStroke:"#7d7d7d",frameFill:"#ffffff",frameText:"#000000",noteFill:"#FFFFFF",noteText:"#000000",highlightSrgb:"#ffffff",highlightP3:"color(display-p3 1 1 1)"}},dark:{text:"hsl(210, 17%, 98%)",background:"hsl(240, 5%, 6.5%)",negativeSpace:"hsl(240, 5%, 6.5%)",solid:"#010403",cursor:"white",snap:"hsl(0, 76%, 60%)",selectionStroke:"hsl(214, 84%, 56%)",selectionFill:"hsl(209, 100%, 57%, 20%)",brushFill:"hsl(0, 0%, 56%, 10.2%)",brushStroke:"hsl(0, 0%, 56%, 25.1%)",selectedContrast:"#ffffff",laser:"hsl(0, 100%, 50%)",noteBorder:"rgb(20, 20, 20)",black:{solid:"#f2f2f2",fill:"#f2f2f2",linedFill:"#ffffff",frameHeadingStroke:"#5c5c5c",frameHeadingFill:"#252525",frameStroke:"#5c5c5c",frameFill:"#0c0c0c",frameText:"#f2f2f2",noteFill:"#2c2c2c",noteText:"#f2f2f2",semi:"#2c3036",pattern:"#989898",highlightSrgb:"#d2b700",highlightP3:"color(display-p3 0.8078 0.6225 0.0312)"},blue:{solid:"#4f72fc",fill:"#4f72fc",linedFill:"#3c5cdd",frameHeadingStroke:"#384994",frameHeadingFill:"#1C2036",frameStroke:"#384994",frameFill:"#11141f",frameText:"#f2f2f2",noteFill:"#2A3F98",noteText:"#f2f2f2",semi:"#262d40",pattern:"#3a4b9e",highlightSrgb:"#0079d2",highlightP3:"color(display-p3 0.0032 0.4655 0.7991)"},green:{solid:"#099268",fill:"#099268",linedFill:"#087856",frameHeadingStroke:"#10513C",frameHeadingFill:"#14241f",frameStroke:"#10513C",frameFill:"#0E1614",frameText:"#f2f2f2",noteFill:"#014429",noteText:"#f2f2f2",semi:"#253231",pattern:"#366a53",highlightSrgb:"#009774",highlightP3:"color(display-p3 0.0085 0.582 0.4604)"},grey:{solid:"#9398b0",fill:"#9398b0",linedFill:"#8388a5",frameHeadingStroke:"#42474D",frameHeadingFill:"#23262A",frameStroke:"#42474D",frameFill:"#151719",frameText:"#f2f2f2",noteFill:"#56595F",noteText:"#f2f2f2",semi:"#33373c",pattern:"#7c8187",highlightSrgb:"#9cb4cb",highlightP3:"color(display-p3 0.6299 0.7012 0.7856)"},"light-blue":{solid:"#4dabf7",fill:"#4dabf7",linedFill:"#2793ec",frameHeadingStroke:"#075797",frameHeadingFill:"#142839",frameStroke:"#075797",frameFill:"#0B1823",frameText:"#f2f2f2",noteFill:"#1F5495",noteText:"#f2f2f2",semi:"#2a3642",pattern:"#4d7aa9",highlightSrgb:"#00bdc8",highlightP3:"color(display-p3 0.0023 0.7259 0.7735)"},"light-green":{solid:"#40c057",fill:"#40c057",linedFill:"#37a44b",frameHeadingStroke:"#1C5427",frameHeadingFill:"#18251A",frameStroke:"#1C5427",frameFill:"#0F1911",frameText:"#f2f2f2",noteFill:"#21581D",noteText:"#f2f2f2",semi:"#2a3830",pattern:"#4e874e",highlightSrgb:"#00a000",highlightP3:"color(display-p3 0.2711 0.6172 0.0195)"},"light-red":{solid:"#ff8787",fill:"#ff8787",linedFill:"#ff6666",frameHeadingStroke:"#6f3232",frameHeadingFill:"#341818",frameStroke:"#6f3232",frameFill:"#181212",frameText:"#f2f2f2",noteFill:"#7a3333",noteText:"#f2f2f2",semi:"#3c2b2b",pattern:"#a56767",highlightSrgb:"#db005b",highlightP3:"color(display-p3 0.7849 0.0585 0.3589)"},"light-violet":{solid:"#e599f7",fill:"#e599f7",linedFill:"#dc71f4",frameHeadingStroke:"#6c367a",frameHeadingFill:"#2D2230",frameStroke:"#6c367a",frameFill:"#1C151E",frameText:"#f2f2f2",noteFill:"#762F8E",noteText:"#f2f2f2",semi:"#383442",pattern:"#9770a9",highlightSrgb:"#c400c7",highlightP3:"color(display-p3 0.7024 0.0403 0.753)"},orange:{solid:"#f76707",fill:"#f76707",linedFill:"#f54900",frameHeadingStroke:"#773a0e",frameHeadingFill:"#2f1d13",frameStroke:"#773a0e",frameFill:"#1c1512",frameText:"#f2f2f2",noteFill:"#7c3905",noteText:"#f2f2f2",semi:"#3b2e27",pattern:"#9f552d",highlightSrgb:"#d07a00",highlightP3:"color(display-p3 0.7699 0.4937 0.0085)"},red:{solid:"#e03131",fill:"#e03131",linedFill:"#c31d1d",frameHeadingStroke:"#701e1e",frameHeadingFill:"#301616",frameStroke:"#701e1e",frameFill:"#1b1313",frameText:"#f2f2f2",noteFill:"#7e201f",noteText:"#f2f2f2",semi:"#382726",pattern:"#8f3734",highlightSrgb:"#de002c",highlightP3:"color(display-p3 0.7978 0.0509 0.2035)"},violet:{solid:"#ae3ec9",fill:"#ae3ec9",linedFill:"#8f2fa7",frameHeadingStroke:"#6d1583",frameHeadingFill:"#27152e",frameStroke:"#6d1583",frameFill:"#1b0f21",frameText:"#f2f2f2",noteFill:"#5f1c70",noteText:"#f2f2f2",semi:"#342938",pattern:"#763a8b",highlightSrgb:"#9e00ee",highlightP3:"color(display-p3 0.5651 0.0079 0.8986)"},yellow:{solid:"#ffc034",fill:"#ffc034",linedFill:"#ffae00",frameHeadingStroke:"#684e12",frameHeadingFill:"#2a2113",frameStroke:"#684e12",frameFill:"#1e1911",frameText:"#f2f2f2",noteFill:"#8a5e1c",noteText:"#f2f2f2",semi:"#3b352b",pattern:"#fecb92",highlightSrgb:"#d2b700",highlightP3:"color(display-p3 0.8078 0.7225 0.0312)"},white:{solid:"#f3f3f3",fill:"#f3f3f3",linedFill:"#f3f3f3",semi:"#f5f5f5",pattern:"#f9f9f9",frameHeadingStroke:"#ffffff",frameHeadingFill:"#ffffff",frameStroke:"#ffffff",frameFill:"#ffffff",frameText:"#000000",noteFill:"#eaeaea",noteText:"#1d1d1d",highlightSrgb:"#ffffff",highlightP3:"color(display-p3 1 1 1)"}}}};function o(e,t,n){let r=e[t];return r&&"string"!=typeof r?r[n]:t}},20026:(e,t,n)=>{"use strict";n.d(t,{_:()=>d,f:()=>l});var r=n(81467),i=n(24167),o=n(54939),s=n(93286),a=n(46195);function l({editor:e,ids:t}){let n=(0,i.oE)(t.map(t=>e.getShape(t))),r=e.getShapesSharedRotation(t),o=e.getShapesRotatedPageBounds(t);if(!o)return null;let s=o.center.clone().rotWith(o.point,r);return{initialPageCenter:s,initialCursorAngle:s.angle(e.inputs.getOriginPagePoint()),initialShapesRotation:r,shapeSnapshots:n.map(t=>({shape:t,initialPagePoint:e.getShapePageTransform(t.id).point()}))}}function d({delta:e,editor:t,snapshot:n,stage:i,centerOverride:l}){let{initialPageCenter:c,shapeSnapshots:h}=n;t.updateShapes(h.map(({shape:n,initialPagePoint:i})=>{let d=(0,r.vc)(n.parentId)?t.getShapePageTransform(n.parentId):o.V.Identity(),h=a.l.RotWith(i,l??c,e),u=o.V.applyToPoint(o.V.Inverse(d),h),p=(0,s.rg)(n.rotation+e);return{id:n.id,type:n.type,x:u.x,y:u.y,rotation:p}}));let u=[];h.forEach(({shape:e})=>{let n=t.getShape(e.id);if(!n)return;let r=t.getShapeUtil(e);if("start"===i||"one-off"===i){let t=r.onRotateStart?.(e);t&&u.push(t)}let o=r.onRotate?.(e,n);if(o&&u.push(o),"end"===i||"one-off"===i){let t=r.onRotateEnd?.(e,n);t&&u.push(t)}}),u.length>0&&t.updateShapes(u)}},20172:(e,t,n)=>{"use strict";n.d(t,{U:()=>o});var r=n(95155),i=n(69730);function o({children:e,className:t="",...n}){return(0,r.jsx)("svg",{...n,className:i("tl-svg-container",t),"aria-hidden":"true",children:e})}},22036:(e,t,n)=>{"use strict";n.d(t,{Gq:()=>m,u0:()=>y,yp:()=>f});var r=n(95155),i=n(83102),o=n(27394);n(24167);var s=n(12115),a=n(67877),l=n(67863),d=n(26065),c=n(54939),h=n(28879),u=n(16038),p=n(1015);let f=(0,s.memo)(function({id:e,shape:t,util:n,index:h,backgroundIndex:f,opacity:b}){let x=(0,l.hG)(),{ShapeErrorFallback:w,ShapeWrapper:v}=(0,a.B)(),S=(0,s.useRef)(null),C=(0,s.useRef)(null);(0,s.useEffect)(()=>(0,i.wv)("load fonts",()=>{let t=x.fonts.getShapeFontFaces(e);x.fonts.requestFonts(t)}),[x,e]);let k=(0,s.useRef)({transform:"",clipPath:"none",width:0,height:0,x:0,y:0});(0,o.lX)("set shape stuff",()=>{let t=x.getShape(e);if(!t)return;let n=k.current,r=x.getShapeClipPath(e)??"none";r!==n.clipPath&&((0,u.$h)(S.current,"clip-path",r),(0,u.$h)(C.current,"clip-path",r),n.clipPath=r);let i=x.getShapePageTransform(e),o=c.V.toCssString(i),s=x.getShapeGeometry(t).bounds;o!==n.transform&&((0,u.$h)(S.current,"transform",o),(0,u.$h)(C.current,"transform",o),n.transform=o);let a=Math.max(s.width,1),l=Math.max(s.height,1);(a!==n.width||l!==n.height)&&((0,u.$h)(S.current,"width",a+"px"),(0,u.$h)(S.current,"height",l+"px"),(0,u.$h)(C.current,"width",a+"px"),(0,u.$h)(C.current,"height",l+"px"),n.width=a,n.height=l)},[x]),(0,s.useLayoutEffect)(()=>{let e=S.current,t=C.current;(0,u.$h)(e,"opacity",b),(0,u.$h)(t,"opacity",b),(0,u.$h)(e,"z-index",h),(0,u.$h)(t,"z-index",f)},[b,h,f]);let{register:P,unregister:T}=(0,d.R)();(0,s.useLayoutEffect)(()=>{let t=S.current;if(!t)return;let n=x.getCulledShapes().has(e);return P(e,t,C.current,n),()=>{T(e)}},[x,e,P,T]);let E=(0,s.useCallback)(e=>x.annotateError(e,{origin:"shape",willCrashApp:!1}),[x]);return t&&v?(0,r.jsxs)(r.Fragment,{children:[n.backgroundComponent&&(0,r.jsx)(v,{ref:C,shape:t,isBackground:!0,children:(0,r.jsx)(p.p,{fallback:w,onError:E,children:(0,r.jsx)(y,{shape:t,util:n})})}),(0,r.jsxs)(v,{ref:S,shape:t,isBackground:!1,children:[(0,r.jsx)(p.p,{fallback:w,onError:E,children:(0,r.jsx)(m,{shape:t,util:n})}),n.getAppOwnedElement&&(0,r.jsx)(g,{id:e,util:n})]})]}):null}),g=(0,s.memo)(function({id:e,util:t}){let n=(0,l.hG)(),i=(0,s.useRef)(null);return(0,s.useLayoutEffect)(()=>{let r=i.current;if(!r)return;let o=n.getShape(e);if(!o)return;let s=t.getAppOwnedElement?.(o);if(s)return s.isConnected,s.parentNode!==r&&(0,u.MM)(r,s),()=>{let r=n.getShape(e)??o;t.onReleaseAppOwnedElement?.(r,s)}},[n,e,t]),(0,r.jsx)("div",{ref:i,className:"tl-content-slot",draggable:!1})}),m=(0,s.memo)(function({shape:e,util:t}){return(0,o.A1)("InnerShape:"+e.type,()=>t.component(t.editor.store.unsafeGetWithoutCapture(e.id)),[t,e.id])},(e,t)=>(0,h.E)(e.shape,t.shape)&&e.util===t.util),y=(0,s.memo)(function({shape:e,util:t}){return(0,o.A1)("InnerShape:"+e.type,()=>t.backgroundComponent?.(t.editor.store.unsafeGetWithoutCapture(e.id)),[t,e.id])},(e,t)=>e.shape.props===t.shape.props&&e.shape.meta===t.shape.meta&&e.util===t.util)},22690:(e,t,n)=>{"use strict";n.d(t,{T:()=>r});var r={};n.r(r),n.d(r,{ArrayOfValidator:()=>d,DictValidator:()=>u,ObjectValidator:()=>c,UnionValidator:()=>h,ValidationError:()=>o,Validator:()=>l,any:()=>g,array:()=>I,arrayOf:()=>_,bigint:()=>T,boolean:()=>P,dict:()=>L,httpUrl:()=>G,indexKey:()=>q,integer:()=>S,jsonDict:()=>D,jsonValue:()=>O,linkUrl:()=>W,literal:()=>E,literalEnum:()=>H,model:()=>z,nonZeroFiniteNumber:()=>w,nonZeroInteger:()=>k,nonZeroNumber:()=>x,nullable:()=>B,number:()=>y,numberUnion:()=>F,object:()=>A,optional:()=>$,or:()=>X,positiveInteger:()=>C,positiveNumber:()=>b,setEnum:()=>N,srcUrl:()=>Y,string:()=>m,union:()=>R,unitInterval:()=>v,unknown:()=>f,unknownObject:()=>M});var i=n(24167);class o extends Error{constructor(e,t=[]){const n=function(e){if(!e.length)return null;let t="";for(let n of e)"number"==typeof n?t+=`.${n}`:n.startsWith("(")?t.endsWith(")")?t=`${t.slice(0,-1)}, ${n.slice(1)}`:t+=n:t+=`.${n}`;return(t=t.replace(/id = [^,]+, /,"").replace(/id = [^)]+/,"")).startsWith(".")?t.slice(1):t}(t),r=e.split("\n").map((e,t)=>0===t?e:` ${e}`).join("\n");super(n?`At ${n}: ${r}`:r),this.rawMessage=e,this.path=t}rawMessage;path;name="ValidationError"}function s(e,t){if(t instanceof o)throw new o(t.rawMessage,[e,...t.path]);throw new o(t.toString(),[e])}function a(e){if(null===e)return"null";if(Array.isArray(e))return"an array";let t=typeof e;switch(t){case"bigint":case"boolean":case"function":case"number":case"string":case"symbol":return`a ${t}`;case"object":return`an ${t}`;case"undefined":return"undefined";default:(0,i.h6)(t)}}class l{constructor(e,t,n=!1){this.validationFn=e,this.validateUsingKnownGoodVersionFn=t,this.skipSameValueCheck=n}validationFn;validateUsingKnownGoodVersionFn;skipSameValueCheck;validate(e){let t=this.validationFn(e);return t}validateUsingKnownGoodVersion(e,t){return Object.is(e,t)?e:this.validateUsingKnownGoodVersionFn?this.validateUsingKnownGoodVersionFn(e,t):this.validate(t)}isValid(e){try{return this.validate(e),!0}catch{return!1}}nullable(){return B(this)}optional(){return $(this)}refine(e){return new l(t=>e(this.validate(t)),(t,n)=>{let r=this.validateUsingKnownGoodVersion(t,n);return Object.is(t,r)?t:e(r)},!0)}check(e,t){return"string"==typeof e?this.refine(n=>{try{t(n)}catch(t){s(`(check ${e})`,t)}return n}):this.refine(t=>(e(t),t))}}class d extends l{constructor(e){super(t=>{let n=I.validate(t);for(let t=0;t<n.length;t++)try{e.validate(n[t])}catch(e){s(t,e)}return n},(t,n)=>{if(Object.is(t,n))return t;if(!e.validateUsingKnownGoodVersion)return this.validate(n);let r=I.validate(n),i=t.length!==r.length;for(let n=0;n<r.length;n++){let o=r[n];if(n>=t.length){i=!0;try{e.validate(o)}catch(e){s(n,e)}continue}if(!Object.is(t[n],o))try{let r=e.validateUsingKnownGoodVersion(t[n],o);Object.is(r,t[n])||(i=!0)}catch(e){s(n,e)}}return i?n:t}),this.itemValidator=e}itemValidator;nonEmpty(){return this.check(e=>{if(0===e.length)throw new o("Expected a non-empty array")})}lengthGreaterThan1(){return this.check(e=>{if(e.length<=1)throw new o("Expected an array with length greater than 1")})}}class c extends l{constructor(e,t=!1){const n=[],r=[];for(const[t,i]of Object.entries(e))n.push(t),r.push(i);super(l=>{if("object"!=typeof l||null===l)throw new o(`Expected object, got ${a(l)}`);for(let e=0;e<n.length;e++){let t=n[e];try{r[e].validate((0,i.g5)(l,t))}catch(e){s(t,e)}}if(!t){for(let t in l)if((0,i.mQ)(l,t)&&!(0,i.mQ)(e,t))throw new o("Unexpected property",[t])}return l},(l,d)=>{if(Object.is(l,d))return l;if("object"!=typeof d||null===d)throw new o(`Expected object, got ${a(d)}`);let c=!1;for(let e=0;e<n.length;e++){let t=n[e],o=(0,i.g5)(l,t),a=(0,i.g5)(d,t);if(!Object.is(o,a))try{let t=r[e],n=t.validateUsingKnownGoodVersion?t.validateUsingKnownGoodVersion(o,a):t.validate(a);Object.is(n,o)||(c=!0)}catch(e){s(t,e)}}if(t){if(!c){for(let t of Object.keys(d))if(!(0,i.mQ)(e,t)&&!Object.is((0,i.g5)(l,t),(0,i.g5)(d,t))){c=!0;break}}}else for(let t in d)if((0,i.mQ)(d,t)&&!(0,i.mQ)(e,t))throw new o("Unexpected property",[t]);if(!c){for(let e in l)if((0,i.mQ)(l,e)&&!(0,i.mQ)(d,e)){c=!0;break}}return c?d:l}),this.config=e,this.shouldAllowUnknownProperties=t}config;shouldAllowUnknownProperties;allowUnknownProperties(){return new c(this.config,!0)}extend(e){return new c({...this.config,...e})}}class h extends l{constructor(e,t,n,r){super(t=>{this.expectObject(t);let n=this.getMatchingSchema(t);if(void 0===n)return this.unknownValueValidation(t,this.getVariant(t));try{return n.validate(t)}catch(n){s(`(${e} = ${this.getVariant(t)})`,n)}},(t,n)=>{this.expectObject(n),this.expectObject(t);let r=this.getMatchingSchema(n);if(void 0===r)return this.unknownValueValidation(n,this.getVariant(n));try{if((0,i.g5)(t,e)!==(0,i.g5)(n,e))return r.validate(n);if(r.validateUsingKnownGoodVersion)return r.validateUsingKnownGoodVersion(t,n);return r.validate(n)}catch(t){s(`(${e} = ${this.getVariant(n)})`,t)}}),this.key=e,this.config=t,this.unknownValueValidation=n,this.useNumberKeys=r}key;config;unknownValueValidation;useNumberKeys;expectObject(e){if("object"!=typeof e||null===e)throw new o(`Expected an object, got ${a(e)}`,[])}getVariant(e){return(0,i.g5)(e,this.key)}getMatchingSchema(e){let t=(0,i.g5)(e,this.key);if(this.useNumberKeys||"string"==typeof t){if(this.useNumberKeys){let e=Number(t);if(e-e!=0)throw new o(`Expected a number for key "${this.key}", got "${t}"`)}}else throw new o(`Expected a string for key "${this.key}", got ${a(t)}`);return(0,i.mQ)(this.config,t)?this.config[t]:void 0}validateUnknownVariants(e){return new h(this.key,this.config,e,this.useNumberKeys)}}class u extends l{constructor(e,t){super(n=>{if("object"!=typeof n||null===n)throw new o(`Expected object, got ${a(n)}`);for(let r in n)if((0,i.mQ)(n,r))try{e.validate(r),t.validate(n[r])}catch(e){s(r,e)}return n},(n,r)=>{if("object"!=typeof r||null===r)throw new o(`Expected object, got ${a(r)}`);let l=!1,d=0;for(let o in r){if(!(0,i.mQ)(r,o))continue;d++;let a=r[o];if(!(0,i.mQ)(n,o)){l=!0;try{e.validate(o),t.validate(a)}catch(e){s(o,e)}continue}let c=n[o];if(!Object.is(c,a))try{let e=t.validateUsingKnownGoodVersion?t.validateUsingKnownGoodVersion(c,a):t.validate(a);Object.is(e,c)||(l=!0)}catch(e){s(o,e)}}if(!l){let e=0;for(let t in n)(0,i.mQ)(n,t)&&e++;e!==d&&(l=!0)}return l?r:n}),this.keyValidator=e,this.valueValidator=t}keyValidator;valueValidator}function p(e){return new l(t=>{if(typeof t!==e)throw new o(`Expected ${e}, got ${a(t)}`);return t})}let f=new l(e=>e),g=new l(e=>e),m=p("string"),y=new l(e=>{if(Number.isFinite(e))return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");throw new o(`Expected a finite number, got ${e}`)}),b=new l(e=>{if(Number.isFinite(e)&&e>=0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e<0)throw new o(`Expected a positive number, got ${e}`);throw new o(`Expected a finite number, got ${e}`)}),x=new l(e=>{if(Number.isFinite(e)&&e>0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e<=0)throw new o(`Expected a non-zero positive number, got ${e}`);throw new o(`Expected a finite number, got ${e}`)}),w=new l(e=>{if(Number.isFinite(e)&&0!==e)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(0===e)throw new o("Expected a non-zero number, got 0");throw new o(`Expected a finite number, got ${e}`)}),v=new l(e=>{if(Number.isFinite(e)&&e>=0&&e<=1)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");throw new o(`Expected a number between 0 and 1, got ${e}`)}),S=new l(e=>{if(Number.isInteger(e))return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e-e!=0)throw new o(`Expected a finite number, got ${e}`);throw new o(`Expected an integer, got ${e}`)}),C=new l(e=>{if(Number.isInteger(e)&&e>=0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e-e!=0)throw new o(`Expected a finite number, got ${e}`);if(e<0)throw new o(`Expected a positive integer, got ${e}`);throw new o(`Expected an integer, got ${e}`)}),k=new l(e=>{if(Number.isInteger(e)&&e>0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e-e!=0)throw new o(`Expected a finite number, got ${e}`);if(e<=0)throw new o(`Expected a non-zero positive integer, got ${e}`);throw new o(`Expected an integer, got ${e}`)}),P=p("boolean"),T=p("bigint");function E(e){return new l(t=>{if(t!==e)throw new o(`Expected ${e}, got ${JSON.stringify(t)}`);return e})}let I=new l(e=>{if(!Array.isArray(e))throw new o(`Expected an array, got ${a(e)}`);return e});function _(e){return new d(e)}let M=new l(e=>{if("object"!=typeof e||null===e)throw new o(`Expected object, got ${a(e)}`);return e});function A(e){return new c(e)}function j(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e)||Object.getPrototypeOf(e)===i.DM)}let O=new l(e=>{if(function e(t){if(null===t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)return!0;if(Array.isArray(t)){for(let n=0;n<t.length;n++)if(!e(t[n]))return!1;return!0}if(j(t)){for(let n in t)if((0,i.mQ)(t,n)&&!e(t[n]))return!1;return!0}return!1}(e))return e;throw new o(`Expected json serializable value, got ${typeof e}`)},(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){let n=e.length!==t.length;for(let r=0;r<t.length;r++){if(r>=e.length){n=!0,O.validate(t[r]);continue}let i=e[r],o=t[r];!Object.is(i,o)&&(Object.is(O.validateUsingKnownGoodVersion(i,o),i)||(n=!0))}return n?t:e}if(!(j(e)&&j(t)))return O.validate(t);{let n=!1;for(let r in t){if(!(0,i.mQ)(t,r))continue;if(!(0,i.mQ)(e,r)){n=!0,O.validate(t[r]);continue}let o=e[r],s=t[r];!Object.is(o,s)&&(Object.is(O.validateUsingKnownGoodVersion(o,s),o)||(n=!0))}if(!n){for(let r in e)if((0,i.mQ)(e,r)&&!(0,i.mQ)(t,r)){n=!0;break}}return n?t:e}});function D(){return L(m,O)}function L(e,t){return new u(e,t)}function R(e,t){return new h(e,t,(n,r)=>{throw new o(`Expected one of ${Object.keys(t).map(e=>JSON.stringify(e)).join(" or ")}, got ${JSON.stringify(r)}`,[e])},!1)}function F(e,t){return new h(e,t,(n,r)=>{throw new o(`Expected one of ${Object.keys(t).map(e=>JSON.stringify(e)).join(" or ")}, got ${JSON.stringify(r)}`,[e])},!0)}function z(e,t){return new l(n=>{try{return t.validate(n)}catch(t){s(e,t)}},(n,r)=>{try{if(t.validateUsingKnownGoodVersion)return t.validateUsingKnownGoodVersion(n,r);return t.validate(r)}catch(t){s(e,t)}})}function N(e){return new l(t=>{if(!e.has(t)){let n=Array.from(e,e=>JSON.stringify(e)).join(" or ");throw new o(`Expected ${n}, got ${t}`)}return t})}function $(e){return new l(t=>{if(void 0!==t)return e.validate(t)},(t,n)=>{if(void 0!==n)return e.validateUsingKnownGoodVersion&&void 0!==t?e.validateUsingKnownGoodVersion(t,n):e.validate(n)},e instanceof l&&e.skipSameValueCheck)}function B(e){return new l(t=>null===t?null:e.validate(t),(t,n)=>null===n?null:e.validateUsingKnownGoodVersion&&null!==t?e.validateUsingKnownGoodVersion(t,n):e.validate(n),e instanceof l&&e.skipSameValueCheck)}function H(...e){return N(new Set(e))}function U(e){try{return new URL(e)}catch{if(e.startsWith("/")||e.startsWith("./"))try{return new URL(e,"http://example.com")}catch{}throw new o(`Expected a valid url, got ${JSON.stringify(e)}`)}}let K=new Set(["http:","https:","mailto:"]),W=m.check(e=>{if(""===e)return;let t=U(e);if(!K.has(t.protocol.toLowerCase()))throw new o(`Expected a valid url, got ${JSON.stringify(e)} (invalid protocol)`)}),V=new Set(["http:","https:","data:","asset:"]),Y=m.check(e=>{if(""===e)return;let t=U(e);if(!V.has(t.protocol.toLowerCase()))throw new o(`Expected a valid url, got ${JSON.stringify(e)} (invalid protocol)`)}),G=m.check(e=>{if(""!==e&&!U(e).protocol.toLowerCase().match(/^https?:$/))throw new o(`Expected a valid url, got ${JSON.stringify(e)} (invalid protocol)`)}),q=m.refine(e=>{try{return(0,i.fb)(e),e}catch{throw new o(`Expected an index key, got ${JSON.stringify(e)}`)}});function X(e,t){return new l(n=>{try{return e.validate(n)}catch{return t.validate(n)}})}(0,i.lF)("@tldraw/validate","5.3.2","esm")},22954:(e,t,n)=>{"use strict";n.d(t,{Eq:()=>d});var r=new WeakMap,i=new WeakMap,o={},s=0,a=function(e){return e&&(e.host||a(e.parentNode))},l=function(e,t,n,l){var d=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=a(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});o[n]||(o[n]=new WeakMap);var c=o[n],h=[],u=new Set,p=new Set(d),f=function(e){!e||u.has(e)||(u.add(e),f(e.parentNode))};d.forEach(f);var g=function(e){!e||p.has(e)||Array.prototype.forEach.call(e.children,function(e){if(u.has(e))g(e);else try{var t=e.getAttribute(l),o=null!==t&&"false"!==t,s=(r.get(e)||0)+1,a=(c.get(e)||0)+1;r.set(e,s),c.set(e,a),h.push(e),1===s&&o&&i.set(e,!0),1===a&&e.setAttribute(n,"true"),o||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return g(t),u.clear(),s++,function(){h.forEach(function(e){var t=r.get(e)-1,o=c.get(e)-1;r.set(e,t),c.set(e,o),t||(i.has(e)||e.removeAttribute(l),i.delete(e)),o||e.removeAttribute(n)}),--s||(r=new WeakMap,r=new WeakMap,i=new WeakMap,o={})}},d=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),l(r,i,n,"aria-hidden")):function(){return null}}},23312:(e,t,n)=>{"use strict";n.d(t,{cee:()=>pO,ZCT:()=>pA,EF7:()=>pD,_LY:()=>pg,P3o:()=>pj,jhL:()=>pb,QVi:()=>r.QVi,A8:()=>r.A8,Unq:()=>pM,Yem:()=>pT,HQo:()=>cS,Hif:()=>u5,F0h:()=>p1,h4e:()=>pv,fPn:()=>pp,foZ:()=>pw,L4x:()=>pf,Gto:()=>pF,hDc:()=>r.hDc,ikG:()=>pu,hUo:()=>pk,fnc:()=>pP,RIo:()=>pR,Yby:()=>pz,dEX:()=>pL,V8r:()=>r.V8r,l7k:()=>py,jkh:()=>pI,GN7:()=>px,D7F:()=>pC,bIq:()=>ph,bKc:()=>pE,dGg:()=>u1,JGv:()=>u2,pY9:()=>uW,Isx:()=>uq,tJe:()=>uG,$EK:()=>uJ,C_T:()=>u0,f1t:()=>uQ,pPo:()=>uX,hLL:()=>u3,k2C:()=>uZ,T:()=>r.T,OsR:()=>r.OsR,SDB:()=>pm,Z1z:()=>x5,Cgn:()=>so,FUD:()=>aE,LRd:()=>ak,Tme:()=>pc,jY:()=>pS,XAu:()=>r.XAu,gPO:()=>p_,EWP:()=>r.EWP,gP_:()=>r.gP_,S6A:()=>r.S6A,n6Y:()=>r.n6Y,_zD:()=>r._zD,dBl:()=>r.dBl,Ats:()=>bY,TjI:()=>r.TjI,iPZ:()=>r.iPZ,Cho:()=>r.Cho,oEU:()=>r.oEU,woC:()=>r.woC,Mcl:()=>r.Mcl,AFA:()=>r.AFA,mfH:()=>r.mfH,P1V:()=>r.P1V,NF7:()=>r.NF7,NFA:()=>r.NFA,jH7:()=>A,hGv:()=>r.hGv,BSi:()=>r.BSi,_q_:()=>r._q_,FxY:()=>sz,lIP:()=>r.lIP,oqt:()=>r.oqt,K4z:()=>r.K4z,Bdt:()=>M,hau:()=>r.hau});var r=n(93647);let i=e=>.65*e+.35*(0,r.dwc)(e*r.PI/2),o=e=>({size:e,thinning:0,streamline:(0,r.wwY)(e,[9,16],[.64,.74],!0),smoothing:.62,simulatePressure:!1,easing:r.Z4H.linear});function s({strokeWidth:e,showAsComplete:t}){return{size:1+e,thinning:0,streamline:.5,smoothing:.5,simulatePressure:!1,easing:r.Z4H.easeOutSine,last:t}}function a(e,t,n,s){let a=e.isComplete||n;if(s)if(!e.isPen)return{...o(t),last:a};else return{...{size:t,thinning:0,streamline:.62,smoothing:.62,simulatePressure:!1,easing:r.Z4H.linear},last:a};if("draw"===e.dash)if(e.isPen)return{size:1+1.2*t,thinning:.62,streamline:.62,smoothing:.62,simulatePressure:!1,easing:i,last:a};else return{...{size:t,thinning:.5,streamline:(0,r.wwY)(t,[9,16],[.64,.74],!0),smoothing:.62,easing:r.Z4H.easeOutSine,simulatePressure:!0},last:a};return{...o(t),last:a}}function l(e,t=1,n=1){let i=[];for(let o of e)!function(e,t,n,i=[]){let o=r.K6A.decodePoints(e.path,e.dim);if(1!==t||1!==n)for(let e of o)e.x*=t,e.y*=n;if("free"===e.type||o.length<2)i.push(...o.map(r.l2P.From));else{let e=r.l2P.From(o[0]),t=r.l2P.From(o[1]),n=r.l2P.Dist(t,e);if(0===n)i.push(e);else{let o=r.l2P.Tan(t,e),s=Math.min(1,Math.floor(n/4)),a=r.l2P.Add(e,r.l2P.Mul(o,s)),l=r.l2P.Add(t,r.l2P.Mul(o,-s)),d=Math.max(4,Math.floor(n/16));i.push(e,...r.l2P.PointsBetween(a,l,d,r.Z4H.easeInOutCubic),t)}}}(o,t,n,i);return i}var d=n(95155);class c{static lineThroughPoints(e,t){let n=new c;n.moveTo(e[0].x,e[0].y,{...t,offset:t?.endOffsets??t?.offset});for(let r=1;r<e.length;r++){let i=r===e.length-1;n.lineTo(e[r].x,e[r].y,i?{offset:t?.endOffsets}:void 0)}return n}static cubicSplineThroughPoints(e,t){let n=new c,r=e.length,i=r-2;n.moveTo(e[0].x,e[0].y,{...t,offset:t?.endOffsets??t?.offset});for(let o=0;o<r-1;o++){let r,s,a,l,d,c=0===o?e[0]:e[o-1],h=e[o],u=e[o+1],p=o===i?u:e[o+2];0===o?(r=c.x,s=c.y):(r=h.x+(u.x-c.x)/6*1.25,s=h.y+(u.y-c.y)/6*1.25),o===i?(a=u.x,l=u.y,d={offset:t?.endOffsets}):(a=u.x-(p.x-h.x)/6*1.25,l=u.y-(p.y-h.y)/6*1.25),n.cubicBezierTo(u.x,u.y,r,s,a,l,d)}return n}commands=[];lastMoveTo=null;assertHasMoveTo(){return(0,r.vAR)(this.lastMoveTo,"Start an SVGPathBuilder with `.moveTo()`"),this.lastMoveTo}moveTo(e,t,n){return this.lastMoveTo={type:"move",x:e,y:t,closeIdx:null,isClose:!1,opts:n},this.commands.push(this.lastMoveTo),this}lineTo(e,t,n){return this.assertHasMoveTo(),this.commands.push({type:"line",x:e,y:t,isClose:!1,opts:n}),this}circularArcTo(e,t,n,r,i,o){return this.arcTo(e,e,t,n,0,r,i,o)}arcTo(e,t,n,i,o,s,a,l){this.assertHasMoveTo();let d=this.commands[this.commands.length-1].x,c=this.commands[this.commands.length-1].y;if(d===s&&c===a)return this;if(0===e||0===t)return this.lineTo(s,a,l);let h=Math.sin(o),u=Math.cos(o),p=Math.abs(e),f=Math.abs(t),g=(d-s)/2,m=(c-a)/2,y=u*g+h*m,b=-h*g+u*m,x=y*y/(p*p)+b*b/(f*f);if(x>1){let e=Math.sqrt(x);p*=e,f*=e}let w=(p*p*f*f-p*p*b*b-f*f*y*y)/(p*p*b*b+f*f*y*y),v=(n!==i?1:-1)*Math.sqrt(w=w<0?0:w),S=p*b/f*v,C=-(f*y)/p*v,k=u*S-h*C+(d+s)/2,P=h*S+u*C+(c+a)/2,T=Math.atan2((b-C)/f,(y-S)/p),E=Math.atan2((-b-C)/f,(-y-S)/p);!i&&E>T?E-=2*Math.PI:i&&E<T&&(E+=2*Math.PI);let I=E-T,_=Math.max(p,f)*Math.abs(I),M=Math.min(4,Math.ceil(Math.abs(I)/(Math.PI/2))),A=Math.ceil((0,r.qnK)(_)/M),j=I/M,O=e=>({x:k+p*Math.cos(e)*u-f*Math.sin(e)*h,y:P+p*Math.cos(e)*h+f*Math.sin(e)*u}),D=e=>({x:-p*Math.sin(e)*u-f*Math.cos(e)*h,y:-p*Math.sin(e)*h+f*Math.cos(e)*u});for(let e=0;e<M;e++){let t=T+e*j,n=T+(e+1)*j,r=n-t,i=O(t),o=O(n),s=D(t),a=D(n),d=4/3*Math.tan(r/4),c=i.x+d*s.x,h=i.y+d*s.y,u=o.x-d*a.x,p=o.y-d*a.y,f=0===e?l:{...l,mergeWithPrevious:!0};this.cubicBezierToWithResolution(o.x,o.y,c,h,u,p,f,A)}return this}cubicBezierTo(e,t,n,r,i,o,s){return this.cubicBezierToWithResolution(e,t,n,r,i,o,s)}cubicBezierToWithResolution(e,t,n,r,i,o,s,a){return this.assertHasMoveTo(),this.commands.push({type:"cubic",x:e,y:t,cp1:{x:n,y:r},cp2:{x:i,y:o},isClose:!1,opts:s,resolution:a}),this}close(){let e=this.assertHasMoveTo(),t=this.commands[this.commands.length-1];return(0,r.YY0)(e.x,t.x)&&(0,r.YY0)(e.y,t.y)?t.isClose=!0:this.commands.push({type:"line",x:e.x,y:e.y,isClose:!0}),e.closeIdx=this.commands.length-1,this.lastMoveTo=null,this}transform(e){let t=new c;for(let n of this.commands){let[i,o]=r.V8r.applyToXY(e,n.x,n.y);switch(n.type){case"move":case"line":t.commands.push({...n,x:i,y:o,_info:void 0});break;case"cubic":{let[s,a]=r.V8r.applyToXY(e,n.cp1.x,n.cp1.y),[l,d]=r.V8r.applyToXY(e,n.cp2.x,n.cp2.y);t.commands.push({...n,x:i,y:o,cp1:{x:s,y:a},cp2:{x:l,y:d},_info:void 0});break}default:(0,r.h6G)(n,"type")}}return t}toD(e={}){let{startIdx:t=0,endIdx:n=this.commands.length,onlyFilled:i=!1}=e,o=[],s=!1,a=!1,l=!1,d=e=>{if(a||0===e)return;a=!0;let t=this.commands[e-1];o.push("M",(0,r.WMC)(t.x),(0,r.WMC)(t.y))};for(let e=t;e<n;e++){let t=this.commands[e];switch(t.type){case"move":{let e=t.opts?.geometry!==!1&&(t.opts?.geometry?.isFilled??!1);i&&!e?s=!0:(s=!1,a=!0,l=!0,o.push("M",(0,r.WMC)(t.x),(0,r.WMC)(t.y)));break}case"line":if(s)break;d(e),t.isClose&&l?o.push("Z"):o.push("L",(0,r.WMC)(t.x),(0,r.WMC)(t.y));break;case"cubic":if(s)break;d(e),o.push("C",(0,r.WMC)(t.cp1.x),(0,r.WMC)(t.cp1.y),(0,r.WMC)(t.cp2.x),(0,r.WMC)(t.cp2.y),(0,r.WMC)(t.x),(0,r.WMC)(t.y));break;default:(0,r.h6G)(t,"type")}}return o.join(" ")}toSvg(e){if("none"===e.style)return null;if(e.forceSolid)return this.toSolidSvg(e);switch(e.style){case"solid":return this.toSolidSvg(e);case"dashed":case"dotted":return this.toDashedSvg(e);case"draw":return this.toDrawSvg(e);default:(0,r.h6G)(e,"style")}}toPath2D(e){return"none"===e.style?new Path2D:new Path2D(e.forceSolid||"solid"===e.style?this.toD({onlyFilled:e.onlyFilled}):"draw"===e.style?this.toDrawD(e):this.toD({onlyFilled:e.onlyFilled}))}toGeometry(){let e=[],t=null;for(let n=0;n<this.commands.length;n++){let i=this.commands[n];"move"===i.type&&(t&&t.opts?.geometry!==!1&&e.push(new u(this,t.startIdx,n,{...t.opts?.geometry,isFilled:t.opts?.geometry?.isFilled??!1,isClosed:null!==t.moveCommand.closeIdx})),t={startIdx:n,moveCommand:i,opts:i.opts,isClosed:!1}),i.isClose&&((0,r.vAR)(t,"No current move command"),t.isClosed=!0)}return(t&&t.opts?.geometry!==!1&&e.push(new u(this,t.startIdx,this.commands.length,{...t.opts?.geometry,isFilled:t.opts?.geometry?.isFilled??!1,isClosed:null!==t.moveCommand.closeIdx})),(0,r.vAR)(e.length>0),1===e.length)?e[0]:new r.IQE({children:e})}toSolidSvg(e){let{strokeWidth:t,props:n}=e;return(0,d.jsx)("path",{strokeWidth:t,d:this.toD({onlyFilled:e.onlyFilled}),...n})}toDashedSvg(e){let t,{style:n,strokeWidth:i,snap:o,lengthRatio:s,props:{markerStart:a,markerEnd:l,...c}={}}=e,h=[],u=!1,p=!1,f=null,g=()=>{if(!f)return;let{startIdx:t,endIdx:c,isFirst:u,isLast:p,length:g,lineOpts:m,pathIsClosed:y}=f;if(f=null,t===c&&"move"===this.commands[t].type)return;let b=m?.dashStart??e.start,x=m?.dashEnd??e.end,{strokeDasharray:w,strokeDashoffset:v}=(0,r.EK8)(g,i,{style:n,snap:o,lengthRatio:s,start:u?b??(y?"outset":"none"):"outset",end:p?x??(y?"outset":"none"):"outset"}),S=this.toD({startIdx:t,endIdx:c+1});h.push((0,d.jsx)("path",{d:S,strokeDasharray:w,strokeDashoffset:v,markerStart:u?a:void 0,markerEnd:p?l:void 0},h.length))};for(let n=0;n<this.commands.length;n++){let r=this.commands[n],i=this.commands[n-1];if("move"===r.type){u=null!==r.closeIdx;let n=r.opts?.geometry!==!1&&(r.opts?.geometry?.isFilled??!1);e.onlyFilled&&!n?p=!0:(p=!1,t=r.opts);continue}if(p)continue;let o=this.calculateSegmentLength(i,r),s="move"===i.type,a=r.isClose||n===this.commands.length-1||this.commands[n+1]?.type==="move";f&&r.opts?.mergeWithPrevious?(f.length+=o,f.endIdx=n,f.isLast=a):(g(),f={startIdx:n,endIdx:n,isFirst:s,isLast:a,length:o,lineOpts:t,pathIsClosed:u})}return g(),(0,d.jsx)("g",{strokeWidth:i,...c,children:h})}toDrawSvg(e){return(0,d.jsx)("path",{strokeWidth:e.strokeWidth,d:this.toDrawD(e),...e.props})}toDrawD(e){let{strokeWidth:t,randomSeed:n,offset:i=t/3,roundness:o=2*t,passes:s=2,onlyFilled:a=!1}=e,l=[],d=this.getCommandInfo(),c=[],u=null;for(let e=0;e<this.commands.length;e++){let t=this.commands[e],n=t.opts?.offset??i,s=t.opts?.roundness??o;"move"===t.type&&(u=e);let a=t.isClose?(0,r.Z1O)(u)+1:this.commands[e+1]&&"move"!==this.commands[e+1].type?e+1:void 0,l=void 0!==a&&this.commands[a]&&this.commands[a]?.type!=="move"?d[a]:void 0,p=h[t.type],f=void 0!==a&&h[this.commands[a].type],g=d[e],m=g?.tangentEnd,y=l?.tangentStart,b=p&&f&&m&&y&&r.l2P.Len2(m)>.01&&r.l2P.Len2(y)>.01?(0,r.wwY)(Math.abs(r.l2P.AngleBetween(m,y)),[Math.PI/2,Math.PI],[s,0],!0):0,x=Math.min(g?.length??1/0,l?.length??1/0)-2*b,w=(0,r.qE8)(n,0,x/4),v=Math.min(b,(g?.length??1/0)/4),S=Math.min(b,(l?.length??1/0)/4),C={command:t,offsetAmount:w,roundnessBefore:v,roundnessAfter:S,tangentToPrev:d[e]?.tangentEnd,tangentToNext:l?.tangentStart,moveDidClose:!1};if(c.push(C),t.isClose&&null!==u){let e=c[u];e.moveDidClose=!0,e.roundnessAfter=S}else"move"===t.type&&(u=e)}for(let e=0;e<s;e++){let t=(0,r.She)(n+e),i={x:0,y:0},o=!1;for(let{command:e,offsetAmount:n,roundnessBefore:s,roundnessAfter:d,tangentToNext:h,tangentToPrev:u}of c){let c;if(e.isClose)c=i;else{let e=new r.l2P(t(),t()).uni(),i=Math.sqrt(Math.abs(t()))*n;c=r.l2P.Mul(e,i)}if("move"===e.type){i=c;let t=e.opts?.geometry!==!1&&(e.opts?.geometry?.isFilled??!1);o=!!a&&!t}if(o)continue;let p=r.l2P.Add(e,c),f=h&&d>0?r.l2P.Mul(h,-d).add(p):p,g=u&&s>0?r.l2P.Mul(u,s).add(p):p;if(f===p||g===p)switch(e.type){case"move":l.push("M",(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"line":l.push("L",(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"cubic":{let t=r.l2P.Add(e.cp1,c),n=r.l2P.Add(e.cp2,c);l.push("C",(0,r.WMC)(t.x),(0,r.WMC)(t.y),(0,r.WMC)(n.x),(0,r.WMC)(n.y),(0,r.WMC)(f.x),(0,r.WMC)(f.y));break}default:(0,r.h6G)(e,"type")}else switch(e.type){case"move":l.push("M",(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"line":l.push("L",(0,r.WMC)(g.x),(0,r.WMC)(g.y),"Q",(0,r.WMC)(p.x),(0,r.WMC)(p.y),(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"cubic":{let t=r.l2P.Add(e.cp1,c),n=r.l2P.Add(e.cp2,c);l.push("C",(0,r.WMC)(t.x),(0,r.WMC)(t.y),(0,r.WMC)(n.x),(0,r.WMC)(n.y),(0,r.WMC)(p.x),(0,r.WMC)(p.y));break}default:(0,r.h6G)(e,"type")}}}return l.join(" ")}calculateSegmentLength(e,t){switch(t.type){case"move":return 0;case"line":return r.l2P.Dist(e,t);case"cubic":return p.length(e.x,e.y,t.cp1.x,t.cp1.y,t.cp2.x,t.cp2.y,t.x,t.y);default:(0,r.h6G)(t,"type")}}getCommands(){return this.commands}getCommandInfo(){let e=[];for(let t=1;t<this.commands.length;t++){let n,i,o=this.commands[t-1],s=this.commands[t];if(s._info){e[t]=s._info;continue}if("move"!==s.type){switch(s.type){case"line":n=i=r.l2P.Sub(o,s).uni();break;case"cubic":n=r.l2P.Sub(s.cp1,o).uni(),i=r.l2P.Sub(s.cp2,s).uni();break;default:(0,r.h6G)(s,"type")}s._info={tangentStart:n,tangentEnd:i,length:this.calculateSegmentLength(o,s)},e[t]=s._info}}return e}}let h={line:!0,move:!0,cubic:!1};class u extends r.vqJ{constructor(e,t,n,r){super(r),this.path=e,this.startIdx=t,this.endIdx=n}path;startIdx;endIdx;_segments=null;getSegments(){if(this._segments)return this._segments;this._segments=[];let e=this.path.commands[this.startIdx];(0,r.vAR)("move"===e.type);for(let t=this.startIdx+1;t<this.endIdx;t++){let n=this.path.commands[t];switch((0,r.vAR)("move"!==n.type),n.type){case"line":this._segments.push(new r.AoN({start:r.l2P.From(e),end:r.l2P.From(n)}));break;case"cubic":this._segments.push(new r.iON({start:r.l2P.From(e),cp1:r.l2P.From(n.cp1),cp2:r.l2P.From(n.cp2),end:r.l2P.From(n),resolution:n.resolution}));break;default:(0,r.h6G)(n,"type")}e=n}return this._segments}getVertices(e){let t=this.getSegments().flatMap(t=>t.getVertices(e)).filter((e,t,n)=>{let i=n[t-1];return!i||!r.l2P.Equals(i,e)});if(this.isClosed){let e=t[t.length-1],n=t[0];r.l2P.Equals(e,n)||t.push(n)}return t}nearestPoint(e,t){let n=null,i=1/0;for(let t of this.getSegments()){let o=t.nearestPoint(e),s=r.l2P.Dist2(e,o);s<i&&(i=s,n=o)}return(0,r.vAR)(n,"No nearest point found"),n}hitTestLineSegment(e,t,n=0,r){return super.hitTestLineSegment(e,t,n,r)}getSvgPathData(){return this.path.toD({startIdx:this.startIdx,endIdx:this.endIdx})}}let p={base3(e,t,n,r,i){let o=e*(-3*t+9*n-9*r+3*i)+6*t-12*n+6*r;return e*o-3*t+3*n},length(e,t,n,r,i,o,s,a,l=1){let d=(l=l>1?1:l<0?0:l)/2,c=0;c=0;for(let l=0;l<12;l++){let h=d*p.Tvalues[l]+d,u=p.base3(h,e,n,i,s),f=p.base3(h,t,r,o,a),g=u*u+f*f;c+=p.Cvalues[l]*Math.sqrt(g)}return d*c},Tvalues:[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],Cvalues:[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472]};var f=n(12115);function g(){let e=(0,r.frr)(),t=(0,r.hau)("animationSpeed",()=>e?.user.getAnimationSpeed(),[e]),[n,i]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{if(void 0!==t)return void i(0===t);let n=e?.getContainerWindow()??window;if(!("matchMedia"in n))return;let r=n.matchMedia("(prefers-reduced-motion: reduce)"),o=()=>{i(r.matches)};return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t,e]),n}function m(e){return"richText"in e.props&&r.eHF.isValid(e.props.richText)}function y(e,t,n={}){let r="string"==typeof t?e.getShape(t):t;if(r&&e.canEditShape(r)){if(!m(r))throw Error("Shape does not have rich text");e.setEditingShape(r),e.setCurrentTool("select.editing_shape",{...n.info,target:"shape",shape:r}),n.selectAll&&e.emit("select-all-text",{shapeId:r.id})}}let b=(0,f.createContext)(null);function x({children:e}){let t=(0,r.fpl)("a11y",{msg:"",priority:"assertive"}),n=(0,f.useContext)(b),i=(0,f.useMemo)(()=>({currentMsg:t,announce(e){e&&t.set(e)}}),[t]);return n?(0,d.jsx)(d.Fragment,{children:e}):(0,d.jsx)(b.Provider,{value:i,children:e})}function w(){let e=(0,f.useContext)(b);if(!e)throw Error("useA11y must be used within a A11yContext.Provider");return e}let v=(0,f.createContext)(null);function S({assetUrls:e,children:t}){return(0,f.useEffect)(()=>{let t=new Set;for(let n of[...Object.values(e.icons),...Object.values(e.embedIcons)]){if(!n)continue;let e=n.split("#")[0];if(t.has(e))continue;t.add(e);let i=(0,r._V3)();i.crossOrigin="anonymous",i.src=n,i.decode().catch(r.lQ1)}},[e]),(0,d.jsx)(v.Provider,{value:e,children:t})}function C(){let e=(0,f.useContext)(v);if(!e)throw Error("useAssetUrls must be used within an AssetUrlsProvider");return e}let k={"action.toggle-auto-pan":"Auto (trackpad)","action.toggle-auto-zoom":"Auto (mouse)","action.toggle-auto-none":"Auto","action.toggle-mouse":"Mouse","action.toggle-trackpad":"Trackpad","action.convert-to-bookmark":"Convert to bookmark","action.convert-to-embed":"Convert to embed","action.open-embed-link":"Open link","action.align-bottom":"Align bottom","action.align-center-horizontal":"Align horizontally","action.align-center-vertical":"Align vertically","action.align-center-horizontal.short":"Align H","action.align-center-vertical.short":"Align V","action.align-left":"Align left","action.align-right":"Align right","action.align-top":"Align top","action.back-to-content":"Back to content","action.bring-forward":"Bring forward","action.bring-to-front":"Bring to front","action.copy-as-json.short":"JSON","action.copy-as-json":"Copy as JSON","action.copy-as-png.short":"PNG","action.copy-as-png":"Copy as PNG","action.copy-as-svg.short":"SVG","action.copy-as-svg":"Copy as SVG","action.copy":"Copy","action.copy-hovered-styles":"Copy hovered styles","action.cut":"Cut","action.delete":"Delete","action.unlock-all":"Unlock all","action.distribute-horizontal":"Distribute horizontally","action.distribute-vertical":"Distribute vertically","action.distribute-horizontal.short":"Distribute H","action.distribute-vertical.short":"Distribute V","action.download-original":"Download original","action.duplicate":"Duplicate","action.edit-link":"Edit link…","action.exit-pen-mode":"Exit pen mode","action.export-as-png.short":"PNG","action.export-as-png":"Export as PNG","action.export-as-svg.short":"SVG","action.export-as-svg":"Export as SVG","action.export-all-as-png.short":"PNG","action.export-all-as-png":"Export as PNG","action.export-all-as-svg.short":"SVG","action.export-all-as-svg":"Export as SVG","action.fit-frame-to-content":"Fit to content","action.flip-horizontal":"Flip horizontally","action.flip-vertical":"Flip vertically","action.flip-horizontal.short":"Flip H","action.flip-vertical.short":"Flip V","action.fork-project":"Fork this project","action.fork-project-on-tldraw":"Fork project on tldraw","action.frame-selection":"Frame selection","action.group":"Group","action.insert-embed":"Insert embed…","action.insert-media":"Upload media…","action.leave-shared-project":"Leave shared project","action.new-project":"New project","action.new-shared-project":"New shared project","action.open-cursor-chat":"Cursor chat","action.open-kbd-shortcuts":"Keyboard shortcuts","action.open-file":"Open file","action.pack":"Pack","action.paste":"Paste","action.paste-error-title":"Pasting failed","action.paste-error-description":"Could not paste due to missing clipboard permissions. Please enable the permissions and try again.","action.print":"Print…","action.redo":"Redo","action.remove-frame":"Remove frame","action.rename":"Rename","action.rotate-ccw":"Rotate counterclockwise","action.rotate-cw":"Rotate clockwise","action.save-copy":"Save a copy","action.select-all":"Select all","action.select-none":"Select none","action.send-backward":"Send backward","action.send-to-back":"Send to back","action.share-project":"Share this project","action.stack-horizontal":"Stack horizontally","action.stack-vertical":"Stack vertically","action.stack-horizontal.short":"Stack H","action.stack-vertical.short":"Stack V","action.stop-following":"Stop following","action.stretch-horizontal":"Stretch horizontally","action.stretch-vertical":"Stretch vertically","action.stretch-horizontal.short":"Stretch H","action.stretch-vertical.short":"Stretch V","action.toggle-auto-size":"Toggle auto size","action.toggle-dark-mode.menu":"Dark mode","action.toggle-dark-mode":"Toggle dark mode","action.toggle-paste-at-cursor.menu":"Paste at cursor","action.toggle-paste-at-cursor":"Toggle paste at cursor","action.toggle-wrap-mode.menu":"Select on wrap","action.toggle-wrap-mode":"Toggle select on wrap","action.toggle-reduce-motion.menu":"Reduce motion","action.toggle-reduce-motion":"Toggle reduce motion","action.toggle-keyboard-shortcuts.menu":"Enable keyboard shortcuts","action.toggle-keyboard-shortcuts":"Toggle keyboard shortcuts","action.enhanced-a11y-mode.menu":"Enhanced accessibility mode","action.enhanced-a11y-mode":"Toggle enhanced accessibility mode","action.toggle-edge-scrolling.menu":"Edge scrolling","action.toggle-edge-scrolling":"Toggle edge scrolling","action.toggle-invert-zoom.menu":"Invert mouse zoom","action.toggle-invert-zoom":"Toggle invert mouse zoom","action.toggle-debug-mode.menu":"Debug mode","action.toggle-debug-mode":"Toggle debug mode","action.toggle-focus-mode.menu":"Focus mode","action.toggle-focus-mode":"Toggle focus mode","action.toggle-dynamic-size-mode.menu":"Dynamic size","action.toggle-dynamic-size-mode":"Toggle dynamic size","action.toggle-grid.menu":"Show grid","action.toggle-grid":"Toggle grid","action.toggle-lock":"Toggle locked","action.flatten-to-image":"Flatten","action.toggle-snap-mode.menu":"Always snap","action.toggle-snap-mode":"Toggle always snap","action.toggle-tool-lock.menu":"Tool lock","action.toggle-tool-lock":"Toggle tool lock","action.toggle-transparent.context-menu":"Transparent","action.toggle-transparent.menu":"Transparent","action.toggle-transparent":"Toggle transparent background","action.undo":"Undo","action.ungroup":"Ungroup","action.zoom-in":"Zoom in","action.zoom-out":"Zoom out","action.zoom-to-100":"Zoom to 100%","action.zoom-to-fit":"Zoom to fit","action.zoom-to-selection":"Zoom to selection","action.zoom-quick":"Quick zoom","action.select-zoom-tool":"Zoom","assets.files.size-too-big":"File size is too big","assets.files.maximum-size":"Maximum file size is {size}","assets.files.type-not-allowed":"File type is not allowed","assets.files.upload-failed":"Upload failed","assets.files.amount-too-many":"Too many files","assets.url.failed":"Couldn’t load URL preview","theme.dark":"Dark","theme.light":"Light","theme.system":"System","color-style.white":"White","color-style.black":"Black","color-style.blue":"Blue","color-style.green":"Green","color-style.grey":"Grey","color-style.light-blue":"Light blue","color-style.light-green":"Light green","color-style.light-red":"Light red","color-style.light-violet":"Light violet","color-style.orange":"Orange","color-style.red":"Red","color-style.violet":"Violet","color-style.yellow":"Yellow","fill-style.none":"None","document.default-name":"Untitled","fill-style.semi":"Semi","fill-style.solid":"Solid","fill-style.pattern":"Pattern","fill-style.fill":"Fill","fill-style.lined-fill":"Lined fill","dash-style.dashed":"Dashed","dash-style.dotted":"Dotted","dash-style.draw":"Draw","dash-style.solid":"Solid","size-style.s":"Small","size-style.m":"Medium","size-style.l":"Large","size-style.xl":"Extra large","opacity-style.0.1":"10%","opacity-style.0.25":"25%","opacity-style.0.5":"50%","opacity-style.0.75":"75%","opacity-style.1":"100%","font-style.draw":"Draw","font-style.sans":"Sans","font-style.serif":"Serif","font-style.mono":"Mono","align-style.start":"Start","align-style.middle":"Middle","align-style.end":"End","align-style.justify":"Justify","verticalAlign-style.start":"Top","verticalAlign-style.middle":"Middle","verticalAlign-style.end":"Bottom","geo-style.arrow-down":"Arrow down","geo-style.arrow-left":"Arrow left","geo-style.arrow-right":"Arrow right","geo-style.arrow-up":"Arrow up","geo-style.cloud":"Cloud","geo-style.diamond":"Diamond","geo-style.ellipse":"Ellipse","geo-style.heart":"Heart","geo-style.hexagon":"Hexagon","geo-style.octagon":"Octagon","geo-style.oval":"Oval","geo-style.pentagon":"Pentagon","geo-style.rectangle":"Rectangle","geo-style.rhombus":"Rhombus","geo-style.rhombus-2":"Rhombus left","geo-style.star":"Star","geo-style.trapezoid":"Trapezoid","geo-style.triangle":"Triangle","geo-style.x-box":"X box","geo-style.check-box":"Check box","arrowheadStart-style.none":"None","arrowheadStart-style.arrow":"Arrow","arrowheadStart-style.bar":"Bar","arrowheadStart-style.diamond":"Diamond","arrowheadStart-style.dot":"Dot","arrowheadStart-style.inverted":"Inverted","arrowheadStart-style.pipe":"Pipe","arrowheadStart-style.square":"Square","arrowheadStart-style.triangle":"Triangle","arrowheadEnd-style.none":"None","arrowheadEnd-style.arrow":"Arrow","arrowheadEnd-style.bar":"Bar","arrowheadEnd-style.diamond":"Diamond","arrowheadEnd-style.dot":"Dot","arrowheadEnd-style.inverted":"Inverted","arrowheadEnd-style.pipe":"Pipe","arrowheadEnd-style.square":"Square","arrowheadEnd-style.triangle":"Triangle","spline-style.line":"Line","spline-style.cubic":"Cubic","arrow-kind-style.arc":"Arc","arrow-kind-style.elbow":"Elbow","tool.select":"Select","tool.hand":"Hand","tool.draw":"Draw","tool.eraser":"Eraser","tool.arrow-down":"Arrow down","tool.arrow-left":"Arrow left","tool.arrow-right":"Arrow right","tool.arrow-up":"Arrow up","tool.arrow":"Arrow","tool.cloud":"Cloud","tool.diamond":"Diamond","tool.ellipse":"Ellipse","tool.heart":"Heart","tool.hexagon":"Hexagon","tool.highlight":"Highlight","tool.line":"Line","tool.octagon":"Octagon","tool.oval":"Oval","tool.pentagon":"Pentagon","tool.rectangle":"Rectangle","tool.rhombus":"Rhombus","tool.star":"Star","tool.trapezoid":"Trapezoid","tool.triangle":"Triangle","tool.x-box":"X box","tool.check-box":"Check box","tool.media":"Media","tool.frame":"Frame","tool.note":"Note","tool.laser":"Laser","tool.embed":"Embed","tool.text":"Text","tool.pointer-down":"Pointer down","tool.image-zoom":"Zoom","tool.replace-media":"Replace media…","tool.flip-horz":"Flip horizontally","tool.flip-vert":"Flip vertically","tool.rotate-cw":"Rotate","tool.aspect-ratio":"Aspect ratio","tool.aspect-ratio.original":"Original","tool.aspect-ratio.square":"Square (1:1)","tool.aspect-ratio.circle":"Circle (1:1)","tool.aspect-ratio.landscape":"Landscape (4:3)","tool.aspect-ratio.portrait":"Portrait (3:4)","tool.aspect-ratio.wide":"Wide (16:9)","tool.image-toolbar-title":"Image tools","tool.image-crop":"Crop image","tool.image-crop-confirm":"Confirm","tool.media-alt-text":"Alternative text","tool.media-alt-text-desc":"Give a description…","tool.media-alt-text-confirm":"Confirm","tool.rich-text-bold":"Bold","tool.rich-text-italic":"Italic","tool.rich-text-code":"Code","tool.rich-text-highlight":"Highlight","tool.rich-text-strikethrough":"Strikethrough","tool.rich-text-link":"Link","tool.rich-text-link-visit":"Visit link","tool.rich-text-link-remove":"Remove link","tool.rich-text-header":"Header","tool.rich-text-bulletList":"Bulleted list","tool.rich-text-toolbar-title":"Text formatting","tool.rich-text-orderedList":"Ordered list","tool.bookmark":"Bookmark","a11y.status":"Status","a11y.skip-to-main-content":"Move focus to canvas","a11y.shape-index":"{num} of {total}","a11y.shape-image":"Image","a11y.shape-video":"Video","a11y.multiple-shapes":"{num} shapes selected","a11y.select-shape":"Select next shape","a11y.select-shape-direction":"Select shape in direction","a11y.enter-leave-container":"Enter/leave container","a11y.repeat-shape":"Repeat shape","a11y.move-shape":"Move shape","a11y.move-shape-faster":"Move shape faster","a11y.rotate-shape-cw":"Rotate shape clockwise","a11y.rotate-shape-ccw":"Rotate shape counterclockwise","a11y.rotate-shape-cw-fine":"Rotate shape clockwise (fine)","a11y.rotate-shape-ccw-fine":"Rotate shape counterclockwise (fine)","a11y.enlarge-shape":"Enlarge shape","a11y.shrink-shape":"Shrink shape","a11y.pan-camera":"Pan camera","a11y.adjust-shape-styles":"Adjust shape styles","a11y.open-context-menu":"Context menu…","a11y.open-keyboard-shortcuts":"Keyboard shortcuts","menu.title":"Menu","menu.theme":"Theme","menu.color-theme":"Color theme","menu.accessibility":"Accessibility","menu.copy-as":"Copy as","menu.edit":"Edit","menu.export-as":"Export as","menu.file":"File","menu.language":"Language","menu.preferences":"Preferences","menu.view":"View","menu.input-device":"Input device","context-menu.title":"Context menu","context-menu.edit":"Edit","context-menu.arrange":"Arrange","context-menu.copy-as":"Copy as","context-menu.export-as":"Export as","context-menu.export-all-as":"Export","context-menu.move-to-page":"Move to page","context-menu.reorder":"Reorder","page-menu.title":"Pages","page-menu.create-new-page":"Create new page","page-menu.max-pages-reached":"Maximum pages reached","page-menu.new-page-initial-name":"Page 1","page-menu.edit-start":"Edit","page-menu.edit-done":"Done","page-menu.go-to-page":"Go to page","page-menu.resize":"Resize page list","page-menu.submenu.rename":"Rename","page-menu.submenu.duplicate-page":"Duplicate","page-menu.submenu.title":"Menu","page-menu.submenu.move-down":"Move down","page-menu.submenu.move-up":"Move up","page-menu.submenu.delete":"Delete","share-menu.title":"Share","share-menu.save-note":"Download this project to your computer as a .tldr file.","share-menu.fork-note":"Create a new shared project based on this snapshot.","share-menu.share-project":"Share this project","share-menu.copy-link":"Copy editor link","share-menu.create-snapshot-link":"Copy snapshot link","share-menu.snapshot-link-note":"Capture and share this project as a read-only snapshot link.","share-menu.copy-readonly-link":"Copy viewer link","share-menu.offline-note":"Create a new shared project based on your current project.","share-menu.copy-link-note":"Anyone with the link will be able to view and edit this project.","share-menu.copy-readonly-link-note":"Anyone with the link will be able to access this project.","share-menu.project-too-large":"Sorry, this project can’t be shared because it’s too large. We’re working on it!","share-menu.upload-failed":"Sorry, we couldn’t upload your project at the moment. Please try again or let us know if the problem persists.","share-menu.creating-project":"Creating the new project…","share-menu.copied":"Copied link","document-name-menu.copy-link":"Copy link","status.offline":"Offline","people-menu.title":"People","people-menu.change-name":"Change name","people-menu.avatar-color":"Avatar color","people-menu.change-color":"Change color","people-menu.follow":"Following","people-menu.following":"Following","people-menu.leading":"Following you","people-menu.user":"(You)","people-menu.invite":"Invite others","people-menu.anonymous-user":"New user","help-menu.import-tldr-file":"Import file…","help-menu.title":"Help and resources","help-menu.about":"About tldraw","help-menu.discord":"Discord","help-menu.github":"GitHub","help-menu.keyboard-shortcuts":"Keyboard shortcuts","help-menu.twitter":"Twitter","help-menu.terms":"Terms of service","help-menu.privacy":"Privacy policy","actions-menu.title":"Actions","edit-link-dialog.title":"Edit link","edit-link-dialog.invalid-url":"A link must be a valid URL.","edit-link-dialog.detail":"Links will open in a new tab.","edit-link-dialog.url":"URL","edit-link-dialog.clear":"Clear","edit-link-dialog.save":"Continue","edit-link-dialog.cancel":"Cancel","edit-link-dialog.external-link":"External link","embed-dialog.title":"Insert embed","embed-dialog.back":"Back","embed-dialog.create":"Create","embed-dialog.cancel":"Cancel","embed-dialog.url":"URL","embed-dialog.instruction":"Paste in the site’s URL to create the embed.","embed-dialog.invalid-url":"We could not create an embed from that URL.","shortcuts-dialog.title":"Keyboard shortcuts","shortcuts-dialog.edit":"Edit","shortcuts-dialog.file":"File","shortcuts-dialog.preferences":"Preferences","shortcuts-dialog.tools":"Tools","shortcuts-dialog.transform":"Transform","shortcuts-dialog.view":"View","shortcuts-dialog.collaboration":"Collaboration","shortcuts-dialog.a11y":"Accessibility","shortcuts-dialog.text-formatting":"Text formatting","style-panel.title":"Styles","style-panel.align":"Align","style-panel.label-align":"Label align","style-panel.vertical-align":"Vertical align","style-panel.position":"Position","style-panel.arrowheads":"Arrows","style-panel.arrowhead-start":"Start","style-panel.arrowhead-end":"End","style-panel.arrow-kind":"Line","style-panel.color":"Color","style-panel.dash":"Dash","style-panel.fill":"Fill","style-panel.font":"Font","style-panel.geo":"Shape","style-panel.mixed":"Mixed","style-panel.opacity":"Opacity","style-panel.size":"Size","style-panel.spline":"Spline","style-panel.selected":"selected","tool-panel.title":"Tools","tool-panel.more":"More","navigation-zone.title":"Navigation","navigation-zone.minimap":"Minimap","navigation-zone.toggle-minimap":"Toggle minimap","navigation-zone.zoom":"Zoom","focus-mode.toggle-focus-mode":"Toggle focus mode","toast.close":"Close","toast.success":"Success","toast.error":"Error","toast.info":"Info","toast.warning":"Warning","file-system.file-open-error.title":"Could not open file","file-system.file-open-error.not-a-tldraw-file":"The file you tried to open doesn’t look like a tldraw file.","file-system.file-open-error.file-format-version-too-new":"The file you tried to open is from a newer version of tldraw. Please reload the page and try again.","file-system.file-open-error.generic-corrupted-file":"The file you tried to open is corrupted.","file-system.confirm-open.title":"Overwrite current project?","file-system.confirm-open.description":"Opening a file will replace your current project and any unsaved changes will be lost. Are you sure you want to continue?","file-system.confirm-open.cancel":"Cancel","file-system.confirm-open.open":"Open file","file-system.confirm-open.dont-show-again":"Don’t ask again","file-system.confirm-clear.title":"Clear current project?","file-system.confirm-clear.description":"Creating a new project will clear your current project and any unsaved changes will be lost. Are you sure you want to continue?","file-system.confirm-clear.cancel":"Cancel","file-system.confirm-clear.continue":"Continue","file-system.confirm-clear.dont-show-again":"Don’t ask again","file-system.shared-document-file-open-error.title":"Could not open file","file-system.shared-document-file-open-error.description":"Opening files from shared projects is not supported.","sharing.confirm-leave.title":"Leave current project?","sharing.confirm-leave.description":"Are you sure you want to leave this shared project? You can return to it by navigating to its URL.","sharing.confirm-leave.cancel":"Cancel","sharing.confirm-leave.leave":"Leave","sharing.confirm-leave.dont-show-again":"Don’t ask again","toast.error.export-fail.title":"Failed export","toast.error.export-fail.desc":"Failed to export image","toast.error.copy-fail.title":"Failed copy","toast.error.copy-fail.desc":"Failed to copy image","context.pages.new-page":"New page","vscode.file-open.desc":"We’ve updated this document to work with the current version of tldraw. If you’d like to keep the original version (which will work on old.tldraw.com), click below to create a backup.","vscode.file-open.open":"Continue","vscode.file-open.backup":"Backup","vscode.file-open.backup-saved":"Backup saved","vscode.file-open.backup-failed":"Backup failed: this is not a .tldr file.","vscode.file-open.dont-show-again":"Don’t ask again","cursor-chat.type-to-chat":"Type to chat…","app.loading":"Loading tldraw…","handle.resize-top":"Resize top","handle.resize-bottom":"Resize bottom","handle.resize-left":"Resize left","handle.resize-right":"Resize right","handle.resize-top-left":"Resize top left","handle.resize-top-right":"Resize top right","handle.resize-bottom-left":"Resize bottom left","handle.resize-bottom-right":"Resize bottom right","handle.rotate.top_left_rotate":"Rotate top left","handle.rotate.top_right_rotate":"Rotate top right","handle.rotate.bottom_left_rotate":"Rotate bottom left","handle.rotate.bottom_right_rotate":"Rotate bottom right","handle.rotate.mobile_rotate":"Rotate","handle.crop.top":"Crop top","handle.crop.bottom":"Crop bottom","handle.crop.left":"Crop left","handle.crop.right":"Crop right","handle.crop.top-left":"Crop top left","handle.crop.top-right":"Crop top right","handle.crop.bottom-left":"Crop bottom left","handle.crop.bottom-right":"Crop bottom right","ui.close":"Close","ui.checked":"Checked","ui.unchecked":"Unchecked","comments.title":"Comments","comments.empty":"No comments on this page yet.","comments.empty-filtered":"No comments match your filters.","comments.thread-title":"Comment","comments.resolved":"Resolved","comments.filter":"Filter comments","comments.show-resolved":"Show resolved comments","comments.only-my-comments":"Only my comments","comments.only-unread":"Only unread","comments.show-all-pages":"Show all pages","comments.more-options":"More options","comments.hide":"Hide comments","comments.show":"Show comments","comments.reply-placeholder":"Reply…","comments.edit-placeholder":"Edit comment…","comments.add-placeholder":"Add a comment…","comments.save":"Save","comments.edit":"Edit","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.delete":"Delete thread","comments.edit-comment":"Edit comment","comments.delete-comment":"Delete comment","comments.dismiss":"Dismiss","comments.copy-link":"Copy link","comments.link-copied":"Link copied","comments.send":"Send","comments.resolved-by":"Resolved by {name}","comments.add-reaction":"Add reaction","comments.reacted-1":"{a} reacted","comments.reacted-2":"{a} and {b} reacted","comments.reacted-3":"{a}, {b} and {c} reacted","comments.reacted-more":"{a}, {b}, {c} and {count} others reacted","comments.reacted-more-one":"{a}, {b}, {c} and 1 other reacted","comments.mention-you":"You","comments.mention-no-matches":"No matches","comments.preview-more":"{count} more","comments.replies-one":"1 reply","comments.replies":"{count} replies","comments.pin-label":"Comment by {name}","comments.pin-label-resolved":"Resolved comment by {name}","comments.cluster-label":"{count} comments here","comments.stack-label":"{count} comments at this spot"},P=new Set(["ar","fa","he","ur","ku"]),T={locale:"en",label:"English",messages:k,dir:"ltr"};async function E(e,t){if(!(await (0,r.hdJ)(t.translations.en)).ok)return console.warn("No main translations found."),T;if("en"===e)return T;let n=r.Yjb.find(t=>t.locale===e);if(!n)return console.warn(`No translation found for locale ${e}`),T;let i=await (0,r.hdJ)(t.translations[n.locale]),o=await i.json();if(!o)return console.warn(`No messages found for locale ${e}`),T;let s=[];for(let e in T.messages)o[e]||s.push(e);return s.length,{locale:e,label:n.label,dir:P.has(n.locale)?"rtl":"ltr",messages:{...T.messages,...o}}}let I=f.createContext(null);function _({overrides:e,locale:t,children:n}){let r=C(),[i,o]=f.useState(()=>e&&e.en?{locale:"en",label:"English",dir:"ltr",messages:{...k,...e.en}}:{locale:"en",label:"English",dir:"ltr",messages:k});return f.useEffect(()=>{let n=!1;return async function(){let i=await E(t,r);i&&!n&&(e&&e[t]?o({...i,messages:{...i.messages,...e[t]}}):o(i))}(),()=>{n=!0}},[r,t,e]),(0,d.jsx)(I.Provider,{value:i,children:n})}function M(){let e=f.useContext(I),t=e?.messages??k;return f.useEffect(()=>{e?.messages||(0,r.mcG)("No translation messages found, falling back to default translation. Wrap your app in <TldrawUiContextProvider>, or in both <AssetUrlsProvider> and <TldrawUiTranslationProvider>, to provide translations.")},[e?.messages]),f.useCallback(function(e){return t[e]??e},[t])}function A(){let e=f.useContext(I);return e?.dir??"ltr"}function j(e,t){let n=t?e.getAsset(t):null;if(n&&!n.props.image)if(!n.props.title)return 46;else return 101;return 320}function O(e,t){return{...t,props:{...t.props,h:j(e,t.props.assetId)}}}function D(e,t,n){if(t)return t;if(!n)return null;let i=r.Kx3.createId((0,r.xpx)(n));return e.getAsset(i)?i:null}function L(e,t){let n=D(e,t.props.assetId,t.props.url);return n===t.props.assetId?t.props.h:j(e,n)}async function R(e,t){if(e.isDisposed)return;let{url:n}=t.props,r=await e.getAssetForExternalContent({type:"url",url:n});r&&e.run(()=>{e.createAssets([r]),e.updateShapes([{id:t.id,type:t.type,props:{assetId:r.id}}])})}let F=new WeakMap;async function z(e,{url:t,center:n=e.getViewportPageBounds().center}){try{let i=r.Kx3.createId((0,r.xpx)(t)),o=e.getAsset(i),s=(0,r.n6Y)(),a={id:s,type:"bookmark",x:n.x-150,y:n.y-160,rotation:0,opacity:1,props:{url:t,assetId:o?.id??null,w:300,h:j(e,o?.id)}};e.run(()=>{e.createShapes([a])});let l=e.getShape(s);if(!l)return r.Q7C.err("Failed to create bookmark shape");if(o)return r.Q7C.ok(l);return N(e,s,t),r.Q7C.ok(l)}catch(e){return r.Q7C.err(e instanceof Error?e.message:"Failed to create bookmark")}}async function N(e,t,n){let r;try{r=await e.getAssetForExternalContent({type:"url",url:n})}catch(e){console.error(e);return}if(e.isDisposed||!r)return;let i=e.getShape(t);!i||i.props.url!==n||i.props.assetId||e.run(()=>{e.getAsset(r.id)||e.createAssets([r]),e.updateShapes([{id:t,type:"bookmark",props:{assetId:r.id}}])},{history:"ignore"})}function $(){return{topLeft:{x:0,y:0},bottomRight:{x:1,y:1}}}let B=["original","square","circle","landscape","portrait","wide"],H={original:0,square:1,circle:1,landscape:4/3,portrait:3/4,wide:16/9};function U(e,t){return t?{w:e.w/(t.bottomRight.x-t.topLeft.x),h:e.h/(t.bottomRight.y-t.topLeft.y)}:{w:e.w,h:e.h}}function K(e){return{width:e.bottomRight.x-e.topLeft.x,height:e.bottomRight.y-e.topLeft.y}}function W(e){let{width:t,height:n}=K(e);return{x:e.topLeft.x+t/2,y:e.topLeft.y+n/2}}function V(e,t,n,r,i){let o=Math.max(0,Math.min(1-n,e-n/2)),s=Math.max(0,Math.min(1-r,t-r/2));return{topLeft:{x:o,y:s},bottomRight:{x:o+n,y:s+r},isCircle:i}}let Y={fontWeight:"normal",fontVariant:"normal",fontStyle:"normal",padding:"0px"},G={s:1,m:1.75,l:2.5,xl:5},q={s:1.125,m:1.5,l:2.25,xl:2.75},X={s:1.125,m:1.375,l:1.625,xl:2},J={s:1.125,m:1.25,l:1.5,xl:1.75},Z={draw:"var(--tl-font-draw)",sans:"var(--tl-font-sans)",serif:"var(--tl-font-serif)",mono:"var(--tl-font-mono)"};function Q(e,t){let n=e.fonts[t];return n?n.fontFamily:Z[t]??t}async function ee(e,t,n){let{elements:i,files:o}=t,s={shapes:[],bindings:[],rootShapeIds:[],assets:[],schema:e.store.schema.serialize()},a=new Map,l=new Map,d=e.getCurrentPageId(),c=new Map,h=[],u=new Set;i.forEach(e=>{if(c.set(e.id,(0,r.n6Y)()),null!==e.boundElements)for(let t of e.boundElements)"text"===t.type&&u.add(t.id)});let p=r.as9;for(let t of i){if(u.has(t.id))continue;let n=c.get(t.id),f={id:n,typeName:"shape",parentId:d,index:p,x:t.x,y:t.y,rotation:0,isLocked:t.locked,opacity:et(t.opacity),meta:{}};switch(0!==t.angle&&l.set(n,t.angle),t.groupIds&&t.groupIds.length>0?a.has(t.groupIds[0])?a.get(t.groupIds[0])?.push(n):a.set(t.groupIds[0],[n]):h.push(n),t.type){case"rectangle":case"ellipse":case"diamond":{let n="",o="middle";if(null!==t.boundElements){for(let e of t.boundElements)if("text"===e.type){let t=i.find(t=>t.id===e.id);t&&(n=t.text,o=ec[t.textAlign])}}let a="transparent"===t.backgroundColor?t.strokeColor:t.backgroundColor;s.shapes.push({...f,type:"geo",props:{...e.getShapeUtil("geo").getDefaultProps(),geo:t.type,url:t.link??"",w:t.width,h:t.height,size:en[t.strokeWidth]??"draw",color:ea[a]??"black",richText:(0,r.TP3)(n),align:o,dash:ep(t),fill:ef(t)}});break}case"freedraw":{let n=t.points.map(([e,t,n=.5])=>({x:e,y:t,z:n})),i=r.K6A.encodePoints(n);s.shapes.push({...f,type:"draw",props:{...e.getShapeUtil("draw").getDefaultProps(),dash:ep(t),size:en[t.strokeWidth],color:ea[t.strokeColor]??"black",segments:[{type:"free",path:i}]}});break}case"line":{if(t.points.slice().length<2)break;let n=(0,r.uud)(t.points.length);s.shapes.push({...f,type:"line",props:{...e.getShapeUtil("line").getDefaultProps(),dash:ep(t),size:en[t.strokeWidth],color:ea[t.strokeColor]??"black",spline:t.roundness?"cubic":"line",points:{...Object.fromEntries(t.points.map(([e,t],r)=>{let i=n[r];return[i,{id:i,index:i,x:e,y:t}]}))}}});break}case"arrow":{let o="";if(null!==t.boundElements){for(let e of t.boundElements)if("text"===e.type){let t=i.find(t=>t.id===e.id);t&&(o=t.text)}}let a=t.points[0],l=t.points[t.points.length-1],d=c.get(t.startBinding?.elementId),h=c.get(t.endBinding?.elementId);s.shapes.push({...f,type:"arrow",props:{...e.getShapeUtil("arrow").getDefaultProps(),richText:(0,r.TP3)(o),kind:t.elbowed?"elbow":"arc",bend:function(e,t,n){let i=0;if(e.points.length>2){let o=new r.l2P(t[0],t[1]),s=new r.l2P(n[0],n[1]),a=new r.l2P(e.points[1][0],e.points[1][1]),l=r.l2P.Sub(s,o),d=r.l2P.Per(l),c=r.l2P.Med(s,o),h=r.l2P.Sub(c,d),u=r.l2P.Add(c,d),p=r.l2P.NearestPointOnLineSegment(h,u,a,!1);i=r.l2P.Dist(p,c),r.l2P.Clockwise(p,s,c)&&(i*=-1)}return i}(t,a,l),dash:ep(t),size:en[t.strokeWidth]??"m",color:ea[t.strokeColor]??"black",start:{x:a[0],y:a[1]},end:{x:l[0],y:l[1]},arrowheadEnd:eu[t.endArrowhead]??"none",arrowheadStart:eu[t.startArrowhead]??"none"}}),d&&s.bindings.push({id:(0,r.BNi)(),typeName:"binding",type:"arrow",fromId:n,toId:d,props:{terminal:"start",snap:"none",normalizedAnchor:{x:.5,y:.5},isPrecise:!1,isExact:!1},meta:{}}),h&&s.bindings.push({id:(0,r.BNi)(),typeName:"binding",type:"arrow",fromId:n,toId:h,props:{terminal:"end",snap:"none",normalizedAnchor:{x:.5,y:.5},isPrecise:!1,isExact:!1},meta:{}});break}case"text":{let{size:n,scale:i}=function(e){let t=er[e];return t?{size:t,scale:1}:e<16?{size:"s",scale:e/16}:e>36?{size:"xl",scale:e/36}:{size:"m",scale:1}}(t.fontSize);s.shapes.push({...f,type:"text",props:{...e.getShapeUtil("text").getDefaultProps(),size:n,scale:i,font:ei[t.fontFamily]??"draw",color:ea[t.strokeColor]??"black",richText:(0,r.TP3)(t.text),textAlign:eh[t.textAlign]}});break}case"image":{let n=o[t.fileId];if(!n)break;let i=r.Kx3.createId();s.assets.push({id:i,typeName:"asset",type:"image",props:{w:t.width,h:t.height,fileSize:n.size,name:t.id??"Untitled",isAnimated:!1,mimeType:n.mimeType,src:n.dataURL},meta:{}}),s.shapes.push({...f,type:"image",props:{...e.getShapeUtil("image").getDefaultProps(),w:t.width,h:t.height,assetId:i}})}}p=(0,r.AQy)(p)}let f=n??(e.inputs.getShiftKey()?e.inputs.getCurrentPagePoint():void 0);for(let t of(e.putContentOntoCurrentPage(s,{point:f,select:!1,preserveIds:!0}),a.values()))if(t.length>1){e.groupShapes(t);let n=e.getShape(t[0]);n?.parentId&&(0,r.vc4)(n.parentId)&&h.push(n.parentId)}for(let[t,n]of l)e.select(t),e.rotateShapesBy([t],n);let g=(0,r.oE7)(h.map(t=>e.getShape(t))),m=r.azJ.Common(g.map(t=>e.getShapePageBounds(t))),y=e.getViewportPageBounds().center;e.updateShapes(g.map(e=>{let t={x:(e.x??0)-(m.x+m.w/2),y:(e.y??0)-(m.y+m.h/2)};return{id:e.id,type:e.type,x:y.x+t.x,y:y.y+t.y}})),e.setSelectedShapes(h)}let et=e=>{let t=e/100;return t<.2?.1:t<.4?.25:t<.6?.5:t<.8?.75:1},en={1:"s",2:"m",3:"l",4:"xl"},er={16:"s",20:"m",28:"l",36:"xl"},ei={1:"draw",2:"sans",3:"mono"},eo={gray:["#f8f9fa","#e9ecef","#ced4da","#868e96","#343a40"],red:["#fff5f5","#ffc9c9","#ff8787","#fa5252","#e03131"],pink:["#fff0f6","#fcc2d7","#f783ac","#e64980","#c2255c"],grape:["#f8f0fc","#eebefa","#da77f2","#be4bdb","#9c36b5"],violet:["#f3f0ff","#d0bfff","#9775fa","#7950f2","#6741d9"],indigo:["#edf2ff","#bac8ff","#748ffc","#4c6ef5","#3b5bdb"],blue:["#e7f5ff","#a5d8ff","#4dabf7","#228be6","#1971c2"],cyan:["#e3fafc","#99e9f2","#3bc9db","#15aabf","#0c8599"],teal:["#e6fcf5","#96f2d7","#38d9a9","#12b886","#099268"],green:["#ebfbee","#b2f2bb","#69db7c","#40c057","#2f9e44"],lime:["#f4fce3","#d8f5a2","#a9e34b","#82c91e","#66a80f"],yellow:["#fff9db","#ffec99","#ffd43b","#fab005","#f08c00"],orange:["#fff4e6","#ffd8a8","#ffa94d","#fd7e14","#e8590c"]};function es(e,t,n){return Object.fromEntries([0,1,2,3,4].map(t=>eo[e][t]).map((e,r)=>[e,r<3?t:n]))}let ea={...es("gray","grey","black"),...es("red","light-red","red"),...es("pink","light-red","red"),...es("grape","light-violet","violet"),...es("blue","light-blue","blue"),...es("cyan","light-blue","blue"),...es("teal","light-green","green"),...es("green","light-green","green"),...es("yellow","yellow","orange"),...es("orange","yellow","orange"),"#ffffff":"white","#000000":"black"},el={solid:"draw",dashed:"dashed",dotted:"dotted"},ed={"cross-hatch":"pattern",hachure:"pattern",solid:"solid"},ec={left:"start",center:"middle",right:"end"},eh={left:"start",center:"middle",right:"end"},eu={arrow:"arrow",dot:"dot",triangle:"triangle",bar:"pipe"},ep=e=>{let t=el[e.strokeStyle]??"draw";return"draw"===t&&0===e.roughness&&(t="solid"),t},ef=e=>"transparent"===e.backgroundColor?"none":ed[e.fillStyle]??"solid";var eg=n(82159);let em=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&"`"===e[t.index-1]?null:{index:t.index,text:t[0],replaceWith:t[1]}},ey=e=>{let t,n=/`([^`]+)`(?!`)/g,r=[];for(;null!==(t=n.exec(e));)t.index>0&&"`"===e[t.index-1]||r.push({index:t.index,text:t[0],replaceWith:t[1]});return r},eb=eg.CU.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",(0,eg.KV)(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,eg.OX)({find:em,type:this.type})]},addPasteRules(){return[(0,eg.Zc)({find:ey,type:this.type})]}}),ex=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,ew=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ev=eg.CU.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||(0,eg.hs)(e,"background-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",(0,eg.KV)(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[(0,eg.OX)({find:ex,type:this.type})]},addPasteRules(){return[(0,eg.Zc)({find:ew,type:this.type})]}});var eS=n(27050),eC=n(76865);let ek=new WeakSet,eP=new WeakSet;function eT(e){return ek.add(e),e}function eE(e){return Array.isArray(e)&&ek.has(e)}let eI=(e,t)=>(function(e,t){if("slot"===e)return 0;if(e instanceof Function){let n=e(t);return!Array.isArray(n)||eE(n)||eP.has(n)?n:eT(n)}let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(eE(n))return eT([e,r,n]);if(0===n.length)return eT([e,r]);let t=function e(t){return t.flatMap(t=>null==t?[]:Array.isArray(t)&&eP.has(t)&&!eE(t)?e(t):[t])}(n);return 0===t.length?eT([e,r]):eT([e,r,...t])}return null!=n?eT([e,r,n]):eT([e,r])})(e,t),e_=/^\s*>\s$/,eM=eg.bP.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return eI("blockquote",{...(0,eg.KV)(this.options.HTMLAttributes,e),children:eI("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,o;let s=(null!=(i=null==(o=t.renderChild)?void 0:o.call(t,e,r))?i:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join(`
|
|
4
|
+
${i}`,e.prepend(t)}}finally{n.dispose()}}},2642:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var r=n(83102),i=n(81467),o=n(24167),s=n(59830),a=n(82246);class l extends a{}class d{rBush;elementsInTree;constructor(){this.rBush=new l,this.elementsInTree=new Map}search(e){return new Set(this.rBush.search({minX:e.minX,minY:e.minY,maxX:e.maxX,maxY:e.maxY}).map(e=>e.id))}remove(e){let t=this.elementsInTree.get(e);t&&(this.rBush.remove(t),this.elementsInTree.delete(e))}applyBatch(e,t){for(let t of e)this.remove(t);for(let e of t){let t=this.elementsInTree.get(e.id);t&&this.rBush.remove(t),this.rBush.insert(e),this.elementsInTree.set(e.id,e)}}bulkLoad(e){for(let t of(this.rBush.load(e),e))this.elementsInTree.set(t.id,t)}clear(){this.rBush.clear(),this.elementsInTree.clear()}has(e){return this.elementsInTree.has(e)}getSize(){return this.elementsInTree.size}getElement(e){return this.elementsInTree.get(e)}dispose(){this.clear()}}class c{constructor(e){this.editor=e,this.rbush=new d,this.spatialIndexComputed=this.createSpatialIndexComputed()}editor;rbush;spatialIndexComputed;lastPageId=null;_boundsEpoch=0;rebuildAndBumpEpoch(){return this.buildFromScratch(),this._boundsEpoch++,this._boundsEpoch}createSpatialIndexComputed(){let e=this.editor.store.query.filterHistory("shape"),t=this.editor.store.query.filterHistory("binding");return(0,r.EW)("spatialIndex",(n,i)=>{let o=e.getDiffSince(i),s=t.getDiffSince(i),a=this.editor.getCurrentPageId();return(0,r._O)(n)||o===r.c2||s===r.c2||this.lastPageId!==a?(0,r.Pm)(()=>this.rebuildAndBumpEpoch()):(0===o.length&&0===s.length||(0,r.Pm)(()=>this.processIncrementalUpdate(o,s))&&this._boundsEpoch++,this._boundsEpoch)})}buildFromScratch(){this.rbush.clear(),this.lastPageId=this.editor.getCurrentPageId();let e=[];for(let t of this.editor.getCurrentPageShapes()){let n=this.editor.getShapePageBounds(t.id);n&&n.isValid()&&e.push({minX:n.minX,minY:n.minY,maxX:n.maxX,maxY:n.maxY,id:t.id})}this.rbush.bulkLoad(e)}processIncrementalUpdate(e,t){let n=new Set,r=[],s=new Set,a=new Set,l=[],d=e=>{a.has(e)||(a.add(e),l.push(e))};for(let t of e){for(let e of(0,o.Ic)(t.added))(0,i.o2)(e)&&(s.add(e.id),d(e.id));for(let e of(0,o.Ic)(t.removed))(0,i.o2)(e)&&(this.rbush.has(e.id)&&n.add(e.id),(0,i.xh)(e.parentId)||d(e.parentId));for(let[e,n]of(0,o.Ic)(t.updated))(0,i.o2)(n)&&(s.add(n.id),d(n.id),(0,i.o2)(e)&&e.parentId!==n.parentId&&!(0,i.xh)(e.parentId)&&d(e.parentId))}for(let e of t){for(let t of(0,o.Ic)(e.added))(0,i.OT)(t)&&(d(t.fromId),d(t.toId));for(let t of(0,o.Ic)(e.removed))(0,i.OT)(t)&&(d(t.fromId),d(t.toId));for(let[t,n]of(0,o.Ic)(e.updated))(0,i.OT)(n)&&(d(n.fromId),d(n.toId),(0,i.OT)(t)&&(t.fromId!==n.fromId||t.toId!==n.toId)&&(d(t.fromId),d(t.toId)))}let c=[...s];for(;c.length;){let e=c.pop();for(let t of this.editor.getSortedChildIdsForParent(e))s.has(t)||(s.add(t),c.push(t)),d(t)}for(;l.length;){let e=l.pop(),t=this.editor.store.unsafeGetWithoutCapture(e);for(let n of(t&&(0,i.o2)(t)&&!(0,i.xh)(t.parentId)&&d(t.parentId),this.editor.getBindingsInvolvingShape(e)))d(n.fromId),d(n.toId)}for(let e of a){let t=n.has(e)?void 0:this.rbush.getElement(e),o=this.editor.store.unsafeGetWithoutCapture(e);if(!o||!(0,i.o2)(o)||this.editor.getAncestorPageId(o)!==this.lastPageId){this.rbush.has(e)&&n.add(e);continue}let s=this.editor.getShapePageBounds(e);s&&s.isValid()?this.areBoundsEqualToSpatialElement(s,t)||(n.delete(e),r.push({minX:s.minX,minY:s.minY,maxX:s.maxX,maxY:s.maxY,id:e})):this.rbush.has(e)&&n.add(e)}return(0!==n.size||0!==r.length)&&(this.rbush.applyBatch(n,r),!0)}areBoundsEqualToSpatialElement(e,t){return!e&&!t||!!e&&!!t&&e.minX===t.minX&&e.minY===t.minY&&e.maxX===t.maxX&&e.maxY===t.maxY}getShapeIdsInsideBounds(e){return this.spatialIndexComputed.get(),this.rbush.search(e)}getShapeIdsAtPoint(e,t=0){return this.spatialIndexComputed.get(),this.rbush.search(new s.az(e.x-t,e.y-t,2*t,2*t))}dispose(){this.rbush.dispose(),this.lastPageId=null}}},3510:(e,t,n)=>{"use strict";n.d(t,{D:()=>r});var r=!1},4343:(e,t,n)=>{"use strict";n.d(t,{H:()=>a,w:()=>s});var r=n(81467),i=n(24167),o=n(59830);function s(e){switch(e.type){case"shapes":{let t=e.shapeIds.map(e=>l(e.slice(6)));return`s${t.join(".")}`}case"page":return"p"+l(r.tv.parseId(e.pageId));case"viewport":{let{bounds:t,pageId:n}=e,i=`v${Math.round(t.x)}.${Math.round(t.y)}.${Math.round(t.w)}.${Math.round(t.h)}`;return n&&(i+="."+l(r.tv.parseId(n))),i}default:(0,i.h6)(e)}}function a(e){switch(e[0]){case"s":return{type:"shapes",shapeIds:e.slice(1).split(".").filter(Boolean).map(e=>(0,r.n6)(decodeURIComponent(e)))};case"p":return{type:"page",pageId:r.tv.createId(decodeURIComponent(e.slice(1)))};case"v":{let[t,n,i,s,a]=e.slice(1).split(".");return{type:"viewport",bounds:new o.az(Number(t),Number(n),Number(i),Number(s)),pageId:a?r.tv.createId(decodeURIComponent(a)):void 0}}default:throw Error("Invalid deep link string")}}function l(e){return encodeURIComponent(e).replace(/\./g,"%2E")}},4467:(e,t,n)=>{var r,i=function(){var e=String.fromCharCode,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function i(e,t){if(!r[e]){r[e]={};for(var n=0;n<e.length;n++)r[e][e.charAt(n)]=n}return r[e][t]}var o={compressToBase64:function(e){if(null==e)return"";var n=o._compress(e,6,function(e){return t.charAt(e)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(e){return null==e?"":""==e?null:o._decompress(e.length,32,function(n){return i(t,e.charAt(n))})},compressToUTF16:function(t){return null==t?"":o._compress(t,15,function(t){return e(t+32)})+" "},decompressFromUTF16:function(e){return null==e?"":""==e?null:o._decompress(e.length,16384,function(t){return e.charCodeAt(t)-32})},compressToUint8Array:function(e){for(var t=o.compress(e),n=new Uint8Array(2*t.length),r=0,i=t.length;r<i;r++){var s=t.charCodeAt(r);n[2*r]=s>>>8,n[2*r+1]=s%256}return n},decompressFromUint8Array:function(t){if(null==t)return o.decompress(t);for(var n=Array(t.length/2),r=0,i=n.length;r<i;r++)n[r]=256*t[2*r]+t[2*r+1];var s=[];return n.forEach(function(t){s.push(e(t))}),o.decompress(s.join(""))},compressToEncodedURIComponent:function(e){return null==e?"":o._compress(e,6,function(e){return n.charAt(e)})},decompressFromEncodedURIComponent:function(e){return null==e?"":""==e?null:(e=e.replace(/ /g,"+"),o._decompress(e.length,32,function(t){return i(n,e.charAt(t))}))},compress:function(t){return o._compress(t,16,function(t){return e(t)})},_compress:function(e,t,n){if(null==e)return"";var r,i,o,s={},a={},l="",d="",c="",h=2,u=3,p=2,f=[],g=0,m=0;for(o=0;o<e.length;o+=1)if(l=e.charAt(o),Object.prototype.hasOwnProperty.call(s,l)||(s[l]=u++,a[l]=!0),d=c+l,Object.prototype.hasOwnProperty.call(s,d))c=d;else{if(Object.prototype.hasOwnProperty.call(a,c)){if(256>c.charCodeAt(0)){for(r=0;r<p;r++)g<<=1,m==t-1?(m=0,f.push(n(g)),g=0):m++;for(i=c.charCodeAt(0),r=0;r<8;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}else{for(r=0,i=1;r<p;r++)g=g<<1|i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i=0;for(i=c.charCodeAt(0),r=0;r<16;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}0==--h&&(h=Math.pow(2,p),p++),delete a[c]}else for(i=s[c],r=0;r<p;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1;0==--h&&(h=Math.pow(2,p),p++),s[d]=u++,c=String(l)}if(""!==c){if(Object.prototype.hasOwnProperty.call(a,c)){if(256>c.charCodeAt(0)){for(r=0;r<p;r++)g<<=1,m==t-1?(m=0,f.push(n(g)),g=0):m++;for(i=c.charCodeAt(0),r=0;r<8;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}else{for(r=0,i=1;r<p;r++)g=g<<1|i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i=0;for(i=c.charCodeAt(0),r=0;r<16;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1}0==--h&&(h=Math.pow(2,p),p++),delete a[c]}else for(i=s[c],r=0;r<p;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1;0==--h&&(h=Math.pow(2,p),p++)}for(r=0,i=2;r<p;r++)g=g<<1|1&i,m==t-1?(m=0,f.push(n(g)),g=0):m++,i>>=1;for(;;){if(g<<=1,m==t-1){f.push(n(g));break}m++}return f.join("")},decompress:function(e){return null==e?"":""==e?null:o._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(t,n,r){var i,o,s,a,l,d,c,h=[],u=4,p=4,f=3,g="",m=[],y={val:r(0),position:n,index:1};for(i=0;i<3;i+=1)h[i]=i;for(s=0,l=4,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;switch(s){case 0:for(s=0,l=256,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;c=e(s);break;case 1:for(s=0,l=65536,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;c=e(s);break;case 2:return""}for(h[3]=c,o=c,m.push(c);;){if(y.index>t)return"";for(s=0,l=Math.pow(2,f),d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;switch(c=s){case 0:for(s=0,l=256,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;h[p++]=e(s),c=p-1,u--;break;case 1:for(s=0,l=65536,d=1;d!=l;)a=y.val&y.position,y.position>>=1,0==y.position&&(y.position=n,y.val=r(y.index++)),s|=(a>0)*d,d<<=1;h[p++]=e(s),c=p-1,u--;break;case 2:return m.join("")}if(0==u&&(u=Math.pow(2,f),f++),h[c])g=h[c];else{if(c!==p)return null;g=o+o.charAt(0)}m.push(g),h[p++]=o+g.charAt(0),u--,o=g,0==u&&(u=Math.pow(2,f),f++)}}};return o}();void 0===(r=(function(){return i}).call(t,n,t,e))||(e.exports=r)},4599:(e,t,n)=>{"use strict";n.d(t,{I:()=>s,d:()=>a});var r=n(83102),i=n(24167),o=n(81962);function s(e,t,n){let s=new Set;for(let n of t){let t=e.getShape(n);if(!t)continue;s.add(t);let r=e.getShape(t.parentId);r&&s.add(r)}let l=new Map;for(let t of s){let i=e.getSortedChildIdsForParent(t);if(n?.filter&&!n.filter(t))l.set(t,i);else{let n=function(e,t,n){if(0===n.length)return r.Ml;let i=e.getShapePageBounds(t);if(!i)return r.Ml;let s=e.getShape(t);if(!s)return r.Ml;let a=e.getShapeGeometry(t),l=e.getShapePageTransform(t),d=l.applyToPoints(a.vertices),c=e.getShapeUtil(s.type).getClipPath?.(s),h=c?l.applyToPoints(c):void 0,u=h?(0,o.oQ)(h,d):d;return u?n.filter(t=>{let n=e.getShapePageBounds(t);if(!n||!i.includes(n))return!1;let r=e.getShapePageTransform(t).clone().invert().applyToPoints(u);return e.getShapeGeometry(t).overlapsPolygon(r)}):r.Ml}(e,t.id,i);if(n.length<i.length){let r=e.getShapeUtil(t),o=i.filter(i=>{if(n.includes(i))return!1;let o=e.getShape(i);return!!o&&r.canRemoveChildrenOfType(t,o.type)});o.length>0&&l.set(t,o)}}}let d=e.getCurrentPageShapesSorted().map(e=>e.id),c={};for(let[t,r]of l){let o=(0,i.oE)(r.map(t=>e.getShape(t))),{reparenting:s,remainingShapesToReparent:l}=a(e,o,(e,r)=>(!n?.filter||!!n.filter(r))&&r.id!==t.id&&d.indexOf(r.id)<d.indexOf(e.id));if(s.forEach((e,t)=>{0!==e.length&&(c[t]||(c[t]={parentId:t,shapeIds:[]}),c[t].shapeIds.push(...e.map(e=>e.id)))}),l.size>0){let n=e.findShapeAncestor(t,t=>e.isShapeOfType(t,"group"))?.id??e.getCurrentPageId();l.forEach(r=>{if(!c[n]){let r,o=e.getSortedChildIdsForParent(n),s=o.indexOf(t.id);if(s>-1){let n=o[s+1],a=n?e.getShape(n).index:void 0,l=a&&a>t.index?a:(0,i.AQ)(t.index);r=(0,i.HE)(t.index,l)}c[n]={parentId:n,shapeIds:[],index:r}}c[n].shapeIds.push(r.id)})}}e.run(()=>{Object.values(c).forEach(({parentId:t,shapeIds:n,index:r})=>{0!==n.length&&(n.sort((e,t)=>d.indexOf(e)<d.indexOf(t)?-1:1),e.reparentShapes(n,t,r))})})}function a(e,t,n){let r=new Set(t),s=new Set;for(let n of t){let t=e.getShapeParent(n);t&&e.isShapeOfType(t,"group")&&!s.has(t)&&s.add(t)}for(let t of s){for(let n of(0,i.oE)(e.getSortedChildIdsForParent(t).map(t=>e.getShape(t))))r.delete(n);r.add(t)}let a=new Map,l=new Map,d=new Set(r),c=e.getCurrentPageShapesSorted().filter(t=>{if(d.has(t))return!1;let n=e.getShapeUtil(t);for(let e of d)if(n.canReceiveNewChildrenOfType(t,e.type))return!0;return!1});for(let t=c.length-1;t>=0;t--){let r=c[t],i=e.findShapeAncestor(r,t=>e.isShapeOfType(t,"group"))?.id,s=e.getShapeGeometry(r),h=e.getShapePageTransform(r),u=e.getShapeMask(r),p=h.applyToPoints(s.vertices),f=u?(0,o.oQ)(u,p):p;if(!f)continue;let g=[];for(let t of d){if(r.id===t.id||n&&!n(t,r)||(a.has(t.id)||a.set(t.id,e.findShapeAncestor(t,t=>e.isShapeOfType(t,"group"))?.id),a.get(t.id)!==i||e.findShapeAncestor(r,e=>t.id===e.id)))continue;let o=e.getShapePageTransform(t).clone().invert().applyToPoints(f);if(e.getShapeGeometry(t).overlapsPolygon(o)){if(!e.getShapeUtil(r).canReceiveNewChildrenOfType?.(r,t.type))continue;t.parentId!==r.id&&g.push(t),d.delete(t);continue}}g.length&&l.set(r.id,g)}return{reparenting:l,remainingShapesToReparent:d}}},5174:(e,t,n)=>{"use strict";n.d(t,{A:()=>X});var r,i,o,s,a,l,d,c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var u=("function"==typeof SuppressedError&&SuppressedError,n(12115)),p="right-scroll-bar-position",f="width-before-scroll-bar";function g(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var m="u">typeof window?u.useLayoutEffect:u.useEffect,y=new WeakMap,b=(void 0===r&&(r={}),(void 0===i&&(i=function(e){return e}),o=[],s=!1,a={read:function(){if(s)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:null},useMedium:function(e){var t=i(e,s);return o.push(t),function(){o=o.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(s=!0;o.length;){var t=o;o=[],t.forEach(e)}o={push:function(t){return e(t)},filter:function(){return o}}},assignMedium:function(e){s=!0;var t=[];if(o.length){var n=o;o=[],n.forEach(e),t=o}var r=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(r)};i(),o={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),o}}}}).options=c({async:!0,ssr:!1},r),a),x=function(){},w=u.forwardRef(function(e,t){var n,r,i,o,s=u.useRef(null),a=u.useState({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:x}),l=a[0],d=a[1],p=e.forwardProps,f=e.children,w=e.className,v=e.removeScrollBar,S=e.enabled,C=e.shards,k=e.sideCar,P=e.noRelative,T=e.noIsolation,E=e.inert,I=e.allowPinchZoom,_=e.as,M=e.gapMode,A=h(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=(n=[s,t],r=function(e){return n.forEach(function(t){return g(t,e)})},(i=(0,u.useState)(function(){return{value:null,callback:r,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=r,o=i.facade,m(function(){var e=y.get(o);if(e){var t=new Set(e),r=new Set(n),i=o.current;t.forEach(function(e){r.has(e)||g(e,null)}),r.forEach(function(e){t.has(e)||g(e,i)})}y.set(o,n)},[n]),o),O=c(c({},A),l);return u.createElement(u.Fragment,null,S&&u.createElement(k,{sideCar:b,removeScrollBar:v,shards:C,noRelative:P,noIsolation:T,inert:E,setCallbacks:d,allowPinchZoom:!!I,lockRef:s,gapMode:M}),p?u.cloneElement(u.Children.only(f),c(c({},O),{ref:j})):u.createElement(void 0===_?"div":_,c({},O,{className:w,ref:j}),f))});w.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},w.classNames={fullWidth:f,zeroRight:p};var v=function(e){var t=e.sideCar,n=h(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return u.createElement(r,c({},n))};v.isSideCarExport=!0;var S=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=d||n.nc;return t&&e.setAttribute("nonce",t),e}())){var i,o;(i=t).styleSheet?i.styleSheet.cssText=r:i.appendChild(document.createTextNode(r)),o=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},C=function(){var e=S();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},k=function(){var e=C();return function(t){return e(t.styles,t.dynamic),null}},P={left:0,top:0,right:0,gap:0},T=function(e){return parseInt(e||"",10)||0},E=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[T(n),T(r),T(i)]},I=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return P;var t=E(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},_=k(),M="data-scroll-locked",A=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(M,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(p," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(f," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(p," .").concat(p," {\n right: 0 ").concat(r,";\n }\n \n .").concat(f," .").concat(f," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(M,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},j=function(){var e=parseInt(document.body.getAttribute(M)||"0",10);return isFinite(e)?e:0},O=function(){u.useEffect(function(){return document.body.setAttribute(M,(j()+1).toString()),function(){var e=j()-1;e<=0?document.body.removeAttribute(M):document.body.setAttribute(M,e.toString())}},[])},D=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;O();var o=u.useMemo(function(){return I(i)},[i]);return u.createElement(_,{styles:A(o,!t,i,n?"":"!important")})},L=!1;if("u">typeof window)try{var R=Object.defineProperty({},"passive",{get:function(){return L=!0,!0}});window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch(e){L=!1}var F=!!L&&{passive:!1},z=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},N=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),$(e,r)){var i=B(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$=function(e,t){return"v"===e?z(t,"overflowY"):z(t,"overflowX")},B=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},H=function(e,t,n,r,i){var o,s=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),a=s*r,l=n.target,d=t.contains(l),c=!1,h=a>0,u=0,p=0;do{if(!l)break;var f=B(e,l),g=f[0],m=f[1]-f[2]-s*g;(g||m)&&$(e,l)&&(u+=m,p+=g);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!d&&l!==document.body||d&&(t.contains(l)||t===l));return h&&(i&&1>Math.abs(u)||!i&&a>u)?c=!0:!h&&(i&&1>Math.abs(p)||!i&&-a>p)&&(c=!0),c},U=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},K=function(e){return[e.deltaX,e.deltaY]},W=function(e){return e&&"current"in e?e.current:e},V=0,Y=[];let G=(l=function(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),i=u.useState(V++)[0],o=u.useState(k)[0],s=u.useRef(e);u.useEffect(function(){s.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(function(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(W),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=u.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var i,o=U(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-o[0],d="deltaY"in e?e.deltaY:a[1]-o[1],c=e.target,h=Math.abs(l)>Math.abs(d)?"h":"v";if("touches"in e&&"h"===h&&"range"===c.type)return!1;var u=window.getSelection(),p=u&&u.anchorNode;if(p&&(p===c||p.contains(c)))return!1;var f=N(h,c);if(!f)return!0;if(f?i=h:(i="v"===h?"h":"v",f=N(h,c)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||d)&&(r.current=i),!i)return!0;var g=r.current||i;return H(g,t,e,"h"===g?l:d,!0)},[]),l=u.useCallback(function(e){if(Y.length&&Y[Y.length-1]===o){var n="deltaY"in e?K(e):U(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var i=(s.current.shards||[]).map(W).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),d=u.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),c=u.useCallback(function(e){n.current=U(e),r.current=void 0},[]),h=u.useCallback(function(t){d(t.type,K(t),t.target,a(t,e.lockRef.current))},[]),p=u.useCallback(function(t){d(t.type,U(t),t.target,a(t,e.lockRef.current))},[]);u.useEffect(function(){return Y.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",l,F),document.addEventListener("touchmove",l,F),document.addEventListener("touchstart",c,F),function(){Y=Y.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,F),document.removeEventListener("touchmove",l,F),document.removeEventListener("touchstart",c,F)}},[]);var f=e.removeScrollBar,g=e.inert;return u.createElement(u.Fragment,null,g?u.createElement(o,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,f?u.createElement(D,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},b.useMedium(l),v);var q=u.forwardRef(function(e,t){return u.createElement(w,c({},e,{ref:t,sideCar:G}))});q.classNames=w.classNames;let X=q},8242:(e,t,n)=>{"use strict";n.d(t,{$L:()=>_,Ln:()=>g,N0:()=>E,Um:()=>I,Wg:()=>m,X9:()=>s,Ys:()=>u,dL:()=>$,jP:()=>x,n9:()=>P,oM:()=>w,zy:()=>k});var r=n(27050);class i{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class o{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&o.empty)return o.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let d=this.ranges[a+o],c=this.ranges[a+s],h=l+d;if(e<=h){let o=d?e==l?-1:e==h?1:t:t,s=l+r+(o<0?0:c);if(n)return s;let u=e==(t<0?l:h)?null:a/3+(e-l)*65536,p=e==l?2:e==h?1:4;return(t<0?e!=l:e!=h)&&(p|=8),new i(s,p,u)}r+=c-d}return n?e+r:new i(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],d=this.ranges[r+n];e(s,s+l,a,a+d),i+=d-l}}invert(){return new o(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?o.empty:new o(e<0?[0,-e,0]:[0,0,e])}}o.empty=new o([]);class s{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new s(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new s;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new i(e,r,null)}}let a=Object.create(null);class l{getMap(){return o.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=a[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in a)throw RangeError("Duplicate use of step JSON ID "+e);return a[e]=t,t.prototype.jsonID=e,t}}class d{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new d(e,null)}static fail(e){return new d(null,e)}static fromReplace(e,t,n,i){try{return d.ok(e.replace(t,n,i))}catch(e){if(e instanceof r.vI)return d.fail(e.message);throw e}}}function c(e,t,n){let i=[];for(let r=0;r<e.childCount;r++){let o=e.child(r);o.content.size&&(o=o.copy(c(o.content,t,o))),o.isInline&&(o=t(o,n,r)),i.push(o)}return r.FK.fromArray(i)}class h extends l{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),o=new r.Ji(c(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,i),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,o)}invert(){return new u(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new h(t.pos,n.pos,this.mark)}merge(e){return e instanceof h&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new h(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new h(t.from,t.to,e.markFromJSON(t.mark))}}l.jsonID("addMark",h);class u extends l{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.Ji(c(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return d.fromReplace(e,this.from,this.to,n)}invert(){return new h(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new u(t.pos,n.pos,this.mark)}merge(e){return e instanceof u&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new u(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new u(t.from,t.to,e.markFromJSON(t.mark))}}l.jsonID("removeMark",u);class p extends l{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new p(this.pos,t.marks[n]);return new p(this.pos,this.mark)}}return new f(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new p(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new p(t.pos,e.markFromJSON(t.mark))}}l.jsonID("addNodeMark",p);class f extends l{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new p(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new f(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new f(t.pos,e.markFromJSON(t.mark))}}l.jsonID("removeNodeMark",f);class g extends l{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&y(e,this.from,this.to)?d.fail("Structure replace would overwrite content"):d.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new o([this.from,this.to-this.from,this.slice.size])}invert(e){return new g(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&g.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new g(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof g)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new g(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new g(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new g(t.from,t.to,r.Ji.fromJSON(e,t.slice),!!t.structure)}}g.MAP_BIAS=1,l.jsonID("replace",g);class m extends l{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(y(e,this.from,this.gapFrom)||y(e,this.gapTo,this.to)))return d.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return d.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?d.fromReplace(e,this.from,this.to,n):d.fail("Content does not fit in gap")}getMap(){return new o([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new m(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new m(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new m(t.from,t.to,t.gapFrom,t.gapTo,r.Ji.fromJSON(e,t.slice),t.insert,!!t.structure)}}function y(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function b(e,t,n,i=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),a=[],l=t+1;for(let t=0;t<s.childCount;t++){let d=s.child(t),c=l+d.nodeSize,h=i.matchType(d.type);if(h){i=h;for(let t=0;t<d.marks.length;t++)n.allowsMarkType(d.marks[t].type)||e.step(new u(l,c,d.marks[t]));if(o&&d.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,i;for(;e=t.exec(d.text);)i||(i=new r.Ji(r.FK.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),a.push(new g(l+e.index,l+e.index+e[0].length,i))}}else a.push(new g(l,c,r.Ji.empty));l=c}if(!i.validEnd){let t=i.fillBefore(r.FK.empty,!0);e.replace(l,l,new r.Ji(t,0,0))}for(let t=a.length-1;t>=0;t--)e.step(a[t])}function x(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function w(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(v).concat({type:t,attrs:n}).concat(o.map(v)):null}function v(e){return{type:e,attrs:null}}function S(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function C(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function k(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function P(e,t){let n=e.resolve(t),r=n.index();return T(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function T(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function E(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&T(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function I(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function _(e,t,n=t,i=r.Ji.empty){if(t==n&&!i.size)return null;let o=e.resolve(t),s=e.resolve(n);return M(o,s,i)?new g(t,n,i):new A(o,s,i).fit()}function M(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}l.jsonID("replaceAround",m);class A{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.FK.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=r.FK.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let o=this.placed,s=n.depth,a=i.depth;for(;s&&a&&1==o.childCount;)o=o.firstChild.content,s--,a--;let l=new r.Ji(o,s,a);return e>-1?new m(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new g(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,i=(n?(e=D(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:a}=this.frontier[o],l,d=null;if(1==t&&(i?a.matchType(i.type)||(d=a.fillBefore(r.FK.from(i),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:o,parent:e,inject:d};if(2==t&&i&&(l=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:o,parent:e,wrap:l};if(e&&a.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=D(e,t);return!!i.childCount&&!i.firstChild.isLeaf&&(this.unplaced=new r.Ji(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=D(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new r.Ji(j(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new r.Ji(j(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,d=0,c=[],{match:h,type:u}=this.frontier[t];if(i){for(let e=0;e<i.childCount;e++)c.push(i.child(e));h=h.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;d<a.childCount;){let e=a.child(d),t=h.matchType(e.type);if(!t)break;(++d>1||0==l||e.content.size)&&(h=t,c.push(function e(t,n,i){if(n<=0)return t;let o=t.content;return n>1&&(o=o.replaceChild(0,e(o.firstChild,n-1,1==o.childCount?i-1:0))),n>0&&(o=t.type.contentMatch.fillBefore(o).append(o),i<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(r.FK.empty,!0)))),t.copy(o)}(e.mark(u.allowedMarks(e.marks)),1==d?l:0,d==a.childCount?p:-1)))}let f=d==a.childCount;f||(p=-1),this.placed=O(this.placed,t,r.FK.from(c)),this.frontier[t].match=h,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=f?0==e?r.Ji.empty:new r.Ji(j(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new r.Ji(j(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!L(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=L(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=L(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=O(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=O(this.placed,this.depth,r.FK.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.FK.empty,!0);e.childCount&&(this.placed=O(this.placed,this.frontier.length,e))}}function j(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(j(e.firstChild.content,t-1,n)))}function O(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(O(e.lastChild.content,t-1,n)))}function D(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function L(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function R(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class F extends l{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return d.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return d.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(i),0,+!t.isLeaf))}getMap(){return o.empty}invert(e){return new F(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new F(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new F(t.pos,t.attr,t.value)}}l.jsonID("attr",F);class z extends l{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return d.ok(n)}getMap(){return o.empty}invert(e){return new z(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new z(t.attr,t.value)}}l.jsonID("docAttr",z);let N=class extends Error{};(N=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),N.prototype.constructor=N,N.prototype.name="TransformError";class ${constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new s}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new N(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r.Ji.empty){let i=_(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new r.Ji(r.FK.from(n),0,0))}delete(e,t){return this.replace(e,t,r.Ji.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,i){if(!i.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(M(o,s,i))return e.step(new g(t,n,i));let a=R(o,s);0==a[a.length-1]&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:o.before(e)==t&&a.splice(1,0,-e)}let d=a.indexOf(l),c=[],h=i.openStart;for(let e=i.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==i.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var u;let t=c[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(l)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=i.openStart;t>=0;t--){let l=(t+h+1)%(i.openStart+1),u=c[l];if(u)for(let t=0;t<a.length;t++){let c=a[(t+d)%a.length],h=!0;c<0&&(h=!1,c=-c);let p=o.node(c-1),f=o.index(c-1);if(p.canReplaceWith(f,f,u.type,u.marks))return e.replace(o.before(c),h?s.after(c):n,new r.Ji(function e(t,n,i,o,s){if(n<i){let r=t.firstChild;t=t.replaceChild(0,r.copy(e(r.content,n+1,i,o,r)))}if(n>o){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(r.FK.empty,!0))}return t}(i.content,0,i.openStart,l),l,i.openEnd))}}let p=e.steps.length;for(let r=a.length-1;r>=0&&(e.replace(t,n,i),!(e.steps.length>p));r--){let e=a[r];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var i=e,o=t;if(!n.isInline&&i==o&&this.doc.resolve(i).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,i,n.type);null!=e&&(i=o=e)}return this.replaceRange(i,o,new r.Ji(r.FK.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=R(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:i,$to:o,depth:s}=t,a=i.before(s+1),l=o.after(s+1),d=a,c=l,h=r.FK.empty,u=0;for(let e=s,t=!1;e>n;e--)t||i.index(e)>0?(t=!0,h=r.FK.from(i.node(e).copy(h)),u++):d--;let p=r.FK.empty,f=0;for(let e=s,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,p=r.FK.from(o.node(e).copy(p)),f++):c++;e.step(new m(d,c,a,l,new r.Ji(h.append(p),u,f),h.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let i=null,{linebreakReplacement:o}=e.doc.type.schema,s=e.doc.resolve(t-n),a=s.node().type;if(o&&a.inlineContent){let e="pre"==a.whitespace,t=!!a.contentMatch.matchType(o);e&&!t?i=!1:!e&&t&&(i=!0)}let l=e.steps.length;if(!1===i){let r=e.doc.resolve(t+n);C(e,r.node(),r.before(),l)}a.inlineContent&&b(e,t+n-1,a,s.node().contentMatchAt(s.index()),null==i);let d=e.mapping.slice(l),c=d.map(t-n);if(e.step(new g(c,d.map(t+n,-1),r.Ji.empty,!0)),!0===i){let t=e.doc.resolve(c);S(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let i=r.FK.empty;for(let e=n.length-1;e>=0;e--){if(i.size){let t=n[e].type.contentMatch.matchFragment(i);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=r.FK.from(n[e].type.create(n[e].attrs,i))}let o=t.start,s=t.end;e.step(new m(o,s,o,s,new r.Ji(i,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,i=null){var o=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var a,l,d;let c,h,u="function"==typeof i?i(e):i;if(e.isTextblock&&!e.hasMarkup(n,u)&&(a=o.doc,l=o.mapping.slice(s).map(t),d=n,h=(c=a.resolve(l)).index(),c.parent.canReplaceWith(h,h+1,d))){let i=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}!1===i&&C(o,e,t,s),b(o,o.mapping.slice(s).map(t,1),n,void 0,null===i);let a=o.mapping.slice(s),l=a.map(t,1),d=a.map(t+e.nodeSize,1);return o.step(new m(l,d,l+1,d-1,new r.Ji(r.FK.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===i&&S(o,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,i){return!function(e,t,n,i,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let a=n.create(i,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new m(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.Ji(r.FK.from(a),0,0),1,!0))}(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new F(e,t,n)),this}setDocAttribute(e,t){return this.step(new z(e,t)),this}addNodeMark(e,t){return this.step(new p(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof r.CU)t.isInSet(n.marks)&&this.step(new f(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new f(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,i){let o=e.doc.resolve(t),s=r.FK.empty,a=r.FK.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){s=r.FK.from(o.node(e).copy(s));let t=i&&i[l];a=r.FK.from(t?t.type.create(t.attrs,a):o.node(e).copy(a))}e.step(new g(t,t,new r.Ji(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,d)=>{if(!r.isInline)return;let c=r.marks;if(!n.isInSet(c)&&d.type.allowsMarkType(n.type)){let d=Math.max(l,e),p=Math.min(l+r.nodeSize,t),f=n.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(f)||(i&&i.to==d&&i.mark.eq(c[e])?i.to=p:s.push(i=new u(d,p,c[e])));o&&o.to==d?o.to=p:a.push(o=new h(d,p,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var i;let o,s;return i=this,o=[],s=0,i.doc.nodesBetween(e,t,(i,a)=>{if(!i.isInline)return;s++;let l=null;if(n instanceof r.sX){let e=i.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(i.marks)&&(l=[n]):l=i.marks;if(l&&l.length){let n=Math.min(a+i.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],i;for(let e=0;e<o.length;e++){let t=o[e];t.step==s-1&&r.eq(o[e].style)&&(i=t)}i?(i.to=n,i.step=s):o.push({style:r,from:Math.max(a,e),to:n,step:s})}}}),o.forEach(e=>i.step(new u(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return b(this,e,t,n),this}}},8810:(e,t,n)=>{"use strict";n.d(t,{c:()=>d});var r=n(83102),i=n(54530),o=n(24167);let s="recording",a="recordingPreserveRedoStack",l="paused";class d{store;dispose;state=s;pendingDiff=new h;stacks=(0,r.eU)("HistoryManager.stacks",{undos:f,redos:f},{isEqual:(e,t)=>e.undos===t.undos&&e.redos===t.redos});annotateError;constructor(e){this.store=e.store,this.annotateError=e.annotateError??o.lQ,this.dispose=this.store.addHistoryInterceptor((e,t)=>{if("user"===t)switch(this.state){case s:this.pendingDiff.apply(e.changes),this.stacks.get().redos.length>0&&this.stacks.update(({undos:e})=>({undos:e,redos:f}));break;case a:this.pendingDiff.apply(e.changes);break;case l:break;default:(0,o.h6)(this.state)}})}flushPendingDiff(){if(this.pendingDiff.isEmpty())return;let e=this.pendingDiff.clear();this.stacks.update(({undos:t,redos:n})=>({undos:t.push({type:"diff",diff:e}),redos:n}))}getNumUndos(){return this.stacks.get().undos.length+ +!this.pendingDiff.isEmpty()}getNumRedos(){return this.stacks.get().redos.length}_isReplaying=!1;isReplaying(){return this._isReplaying}_isInBatch=!1;batch(e,t){let n=this.state;n!==l&&t?.history&&(this.state=c[t.history]);try{if(this._isInBatch)return(0,r.hL)(e),this;this._isInBatch=!0;try{(0,r.hL)(e)}catch(e){throw this.annotateError(e),e}finally{this._isInBatch=!1}return this}finally{this.state=n}}_undo({pushToRedoStack:e,toMark:t}){let n=this.state,r=this._isReplaying;this.state=l,this._isReplaying=!0;try{let{undos:n,redos:r}=this.stacks.get(),s=this.pendingDiff.clear(),a=(0,i.RF)(s),l=(0,i.E8)(s);e&&!a&&(r=r.push({type:"diff",diff:s}));let d=!1;if(a)for(;n.head?.type==="stop";){let i=n.head;if(n=n.tail,e&&(r=r.push(i)),i.id===t){d=!0;break}}if(!d)t:for(;n.head;){let s=n.head;switch(n=n.tail,e&&(r=r.push(s)),s.type){case"diff":(0,i.Fl)(l,[(0,i.E8)(s.diff)]);break;case"stop":if(!t)break t;if(s.id===t){d=!0;break t}break;default:(0,o.h6)(s)}}if(!d&&t)return this.pendingDiff.restore(s),this;this.store.applyDiff(l,{ignoreEphemeralKeys:!0}),this.store.ensureStoreIsUsable(),this.stacks.set({undos:n,redos:r})}finally{this._isReplaying=r,this.state=n}return this}undo(){return this._undo({pushToRedoStack:!0}),this}redo(){let e=this.state,t=this._isReplaying;this.state=l,this._isReplaying=!0;try{this.flushPendingDiff();let{undos:e,redos:t}=this.stacks.get();if(0===t.length)return this;for(;t.head?.type==="stop";)e=e.push(t.head),t=t.tail;let n=(0,i.L4)();for(;t.head;){let r=t.head;if(e=e.push(r),t=t.tail,"diff"===r.type)(0,i.Fl)(n,[r.diff]);else break}this.store.applyDiff(n,{ignoreEphemeralKeys:!0}),this.store.ensureStoreIsUsable(),this.stacks.set({undos:e,redos:t})}finally{this._isReplaying=t,this.state=e}return this}bail(){return this._undo({pushToRedoStack:!1}),this}bailToMark(e){return e&&this._undo({pushToRedoStack:!1,toMark:e}),this}squashToMark(e){let t=this.stacks.get().undos,n=[];for(;t.head&&("stop"!==t.head.type||t.head.id!==e);)"diff"===t.head.type&&n.push(t.head.diff),t=t.tail;if(!t.head||t.head?.id!==e)return console.error("Could not find mark to squash to: ",e),this;if(0===n.length)return this;let r=(0,i.L4)();return(0,i.Fl)(r,n.reverse()),this.stacks.update(({redos:e})=>({undos:t.push({type:"diff",diff:r}),redos:e})),this}_mark(e){(0,r.hL)(()=>{this.flushPendingDiff(),this.stacks.update(({undos:t,redos:n})=>({undos:t.push({type:"stop",id:e}),redos:n}))})}clear(){this.stacks.set({undos:f,redos:f}),this.pendingDiff.clear()}getMarkIdMatching(e){let t=this.stacks.get().undos;for(;t.head;){if("stop"===t.head.type&&t.head.id.includes(e))return t.head.id;t=t.tail}return null}debug(){let{undos:e,redos:t}=this.stacks.get();return{undos:m(e),redos:m(t),pendingDiff:this.pendingDiff.debug(),state:this.state}}}let c={record:s,"record-preserveRedoStack":a,ignore:l};class h{diff=(0,i.L4)();isEmptyAtom=(0,r.eU)("PendingDiff.isEmpty",!0);clear(){let e=this.diff;return this.diff=(0,i.L4)(),this.isEmptyAtom.set(!0),e}restore(e){this.diff=e,this.isEmptyAtom.set((0,i.RF)(e))}isEmpty(){return this.isEmptyAtom.get()}apply(e){(0,i.Fl)(this.diff,[e]),u(e.added)||u(e.removed)?this.isEmptyAtom.set((0,i.RF)(this.diff)):this.isEmptyAtom.__unsafe__getWithoutCapture()&&this.isEmptyAtom.set(!u(e.updated))}debug(){return{diff:this.diff,isEmpty:this.isEmpty()}}}function u(e){for(let t in e)return!0;return!1}class p{length=0;head=null;tail=this;push(e){return new g(e,this)}}let f=new p;class g{constructor(e,t){this.head=e,this.tail=t,this.length=t.length+1}head;tail;length;push(e){return new g(e,this)}}function m(e){if(!e.length)return r.Ml;let t=[];for(;e.length;)t.push(e.head),e=e.tail;return t}},11421:(e,t,n)=>{"use strict";n.d(t,{YO:()=>a,bG:()=>l,of:()=>s});var r=n(83102),i=n(24167),o=n(41463);let s={},a=d("pointerCaptureTrackingObject",{defaults:{all:new Map},shouldStoreForSession:!1}),l={logPreventDefaults:d("logPreventDefaults",{defaults:{all:!1}}),logPointerCaptures:d("logPointerCaptures",{defaults:{all:!1}}),logElementRemoves:d("logElementRemoves",{defaults:{all:!1}}),debugSvg:d("debugSvg",{defaults:{all:!1}}),showFps:d("showFps",{defaults:{all:!1}}),measurePerformance:d("measurePerformance",{defaults:{all:!1}}),throwToBlob:d("throwToBlob",{defaults:{all:!1}}),reconnectOnPing:d("reconnectOnPing",{defaults:{all:!1}}),debugCursors:d("debugCursors",{defaults:{all:!1}}),forceSrgb:d("forceSrgbColors",{defaults:{all:!1}}),debugGeometry:d("debugGeometry",{defaults:{all:!1}}),hideShapes:d("hideShapes",{defaults:{all:!1}}),editOnType:d("editOnType",{defaults:{all:!1}}),a11y:d("a11y",{defaults:{all:!1}}),debugElbowArrows:d("debugElbowArrows",{defaults:{all:!1}})};if("u">typeof Element){let e=Element.prototype.removeChild;(0,r.wv)("element removal logging",()=>{l.logElementRemoves.get()?Element.prototype.removeChild=function(t){return console.warn("[tldraw] removing child:",t),e.call(this,t)}:Element.prototype.removeChild=e})}function d(e,{defaults:t,shouldStoreForSession:n=!0}){var s;let a,l,h;return a=function(e){switch(c(()=>o.env.TLDRAW_ENV)??c(()=>o.env.VERCEL_PUBLIC_TLDRAW_ENV)??c(()=>o.env.NEXT_PUBLIC_TLDRAW_ENV)??"production"){case"production":return e.defaults.production??e.defaults.all;case"preview":case"staging":return e.defaults.staging??e.defaults.all;default:return e.defaults.development??e.defaults.all}}(s={name:e,defaults:t,shouldStoreForSession:n}),l=s.shouldStoreForSession?function(e){try{return JSON.parse((0,i._9)(`tldraw_debug:${e}`)??"null")}catch{return null}}(s.name):null,h=(0,r.eU)(`debug:${s.name}`,l??a),"u">typeof window&&(s.shouldStoreForSession&&(0,r.wv)(`debug:${s.name}`,()=>{let e=h.get();e===a?(0,i.ZJ)(`tldraw_debug:${s.name}`):(0,i.dQ)(`tldraw_debug:${s.name}`,JSON.stringify(e))}),Object.defineProperty(window,`tldraw${s.name.replace(/^[a-z]/,e=>e.toUpperCase())}`,{get:()=>h.get(),set(e){h.set(e)},configurable:!0})),Object.assign(h,s,{reset:()=>h.set(a)})}function c(e){try{return e()}catch{return null}}},12318:(e,t,n)=>{"use strict";n.d(t,{v:()=>f});var r=n(83102),i=n(54530),o=n(81467),s=n(24167),a=n(15727),l=n(46195),d=n(50139),c=n(38335),h=Object.defineProperty,u=Object.getOwnPropertyDescriptor,p=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?u(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&h(t,n,o),o};class f extends c.r{constructor(e){super(e),this.addEditorEvent("frame",this._onFrame)}_onFrame(e){this.updatePointerVelocity(e)}_originPagePoint=(0,r.eU)("originPagePoint",new l.l);getOriginPagePoint(){return this._originPagePoint.get()}get originPagePoint(){return this.getOriginPagePoint()}_originScreenPoint=(0,r.eU)("originScreenPoint",new l.l);getOriginScreenPoint(){return this._originScreenPoint.get()}get originScreenPoint(){return this.getOriginScreenPoint()}_previousPagePoint=(0,r.eU)("previousPagePoint",new l.l);getPreviousPagePoint(){return this._previousPagePoint.get()}get previousPagePoint(){return this.getPreviousPagePoint()}_previousScreenPoint=(0,r.eU)("previousScreenPoint",new l.l);getPreviousScreenPoint(){return this._previousScreenPoint.get()}get previousScreenPoint(){return this.getPreviousScreenPoint()}_currentPagePoint=(0,r.eU)("currentPagePoint",new l.l);getCurrentPagePoint(){return this._currentPagePoint.get()}get currentPagePoint(){return this.getCurrentPagePoint()}_currentScreenPoint=(0,r.eU)("currentScreenPoint",new l.l);getCurrentScreenPoint(){return this._currentScreenPoint.get()}get currentScreenPoint(){return this.getCurrentScreenPoint()}_pointerVelocity=(0,r.eU)("pointerVelocity",new l.l);getPointerVelocity(){return this._pointerVelocity.get()}get pointerVelocity(){return this.getPointerVelocity()}setPointerVelocity(e){this._pointerVelocity.set(e)}keys=new i.uw("keys");buttons=new i.uw("buttons");_isPen=(0,r.eU)("isPen",!1);getIsPen(){return this._isPen.get()}get isPen(){return this.getIsPen()}set isPen(e){this.setIsPen(e)}setIsPen(e){this._isPen.set(e)}_shiftKey=(0,r.eU)("shiftKey",!1);getShiftKey(){return this._shiftKey.get()}get shiftKey(){return this.getShiftKey()}set shiftKey(e){this.setShiftKey(e)}setShiftKey(e){this._shiftKey.set(e)}_metaKey=(0,r.eU)("metaKey",!1);getMetaKey(){return this._metaKey.get()}get metaKey(){return this.getMetaKey()}set metaKey(e){this.setMetaKey(e)}setMetaKey(e){this._metaKey.set(e)}_ctrlKey=(0,r.eU)("ctrlKey",!1);getCtrlKey(){return this._ctrlKey.get()}get ctrlKey(){return this.getCtrlKey()}set ctrlKey(e){this.setCtrlKey(e)}setCtrlKey(e){this._ctrlKey.set(e)}_altKey=(0,r.eU)("altKey",!1);getAltKey(){return this._altKey.get()}get altKey(){return this.getAltKey()}set altKey(e){this.setAltKey(e)}setAltKey(e){this._altKey.set(e)}getAccelKey(){return(0,d.g)({metaKey:this.getMetaKey(),ctrlKey:this.getCtrlKey()})}get accelKey(){return this.getAccelKey()}_isDragging=(0,r.eU)("isDragging",!1);getIsDragging(){return this._isDragging.get()}get isDragging(){return this.getIsDragging()}set isDragging(e){this.setIsDragging(e)}setIsDragging(e){this._isDragging.set(e)}_isPointing=(0,r.eU)("isPointing",!1);getIsPointing(){return this._isPointing.get()}get isPointing(){return this.getIsPointing()}set isPointing(e){this.setIsPointing(e)}setIsPointing(e){this._isPointing.set(e)}_isRightPointing=(0,r.eU)("isRightPointing",!1);getIsRightPointing(){return this._isRightPointing.get()}setIsRightPointing(e){this._isRightPointing.set(e)}_isPinching=(0,r.eU)("isPinching",!1);getIsPinching(){return this._isPinching.get()}get isPinching(){return this.getIsPinching()}set isPinching(e){this.setIsPinching(e)}setIsPinching(e){this._isPinching.set(e)}_isEditing=(0,r.eU)("isEditing",!1);getIsEditing(){return this._isEditing.get()}get isEditing(){return this.getIsEditing()}set isEditing(e){this.setIsEditing(e)}setIsEditing(e){this._isEditing.set(e)}_isPanning=(0,r.eU)("isPanning",!1);getIsPanning(){return this._isPanning.get()}get isPanning(){return this.getIsPanning()}set isPanning(e){this.setIsPanning(e)}setIsPanning(e){this._isPanning.set(e)}_isSpacebarPanning=(0,r.eU)("isSpacebarPanning",!1);getIsSpacebarPanning(){return this._isSpacebarPanning.get()}get isSpacebarPanning(){return this.getIsSpacebarPanning()}set isSpacebarPanning(e){this.setIsSpacebarPanning(e)}setIsSpacebarPanning(e){this._isSpacebarPanning.set(e)}_getHasCollaborators(){return this.editor.getCollaborators().length>0}_velocityPrevPoint=new l.l;updatePointerVelocity(e){let t=this.getCurrentScreenPoint(),n=this.getPointerVelocity();if(0===e)return;let r=l.l.Sub(t,this._velocityPrevPoint);this._velocityPrevPoint=t.clone();let i=r.len(),o=i?r.div(i):new l.l(0,0),s=1-Math.pow(.5,e/16),a=n.clone().lrp(o.mul(i/e),s);.01>Math.abs(a.x)&&(a.x=0),.01>Math.abs(a.y)&&(a.y=0),n.equals(a)||this._pointerVelocity.set(a)}updateFromEvent(e){let t=this._currentScreenPoint.__unsafe__getWithoutCapture(),n=this._currentPagePoint.__unsafe__getWithoutCapture(),i=this._isPinching.__unsafe__getWithoutCapture(),{screenBounds:s}=this.editor.store.unsafeGetWithoutCapture(o.O9),{x:d,y:c,z:h}=(0,r.Pm)(()=>this.editor.getCamera()),u=e.point.x-s.x,p=e.point.y-s.y,f=e.point.z??.5;this._previousScreenPoint.set(t),this._previousPagePoint.set(n),this._currentScreenPoint.set(new l.l(u,p));let g=u/h-d,m=p/h-c;isFinite(g)&&isFinite(m)&&this._currentPagePoint.set(new l.l(g,m,f)),this._isPen.set("pointer"===e.type&&e.isPen),("pointer_down"===e.name||i)&&(this._pointerVelocity.set(new l.l),this._originScreenPoint.set(this._currentScreenPoint.__unsafe__getWithoutCapture()),this._originPagePoint.set(this._currentPagePoint.__unsafe__getWithoutCapture())),this._getHasCollaborators()&&this.editor.run(()=>{let t=this._currentPagePoint.__unsafe__getWithoutCapture();this.editor.store.put([{id:o.G1,typeName:"pointer",x:t.x,y:t.y,lastActivityTimestamp:"pointer"===e.type&&e.pointerId===a.zm.CAMERA_MOVE?this.editor.store.unsafeGetWithoutCapture(o.G1)?.lastActivityTimestamp??Date.now():Date.now(),meta:{}}])},{history:"ignore"})}toJson(){return{originPagePoint:this._originPagePoint.get().toJson(),originScreenPoint:this._originScreenPoint.get().toJson(),previousPagePoint:this._previousPagePoint.get().toJson(),previousScreenPoint:this._previousScreenPoint.get().toJson(),currentPagePoint:this._currentPagePoint.get().toJson(),currentScreenPoint:this._currentScreenPoint.get().toJson(),pointerVelocity:this._pointerVelocity.get().toJson(),shiftKey:this._shiftKey.get(),metaKey:this._metaKey.get(),ctrlKey:this._ctrlKey.get(),altKey:this._altKey.get(),isPen:this._isPen.get(),isDragging:this._isDragging.get(),isPointing:this._isPointing.get(),isPinching:this._isPinching.get(),isEditing:this._isEditing.get(),isPanning:this._isPanning.get(),isSpacebarPanning:this._isSpacebarPanning.get(),keys:Array.from(this.keys.keys()),buttons:Array.from(this.buttons.keys())}}}p([s.oI],f.prototype,"_onFrame",1),p([r.EW],f.prototype,"_getHasCollaborators",1)},12894:(e,t,n)=>{"use strict";n.d(t,{K:()=>f,w:()=>p});for(var r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o="u">typeof navigator&&/Mac/.test(navigator.platform),s="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)r[48+a]=r[96+a]=String(a);for(var a=1;a<=24;a++)r[a+111]="F"+a;for(var a=65;a<=90;a++)r[a]=String.fromCharCode(a+32),i[a]=String.fromCharCode(a);for(var l in r)i.hasOwnProperty(l)||(i[l]=r[l]);var d=n(76865);let c="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),h="u">typeof navigator&&/Win/.test(navigator.platform);function u(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function p(e){return new d.k_({props:{handleKeyDown:f(e)}})}function f(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))c?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var a;let l=("Esc"==(a=!(o&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||s&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?i:r)[n.keyCode]||n.key||"Unidentified")&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a),d,c=t[u(l,n)];if(c&&c(e.state,e.dispatch,e))return!0;if(1==l.length&&" "!=l){if(n.shiftKey){let r=t[u(l,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(h&&n.ctrlKey&&n.altKey)&&(d=r[n.keyCode])&&d!=l){let r=t[u(d,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}},13004:(e,t,n)=>{"use strict";n.d(t,{f:()=>c});var r=n(83102),i=n(81467),o=n(97156),s=n(16038),a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?l(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&a(t,n,o),o};class c{constructor(e,t){if(this.user=e,this.colorScheme=t,"u"<typeof window||!(0,s.CM)().matchMedia)return;const n=(0,s.CM)().matchMedia("(prefers-color-scheme: dark)");n?.matches&&this.systemColorScheme.set("dark");const r=e=>{e.matches?this.systemColorScheme.set("dark"):this.systemColorScheme.set("light")};n?.addEventListener("change",r),this.disposables.add(()=>n?.removeEventListener("change",r))}user;colorScheme;systemColorScheme=(0,r.eU)("systemColorScheme","light");disposables=new Set;dispose(){this.disposables.forEach(e=>e())}updateUserPreferences(e){this.user.setUserPreferences({...this.user.userPreferences.get(),...e})}getUserPreferences(){return{id:this.getExternalId(),name:this.getName(),locale:this.getLocale(),color:this.getColor(),animationSpeed:this.getAnimationSpeed(),areKeyboardShortcutsEnabled:this.getAreKeyboardShortcutsEnabled(),isSnapMode:this.getIsSnapMode(),colorScheme:this.user.userPreferences.get().colorScheme,isDarkMode:this.getIsDarkMode(),isWrapMode:this.getIsWrapMode(),isDynamicResizeMode:this.getIsDynamicResizeMode(),enhancedA11yMode:this.getEnhancedA11yMode(),inputMode:this.getInputMode(),isZoomDirectionInverted:this.getIsZoomDirectionInverted()}}getIsDarkMode(){switch(this.user.userPreferences.get().colorScheme??this.colorScheme){case"dark":return!0;case"light":default:return!1;case"system":return"dark"===this.systemColorScheme.get()}}getEdgeScrollSpeed(){return this.user.userPreferences.get().edgeScrollSpeed??o.Tj.edgeScrollSpeed}getAnimationSpeed(){return this.user.userPreferences.get().animationSpeed??o.Tj.animationSpeed}getAreKeyboardShortcutsEnabled(){return this.user.userPreferences.get().areKeyboardShortcutsEnabled??o.Tj.areKeyboardShortcutsEnabled}getExternalId(){return this.user.userPreferences.get().id}getId(){return this.getExternalId()}getRecordId(){return(0,i.dB)(this.getExternalId())}getName(){return this.user.userPreferences.get().name?.trim()??o.Tj.name}getLocale(){return this.user.userPreferences.get().locale??o.Tj.locale}getColor(){return this.user.userPreferences.get().color??o.Tj.color}getIsSnapMode(){return this.user.userPreferences.get().isSnapMode??o.Tj.isSnapMode}getIsWrapMode(){return this.user.userPreferences.get().isWrapMode??o.Tj.isWrapMode}getIsDynamicResizeMode(){return this.user.userPreferences.get().isDynamicSizeMode??o.Tj.isDynamicSizeMode}getIsPasteAtCursorMode(){return this.user.userPreferences.get().isPasteAtCursorMode??o.Tj.isPasteAtCursorMode}getEnhancedA11yMode(){return this.user.userPreferences.get().enhancedA11yMode??o.Tj.enhancedA11yMode}getInputMode(){return this.user.userPreferences.get().inputMode??o.Tj.inputMode}getIsZoomDirectionInverted(){return this.user.userPreferences.get().isZoomDirectionInverted??o.Tj.isZoomDirectionInverted}}d([r.EW],c.prototype,"getUserPreferences",1),d([r.EW],c.prototype,"getIsDarkMode",1),d([r.EW],c.prototype,"getEdgeScrollSpeed",1),d([r.EW],c.prototype,"getAnimationSpeed",1),d([r.EW],c.prototype,"getAreKeyboardShortcutsEnabled",1),d([r.EW],c.prototype,"getExternalId",1),d([r.EW],c.prototype,"getId",1),d([r.EW],c.prototype,"getRecordId",1),d([r.EW],c.prototype,"getName",1),d([r.EW],c.prototype,"getLocale",1),d([r.EW],c.prototype,"getColor",1),d([r.EW],c.prototype,"getIsSnapMode",1),d([r.EW],c.prototype,"getIsWrapMode",1),d([r.EW],c.prototype,"getIsDynamicResizeMode",1),d([r.EW],c.prototype,"getIsPasteAtCursorMode",1),d([r.EW],c.prototype,"getEnhancedA11yMode",1),d([r.EW],c.prototype,"getInputMode",1),d([r.EW],c.prototype,"getIsZoomDirectionInverted",1)},13248:(e,t,n)=>{"use strict";n.d(t,{sanitizeSvg:()=>k});let r=new Set(["svg","a","altglyph","altglyphdef","altglyphitem","animate","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","fedistantlight","fedropshadow","feflood","fefunca","fefuncb","fefuncg","fefuncr","fegaussianblur","feimage","femerge","femergenode","femorphology","feoffset","fepointlight","fespecularlighting","fespotlight","fetile","feturbulence","filter","font","foreignobject","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","set","stop","style","switch","symbol","text","textpath","title","tref","tspan","use","view","vkern"]),i=new Set(["a","b","blockquote","body","br","code","del","div","em","h1","h2","h3","h4","h5","h6","i","li","mark","ol","p","pre","span","strong","s","sub","sup","table","tbody","td","th","thead","tr","u","ul"]),o=new Set(["script","iframe","object","embed","form","input","textarea","select","button","link","meta","base","img","video","audio","source","picture","svg"]),s=new Set(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clip-path","clip-rule","clippathunits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","diffuseconstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","from","fx","fy","g1","g2","glyph-name","glyphref","gradienttransform","gradientunits","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","kernelmatrix","kernelunitlength","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","mask","mask-type","maskcontentunits","maskunits","max","media","method","min","mode","name","numoctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","radius","refx","refy","repeatcount","repeatdur","requiredfeatures","restart","result","role","rotate","rx","ry","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","text-anchor","text-decoration","text-rendering","textlength","to","transform","transform-origin","type","u1","u2","unicode","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewbox","visibility","width","word-spacing","wrap","writing-mode","x","x1","x2","xchannelselector","xlink:href","xml:id","xml:space","xlink:title","xmlns","xmlns:xlink","y","y1","y2","z","zoomandpan"]),a=new Set(["class","dir","href","id","lang","role","style","tabindex","title"]),l=/^data-/,d=/^aria-/,c=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,h=/^(?:https?:|mailto:)/i,u=/^data:/i,p=/^data:image\/(?:png|jpeg|jpg|gif|webp|avif|bmp|tiff|x-icon|vnd\.microsoft\.icon)[;,]/i,f=/^data:image\/svg\+xml[;,]/i,g=/^#/,m=/^data:(?:image\/(?:png|jpeg|jpg|gif|webp|avif)|font\/(?:woff2?|opentype|truetype|sfnt)|application\/(?:x-font-woff|font-woff2?|x-font-ttf|x-font-opentype|font-sfnt))[;,]/i;function y(e){let t=e.replace(/\\([0-9a-fA-F]{1,6})\s?|\\([^\n])/g,(e,t,n)=>{if(t){let e=parseInt(t,16);return e>1114111||0===e?"�":String.fromCodePoint(e)}return n});return(t=(t=(t=(t=t.replace(/@import\s+(?:url\s*\([^)]*\)|"[^"]*"|'[^']*')[^;]*;?|@import\b[^;]*;?/gi,"")).replace(/expression\s*\([^)]*\)/gi,"")).replace(/-moz-binding\s*:[^;]*/gi,"")).replace(/behavior\s*:[^;]*/gi,"")).replace(/url\s*\(\s*(['"]?)(.*?)\1\s*\)/gis,(e,t,n)=>{let r=n.replace(c,"");return m.test(r)||g.test(r)?e:""})}let b=new Set(["animate","set","animatecolor","animatetransform"]),x=/^(?:href|xlink:href|on)/i,w=/^on/i,v=new Set(["clip-path","cursor","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"]);function S(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n],i=r.name.toLowerCase(),o=i.replace(c,"");if(w.test(o)){e.removeAttribute(r.name);continue}if(!(l.test(i)||d.test(i))){if(!s.has(i)){e.removeAttribute(r.name);continue}if("href"===i||"xlink:href"===i){let n=function(e,t,n){let r=t.replace(c,""),i=e.tagName.toLowerCase();if("image"===i||"feimage"===i){if(p.test(r))return t;if(f.test(r)){let e;if(n>=10)return console.warn("Embedded SVG data URI recursion depth limit (10) reached"),null;try{let t=function(e){let t=e.search(/;base64,/i);if(t>=0){let n=e.slice(t+8),r=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return new TextDecoder().decode(r)}let n=e.indexOf(",");return n<0?null:decodeURIComponent(e.slice(n+1))}(r);if(null===t)return null;e=t}catch{return null}let t=C(e,n+1);return t?"data:image/svg+xml;base64,"+btoa(Array.from(new TextEncoder().encode(t),e=>String.fromCharCode(e)).join("")):null}return null}return"use"===i?g.test(r)?t:null:"a"===i?h.test(r)?t:null:u.test(r)||g.test(r)?t:null}(e,r.value,t);null===n?e.removeAttribute(r.name):n!==r.value&&(r.value=n);continue}if("style"===i){r.value=y(r.value);continue}v.has(i)&&/url\s*\(/i.test(r.value)&&(r.value=y(r.value))}}}function C(e,t){let n=new DOMParser().parseFromString(e,"image/svg+xml");if(n.querySelector("parsererror"))return"";let s=n.documentElement;return"svg"!==s.tagName.toLowerCase()||(S(s,t),!function e(t,n,s){for(let u=t.children.length-1;u>=0;u--){let p=t.children[u],f=p.tagName.toLowerCase();"svg"===n?"foreignobject"===f?(S(p,s),e(p,"html",s)):"style"===f?(S(p,s),p.textContent&&(p.textContent=y(p.textContent))):b.has(f)&&function(e){let t=e.getAttribute("attributeName");return!!t&&x.test(t.replace(c,""))}(p)?p.remove():r.has(f)?(S(p,s),e(p,"svg",s)):p.remove():o.has(f)?p.remove():i.has(f)?(!function(e){let t=e.tagName.toLowerCase();for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n],i=r.name.toLowerCase(),o=i.replace(c,"");if(w.test(o)){e.removeAttribute(r.name);continue}if(!(l.test(i)||d.test(i))){if(!a.has(i)){e.removeAttribute(r.name);continue}if("href"===i){if("a"!==t){e.removeAttribute(r.name);continue}let n=r.value.replace(c,"");h.test(n)||e.removeAttribute(r.name);continue}"style"===i&&(r.value=y(r.value))}}}(p),e(p,"html",s)):p.remove()}}(s,"svg",t),0===s.children.length)?"":new XMLSerializer().serializeToString(s)}function k(e){return C(e,0)}},13656:(e,t,n)=>{"use strict";n.d(t,{p:()=>i,r:()=>r});let r="5.3.2",i={major:"2026-05-06T16:28:18.473Z",minor:"2026-08-05T11:39:54.978Z",patch:"2026-08-18T09:59:40.172Z"}},13982:(e,t,n)=>{"use strict";n.d(t,{$:()=>a,Y:()=>o});var r=n(83102),i=n(16038);let o={isSafari:!1,isIos:!1,isChromeForIos:!1,isFirefox:!1,isAndroid:!1,isWebview:!1,isDarwin:!1,hasCanvasSupport:!1,isTouchDevice:!1},s=!1;"u">typeof window&&("navigator"in window&&(o.isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o.isIos=!!navigator.userAgent.match(/iPad/i)||!!navigator.userAgent.match(/iPhone/i),o.isChromeForIos=/crios.*safari/i.test(navigator.userAgent),o.isFirefox=/firefox/i.test(navigator.userAgent),o.isAndroid=/android/i.test(navigator.userAgent),o.isDarwin=(0,i.CM)().navigator.userAgent.toLowerCase().indexOf("mac")>-1),o.hasCanvasSupport="Promise"in window&&"HTMLCanvasElement"in window,s=o.isFirefox&&!o.isAndroid&&!o.isIos,o.isTouchDevice="navigator"in window&&window.navigator.maxTouchPoints>0||"function"==typeof window.matchMedia&&window.matchMedia("(any-pointer: coarse)").matches);let a=(0,r.eU)("tlenvReactive",{isCoarsePointer:!1,supportsP3ColorSpace:!1});if("u">typeof window&&"u">typeof CSS&&CSS.supports("color","color(display-p3 1 1 1)")){let e=window.matchMedia("(color-gamut: p3)"),t=()=>{let t=e.matches;t!==a.__unsafe__getWithoutCapture().supportsP3ColorSpace&&a.update(e=>({...e,supportsP3ColorSpace:t}))};t(),e.addEventListener("change",t)}if("u">typeof window&&!s){let e=(0,i.CM)().matchMedia&&(0,i.CM)().matchMedia("(any-pointer: coarse)");if(e){let t=()=>{let t=e.matches;t!==a.__unsafe__getWithoutCapture().isCoarsePointer&&a.update(e=>({...e,isCoarsePointer:t}))};t(),e.addEventListener("change",t)}(0,i.CM)().addEventListener("pointerdown",e=>{let t="mouse"!==e.pointerType;t!==a.__unsafe__getWithoutCapture().isCoarsePointer&&a.update(e=>({...e,isCoarsePointer:t}))},{capture:!0})}},15727:(e,t,n)=>{"use strict";n.d(t,{BV:()=>a,EI:()=>d,R_:()=>c,Tf:()=>h,bH:()=>l,mp:()=>o,zd:()=>i,zm:()=>s});var r=n(58347);let i={isLocked:!1,wheelBehavior:"pan",panSpeed:1,zoomSpeed:1,zoomSteps:[.05,.1,.25,.5,1,2,4,8]},o={duration:0,easing:r.Z.easeInOutCubic},s={CAMERA_MOVE:-10},a=["top","right","bottom","left"],l=0,d=2,c=1,h=5},16038:(e,t,n)=>{"use strict";n.d(t,{$h:()=>a,CM:()=>h,MM:()=>l,YY:()=>o,gh:()=>u,hP:()=>s,jL:()=>c,oO:()=>d,wo:()=>i});var r=n(11421);function i(e){"cancelable"in e&&!e.cancelable||(e.preventDefault(),r.bG.logPreventDefaults.get()&&console.warn("preventDefault called on event:",e))}function o(e,t){if(e.setPointerCapture(t.pointerId),r.bG.logPointerCaptures.get()){let n=r.YO.get();n.set(e,(n.get(e)??0)+1),console.warn("setPointerCapture called on element:",e,t)}}function s(e,t){if(e.hasPointerCapture(t.pointerId)&&(e.releasePointerCapture(t.pointerId),r.bG.logPointerCaptures.get())){let n=r.YO.get();1===n.get(e)?n.delete(e):n.has(e)?n.set(e,n.get(e)-1):console.warn("Release without capture"),console.warn("releasePointerCapture called on element:",e,t)}}function a(e,t,n){e&&e.style.setProperty(t,String(n))}function l(e,t){if(t.isConnected&&e.isConnected&&"function"==typeof e.moveBefore&&t.ownerDocument===e.ownerDocument)try{e.moveBefore(t,null);return}catch{}e.appendChild(t)}function d(e,t=!0){if(!e)return!1;let n=e.tagName.toLowerCase();return e.isContentEditable||"input"===n||"textarea"===n||t&&"select"===n||t&&"button"===n||e.classList.contains("tlui-slider__thumb")}function c(){return"u">typeof document?document:globalThis.document}function h(){return"u">typeof window?window:globalThis}function u(e=!0,t){return d((t??c()).activeElement,e)}},16398:(e,t,n)=>{"use strict";n.d(t,{O:()=>r});let r={wheel:"onWheel",pointer_down:"onPointerDown",pointer_move:"onPointerMove",long_press:"onLongPress",pointer_up:"onPointerUp",right_click:"onRightClick",middle_click:"onMiddleClick",key_down:"onKeyDown",key_up:"onKeyUp",key_repeat:"onKeyRepeat",cancel:"onCancel",complete:"onComplete",interrupt:"onInterrupt",double_click:"onDoubleClick",tick:"onTick"}},17347:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var r=n(12115);function i(e){let t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...e)=>t.current?.(...e),[])}(0,Object.defineProperty)(i,"name",{value:"useCallbackRef",configurable:!0})},17357:(e,t,n)=>{"use strict";n.d(t,{pX:()=>T});var r=n(24167),i=n(83102),o=n(54530);let s="patch",a="remove";function l(e){let t=null;for(let[n,i]of(0,r.iA)(e.added))t||(t={}),t[n]=["put",i];for(let[n,i]of(0,r.Ic)(e.updated)){let e=u(n,i);e&&(t||(t={}),t[i.id]=[s,e])}for(let n of Object.keys(e.removed))t||(t={}),t[n]=[a];return t}let d="delete",c="append",h="patch";function u(e,t,n=!1){return p(e,t,new Set(["props","meta"]),n)}function p(e,t,n,i){if(e===t)return null;let o=null;for(let s of Object.keys(e)){if(!(s in t)){o||(o={}),o[s]=[d];continue}let a=e[s],l=t[s];if(n?.has(s)||Array.isArray(a)&&Array.isArray(l)||"string"==typeof a&&"string"==typeof l){let e=function e(t,n,i){if(Object.is(t,n))return null;if(Array.isArray(t)&&Array.isArray(n))return function(t,n,i){if(Object.is(t,n))return null;if(t.length===n.length){let o=Math.max(t.length/5,1),s=[];for(let e=0;e<t.length;e++)if(!(0,r.n4)(t[e],n[e])&&(s.push(e),s.length>o))return["put",n];if(0===s.length)return null;let a={};for(let r of s){let o=t[r],s=n[r];if(o&&s)if("object"==typeof o&&"object"==typeof s){let t=e(o,s,i);t&&(a[r]=t)}else a[r]=["put",s];else a[r]=["put",s]}return[h,a]}for(let e=0;e<t.length;e++)if(!(0,r.n4)(t[e],n[e]))return["put",n];return[c,n.slice(t.length),t.length]}(t,n,i);if("string"==typeof t&&"string"==typeof n)return!i&&n.startsWith(t)?[c,n.slice(t.length),t.length]:["put",n];{if(!t||!n||"object"!=typeof t||"object"!=typeof n)return(0,r.n4)(t,n)?null:["put",n];let e=p(t,n,void 0,i);return e?[h,e]:null}}(a,l,i);e&&(o||(o={}),o[s]=e)}else(0,r.n4)(a,l)||(o||(o={}),o[s]=["put",l])}for(let n of Object.keys(t))n in e||(o||(o={}),o[n]=["put",t[n]]);return o}function f(e,t){let n=setInterval(e,t);return()=>clearInterval(n)}class g{lastServerClock=-1;lastServerInteractionTimestamp=Date.now();pendingPushRequests=[];unsentChanges={nextDiff:void 0,nextPresence:void 0};speculativeChanges={added:{},updated:{},removed:{}};disposables=[];fpsScheduler;sendUnsentChanges;scheduleRebase;store;socket;presenceState;presenceMode;isConnectedToRoom=!1;clientClock=0;onAfterConnect;onCustomMessageReceived;isDebugging=!1;debug(...e){this.isDebugging&&console.debug(...e)}presenceType;didCancel;constructor(e){this.didCancel=e.didCancel,this.presenceType=e.store.scopedTypes.presence.values().next().value??null,this.fpsScheduler=new r.$3(30),this.sendUnsentChanges=this.fpsScheduler.fpsThrottle(()=>{if(this.debug("sending unsent changes",{isConnectedToRoom:this.isConnectedToRoom,unsentChanges:this.unsentChanges}),!this.isConnectedToRoom||this.store.isPossiblyCorrupted()||!this.unsentChanges.nextDiff&&!this.unsentChanges.nextPresence)return;let e=this.unsentChanges.nextDiff?l(this.unsentChanges.nextDiff)??void 0:void 0,t=this.unsentChanges.nextPresence?function(e,t){if(!e&&t)return["put",t];if(e&&t){let n=u(e,t);if(!n)return;return[s,n]}}(this.lastPushedPresenceState,this.unsentChanges.nextPresence):void 0;if(!e&&!t)return;let n={type:"push",clientClock:this.clientClock,diff:e,presence:t};this.debug("sending push request",n),this.socket.sendMessage(n),this.unsentChanges.nextPresence&&(this.lastPushedPresenceState=this.unsentChanges.nextPresence),this.clientClock++,this.pendingPushRequests.push(n),this.unsentChanges.nextDiff=void 0,this.unsentChanges.nextPresence=void 0}),this.scheduleRebase=this.fpsScheduler.fpsThrottle(this.rebase),"u">typeof window&&(window.tlsync=this),this.store=e.store,this.socket=e.socket,this.onAfterConnect=e.onAfterConnect,this.onCustomMessageReceived=e.onCustomMessageReceived;let t=!1;this.presenceState=e.presence,this.presenceMode=e.presenceMode,this.disposables.push(this.store.listen(({changes:e})=>{if(this.didCancel?.())return this.close();this.debug("received store changes",{changes:e}),this.push(e)},{source:"user",scope:"document"}),this.socket.onReceiveMessage(n=>{if(this.didCancel?.())return this.close();this.debug("received message from server",n),this.handleServerEvent(n),t||(t=!0,e.onLoad(this))}),this.socket.onStatusChange(n=>{if(this.didCancel?.())return this.close();this.debug("socket status changed",n.status),"online"===n.status?this.sendConnectMessage():(this.resetConnection(),"error"===n.status&&(t=!0,e.onSyncError(n.reason),this.close()))}),f(()=>{if(this.didCancel?.())return this.close();if(this.debug("ping loop",{isConnectedToRoom:this.isConnectedToRoom}),this.isConnectedToRoom)try{this.socket.sendMessage({type:"ping"})}catch(e){console.warn("ping failed, resetting",e),this.resetConnection()}},5e3),f(()=>{if(this.didCancel?.())return this.close();if(this.debug("health check loop",{isConnectedToRoom:this.isConnectedToRoom}),!this.isConnectedToRoom)return;let e=Date.now()-this.lastServerInteractionTimestamp;e<1e4?this.debug("health check passed",{timeSinceLastServerInteraction:e}):(console.warn("Haven't heard from the server in a while, resetting connection..."),this.resetConnection())},1e4)),this.presenceState&&this.disposables.push((0,i.wv)("pushPresence",()=>{if(this.didCancel?.())return this.close();let e=this.presenceMode?.get();this.fpsScheduler.updateTargetFps(this.getSyncFps()),"full"===e&&this.pushPresence(this.presenceState.get())})),"online"===this.socket.connectionStatus&&this.sendConnectMessage()}latestConnectRequestId=null;sendConnectMessage(){this.isConnectedToRoom?console.error("sendConnectMessage called while already connected"):(this.debug("sending connect message"),this.latestConnectRequestId=(0,r.NF)(),this.socket.sendMessage({type:"connect",connectRequestId:this.latestConnectRequestId,schema:this.store.schema.serialize(),protocolVersion:8,lastServerClock:this.lastServerClock}))}resetConnection(e=!1){this.debug("resetting connection"),e&&(this.lastServerClock=0);let t=Object.keys(this.store.serialize("presence"));t.length>0&&this.store.mergeRemoteChanges(()=>{this.store.remove(t)}),this.lastPushedPresenceState=null,this.isConnectedToRoom=!1,this.pendingPushRequests=[],this.incomingDiffBuffer=[],this.unsentChanges.nextDiff=void 0,this.unsentChanges.nextPresence=void 0,"online"===this.socket.connectionStatus&&this.socket.restart()}didReconnect(e){if(this.debug("did reconnect",e),e.connectRequestId===this.latestConnectRequestId){if(this.latestConnectRequestId=null,this.isConnectedToRoom){console.error("didReconnect called while already connected"),this.resetConnection(!0);return}if(this.pendingPushRequests.length>0){console.error("pendingPushRequests should already be empty when we reconnect"),this.resetConnection(!0);return}(0,i.hL)(()=>{let t=this.speculativeChanges;this.speculativeChanges={added:{},updated:{},removed:{}},this.store.mergeRemoteChanges(()=>{let n={},i="wipe_all"===e.hydrationType;for(let[e,s]of(i||this.store.applyDiff((0,o.E8)(t),{runCallbacks:!1}),(0,r.iA)(this.store.serialize("all"))))(i&&this.store.scopedTypes.document.has(s.typeName)||s.typeName===this.presenceType)&&(n[e]=[a]);this.applyNetworkDiff({...n,...e.diff},!0),this.isConnectedToRoom=!0;let s=l(t);if(!s)return;let d=this.store.filterChangesByScope(this.store.extractingChanges(()=>{this.applyNetworkDiff(s,!0)}),"document");d&&this.push(d)}),this.onAfterConnect?.(this,{isReadonly:e.isReadonly,objectAccess:e.objectAccess??"write"});let n=this.presenceState?.get();n&&this.pushPresence(n)}),this.lastServerClock=e.serverClock}}incomingDiffBuffer=[];handleServerEvent(e){switch(this.debug("received server event",e),this.lastServerInteractionTimestamp=Date.now(),e.type){case"connect":this.didReconnect(e);break;case"patch":case"push_result":if(!this.isConnectedToRoom)break;this.incomingDiffBuffer.push(e),this.scheduleRebase();break;case"data":if(!this.isConnectedToRoom)break;this.incomingDiffBuffer.push(...e.data),this.scheduleRebase();break;case"incompatibility_error":console.error("incompatibility error is legacy and should no longer be sent by the server");break;case"pong":break;case"custom":this.onCustomMessageReceived?.call(null,e.data);break;default:(0,r.h6)(e)}}close(){this.debug("closing"),this.disposables.forEach(e=>e()),this.sendUnsentChanges.cancel?.(),this.scheduleRebase.cancel?.(),"u">typeof window&&window.tlsync===this&&delete window.tlsync}lastPushedPresenceState=null;pushPresence(e){this.store._flushHistory(),this.isConnectedToRoom&&(this.unsentChanges.nextPresence=e,this.sendUnsentChanges())}push(e){this.debug("push",e),(0,o.Fl)(this.speculativeChanges,[e]),this.isConnectedToRoom&&(this.unsentChanges.nextDiff||(this.unsentChanges.nextDiff={added:{},updated:{},removed:{}}),(0,o.Fl)(this.unsentChanges.nextDiff,[e]),this.sendUnsentChanges())}getSyncFps(){return this.presenceMode?.get()==="solo"?1:30}applyNetworkDiff(e,t){this.debug("applyNetworkDiff",e);let n={added:{},updated:{},removed:{}},i=!1;for(let[t,o]of(0,r.iA)(e))if("put"===o[0]){let e=this.store.get(t);e&&!(0,r.n4)(e,o[1])?(i=!0,n.updated[t]=[e,o[1]]):(i=!0,n.added[t]=o[1])}else if(o[0]===s){let e=this.store.get(t);if(!e)continue;let s=function e(t,n){let i;if(!t||"object"!=typeof t)return t;let o=Array.isArray(t),s=(e,n)=>{i||(i=o?[...t]:{...t}),o?i[Number(e)]=n:i[e]=n};for(let[a,l]of Object.entries(n))switch(l[0]){case"put":{let e=l[1];(0,r.n4)(t[a],e)||s(a,e);break}case c:{let e=l[1],n=l[2],r=t[a];Array.isArray(r)&&Array.isArray(e)&&r.length===n?s(a,[...r,...e]):"string"==typeof r&&"string"==typeof e&&r.length===n&&s(a,r+e);break}case h:if(t[a]&&"object"==typeof t[a]){let n=l[1],r=e(t[a],n);r!==t[a]&&s(a,r)}break;case d:a in t&&(i||(o?(console.error("Can't delete array item yet (this should never happen)"),i=[...t]):i={...t}),delete i[a])}return i??t}(e,o[1]);i=!0,n.updated[t]=[e,s]}else o[0]===a&&this.store.has(t)&&(i=!0,n.removed[t]=this.store.get(t));i&&this.store.applyDiff(n,{runCallbacks:t})}rebase=()=>{if(this.store._flushHistory(),0===this.incomingDiffBuffer.length)return;let e=this.incomingDiffBuffer;this.incomingDiffBuffer=[];try{this.store.mergeRemoteChanges(()=>{for(let t of(this.store.applyDiff((0,o.E8)(this.speculativeChanges),{runCallbacks:!1}),e)){if("patch"===t.type){this.applyNetworkDiff(t.diff,!0);continue}if(0===this.pendingPushRequests.length)throw Error("Received push_result but there are no pending push requests");if(this.pendingPushRequests[0].clientClock!==t.clientClock)throw Error("Received push_result for a push request that is not at the front of the queue");if("discard"===t.action)this.pendingPushRequests.shift();else if("commit"===t.action){let e=this.pendingPushRequests.shift();"diff"in e&&e.diff&&this.applyNetworkDiff(e.diff,!0)}else this.applyNetworkDiff(t.action.rebaseWithDiff,!0),this.pendingPushRequests.shift()}try{this.speculativeChanges=this.store.extractingChanges(()=>{for(let e of this.pendingPushRequests)"diff"in e&&e.diff&&this.applyNetworkDiff(e.diff,!0);if(!this.unsentChanges.nextDiff)return;let e=l(this.unsentChanges.nextDiff);e&&this.applyNetworkDiff(e,!0)})}catch(e){console.error(e),this.speculativeChanges={added:{},updated:{},removed:{}},this.resetConnection()}}),this.lastServerClock=e.at(-1)?.serverClock??this.lastServerClock}catch(e){console.error(e),this.store.ensureStoreIsUsable(),this.resetConnection()}}}function m(e,t,n){return e.addEventListener(t,n),()=>{e.removeEventListener(t,n)}}function y(...e){if("u">typeof window&&window.__tldraw_socket_debug){let t=new Date;console.log(`${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}.${t.getMilliseconds()}`,...e)}}class b{_ws=null;isDisposed=!1;_reconnectManager;close(){this.isDisposed=!0,this._reconnectManager.close(),this._ws?.close()}constructor(e){this._reconnectManager=new x(this,e)}_handleConnect(){y("handleConnect"),this._connectionStatus.set("online"),this.statusListeners.forEach(e=>e({status:"online"})),this._reconnectManager.connected()}_handleDisconnect(e,t,n,i){let o;switch(i=i||"UNKNOWN_ERROR",y("handleDisconnect",{currentStatus:this.connectionStatus,closeCode:t,reason:e}),e){case"closed":o=4099===t?"error":"offline";break;case"manual":o="offline"}1006!==t||n||(0,r.mc)("Could not open WebSocket connection. This might be because you're trying to load a URL that doesn't support websockets. Check the URL you're trying to connect to."),this.connectionStatus!==o&&("error"!==o||"offline"!==this.connectionStatus)&&(this._connectionStatus.set(o),this.statusListeners.forEach(e=>e("error"===o?{status:"error",reason:i}:{status:o}))),this._reconnectManager.disconnected()}_setNewSocket(e){(0,r.vA)(!this.isDisposed,"Tried to set a new websocket on a disposed socket"),(0,r.vA)(null===this._ws||this._ws.readyState===WebSocket.CLOSED||this._ws.readyState===WebSocket.CLOSING,`Tried to set a new websocket in when the existing one was ${this._ws?.readyState}`);let t=!1;e.onopen=()=>{y("ws.onopen"),(0,r.vA)(this._ws===e,"sockets must only be orphaned when they are CLOSING or CLOSED, so they can't open"),t=!0,this._handleConnect()},e.onclose=n=>{y("ws.onclose",n),this._ws===e?this._handleDisconnect("closed",n.code,t,n.reason):y("ignoring onclose for an orphaned socket")},e.onerror=t=>{y("ws.onerror",t),this._ws===e?this._handleDisconnect("closed"):y("ignoring onerror for an orphaned socket")},e.onmessage=t=>{let n;(0,r.vA)(this._ws===e,"sockets must only be orphaned when they are CLOSING or CLOSED, so they can't receive messages");try{n=JSON.parse(t.data.toString())}catch{(0,r.mc)("Received malformed WebSocket message. Restarting the connection."),this.restart();return}this.messageListeners.forEach(e=>e(n))},this._ws=e}_closeSocket(){null!==this._ws&&(this._ws.close(),this._ws=null,this._handleDisconnect("manual"))}_connectionStatus=(0,i.eU)("websocket connection status","initial");get connectionStatus(){let e=this._connectionStatus.get();return"initial"===e?"offline":e}sendMessage(e){if((0,r.vA)(!this.isDisposed,"Tried to send message on a disposed socket"),this._ws)if("online"===this.connectionStatus)for(let t of function(e,t=262144){if(e.length<t)return[e];{let n=[],r=0,i=e.length;for(;i>0;){let o=`${r}_`,s=Math.max(Math.min(t-o.length,i),1);n.unshift(o+e.slice(i-s,i)),i-=s,r++}return n}}(JSON.stringify(e)))this._ws.send(t);else console.warn("Tried to send message while "+this.connectionStatus)}messageListeners=new Set;onReceiveMessage(e){return(0,r.vA)(!this.isDisposed,"Tried to add message listener on a disposed socket"),this.messageListeners.add(e),()=>{this.messageListeners.delete(e)}}statusListeners=new Set;onStatusChange(e){return(0,r.vA)(!this.isDisposed,"Tried to add status listener on a disposed socket"),this.statusListeners.add(e),()=>{this.statusListeners.delete(e)}}restart(){(0,r.vA)(!this.isDisposed,"Tried to restart a disposed socket"),y("restarting"),this._closeSocket(),this._reconnectManager.maybeReconnected()}}class x{constructor(e,t){this.socketAdapter=e,this.getUri=t,this.subscribeToReconnectHints(),this.disposables.push(m(window,"offline",()=>{y("window went offline"),this.socketAdapter._closeSocket()})),this.state="pendingAttempt",this.intendedDelay=500,this.scheduleAttempt()}socketAdapter;getUri;isDisposed=!1;disposables=[()=>{this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.recheckConnectingTimeout&&clearTimeout(this.recheckConnectingTimeout)}];reconnectTimeout=null;recheckConnectingTimeout=null;lastAttemptStart=null;intendedDelay=500;state;subscribeToReconnectHints(){if(this.disposables.push(m(window,"online",()=>{y("window went online"),this.maybeReconnected()}),m(document,"visibilitychange",()=>{document.hidden||(y("document became visible"),this.maybeReconnected())})),Object.prototype.hasOwnProperty.call(navigator,"connection")){let e=navigator.connection;this.disposables.push(m(e,"change",()=>{y("navigator.connection change"),this.maybeReconnected()}))}}scheduleAttempt(){(0,r.vA)("pendingAttempt"===this.state),y("scheduling a connection attempt"),Promise.resolve(this.getUri()).then(e=>{"pendingAttempt"!==this.state||this.isDisposed||((0,r.vA)(this.socketAdapter._ws?.readyState!==WebSocket.OPEN,"There should be no connection attempts while already connected"),this.lastAttemptStart=Date.now(),this.socketAdapter._setNewSocket(new WebSocket(e.replace(/^http(s)?:/,"ws$1:"))),this.state="pendingAttemptResult")})}getMaxDelay(){return document.hidden?3e5:2e3}getMinDelay(){return document.hidden?1e3:500}clearReconnectTimeout(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}clearRecheckConnectingTimeout(){this.recheckConnectingTimeout&&(clearTimeout(this.recheckConnectingTimeout),this.recheckConnectingTimeout=null)}maybeReconnected(){if(y("ReconnectManager.maybeReconnected"),this.clearRecheckConnectingTimeout(),this.socketAdapter._ws?.readyState===WebSocket.OPEN)return void y("ReconnectManager.maybeReconnected: already connected");if(this.socketAdapter._ws?.readyState===WebSocket.CONNECTING){y("ReconnectManager.maybeReconnected: connecting"),(0,r.vA)(this.lastAttemptStart,"ReadyState=CONNECTING without lastAttemptStart should be impossible");let e=Date.now()-this.lastAttemptStart;e<1e3?(y("ReconnectManager.maybeReconnected: connecting, rechecking later"),this.recheckConnectingTimeout=setTimeout(()=>this.maybeReconnected(),1e3-e)):(y("ReconnectManager.maybeReconnected: connecting, but for too long, retry now"),this.clearRecheckConnectingTimeout(),this.socketAdapter._closeSocket());return}y("ReconnectManager.maybeReconnected: closing/closed/null, retry now"),this.intendedDelay=500,this.disconnected()}disconnected(){if(y("ReconnectManager.disconnected"),this.socketAdapter._ws?.readyState!==WebSocket.OPEN&&this.socketAdapter._ws?.readyState!==WebSocket.CONNECTING){let e;y("ReconnectManager.disconnected: websocket is not OPEN or CONNECTING"),this.clearReconnectTimeout(),"connected"===this.state?(this.intendedDelay=this.getMinDelay(),e=this.intendedDelay):e=null!==this.lastAttemptStart?this.lastAttemptStart+this.intendedDelay-Date.now():0,e>0?(y("ReconnectManager.disconnected: delaying, delayLeft",e),this.state="delay",this.reconnectTimeout=setTimeout(()=>this.disconnected(),e)):(this.state="pendingAttempt",this.intendedDelay=Math.min(this.getMaxDelay(),1.5*Math.max(this.getMinDelay(),this.intendedDelay)),y("ReconnectManager.disconnected: attempting a connection, next delay",this.intendedDelay),this.scheduleAttempt())}}connected(){y("ReconnectManager.connected"),this.socketAdapter._ws?.readyState===WebSocket.OPEN&&(y("ReconnectManager.connected: websocket is OPEN"),this.state="connected",this.clearReconnectTimeout(),this.intendedDelay=500)}close(){this.disposables.forEach(e=>e()),this.isDisposed=!0}}var w=n(81467);(0,w.Wt)().serialize(),w.tS.create({id:w.yI}),w.tv.create({id:"page:page",name:"Page 1",index:"a1"});new TextEncoder,new TextDecoder;class v extends Error{constructor(e){super(`sync error: ${e}`),this.reason=e}reason;name="RemoteSyncError"}(0,r.lF)("@tldraw/sync-core","5.3.2","esm");var S=n(12115),C=n(23312);let k="multiplayer.client",P=()=>{};function T(e){let[t,n]=(0,C.oqt)(null),{uri:r,roomId:o="default",assets:s,users:a,onMount:l,connect:d,trackAnalyticsEvent:c,getUserPresence:h,onCustomMessageReceived:u,themes:p,...f}=e,m=(0,C.P1V)(p);(0,C.Mcl)(m),(0,C.AFA)(m);let y=(0,C.K4z)(f),x=(0,C.lIP)(h??C.Cho),w=(0,C._q_)(u??P);return(0,S.useEffect)(()=>{let e,t=(0,C.NF7)(),h=a?{currentUser:a.currentUser,resolve:a.resolve??(0,C.gP_)(e=>{let t=a.currentUser.get();return t&&t.id===(0,C.dBl)(e)?t:null})}:{currentUser:C.iPZ.currentUser,resolve:(0,C.gP_)(e=>{let t=C.iPZ.currentUser.get();if(t&&t.id===(0,C.dBl)(e))return t;let n=T.query.records("instance_presence").get().find(t=>t.userId===(0,C.dBl)(e));return n?C.XAu.create({id:(0,C.dBl)(e),name:n.userName,color:n.color}):null})},u=(0,C.EWP)("currentUser",()=>{let e=h.currentUser.get();if(e)return e;let t=(0,C.oEU)();return C.XAu.create({id:(0,C.dBl)(t.id),name:t.name??"",color:t.color??C.TjI.color})});if(d){if(r)throw Error("uri and connect cannot be used together");e=d({sessionId:C.OsR,storeId:t})}else if(r){if(d)throw Error("uri and connect cannot be used together");e=new b(async()=>{let e=new URL("string"==typeof r?r:await r());if(e.searchParams.has("sessionId"))throw Error('useSync. "sessionId" is a reserved query param name. Please use a different name');if(e.searchParams.has("storeId"))throw Error('useSync. "storeId" is a reserved query param name. Please use a different name');return e.searchParams.set("sessionId",C.OsR),e.searchParams.set("storeId",t),e.toString()})}else throw Error("uri or connect must be provided");let p=!1;function f(){return"error"===e.connectionStatus?"offline":e.connectionStatus}let m=(0,i.eU)("collaboration status",f()),S=e.onStatusChange(()=>{m.set(f())}),P=(0,i.eU)("sync mode","readwrite"),T=(0,C._zD)({id:t,schema:y,assets:s,users:h,onMount:l,collaboration:{status:m,mode:P}}),E=(0,C.S6A)(u,{getUserPresence:x})(T),I=T.query.ids("instance_presence"),_=(0,C.EWP)("presenceMode",()=>0===I.get().size?"solo":"full"),M=new g({store:T,socket:e,didCancel:()=>p,onLoad(e){c?.(k,{name:"load",roomId:o}),n(t=>({...t,readyClient:e}))},onSyncError(t){switch(console.error("sync error",t),t){case"NOT_FOUND":c?.(k,{name:"room-not-found",roomId:o});break;case"FORBIDDEN":c?.(k,{name:"forbidden",roomId:o});break;case"NOT_AUTHENTICATED":c?.(k,{name:"not-authenticated",roomId:o});break;case"RATE_LIMITED":c?.(k,{name:"rate-limited",roomId:o});break;default:c?.(k,{name:"sync-error:"+t,roomId:o})}n({error:new v(t)}),e.close()},onAfterConnect(e,{isReadonly:t,objectAccess:r}){n(e=>({...e,objectAccess:r})),(0,i.hL)(()=>{P.set(t?"readonly":"readwrite"),T.ensureStoreIsUsable()})},onCustomMessageReceived:w,presence:E,presenceMode:_});return()=>{p=!0,S(),M.close(),e.close()}},[s,l,d,a,o,y,n,c,r,x,w]),(0,C.hau)("remote synced store",()=>{if(!t)return{status:"loading"};if(t.error)return{status:"error",error:t.error};if(!t.readyClient)return{status:"loading"};let e=t.readyClient.socket.connectionStatus;return{status:"synced-remote",connectionStatus:"error"===e?"offline":e,store:t.readyClient.store,objectAccess:t.objectAccess??"write"}},[t])}var E=n(41463);function I(e){try{return e()}catch{return}}I(()=>"https://demo.tldraw.xyz"),I(()=>E.env.TLDRAW_IMAGE_URL),(0,r.lF)("@tldraw/sync","5.3.2","esm")},17858:(e,t,n)=>{"use strict";n.d(t,{m:()=>c});var r=n(83102),i=n(81467),o=n(58929),s=n(66122),a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=(e,t,n,r)=>{for(var i,o=r>1?void 0:r?l(t,n):t,s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&a(t,n,o),o};class c{constructor(e){this.editor=e,this.shapeBounds=new o.N(this),this.handles=new s.O(this)}editor;shapeBounds;handles;_snapIndicators=(0,r.eU)("snapLines",void 0);getIndicators(){return this._snapIndicators.get()??r.Ml}clearIndicators(){this.getIndicators().length&&this._snapIndicators.set(void 0)}setIndicators(e){this._snapIndicators.set(e)}getSnapThreshold(){return this.editor.options.snapThreshold/this.editor.getZoomLevel()}getSnappableShapes(){let{editor:e}=this,t=e.getViewportPageBounds(),n=e.getSelectedShapeIds(),r=new Set,o=s=>{if((0,i.vc)(s)){let t=e.getShape(s);t&&e.isShapeFrameLike(t)&&r.add(s)}for(let i of e.getSortedChildIdsForParent(s)){if(n.includes(i))continue;let s=e.getShape(i);if(!s||!e.getShapeUtil(s).canSnap(s))continue;let a=e.getShapePageBounds(i);if(a&&t.includes(a)){if(e.isShapeOfType(s,"group")){o(i);continue}r.add(i)}}};return o(this.getCurrentCommonAncestor()??e.getCurrentPageId()),r}getCurrentCommonAncestor(){return this.editor.findCommonAncestor(this.editor.getSelectedShapes())}}d([r.EW],c.prototype,"getSnapThreshold",1),d([r.EW],c.prototype,"getSnappableShapes",1),d([r.EW],c.prototype,"getCurrentCommonAncestor",1)},18314:(e,t,n)=>{"use strict";n.d(t,{_:()=>s,l:()=>a});var r=n(27394),i=n(24167),o=n(12115);function s(e){let t=(0,o.useRef)(void 0);return(0,o.useLayoutEffect)(()=>{t.current=e}),(0,o.useDebugValue)(e),(0,o.useCallback)((...e)=>{let n=t.current;return(0,i.vA)(n,"fn does not exist"),n(...e)},[])}function a(e){let t=(0,r.fp)("useReactiveEvent",()=>e);return(0,o.useLayoutEffect)(()=>{t.set(e)}),(0,o.useDebugValue)(e),(0,o.useCallback)((...e)=>{let n=t.get();return(0,i.vA)(n,"fn does not exist"),n(...e)},[t])}},19040:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(12115),i=n(47650),o=n(55897),s=n(66294),a=n(95155),l=Object.defineProperty,d=r.forwardRef(l(function(e,t){let{container:n,...l}=e,[d,c]=r.useState(!1);(0,s.N)(()=>c(!0),[]);let h=n||d&&globalThis?.document?.body;return h?i.createPortal((0,a.jsx)(o.sG.div,{...l,ref:t}),h):null},"name",{value:"Portal",configurable:!0}))},19065:(e,t,n)=>{"use strict";n.d(t,{XN:()=>h,q1:()=>l});var r=n(24167),i=n(13982),o=n(65009),s=n(11421),a=n(16038);async function l(e,t){let{type:n,width:i,height:l,quality:h=1,pixelRatio:u=2,trimPadding:p=0,scale:f=1}=t;if(i<=0||l<=0)return null;let[g,m]=(0,o.A)(i*u,l*u);g=Math.floor(g),m=Math.floor(m);let y=g/i,b=await d(e,g,m);if(!b)return null;let x=p>0?function(e,t){let n=e.width,r=e.height,i=c(e,t);if(!i)return{canvas:e,width:n,height:r};let{cropLeft:o,cropTop:s,cropRight:l,cropBottom:d}=i,h=l-o,u=d-s,p=(0,a.jL)().createElement("canvas");return p.width=h,p.height=u,p.getContext("2d").drawImage(e,o,s,h,u,0,0,h,u),{canvas:p,width:h,height:u}}(b,p*f*y):{canvas:b,width:g,height:m},w=await new Promise(e=>x.canvas.toBlob(t=>{(!t||s.bG.throwToBlob.get())&&e(null),e(t)},"image/"+n,h));return w?{blob:"png"===n?r.ZA.setPhysChunk(new DataView(await w.arrayBuffer()),y,{type:"image/"+n}):w,width:x.width/y,height:x.height/y}:null}async function d(e,t,n){let o=await r.Sm.blobToDataUrl(new Blob([e],{type:"image/svg+xml"}));return new Promise(e=>{let s=(0,r._V)();s.crossOrigin="anonymous",s.onload=async()=>{i.Y.isSafari&&await (0,r.yy)(250);let o=(0,a.jL)().createElement("canvas"),l=o.getContext("2d");o.width=t,o.height=n,l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,t,n),e(o)},s.onerror=()=>{e(null)},s.src=o})}function c(e,t){let n=e.width,r=e.height,i=e.getContext("2d"),o=Math.ceil(t);if(o<=0||2*o>=n||2*o>=r)return null;let s=i.getImageData(0,0,n,r).data,a=s[0],l=s[1],d=s[2],c=s[3],h=0===c;function u(e){if(h)return s[e+3]>0;{if(s[e+3]!==c)return!0;let t=s[e],n=s[e+1],r=s[e+2];return t!==a||n!==l||r!==d}}let p=n-o,f=r-o,g=o;for(let e=0;e<o;e++){let t=!1;for(let r=0;r<n;r++)if(u((e*n+r)*4)){t=!0;break}if(t){g=e;break}}let m=f;for(let e=r-1;e>=f;e--){let t=!1;for(let r=0;r<n;r++)if(u((e*n+r)*4)){t=!0;break}if(t){m=e+1;break}}let y=o;for(let e=0;e<o;e++){let t=!1;for(let r=g;r<m;r++)if(u((r*n+e)*4)){t=!0;break}if(t){y=e;break}}let b=p;for(let e=n-1;e>=p;e--){let t=!1;for(let r=g;r<m;r++)if(u((r*n+e)*4)){t=!0;break}if(t){b=e+1;break}}return 0===y&&0===g&&b===n&&m===r?null:{cropLeft:y,cropTop:g,cropRight:b,cropBottom:m}}async function h(e,t){let{width:n,height:r,trimPadding:i,scale:o}=t;if(i<=0)return null;let s=Math.floor(n),a=Math.floor(r);if(s<=0||a<=0)return null;let l=await d(e,s,a);if(!l)return null;let h=c(l,i*o);if(!h)return null;let{cropLeft:u,cropTop:p,cropRight:f,cropBottom:g}=h,m=new DOMParser().parseFromString(e,"image/svg+xml").documentElement,y=m.getAttribute("viewBox");if(!y)return null;let[b,x,w,v]=y.split(/\s+/).map(Number),S=b+u/s*w,C=x+p/a*v,k=(f-u)/s*w,P=(g-p)/a*v,T=k*o,E=P*o;return m.setAttribute("viewBox",`${S} ${C} ${k} ${P}`),m.setAttribute("width",String(T)),m.setAttribute("height",String(E)),{svg:new XMLSerializer().serializeToString(m),width:T,height:E}}},19416:(e,t,n)=>{"use strict";n.d(t,{bL:()=>S,e0:()=>m,lg:()=>C,qW:()=>f});var r,i=n(12115),o=n(70379),s=n(55897),a=n(47527),l=n(17347),d=n(95155),c=Object.defineProperty,h=(e,t)=>c(e,"name",{value:t,configurable:!0}),u="dismissableLayer.update",p=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),f=i.forwardRef(h(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:m,onInteractOutside:y,onDismiss:v,...S}=e,C=i.useContext(p),[k,P]=i.useState(null),T=k?.ownerDocument??globalThis?.document,[,E]=i.useState({}),I=(0,a.s)(t,P),_=Array.from(C.layers),[M]=[...C.layersWithOutsidePointerEventsDisabled].slice(-1),A=M?_.indexOf(M):-1,j=k?_.indexOf(k):-1,O=C.layersWithOutsidePointerEventsDisabled.size>0,D=j>=A,L=i.useRef(!1),R=b(e=>{g?.(e),y?.(e),e.defaultPrevented||v?.()},{ownerDocument:T,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:C.dismissableSurfaces,shouldHandlePointerDownOutside:i.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...C.branches].some(t=>t.contains(e));return D&&!t},[C.branches,D])}),F=x(e=>{if(c&&L.current)return;let t=e.target;![...C.branches].some(e=>e.contains(t))&&(m?.(e),y?.(e),e.defaultPrevented||v?.())},T),z=!!k&&j===_.length-1,N=(0,l.c)(e=>{"Escape"===e.key&&(f?.(e),!e.defaultPrevented&&v&&(e.preventDefault(),v()))});return i.useEffect(()=>{if(z)return T.addEventListener("keydown",N,{capture:!0}),()=>T.removeEventListener("keydown",N,{capture:!0})},[T,z,N]),i.useEffect(()=>{if(k)return n&&(0===C.layersWithOutsidePointerEventsDisabled.size&&(r=T.body.style.pointerEvents,T.body.style.pointerEvents="none"),C.layersWithOutsidePointerEventsDisabled.add(k)),C.layers.add(k),w(),()=>{n&&(C.layersWithOutsidePointerEventsDisabled.delete(k),0===C.layersWithOutsidePointerEventsDisabled.size&&(T.body.style.pointerEvents=r))}},[k,T,n,C]),i.useEffect(()=>()=>{k&&(C.layers.delete(k),C.layersWithOutsidePointerEventsDisabled.delete(k),w())},[k,C]),i.useEffect(()=>{let e=h(()=>E({}),"handleUpdate");return document.addEventListener(u,e),()=>document.removeEventListener(u,e)},[]),(0,d.jsx)(s.sG.div,{...S,ref:I,style:{pointerEvents:O?D?"auto":"none":void 0,...e.style},onFocusCapture:(0,o.mK)(e.onFocusCapture,F.onFocusCapture),onBlurCapture:(0,o.mK)(e.onBlurCapture,F.onBlurCapture),onPointerDownCapture:(0,o.mK)(e.onPointerDownCapture,R.onPointerDownCapture)})},"DismissableLayer")),g=i.forwardRef(h(function(e,t){let n=i.useContext(p),r=i.useRef(null),o=(0,a.s)(t,r);return i.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,d.jsx)(s.sG.div,{...e,ref:o})},"DismissableLayerBranch"));function m(){let e=i.useContext(p),[t,n]=i.useState(null);return i.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}h(m,"useDismissableLayerSurface");var y=h(()=>!0,"IS_TRUE");function b(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=y}=t,d=(0,l.c)(e),c=i.useRef(!1),u=i.useRef(!1),p=i.useRef(new Map),f=i.useRef(()=>{});return i.useEffect(()=>{function e(){u.current=!1,o.current=!1,p.current.clear()}function t(){return Array.from(p.current.values()).some(Boolean)}function i(e){if(!u.current)return;let t=e.target;t instanceof Node&&[...s].some(e=>e.contains(t))||p.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{u.current&&f.current()},0)}function l(e){u.current&&p.current.set(e.type,!1)}h(e,"resetOutsideInteraction"),h(t,"isOutsideInteractionIntercepted"),h(i,"handleInteractionCapture"),h(l,"handleInteractionBubble");let g=h(i=>{if(i.target&&!c.current){let s=function(){n.removeEventListener("click",f.current);let r=t();e(),r||v("dismissableLayer.pointerDownOutside",d,l,{discrete:!0})};if(h(s,"handleAndDispatchPointerDownOutsideEvent"),!a(i.target)){n.removeEventListener("click",f.current),e(),c.current=!1;return}let l={originalEvent:i};u.current=!0,o.current=r&&0===i.button,p.current.clear(),r&&0===i.button?(n.removeEventListener("click",f.current),f.current=s,n.addEventListener("click",f.current,{once:!0})):s()}else n.removeEventListener("click",f.current),e();c.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)n.addEventListener(e,i,!0),n.addEventListener(e,l);let y=window.setTimeout(()=>{n.addEventListener("pointerdown",g)},0);return()=>{for(let e of(window.clearTimeout(y),n.removeEventListener("pointerdown",g),n.removeEventListener("click",f.current),m))n.removeEventListener(e,i,!0),n.removeEventListener(e,l)}},[n,d,r,o,s,a]),{onPointerDownCapture:h(()=>c.current=!0,"onPointerDownCapture")}}function x(e,t=globalThis?.document){let n=(0,l.c)(e),r=i.useRef(!1);return i.useEffect(()=>{let e=h(e=>{e.target&&!r.current&&v("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:h(()=>r.current=!0,"onFocusCapture"),onBlurCapture:h(()=>r.current=!1,"onBlurCapture")}}function w(){let e=new CustomEvent(u);document.dispatchEvent(e)}function v(e,t,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?(0,s.hO)(i,o):i.dispatchEvent(o)}h(b,"usePointerDownOutside"),h(x,"useFocusOutside"),h(w,"dispatchUpdate"),h(v,"handleAndDispatchCustomEvent");var S=f,C=g},19743:(e,t,n)=>{"use strict";n.d(t,{F:()=>o,S:()=>i});var r=n(81467);let i={id:"default",fontSize:16,lineHeight:1.35,strokeWidth:2,fonts:{draw:{fontFamily:r.xX.draw,faces:[{family:"tldraw_draw",src:{url:"tldraw_draw",format:"woff2"},weight:"normal"},{family:"tldraw_draw",src:{url:"tldraw_draw_bold",format:"woff2"},weight:"bold"},{family:"tldraw_draw",src:{url:"tldraw_draw_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_draw",src:{url:"tldraw_draw_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]},sans:{fontFamily:r.xX.sans,faces:[{family:"tldraw_sans",src:{url:"tldraw_sans",format:"woff2"},weight:"normal",style:"normal"},{family:"tldraw_sans",src:{url:"tldraw_sans_bold",format:"woff2"},weight:"bold",style:"normal"},{family:"tldraw_sans",src:{url:"tldraw_sans_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_sans",src:{url:"tldraw_sans_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]},serif:{fontFamily:r.xX.serif,faces:[{family:"tldraw_serif",src:{url:"tldraw_serif",format:"woff2"},weight:"normal",style:"normal"},{family:"tldraw_serif",src:{url:"tldraw_serif_bold",format:"woff2"},weight:"bold",style:"normal"},{family:"tldraw_serif",src:{url:"tldraw_serif_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_serif",src:{url:"tldraw_serif_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]},mono:{fontFamily:r.xX.mono,faces:[{family:"tldraw_mono",src:{url:"tldraw_mono",format:"woff2"},weight:"normal",style:"normal"},{family:"tldraw_mono",src:{url:"tldraw_mono_bold",format:"woff2"},weight:"bold",style:"normal"},{family:"tldraw_mono",src:{url:"tldraw_mono_italic",format:"woff2"},weight:"normal",style:"italic"},{family:"tldraw_mono",src:{url:"tldraw_mono_italic_bold",format:"woff2"},weight:"bold",style:"italic"}]}},colors:{light:{text:"#000000",background:"#f9fafb",negativeSpace:"#f9fafb",solid:"#fcfffe",cursor:"black",noteBorder:"rgb(144, 144, 144)",snap:"hsl(0, 76%, 60%)",selectionStroke:"hsl(214, 84%, 56%)",selectionFill:"hsl(210, 100%, 56%, 24%)",brushFill:"hsl(0, 0%, 56%, 10.2%)",brushStroke:"hsl(0, 0%, 56%, 25.1%)",selectedContrast:"#ffffff",laser:"hsl(0, 100%, 50%)",black:{solid:"#1d1d1d",fill:"#1d1d1d",linedFill:"#363636",frameHeadingStroke:"#717171",frameHeadingFill:"#ffffff",frameStroke:"#717171",frameFill:"#ffffff",frameText:"#000000",noteFill:"#FCE19C",noteText:"#000000",semi:"#e8e8e8",pattern:"#494949",highlightSrgb:"#fddd00",highlightP3:"color(display-p3 0.972 0.8205 0.05)"},blue:{solid:"#4465e9",fill:"#4465e9",linedFill:"#6580ec",frameHeadingStroke:"#6681ec",frameHeadingFill:"#f9fafe",frameStroke:"#6681ec",frameFill:"#f9fafe",frameText:"#000000",noteFill:"#8AA3FF",noteText:"#000000",semi:"#dce1f8",pattern:"#6681ee",highlightSrgb:"#10acff",highlightP3:"color(display-p3 0.308 0.6632 0.9996)"},green:{solid:"#099268",fill:"#099268",linedFill:"#0bad7c",frameHeadingStroke:"#37a684",frameHeadingFill:"#f8fcfa",frameStroke:"#37a684",frameFill:"#f8fcfa",frameText:"#000000",noteFill:"#6FC896",noteText:"#000000",semi:"#d3e9e3",pattern:"#39a785",highlightSrgb:"#00ffc8",highlightP3:"color(display-p3 0.2536 0.984 0.7981)"},grey:{solid:"#9fa8b2",fill:"#9fa8b2",linedFill:"#bbc1c9",frameHeadingStroke:"#aaaaab",frameHeadingFill:"#fbfcfc",frameStroke:"#aaaaab",frameFill:"#fcfcfd",frameText:"#000000",noteFill:"#C0CAD3",noteText:"#000000",semi:"#eceef0",pattern:"#bcc3c9",highlightSrgb:"#cbe7f1",highlightP3:"color(display-p3 0.8163 0.9023 0.9416)"},"light-blue":{solid:"#4ba1f1",fill:"#4ba1f1",linedFill:"#7abaf5",frameHeadingStroke:"#6cb2f3",frameHeadingFill:"#f8fbfe",frameStroke:"#6cb2f3",frameFill:"#fafcff",frameText:"#000000",noteFill:"#9BC4FD",noteText:"#000000",semi:"#ddedfa",pattern:"#6fbbf8",highlightSrgb:"#00f4ff",highlightP3:"color(display-p3 0.1512 0.9414 0.9996)"},"light-green":{solid:"#4cb05e",fill:"#4cb05e",linedFill:"#7ec88c",frameHeadingStroke:"#6dbe7c",frameHeadingFill:"#f8fcf9",frameStroke:"#6dbe7c",frameFill:"#fafdfa",frameText:"#000000",noteFill:"#98D08A",noteText:"#000000",semi:"#dbf0e0",pattern:"#65cb78",highlightSrgb:"#65f641",highlightP3:"color(display-p3 0.563 0.9495 0.3857)"},"light-red":{solid:"#f87777",fill:"#f87777",linedFill:"#f99a9a",frameHeadingStroke:"#f89090",frameHeadingFill:"#fffafa",frameStroke:"#f89090",frameFill:"#fffbfb",frameText:"#000000",noteFill:"#F7A5A1",noteText:"#000000",semi:"#f4dadb",pattern:"#fe9e9e",highlightSrgb:"#ff7fa3",highlightP3:"color(display-p3 0.9988 0.5301 0.6397)"},"light-violet":{solid:"#e085f4",fill:"#e085f4",linedFill:"#e9abf7",frameHeadingStroke:"#e59bf5",frameHeadingFill:"#fefaff",frameStroke:"#e59bf5",frameFill:"#fefbff",frameText:"#000000",noteFill:"#DFB0F9",noteText:"#000000",semi:"#f5eafa",pattern:"#e9acf8",highlightSrgb:"#ff88ff",highlightP3:"color(display-p3 0.9676 0.5652 0.9999)"},orange:{solid:"#e16919",fill:"#e16919",linedFill:"#ea8643",frameHeadingStroke:"#e68544",frameHeadingFill:"#fef9f6",frameStroke:"#e68544",frameFill:"#fef9f6",frameText:"#000000",noteFill:"#FAA475",noteText:"#000000",semi:"#f8e2d4",pattern:"#f78438",highlightSrgb:"#ffa500",highlightP3:"color(display-p3 0.9988 0.6905 0.266)"},red:{solid:"#e03131",fill:"#e03131",linedFill:"#e75f5f",frameHeadingStroke:"#e55757",frameHeadingFill:"#fef7f7",frameStroke:"#e55757",frameFill:"#fef9f9",frameText:"#000000",noteFill:"#FC8282",noteText:"#000000",semi:"#f4dadb",pattern:"#e55959",highlightSrgb:"#ff636e",highlightP3:"color(display-p3 0.9992 0.4376 0.45)"},violet:{solid:"#ae3ec9",fill:"#ae3ec9",linedFill:"#be68d4",frameHeadingStroke:"#bc62d3",frameHeadingFill:"#fcf7fd",frameStroke:"#bc62d3",frameFill:"#fdf9fd",frameText:"#000000",noteFill:"#DB91FD",noteText:"#000000",semi:"#ecdcf2",pattern:"#bd63d3",highlightSrgb:"#c77cff",highlightP3:"color(display-p3 0.7469 0.5089 0.9995)"},yellow:{solid:"#f1ac4b",fill:"#f1ac4b",linedFill:"#f5c27a",frameHeadingStroke:"#f3bb6c",frameHeadingFill:"#fefcf8",frameStroke:"#f3bb6c",frameFill:"#fffdfa",frameText:"#000000",noteFill:"#FED49A",noteText:"#000000",semi:"#f9f0e6",pattern:"#fecb92",highlightSrgb:"#fddd00",highlightP3:"color(display-p3 0.972 0.8705 0.05)"},white:{solid:"#FFFFFF",fill:"#FFFFFF",linedFill:"#ffffff",semi:"#f5f5f5",pattern:"#f9f9f9",frameHeadingStroke:"#7d7d7d",frameHeadingFill:"#ffffff",frameStroke:"#7d7d7d",frameFill:"#ffffff",frameText:"#000000",noteFill:"#FFFFFF",noteText:"#000000",highlightSrgb:"#ffffff",highlightP3:"color(display-p3 1 1 1)"}},dark:{text:"hsl(210, 17%, 98%)",background:"hsl(240, 5%, 6.5%)",negativeSpace:"hsl(240, 5%, 6.5%)",solid:"#010403",cursor:"white",snap:"hsl(0, 76%, 60%)",selectionStroke:"hsl(214, 84%, 56%)",selectionFill:"hsl(209, 100%, 57%, 20%)",brushFill:"hsl(0, 0%, 56%, 10.2%)",brushStroke:"hsl(0, 0%, 56%, 25.1%)",selectedContrast:"#ffffff",laser:"hsl(0, 100%, 50%)",noteBorder:"rgb(20, 20, 20)",black:{solid:"#f2f2f2",fill:"#f2f2f2",linedFill:"#ffffff",frameHeadingStroke:"#5c5c5c",frameHeadingFill:"#252525",frameStroke:"#5c5c5c",frameFill:"#0c0c0c",frameText:"#f2f2f2",noteFill:"#2c2c2c",noteText:"#f2f2f2",semi:"#2c3036",pattern:"#989898",highlightSrgb:"#d2b700",highlightP3:"color(display-p3 0.8078 0.6225 0.0312)"},blue:{solid:"#4f72fc",fill:"#4f72fc",linedFill:"#3c5cdd",frameHeadingStroke:"#384994",frameHeadingFill:"#1C2036",frameStroke:"#384994",frameFill:"#11141f",frameText:"#f2f2f2",noteFill:"#2A3F98",noteText:"#f2f2f2",semi:"#262d40",pattern:"#3a4b9e",highlightSrgb:"#0079d2",highlightP3:"color(display-p3 0.0032 0.4655 0.7991)"},green:{solid:"#099268",fill:"#099268",linedFill:"#087856",frameHeadingStroke:"#10513C",frameHeadingFill:"#14241f",frameStroke:"#10513C",frameFill:"#0E1614",frameText:"#f2f2f2",noteFill:"#014429",noteText:"#f2f2f2",semi:"#253231",pattern:"#366a53",highlightSrgb:"#009774",highlightP3:"color(display-p3 0.0085 0.582 0.4604)"},grey:{solid:"#9398b0",fill:"#9398b0",linedFill:"#8388a5",frameHeadingStroke:"#42474D",frameHeadingFill:"#23262A",frameStroke:"#42474D",frameFill:"#151719",frameText:"#f2f2f2",noteFill:"#56595F",noteText:"#f2f2f2",semi:"#33373c",pattern:"#7c8187",highlightSrgb:"#9cb4cb",highlightP3:"color(display-p3 0.6299 0.7012 0.7856)"},"light-blue":{solid:"#4dabf7",fill:"#4dabf7",linedFill:"#2793ec",frameHeadingStroke:"#075797",frameHeadingFill:"#142839",frameStroke:"#075797",frameFill:"#0B1823",frameText:"#f2f2f2",noteFill:"#1F5495",noteText:"#f2f2f2",semi:"#2a3642",pattern:"#4d7aa9",highlightSrgb:"#00bdc8",highlightP3:"color(display-p3 0.0023 0.7259 0.7735)"},"light-green":{solid:"#40c057",fill:"#40c057",linedFill:"#37a44b",frameHeadingStroke:"#1C5427",frameHeadingFill:"#18251A",frameStroke:"#1C5427",frameFill:"#0F1911",frameText:"#f2f2f2",noteFill:"#21581D",noteText:"#f2f2f2",semi:"#2a3830",pattern:"#4e874e",highlightSrgb:"#00a000",highlightP3:"color(display-p3 0.2711 0.6172 0.0195)"},"light-red":{solid:"#ff8787",fill:"#ff8787",linedFill:"#ff6666",frameHeadingStroke:"#6f3232",frameHeadingFill:"#341818",frameStroke:"#6f3232",frameFill:"#181212",frameText:"#f2f2f2",noteFill:"#7a3333",noteText:"#f2f2f2",semi:"#3c2b2b",pattern:"#a56767",highlightSrgb:"#db005b",highlightP3:"color(display-p3 0.7849 0.0585 0.3589)"},"light-violet":{solid:"#e599f7",fill:"#e599f7",linedFill:"#dc71f4",frameHeadingStroke:"#6c367a",frameHeadingFill:"#2D2230",frameStroke:"#6c367a",frameFill:"#1C151E",frameText:"#f2f2f2",noteFill:"#762F8E",noteText:"#f2f2f2",semi:"#383442",pattern:"#9770a9",highlightSrgb:"#c400c7",highlightP3:"color(display-p3 0.7024 0.0403 0.753)"},orange:{solid:"#f76707",fill:"#f76707",linedFill:"#f54900",frameHeadingStroke:"#773a0e",frameHeadingFill:"#2f1d13",frameStroke:"#773a0e",frameFill:"#1c1512",frameText:"#f2f2f2",noteFill:"#7c3905",noteText:"#f2f2f2",semi:"#3b2e27",pattern:"#9f552d",highlightSrgb:"#d07a00",highlightP3:"color(display-p3 0.7699 0.4937 0.0085)"},red:{solid:"#e03131",fill:"#e03131",linedFill:"#c31d1d",frameHeadingStroke:"#701e1e",frameHeadingFill:"#301616",frameStroke:"#701e1e",frameFill:"#1b1313",frameText:"#f2f2f2",noteFill:"#7e201f",noteText:"#f2f2f2",semi:"#382726",pattern:"#8f3734",highlightSrgb:"#de002c",highlightP3:"color(display-p3 0.7978 0.0509 0.2035)"},violet:{solid:"#ae3ec9",fill:"#ae3ec9",linedFill:"#8f2fa7",frameHeadingStroke:"#6d1583",frameHeadingFill:"#27152e",frameStroke:"#6d1583",frameFill:"#1b0f21",frameText:"#f2f2f2",noteFill:"#5f1c70",noteText:"#f2f2f2",semi:"#342938",pattern:"#763a8b",highlightSrgb:"#9e00ee",highlightP3:"color(display-p3 0.5651 0.0079 0.8986)"},yellow:{solid:"#ffc034",fill:"#ffc034",linedFill:"#ffae00",frameHeadingStroke:"#684e12",frameHeadingFill:"#2a2113",frameStroke:"#684e12",frameFill:"#1e1911",frameText:"#f2f2f2",noteFill:"#8a5e1c",noteText:"#f2f2f2",semi:"#3b352b",pattern:"#fecb92",highlightSrgb:"#d2b700",highlightP3:"color(display-p3 0.8078 0.7225 0.0312)"},white:{solid:"#f3f3f3",fill:"#f3f3f3",linedFill:"#f3f3f3",semi:"#f5f5f5",pattern:"#f9f9f9",frameHeadingStroke:"#ffffff",frameHeadingFill:"#ffffff",frameStroke:"#ffffff",frameFill:"#ffffff",frameText:"#000000",noteFill:"#eaeaea",noteText:"#1d1d1d",highlightSrgb:"#ffffff",highlightP3:"color(display-p3 1 1 1)"}}}};function o(e,t,n){let r=e[t];return r&&"string"!=typeof r?r[n]:t}},20026:(e,t,n)=>{"use strict";n.d(t,{_:()=>d,f:()=>l});var r=n(81467),i=n(24167),o=n(54939),s=n(93286),a=n(46195);function l({editor:e,ids:t}){let n=(0,i.oE)(t.map(t=>e.getShape(t))),r=e.getShapesSharedRotation(t),o=e.getShapesRotatedPageBounds(t);if(!o)return null;let s=o.center.clone().rotWith(o.point,r);return{initialPageCenter:s,initialCursorAngle:s.angle(e.inputs.getOriginPagePoint()),initialShapesRotation:r,shapeSnapshots:n.map(t=>({shape:t,initialPagePoint:e.getShapePageTransform(t.id).point()}))}}function d({delta:e,editor:t,snapshot:n,stage:i,centerOverride:l}){let{initialPageCenter:c,shapeSnapshots:h}=n;t.updateShapes(h.map(({shape:n,initialPagePoint:i})=>{let d=(0,r.vc)(n.parentId)?t.getShapePageTransform(n.parentId):o.V.Identity(),h=a.l.RotWith(i,l??c,e),u=o.V.applyToPoint(o.V.Inverse(d),h),p=(0,s.rg)(n.rotation+e);return{id:n.id,type:n.type,x:u.x,y:u.y,rotation:p}}));let u=[];h.forEach(({shape:e})=>{let n=t.getShape(e.id);if(!n)return;let r=t.getShapeUtil(e);if("start"===i||"one-off"===i){let t=r.onRotateStart?.(e);t&&u.push(t)}let o=r.onRotate?.(e,n);if(o&&u.push(o),"end"===i||"one-off"===i){let t=r.onRotateEnd?.(e,n);t&&u.push(t)}}),u.length>0&&t.updateShapes(u)}},20172:(e,t,n)=>{"use strict";n.d(t,{U:()=>o});var r=n(95155),i=n(69730);function o({children:e,className:t="",...n}){return(0,r.jsx)("svg",{...n,className:i("tl-svg-container",t),"aria-hidden":"true",children:e})}},22036:(e,t,n)=>{"use strict";n.d(t,{Gq:()=>m,u0:()=>y,yp:()=>f});var r=n(95155),i=n(83102),o=n(27394);n(24167);var s=n(12115),a=n(67877),l=n(67863),d=n(26065),c=n(54939),h=n(28879),u=n(16038),p=n(1015);let f=(0,s.memo)(function({id:e,shape:t,util:n,index:h,backgroundIndex:f,opacity:b}){let x=(0,l.hG)(),{ShapeErrorFallback:w,ShapeWrapper:v}=(0,a.B)(),S=(0,s.useRef)(null),C=(0,s.useRef)(null);(0,s.useEffect)(()=>(0,i.wv)("load fonts",()=>{let t=x.fonts.getShapeFontFaces(e);x.fonts.requestFonts(t)}),[x,e]);let k=(0,s.useRef)({transform:"",clipPath:"none",width:0,height:0,x:0,y:0});(0,o.lX)("set shape stuff",()=>{let t=x.getShape(e);if(!t)return;let n=k.current,r=x.getShapeClipPath(e)??"none";r!==n.clipPath&&((0,u.$h)(S.current,"clip-path",r),(0,u.$h)(C.current,"clip-path",r),n.clipPath=r);let i=x.getShapePageTransform(e),o=c.V.toCssString(i),s=x.getShapeGeometry(t).bounds;o!==n.transform&&((0,u.$h)(S.current,"transform",o),(0,u.$h)(C.current,"transform",o),n.transform=o);let a=Math.max(s.width,1),l=Math.max(s.height,1);(a!==n.width||l!==n.height)&&((0,u.$h)(S.current,"width",a+"px"),(0,u.$h)(S.current,"height",l+"px"),(0,u.$h)(C.current,"width",a+"px"),(0,u.$h)(C.current,"height",l+"px"),n.width=a,n.height=l)},[x]),(0,s.useLayoutEffect)(()=>{let e=S.current,t=C.current;(0,u.$h)(e,"opacity",b),(0,u.$h)(t,"opacity",b),(0,u.$h)(e,"z-index",h),(0,u.$h)(t,"z-index",f)},[b,h,f]);let{register:P,unregister:T}=(0,d.R)();(0,s.useLayoutEffect)(()=>{let t=S.current;if(!t)return;let n=x.getCulledShapes().has(e);return P(e,t,C.current,n),()=>{T(e)}},[x,e,P,T]);let E=(0,s.useCallback)(e=>x.annotateError(e,{origin:"shape",willCrashApp:!1}),[x]);return t&&v?(0,r.jsxs)(r.Fragment,{children:[n.backgroundComponent&&(0,r.jsx)(v,{ref:C,shape:t,isBackground:!0,children:(0,r.jsx)(p.p,{fallback:w,onError:E,children:(0,r.jsx)(y,{shape:t,util:n})})}),(0,r.jsxs)(v,{ref:S,shape:t,isBackground:!1,children:[(0,r.jsx)(p.p,{fallback:w,onError:E,children:(0,r.jsx)(m,{shape:t,util:n})}),n.getAppOwnedElement&&(0,r.jsx)(g,{id:e,util:n})]})]}):null}),g=(0,s.memo)(function({id:e,util:t}){let n=(0,l.hG)(),i=(0,s.useRef)(null);return(0,s.useLayoutEffect)(()=>{let r=i.current;if(!r)return;let o=n.getShape(e);if(!o)return;let s=t.getAppOwnedElement?.(o);if(s)return s.isConnected,s.parentNode!==r&&(0,u.MM)(r,s),()=>{let r=n.getShape(e)??o;t.onReleaseAppOwnedElement?.(r,s)}},[n,e,t]),(0,r.jsx)("div",{ref:i,className:"tl-content-slot",draggable:!1})}),m=(0,s.memo)(function({shape:e,util:t}){return(0,o.A1)("InnerShape:"+e.type,()=>t.component(t.editor.store.unsafeGetWithoutCapture(e.id)),[t,e.id])},(e,t)=>(0,h.E)(e.shape,t.shape)&&e.util===t.util),y=(0,s.memo)(function({shape:e,util:t}){return(0,o.A1)("InnerShape:"+e.type,()=>t.backgroundComponent?.(t.editor.store.unsafeGetWithoutCapture(e.id)),[t,e.id])},(e,t)=>e.shape.props===t.shape.props&&e.shape.meta===t.shape.meta&&e.util===t.util)},22690:(e,t,n)=>{"use strict";n.d(t,{T:()=>r});var r={};n.r(r),n.d(r,{ArrayOfValidator:()=>d,DictValidator:()=>u,ObjectValidator:()=>c,UnionValidator:()=>h,ValidationError:()=>o,Validator:()=>l,any:()=>g,array:()=>I,arrayOf:()=>_,bigint:()=>T,boolean:()=>P,dict:()=>L,httpUrl:()=>G,indexKey:()=>q,integer:()=>S,jsonDict:()=>D,jsonValue:()=>O,linkUrl:()=>W,literal:()=>E,literalEnum:()=>H,model:()=>z,nonZeroFiniteNumber:()=>w,nonZeroInteger:()=>k,nonZeroNumber:()=>x,nullable:()=>B,number:()=>y,numberUnion:()=>F,object:()=>A,optional:()=>$,or:()=>X,positiveInteger:()=>C,positiveNumber:()=>b,setEnum:()=>N,srcUrl:()=>Y,string:()=>m,union:()=>R,unitInterval:()=>v,unknown:()=>f,unknownObject:()=>M});var i=n(24167);class o extends Error{constructor(e,t=[]){const n=function(e){if(!e.length)return null;let t="";for(let n of e)"number"==typeof n?t+=`.${n}`:n.startsWith("(")?t.endsWith(")")?t=`${t.slice(0,-1)}, ${n.slice(1)}`:t+=n:t+=`.${n}`;return(t=t.replace(/id = [^,]+, /,"").replace(/id = [^)]+/,"")).startsWith(".")?t.slice(1):t}(t),r=e.split("\n").map((e,t)=>0===t?e:` ${e}`).join("\n");super(n?`At ${n}: ${r}`:r),this.rawMessage=e,this.path=t}rawMessage;path;name="ValidationError"}function s(e,t){if(t instanceof o)throw new o(t.rawMessage,[e,...t.path]);throw new o(t.toString(),[e])}function a(e){if(null===e)return"null";if(Array.isArray(e))return"an array";let t=typeof e;switch(t){case"bigint":case"boolean":case"function":case"number":case"string":case"symbol":return`a ${t}`;case"object":return`an ${t}`;case"undefined":return"undefined";default:(0,i.h6)(t)}}class l{constructor(e,t,n=!1){this.validationFn=e,this.validateUsingKnownGoodVersionFn=t,this.skipSameValueCheck=n}validationFn;validateUsingKnownGoodVersionFn;skipSameValueCheck;validate(e){let t=this.validationFn(e);return t}validateUsingKnownGoodVersion(e,t){return Object.is(e,t)?e:this.validateUsingKnownGoodVersionFn?this.validateUsingKnownGoodVersionFn(e,t):this.validate(t)}isValid(e){try{return this.validate(e),!0}catch{return!1}}nullable(){return B(this)}optional(){return $(this)}refine(e){return new l(t=>e(this.validate(t)),(t,n)=>{let r=this.validateUsingKnownGoodVersion(t,n);return Object.is(t,r)?t:e(r)},!0)}check(e,t){return"string"==typeof e?this.refine(n=>{try{t(n)}catch(t){s(`(check ${e})`,t)}return n}):this.refine(t=>(e(t),t))}}class d extends l{constructor(e){super(t=>{let n=I.validate(t);for(let t=0;t<n.length;t++)try{e.validate(n[t])}catch(e){s(t,e)}return n},(t,n)=>{if(Object.is(t,n))return t;if(!e.validateUsingKnownGoodVersion)return this.validate(n);let r=I.validate(n),i=t.length!==r.length;for(let n=0;n<r.length;n++){let o=r[n];if(n>=t.length){i=!0;try{e.validate(o)}catch(e){s(n,e)}continue}if(!Object.is(t[n],o))try{let r=e.validateUsingKnownGoodVersion(t[n],o);Object.is(r,t[n])||(i=!0)}catch(e){s(n,e)}}return i?n:t}),this.itemValidator=e}itemValidator;nonEmpty(){return this.check(e=>{if(0===e.length)throw new o("Expected a non-empty array")})}lengthGreaterThan1(){return this.check(e=>{if(e.length<=1)throw new o("Expected an array with length greater than 1")})}}class c extends l{constructor(e,t=!1){const n=[],r=[];for(const[t,i]of Object.entries(e))n.push(t),r.push(i);super(l=>{if("object"!=typeof l||null===l)throw new o(`Expected object, got ${a(l)}`);for(let e=0;e<n.length;e++){let t=n[e];try{r[e].validate((0,i.g5)(l,t))}catch(e){s(t,e)}}if(!t){for(let t in l)if((0,i.mQ)(l,t)&&!(0,i.mQ)(e,t))throw new o("Unexpected property",[t])}return l},(l,d)=>{if(Object.is(l,d))return l;if("object"!=typeof d||null===d)throw new o(`Expected object, got ${a(d)}`);let c=!1;for(let e=0;e<n.length;e++){let t=n[e],o=(0,i.g5)(l,t),a=(0,i.g5)(d,t);if(!Object.is(o,a))try{let t=r[e],n=t.validateUsingKnownGoodVersion?t.validateUsingKnownGoodVersion(o,a):t.validate(a);Object.is(n,o)||(c=!0)}catch(e){s(t,e)}}if(t){if(!c){for(let t of Object.keys(d))if(!(0,i.mQ)(e,t)&&!Object.is((0,i.g5)(l,t),(0,i.g5)(d,t))){c=!0;break}}}else for(let t in d)if((0,i.mQ)(d,t)&&!(0,i.mQ)(e,t))throw new o("Unexpected property",[t]);if(!c){for(let e in l)if((0,i.mQ)(l,e)&&!(0,i.mQ)(d,e)){c=!0;break}}return c?d:l}),this.config=e,this.shouldAllowUnknownProperties=t}config;shouldAllowUnknownProperties;allowUnknownProperties(){return new c(this.config,!0)}extend(e){return new c({...this.config,...e})}}class h extends l{constructor(e,t,n,r){super(t=>{this.expectObject(t);let n=this.getMatchingSchema(t);if(void 0===n)return this.unknownValueValidation(t,this.getVariant(t));try{return n.validate(t)}catch(n){s(`(${e} = ${this.getVariant(t)})`,n)}},(t,n)=>{this.expectObject(n),this.expectObject(t);let r=this.getMatchingSchema(n);if(void 0===r)return this.unknownValueValidation(n,this.getVariant(n));try{if((0,i.g5)(t,e)!==(0,i.g5)(n,e))return r.validate(n);if(r.validateUsingKnownGoodVersion)return r.validateUsingKnownGoodVersion(t,n);return r.validate(n)}catch(t){s(`(${e} = ${this.getVariant(n)})`,t)}}),this.key=e,this.config=t,this.unknownValueValidation=n,this.useNumberKeys=r}key;config;unknownValueValidation;useNumberKeys;expectObject(e){if("object"!=typeof e||null===e)throw new o(`Expected an object, got ${a(e)}`,[])}getVariant(e){return(0,i.g5)(e,this.key)}getMatchingSchema(e){let t=(0,i.g5)(e,this.key);if(this.useNumberKeys||"string"==typeof t){if(this.useNumberKeys){let e=Number(t);if(e-e!=0)throw new o(`Expected a number for key "${this.key}", got "${t}"`)}}else throw new o(`Expected a string for key "${this.key}", got ${a(t)}`);return(0,i.mQ)(this.config,t)?this.config[t]:void 0}validateUnknownVariants(e){return new h(this.key,this.config,e,this.useNumberKeys)}}class u extends l{constructor(e,t){super(n=>{if("object"!=typeof n||null===n)throw new o(`Expected object, got ${a(n)}`);for(let r in n)if((0,i.mQ)(n,r))try{e.validate(r),t.validate(n[r])}catch(e){s(r,e)}return n},(n,r)=>{if("object"!=typeof r||null===r)throw new o(`Expected object, got ${a(r)}`);let l=!1,d=0;for(let o in r){if(!(0,i.mQ)(r,o))continue;d++;let a=r[o];if(!(0,i.mQ)(n,o)){l=!0;try{e.validate(o),t.validate(a)}catch(e){s(o,e)}continue}let c=n[o];if(!Object.is(c,a))try{let e=t.validateUsingKnownGoodVersion?t.validateUsingKnownGoodVersion(c,a):t.validate(a);Object.is(e,c)||(l=!0)}catch(e){s(o,e)}}if(!l){let e=0;for(let t in n)(0,i.mQ)(n,t)&&e++;e!==d&&(l=!0)}return l?r:n}),this.keyValidator=e,this.valueValidator=t}keyValidator;valueValidator}function p(e){return new l(t=>{if(typeof t!==e)throw new o(`Expected ${e}, got ${a(t)}`);return t})}let f=new l(e=>e),g=new l(e=>e),m=p("string"),y=new l(e=>{if(Number.isFinite(e))return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");throw new o(`Expected a finite number, got ${e}`)}),b=new l(e=>{if(Number.isFinite(e)&&e>=0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e<0)throw new o(`Expected a positive number, got ${e}`);throw new o(`Expected a finite number, got ${e}`)}),x=new l(e=>{if(Number.isFinite(e)&&e>0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e<=0)throw new o(`Expected a non-zero positive number, got ${e}`);throw new o(`Expected a finite number, got ${e}`)}),w=new l(e=>{if(Number.isFinite(e)&&0!==e)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(0===e)throw new o("Expected a non-zero number, got 0");throw new o(`Expected a finite number, got ${e}`)}),v=new l(e=>{if(Number.isFinite(e)&&e>=0&&e<=1)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");throw new o(`Expected a number between 0 and 1, got ${e}`)}),S=new l(e=>{if(Number.isInteger(e))return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e-e!=0)throw new o(`Expected a finite number, got ${e}`);throw new o(`Expected an integer, got ${e}`)}),C=new l(e=>{if(Number.isInteger(e)&&e>=0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e-e!=0)throw new o(`Expected a finite number, got ${e}`);if(e<0)throw new o(`Expected a positive integer, got ${e}`);throw new o(`Expected an integer, got ${e}`)}),k=new l(e=>{if(Number.isInteger(e)&&e>0)return e;if("number"!=typeof e)throw new o(`Expected number, got ${a(e)}`);if(e!=e)throw new o("Expected a number, got NaN");if(e-e!=0)throw new o(`Expected a finite number, got ${e}`);if(e<=0)throw new o(`Expected a non-zero positive integer, got ${e}`);throw new o(`Expected an integer, got ${e}`)}),P=p("boolean"),T=p("bigint");function E(e){return new l(t=>{if(t!==e)throw new o(`Expected ${e}, got ${JSON.stringify(t)}`);return e})}let I=new l(e=>{if(!Array.isArray(e))throw new o(`Expected an array, got ${a(e)}`);return e});function _(e){return new d(e)}let M=new l(e=>{if("object"!=typeof e||null===e)throw new o(`Expected object, got ${a(e)}`);return e});function A(e){return new c(e)}function j(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e)||Object.getPrototypeOf(e)===i.DM)}let O=new l(e=>{if(function e(t){if(null===t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)return!0;if(Array.isArray(t)){for(let n=0;n<t.length;n++)if(!e(t[n]))return!1;return!0}if(j(t)){for(let n in t)if((0,i.mQ)(t,n)&&!e(t[n]))return!1;return!0}return!1}(e))return e;throw new o(`Expected json serializable value, got ${typeof e}`)},(e,t)=>{if(Array.isArray(e)&&Array.isArray(t)){let n=e.length!==t.length;for(let r=0;r<t.length;r++){if(r>=e.length){n=!0,O.validate(t[r]);continue}let i=e[r],o=t[r];!Object.is(i,o)&&(Object.is(O.validateUsingKnownGoodVersion(i,o),i)||(n=!0))}return n?t:e}if(!(j(e)&&j(t)))return O.validate(t);{let n=!1;for(let r in t){if(!(0,i.mQ)(t,r))continue;if(!(0,i.mQ)(e,r)){n=!0,O.validate(t[r]);continue}let o=e[r],s=t[r];!Object.is(o,s)&&(Object.is(O.validateUsingKnownGoodVersion(o,s),o)||(n=!0))}if(!n){for(let r in e)if((0,i.mQ)(e,r)&&!(0,i.mQ)(t,r)){n=!0;break}}return n?t:e}});function D(){return L(m,O)}function L(e,t){return new u(e,t)}function R(e,t){return new h(e,t,(n,r)=>{throw new o(`Expected one of ${Object.keys(t).map(e=>JSON.stringify(e)).join(" or ")}, got ${JSON.stringify(r)}`,[e])},!1)}function F(e,t){return new h(e,t,(n,r)=>{throw new o(`Expected one of ${Object.keys(t).map(e=>JSON.stringify(e)).join(" or ")}, got ${JSON.stringify(r)}`,[e])},!0)}function z(e,t){return new l(n=>{try{return t.validate(n)}catch(t){s(e,t)}},(n,r)=>{try{if(t.validateUsingKnownGoodVersion)return t.validateUsingKnownGoodVersion(n,r);return t.validate(r)}catch(t){s(e,t)}})}function N(e){return new l(t=>{if(!e.has(t)){let n=Array.from(e,e=>JSON.stringify(e)).join(" or ");throw new o(`Expected ${n}, got ${t}`)}return t})}function $(e){return new l(t=>{if(void 0!==t)return e.validate(t)},(t,n)=>{if(void 0!==n)return e.validateUsingKnownGoodVersion&&void 0!==t?e.validateUsingKnownGoodVersion(t,n):e.validate(n)},e instanceof l&&e.skipSameValueCheck)}function B(e){return new l(t=>null===t?null:e.validate(t),(t,n)=>null===n?null:e.validateUsingKnownGoodVersion&&null!==t?e.validateUsingKnownGoodVersion(t,n):e.validate(n),e instanceof l&&e.skipSameValueCheck)}function H(...e){return N(new Set(e))}function U(e){try{return new URL(e)}catch{if(e.startsWith("/")||e.startsWith("./"))try{return new URL(e,"http://example.com")}catch{}throw new o(`Expected a valid url, got ${JSON.stringify(e)}`)}}let K=new Set(["http:","https:","mailto:"]),W=m.check(e=>{if(""===e)return;let t=U(e);if(!K.has(t.protocol.toLowerCase()))throw new o(`Expected a valid url, got ${JSON.stringify(e)} (invalid protocol)`)}),V=new Set(["http:","https:","data:","asset:"]),Y=m.check(e=>{if(""===e)return;let t=U(e);if(!V.has(t.protocol.toLowerCase()))throw new o(`Expected a valid url, got ${JSON.stringify(e)} (invalid protocol)`)}),G=m.check(e=>{if(""!==e&&!U(e).protocol.toLowerCase().match(/^https?:$/))throw new o(`Expected a valid url, got ${JSON.stringify(e)} (invalid protocol)`)}),q=m.refine(e=>{try{return(0,i.fb)(e),e}catch{throw new o(`Expected an index key, got ${JSON.stringify(e)}`)}});function X(e,t){return new l(n=>{try{return e.validate(n)}catch{return t.validate(n)}})}(0,i.lF)("@tldraw/validate","5.3.2","esm")},22954:(e,t,n)=>{"use strict";n.d(t,{Eq:()=>d});var r=new WeakMap,i=new WeakMap,o={},s=0,a=function(e){return e&&(e.host||a(e.parentNode))},l=function(e,t,n,l){var d=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=a(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});o[n]||(o[n]=new WeakMap);var c=o[n],h=[],u=new Set,p=new Set(d),f=function(e){!e||u.has(e)||(u.add(e),f(e.parentNode))};d.forEach(f);var g=function(e){!e||p.has(e)||Array.prototype.forEach.call(e.children,function(e){if(u.has(e))g(e);else try{var t=e.getAttribute(l),o=null!==t&&"false"!==t,s=(r.get(e)||0)+1,a=(c.get(e)||0)+1;r.set(e,s),c.set(e,a),h.push(e),1===s&&o&&i.set(e,!0),1===a&&e.setAttribute(n,"true"),o||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return g(t),u.clear(),s++,function(){h.forEach(function(e){var t=r.get(e)-1,o=c.get(e)-1;r.set(e,t),c.set(e,o),t||(i.has(e)||e.removeAttribute(l),i.delete(e)),o||e.removeAttribute(n)}),--s||(r=new WeakMap,r=new WeakMap,i=new WeakMap,o={})}},d=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),l(r,i,n,"aria-hidden")):function(){return null}}},23312:(e,t,n)=>{"use strict";n.d(t,{cee:()=>pO,ZCT:()=>pA,EF7:()=>pD,_LY:()=>pg,P3o:()=>pj,jhL:()=>pb,QVi:()=>r.QVi,A8:()=>r.A8,Unq:()=>pM,Yem:()=>pT,HQo:()=>cS,Hif:()=>u5,F0h:()=>p1,h4e:()=>pv,fPn:()=>pp,foZ:()=>pw,L4x:()=>pf,Gto:()=>pF,hDc:()=>r.hDc,ikG:()=>pu,hUo:()=>pk,fnc:()=>pP,RIo:()=>pR,Yby:()=>pz,dEX:()=>pL,V8r:()=>r.V8r,l7k:()=>py,jkh:()=>pI,GN7:()=>px,D7F:()=>pC,bIq:()=>ph,bKc:()=>pE,dGg:()=>u1,JGv:()=>u2,pY9:()=>uW,Isx:()=>uq,tJe:()=>uG,$EK:()=>uJ,C_T:()=>u0,f1t:()=>uQ,pPo:()=>uX,hLL:()=>u3,k2C:()=>uZ,T:()=>r.T,OsR:()=>r.OsR,SDB:()=>pm,Z1z:()=>x5,Cgn:()=>so,FUD:()=>aE,LRd:()=>ak,Tme:()=>pc,jY:()=>pS,XAu:()=>r.XAu,gPO:()=>p_,EWP:()=>r.EWP,gP_:()=>r.gP_,S6A:()=>r.S6A,n6Y:()=>r.n6Y,_zD:()=>r._zD,dBl:()=>r.dBl,Ats:()=>bY,TjI:()=>r.TjI,iPZ:()=>r.iPZ,Cho:()=>r.Cho,oEU:()=>r.oEU,woC:()=>r.woC,Mcl:()=>r.Mcl,AFA:()=>r.AFA,mfH:()=>r.mfH,P1V:()=>r.P1V,NF7:()=>r.NF7,NFA:()=>r.NFA,jH7:()=>A,hGv:()=>r.hGv,BSi:()=>r.BSi,_q_:()=>r._q_,FxY:()=>sz,lIP:()=>r.lIP,oqt:()=>r.oqt,K4z:()=>r.K4z,Bdt:()=>M,hau:()=>r.hau});var r=n(93647);let i=e=>.65*e+.35*(0,r.dwc)(e*r.PI/2),o=e=>({size:e,thinning:0,streamline:(0,r.wwY)(e,[9,16],[.64,.74],!0),smoothing:.62,simulatePressure:!1,easing:r.Z4H.linear});function s({strokeWidth:e,showAsComplete:t}){return{size:1+e,thinning:0,streamline:.5,smoothing:.5,simulatePressure:!1,easing:r.Z4H.easeOutSine,last:t}}function a(e,t,n,s){let a=e.isComplete||n;if(s)if(!e.isPen)return{...o(t),last:a};else return{...{size:t,thinning:0,streamline:.62,smoothing:.62,simulatePressure:!1,easing:r.Z4H.linear},last:a};if("draw"===e.dash)if(e.isPen)return{size:1+1.2*t,thinning:.62,streamline:.62,smoothing:.62,simulatePressure:!1,easing:i,last:a};else return{...{size:t,thinning:.5,streamline:(0,r.wwY)(t,[9,16],[.64,.74],!0),smoothing:.62,easing:r.Z4H.easeOutSine,simulatePressure:!0},last:a};return{...o(t),last:a}}function l(e,t=1,n=1){let i=[];for(let o of e)!function(e,t,n,i=[]){let o=r.K6A.decodePoints(e.path,e.dim);if(1!==t||1!==n)for(let e of o)e.x*=t,e.y*=n;if("free"===e.type||o.length<2)i.push(...o.map(r.l2P.From));else{let e=r.l2P.From(o[0]),t=r.l2P.From(o[1]),n=r.l2P.Dist(t,e);if(0===n)i.push(e);else{let o=r.l2P.Tan(t,e),s=Math.min(1,Math.floor(n/4)),a=r.l2P.Add(e,r.l2P.Mul(o,s)),l=r.l2P.Add(t,r.l2P.Mul(o,-s)),d=Math.max(4,Math.floor(n/16));i.push(e,...r.l2P.PointsBetween(a,l,d,r.Z4H.easeInOutCubic),t)}}}(o,t,n,i);return i}var d=n(95155);class c{static lineThroughPoints(e,t){let n=new c;n.moveTo(e[0].x,e[0].y,{...t,offset:t?.endOffsets??t?.offset});for(let r=1;r<e.length;r++){let i=r===e.length-1;n.lineTo(e[r].x,e[r].y,i?{offset:t?.endOffsets}:void 0)}return n}static cubicSplineThroughPoints(e,t){let n=new c,r=e.length,i=r-2;n.moveTo(e[0].x,e[0].y,{...t,offset:t?.endOffsets??t?.offset});for(let o=0;o<r-1;o++){let r,s,a,l,d,c=0===o?e[0]:e[o-1],h=e[o],u=e[o+1],p=o===i?u:e[o+2];0===o?(r=c.x,s=c.y):(r=h.x+(u.x-c.x)/6*1.25,s=h.y+(u.y-c.y)/6*1.25),o===i?(a=u.x,l=u.y,d={offset:t?.endOffsets}):(a=u.x-(p.x-h.x)/6*1.25,l=u.y-(p.y-h.y)/6*1.25),n.cubicBezierTo(u.x,u.y,r,s,a,l,d)}return n}commands=[];lastMoveTo=null;assertHasMoveTo(){return(0,r.vAR)(this.lastMoveTo,"Start an SVGPathBuilder with `.moveTo()`"),this.lastMoveTo}moveTo(e,t,n){return this.lastMoveTo={type:"move",x:e,y:t,closeIdx:null,isClose:!1,opts:n},this.commands.push(this.lastMoveTo),this}lineTo(e,t,n){return this.assertHasMoveTo(),this.commands.push({type:"line",x:e,y:t,isClose:!1,opts:n}),this}circularArcTo(e,t,n,r,i,o){return this.arcTo(e,e,t,n,0,r,i,o)}arcTo(e,t,n,i,o,s,a,l){this.assertHasMoveTo();let d=this.commands[this.commands.length-1].x,c=this.commands[this.commands.length-1].y;if(d===s&&c===a)return this;if(0===e||0===t)return this.lineTo(s,a,l);let h=Math.sin(o),u=Math.cos(o),p=Math.abs(e),f=Math.abs(t),g=(d-s)/2,m=(c-a)/2,y=u*g+h*m,b=-h*g+u*m,x=y*y/(p*p)+b*b/(f*f);if(x>1){let e=Math.sqrt(x);p*=e,f*=e}let w=(p*p*f*f-p*p*b*b-f*f*y*y)/(p*p*b*b+f*f*y*y),v=(n!==i?1:-1)*Math.sqrt(w=w<0?0:w),S=p*b/f*v,C=-(f*y)/p*v,k=u*S-h*C+(d+s)/2,P=h*S+u*C+(c+a)/2,T=Math.atan2((b-C)/f,(y-S)/p),E=Math.atan2((-b-C)/f,(-y-S)/p);!i&&E>T?E-=2*Math.PI:i&&E<T&&(E+=2*Math.PI);let I=E-T,_=Math.max(p,f)*Math.abs(I),M=Math.min(4,Math.ceil(Math.abs(I)/(Math.PI/2))),A=Math.ceil((0,r.qnK)(_)/M),j=I/M,O=e=>({x:k+p*Math.cos(e)*u-f*Math.sin(e)*h,y:P+p*Math.cos(e)*h+f*Math.sin(e)*u}),D=e=>({x:-p*Math.sin(e)*u-f*Math.cos(e)*h,y:-p*Math.sin(e)*h+f*Math.cos(e)*u});for(let e=0;e<M;e++){let t=T+e*j,n=T+(e+1)*j,r=n-t,i=O(t),o=O(n),s=D(t),a=D(n),d=4/3*Math.tan(r/4),c=i.x+d*s.x,h=i.y+d*s.y,u=o.x-d*a.x,p=o.y-d*a.y,f=0===e?l:{...l,mergeWithPrevious:!0};this.cubicBezierToWithResolution(o.x,o.y,c,h,u,p,f,A)}return this}cubicBezierTo(e,t,n,r,i,o,s){return this.cubicBezierToWithResolution(e,t,n,r,i,o,s)}cubicBezierToWithResolution(e,t,n,r,i,o,s,a){return this.assertHasMoveTo(),this.commands.push({type:"cubic",x:e,y:t,cp1:{x:n,y:r},cp2:{x:i,y:o},isClose:!1,opts:s,resolution:a}),this}close(){let e=this.assertHasMoveTo(),t=this.commands[this.commands.length-1];return(0,r.YY0)(e.x,t.x)&&(0,r.YY0)(e.y,t.y)?t.isClose=!0:this.commands.push({type:"line",x:e.x,y:e.y,isClose:!0}),e.closeIdx=this.commands.length-1,this.lastMoveTo=null,this}transform(e){let t=new c;for(let n of this.commands){let[i,o]=r.V8r.applyToXY(e,n.x,n.y);switch(n.type){case"move":case"line":t.commands.push({...n,x:i,y:o,_info:void 0});break;case"cubic":{let[s,a]=r.V8r.applyToXY(e,n.cp1.x,n.cp1.y),[l,d]=r.V8r.applyToXY(e,n.cp2.x,n.cp2.y);t.commands.push({...n,x:i,y:o,cp1:{x:s,y:a},cp2:{x:l,y:d},_info:void 0});break}default:(0,r.h6G)(n,"type")}}return t}toD(e={}){let{startIdx:t=0,endIdx:n=this.commands.length,onlyFilled:i=!1}=e,o=[],s=!1,a=!1,l=!1,d=e=>{if(a||0===e)return;a=!0;let t=this.commands[e-1];o.push("M",(0,r.WMC)(t.x),(0,r.WMC)(t.y))};for(let e=t;e<n;e++){let t=this.commands[e];switch(t.type){case"move":{let e=t.opts?.geometry!==!1&&(t.opts?.geometry?.isFilled??!1);i&&!e?s=!0:(s=!1,a=!0,l=!0,o.push("M",(0,r.WMC)(t.x),(0,r.WMC)(t.y)));break}case"line":if(s)break;d(e),t.isClose&&l?o.push("Z"):o.push("L",(0,r.WMC)(t.x),(0,r.WMC)(t.y));break;case"cubic":if(s)break;d(e),o.push("C",(0,r.WMC)(t.cp1.x),(0,r.WMC)(t.cp1.y),(0,r.WMC)(t.cp2.x),(0,r.WMC)(t.cp2.y),(0,r.WMC)(t.x),(0,r.WMC)(t.y));break;default:(0,r.h6G)(t,"type")}}return o.join(" ")}toSvg(e){if("none"===e.style)return null;if(e.forceSolid)return this.toSolidSvg(e);switch(e.style){case"solid":return this.toSolidSvg(e);case"dashed":case"dotted":return this.toDashedSvg(e);case"draw":return this.toDrawSvg(e);default:(0,r.h6G)(e,"style")}}toPath2D(e){return"none"===e.style?new Path2D:new Path2D(e.forceSolid||"solid"===e.style?this.toD({onlyFilled:e.onlyFilled}):"draw"===e.style?this.toDrawD(e):this.toD({onlyFilled:e.onlyFilled}))}toGeometry(){let e=[],t=null;for(let n=0;n<this.commands.length;n++){let i=this.commands[n];"move"===i.type&&(t&&t.opts?.geometry!==!1&&e.push(new u(this,t.startIdx,n,{...t.opts?.geometry,isFilled:t.opts?.geometry?.isFilled??!1,isClosed:null!==t.moveCommand.closeIdx})),t={startIdx:n,moveCommand:i,opts:i.opts,isClosed:!1}),i.isClose&&((0,r.vAR)(t,"No current move command"),t.isClosed=!0)}return(t&&t.opts?.geometry!==!1&&e.push(new u(this,t.startIdx,this.commands.length,{...t.opts?.geometry,isFilled:t.opts?.geometry?.isFilled??!1,isClosed:null!==t.moveCommand.closeIdx})),(0,r.vAR)(e.length>0),1===e.length)?e[0]:new r.IQE({children:e})}toSolidSvg(e){let{strokeWidth:t,props:n}=e;return(0,d.jsx)("path",{strokeWidth:t,d:this.toD({onlyFilled:e.onlyFilled}),...n})}toDashedSvg(e){let t,{style:n,strokeWidth:i,snap:o,lengthRatio:s,props:{markerStart:a,markerEnd:l,...c}={}}=e,h=[],u=!1,p=!1,f=null,g=()=>{if(!f)return;let{startIdx:t,endIdx:c,isFirst:u,isLast:p,length:g,lineOpts:m,pathIsClosed:y}=f;if(f=null,t===c&&"move"===this.commands[t].type)return;let b=m?.dashStart??e.start,x=m?.dashEnd??e.end,{strokeDasharray:w,strokeDashoffset:v}=(0,r.EK8)(g,i,{style:n,snap:o,lengthRatio:s,start:u?b??(y?"outset":"none"):"outset",end:p?x??(y?"outset":"none"):"outset"}),S=this.toD({startIdx:t,endIdx:c+1});h.push((0,d.jsx)("path",{d:S,strokeDasharray:w,strokeDashoffset:v,markerStart:u?a:void 0,markerEnd:p?l:void 0},h.length))};for(let n=0;n<this.commands.length;n++){let r=this.commands[n],i=this.commands[n-1];if("move"===r.type){u=null!==r.closeIdx;let n=r.opts?.geometry!==!1&&(r.opts?.geometry?.isFilled??!1);e.onlyFilled&&!n?p=!0:(p=!1,t=r.opts);continue}if(p)continue;let o=this.calculateSegmentLength(i,r),s="move"===i.type,a=r.isClose||n===this.commands.length-1||this.commands[n+1]?.type==="move";f&&r.opts?.mergeWithPrevious?(f.length+=o,f.endIdx=n,f.isLast=a):(g(),f={startIdx:n,endIdx:n,isFirst:s,isLast:a,length:o,lineOpts:t,pathIsClosed:u})}return g(),(0,d.jsx)("g",{strokeWidth:i,...c,children:h})}toDrawSvg(e){return(0,d.jsx)("path",{strokeWidth:e.strokeWidth,d:this.toDrawD(e),...e.props})}toDrawD(e){let{strokeWidth:t,randomSeed:n,offset:i=t/3,roundness:o=2*t,passes:s=2,onlyFilled:a=!1}=e,l=[],d=this.getCommandInfo(),c=[],u=null;for(let e=0;e<this.commands.length;e++){let t=this.commands[e],n=t.opts?.offset??i,s=t.opts?.roundness??o;"move"===t.type&&(u=e);let a=t.isClose?(0,r.Z1O)(u)+1:this.commands[e+1]&&"move"!==this.commands[e+1].type?e+1:void 0,l=void 0!==a&&this.commands[a]&&this.commands[a]?.type!=="move"?d[a]:void 0,p=h[t.type],f=void 0!==a&&h[this.commands[a].type],g=d[e],m=g?.tangentEnd,y=l?.tangentStart,b=p&&f&&m&&y&&r.l2P.Len2(m)>.01&&r.l2P.Len2(y)>.01?(0,r.wwY)(Math.abs(r.l2P.AngleBetween(m,y)),[Math.PI/2,Math.PI],[s,0],!0):0,x=Math.min(g?.length??1/0,l?.length??1/0)-2*b,w=(0,r.qE8)(n,0,x/4),v=Math.min(b,(g?.length??1/0)/4),S=Math.min(b,(l?.length??1/0)/4),C={command:t,offsetAmount:w,roundnessBefore:v,roundnessAfter:S,tangentToPrev:d[e]?.tangentEnd,tangentToNext:l?.tangentStart,moveDidClose:!1};if(c.push(C),t.isClose&&null!==u){let e=c[u];e.moveDidClose=!0,e.roundnessAfter=S}else"move"===t.type&&(u=e)}for(let e=0;e<s;e++){let t=(0,r.She)(n+e),i={x:0,y:0},o=!1;for(let{command:e,offsetAmount:n,roundnessBefore:s,roundnessAfter:d,tangentToNext:h,tangentToPrev:u}of c){let c;if(e.isClose)c=i;else{let e=new r.l2P(t(),t()).uni(),i=Math.sqrt(Math.abs(t()))*n;c=r.l2P.Mul(e,i)}if("move"===e.type){i=c;let t=e.opts?.geometry!==!1&&(e.opts?.geometry?.isFilled??!1);o=!!a&&!t}if(o)continue;let p=r.l2P.Add(e,c),f=h&&d>0?r.l2P.Mul(h,-d).add(p):p,g=u&&s>0?r.l2P.Mul(u,s).add(p):p;if(f===p||g===p)switch(e.type){case"move":l.push("M",(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"line":l.push("L",(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"cubic":{let t=r.l2P.Add(e.cp1,c),n=r.l2P.Add(e.cp2,c);l.push("C",(0,r.WMC)(t.x),(0,r.WMC)(t.y),(0,r.WMC)(n.x),(0,r.WMC)(n.y),(0,r.WMC)(f.x),(0,r.WMC)(f.y));break}default:(0,r.h6G)(e,"type")}else switch(e.type){case"move":l.push("M",(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"line":l.push("L",(0,r.WMC)(g.x),(0,r.WMC)(g.y),"Q",(0,r.WMC)(p.x),(0,r.WMC)(p.y),(0,r.WMC)(f.x),(0,r.WMC)(f.y));break;case"cubic":{let t=r.l2P.Add(e.cp1,c),n=r.l2P.Add(e.cp2,c);l.push("C",(0,r.WMC)(t.x),(0,r.WMC)(t.y),(0,r.WMC)(n.x),(0,r.WMC)(n.y),(0,r.WMC)(p.x),(0,r.WMC)(p.y));break}default:(0,r.h6G)(e,"type")}}}return l.join(" ")}calculateSegmentLength(e,t){switch(t.type){case"move":return 0;case"line":return r.l2P.Dist(e,t);case"cubic":return p.length(e.x,e.y,t.cp1.x,t.cp1.y,t.cp2.x,t.cp2.y,t.x,t.y);default:(0,r.h6G)(t,"type")}}getCommands(){return this.commands}getCommandInfo(){let e=[];for(let t=1;t<this.commands.length;t++){let n,i,o=this.commands[t-1],s=this.commands[t];if(s._info){e[t]=s._info;continue}if("move"!==s.type){switch(s.type){case"line":n=i=r.l2P.Sub(o,s).uni();break;case"cubic":n=r.l2P.Sub(s.cp1,o).uni(),i=r.l2P.Sub(s.cp2,s).uni();break;default:(0,r.h6G)(s,"type")}s._info={tangentStart:n,tangentEnd:i,length:this.calculateSegmentLength(o,s)},e[t]=s._info}}return e}}let h={line:!0,move:!0,cubic:!1};class u extends r.vqJ{constructor(e,t,n,r){super(r),this.path=e,this.startIdx=t,this.endIdx=n}path;startIdx;endIdx;_segments=null;getSegments(){if(this._segments)return this._segments;this._segments=[];let e=this.path.commands[this.startIdx];(0,r.vAR)("move"===e.type);for(let t=this.startIdx+1;t<this.endIdx;t++){let n=this.path.commands[t];switch((0,r.vAR)("move"!==n.type),n.type){case"line":this._segments.push(new r.AoN({start:r.l2P.From(e),end:r.l2P.From(n)}));break;case"cubic":this._segments.push(new r.iON({start:r.l2P.From(e),cp1:r.l2P.From(n.cp1),cp2:r.l2P.From(n.cp2),end:r.l2P.From(n),resolution:n.resolution}));break;default:(0,r.h6G)(n,"type")}e=n}return this._segments}getVertices(e){let t=this.getSegments().flatMap(t=>t.getVertices(e)).filter((e,t,n)=>{let i=n[t-1];return!i||!r.l2P.Equals(i,e)});if(this.isClosed){let e=t[t.length-1],n=t[0];r.l2P.Equals(e,n)||t.push(n)}return t}nearestPoint(e,t){let n=null,i=1/0;for(let t of this.getSegments()){let o=t.nearestPoint(e),s=r.l2P.Dist2(e,o);s<i&&(i=s,n=o)}return(0,r.vAR)(n,"No nearest point found"),n}hitTestLineSegment(e,t,n=0,r){return super.hitTestLineSegment(e,t,n,r)}getSvgPathData(){return this.path.toD({startIdx:this.startIdx,endIdx:this.endIdx})}}let p={base3(e,t,n,r,i){let o=e*(-3*t+9*n-9*r+3*i)+6*t-12*n+6*r;return e*o-3*t+3*n},length(e,t,n,r,i,o,s,a,l=1){let d=(l=l>1?1:l<0?0:l)/2,c=0;c=0;for(let l=0;l<12;l++){let h=d*p.Tvalues[l]+d,u=p.base3(h,e,n,i,s),f=p.base3(h,t,r,o,a),g=u*u+f*f;c+=p.Cvalues[l]*Math.sqrt(g)}return d*c},Tvalues:[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],Cvalues:[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472]};var f=n(12115);function g(){let e=(0,r.frr)(),t=(0,r.hau)("animationSpeed",()=>e?.user.getAnimationSpeed(),[e]),[n,i]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{if(void 0!==t)return void i(0===t);let n=e?.getContainerWindow()??window;if(!("matchMedia"in n))return;let r=n.matchMedia("(prefers-reduced-motion: reduce)"),o=()=>{i(r.matches)};return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t,e]),n}function m(e){return"richText"in e.props&&r.eHF.isValid(e.props.richText)}function y(e,t,n={}){let r="string"==typeof t?e.getShape(t):t;if(r&&e.canEditShape(r)){if(!m(r))throw Error("Shape does not have rich text");e.setEditingShape(r),e.setCurrentTool("select.editing_shape",{...n.info,target:"shape",shape:r}),n.selectAll&&e.emit("select-all-text",{shapeId:r.id})}}let b=(0,f.createContext)(null);function x({children:e}){let t=(0,r.fpl)("a11y",{msg:"",priority:"assertive"}),n=(0,f.useContext)(b),i=(0,f.useMemo)(()=>({currentMsg:t,announce(e){e&&t.set(e)}}),[t]);return n?(0,d.jsx)(d.Fragment,{children:e}):(0,d.jsx)(b.Provider,{value:i,children:e})}function w(){let e=(0,f.useContext)(b);if(!e)throw Error("useA11y must be used within a A11yContext.Provider");return e}let v=(0,f.createContext)(null);function S({assetUrls:e,children:t}){return(0,f.useEffect)(()=>{let t=new Set;for(let n of[...Object.values(e.icons),...Object.values(e.embedIcons)]){if(!n)continue;let e=n.split("#")[0];if(t.has(e))continue;t.add(e);let i=(0,r._V3)();i.crossOrigin="anonymous",i.src=n,i.decode().catch(r.lQ1)}},[e]),(0,d.jsx)(v.Provider,{value:e,children:t})}function C(){let e=(0,f.useContext)(v);if(!e)throw Error("useAssetUrls must be used within an AssetUrlsProvider");return e}let k={"action.toggle-auto-pan":"Auto (trackpad)","action.toggle-auto-zoom":"Auto (mouse)","action.toggle-auto-none":"Auto","action.toggle-mouse":"Mouse","action.toggle-trackpad":"Trackpad","action.convert-to-bookmark":"Convert to bookmark","action.convert-to-embed":"Convert to embed","action.open-embed-link":"Open link","action.align-bottom":"Align bottom","action.align-center-horizontal":"Align horizontally","action.align-center-vertical":"Align vertically","action.align-center-horizontal.short":"Align H","action.align-center-vertical.short":"Align V","action.align-left":"Align left","action.align-right":"Align right","action.align-top":"Align top","action.back-to-content":"Back to content","action.bring-forward":"Bring forward","action.bring-to-front":"Bring to front","action.copy-as-json.short":"JSON","action.copy-as-json":"Copy as JSON","action.copy-as-png.short":"PNG","action.copy-as-png":"Copy as PNG","action.copy-as-svg.short":"SVG","action.copy-as-svg":"Copy as SVG","action.copy":"Copy","action.copy-hovered-styles":"Copy hovered styles","action.cut":"Cut","action.delete":"Delete","action.unlock-all":"Unlock all","action.distribute-horizontal":"Distribute horizontally","action.distribute-vertical":"Distribute vertically","action.distribute-horizontal.short":"Distribute H","action.distribute-vertical.short":"Distribute V","action.download-original":"Download original","action.duplicate":"Duplicate","action.edit-link":"Edit link…","action.exit-pen-mode":"Exit pen mode","action.export-as-png.short":"PNG","action.export-as-png":"Export as PNG","action.export-as-svg.short":"SVG","action.export-as-svg":"Export as SVG","action.export-all-as-png.short":"PNG","action.export-all-as-png":"Export as PNG","action.export-all-as-svg.short":"SVG","action.export-all-as-svg":"Export as SVG","action.fit-frame-to-content":"Fit to content","action.flip-horizontal":"Flip horizontally","action.flip-vertical":"Flip vertically","action.flip-horizontal.short":"Flip H","action.flip-vertical.short":"Flip V","action.fork-project":"Fork this project","action.fork-project-on-tldraw":"Fork project on tldraw","action.frame-selection":"Frame selection","action.group":"Group","action.insert-embed":"Insert embed…","action.insert-media":"Upload media…","action.leave-shared-project":"Leave shared project","action.new-project":"New project","action.new-shared-project":"New shared project","action.open-cursor-chat":"Cursor chat","action.open-kbd-shortcuts":"Keyboard shortcuts","action.open-file":"Open file","action.pack":"Pack","action.paste":"Paste","action.paste-error-title":"Pasting failed","action.paste-error-description":"Could not paste due to missing clipboard permissions. Please enable the permissions and try again.","action.print":"Print…","action.redo":"Redo","action.remove-frame":"Remove frame","action.rename":"Rename","action.rotate-ccw":"Rotate counterclockwise","action.rotate-cw":"Rotate clockwise","action.save-copy":"Save a copy","action.select-all":"Select all","action.select-none":"Select none","action.send-backward":"Send backward","action.send-to-back":"Send to back","action.share-project":"Share this project","action.stack-horizontal":"Stack horizontally","action.stack-vertical":"Stack vertically","action.stack-horizontal.short":"Stack H","action.stack-vertical.short":"Stack V","action.stop-following":"Stop following","action.stretch-horizontal":"Stretch horizontally","action.stretch-vertical":"Stretch vertically","action.stretch-horizontal.short":"Stretch H","action.stretch-vertical.short":"Stretch V","action.toggle-auto-size":"Toggle auto size","action.toggle-dark-mode.menu":"Dark mode","action.toggle-dark-mode":"Toggle dark mode","action.toggle-paste-at-cursor.menu":"Paste at cursor","action.toggle-paste-at-cursor":"Toggle paste at cursor","action.toggle-wrap-mode.menu":"Select on wrap","action.toggle-wrap-mode":"Toggle select on wrap","action.toggle-reduce-motion.menu":"Reduce motion","action.toggle-reduce-motion":"Toggle reduce motion","action.toggle-keyboard-shortcuts.menu":"Enable keyboard shortcuts","action.toggle-keyboard-shortcuts":"Toggle keyboard shortcuts","action.enhanced-a11y-mode.menu":"Enhanced accessibility mode","action.enhanced-a11y-mode":"Toggle enhanced accessibility mode","action.toggle-edge-scrolling.menu":"Edge scrolling","action.toggle-edge-scrolling":"Toggle edge scrolling","action.toggle-invert-zoom.menu":"Invert mouse zoom","action.toggle-invert-zoom":"Toggle invert mouse zoom","action.toggle-debug-mode.menu":"Debug mode","action.toggle-debug-mode":"Toggle debug mode","action.toggle-focus-mode.menu":"Focus mode","action.toggle-focus-mode":"Toggle focus mode","action.toggle-dynamic-size-mode.menu":"Dynamic size","action.toggle-dynamic-size-mode":"Toggle dynamic size","action.toggle-grid.menu":"Show grid","action.toggle-grid":"Toggle grid","action.toggle-lock":"Toggle locked","action.flatten-to-image":"Flatten","action.toggle-snap-mode.menu":"Always snap","action.toggle-snap-mode":"Toggle always snap","action.toggle-tool-lock.menu":"Tool lock","action.toggle-tool-lock":"Toggle tool lock","action.toggle-transparent.context-menu":"Transparent","action.toggle-transparent.menu":"Transparent","action.toggle-transparent":"Toggle transparent background","action.undo":"Undo","action.ungroup":"Ungroup","action.zoom-in":"Zoom in","action.zoom-out":"Zoom out","action.zoom-to-100":"Zoom to 100%","action.zoom-to-fit":"Zoom to fit","action.zoom-to-selection":"Zoom to selection","action.zoom-quick":"Quick zoom","action.select-zoom-tool":"Zoom","assets.files.size-too-big":"File size is too big","assets.files.maximum-size":"Maximum file size is {size}","assets.files.type-not-allowed":"File type is not allowed","assets.files.upload-failed":"Upload failed","assets.files.amount-too-many":"Too many files","assets.url.failed":"Couldn’t load URL preview","theme.dark":"Dark","theme.light":"Light","theme.system":"System","color-style.white":"White","color-style.black":"Black","color-style.blue":"Blue","color-style.green":"Green","color-style.grey":"Grey","color-style.light-blue":"Light blue","color-style.light-green":"Light green","color-style.light-red":"Light red","color-style.light-violet":"Light violet","color-style.orange":"Orange","color-style.red":"Red","color-style.violet":"Violet","color-style.yellow":"Yellow","fill-style.none":"None","document.default-name":"Untitled","fill-style.semi":"Semi","fill-style.solid":"Solid","fill-style.pattern":"Pattern","fill-style.fill":"Fill","fill-style.lined-fill":"Lined fill","dash-style.dashed":"Dashed","dash-style.dotted":"Dotted","dash-style.draw":"Draw","dash-style.solid":"Solid","size-style.s":"Small","size-style.m":"Medium","size-style.l":"Large","size-style.xl":"Extra large","opacity-style.0.1":"10%","opacity-style.0.25":"25%","opacity-style.0.5":"50%","opacity-style.0.75":"75%","opacity-style.1":"100%","font-style.draw":"Draw","font-style.sans":"Sans","font-style.serif":"Serif","font-style.mono":"Mono","align-style.start":"Start","align-style.middle":"Middle","align-style.end":"End","align-style.justify":"Justify","verticalAlign-style.start":"Top","verticalAlign-style.middle":"Middle","verticalAlign-style.end":"Bottom","geo-style.arrow-down":"Arrow down","geo-style.arrow-left":"Arrow left","geo-style.arrow-right":"Arrow right","geo-style.arrow-up":"Arrow up","geo-style.cloud":"Cloud","geo-style.diamond":"Diamond","geo-style.ellipse":"Ellipse","geo-style.heart":"Heart","geo-style.hexagon":"Hexagon","geo-style.octagon":"Octagon","geo-style.oval":"Oval","geo-style.pentagon":"Pentagon","geo-style.rectangle":"Rectangle","geo-style.rhombus":"Rhombus","geo-style.rhombus-2":"Rhombus left","geo-style.star":"Star","geo-style.trapezoid":"Trapezoid","geo-style.triangle":"Triangle","geo-style.x-box":"X box","geo-style.check-box":"Check box","arrowheadStart-style.none":"None","arrowheadStart-style.arrow":"Arrow","arrowheadStart-style.bar":"Bar","arrowheadStart-style.diamond":"Diamond","arrowheadStart-style.dot":"Dot","arrowheadStart-style.inverted":"Inverted","arrowheadStart-style.pipe":"Pipe","arrowheadStart-style.square":"Square","arrowheadStart-style.triangle":"Triangle","arrowheadEnd-style.none":"None","arrowheadEnd-style.arrow":"Arrow","arrowheadEnd-style.bar":"Bar","arrowheadEnd-style.diamond":"Diamond","arrowheadEnd-style.dot":"Dot","arrowheadEnd-style.inverted":"Inverted","arrowheadEnd-style.pipe":"Pipe","arrowheadEnd-style.square":"Square","arrowheadEnd-style.triangle":"Triangle","spline-style.line":"Line","spline-style.cubic":"Cubic","arrow-kind-style.arc":"Arc","arrow-kind-style.elbow":"Elbow","tool.select":"Select","tool.hand":"Hand","tool.draw":"Draw","tool.eraser":"Eraser","tool.arrow-down":"Arrow down","tool.arrow-left":"Arrow left","tool.arrow-right":"Arrow right","tool.arrow-up":"Arrow up","tool.arrow":"Arrow","tool.cloud":"Cloud","tool.diamond":"Diamond","tool.ellipse":"Ellipse","tool.heart":"Heart","tool.hexagon":"Hexagon","tool.highlight":"Highlight","tool.line":"Line","tool.octagon":"Octagon","tool.oval":"Oval","tool.pentagon":"Pentagon","tool.rectangle":"Rectangle","tool.rhombus":"Rhombus","tool.star":"Star","tool.trapezoid":"Trapezoid","tool.triangle":"Triangle","tool.x-box":"X box","tool.check-box":"Check box","tool.media":"Media","tool.frame":"Frame","tool.note":"Note","tool.laser":"Laser","tool.embed":"Embed","tool.text":"Text","tool.pointer-down":"Pointer down","tool.image-zoom":"Zoom","tool.replace-media":"Replace media…","tool.flip-horz":"Flip horizontally","tool.flip-vert":"Flip vertically","tool.rotate-cw":"Rotate","tool.aspect-ratio":"Aspect ratio","tool.aspect-ratio.original":"Original","tool.aspect-ratio.square":"Square (1:1)","tool.aspect-ratio.circle":"Circle (1:1)","tool.aspect-ratio.landscape":"Landscape (4:3)","tool.aspect-ratio.portrait":"Portrait (3:4)","tool.aspect-ratio.wide":"Wide (16:9)","tool.image-toolbar-title":"Image tools","tool.image-crop":"Crop image","tool.image-crop-confirm":"Confirm","tool.media-alt-text":"Alternative text","tool.media-alt-text-desc":"Give a description…","tool.media-alt-text-confirm":"Confirm","tool.rich-text-bold":"Bold","tool.rich-text-italic":"Italic","tool.rich-text-code":"Code","tool.rich-text-highlight":"Highlight","tool.rich-text-strikethrough":"Strikethrough","tool.rich-text-link":"Link","tool.rich-text-link-visit":"Visit link","tool.rich-text-link-remove":"Remove link","tool.rich-text-header":"Header","tool.rich-text-bulletList":"Bulleted list","tool.rich-text-toolbar-title":"Text formatting","tool.rich-text-orderedList":"Ordered list","tool.bookmark":"Bookmark","a11y.status":"Status","a11y.skip-to-main-content":"Move focus to canvas","a11y.shape-index":"{num} of {total}","a11y.shape-image":"Image","a11y.shape-video":"Video","a11y.multiple-shapes":"{num} shapes selected","a11y.select-shape":"Select next shape","a11y.select-shape-direction":"Select shape in direction","a11y.enter-leave-container":"Enter/leave container","a11y.repeat-shape":"Repeat shape","a11y.move-shape":"Move shape","a11y.move-shape-faster":"Move shape faster","a11y.rotate-shape-cw":"Rotate shape clockwise","a11y.rotate-shape-ccw":"Rotate shape counterclockwise","a11y.rotate-shape-cw-fine":"Rotate shape clockwise (fine)","a11y.rotate-shape-ccw-fine":"Rotate shape counterclockwise (fine)","a11y.enlarge-shape":"Enlarge shape","a11y.shrink-shape":"Shrink shape","a11y.pan-camera":"Pan camera","a11y.adjust-shape-styles":"Adjust shape styles","a11y.open-context-menu":"Context menu…","a11y.open-keyboard-shortcuts":"Keyboard shortcuts","menu.title":"Menu","menu.theme":"Theme","menu.color-theme":"Color theme","menu.accessibility":"Accessibility","menu.copy-as":"Copy as","menu.edit":"Edit","menu.export-as":"Export as","menu.file":"File","menu.language":"Language","menu.preferences":"Preferences","menu.view":"View","menu.input-device":"Input device","context-menu.title":"Context menu","context-menu.edit":"Edit","context-menu.arrange":"Arrange","context-menu.copy-as":"Copy as","context-menu.export-as":"Export as","context-menu.export-all-as":"Export","context-menu.move-to-page":"Move to page","context-menu.reorder":"Reorder","page-menu.title":"Pages","page-menu.create-new-page":"Create new page","page-menu.max-pages-reached":"Maximum pages reached","page-menu.new-page-initial-name":"Page 1","page-menu.edit-start":"Edit","page-menu.edit-done":"Done","page-menu.go-to-page":"Go to page","page-menu.resize":"Resize page list","page-menu.submenu.rename":"Rename","page-menu.submenu.duplicate-page":"Duplicate","page-menu.submenu.title":"Menu","page-menu.submenu.move-down":"Move down","page-menu.submenu.move-up":"Move up","page-menu.submenu.delete":"Delete","share-menu.title":"Share","share-menu.save-note":"Download this project to your computer as a .tldr file.","share-menu.fork-note":"Create a new shared project based on this snapshot.","share-menu.share-project":"Share this project","share-menu.copy-link":"Copy editor link","share-menu.create-snapshot-link":"Copy snapshot link","share-menu.snapshot-link-note":"Capture and share this project as a read-only snapshot link.","share-menu.copy-readonly-link":"Copy viewer link","share-menu.offline-note":"Create a new shared project based on your current project.","share-menu.copy-link-note":"Anyone with the link will be able to view and edit this project.","share-menu.copy-readonly-link-note":"Anyone with the link will be able to access this project.","share-menu.project-too-large":"Sorry, this project can’t be shared because it’s too large. We’re working on it!","share-menu.upload-failed":"Sorry, we couldn’t upload your project at the moment. Please try again or let us know if the problem persists.","share-menu.creating-project":"Creating the new project…","share-menu.copied":"Copied link","document-name-menu.copy-link":"Copy link","status.offline":"Offline","people-menu.title":"People","people-menu.change-name":"Change name","people-menu.avatar-color":"Avatar color","people-menu.change-color":"Change color","people-menu.follow":"Following","people-menu.following":"Following","people-menu.leading":"Following you","people-menu.user":"(You)","people-menu.invite":"Invite others","people-menu.anonymous-user":"New user","help-menu.import-tldr-file":"Import file…","help-menu.title":"Help and resources","help-menu.about":"About tldraw","help-menu.discord":"Discord","help-menu.github":"GitHub","help-menu.keyboard-shortcuts":"Keyboard shortcuts","help-menu.twitter":"Twitter","help-menu.terms":"Terms of service","help-menu.privacy":"Privacy policy","actions-menu.title":"Actions","edit-link-dialog.title":"Edit link","edit-link-dialog.invalid-url":"A link must be a valid URL.","edit-link-dialog.detail":"Links will open in a new tab.","edit-link-dialog.url":"URL","edit-link-dialog.clear":"Clear","edit-link-dialog.save":"Continue","edit-link-dialog.cancel":"Cancel","edit-link-dialog.external-link":"External link","embed-dialog.title":"Insert embed","embed-dialog.back":"Back","embed-dialog.create":"Create","embed-dialog.cancel":"Cancel","embed-dialog.url":"URL","embed-dialog.instruction":"Paste in the site’s URL to create the embed.","embed-dialog.invalid-url":"We could not create an embed from that URL.","shortcuts-dialog.title":"Keyboard shortcuts","shortcuts-dialog.edit":"Edit","shortcuts-dialog.file":"File","shortcuts-dialog.preferences":"Preferences","shortcuts-dialog.tools":"Tools","shortcuts-dialog.transform":"Transform","shortcuts-dialog.view":"View","shortcuts-dialog.collaboration":"Collaboration","shortcuts-dialog.a11y":"Accessibility","shortcuts-dialog.text-formatting":"Text formatting","style-panel.title":"Styles","style-panel.align":"Align","style-panel.label-align":"Label align","style-panel.vertical-align":"Vertical align","style-panel.position":"Position","style-panel.arrowheads":"Arrows","style-panel.arrowhead-start":"Start","style-panel.arrowhead-end":"End","style-panel.arrow-kind":"Line","style-panel.color":"Color","style-panel.dash":"Dash","style-panel.fill":"Fill","style-panel.font":"Font","style-panel.geo":"Shape","style-panel.mixed":"Mixed","style-panel.opacity":"Opacity","style-panel.size":"Size","style-panel.spline":"Spline","style-panel.selected":"selected","tool-panel.title":"Tools","tool-panel.more":"More","navigation-zone.title":"Navigation","navigation-zone.minimap":"Minimap","navigation-zone.toggle-minimap":"Toggle minimap","navigation-zone.zoom":"Zoom","focus-mode.toggle-focus-mode":"Toggle focus mode","toast.close":"Close","toast.success":"Success","toast.error":"Error","toast.info":"Info","toast.warning":"Warning","file-system.file-open-error.title":"Could not open file","file-system.file-open-error.not-a-tldraw-file":"The file you tried to open doesn’t look like a tldraw file.","file-system.file-open-error.file-format-version-too-new":"The file you tried to open is from a newer version of tldraw. Please reload the page and try again.","file-system.file-open-error.generic-corrupted-file":"The file you tried to open is corrupted.","file-system.confirm-open.title":"Overwrite current project?","file-system.confirm-open.description":"Opening a file will replace your current project and any unsaved changes will be lost. Are you sure you want to continue?","file-system.confirm-open.cancel":"Cancel","file-system.confirm-open.open":"Open file","file-system.confirm-open.dont-show-again":"Don’t ask again","file-system.confirm-clear.title":"Clear current project?","file-system.confirm-clear.description":"Creating a new project will clear your current project and any unsaved changes will be lost. Are you sure you want to continue?","file-system.confirm-clear.cancel":"Cancel","file-system.confirm-clear.continue":"Continue","file-system.confirm-clear.dont-show-again":"Don’t ask again","file-system.shared-document-file-open-error.title":"Could not open file","file-system.shared-document-file-open-error.description":"Opening files from shared projects is not supported.","sharing.confirm-leave.title":"Leave current project?","sharing.confirm-leave.description":"Are you sure you want to leave this shared project? You can return to it by navigating to its URL.","sharing.confirm-leave.cancel":"Cancel","sharing.confirm-leave.leave":"Leave","sharing.confirm-leave.dont-show-again":"Don’t ask again","toast.error.export-fail.title":"Failed export","toast.error.export-fail.desc":"Failed to export image","toast.error.copy-fail.title":"Failed copy","toast.error.copy-fail.desc":"Failed to copy image","context.pages.new-page":"New page","vscode.file-open.desc":"We’ve updated this document to work with the current version of tldraw. If you’d like to keep the original version (which will work on old.tldraw.com), click below to create a backup.","vscode.file-open.open":"Continue","vscode.file-open.backup":"Backup","vscode.file-open.backup-saved":"Backup saved","vscode.file-open.backup-failed":"Backup failed: this is not a .tldr file.","vscode.file-open.dont-show-again":"Don’t ask again","cursor-chat.type-to-chat":"Type to chat…","app.loading":"Loading tldraw…","handle.resize-top":"Resize top","handle.resize-bottom":"Resize bottom","handle.resize-left":"Resize left","handle.resize-right":"Resize right","handle.resize-top-left":"Resize top left","handle.resize-top-right":"Resize top right","handle.resize-bottom-left":"Resize bottom left","handle.resize-bottom-right":"Resize bottom right","handle.rotate.top_left_rotate":"Rotate top left","handle.rotate.top_right_rotate":"Rotate top right","handle.rotate.bottom_left_rotate":"Rotate bottom left","handle.rotate.bottom_right_rotate":"Rotate bottom right","handle.rotate.mobile_rotate":"Rotate","handle.crop.top":"Crop top","handle.crop.bottom":"Crop bottom","handle.crop.left":"Crop left","handle.crop.right":"Crop right","handle.crop.top-left":"Crop top left","handle.crop.top-right":"Crop top right","handle.crop.bottom-left":"Crop bottom left","handle.crop.bottom-right":"Crop bottom right","ui.close":"Close","ui.checked":"Checked","ui.unchecked":"Unchecked","comments.title":"Comments","comments.empty":"No comments on this page yet.","comments.empty-filtered":"No comments match your filters.","comments.thread-title":"Comment","comments.resolved":"Resolved","comments.filter":"Filter comments","comments.show-resolved":"Show resolved comments","comments.only-my-comments":"Only my comments","comments.only-unread":"Only unread","comments.show-all-pages":"Show all pages","comments.more-options":"More options","comments.hide":"Hide comments","comments.show":"Show comments","comments.reply-placeholder":"Reply…","comments.edit-placeholder":"Edit comment…","comments.add-placeholder":"Add a comment…","comments.save":"Save","comments.edit":"Edit","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.delete":"Delete thread","comments.edit-comment":"Edit comment","comments.delete-comment":"Delete comment","comments.dismiss":"Dismiss","comments.copy-link":"Copy link","comments.link-copied":"Link copied","comments.send":"Send","comments.resolved-by":"Resolved by {name}","comments.add-reaction":"Add reaction","comments.reacted-1":"{a} reacted","comments.reacted-2":"{a} and {b} reacted","comments.reacted-3":"{a}, {b} and {c} reacted","comments.reacted-more":"{a}, {b}, {c} and {count} others reacted","comments.reacted-more-one":"{a}, {b}, {c} and 1 other reacted","comments.mention-you":"You","comments.mention-no-matches":"No matches","comments.preview-more":"{count} more","comments.replies-one":"1 reply","comments.replies":"{count} replies","comments.pin-label":"Comment by {name}","comments.pin-label-resolved":"Resolved comment by {name}","comments.cluster-label":"{count} comments here","comments.stack-label":"{count} comments at this spot"},P=new Set(["ar","fa","he","ur","ku"]),T={locale:"en",label:"English",messages:k,dir:"ltr"};async function E(e,t){if(!(await (0,r.hdJ)(t.translations.en)).ok)return console.warn("No main translations found."),T;if("en"===e)return T;let n=r.Yjb.find(t=>t.locale===e);if(!n)return console.warn(`No translation found for locale ${e}`),T;let i=await (0,r.hdJ)(t.translations[n.locale]),o=await i.json();if(!o)return console.warn(`No messages found for locale ${e}`),T;let s=[];for(let e in T.messages)o[e]||s.push(e);return s.length,{locale:e,label:n.label,dir:P.has(n.locale)?"rtl":"ltr",messages:{...T.messages,...o}}}let I=f.createContext(null);function _({overrides:e,locale:t,children:n}){let r=C(),[i,o]=f.useState(()=>e&&e.en?{locale:"en",label:"English",dir:"ltr",messages:{...k,...e.en}}:{locale:"en",label:"English",dir:"ltr",messages:k});return f.useEffect(()=>{let n=!1;return async function(){let i=await E(t,r);i&&!n&&(e&&e[t]?o({...i,messages:{...i.messages,...e[t]}}):o(i))}(),()=>{n=!0}},[r,t,e]),(0,d.jsx)(I.Provider,{value:i,children:n})}function M(){let e=f.useContext(I),t=e?.messages??k;return f.useEffect(()=>{e?.messages||(0,r.mcG)("No translation messages found, falling back to default translation. Wrap your app in <TldrawUiContextProvider>, or in both <AssetUrlsProvider> and <TldrawUiTranslationProvider>, to provide translations.")},[e?.messages]),f.useCallback(function(e){return t[e]??e},[t])}function A(){let e=f.useContext(I);return e?.dir??"ltr"}function j(e,t){let n=t?e.getAsset(t):null;if(n&&!n.props.image)if(!n.props.title)return 46;else return 101;return 320}function O(e,t){return{...t,props:{...t.props,h:j(e,t.props.assetId)}}}function D(e,t,n){if(t)return t;if(!n)return null;let i=r.Kx3.createId((0,r.xpx)(n));return e.getAsset(i)?i:null}function L(e,t){let n=D(e,t.props.assetId,t.props.url);return n===t.props.assetId?t.props.h:j(e,n)}async function R(e,t){if(e.isDisposed)return;let{url:n}=t.props,r=await e.getAssetForExternalContent({type:"url",url:n});r&&e.run(()=>{e.createAssets([r]),e.updateShapes([{id:t.id,type:t.type,props:{assetId:r.id}}])})}let F=new WeakMap;async function z(e,{url:t,center:n=e.getViewportPageBounds().center}){try{let i=r.Kx3.createId((0,r.xpx)(t)),o=e.getAsset(i),s=(0,r.n6Y)(),a={id:s,type:"bookmark",x:n.x-150,y:n.y-160,rotation:0,opacity:1,props:{url:t,assetId:o?.id??null,w:300,h:j(e,o?.id)}};e.run(()=>{e.createShapes([a])});let l=e.getShape(s);if(!l)return r.Q7C.err("Failed to create bookmark shape");if(o)return r.Q7C.ok(l);return N(e,s,t),r.Q7C.ok(l)}catch(e){return r.Q7C.err(e instanceof Error?e.message:"Failed to create bookmark")}}async function N(e,t,n){let r;try{r=await e.getAssetForExternalContent({type:"url",url:n})}catch(e){console.error(e);return}if(e.isDisposed||!r)return;let i=e.getShape(t);!i||i.props.url!==n||i.props.assetId||e.run(()=>{e.getAsset(r.id)||e.createAssets([r]),e.updateShapes([{id:t,type:"bookmark",props:{assetId:r.id}}])},{history:"ignore"})}function $(){return{topLeft:{x:0,y:0},bottomRight:{x:1,y:1}}}let B=["original","square","circle","landscape","portrait","wide"],H={original:0,square:1,circle:1,landscape:4/3,portrait:3/4,wide:16/9};function U(e,t){return t?{w:e.w/(t.bottomRight.x-t.topLeft.x),h:e.h/(t.bottomRight.y-t.topLeft.y)}:{w:e.w,h:e.h}}function K(e){return{width:e.bottomRight.x-e.topLeft.x,height:e.bottomRight.y-e.topLeft.y}}function W(e){let{width:t,height:n}=K(e);return{x:e.topLeft.x+t/2,y:e.topLeft.y+n/2}}function V(e,t,n,r,i){let o=Math.max(0,Math.min(1-n,e-n/2)),s=Math.max(0,Math.min(1-r,t-r/2));return{topLeft:{x:o,y:s},bottomRight:{x:o+n,y:s+r},isCircle:i}}let Y={fontWeight:"normal",fontVariant:"normal",fontStyle:"normal",padding:"0px"},G={s:1,m:1.75,l:2.5,xl:5},q={s:1.125,m:1.5,l:2.25,xl:2.75},X={s:1.125,m:1.375,l:1.625,xl:2},J={s:1.125,m:1.25,l:1.5,xl:1.75},Z={draw:"var(--tl-font-draw)",sans:"var(--tl-font-sans)",serif:"var(--tl-font-serif)",mono:"var(--tl-font-mono)"};function Q(e,t){let n=e.fonts[t];return n?n.fontFamily:Z[t]??t}async function ee(e,t,n){let{elements:i,files:o}=t,s={shapes:[],bindings:[],rootShapeIds:[],assets:[],schema:e.store.schema.serialize()},a=new Map,l=new Map,d=e.getCurrentPageId(),c=new Map,h=[],u=new Set;i.forEach(e=>{if(c.set(e.id,(0,r.n6Y)()),null!==e.boundElements)for(let t of e.boundElements)"text"===t.type&&u.add(t.id)});let p=r.as9;for(let t of i){if(u.has(t.id))continue;let n=c.get(t.id),f={id:n,typeName:"shape",parentId:d,index:p,x:t.x,y:t.y,rotation:0,isLocked:t.locked,opacity:et(t.opacity),meta:{}};switch(0!==t.angle&&l.set(n,t.angle),t.groupIds&&t.groupIds.length>0?a.has(t.groupIds[0])?a.get(t.groupIds[0])?.push(n):a.set(t.groupIds[0],[n]):h.push(n),t.type){case"rectangle":case"ellipse":case"diamond":{let n="",o="middle";if(null!==t.boundElements){for(let e of t.boundElements)if("text"===e.type){let t=i.find(t=>t.id===e.id);t&&(n=t.text,o=ec[t.textAlign])}}let a="transparent"===t.backgroundColor?t.strokeColor:t.backgroundColor;s.shapes.push({...f,type:"geo",props:{...e.getShapeUtil("geo").getDefaultProps(),geo:t.type,url:t.link??"",w:t.width,h:t.height,size:en[t.strokeWidth]??"draw",color:ea[a]??"black",richText:(0,r.TP3)(n),align:o,dash:ep(t),fill:ef(t)}});break}case"freedraw":{let n=t.points.map(([e,t,n=.5])=>({x:e,y:t,z:n})),i=r.K6A.encodePoints(n);s.shapes.push({...f,type:"draw",props:{...e.getShapeUtil("draw").getDefaultProps(),dash:ep(t),size:en[t.strokeWidth],color:ea[t.strokeColor]??"black",segments:[{type:"free",path:i}]}});break}case"line":{if(t.points.slice().length<2)break;let n=(0,r.uud)(t.points.length);s.shapes.push({...f,type:"line",props:{...e.getShapeUtil("line").getDefaultProps(),dash:ep(t),size:en[t.strokeWidth],color:ea[t.strokeColor]??"black",spline:t.roundness?"cubic":"line",points:{...Object.fromEntries(t.points.map(([e,t],r)=>{let i=n[r];return[i,{id:i,index:i,x:e,y:t}]}))}}});break}case"arrow":{let o="";if(null!==t.boundElements){for(let e of t.boundElements)if("text"===e.type){let t=i.find(t=>t.id===e.id);t&&(o=t.text)}}let a=t.points[0],l=t.points[t.points.length-1],d=c.get(t.startBinding?.elementId),h=c.get(t.endBinding?.elementId);s.shapes.push({...f,type:"arrow",props:{...e.getShapeUtil("arrow").getDefaultProps(),richText:(0,r.TP3)(o),kind:t.elbowed?"elbow":"arc",bend:function(e,t,n){let i=0;if(e.points.length>2){let o=new r.l2P(t[0],t[1]),s=new r.l2P(n[0],n[1]),a=new r.l2P(e.points[1][0],e.points[1][1]),l=r.l2P.Sub(s,o),d=r.l2P.Per(l),c=r.l2P.Med(s,o),h=r.l2P.Sub(c,d),u=r.l2P.Add(c,d),p=r.l2P.NearestPointOnLineSegment(h,u,a,!1);i=r.l2P.Dist(p,c),r.l2P.Clockwise(p,s,c)&&(i*=-1)}return i}(t,a,l),dash:ep(t),size:en[t.strokeWidth]??"m",color:ea[t.strokeColor]??"black",start:{x:a[0],y:a[1]},end:{x:l[0],y:l[1]},arrowheadEnd:eu[t.endArrowhead]??"none",arrowheadStart:eu[t.startArrowhead]??"none"}}),d&&s.bindings.push({id:(0,r.BNi)(),typeName:"binding",type:"arrow",fromId:n,toId:d,props:{terminal:"start",snap:"none",normalizedAnchor:{x:.5,y:.5},isPrecise:!1,isExact:!1},meta:{}}),h&&s.bindings.push({id:(0,r.BNi)(),typeName:"binding",type:"arrow",fromId:n,toId:h,props:{terminal:"end",snap:"none",normalizedAnchor:{x:.5,y:.5},isPrecise:!1,isExact:!1},meta:{}});break}case"text":{let{size:n,scale:i}=function(e){let t=er[e];return t?{size:t,scale:1}:e<16?{size:"s",scale:e/16}:e>36?{size:"xl",scale:e/36}:{size:"m",scale:1}}(t.fontSize);s.shapes.push({...f,type:"text",props:{...e.getShapeUtil("text").getDefaultProps(),size:n,scale:i,font:ei[t.fontFamily]??"draw",color:ea[t.strokeColor]??"black",richText:(0,r.TP3)(t.text),textAlign:eh[t.textAlign]}});break}case"image":{let n=o[t.fileId];if(!n)break;let i=r.Kx3.createId();s.assets.push({id:i,typeName:"asset",type:"image",props:{w:t.width,h:t.height,fileSize:n.size,name:t.id??"Untitled",isAnimated:!1,mimeType:n.mimeType,src:n.dataURL},meta:{}}),s.shapes.push({...f,type:"image",props:{...e.getShapeUtil("image").getDefaultProps(),w:t.width,h:t.height,assetId:i}})}}p=(0,r.AQy)(p)}let f=n??(e.inputs.getShiftKey()?e.inputs.getCurrentPagePoint():void 0);for(let t of(e.putContentOntoCurrentPage(s,{point:f,select:!1,preserveIds:!0}),a.values()))if(t.length>1){e.groupShapes(t);let n=e.getShape(t[0]);n?.parentId&&(0,r.vc4)(n.parentId)&&h.push(n.parentId)}for(let[t,n]of l)e.select(t),e.rotateShapesBy([t],n);let g=(0,r.oE7)(h.map(t=>e.getShape(t))),m=r.azJ.Common(g.map(t=>e.getShapePageBounds(t))),y=e.getViewportPageBounds().center;e.updateShapes(g.map(e=>{let t={x:(e.x??0)-(m.x+m.w/2),y:(e.y??0)-(m.y+m.h/2)};return{id:e.id,type:e.type,x:y.x+t.x,y:y.y+t.y}})),e.setSelectedShapes(h)}let et=e=>{let t=e/100;return t<.2?.1:t<.4?.25:t<.6?.5:t<.8?.75:1},en={1:"s",2:"m",3:"l",4:"xl"},er={16:"s",20:"m",28:"l",36:"xl"},ei={1:"draw",2:"sans",3:"mono"},eo={gray:["#f8f9fa","#e9ecef","#ced4da","#868e96","#343a40"],red:["#fff5f5","#ffc9c9","#ff8787","#fa5252","#e03131"],pink:["#fff0f6","#fcc2d7","#f783ac","#e64980","#c2255c"],grape:["#f8f0fc","#eebefa","#da77f2","#be4bdb","#9c36b5"],violet:["#f3f0ff","#d0bfff","#9775fa","#7950f2","#6741d9"],indigo:["#edf2ff","#bac8ff","#748ffc","#4c6ef5","#3b5bdb"],blue:["#e7f5ff","#a5d8ff","#4dabf7","#228be6","#1971c2"],cyan:["#e3fafc","#99e9f2","#3bc9db","#15aabf","#0c8599"],teal:["#e6fcf5","#96f2d7","#38d9a9","#12b886","#099268"],green:["#ebfbee","#b2f2bb","#69db7c","#40c057","#2f9e44"],lime:["#f4fce3","#d8f5a2","#a9e34b","#82c91e","#66a80f"],yellow:["#fff9db","#ffec99","#ffd43b","#fab005","#f08c00"],orange:["#fff4e6","#ffd8a8","#ffa94d","#fd7e14","#e8590c"]};function es(e,t,n){return Object.fromEntries([0,1,2,3,4].map(t=>eo[e][t]).map((e,r)=>[e,r<3?t:n]))}let ea={...es("gray","grey","black"),...es("red","light-red","red"),...es("pink","light-red","red"),...es("grape","light-violet","violet"),...es("blue","light-blue","blue"),...es("cyan","light-blue","blue"),...es("teal","light-green","green"),...es("green","light-green","green"),...es("yellow","yellow","orange"),...es("orange","yellow","orange"),"#ffffff":"white","#000000":"black"},el={solid:"draw",dashed:"dashed",dotted:"dotted"},ed={"cross-hatch":"pattern",hachure:"pattern",solid:"solid"},ec={left:"start",center:"middle",right:"end"},eh={left:"start",center:"middle",right:"end"},eu={arrow:"arrow",dot:"dot",triangle:"triangle",bar:"pipe"},ep=e=>{let t=el[e.strokeStyle]??"draw";return"draw"===t&&0===e.roughness&&(t="solid"),t},ef=e=>"transparent"===e.backgroundColor?"none":ed[e.fillStyle]??"solid";var eg=n(82159);let em=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&"`"===e[t.index-1]?null:{index:t.index,text:t[0],replaceWith:t[1]}},ey=e=>{let t,n=/`([^`]+)`(?!`)/g,r=[];for(;null!==(t=n.exec(e));)t.index>0&&"`"===e[t.index-1]||r.push({index:t.index,text:t[0],replaceWith:t[1]});return r},eb=eg.CU.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",(0,eg.KV)(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,eg.OX)({find:em,type:this.type})]},addPasteRules(){return[(0,eg.Zc)({find:ey,type:this.type})]}}),ex=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,ew=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ev=eg.CU.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||(0,eg.hs)(e,"background-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",(0,eg.KV)(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[(0,eg.OX)({find:ex,type:this.type})]},addPasteRules(){return[(0,eg.Zc)({find:ew,type:this.type})]}});var eS=n(27050),eC=n(76865);let ek=new WeakSet,eP=new WeakSet;function eT(e){return ek.add(e),e}function eE(e){return Array.isArray(e)&&ek.has(e)}let eI=(e,t)=>(function(e,t){if("slot"===e)return 0;if(e instanceof Function){let n=e(t);return!Array.isArray(n)||eE(n)||eP.has(n)?n:eT(n)}let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(eE(n))return eT([e,r,n]);if(0===n.length)return eT([e,r]);let t=function e(t){return t.flatMap(t=>null==t?[]:Array.isArray(t)&&eP.has(t)&&!eE(t)?e(t):[t])}(n);return 0===t.length?eT([e,r]):eT([e,r,...t])}return null!=n?eT([e,r,n]):eT([e,r])})(e,t),e_=/^\s*>\s$/,eM=eg.bP.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return eI("blockquote",{...(0,eg.KV)(this.options.HTMLAttributes,e),children:eI("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,o;let s=(null!=(i=null==(o=t.renderChild)?void 0:o.call(t,e,r))?i:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join(`
|
|
5
5
|
>
|
|
6
6
|
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>((e,t)=>{var n;let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:o}=i;if(0!==o.parentOffset)return!1;let s=o.depth-1;if(s<0)return!1;let a=o.node(s),l=o.index(s);if(0===l)return!1;if(a.type===t)return e.commands.lift(t.name);let d=a.child(l-1);if(d.type!==t||!(null==(n=d.lastChild)?void 0:n.isTextblock))return!1;let c=o.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=o.parent.content,r=new eS.Ji(n,0,0);return e.replace(c,o.after(),r),e.setSelection(eC.U3.create(e.doc,c+n.size)),e.scrollIntoView(),t(e),!0})})(this.editor,this.type)}},addInputRules(){return[(0,eg.tG)({find:e_,type:this.type})]}}),eA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ej=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,eO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,eD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,eL=eg.CU.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return eI("strong",{...(0,eg.KV)(this.options.HTMLAttributes,e),children:eI("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[(0,eg.OX)({find:eA,type:this.type}),(0,eg.OX)({find:eO,type:this.type})]},addPasteRules(){return[(0,eg.Zc)({find:ej,type:this.type}),(0,eg.Zc)({find:eD,type:this.type})]}}),eR=/^```([a-z]+)?[\s\n]$/,eF=/^~~~([a-z]+)?[\s\n]$/,ez=eg.bP.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",(0,eg.KV)(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
|
|
7
7
|
|