var FW=Object.defineProperty;var BW=(e,t,n)=>t in e?FW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var F=(e,t,n)=>(BW(e,typeof t!="symbol"?t+"":t,n),n);function zW(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();var va=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dxe(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var NL={exports:{}},E6={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var HW=Symbol.for("react.transitional.element"),VW=Symbol.for("react.fragment");function OL(e,t,n){var i=null;if(n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:HW,type:e,key:i,ref:t!==void 0?t:null,props:n}}E6.Fragment=VW;E6.jsx=OL;E6.jsxs=OL;NL.exports=E6;var Y4=NL.exports;const he=Y4.Fragment,g=Y4.jsx,P=Y4.jsxs;var PL={exports:{}},je={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var W4=Symbol.for("react.transitional.element"),$W=Symbol.for("react.portal"),GW=Symbol.for("react.fragment"),XW=Symbol.for("react.strict_mode"),jW=Symbol.for("react.profiler"),YW=Symbol.for("react.consumer"),WW=Symbol.for("react.context"),KW=Symbol.for("react.forward_ref"),ZW=Symbol.for("react.suspense"),qW=Symbol.for("react.memo"),FL=Symbol.for("react.lazy"),gS=Symbol.iterator;function QW(e){return e===null||typeof e!="object"?null:(e=gS&&e[gS]||e["@@iterator"],typeof e=="function"?e:null)}var BL={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zL=Object.assign,HL={};function Gh(e,t,n){this.props=e,this.context=t,this.refs=HL,this.updater=n||BL}Gh.prototype.isReactComponent={};Gh.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Gh.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function VL(){}VL.prototype=Gh.prototype;function K4(e,t,n){this.props=e,this.context=t,this.refs=HL,this.updater=n||BL}var Z4=K4.prototype=new VL;Z4.constructor=K4;zL(Z4,Gh.prototype);Z4.isPureReactComponent=!0;var mS=Array.isArray,un={H:null,A:null,T:null,S:null},$L=Object.prototype.hasOwnProperty;function q4(e,t,n,i,r,s){return n=s.ref,{$$typeof:W4,type:e,key:t,ref:n!==void 0?n:null,props:s}}function JW(e,t){return q4(e.type,t,void 0,void 0,void 0,e.props)}function Q4(e){return typeof e=="object"&&e!==null&&e.$$typeof===W4}function eK(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pS=/\/+/g;function Sy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?eK(""+e.key):t.toString(36)}function US(){}function tK(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(US,US):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function rf(e,t,n,i,r){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case W4:case $W:o=!0;break;case FL:return o=e._init,rf(o(e._payload),t,n,i,r)}}if(o)return r=r(e),o=i===""?"."+Sy(e,0):i,mS(r)?(n="",o!=null&&(n=o.replace(pS,"$&/")+"/"),rf(r,t,n,"",function(c){return c})):r!=null&&(Q4(r)&&(r=JW(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(pS,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=i===""?".":i+":";if(mS(e))for(var l=0;l<e.length;l++)i=e[l],s=a+Sy(i,l),o+=rf(i,t,n,s,r);else if(l=QW(e),typeof l=="function")for(e=l.call(e),l=0;!(i=e.next()).done;)i=i.value,s=a+Sy(i,l++),o+=rf(i,t,n,s,r);else if(s==="object"){if(typeof e.then=="function")return rf(tK(e),t,n,i,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function Ip(e,t,n){if(e==null)return e;var i=[],r=0;return rf(e,i,"","",function(s){return t.call(n,s,r++)}),i}function nK(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var bS=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function iK(){}je.Children={map:Ip,forEach:function(e,t,n){Ip(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ip(e,function(){t++}),t},toArray:function(e){return Ip(e,function(t){return t})||[]},only:function(e){if(!Q4(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};je.Component=Gh;je.Fragment=GW;je.Profiler=jW;je.PureComponent=K4;je.StrictMode=XW;je.Suspense=ZW;je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=un;je.act=function(){throw Error("act(...) is not supported in production builds of React.")};je.cache=function(e){return function(){return e.apply(null,arguments)}};je.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var i=zL({},e.props),r=e.key,s=void 0;if(t!=null)for(o in t.ref!==void 0&&(s=void 0),t.key!==void 0&&(r=""+t.key),t)!$L.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(i[o]=t[o]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];i.children=a}return q4(e.type,r,void 0,void 0,s,i)};je.createContext=function(e){return e={$$typeof:WW,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:YW,_context:e},e};je.createElement=function(e,t,n){var i,r={},s=null;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)$L.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(r[i]=t[i]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];r.children=a}if(e&&e.defaultProps)for(i in o=e.defaultProps,o)r[i]===void 0&&(r[i]=o[i]);return q4(e,s,void 0,void 0,null,r)};je.createRef=function(){return{current:null}};je.forwardRef=function(e){return{$$typeof:KW,render:e}};je.isValidElement=Q4;je.lazy=function(e){return{$$typeof:FL,_payload:{_status:-1,_result:e},_init:nK}};je.memo=function(e,t){return{$$typeof:qW,type:e,compare:t===void 0?null:t}};je.startTransition=function(e){var t=un.T,n={};un.T=n;try{var i=e(),r=un.S;r!==null&&r(n,i),typeof i=="object"&&i!==null&&typeof i.then=="function"&&i.then(iK,bS)}catch(s){bS(s)}finally{un.T=t}};je.unstable_useCacheRefresh=function(){return un.H.useCacheRefresh()};je.use=function(e){return un.H.use(e)};je.useActionState=function(e,t,n){return un.H.useActionState(e,t,n)};je.useCallback=function(e,t){return un.H.useCallback(e,t)};je.useContext=function(e){return un.H.useContext(e)};je.useDebugValue=function(){};je.useDeferredValue=function(e,t){return un.H.useDeferredValue(e,t)};je.useEffect=function(e,t){return un.H.useEffect(e,t)};je.useId=function(){return un.H.useId()};je.useImperativeHandle=function(e,t,n){return un.H.useImperativeHandle(e,t,n)};je.useInsertionEffect=function(e,t){return un.H.useInsertionEffect(e,t)};je.useLayoutEffect=function(e,t){return un.H.useLayoutEffect(e,t)};je.useMemo=function(e,t){return un.H.useMemo(e,t)};je.useOptimistic=function(e,t){return un.H.useOptimistic(e,t)};je.useReducer=function(e,t,n){return un.H.useReducer(e,t,n)};je.useRef=function(e){return un.H.useRef(e)};je.useState=function(e){return un.H.useState(e)};je.useSyncExternalStore=function(e,t,n){return un.H.useSyncExternalStore(e,t,n)};je.useTransition=function(){return un.H.useTransition()};je.version="19.0.0";PL.exports=je;var M=PL.exports;const se=sl(M),GL=zW({__proto__:null,default:se},[M]);var XL={exports:{}},v6={},jL={exports:{}},YL={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(H,$){var j=H.length;H.push($);e:for(;0<j;){var X=j-1>>>1,Y=H[X];if(0<r(Y,$))H[X]=$,H[j]=Y,j=X;else break e}}function n(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var $=H[0],j=H.pop();if(j!==$){H[0]=j;e:for(var X=0,Y=H.length,le=Y>>>1;X<le;){var pe=2*(X+1)-1,ae=H[pe],ze=pe+1,Xe=H[ze];if(0>r(ae,j))ze<Y&&0>r(Xe,ae)?(H[X]=Xe,H[ze]=j,X=ze):(H[X]=ae,H[pe]=j,X=pe);else if(ze<Y&&0>r(Xe,j))H[X]=Xe,H[ze]=j,X=ze;else break e}}return $}function r(H,$){var j=H.sortIndex-$.sortIndex;return j!==0?j:H.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,f=3,h=!1,m=!1,p=!1,b=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function v(H){for(var $=n(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=H)i(c),$.sortIndex=$.expirationTime,t(l,$);else break;$=n(c)}}function _(H){if(p=!1,v(H),!m)if(n(l)!==null)m=!0,G();else{var $=n(c);$!==null&&V(_,$.startTime-H)}}var I=!1,R=-1,w=5,T=-1;function A(){return!(e.unstable_now()-T<w)}function S(){if(I){var H=e.unstable_now();T=H;var $=!0;try{e:{m=!1,p&&(p=!1,E(R),R=-1),h=!0;var j=f;try{t:{for(v(H),d=n(l);d!==null&&!(d.expirationTime>H&&A());){var X=d.callback;if(typeof X=="function"){d.callback=null,f=d.priorityLevel;var Y=X(d.expirationTime<=H);if(H=e.unstable_now(),typeof Y=="function"){d.callback=Y,v(H),$=!0;break t}d===n(l)&&i(l),v(H)}else i(l);d=n(l)}if(d!==null)$=!0;else{var le=n(c);le!==null&&V(_,le.startTime-H),$=!1}}break e}finally{d=null,f=j,h=!1}$=void 0}}finally{$?k():I=!1}}}var k;if(typeof y=="function")k=function(){y(S)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,D=N.port2;N.port1.onmessage=S,k=function(){D.postMessage(null)}}else k=function(){b(S,0)};function G(){I||(I=!0,k())}function V(H,$){R=b(function(){H(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_continueExecution=function(){m||h||(m=!0,G())},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(H){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var j=f;f=$;try{return H()}finally{f=j}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,$){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var j=f;f=H;try{return $()}finally{f=j}},e.unstable_scheduleCallback=function(H,$,j){var X=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?X+j:X):j=X,H){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=j+Y,H={id:u++,callback:$,priorityLevel:H,startTime:j,expirationTime:Y,sortIndex:-1},j>X?(H.sortIndex=j,t(c,H),n(l)===null&&H===n(c)&&(p?(E(R),R=-1):p=!0,V(_,j-X))):(H.sortIndex=Y,t(l,H),m||h||(m=!0,G())),H},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(H){var $=f;return function(){var j=f;f=$;try{return H.apply(this,arguments)}finally{f=j}}}})(YL);jL.exports=YL;var rK=jL.exports,WL={exports:{}},nr={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var sK=M;function KL(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function gl(){}var Ki={d:{f:gl,r:function(){throw Error(KL(522))},D:gl,C:gl,L:gl,m:gl,X:gl,S:gl,M:gl},p:0,findDOMNode:null},oK=Symbol.for("react.portal");function aK(e,t,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:oK,key:i==null?null:""+i,children:e,containerInfo:t,implementation:n}}var Sg=sK.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function _6(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}nr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ki;nr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(KL(299));return aK(e,t,null,n)};nr.flushSync=function(e){var t=Sg.T,n=Ki.p;try{if(Sg.T=null,Ki.p=2,e)return e()}finally{Sg.T=t,Ki.p=n,Ki.d.f()}};nr.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ki.d.C(e,t))};nr.prefetchDNS=function(e){typeof e=="string"&&Ki.d.D(e)};nr.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,i=_6(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,s=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Ki.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:i,integrity:r,fetchPriority:s}):n==="script"&&Ki.d.X(e,{crossOrigin:i,integrity:r,fetchPriority:s,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};nr.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=_6(t.as,t.crossOrigin);Ki.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Ki.d.M(e)};nr.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,i=_6(n,t.crossOrigin);Ki.d.L(e,n,{crossOrigin:i,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};nr.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=_6(t.as,t.crossOrigin);Ki.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Ki.d.m(e)};nr.requestFormReset=function(e){Ki.d.r(e)};nr.unstable_batchedUpdates=function(e,t){return e(t)};nr.useFormState=function(e,t,n){return Sg.H.useFormState(e,t,n)};nr.useFormStatus=function(){return Sg.H.useHostTransitionStatus()};nr.version="19.0.0";function ZL(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ZL)}catch(e){console.error(e)}}ZL(),WL.exports=nr;var Xn=WL.exports;const lK=sl(Xn);/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var qn=rK,qL=M,cK=Xn;function ne(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function QL(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}var uK=Symbol.for("react.element"),xp=Symbol.for("react.transitional.element"),ng=Symbol.for("react.portal"),Uf=Symbol.for("react.fragment"),JL=Symbol.for("react.strict_mode"),$7=Symbol.for("react.profiler"),dK=Symbol.for("react.provider"),eD=Symbol.for("react.consumer"),_a=Symbol.for("react.context"),J4=Symbol.for("react.forward_ref"),G7=Symbol.for("react.suspense"),X7=Symbol.for("react.suspense_list"),ev=Symbol.for("react.memo"),Tl=Symbol.for("react.lazy"),tD=Symbol.for("react.offscreen"),fK=Symbol.for("react.memo_cache_sentinel"),yS=Symbol.iterator;function x1(e){return e===null||typeof e!="object"?null:(e=yS&&e[yS]||e["@@iterator"],typeof e=="function"?e:null)}var hK=Symbol.for("react.client.reference");function j7(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===hK?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Uf:return"Fragment";case ng:return"Portal";case $7:return"Profiler";case JL:return"StrictMode";case G7:return"Suspense";case X7:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _a:return(e.displayName||"Context")+".Provider";case eD:return(e._context.displayName||"Context")+".Consumer";case J4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ev:return t=e.displayName||null,t!==null?t:j7(e.type)||"Memo";case Tl:t=e._payload,e=e._init;try{return j7(e(t))}catch{}}return null}var Ge=qL.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Zt=Object.assign,Iy,ES;function ig(e){if(Iy===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Iy=t&&t[1]||"",ES=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Iy+e+ES}var xy=!1;function Cy(e,t){if(!e||xy)return"";xy=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(h){var f=h}Reflect.construct(e,[],d)}else{try{d.call()}catch(h){f=h}e.call(d.prototype)}}else{try{throw Error()}catch(h){f=h}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(h){if(h&&f&&typeof h.stack=="string")return[h.stack,f.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=i.DetermineComponentFrameRoot(),o=s[0],a=s[1];if(o&&a){var l=o.split(`
`),c=a.split(`
`);for(r=i=0;i<l.length&&!l[i].includes("DetermineComponentFrameRoot");)i++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(i===l.length||r===c.length)for(i=l.length-1,r=c.length-1;1<=i&&0<=r&&l[i]!==c[r];)r--;for(;1<=i&&0<=r;i--,r--)if(l[i]!==c[r]){if(i!==1||r!==1)do if(i--,r--,0>r||l[i]!==c[r]){var u=`
`+l[i].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=i&&0<=r);break}}}finally{xy=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ig(n):""}function gK(e){switch(e.tag){case 26:case 27:case 5:return ig(e.type);case 16:return ig("Lazy");case 13:return ig("Suspense");case 19:return ig("SuspenseList");case 0:case 15:return e=Cy(e.type,!1),e;case 11:return e=Cy(e.type.render,!1),e;case 1:return e=Cy(e.type,!0),e;default:return""}}function vS(e){try{var t="";do t+=gK(e),e=e.return;while(e);return t}catch(n){return`
Error generating stack: `+n.message+`
`+n.stack}}function Xh(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function nD(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function _S(e){if(Xh(e)!==e)throw Error(ne(188))}function mK(e){var t=e.alternate;if(!t){if(t=Xh(e),t===null)throw Error(ne(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){n=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===n)return _S(r),e;if(s===i)return _S(r),t;s=s.sibling}throw Error(ne(188))}if(n.return!==i.return)n=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,i=s;break}if(a===i){o=!0,i=r,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,i=r;break}if(a===i){o=!0,i=s,n=r;break}a=a.sibling}if(!o)throw Error(ne(189))}}if(n.alternate!==i)throw Error(ne(190))}if(n.tag!==3)throw Error(ne(188));return n.stateNode.current===n?e:t}function iD(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=iD(e),t!==null)return t;e=e.sibling}return null}var rg=Array.isArray,Kt=cK.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Iu={pending:!1,data:null,method:null,action:null},Y7=[],bf=-1;function Yo(e){return{current:e}}function ci(e){0>bf||(e.current=Y7[bf],Y7[bf]=null,bf--)}function sn(e,t){bf++,Y7[bf]=e.current,e.current=t}var Ro=Yo(null),g0=Yo(null),Yl=Yo(null),v2=Yo(null);function _2(e,t){switch(sn(Yl,t),sn(g0,e),sn(Ro,null),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)&&(t=t.namespaceURI)?wI(t):0;break;default:if(e=e===8?t.parentNode:t,t=e.tagName,e=e.namespaceURI)e=wI(e),t=mO(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ci(Ro),sn(Ro,t)}function rh(){ci(Ro),ci(g0),ci(Yl)}function W7(e){e.memoizedState!==null&&sn(v2,e);var t=Ro.current,n=mO(t,e.type);t!==n&&(sn(g0,e),sn(Ro,n))}function w2(e){g0.current===e&&(ci(Ro),ci(g0)),v2.current===e&&(ci(v2),S0._currentValue=Iu)}var K7=Object.prototype.hasOwnProperty,tv=qn.unstable_scheduleCallback,Ay=qn.unstable_cancelCallback,pK=qn.unstable_shouldYield,UK=qn.unstable_requestPaint,ko=qn.unstable_now,bK=qn.unstable_getCurrentPriorityLevel,rD=qn.unstable_ImmediatePriority,sD=qn.unstable_UserBlockingPriority,T2=qn.unstable_NormalPriority,yK=qn.unstable_LowPriority,oD=qn.unstable_IdlePriority,EK=qn.log,vK=qn.unstable_setDisableYieldValue,_m=null,Lr=null;function _K(e){if(Lr&&typeof Lr.onCommitFiberRoot=="function")try{Lr.onCommitFiberRoot(_m,e,void 0,(e.current.flags&128)===128)}catch{}}function Pl(e){if(typeof EK=="function"&&vK(e),Lr&&typeof Lr.setStrictMode=="function")try{Lr.setStrictMode(_m,e)}catch{}}var Dr=Math.clz32?Math.clz32:SK,wK=Math.log,TK=Math.LN2;function SK(e){return e>>>=0,e===0?32:31-(wK(e)/TK|0)|0}var Cp=128,Ap=4194304;function Qc(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function w6(e,t){var n=e.pendingLanes;if(n===0)return 0;var i=0,r=e.suspendedLanes,s=e.pingedLanes,o=e.warmLanes;e=e.finishedLanes!==0;var a=n&134217727;return a!==0?(n=a&~r,n!==0?i=Qc(n):(s&=a,s!==0?i=Qc(s):e||(o=a&~o,o!==0&&(i=Qc(o))))):(a=n&~r,a!==0?i=Qc(a):s!==0?i=Qc(s):e||(o=n&~o,o!==0&&(i=Qc(o)))),i===0?0:t!==0&&t!==i&&!(t&r)&&(r=i&-i,o=t&-t,r>=o||r===32&&(o&4194176)!==0)?t:i}function wm(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function IK(e,t){switch(e){case 1:case 2:case 4:case 8:return t+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function aD(){var e=Cp;return Cp<<=1,!(Cp&4194176)&&(Cp=128),e}function lD(){var e=Ap;return Ap<<=1,!(Ap&62914560)&&(Ap=4194304),e}function My(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Tm(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xK(e,t,n,i,r,s){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var a=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Dr(n),d=1<<u;a[u]=0,l[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var h=f[u];h!==null&&(h.lane&=-536870913)}n&=~d}i!==0&&cD(e,i,0),s!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=s&~(o&~t))}function cD(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Dr(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&4194218}function uD(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Dr(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}function dD(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function fD(){var e=Kt.p;return e!==0?e:(e=window.event,e===void 0?32:SO(e.type))}function CK(e,t){var n=Kt.p;try{return Kt.p=e,t()}finally{Kt.p=n}}var Dc=Math.random().toString(36).slice(2),Oi="__reactFiber$"+Dc,br="__reactProps$"+Dc,jh="__reactContainer$"+Dc,Z7="__reactEvents$"+Dc,AK="__reactListeners$"+Dc,MK="__reactHandles$"+Dc,wS="__reactResources$"+Dc,m0="__reactMarker$"+Dc;function nv(e){delete e[Oi],delete e[br],delete e[Z7],delete e[AK],delete e[MK]}function hu(e){var t=e[Oi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[jh]||n[Oi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=SI(e);e!==null;){if(n=e[Oi])return n;e=SI(e)}return t}e=n,n=e.parentNode}return null}function Yh(e){if(e=e[Oi]||e[jh]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function sg(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(ne(33))}function zf(e){var t=e[wS];return t||(t=e[wS]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ri(e){e[m0]=!0}var hD=new Set,gD={};function yd(e,t){sh(e,t),sh(e+"Capture",t)}function sh(e,t){for(gD[e]=t,e=0;e<t.length;e++)hD.add(t[e])}var Pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),RK=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),TS={},SS={};function kK(e){return K7.call(SS,e)?!0:K7.call(TS,e)?!1:RK.test(e)?SS[e]=!0:(TS[e]=!0,!1)}function MU(e,t,n){if(kK(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Mp(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function ta(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function Zr(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mD(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function LK(e){var t=mD(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function S2(e){e._valueTracker||(e._valueTracker=LK(e))}function pD(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=mD(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function I2(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var DK=/[\n"\\]/g;function Jr(e){return e.replace(DK,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function q7(e,t,n,i,r,s,o,a){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zr(t)):e.value!==""+Zr(t)&&(e.value=""+Zr(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Q7(e,o,Zr(t)):n!=null?Q7(e,o,Zr(n)):i!=null&&e.removeAttribute("value"),r==null&&s!=null&&(e.defaultChecked=!!s),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Zr(a):e.removeAttribute("name")}function UD(e,t,n,i,r,s,o,a){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null))return;n=n!=null?""+Zr(n):"",t=t!=null?""+Zr(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}i=i??r,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=a?e.checked:!!i,e.defaultChecked=!!i,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o)}function Q7(e,t,n){t==="number"&&I2(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Hf(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Zr(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,i&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function bD(e,t,n){if(t!=null&&(t=""+Zr(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zr(n):""}function yD(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(ne(92));if(rg(i)){if(1<i.length)throw Error(ne(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Zr(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i)}function oh(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var NK=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function IS(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||NK.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function ED(e,t,n){if(t!=null&&typeof t!="object")throw Error(ne(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var r in t)i=t[r],t.hasOwnProperty(r)&&n[r]!==i&&IS(e,r,i)}else for(var s in t)t.hasOwnProperty(s)&&IS(e,s,t[s])}function iv(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var OK=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),PK=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function RU(e){return PK.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var J7=null;function rv(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yf=null,Vf=null;function xS(e){var t=Yh(e);if(t&&(e=t.stateNode)){var n=e[br]||null;e:switch(e=t.stateNode,t.type){case"input":if(q7(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Jr(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var r=i[br]||null;if(!r)throw Error(ne(90));q7(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&pD(i)}break e;case"textarea":bD(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Hf(e,!!n.multiple,t,!1)}}}var Ry=!1;function vD(e,t,n){if(Ry)return e(t,n);Ry=!0;try{var i=e(t);return i}finally{if(Ry=!1,(yf!==null||Vf!==null)&&(L6(),yf&&(t=yf,e=Vf,Vf=yf=null,xS(t),e)))for(t=0;t<e.length;t++)xS(e[t])}}function p0(e,t){var n=e.stateNode;if(n===null)return null;var i=n[br]||null;if(i===null)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ne(231,t,typeof n));return n}var e3=!1;if(Pa)try{var C1={};Object.defineProperty(C1,"passive",{get:function(){e3=!0}}),window.addEventListener("test",C1,C1),window.removeEventListener("test",C1,C1)}catch{e3=!1}var Fl=null,sv=null,kU=null;function _D(){if(kU)return kU;var e,t=sv,n=t.length,i,r="value"in Fl?Fl.value:Fl.textContent,s=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(i=1;i<=o&&t[n-i]===r[s-i];i++);return kU=r.slice(e,1<i?1-i:void 0)}function LU(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Rp(){return!0}function CS(){return!1}function yr(e){function t(n,i,r,s,o){this._reactName=n,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Rp:CS,this.isPropagationStopped=CS,this}return Zt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Rp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Rp)},persist:function(){},isPersistent:Rp}),t}var Ed={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},T6=yr(Ed),Sm=Zt({},Ed,{view:0,detail:0}),FK=yr(Sm),ky,Ly,A1,S6=Zt({},Sm,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ov,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==A1&&(A1&&e.type==="mousemove"?(ky=e.screenX-A1.screenX,Ly=e.screenY-A1.screenY):Ly=ky=0,A1=e),ky)},movementY:function(e){return"movementY"in e?e.movementY:Ly}}),AS=yr(S6),BK=Zt({},S6,{dataTransfer:0}),zK=yr(BK),HK=Zt({},Sm,{relatedTarget:0}),Dy=yr(HK),VK=Zt({},Ed,{animationName:0,elapsedTime:0,pseudoElement:0}),$K=yr(VK),GK=Zt({},Ed,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),XK=yr(GK),jK=Zt({},Ed,{data:0}),MS=yr(jK),YK={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WK={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},KK={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ZK(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=KK[e])?!!t[e]:!1}function ov(){return ZK}var qK=Zt({},Sm,{key:function(e){if(e.key){var t=YK[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=LU(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?WK[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ov,charCode:function(e){return e.type==="keypress"?LU(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?LU(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),QK=yr(qK),JK=Zt({},S6,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),RS=yr(JK),eZ=Zt({},Sm,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ov}),tZ=yr(eZ),nZ=Zt({},Ed,{propertyName:0,elapsedTime:0,pseudoElement:0}),iZ=yr(nZ),rZ=Zt({},S6,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),sZ=yr(rZ),oZ=Zt({},Ed,{newState:0,oldState:0}),aZ=yr(oZ),lZ=[9,13,27,32],av=Pa&&"CompositionEvent"in window,Ig=null;Pa&&"documentMode"in document&&(Ig=document.documentMode);var cZ=Pa&&"TextEvent"in window&&!Ig,wD=Pa&&(!av||Ig&&8<Ig&&11>=Ig),kS=" ",LS=!1;function TD(e,t){switch(e){case"keyup":return lZ.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function SD(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ef=!1;function uZ(e,t){switch(e){case"compositionend":return SD(t);case"keypress":return t.which!==32?null:(LS=!0,kS);case"textInput":return e=t.data,e===kS&&LS?null:e;default:return null}}function dZ(e,t){if(Ef)return e==="compositionend"||!av&&TD(e,t)?(e=_D(),kU=sv=Fl=null,Ef=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return wD&&t.locale!=="ko"?null:t.data;default:return null}}var fZ={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function DS(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!fZ[e.type]:t==="textarea"}function ID(e,t,n,i){yf?Vf?Vf.push(i):Vf=[i]:yf=i,t=V2(t,"onChange"),0<t.length&&(n=new T6("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var xg=null,U0=null;function hZ(e){fO(e,0)}function I6(e){var t=sg(e);if(pD(t))return e}function NS(e,t){if(e==="change")return t}var xD=!1;if(Pa){var Ny;if(Pa){var Oy="oninput"in document;if(!Oy){var OS=document.createElement("div");OS.setAttribute("oninput","return;"),Oy=typeof OS.oninput=="function"}Ny=Oy}else Ny=!1;xD=Ny&&(!document.documentMode||9<document.documentMode)}function PS(){xg&&(xg.detachEvent("onpropertychange",CD),U0=xg=null)}function CD(e){if(e.propertyName==="value"&&I6(U0)){var t=[];ID(t,U0,e,rv(e)),vD(hZ,t)}}function gZ(e,t,n){e==="focusin"?(PS(),xg=t,U0=n,xg.attachEvent("onpropertychange",CD)):e==="focusout"&&PS()}function mZ(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return I6(U0)}function pZ(e,t){if(e==="click")return I6(t)}function UZ(e,t){if(e==="input"||e==="change")return I6(t)}function bZ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Fr=typeof Object.is=="function"?Object.is:bZ;function b0(e,t){if(Fr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!K7.call(t,r)||!Fr(e[r],t[r]))return!1}return!0}function FS(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function BS(e,t){var n=FS(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=FS(n)}}function AD(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?AD(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function MD(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=I2(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=I2(e.document)}return t}function lv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function yZ(e,t){var n=MD(t);t=e.focusedElem;var i=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&AD(t.ownerDocument.documentElement,t)){if(i!==null&&lv(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=BS(t,s);var o=BS(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var EZ=Pa&&"documentMode"in document&&11>=document.documentMode,vf=null,t3=null,Cg=null,n3=!1;function zS(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;n3||vf==null||vf!==I2(i)||(i=vf,"selectionStart"in i&&lv(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Cg&&b0(Cg,i)||(Cg=i,i=V2(t3,"onSelect"),0<i.length&&(t=new T6("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=vf)))}function Yc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _f={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionrun:Yc("Transition","TransitionRun"),transitionstart:Yc("Transition","TransitionStart"),transitioncancel:Yc("Transition","TransitionCancel"),transitionend:Yc("Transition","TransitionEnd")},Py={},RD={};Pa&&(RD=document.createElement("div").style,"AnimationEvent"in window||(delete _f.animationend.animation,delete _f.animationiteration.animation,delete _f.animationstart.animation),"TransitionEvent"in window||delete _f.transitionend.transition);function vd(e){if(Py[e])return Py[e];if(!_f[e])return e;var t=_f[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in RD)return Py[e]=t[n];return e}var kD=vd("animationend"),LD=vd("animationiteration"),DD=vd("animationstart"),vZ=vd("transitionrun"),_Z=vd("transitionstart"),wZ=vd("transitioncancel"),ND=vd("transitionend"),OD=new Map,HS="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll scrollEnd toggle touchMove waiting wheel".split(" ");function ro(e,t){OD.set(e,t),yd(t,[e])}var Wr=[],wf=0,cv=0;function x6(){for(var e=wf,t=cv=wf=0;t<e;){var n=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var s=Wr[t];if(Wr[t++]=null,i!==null&&r!==null){var o=i.pending;o===null?r.next=r:(r.next=o.next,o.next=r),i.pending=r}s!==0&&PD(n,r,s)}}function C6(e,t,n,i){Wr[wf++]=e,Wr[wf++]=t,Wr[wf++]=n,Wr[wf++]=i,cv|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function uv(e,t,n,i){return C6(e,t,n,i),x2(e)}function dc(e,t){return C6(e,null,null,t),x2(e)}function PD(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var r=!1,s=e.return;s!==null;)s.childLanes|=n,i=s.alternate,i!==null&&(i.childLanes|=n),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(r=!0)),e=s,s=s.return;r&&t!==null&&e.tag===3&&(s=e.stateNode,r=31-Dr(n),s=s.hiddenUpdates,e=s[r],e===null?s[r]=[t]:e.push(t),t.lane=n|536870912)}function x2(e){if(50<zg)throw zg=0,T3=null,Error(ne(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Tf={},VS=new WeakMap;function es(e,t){if(typeof e=="object"&&e!==null){var n=VS.get(e);return n!==void 0?n:(t={value:e,source:t,stack:vS(t)},VS.set(e,t),t)}return{value:e,source:t,stack:vS(t)}}var Sf=[],If=0,C2=null,A2=0,qr=[],Qr=0,xu=null,wa=1,Ta="";function Jc(e,t){Sf[If++]=A2,Sf[If++]=C2,C2=e,A2=t}function FD(e,t,n){qr[Qr++]=wa,qr[Qr++]=Ta,qr[Qr++]=xu,xu=e;var i=wa;e=Ta;var r=32-Dr(i)-1;i&=~(1<<r),n+=1;var s=32-Dr(t)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,wa=1<<32-Dr(t)+r|n<<r|i,Ta=s+e}else wa=1<<s|n<<r|i,Ta=e}function dv(e){e.return!==null&&(Jc(e,1),FD(e,1,0))}function fv(e){for(;e===C2;)C2=Sf[--If],Sf[If]=null,A2=Sf[--If],Sf[If]=null;for(;e===xu;)xu=qr[--Qr],qr[Qr]=null,Ta=qr[--Qr],qr[Qr]=null,wa=qr[--Qr],qr[Qr]=null}var Wi=null,yi=null,_t=!1,Rs=null,wo=!1,i3=Error(ne(519));function Vu(e){var t=Error(ne(418,""));throw y0(es(t,e)),i3}function $S(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[Oi]=e,t[br]=i,n){case"dialog":it("cancel",t),it("close",t);break;case"iframe":case"object":case"embed":it("load",t);break;case"video":case"audio":for(n=0;n<_0.length;n++)it(_0[n],t);break;case"source":it("error",t);break;case"img":case"image":case"link":it("error",t),it("load",t);break;case"details":it("toggle",t);break;case"input":it("invalid",t),UD(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0),S2(t);break;case"select":it("invalid",t);break;case"textarea":it("invalid",t),yD(t,i.value,i.defaultValue,i.children),S2(t)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||gO(t.textContent,n)?(i.popover!=null&&(it("beforetoggle",t),it("toggle",t)),i.onScroll!=null&&it("scroll",t),i.onScrollEnd!=null&&it("scrollend",t),i.onClick!=null&&(t.onclick=N6),t=!0):t=!1,t||Vu(e)}function GS(e){for(Wi=e.return;Wi;)switch(Wi.tag){case 3:case 27:wo=!0;return;case 5:case 13:wo=!1;return;default:Wi=Wi.return}}function M1(e){if(e!==Wi)return!1;if(!_t)return GS(e),_t=!0,!1;var t=!1,n;if((n=e.tag!==3&&e.tag!==27)&&((n=e.tag===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||R3(e.type,e.memoizedProps)),n=!n),n&&(t=!0),t&&yi&&Vu(e),GS(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){yi=Hs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}yi=null}}else yi=Wi?Hs(e.stateNode.nextSibling):null;return!0}function Im(){yi=Wi=null,_t=!1}function y0(e){Rs===null?Rs=[e]:Rs.push(e)}var Ag=Error(ne(460)),BD=Error(ne(474)),r3={then:function(){}};function XS(e){return e=e.status,e==="fulfilled"||e==="rejected"}function kp(){}function zD(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(kp,kp),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,e===Ag?Error(ne(483)):e;default:if(typeof t.status=="string")t.then(kp,kp);else{if(e=jt,e!==null&&100<e.shellSuspendCounter)throw Error(ne(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=i}},function(i){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,e===Ag?Error(ne(483)):e}throw Mg=t,Ag}}var Mg=null;function jS(){if(Mg===null)throw Error(ne(459));var e=Mg;return Mg=null,e}var $f=null,E0=0;function Lp(e){var t=E0;return E0+=1,$f===null&&($f=[]),zD($f,e,t)}function R1(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Dp(e,t){throw t.$$typeof===uK?Error(ne(525)):(e=Object.prototype.toString.call(t),Error(ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function YS(e){var t=e._init;return t(e._payload)}function HD(e){function t(E,y){if(e){var v=E.deletions;v===null?(E.deletions=[y],E.flags|=16):v.push(y)}}function n(E,y){if(!e)return null;for(;y!==null;)t(E,y),y=y.sibling;return null}function i(E){for(var y=new Map;E!==null;)E.key!==null?y.set(E.key,E):y.set(E.index,E),E=E.sibling;return y}function r(E,y){return E=Zl(E,y),E.index=0,E.sibling=null,E}function s(E,y,v){return E.index=v,e?(v=E.alternate,v!==null?(v=v.index,v<y?(E.flags|=33554434,y):v):(E.flags|=33554434,y)):(E.flags|=1048576,y)}function o(E){return e&&E.alternate===null&&(E.flags|=33554434),E}function a(E,y,v,_){return y===null||y.tag!==6?(y=Ky(v,E.mode,_),y.return=E,y):(y=r(y,v),y.return=E,y)}function l(E,y,v,_){var I=v.type;return I===Uf?u(E,y,v.props.children,_,v.key):y!==null&&(y.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Tl&&YS(I)===y.type)?(y=r(y,v.props),R1(y,v),y.return=E,y):(y=FU(v.type,v.key,v.props,null,E.mode,_),R1(y,v),y.return=E,y)}function c(E,y,v,_){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=Zy(v,E.mode,_),y.return=E,y):(y=r(y,v.children||[]),y.return=E,y)}function u(E,y,v,_,I){return y===null||y.tag!==7?(y=Au(v,E.mode,_,I),y.return=E,y):(y=r(y,v),y.return=E,y)}function d(E,y,v){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=Ky(""+y,E.mode,v),y.return=E,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case xp:return v=FU(y.type,y.key,y.props,null,E.mode,v),R1(v,y),v.return=E,v;case ng:return y=Zy(y,E.mode,v),y.return=E,y;case Tl:var _=y._init;return y=_(y._payload),d(E,y,v)}if(rg(y)||x1(y))return y=Au(y,E.mode,v,null),y.return=E,y;if(typeof y.then=="function")return d(E,Lp(y),v);if(y.$$typeof===_a)return d(E,Np(E,y),v);Dp(E,y)}return null}function f(E,y,v,_){var I=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return I!==null?null:a(E,y,""+v,_);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case xp:return v.key===I?l(E,y,v,_):null;case ng:return v.key===I?c(E,y,v,_):null;case Tl:return I=v._init,v=I(v._payload),f(E,y,v,_)}if(rg(v)||x1(v))return I!==null?null:u(E,y,v,_,null);if(typeof v.then=="function")return f(E,y,Lp(v),_);if(v.$$typeof===_a)return f(E,y,Np(E,v),_);Dp(E,v)}return null}function h(E,y,v,_,I){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return E=E.get(v)||null,a(y,E,""+_,I);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case xp:return E=E.get(_.key===null?v:_.key)||null,l(y,E,_,I);case ng:return E=E.get(_.key===null?v:_.key)||null,c(y,E,_,I);case Tl:var R=_._init;return _=R(_._payload),h(E,y,v,_,I)}if(rg(_)||x1(_))return E=E.get(v)||null,u(y,E,_,I,null);if(typeof _.then=="function")return h(E,y,v,Lp(_),I);if(_.$$typeof===_a)return h(E,y,v,Np(y,_),I);Dp(y,_)}return null}function m(E,y,v,_){for(var I=null,R=null,w=y,T=y=0,A=null;w!==null&&T<v.length;T++){w.index>T?(A=w,w=null):A=w.sibling;var S=f(E,w,v[T],_);if(S===null){w===null&&(w=A);break}e&&w&&S.alternate===null&&t(E,w),y=s(S,y,T),R===null?I=S:R.sibling=S,R=S,w=A}if(T===v.length)return n(E,w),_t&&Jc(E,T),I;if(w===null){for(;T<v.length;T++)w=d(E,v[T],_),w!==null&&(y=s(w,y,T),R===null?I=w:R.sibling=w,R=w);return _t&&Jc(E,T),I}for(w=i(w);T<v.length;T++)A=h(w,E,T,v[T],_),A!==null&&(e&&A.alternate!==null&&w.delete(A.key===null?T:A.key),y=s(A,y,T),R===null?I=A:R.sibling=A,R=A);return e&&w.forEach(function(k){return t(E,k)}),_t&&Jc(E,T),I}function p(E,y,v,_){if(v==null)throw Error(ne(151));for(var I=null,R=null,w=y,T=y=0,A=null,S=v.next();w!==null&&!S.done;T++,S=v.next()){w.index>T?(A=w,w=null):A=w.sibling;var k=f(E,w,S.value,_);if(k===null){w===null&&(w=A);break}e&&w&&k.alternate===null&&t(E,w),y=s(k,y,T),R===null?I=k:R.sibling=k,R=k,w=A}if(S.done)return n(E,w),_t&&Jc(E,T),I;if(w===null){for(;!S.done;T++,S=v.next())S=d(E,S.value,_),S!==null&&(y=s(S,y,T),R===null?I=S:R.sibling=S,R=S);return _t&&Jc(E,T),I}for(w=i(w);!S.done;T++,S=v.next())S=h(w,E,T,S.value,_),S!==null&&(e&&S.alternate!==null&&w.delete(S.key===null?T:S.key),y=s(S,y,T),R===null?I=S:R.sibling=S,R=S);return e&&w.forEach(function(N){return t(E,N)}),_t&&Jc(E,T),I}function b(E,y,v,_){if(typeof v=="object"&&v!==null&&v.type===Uf&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case xp:e:{for(var I=v.key;y!==null;){if(y.key===I){if(I=v.type,I===Uf){if(y.tag===7){n(E,y.sibling),_=r(y,v.props.children),_.return=E,E=_;break e}}else if(y.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Tl&&YS(I)===y.type){n(E,y.sibling),_=r(y,v.props),R1(_,v),_.return=E,E=_;break e}n(E,y);break}else t(E,y);y=y.sibling}v.type===Uf?(_=Au(v.props.children,E.mode,_,v.key),_.return=E,E=_):(_=FU(v.type,v.key,v.props,null,E.mode,_),R1(_,v),_.return=E,E=_)}return o(E);case ng:e:{for(I=v.key;y!==null;){if(y.key===I)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(E,y.sibling),_=r(y,v.children||[]),_.return=E,E=_;break e}else{n(E,y);break}else t(E,y);y=y.sibling}_=Zy(v,E.mode,_),_.return=E,E=_}return o(E);case Tl:return I=v._init,v=I(v._payload),b(E,y,v,_)}if(rg(v))return m(E,y,v,_);if(x1(v)){if(I=x1(v),typeof I!="function")throw Error(ne(150));return v=I.call(v),p(E,y,v,_)}if(typeof v.then=="function")return b(E,y,Lp(v),_);if(v.$$typeof===_a)return b(E,y,Np(E,v),_);Dp(E,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,y!==null&&y.tag===6?(n(E,y.sibling),_=r(y,v),_.return=E,E=_):(n(E,y),_=Ky(v,E.mode,_),_.return=E,E=_),o(E)):n(E,y)}return function(E,y,v,_){try{E0=0;var I=b(E,y,v,_);return $f=null,I}catch(w){if(w===Ag)throw w;var R=is(29,w,null,E.mode);return R.lanes=_,R.return=E,R}finally{}}}var $u=HD(!0),VD=HD(!1),ah=Yo(null),M2=Yo(0);function WS(e,t){e=za,sn(M2,e),sn(ah,t),za=e|t.baseLanes}function s3(){sn(M2,za),sn(ah,ah.current)}function hv(){za=M2.current,ci(ah),ci(M2)}var fs=Yo(null),Lo=null;function Ml(e){var t=e.alternate;sn(Yn,Yn.current&1),sn(fs,e),Lo===null&&(t===null||ah.current!==null||t.memoizedState!==null)&&(Lo=e)}function $D(e){if(e.tag===22){if(sn(Yn,Yn.current),sn(fs,e),Lo===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Lo=e)}}else Rl()}function Rl(){sn(Yn,Yn.current),sn(fs,fs.current)}function Sa(e){ci(fs),Lo===e&&(Lo=null),ci(Yn)}var Yn=Yo(0);function R2(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var TZ=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},SZ=qn.unstable_scheduleCallback,IZ=qn.unstable_NormalPriority,jn={$$typeof:_a,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gv(){return{controller:new TZ,data:new Map,refCount:0}}function xm(e){e.refCount--,e.refCount===0&&SZ(IZ,function(){e.controller.abort()})}var Rg=null,o3=0,lh=0,Gf=null;function xZ(e,t){if(Rg===null){var n=Rg=[];o3=0,lh=Pv(),Gf={status:"pending",value:void 0,then:function(i){n.push(i)}}}return o3++,t.then(KS,KS),t}function KS(){if(--o3===0&&Rg!==null){Gf!==null&&(Gf.status="fulfilled");var e=Rg;Rg=null,lh=0,Gf=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function CZ(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(i.status="rejected",i.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),i}var ZS=Ge.S;Ge.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&xZ(e,t),ZS!==null&&ZS(e,t)};var Cu=Yo(null);function mv(){var e=Cu.current;return e!==null?e:jt.pooledCache}function DU(e,t){t===null?sn(Cu,Cu.current):sn(Cu,t.pool)}function GD(){var e=mv();return e===null?null:{parent:jn._currentValue,pool:e}}var fc=0,We=null,Lt=null,Dn=null,k2=!1,Xf=!1,Gu=!1,L2=0,v0=0,jf=null,AZ=0;function wn(){throw Error(ne(321))}function pv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Fr(e[n],t[n]))return!1;return!0}function Uv(e,t,n,i,r,s){return fc=s,We=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ge.H=e===null||e.memoizedState===null?_d:Nc,Gu=!1,s=n(i,r),Gu=!1,Xf&&(s=jD(t,n,i,r)),XD(e),s}function XD(e){Ge.H=Po;var t=Lt!==null&&Lt.next!==null;if(fc=0,Dn=Lt=We=null,k2=!1,v0=0,jf=null,t)throw Error(ne(300));e===null||ai||(e=e.dependencies,e!==null&&O2(e)&&(ai=!0))}function jD(e,t,n,i){We=e;var r=0;do{if(Xf&&(jf=null),v0=0,Xf=!1,25<=r)throw Error(ne(301));if(r+=1,Dn=Lt=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}Ge.H=wd,s=t(n,i)}while(Xf);return s}function MZ(){var e=Ge.H,t=e.useState()[0];return t=typeof t.then=="function"?Cm(t):t,e=e.useState()[0],(Lt!==null?Lt.memoizedState:null)!==e&&(We.flags|=1024),t}function bv(){var e=L2!==0;return L2=0,e}function yv(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ev(e){if(k2){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}k2=!1}fc=0,Dn=Lt=We=null,Xf=!1,v0=L2=0,jf=null}function ar(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dn===null?We.memoizedState=Dn=e:Dn=Dn.next=e,Dn}function Pn(){if(Lt===null){var e=We.alternate;e=e!==null?e.memoizedState:null}else e=Lt.next;var t=Dn===null?We.memoizedState:Dn.next;if(t!==null)Dn=t,Lt=e;else{if(e===null)throw We.alternate===null?Error(ne(467)):Error(ne(310));Lt=e,e={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},Dn===null?We.memoizedState=Dn=e:Dn=Dn.next=e}return Dn}var A6;A6=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}};function Cm(e){var t=v0;return v0+=1,jf===null&&(jf=[]),e=zD(jf,e,t),t=We,(Dn===null?t.memoizedState:Dn.next)===null&&(t=t.alternate,Ge.H=t===null||t.memoizedState===null?_d:Nc),e}function M6(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Cm(e);if(e.$$typeof===_a)return Pi(e)}throw Error(ne(438,String(e)))}function vv(e){var t=null,n=We.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=We.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=A6(),We.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=fK;return t.index++,n}function Fa(e,t){return typeof t=="function"?t(e):t}function NU(e){var t=Pn();return _v(t,Lt,e)}function _v(e,t,n){var i=e.queue;if(i===null)throw Error(ne(311));i.lastRenderedReducer=n;var r=e.baseQueue,s=i.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}t.baseQueue=r=s,i.pending=null}if(s=e.baseState,r===null)e.memoizedState=s;else{t=r.next;var a=o=null,l=null,c=t,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(ft&d)===d:(fc&d)===d){var f=c.revertLane;if(f===0)l!==null&&(l=l.next={lane:0,revertLane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===lh&&(u=!0);else if((fc&f)===f){c=c.next,f===lh&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=d,o=s):l=l.next=d,We.lanes|=f,gc|=f;d=c.action,Gu&&n(s,d),s=c.hasEagerState?c.eagerState:n(s,d)}else f={lane:d,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=f,o=s):l=l.next=f,We.lanes|=d,gc|=d;c=c.next}while(c!==null&&c!==t);if(l===null?o=s:l.next=a,!Fr(s,e.memoizedState)&&(ai=!0,u&&(n=Gf,n!==null)))throw n;e.memoizedState=s,e.baseState=o,e.baseQueue=l,i.lastRenderedState=s}return r===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Fy(e){var t=Pn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var i=n.dispatch,r=n.pending,s=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do s=e(s,o.action),o=o.next;while(o!==r);Fr(s,t.memoizedState)||(ai=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,i]}function YD(e,t,n){var i=We,r=Pn(),s=_t;if(s){if(n===void 0)throw Error(ne(407));n=n()}else n=t();var o=!Fr((Lt||r).memoizedState,n);if(o&&(r.memoizedState=n,ai=!0),r=r.queue,wv(ZD.bind(null,i,r,e),[e]),r.getSnapshot!==t||o||Dn!==null&&Dn.memoizedState.tag&1){if(i.flags|=2048,ch(9,KD.bind(null,i,r,n,t),{destroy:void 0},null),jt===null)throw Error(ne(349));s||fc&60||WD(i,t,n)}return n}function WD(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=We.updateQueue,t===null?(t=A6(),We.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function KD(e,t,n,i){t.value=n,t.getSnapshot=i,qD(t)&&QD(e)}function ZD(e,t,n){return n(function(){qD(t)&&QD(e)})}function qD(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Fr(e,n)}catch{return!0}}function QD(e){var t=dc(e,2);t!==null&&Zi(t,e,2)}function a3(e){var t=ar();if(typeof e=="function"){var n=e;if(e=n(),Gu){Pl(!0);try{n()}finally{Pl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:e},t}function JD(e,t,n,i){return e.baseState=n,_v(e,Lt,typeof i=="function"?i:Fa)}function RZ(e,t,n,i,r){if(k6(e))throw Error(ne(485));if(e=t.action,e!==null){var s={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){s.listeners.push(o)}};Ge.T!==null?n(!0):s.isTransition=!1,i(s),n=t.pending,n===null?(s.next=t.pending=s,eN(t,s)):(s.next=n.next,t.pending=n.next=s)}}function eN(e,t){var n=t.action,i=t.payload,r=e.state;if(t.isTransition){var s=Ge.T,o={};Ge.T=o;try{var a=n(r,i),l=Ge.S;l!==null&&l(o,a),qS(e,t,a)}catch(c){l3(e,t,c)}finally{Ge.T=s}}else try{s=n(r,i),qS(e,t,s)}catch(c){l3(e,t,c)}}function qS(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){QS(e,t,i)},function(i){return l3(e,t,i)}):QS(e,t,n)}function QS(e,t,n){t.status="fulfilled",t.value=n,tN(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,eN(e,n)))}function l3(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,tN(t),t=t.next;while(t!==i)}e.action=null}function tN(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function nN(e,t){return t}function iN(e,t){if(_t){var n=jt.formState;if(n!==null){e:{var i=We;if(_t){if(yi){t:{for(var r=yi,s=wo;r.nodeType!==8;){if(!s){r=null;break t}if(r=Hs(r.nextSibling),r===null){r=null;break t}}s=r.data,r=s==="F!"||s==="F"?r:null}if(r){yi=Hs(r.nextSibling),i=r.data==="F!";break e}}Vu(i)}i=!1}i&&(t=n[0])}}return n=ar(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nN,lastRenderedState:t},n.queue=i,n=EN.bind(null,We,i),i.dispatch=n,i=a3(!1),s=xv.bind(null,We,!1,i.queue),i=ar(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,n=RZ.bind(null,We,r,s,n),r.dispatch=n,i.memoizedState=e,[t,n,!1]}function rN(e){var t=Pn();return sN(t,Lt,e)}function sN(e,t,n){t=_v(e,t,nN)[0],e=NU(Fa)[0],t=typeof t=="object"&&t!==null&&typeof t.then=="function"?Cm(t):t;var i=Pn(),r=i.queue,s=r.dispatch;return n!==i.memoizedState&&(We.flags|=2048,ch(9,kZ.bind(null,r,n),{destroy:void 0},null)),[t,s,e]}function kZ(e,t){e.action=t}function oN(e){var t=Pn(),n=Lt;if(n!==null)return sN(t,n,e);Pn(),t=t.memoizedState,n=Pn();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function ch(e,t,n,i){return e={tag:e,create:t,inst:n,deps:i,next:null},t=We.updateQueue,t===null&&(t=A6(),We.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function aN(){return Pn().memoizedState}function OU(e,t,n,i){var r=ar();We.flags|=e,r.memoizedState=ch(1|t,n,{destroy:void 0},i===void 0?null:i)}function R6(e,t,n,i){var r=Pn();i=i===void 0?null:i;var s=r.memoizedState.inst;Lt!==null&&i!==null&&pv(i,Lt.memoizedState.deps)?r.memoizedState=ch(t,n,s,i):(We.flags|=e,r.memoizedState=ch(1|t,n,s,i))}function JS(e,t){OU(8390656,8,e,t)}function wv(e,t){R6(2048,8,e,t)}function lN(e,t){return R6(4,2,e,t)}function cN(e,t){return R6(4,4,e,t)}function uN(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dN(e,t,n){n=n!=null?n.concat([e]):null,R6(4,4,uN.bind(null,t,e),n)}function Tv(){}function fN(e,t){var n=Pn();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&pv(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function hN(e,t){var n=Pn();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&pv(t,i[1]))return i[0];if(i=e(),Gu){Pl(!0);try{e()}finally{Pl(!1)}}return n.memoizedState=[i,t],i}function Sv(e,t,n){return n===void 0||fc&1073741824?e.memoizedState=t:(e.memoizedState=n,e=tO(),We.lanes|=e,gc|=e,n)}function gN(e,t,n,i){return Fr(n,t)?n:ah.current!==null?(e=Sv(e,n,i),Fr(e,t)||(ai=!0),e):fc&42?(e=tO(),We.lanes|=e,gc|=e,t):(ai=!0,e.memoizedState=n)}function mN(e,t,n,i,r){var s=Kt.p;Kt.p=s!==0&&8>s?s:8;var o=Ge.T,a={};Ge.T=a,xv(e,!1,t,n);try{var l=r(),c=Ge.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=CZ(l,i);kg(e,t,u,Nr(e))}else kg(e,t,i,Nr(e))}catch(d){kg(e,t,{then:function(){},status:"rejected",reason:d},Nr())}finally{Kt.p=s,Ge.T=o}}function LZ(){}function c3(e,t,n,i){if(e.tag!==5)throw Error(ne(476));var r=pN(e).queue;mN(e,r,t,Iu,n===null?LZ:function(){return UN(e),n(i)})}function pN(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Iu,baseState:Iu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:Iu},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function UN(e){var t=pN(e).next.queue;kg(e,t,{},Nr())}function Iv(){return Pi(S0)}function bN(){return Pn().memoizedState}function yN(){return Pn().memoizedState}function DZ(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Nr();e=Wl(n);var i=Kl(t,e,n);i!==null&&(Zi(i,t,n),Dg(i,t,n)),t={cache:gv()},e.payload=t;return}t=t.return}}function NZ(e,t,n){var i=Nr();n={lane:i,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},k6(e)?vN(t,n):(n=uv(e,t,n,i),n!==null&&(Zi(n,e,i),_N(n,t,i)))}function EN(e,t,n){var i=Nr();kg(e,t,n,i)}function kg(e,t,n,i){var r={lane:i,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(k6(e))vN(t,r);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(r.hasEagerState=!0,r.eagerState=a,Fr(a,o))return C6(e,t,r,0),jt===null&&x6(),!1}catch{}finally{}if(n=uv(e,t,r,i),n!==null)return Zi(n,e,i),_N(n,t,i),!0}return!1}function xv(e,t,n,i){if(i={lane:2,revertLane:Pv(),action:i,hasEagerState:!1,eagerState:null,next:null},k6(e)){if(t)throw Error(ne(479))}else t=uv(e,n,i,2),t!==null&&Zi(t,e,2)}function k6(e){var t=e.alternate;return e===We||t!==null&&t===We}function vN(e,t){Xf=k2=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _N(e,t,n){if(n&4194176){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,uD(e,n)}}var Po={readContext:Pi,use:M6,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useLayoutEffect:wn,useInsertionEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useSyncExternalStore:wn,useId:wn};Po.useCacheRefresh=wn;Po.useMemoCache=wn;Po.useHostTransitionStatus=wn;Po.useFormState=wn;Po.useActionState=wn;Po.useOptimistic=wn;var _d={readContext:Pi,use:M6,useCallback:function(e,t){return ar().memoizedState=[e,t===void 0?null:t],e},useContext:Pi,useEffect:JS,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,OU(4194308,4,uN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return OU(4194308,4,e,t)},useInsertionEffect:function(e,t){OU(4,2,e,t)},useMemo:function(e,t){var n=ar();t=t===void 0?null:t;var i=e();if(Gu){Pl(!0);try{e()}finally{Pl(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=ar();if(n!==void 0){var r=n(t);if(Gu){Pl(!0);try{n(t)}finally{Pl(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=NZ.bind(null,We,e),[i.memoizedState,e]},useRef:function(e){var t=ar();return e={current:e},t.memoizedState=e},useState:function(e){e=a3(e);var t=e.queue,n=EN.bind(null,We,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Tv,useDeferredValue:function(e,t){var n=ar();return Sv(n,e,t)},useTransition:function(){var e=a3(!1);return e=mN.bind(null,We,e.queue,!0,!1),ar().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=We,r=ar();if(_t){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),jt===null)throw Error(ne(349));ft&60||WD(i,t,n)}r.memoizedState=n;var s={value:n,getSnapshot:t};return r.queue=s,JS(ZD.bind(null,i,s,e),[e]),i.flags|=2048,ch(9,KD.bind(null,i,s,n,t),{destroy:void 0},null),n},useId:function(){var e=ar(),t=jt.identifierPrefix;if(_t){var n=Ta,i=wa;n=(i&~(1<<32-Dr(i)-1)).toString(32)+n,t=":"+t+"R"+n,n=L2++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=AZ++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},useCacheRefresh:function(){return ar().memoizedState=DZ.bind(null,We)}};_d.useMemoCache=vv;_d.useHostTransitionStatus=Iv;_d.useFormState=iN;_d.useActionState=iN;_d.useOptimistic=function(e){var t=ar();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=xv.bind(null,We,!0,n),n.dispatch=t,[e,t]};var Nc={readContext:Pi,use:M6,useCallback:fN,useContext:Pi,useEffect:wv,useImperativeHandle:dN,useInsertionEffect:lN,useLayoutEffect:cN,useMemo:hN,useReducer:NU,useRef:aN,useState:function(){return NU(Fa)},useDebugValue:Tv,useDeferredValue:function(e,t){var n=Pn();return gN(n,Lt.memoizedState,e,t)},useTransition:function(){var e=NU(Fa)[0],t=Pn().memoizedState;return[typeof e=="boolean"?e:Cm(e),t]},useSyncExternalStore:YD,useId:bN};Nc.useCacheRefresh=yN;Nc.useMemoCache=vv;Nc.useHostTransitionStatus=Iv;Nc.useFormState=rN;Nc.useActionState=rN;Nc.useOptimistic=function(e,t){var n=Pn();return JD(n,Lt,e,t)};var wd={readContext:Pi,use:M6,useCallback:fN,useContext:Pi,useEffect:wv,useImperativeHandle:dN,useInsertionEffect:lN,useLayoutEffect:cN,useMemo:hN,useReducer:Fy,useRef:aN,useState:function(){return Fy(Fa)},useDebugValue:Tv,useDeferredValue:function(e,t){var n=Pn();return Lt===null?Sv(n,e,t):gN(n,Lt.memoizedState,e,t)},useTransition:function(){var e=Fy(Fa)[0],t=Pn().memoizedState;return[typeof e=="boolean"?e:Cm(e),t]},useSyncExternalStore:YD,useId:bN};wd.useCacheRefresh=yN;wd.useMemoCache=vv;wd.useHostTransitionStatus=Iv;wd.useFormState=oN;wd.useActionState=oN;wd.useOptimistic=function(e,t){var n=Pn();return Lt!==null?JD(n,Lt,e,t):(n.baseState=e,[e,n.queue.dispatch])};function By(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:Zt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var u3={isMounted:function(e){return(e=e._reactInternals)?Xh(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Nr(),r=Wl(i);r.payload=t,n!=null&&(r.callback=n),t=Kl(e,r,i),t!==null&&(Zi(t,e,i),Dg(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Nr(),r=Wl(i);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Kl(e,r,i),t!==null&&(Zi(t,e,i),Dg(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Nr(),i=Wl(n);i.tag=2,t!=null&&(i.callback=t),t=Kl(e,i,n),t!==null&&(Zi(t,e,n),Dg(t,e,n))}};function eI(e,t,n,i,r,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,s,o):t.prototype&&t.prototype.isPureReactComponent?!b0(n,i)||!b0(r,s):!0}function tI(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&u3.enqueueReplaceState(t,t.state,null)}function Xu(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=Zt({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}var D2=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function wN(e){D2(e)}function TN(e){console.error(e)}function SN(e){D2(e)}function N2(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function nI(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function d3(e,t,n){return n=Wl(n),n.tag=3,n.payload={element:null},n.callback=function(){N2(e,t)},n}function IN(e){return e=Wl(e),e.tag=3,e}function xN(e,t,n,i){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var s=i.value;e.payload=function(){return r(s)},e.callback=function(){nI(t,n,i)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){nI(t,n,i),typeof r!="function"&&(ql===null?ql=new Set([this]):ql.add(this));var a=i.stack;this.componentDidCatch(i.value,{componentStack:a!==null?a:""})})}function OZ(e,t,n,i,r){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Am(t,n,r,!0),n=fs.current,n!==null){switch(n.tag){case 13:return Lo===null?I3():n.alternate===null&&En===0&&(En=3),n.flags&=-257,n.flags|=65536,n.lanes=r,i===r3?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),Qy(e,i,r)),!1;case 22:return n.flags|=65536,i===r3?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),Qy(e,i,r)),!1}throw Error(ne(435,n.tag))}return Qy(e,i,r),I3(),!1}if(_t)return t=fs.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,i!==i3&&(e=Error(ne(422),{cause:i}),y0(es(e,n)))):(i!==i3&&(t=Error(ne(423),{cause:i}),y0(es(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,i=es(i,n),r=d3(e.stateNode,i,r),Xy(e,r),En!==4&&(En=2)),!1;var s=Error(ne(520),{cause:i});if(s=es(s,n),Fg===null?Fg=[s]:Fg.push(s),En!==4&&(En=2),t===null)return!0;i=es(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=d3(n.stateNode,i,e),Xy(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(ql===null||!ql.has(s))))return n.flags|=65536,r&=-r,n.lanes|=r,r=IN(r),xN(r,e,n,i),Xy(n,r),!1}n=n.return}while(n!==null);return!1}var CN=Error(ne(461)),ai=!1;function mi(e,t,n,i){t.child=e===null?VD(t,null,n,i):$u(t,e.child,n,i)}function iI(e,t,n,i,r){n=n.render;var s=t.ref;if("ref"in i){var o={};for(var a in i)a!=="ref"&&(o[a]=i[a])}else o=i;return ju(t),i=Uv(e,t,n,o,s,r),a=bv(),e!==null&&!ai?(yv(e,t,r),Ba(e,t,r)):(_t&&a&&dv(t),t.flags|=1,mi(e,t,i,r),t.child)}function rI(e,t,n,i,r){if(e===null){var s=n.type;return typeof s=="function"&&!kv(s)&&s.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=s,AN(e,t,s,i,r)):(e=FU(n.type,null,i,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!Cv(e,r)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:b0,n(o,i)&&e.ref===t.ref)return Ba(e,t,r)}return t.flags|=1,e=Zl(s,i),e.ref=t.ref,e.return=t,t.child=e}function AN(e,t,n,i,r){if(e!==null){var s=e.memoizedProps;if(b0(s,i)&&e.ref===t.ref)if(ai=!1,t.pendingProps=i=s,Cv(e,r))e.flags&131072&&(ai=!0);else return t.lanes=e.lanes,Ba(e,t,r)}return f3(e,t,n,i,r)}function MN(e,t,n){var i=t.pendingProps,r=i.children,s=(t.stateNode._pendingVisibility&2)!==0,o=e!==null?e.memoizedState:null;if(Lg(e,t),i.mode==="hidden"||s){if(t.flags&128){if(i=o!==null?o.baseLanes|n:n,e!==null){for(r=t.child=e.child,s=0;r!==null;)s=s|r.lanes|r.childLanes,r=r.sibling;t.childLanes=s&~i}else t.childLanes=0,t.child=null;return sI(e,t,i,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&DU(t,o!==null?o.cachePool:null),o!==null?WS(t,o):s3(),$D(t);else return t.lanes=t.childLanes=536870912,sI(e,t,o!==null?o.baseLanes|n:n,n)}else o!==null?(DU(t,o.cachePool),WS(t,o),Rl(),t.memoizedState=null):(e!==null&&DU(t,null),s3(),Rl());return mi(e,t,r,n),t.child}function sI(e,t,n,i){var r=mv();return r=r===null?null:{parent:jn._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&DU(t,null),s3(),$D(t),e!==null&&Am(e,t,i,!0),null}function Lg(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=2097664);else{if(typeof n!="function"&&typeof n!="object")throw Error(ne(284));(e===null||e.ref!==n)&&(t.flags|=2097664)}}function f3(e,t,n,i,r){return ju(t),n=Uv(e,t,n,i,void 0,r),i=bv(),e!==null&&!ai?(yv(e,t,r),Ba(e,t,r)):(_t&&i&&dv(t),t.flags|=1,mi(e,t,n,r),t.child)}function oI(e,t,n,i,r,s){return ju(t),t.updateQueue=null,n=jD(t,i,n,r),XD(e),i=bv(),e!==null&&!ai?(yv(e,t,s),Ba(e,t,s)):(_t&&i&&dv(t),t.flags|=1,mi(e,t,n,s),t.child)}function aI(e,t,n,i,r){if(ju(t),t.stateNode===null){var s=Tf,o=n.contextType;typeof o=="object"&&o!==null&&(s=Pi(o)),s=new n(i,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=u3,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=i,s.state=t.memoizedState,s.refs={},Av(t),o=n.contextType,s.context=typeof o=="object"&&o!==null?Pi(o):Tf,s.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(By(t,n,o,i),s.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(o=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),o!==s.state&&u3.enqueueReplaceState(s,s.state,null),Og(t,i,s,r),Ng(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){s=t.stateNode;var a=t.memoizedProps,l=Xu(n,a);s.props=l;var c=s.context,u=n.contextType;o=Tf,typeof u=="object"&&u!==null&&(o=Pi(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,u||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a||c!==o)&&tI(t,s,i,o),Sl=!1;var f=t.memoizedState;s.state=f,Og(t,i,s,r),Ng(),c=t.memoizedState,a||f!==c||Sl?(typeof d=="function"&&(By(t,n,d,i),c=t.memoizedState),(l=Sl||eI(t,n,l,i,f,c,o))?(u||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=c),s.props=i,s.state=c,s.context=o,i=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{s=t.stateNode,b3(e,t),o=t.memoizedProps,u=Xu(n,o),s.props=u,d=t.pendingProps,f=s.context,c=n.contextType,l=Tf,typeof c=="object"&&c!==null&&(l=Pi(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o!==d||f!==l)&&tI(t,s,i,l),Sl=!1,f=t.memoizedState,s.state=f,Og(t,i,s,r),Ng();var h=t.memoizedState;o!==d||f!==h||Sl||e!==null&&e.dependencies!==null&&O2(e.dependencies)?(typeof a=="function"&&(By(t,n,a,i),h=t.memoizedState),(u=Sl||eI(t,n,u,i,f,h,l)||e!==null&&e.dependencies!==null&&O2(e.dependencies))?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(i,h,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(i,h,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=h),s.props=i,s.state=h,s.context=l,i=u):(typeof s.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),i=!1)}return s=i,Lg(e,t),i=(t.flags&128)!==0,s||i?(s=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&i?(t.child=$u(t,e.child,null,r),t.child=$u(t,null,n,r)):mi(e,t,n,r),t.memoizedState=s.state,e=t.child):e=Ba(e,t,r),e}function lI(e,t,n,i){return Im(),t.flags|=256,mi(e,t,n,i),t.child}var zy={dehydrated:null,treeContext:null,retryLane:0};function Hy(e){return{baseLanes:e,cachePool:GD()}}function Vy(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=rs),e}function RN(e,t,n){var i=t.pendingProps,r=!1,s=(t.flags&128)!==0,o;if((o=s)||(o=e!==null&&e.memoizedState===null?!1:(Yn.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(_t){if(r?Ml(t):Rl(),_t){var a=yi,l;if(l=a){e:{for(l=a,a=wo;l.nodeType!==8;){if(!a){a=null;break e}if(l=Hs(l.nextSibling),l===null){a=null;break e}}a=l}a!==null?(t.memoizedState={dehydrated:a,treeContext:xu!==null?{id:wa,overflow:Ta}:null,retryLane:536870912},l=is(18,null,null,0),l.stateNode=a,l.return=t,t.child=l,Wi=t,yi=null,l=!0):l=!1}l||Vu(t)}if(a=t.memoizedState,a!==null&&(a=a.dehydrated,a!==null))return a.data==="$!"?t.lanes=16:t.lanes=536870912,null;Sa(t)}return a=i.children,i=i.fallback,r?(Rl(),r=t.mode,a=g3({mode:"hidden",children:a},r),i=Au(i,r,n,null),a.return=t,i.return=t,a.sibling=i,t.child=a,r=t.child,r.memoizedState=Hy(n),r.childLanes=Vy(e,o,n),t.memoizedState=zy,i):(Ml(t),h3(t,a))}if(l=e.memoizedState,l!==null&&(a=l.dehydrated,a!==null)){if(s)t.flags&256?(Ml(t),t.flags&=-257,t=$y(e,t,n)):t.memoizedState!==null?(Rl(),t.child=e.child,t.flags|=128,t=null):(Rl(),r=i.fallback,a=t.mode,i=g3({mode:"visible",children:i.children},a),r=Au(r,a,n,null),r.flags|=2,i.return=t,r.return=t,i.sibling=r,t.child=i,$u(t,e.child,null,n),i=t.child,i.memoizedState=Hy(n),i.childLanes=Vy(e,o,n),t.memoizedState=zy,t=r);else if(Ml(t),a.data==="$!"){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,i=Error(ne(419)),i.stack="",i.digest=o,y0({value:i,source:null,stack:null}),t=$y(e,t,n)}else if(ai||Am(e,t,n,!1),o=(n&e.childLanes)!==0,ai||o){if(o=jt,o!==null){if(i=n&-n,i&42)i=1;else switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=64;break;case 268435456:i=134217728;break;default:i=0}if(i=i&(o.suspendedLanes|n)?0:i,i!==0&&i!==l.retryLane)throw l.retryLane=i,dc(e,i),Zi(o,e,i),CN}a.data==="$?"||I3(),t=$y(e,t,n)}else a.data==="$?"?(t.flags|=128,t.child=e.child,t=qZ.bind(null,e),a._reactRetry=t,t=null):(e=l.treeContext,yi=Hs(a.nextSibling),Wi=t,_t=!0,Rs=null,wo=!1,e!==null&&(qr[Qr++]=wa,qr[Qr++]=Ta,qr[Qr++]=xu,wa=e.id,Ta=e.overflow,xu=t),t=h3(t,i.children),t.flags|=4096);return t}return r?(Rl(),r=i.fallback,a=t.mode,l=e.child,c=l.sibling,i=Zl(l,{mode:"hidden",children:i.children}),i.subtreeFlags=l.subtreeFlags&31457280,c!==null?r=Zl(c,r):(r=Au(r,a,n,null),r.flags|=2),r.return=t,i.return=t,i.sibling=r,t.child=i,i=r,r=t.child,a=e.child.memoizedState,a===null?a=Hy(n):(l=a.cachePool,l!==null?(c=jn._currentValue,l=l.parent!==c?{parent:c,pool:c}:l):l=GD(),a={baseLanes:a.baseLanes|n,cachePool:l}),r.memoizedState=a,r.childLanes=Vy(e,o,n),t.memoizedState=zy,i):(Ml(t),n=e.child,e=n.sibling,n=Zl(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function h3(e,t){return t=g3({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function g3(e,t){return JN(e,t,0,null)}function $y(e,t,n){return $u(t,e.child,null,n),e=h3(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cI(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),p3(e.return,t,n)}function Gy(e,t,n,i,r){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r)}function kN(e,t,n){var i=t.pendingProps,r=i.revealOrder,s=i.tail;if(mi(e,t,i.children,n),i=Yn.current,i&2)i=i&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cI(e,n,t);else if(e.tag===19)cI(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}switch(sn(Yn,i),r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&R2(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Gy(t,!1,r,n,s);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&R2(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Gy(t,!0,n,null,s);break;case"together":Gy(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ba(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gc|=t.lanes,!(n&t.childLanes))if(e!==null){if(Am(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(ne(153));if(t.child!==null){for(e=t.child,n=Zl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cv(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&O2(e)))}function PZ(e,t,n){switch(t.tag){case 3:_2(t,t.stateNode.containerInfo),kl(t,jn,e.memoizedState.cache),Im();break;case 27:case 5:W7(t);break;case 4:_2(t,t.stateNode.containerInfo);break;case 10:kl(t,t.type,t.memoizedProps.value);break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Ml(t),t.flags|=128,null):n&t.child.childLanes?RN(e,t,n):(Ml(t),e=Ba(e,t,n),e!==null?e.sibling:null);Ml(t);break;case 19:var r=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Am(e,t,n,!1),i=(n&t.childLanes)!==0),r){if(i)return kN(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),sn(Yn,Yn.current),i)break;return null;case 22:case 23:return t.lanes=0,MN(e,t,n);case 24:kl(t,jn,e.memoizedState.cache)}return Ba(e,t,n)}function LN(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ai=!0;else{if(!Cv(e,n)&&!(t.flags&128))return ai=!1,PZ(e,t,n);ai=!!(e.flags&131072)}else ai=!1,_t&&t.flags&1048576&&FD(t,A2,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var i=t.elementType,r=i._init;if(i=r(i._payload),t.type=i,typeof i=="function")kv(i)?(e=Xu(i,e),t.tag=1,t=aI(null,t,i,e,n)):(t.tag=0,t=f3(null,t,i,e,n));else{if(i!=null){if(r=i.$$typeof,r===J4){t.tag=11,t=iI(null,t,i,e,n);break e}else if(r===ev){t.tag=14,t=rI(null,t,i,e,n);break e}}throw t=j7(i)||i,Error(ne(306,t,""))}}return t;case 0:return f3(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,r=Xu(i,t.pendingProps),aI(e,t,i,r,n);case 3:e:{if(_2(t,t.stateNode.containerInfo),e===null)throw Error(ne(387));var s=t.pendingProps;r=t.memoizedState,i=r.element,b3(e,t),Og(t,s,null,n);var o=t.memoizedState;if(s=o.cache,kl(t,jn,s),s!==r.cache&&U3(t,[jn],n,!0),Ng(),s=o.element,r.isDehydrated)if(r={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=lI(e,t,s,n);break e}else if(s!==i){i=es(Error(ne(424)),t),y0(i),t=lI(e,t,s,n);break e}else for(yi=Hs(t.stateNode.containerInfo.firstChild),Wi=t,_t=!0,Rs=null,wo=!0,n=VD(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Im(),s===i){t=Ba(e,t,n);break e}mi(e,t,s,n)}t=t.child}return t;case 26:return Lg(e,t),e===null?(n=xI(t.type,null,t.pendingProps,null))?t.memoizedState=n:_t||(n=t.type,e=t.pendingProps,i=$2(Yl.current).createElement(n),i[Oi]=t,i[br]=e,Ei(i,n,e),ri(i),t.stateNode=i):t.memoizedState=xI(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return W7(t),e===null&&_t&&(i=t.stateNode=UO(t.type,t.pendingProps,Yl.current),Wi=t,wo=!0,yi=Hs(i.firstChild)),i=t.pendingProps.children,e!==null||_t?mi(e,t,i,n):t.child=$u(t,null,i,n),Lg(e,t),t.child;case 5:return e===null&&_t&&((r=i=yi)&&(i=hq(i,t.type,t.pendingProps,wo),i!==null?(t.stateNode=i,Wi=t,yi=Hs(i.firstChild),wo=!1,r=!0):r=!1),r||Vu(t)),W7(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,R3(r,s)?i=null:o!==null&&R3(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=Uv(e,t,MZ,null,null,n),S0._currentValue=r),Lg(e,t),mi(e,t,i,n),t.child;case 6:return e===null&&_t&&((e=n=yi)&&(n=gq(n,t.pendingProps,wo),n!==null?(t.stateNode=n,Wi=t,yi=null,e=!0):e=!1),e||Vu(t)),null;case 13:return RN(e,t,n);case 4:return _2(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=$u(t,null,i,n):mi(e,t,i,n),t.child;case 11:return iI(e,t,t.type,t.pendingProps,n);case 7:return mi(e,t,t.pendingProps,n),t.child;case 8:return mi(e,t,t.pendingProps.children,n),t.child;case 12:return mi(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,kl(t,t.type,i.value),mi(e,t,i.children,n),t.child;case 9:return r=t.type._context,i=t.pendingProps.children,ju(t),r=Pi(r),i=i(r),t.flags|=1,mi(e,t,i,n),t.child;case 14:return rI(e,t,t.type,t.pendingProps,n);case 15:return AN(e,t,t.type,t.pendingProps,n);case 19:return kN(e,t,n);case 22:return MN(e,t,n);case 24:return ju(t),i=Pi(jn),e===null?(r=mv(),r===null&&(r=jt,s=gv(),r.pooledCache=s,s.refCount++,s!==null&&(r.pooledCacheLanes|=n),r=s),t.memoizedState={parent:i,cache:r},Av(t),kl(t,jn,r)):(e.lanes&n&&(b3(e,t),Og(t,null,null,n),Ng()),r=e.memoizedState,s=t.memoizedState,r.parent!==i?(r={parent:i,cache:i},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),kl(t,jn,i)):(i=s.cache,kl(t,jn,i),i!==r.cache&&U3(t,[jn],n,!0))),mi(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(ne(156,t.tag))}var m3=Yo(null),Td=null,Ia=null;function kl(e,t,n){sn(m3,t._currentValue),t._currentValue=n}function Ma(e){e._currentValue=m3.current,ci(m3)}function p3(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function U3(e,t,n,i){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var s=r.dependencies;if(s!==null){var o=r.child;s=s.firstContext;e:for(;s!==null;){var a=s;s=r;for(var l=0;l<t.length;l++)if(a.context===t[l]){s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),p3(s.return,n,e),i||(o=null);break e}s=a.next}}else if(r.tag===18){if(o=r.return,o===null)throw Error(ne(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),p3(o,n,e),o=null}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}}function Am(e,t,n,i){e=null;for(var r=t,s=!1;r!==null;){if(!s){if(r.flags&524288)s=!0;else if(r.flags&262144)break}if(r.tag===10){var o=r.alternate;if(o===null)throw Error(ne(387));if(o=o.memoizedProps,o!==null){var a=r.type;Fr(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===v2.current){if(o=r.alternate,o===null)throw Error(ne(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(S0):e=[S0])}r=r.return}e!==null&&U3(t,e,n,i),t.flags|=262144}function O2(e){for(e=e.firstContext;e!==null;){if(!Fr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ju(e){Td=e,Ia=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Pi(e){return DN(Td,e)}function Np(e,t){return Td===null&&ju(e),DN(e,t)}function DN(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ia===null){if(e===null)throw Error(ne(308));Ia=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ia=Ia.next=t;return n}var Sl=!1;function Av(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function b3(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Kl(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,dn&2){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=x2(e),PD(e,null,n),t}return C6(e,i,t,n),x2(e)}function Dg(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194176)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,uD(e,n)}}function Xy(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?r=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?r=s=t:s=s.next=t}else r=s=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var y3=!1;function Ng(){if(y3){var e=Gf;if(e!==null)throw e}}function Og(e,t,n,i){y3=!1;var r=e.updateQueue;Sl=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;o=0,u=c=l=null,a=s;do{var f=a.lane&-536870913,h=f!==a.lane;if(h?(ft&f)===f:(i&f)===f){f!==0&&f===lh&&(y3=!0),u!==null&&(u=u.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var m=e,p=a;f=t;var b=n;switch(p.tag){case 1:if(m=p.payload,typeof m=="function"){d=m.call(b,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=p.payload,f=typeof m=="function"?m.call(b,d,f):m,f==null)break e;d=Zt({},d,f);break e;case 2:Sl=!0}}f=a.callback,f!==null&&(e.flags|=64,h&&(e.flags|=8192),h=r.callbacks,h===null?r.callbacks=[f]:h.push(f))}else h={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,o|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,s===null&&(r.shared.lanes=0),gc|=o,e.lanes=o,e.memoizedState=d}}function NN(e,t){if(typeof e!="function")throw Error(ne(191,e));e.call(t)}function ON(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)NN(n[e],t)}function Mm(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var s=n.create,o=n.inst;i=s(),o.destroy=i}n=n.next}while(n!==r)}}catch(a){Ft(t,t.return,a)}}function hc(e,t,n){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var s=r.next;i=s;do{if((i.tag&e)===e){var o=i.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,r=t;var l=n;try{a()}catch(c){Ft(r,l,c)}}}i=i.next}while(i!==s)}}catch(c){Ft(t,t.return,c)}}function PN(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ON(t,n)}catch(i){Ft(e,e.return,i)}}}function FN(e,t,n){n.props=Xu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){Ft(e,t,i)}}function gu(e,t){try{var n=e.ref;if(n!==null){var i=e.stateNode;switch(e.tag){case 26:case 27:case 5:var r=i;break;default:r=i}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(s){Ft(e,t,s)}}function Cr(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(r){Ft(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){Ft(e,t,r)}else n.current=null}function BN(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(r){Ft(e,e.return,r)}}function uI(e,t,n){try{var i=e.stateNode;lq(i,e.type,n,t),i[br]=t}catch(r){Ft(e,e.return,r)}}function zN(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27||e.tag===4}function jy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zN(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==27&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function E3(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=N6));else if(i!==4&&i!==27&&(e=e.child,e!==null))for(E3(e,t,n),e=e.sibling;e!==null;)E3(e,t,n),e=e.sibling}function P2(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&i!==27&&(e=e.child,e!==null))for(P2(e,t,n),e=e.sibling;e!==null;)P2(e,t,n),e=e.sibling}var Ua=!1,yn=!1,Yy=!1,dI=typeof WeakSet=="function"?WeakSet:Set,ii=null,fI=!1;function FZ(e,t){if(e=e.containerInfo,A3=Y2,e=MD(e),lv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===r&&(a=o),f===s&&++u===i&&(l=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(M3={focusedElem:e,selectionRange:n},Y2=!1,ii=t;ii!==null;)if(t=ii,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ii=e;else for(;ii!==null;){switch(t=ii,s=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&s!==null){e=void 0,n=t,r=s.memoizedProps,s=s.memoizedState,i=n.stateNode;try{var m=Xu(n.type,r,n.elementType===n.type);e=i.getSnapshotBeforeUpdate(m,s),i.__reactInternalSnapshotBeforeUpdate=e}catch(p){Ft(n,n.return,p)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)k3(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":k3(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(ne(163))}if(e=t.sibling,e!==null){e.return=t.return,ii=e;break}ii=t.return}return m=fI,fI=!1,m}function HN(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:ia(e,n),i&4&&Mm(5,n);break;case 1:if(ia(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(a){Ft(n,n.return,a)}else{var r=Xu(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(a){Ft(n,n.return,a)}}i&64&&PN(n),i&512&&gu(n,n.return);break;case 3:if(ia(e,n),i&64&&(i=n.updateQueue,i!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{ON(i,e)}catch(a){Ft(n,n.return,a)}}break;case 26:ia(e,n),i&512&&gu(n,n.return);break;case 27:case 5:ia(e,n),t===null&&i&4&&BN(n),i&512&&gu(n,n.return);break;case 12:ia(e,n);break;case 13:ia(e,n),i&4&&GN(e,n);break;case 22:if(r=n.memoizedState!==null||Ua,!r){t=t!==null&&t.memoizedState!==null||yn;var s=Ua,o=yn;Ua=r,(yn=t)&&!o?yl(e,n,(n.subtreeFlags&8772)!==0):ia(e,n),Ua=s,yn=o}i&512&&(n.memoizedProps.mode==="manual"?gu(n,n.return):Cr(n,n.return));break;default:ia(e,n)}}function VN(e){var t=e.alternate;t!==null&&(e.alternate=null,VN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&nv(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ln=null,Tr=!1;function na(e,t,n){for(n=n.child;n!==null;)$N(e,t,n),n=n.sibling}function $N(e,t,n){if(Lr&&typeof Lr.onCommitFiberUnmount=="function")try{Lr.onCommitFiberUnmount(_m,n)}catch{}switch(n.tag){case 26:yn||Cr(n,t),na(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:yn||Cr(n,t);var i=Ln,r=Tr;for(Ln=n.stateNode,na(e,t,n),n=n.stateNode,t=n.attributes;t.length;)n.removeAttributeNode(t[0]);nv(n),Ln=i,Tr=r;break;case 5:yn||Cr(n,t);case 6:r=Ln;var s=Tr;if(Ln=null,na(e,t,n),Ln=r,Tr=s,Ln!==null)if(Tr)try{e=Ln,i=n.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)}catch(o){Ft(n,t,o)}else try{Ln.removeChild(n.stateNode)}catch(o){Ft(n,t,o)}break;case 18:Ln!==null&&(Tr?(t=Ln,n=n.stateNode,t.nodeType===8?s8(t.parentNode,n):t.nodeType===1&&s8(t,n),C0(t)):s8(Ln,n.stateNode));break;case 4:i=Ln,r=Tr,Ln=n.stateNode.containerInfo,Tr=!0,na(e,t,n),Ln=i,Tr=r;break;case 0:case 11:case 14:case 15:yn||hc(2,n,t),yn||hc(4,n,t),na(e,t,n);break;case 1:yn||(Cr(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&FN(n,t,i)),na(e,t,n);break;case 21:na(e,t,n);break;case 22:yn||Cr(n,t),yn=(i=yn)||n.memoizedState!==null,na(e,t,n),yn=i;break;default:na(e,t,n)}}function GN(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{C0(e)}catch(n){Ft(t,t.return,n)}}function BZ(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new dI),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new dI),t;default:throw Error(ne(435,e.tag))}}function Wy(e,t){var n=BZ(e);t.forEach(function(i){var r=QZ.bind(null,e,i);n.has(i)||(n.add(i),i.then(r,r))})}function $r(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i],s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:case 5:Ln=a.stateNode,Tr=!1;break e;case 3:Ln=a.stateNode.containerInfo,Tr=!0;break e;case 4:Ln=a.stateNode.containerInfo,Tr=!0;break e}a=a.return}if(Ln===null)throw Error(ne(160));$N(s,o,r),Ln=null,Tr=!1,s=r.alternate,s!==null&&(s.return=null),r.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)XN(t,e),t=t.sibling}var As=null;function XN(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$r(t,e),Gr(e),i&4&&(hc(3,e,e.return),Mm(3,e),hc(5,e,e.return));break;case 1:$r(t,e),Gr(e),i&512&&(yn||n===null||Cr(n,n.return)),i&64&&Ua&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var r=As;if($r(t,e),Gr(e),i&512&&(yn||n===null||Cr(n,n.return)),i&4){var s=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(i){case"title":s=r.getElementsByTagName("title")[0],(!s||s[m0]||s[Oi]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=r.createElement(i),r.head.insertBefore(s,r.querySelector("head > title"))),Ei(s,i,n),s[Oi]=e,ri(s),i=s;break e;case"link":var o=AI("link","href",r).get(i+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(s=o[a],s.getAttribute("href")===(n.href==null?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}s=r.createElement(i),Ei(s,i,n),r.head.appendChild(s);break;case"meta":if(o=AI("meta","content",r).get(i+(n.content||""))){for(a=0;a<o.length;a++)if(s=o[a],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}s=r.createElement(i),Ei(s,i,n),r.head.appendChild(s);break;default:throw Error(ne(468,i))}s[Oi]=e,ri(s),i=s}e.stateNode=i}else MI(r,e.type,e.stateNode);else e.stateNode=CI(r,i,e.memoizedProps);else s!==i?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,i===null?MI(r,e.type,e.stateNode):CI(r,i,e.memoizedProps)):i===null&&e.stateNode!==null&&uI(e,e.memoizedProps,n.memoizedProps)}break;case 27:if(i&4&&e.alternate===null){r=e.stateNode,s=e.memoizedProps;try{for(var l=r.firstChild;l;){var c=l.nextSibling,u=l.nodeName;l[m0]||u==="HEAD"||u==="BODY"||u==="SCRIPT"||u==="STYLE"||u==="LINK"&&l.rel.toLowerCase()==="stylesheet"||r.removeChild(l),l=c}for(var d=e.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ei(r,d,s),r[Oi]=e,r[br]=s}catch(m){Ft(e,e.return,m)}}case 5:if($r(t,e),Gr(e),i&512&&(yn||n===null||Cr(n,n.return)),e.flags&32){r=e.stateNode;try{oh(r,"")}catch(m){Ft(e,e.return,m)}}i&4&&e.stateNode!=null&&(r=e.memoizedProps,uI(e,r,n!==null?n.memoizedProps:r)),i&1024&&(Yy=!0);break;case 6:if($r(t,e),Gr(e),i&4){if(e.stateNode===null)throw Error(ne(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(m){Ft(e,e.return,m)}}break;case 3:if(zU=null,r=As,As=G2(t.containerInfo),$r(t,e),As=r,Gr(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{C0(t.containerInfo)}catch(m){Ft(e,e.return,m)}Yy&&(Yy=!1,jN(e));break;case 4:i=As,As=G2(e.stateNode.containerInfo),$r(t,e),Gr(e),As=i;break;case 12:$r(t,e),Gr(e);break;case 13:$r(t,e),Gr(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Nv=ko()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Wy(e,i)));break;case 22:if(i&512&&(yn||n===null||Cr(n,n.return)),l=e.memoizedState!==null,c=n!==null&&n.memoizedState!==null,u=Ua,d=yn,Ua=u||l,yn=d||c,$r(t,e),yn=d,Ua=u,Gr(e),t=e.stateNode,t._current=e,t._visibility&=-3,t._visibility|=t._pendingVisibility&2,i&8192&&(t._visibility=l?t._visibility&-2:t._visibility|1,l&&(t=Ua||yn,n===null||c||t||sf(e)),e.memoizedProps===null||e.memoizedProps.mode!=="manual"))e:for(n=null,t=e;;){if(t.tag===5||t.tag===26||t.tag===27){if(n===null){c=n=t;try{if(r=c.stateNode,l)s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none";else{o=c.stateNode,a=c.memoizedProps.style;var h=a!=null&&a.hasOwnProperty("display")?a.display:null;o.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(m){Ft(c,c.return,m)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=l?"":c.memoizedProps}catch(m){Ft(c,c.return,m)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Wy(e,n))));break;case 19:$r(t,e),Gr(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Wy(e,i)));break;case 21:break;default:$r(t,e),Gr(e)}}function Gr(e){var t=e.flags;if(t&2){try{if(e.tag!==27){e:{for(var n=e.return;n!==null;){if(zN(n)){var i=n;break e}n=n.return}throw Error(ne(160))}switch(i.tag){case 27:var r=i.stateNode,s=jy(e);P2(e,s,r);break;case 5:var o=i.stateNode;i.flags&32&&(oh(o,""),i.flags&=-33);var a=jy(e);P2(e,a,o);break;case 3:case 4:var l=i.stateNode.containerInfo,c=jy(e);E3(e,c,l);break;default:throw Error(ne(161))}}}catch(u){Ft(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jN(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;jN(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ia(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)HN(e,t.alternate,t),t=t.sibling}function sf(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:hc(4,t,t.return),sf(t);break;case 1:Cr(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&FN(t,t.return,n),sf(t);break;case 26:case 27:case 5:Cr(t,t.return),sf(t);break;case 22:Cr(t,t.return),t.memoizedState===null&&sf(t);break;default:sf(t)}e=e.sibling}}function yl(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,r=e,s=t,o=s.flags;switch(s.tag){case 0:case 11:case 15:yl(r,s,n),Mm(4,s);break;case 1:if(yl(r,s,n),i=s,r=i.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(c){Ft(i,i.return,c)}if(i=s,r=i.updateQueue,r!==null){var a=i.stateNode;try{var l=r.shared.hiddenCallbacks;if(l!==null)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)NN(l[r],a)}catch(c){Ft(i,i.return,c)}}n&&o&64&&PN(s),gu(s,s.return);break;case 26:case 27:case 5:yl(r,s,n),n&&i===null&&o&4&&BN(s),gu(s,s.return);break;case 12:yl(r,s,n);break;case 13:yl(r,s,n),n&&o&4&&GN(r,s);break;case 22:s.memoizedState===null&&yl(r,s,n),gu(s,s.return);break;default:yl(r,s,n)}t=t.sibling}}function Mv(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&xm(n))}function Rv(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xm(e))}function ml(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)YN(e,t,n,i),t=t.sibling}function YN(e,t,n,i){var r=t.flags;switch(t.tag){case 0:case 11:case 15:ml(e,t,n,i),r&2048&&Mm(9,t);break;case 3:ml(e,t,n,i),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xm(e)));break;case 12:if(r&2048){ml(e,t,n,i),e=t.stateNode;try{var s=t.memoizedProps,o=s.id,a=s.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){Ft(t,t.return,l)}}else ml(e,t,n,i);break;case 23:break;case 22:s=t.stateNode,t.memoizedState!==null?s._visibility&4?ml(e,t,n,i):Pg(e,t):s._visibility&4?ml(e,t,n,i):(s._visibility|=4,of(e,t,n,i,(t.subtreeFlags&10256)!==0)),r&2048&&Mv(t.alternate,t);break;case 24:ml(e,t,n,i),r&2048&&Rv(t.alternate,t);break;default:ml(e,t,n,i)}}function of(e,t,n,i,r){for(r=r&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var s=e,o=t,a=n,l=i,c=o.flags;switch(o.tag){case 0:case 11:case 15:of(s,o,a,l,r),Mm(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState!==null?u._visibility&4?of(s,o,a,l,r):Pg(s,o):(u._visibility|=4,of(s,o,a,l,r)),r&&c&2048&&Mv(o.alternate,o);break;case 24:of(s,o,a,l,r),r&&c&2048&&Rv(o.alternate,o);break;default:of(s,o,a,l,r)}t=t.sibling}}function Pg(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,r=i.flags;switch(i.tag){case 22:Pg(n,i),r&2048&&Mv(i.alternate,i);break;case 24:Pg(n,i),r&2048&&Rv(i.alternate,i);break;default:Pg(n,i)}t=t.sibling}}var og=8192;function $d(e){if(e.subtreeFlags&og)for(e=e.child;e!==null;)WN(e),e=e.sibling}function WN(e){switch(e.tag){case 26:$d(e),e.flags&og&&e.memoizedState!==null&&xq(As,e.memoizedState,e.memoizedProps);break;case 5:$d(e);break;case 3:case 4:var t=As;As=G2(e.stateNode.containerInfo),$d(e),As=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=og,og=16777216,$d(e),og=t):$d(e));break;default:$d(e)}}function KN(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function k1(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];ii=i,qN(i,e)}KN(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ZN(e),e=e.sibling}function ZN(e){switch(e.tag){case 0:case 11:case 15:k1(e),e.flags&2048&&hc(9,e,e.return);break;case 3:k1(e);break;case 12:k1(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&4&&(e.return===null||e.return.tag!==13)?(t._visibility&=-5,PU(e)):k1(e);break;default:k1(e)}}function PU(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];ii=i,qN(i,e)}KN(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:hc(8,t,t.return),PU(t);break;case 22:n=t.stateNode,n._visibility&4&&(n._visibility&=-5,PU(t));break;default:PU(t)}e=e.sibling}}function qN(e,t){for(;ii!==null;){var n=ii;switch(n.tag){case 0:case 11:case 15:hc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:xm(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,ii=i;else e:for(n=e;ii!==null;){i=ii;var r=i.sibling,s=i.return;if(VN(i),i===n){ii=null;break e}if(r!==null){r.return=s,ii=r;break e}ii=s}}}function zZ(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function is(e,t,n,i){return new zZ(e,t,n,i)}function kv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zl(e,t){var n=e.alternate;return n===null?(n=is(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&31457280,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function QN(e,t){e.flags&=31457282;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function FU(e,t,n,i,r,s){var o=0;if(i=e,typeof e=="function")kv(e)&&(o=1);else if(typeof e=="string")o=Sq(e,n,Ro.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Uf:return Au(n.children,r,s,t);case JL:o=8,r|=24;break;case $7:return e=is(12,n,t,r|2),e.elementType=$7,e.lanes=s,e;case G7:return e=is(13,n,t,r),e.elementType=G7,e.lanes=s,e;case X7:return e=is(19,n,t,r),e.elementType=X7,e.lanes=s,e;case tD:return JN(n,r,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dK:case _a:o=10;break e;case eD:o=9;break e;case J4:o=11;break e;case ev:o=14;break e;case Tl:o=16,i=null;break e}o=29,n=Error(ne(130,e===null?"null":typeof e,"")),i=null}return t=is(o,n,t,r),t.elementType=e,t.type=i,t.lanes=s,t}function Au(e,t,n,i){return e=is(7,e,i,t),e.lanes=n,e}function JN(e,t,n,i){e=is(22,e,i,t),e.elementType=tD,e.lanes=n;var r={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var s=r._current;if(s===null)throw Error(ne(456));if(!(r._pendingVisibility&2)){var o=dc(s,2);o!==null&&(r._pendingVisibility|=2,Zi(o,s,2))}},attach:function(){var s=r._current;if(s===null)throw Error(ne(456));if(r._pendingVisibility&2){var o=dc(s,2);o!==null&&(r._pendingVisibility&=-3,Zi(o,s,2))}}};return e.stateNode=r,e}function Ky(e,t,n){return e=is(6,e,null,t),e.lanes=n,e}function Zy(e,t,n){return t=is(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ra(e){e.flags|=4}function hI(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!EO(t)){if(t=fs.current,t!==null&&((ft&4194176)===ft?Lo!==null:(ft&62914560)!==ft&&!(ft&536870912)||t!==Lo))throw Mg=r3,BD;e.flags|=8192}}function Op(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?lD():536870912,e.lanes|=t,uh|=t)}function L1(e,t){if(!_t)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function an(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags&31457280,i|=r.flags&31457280,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function HZ(e,t,n){var i=t.pendingProps;switch(fv(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return an(t),null;case 1:return an(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Ma(jn),rh(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(M1(t)?ra(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Rs!==null&&(S3(Rs),Rs=null))),an(t),null;case 26:return n=t.memoizedState,e===null?(ra(t),n!==null?(an(t),hI(t,n)):(an(t),t.flags&=-16777217)):n?n!==e.memoizedState?(ra(t),an(t),hI(t,n)):(an(t),t.flags&=-16777217):(e.memoizedProps!==i&&ra(t),an(t),t.flags&=-16777217),null;case 27:w2(t),n=Yl.current;var r=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ra(t);else{if(!i){if(t.stateNode===null)throw Error(ne(166));return an(t),null}e=Ro.current,M1(t)?$S(t):(e=UO(r,i,n),t.stateNode=e,ra(t))}return an(t),null;case 5:if(w2(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ra(t);else{if(!i){if(t.stateNode===null)throw Error(ne(166));return an(t),null}if(e=Ro.current,M1(t))$S(t);else{switch(r=$2(Yl.current),e){case 1:e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=r.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof i.is=="string"?r.createElement("select",{is:i.is}):r.createElement("select"),i.multiple?e.multiple=!0:i.size&&(e.size=i.size);break;default:e=typeof i.is=="string"?r.createElement(n,{is:i.is}):r.createElement(n)}}e[Oi]=t,e[br]=i;e:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=e;e:switch(Ei(e,n,i),n){case"button":case"input":case"select":case"textarea":e=!!i.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&ra(t)}}return an(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ra(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(ne(166));if(e=Yl.current,M1(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,r=Wi,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[Oi]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||gO(e.nodeValue,n)),e||Vu(t)}else e=$2(e).createTextNode(i),e[Oi]=t,t.stateNode=e}return an(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=M1(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(ne(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(ne(317));r[Oi]=t}else Im(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;an(t),r=!1}else Rs!==null&&(S3(Rs),Rs=null),r=!0;if(!r)return t.flags&256?(Sa(t),t):(Sa(t),null)}if(Sa(t),t.flags&128)return t.lanes=n,t;if(n=i!==null,e=e!==null&&e.memoizedState!==null,n){i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool);var s=null;i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==r&&(i.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Op(t,t.updateQueue),an(t),null;case 4:return rh(),e===null&&Fv(t.stateNode.containerInfo),an(t),null;case 10:return Ma(t.type),an(t),null;case 19:if(ci(Yn),r=t.memoizedState,r===null)return an(t),null;if(i=(t.flags&128)!==0,s=r.rendering,s===null)if(i)L1(r,!1);else{if(En!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=R2(e),s!==null){for(t.flags|=128,L1(r,!1),e=s.updateQueue,t.updateQueue=e,Op(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)QN(n,e),n=n.sibling;return sn(Yn,Yn.current&1|2),t.child}e=e.sibling}r.tail!==null&&ko()>F2&&(t.flags|=128,i=!0,L1(r,!1),t.lanes=4194304)}else{if(!i)if(e=R2(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Op(t,e),L1(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!_t)return an(t),null}else 2*ko()-r.renderingStartTime>F2&&n!==536870912&&(t.flags|=128,i=!0,L1(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(e=r.last,e!==null?e.sibling=s:t.child=s,r.last=s)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=ko(),t.sibling=null,e=Yn.current,sn(Yn,i?e&1|2:e&1),t):(an(t),null);case 22:case 23:return Sa(t),hv(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(an(t),t.subtreeFlags&6&&(t.flags|=8192)):an(t),n=t.updateQueue,n!==null&&Op(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&ci(Cu),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ma(jn),an(t),null;case 25:return null}throw Error(ne(156,t.tag))}function VZ(e,t){switch(fv(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ma(jn),rh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return w2(t),null;case 13:if(Sa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));Im()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ci(Yn),null;case 4:return rh(),null;case 10:return Ma(t.type),null;case 22:case 23:return Sa(t),hv(),e!==null&&ci(Cu),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ma(jn),null;case 25:return null;default:return null}}function eO(e,t){switch(fv(t),t.tag){case 3:Ma(jn),rh();break;case 26:case 27:case 5:w2(t);break;case 4:rh();break;case 13:Sa(t);break;case 19:ci(Yn);break;case 10:Ma(t.type);break;case 22:case 23:Sa(t),hv(),e!==null&&ci(Cu);break;case 24:Ma(jn)}}var $Z={getCacheForType:function(e){var t=Pi(jn),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},GZ=typeof WeakMap=="function"?WeakMap:Map,dn=0,jt=null,et=null,ft=0,Vt=0,Sr=null,ba=!1,Wh=!1,Lv=!1,za=0,En=0,gc=0,Mu=0,Dv=0,rs=0,uh=0,Fg=null,To=null,v3=!1,Nv=0,F2=1/0,B2=null,ql=null,Pp=!1,su=null,Bg=0,_3=0,w3=null,zg=0,T3=null;function Nr(){if(dn&2&&ft!==0)return ft&-ft;if(Ge.T!==null){var e=lh;return e!==0?e:Pv()}return fD()}function tO(){rs===0&&(rs=!(ft&536870912)||_t?aD():536870912);var e=fs.current;return e!==null&&(e.flags|=32),rs}function Zi(e,t,n){(e===jt&&Vt===2||e.cancelPendingCommit!==null)&&(dh(e,0),ya(e,ft,rs,!1)),Tm(e,n),(!(dn&2)||e!==jt)&&(e===jt&&(!(dn&2)&&(Mu|=n),En===4&&ya(e,ft,rs,!1)),Wo(e))}function nO(e,t,n){if(dn&6)throw Error(ne(327));var i=!n&&(t&60)===0&&(t&e.expiredLanes)===0||wm(e,t),r=i?YZ(e,t):qy(e,t,!0),s=i;do{if(r===0){Wh&&!i&&ya(e,t,0,!1);break}else if(r===6)ya(e,t,0,!ba);else{if(n=e.current.alternate,s&&!XZ(n)){r=qy(e,t,!1),s=!1;continue}if(r===2){if(s=t,e.errorRecoveryDisabledLanes&s)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;r=Fg;var l=a.current.memoizedState.isDehydrated;if(l&&(dh(a,o).flags|=256),o=qy(a,o,!1),o!==2){if(Lv&&!l){a.errorRecoveryDisabledLanes|=s,Mu|=s,r=4;break e}s=To,To=r,s!==null&&S3(s)}r=o}if(s=!1,r!==2)continue}}if(r===1){dh(e,0),ya(e,t,0,!0);break}e:{switch(i=e,r){case 0:case 1:throw Error(ne(345));case 4:if((t&4194176)===t){ya(i,t,rs,!ba);break e}break;case 2:To=null;break;case 3:case 5:break;default:throw Error(ne(329))}if(i.finishedWork=n,i.finishedLanes=t,(t&62914560)===t&&(s=Nv+300-ko(),10<s)){if(ya(i,t,rs,!ba),w6(i,0)!==0)break e;i.timeoutHandle=pO(gI.bind(null,i,n,To,B2,v3,t,rs,Mu,uh,ba,2,-0,0),s);break e}gI(i,n,To,B2,v3,t,rs,Mu,uh,ba,0,-0,0)}}break}while(!0);Wo(e)}function S3(e){To===null?To=e:To.push.apply(To,e)}function gI(e,t,n,i,r,s,o,a,l,c,u,d,f){var h=t.subtreeFlags;if((h&8192||(h&16785408)===16785408)&&(T0={stylesheets:null,count:0,unsuspend:Iq},WN(t),t=Cq(),t!==null)){e.cancelPendingCommit=t(pI.bind(null,e,n,i,r,o,a,l,1,d,f)),ya(e,s,o,!c);return}pI(e,n,i,r,o,a,l,u,d,f)}function XZ(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var r=n[i],s=r.getSnapshot;r=r.value;try{if(!Fr(s(),r))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ya(e,t,n,i){t&=~Dv,t&=~Mu,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var s=31-Dr(r),o=1<<s;i[s]=-1,r&=~o}n!==0&&cD(e,n,t)}function L6(){return dn&6?!0:(Rm(0),!1)}function Ov(){if(et!==null){if(Vt===0)var e=et.return;else e=et,Ia=Td=null,Ev(e),$f=null,E0=0,e=et;for(;e!==null;)eO(e.alternate,e),e=e.return;et=null}}function dh(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,uq(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ov(),jt=e,et=n=Zl(e.current,null),ft=t,Vt=0,Sr=null,ba=!1,Wh=wm(e,t),Lv=!1,uh=rs=Dv=Mu=gc=En=0,To=Fg=null,v3=!1,t&8&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var r=31-Dr(i),s=1<<r;t|=e[r],i&=~s}return za=t,x6(),n}function iO(e,t){We=null,Ge.H=Po,t===Ag?(t=jS(),Vt=3):t===BD?(t=jS(),Vt=4):Vt=t===CN?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Sr=t,et===null&&(En=1,N2(e,es(t,e.current)))}function rO(){var e=Ge.H;return Ge.H=Po,e===null?Po:e}function sO(){var e=Ge.A;return Ge.A=$Z,e}function I3(){En=4,ba||(ft&4194176)!==ft&&fs.current!==null||(Wh=!0),!(gc&134217727)&&!(Mu&134217727)||jt===null||ya(jt,ft,rs,!1)}function qy(e,t,n){var i=dn;dn|=2;var r=rO(),s=sO();(jt!==e||ft!==t)&&(B2=null,dh(e,t)),t=!1;var o=En;e:do try{if(Vt!==0&&et!==null){var a=et,l=Sr;switch(Vt){case 8:Ov(),o=6;break e;case 3:case 2:case 6:fs.current===null&&(t=!0);var c=Vt;if(Vt=0,Sr=null,xf(e,a,l,c),n&&Wh){o=0;break e}break;default:c=Vt,Vt=0,Sr=null,xf(e,a,l,c)}}jZ(),o=En;break}catch(u){iO(e,u)}while(!0);return t&&e.shellSuspendCounter++,Ia=Td=null,dn=i,Ge.H=r,Ge.A=s,et===null&&(jt=null,ft=0,x6()),o}function jZ(){for(;et!==null;)oO(et)}function YZ(e,t){var n=dn;dn|=2;var i=rO(),r=sO();jt!==e||ft!==t?(B2=null,F2=ko()+500,dh(e,t)):Wh=wm(e,t);e:do try{if(Vt!==0&&et!==null){t=et;var s=Sr;t:switch(Vt){case 1:Vt=0,Sr=null,xf(e,t,s,1);break;case 2:if(XS(s)){Vt=0,Sr=null,mI(t);break}t=function(){Vt===2&&jt===e&&(Vt=7),Wo(e)},s.then(t,t);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:XS(s)?(Vt=0,Sr=null,mI(t)):(Vt=0,Sr=null,xf(e,t,s,7));break;case 5:var o=null;switch(et.tag){case 26:o=et.memoizedState;case 5:case 27:var a=et;if(!o||EO(o)){Vt=0,Sr=null;var l=a.sibling;if(l!==null)et=l;else{var c=a.return;c!==null?(et=c,D6(c)):et=null}break t}}Vt=0,Sr=null,xf(e,t,s,5);break;case 6:Vt=0,Sr=null,xf(e,t,s,6);break;case 8:Ov(),En=6;break e;default:throw Error(ne(462))}}WZ();break}catch(u){iO(e,u)}while(!0);return Ia=Td=null,Ge.H=i,Ge.A=r,dn=n,et!==null?0:(jt=null,ft=0,x6(),En)}function WZ(){for(;et!==null&&!pK();)oO(et)}function oO(e){var t=LN(e.alternate,e,za);e.memoizedProps=e.pendingProps,t===null?D6(e):et=t}function mI(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=oI(n,t,t.pendingProps,t.type,void 0,ft);break;case 11:t=oI(n,t,t.pendingProps,t.type.render,t.ref,ft);break;case 5:Ev(t);default:eO(n,t),t=et=QN(t,za),t=LN(n,t,za)}e.memoizedProps=e.pendingProps,t===null?D6(e):et=t}function xf(e,t,n,i){Ia=Td=null,Ev(t),$f=null,E0=0;var r=t.return;try{if(OZ(e,r,t,n,ft)){En=1,N2(e,es(n,e.current)),et=null;return}}catch(s){if(r!==null)throw et=r,s;En=1,N2(e,es(n,e.current)),et=null;return}t.flags&32768?(_t||i===1?e=!0:Wh||ft&536870912?e=!1:(ba=e=!0,(i===2||i===3||i===6)&&(i=fs.current,i!==null&&i.tag===13&&(i.flags|=16384))),aO(t,e)):D6(t)}function D6(e){var t=e;do{if(t.flags&32768){aO(t,ba);return}e=t.return;var n=HZ(t.alternate,t,za);if(n!==null){et=n;return}if(t=t.sibling,t!==null){et=t;return}et=t=e}while(t!==null);En===0&&(En=5)}function aO(e,t){do{var n=VZ(e.alternate,e);if(n!==null){n.flags&=32767,et=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){et=e;return}et=e=n}while(e!==null);En=6,et=null}function pI(e,t,n,i,r,s,o,a,l,c){var u=Ge.T,d=Kt.p;try{Kt.p=2,Ge.T=null,KZ(e,t,n,i,d,r,s,o,a,l,c)}finally{Ge.T=u,Kt.p=d}}function KZ(e,t,n,i,r,s,o,a){do Yf();while(su!==null);if(dn&6)throw Error(ne(327));var l=e.finishedWork;if(i=e.finishedLanes,l===null)return null;if(e.finishedWork=null,e.finishedLanes=0,l===e.current)throw Error(ne(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var c=l.lanes|l.childLanes;if(c|=cv,xK(e,i,c,s,o,a),e===jt&&(et=jt=null,ft=0),!(l.subtreeFlags&10256)&&!(l.flags&10256)||Pp||(Pp=!0,_3=c,w3=n,JZ(T2,function(){return Yf(),null})),n=(l.flags&15990)!==0,l.subtreeFlags&15990||n?(n=Ge.T,Ge.T=null,s=Kt.p,Kt.p=2,o=dn,dn|=4,FZ(e,l),XN(l,e),yZ(M3,e.containerInfo),Y2=!!A3,M3=A3=null,e.current=l,HN(e,l.alternate,l),UK(),dn=o,Kt.p=s,Ge.T=n):e.current=l,Pp?(Pp=!1,su=e,Bg=i):lO(e,c),c=e.pendingLanes,c===0&&(ql=null),_K(l.stateNode),Wo(e),t!==null)for(r=e.onRecoverableError,l=0;l<t.length;l++)c=t[l],r(c.value,{componentStack:c.stack});return Bg&3&&Yf(),c=e.pendingLanes,i&4194218&&c&42?e===T3?zg++:(zg=0,T3=e):zg=0,Rm(0),null}function lO(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,xm(t)))}function Yf(){if(su!==null){var e=su,t=_3;_3=0;var n=dD(Bg),i=Ge.T,r=Kt.p;try{if(Kt.p=32>n?32:n,Ge.T=null,su===null)var s=!1;else{n=w3,w3=null;var o=su,a=Bg;if(su=null,Bg=0,dn&6)throw Error(ne(331));var l=dn;if(dn|=4,ZN(o.current),YN(o,o.current,a,n),dn=l,Rm(0,!1),Lr&&typeof Lr.onPostCommitFiberRoot=="function")try{Lr.onPostCommitFiberRoot(_m,o)}catch{}s=!0}return s}finally{Kt.p=r,Ge.T=i,lO(e,t)}}return!1}function UI(e,t,n){t=es(n,t),t=d3(e.stateNode,t,2),e=Kl(e,t,2),e!==null&&(Tm(e,2),Wo(e))}function Ft(e,t,n){if(e.tag===3)UI(e,e,n);else for(;t!==null;){if(t.tag===3){UI(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(ql===null||!ql.has(i))){e=es(n,e),n=IN(2),i=Kl(t,n,2),i!==null&&(xN(n,i,t,e),Tm(i,2),Wo(i));break}}t=t.return}}function Qy(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new GZ;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(n)||(Lv=!0,r.add(n),e=ZZ.bind(null,e,t,n),t.then(e,e))}function ZZ(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,jt===e&&(ft&n)===n&&(En===4||En===3&&(ft&62914560)===ft&&300>ko()-Nv?!(dn&2)&&dh(e,0):Dv|=n,uh===ft&&(uh=0)),Wo(e)}function cO(e,t){t===0&&(t=lD()),e=dc(e,t),e!==null&&(Tm(e,t),Wo(e))}function qZ(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),cO(e,n)}function QZ(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(ne(314))}i!==null&&i.delete(t),cO(e,n)}function JZ(e,t){return tv(e,t)}var z2=null,af=null,x3=!1,H2=!1,Jy=!1,Ru=0;function Wo(e){e!==af&&e.next===null&&(af===null?z2=af=e:af=af.next=e),H2=!0,x3||(x3=!0,tq(eq))}function Rm(e,t){if(!Jy&&H2){Jy=!0;do for(var n=!1,i=z2;i!==null;){if(e!==0){var r=i.pendingLanes;if(r===0)var s=0;else{var o=i.suspendedLanes,a=i.pingedLanes;s=(1<<31-Dr(42|e)+1)-1,s&=r&~(o&~a),s=s&201326677?s&201326677|1:s?s|2:0}s!==0&&(n=!0,bI(i,s))}else s=ft,s=w6(i,i===jt?s:0),!(s&3)||wm(i,s)||(n=!0,bI(i,s));i=i.next}while(n);Jy=!1}}function eq(){H2=x3=!1;var e=0;Ru!==0&&(cq()&&(e=Ru),Ru=0);for(var t=ko(),n=null,i=z2;i!==null;){var r=i.next,s=uO(i,t);s===0?(i.next=null,n===null?z2=r:n.next=r,r===null&&(af=n)):(n=i,(e!==0||s&3)&&(H2=!0)),i=r}Rm(e)}function uO(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var o=31-Dr(s),a=1<<o,l=r[o];l===-1?(!(a&n)||a&i)&&(r[o]=IK(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}if(t=jt,n=ft,n=w6(e,e===t?n:0),i=e.callbackNode,n===0||e===t&&Vt===2||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Ay(i),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||wm(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&Ay(i),dD(n)){case 2:case 8:n=sD;break;case 32:n=T2;break;case 268435456:n=oD;break;default:n=T2}return i=dO.bind(null,e),n=tv(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&Ay(i),e.callbackPriority=2,e.callbackNode=null,2}function dO(e,t){var n=e.callbackNode;if(Yf()&&e.callbackNode!==n)return null;var i=ft;return i=w6(e,e===jt?i:0),i===0?null:(nO(e,i,t),uO(e,ko()),e.callbackNode!=null&&e.callbackNode===n?dO.bind(null,e):null)}function bI(e,t){if(Yf())return null;nO(e,t,!0)}function tq(e){dq(function(){dn&6?tv(rD,e):e()})}function Pv(){return Ru===0&&(Ru=aD()),Ru}function yI(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:RU(""+e)}function EI(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function nq(e,t,n,i,r){if(t==="submit"&&n&&n.stateNode===r){var s=yI((r[br]||null).action),o=i.submitter;o&&(t=(t=o[br]||null)?yI(t.formAction):o.getAttribute("formAction"),t!==null&&(s=t,o=null));var a=new T6("action","action",null,i,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ru!==0){var l=o?EI(r,o):new FormData(r);c3(n,{pending:!0,data:l,method:r.method,action:s},null,l)}}else typeof s=="function"&&(a.preventDefault(),l=o?EI(r,o):new FormData(r),c3(n,{pending:!0,data:l,method:r.method,action:s},s,l))},currentTarget:r}]})}}for(var e8=0;e8<HS.length;e8++){var t8=HS[e8],iq=t8.toLowerCase(),rq=t8[0].toUpperCase()+t8.slice(1);ro(iq,"on"+rq)}ro(kD,"onAnimationEnd");ro(LD,"onAnimationIteration");ro(DD,"onAnimationStart");ro("dblclick","onDoubleClick");ro("focusin","onFocus");ro("focusout","onBlur");ro(vZ,"onTransitionRun");ro(_Z,"onTransitionStart");ro(wZ,"onTransitionCancel");ro(ND,"onTransitionEnd");sh("onMouseEnter",["mouseout","mouseover"]);sh("onMouseLeave",["mouseout","mouseover"]);sh("onPointerEnter",["pointerout","pointerover"]);sh("onPointerLeave",["pointerout","pointerover"]);yd("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));yd("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));yd("onBeforeInput",["compositionend","keypress","textInput","paste"]);yd("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));yd("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));yd("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _0="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),sq=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_0));function fO(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],r=i.event;i=i.listeners;e:{var s=void 0;if(t)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;s=a,r.currentTarget=c;try{s(r)}catch(u){D2(u)}r.currentTarget=null,s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;s=a,r.currentTarget=c;try{s(r)}catch(u){D2(u)}r.currentTarget=null,s=l}}}}function it(e,t){var n=t[Z7];n===void 0&&(n=t[Z7]=new Set);var i=e+"__bubble";n.has(i)||(hO(t,e,2,!1),n.add(i))}function n8(e,t,n){var i=0;t&&(i|=4),hO(n,e,i,t)}var Fp="_reactListening"+Math.random().toString(36).slice(2);function Fv(e){if(!e[Fp]){e[Fp]=!0,hD.forEach(function(n){n!=="selectionchange"&&(sq.has(n)||n8(n,!1,e),n8(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fp]||(t[Fp]=!0,n8("selectionchange",!1,t))}}function hO(e,t,n,i){switch(SO(t)){case 2:var r=Rq;break;case 8:r=kq;break;default:r=Vv}n=r.bind(null,t,n,e),r=void 0,!e3||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),i?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function i8(e,t,n,i,r){var s=i;if(!(t&1)&&!(t&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=hu(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){i=s=o;continue e}a=a.parentNode}}i=i.return}vD(function(){var c=s,u=rv(n),d=[];e:{var f=OD.get(e);if(f!==void 0){var h=T6,m=e;switch(e){case"keypress":if(LU(n)===0)break e;case"keydown":case"keyup":h=QK;break;case"focusin":m="focus",h=Dy;break;case"focusout":m="blur",h=Dy;break;case"beforeblur":case"afterblur":h=Dy;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=AS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=zK;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=tZ;break;case kD:case LD:case DD:h=$K;break;case ND:h=iZ;break;case"scroll":case"scrollend":h=FK;break;case"wheel":h=sZ;break;case"copy":case"cut":case"paste":h=XK;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=RS;break;case"toggle":case"beforetoggle":h=aZ}var p=(t&4)!==0,b=!p&&(e==="scroll"||e==="scrollend"),E=p?f!==null?f+"Capture":null:f;p=[];for(var y=c,v;y!==null;){var _=y;if(v=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||v===null||E===null||(_=p0(y,E),_!=null&&p.push(w0(y,_,v))),b)break;y=y.return}0<p.length&&(f=new h(f,m,null,n,u),d.push({event:f,listeners:p}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==J7&&(m=n.relatedTarget||n.fromElement)&&(hu(m)||m[jh]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(m=n.relatedTarget||n.toElement,h=c,m=m?hu(m):null,m!==null&&(b=Xh(m),p=m.tag,m!==b||p!==5&&p!==27&&p!==6)&&(m=null)):(h=null,m=c),h!==m)){if(p=AS,_="onMouseLeave",E="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(p=RS,_="onPointerLeave",E="onPointerEnter",y="pointer"),b=h==null?f:sg(h),v=m==null?f:sg(m),f=new p(_,y+"leave",h,n,u),f.target=b,f.relatedTarget=v,_=null,hu(u)===c&&(p=new p(E,y+"enter",m,n,u),p.target=v,p.relatedTarget=b,_=p),b=_,h&&m)t:{for(p=h,E=m,y=0,v=p;v;v=Gd(v))y++;for(v=0,_=E;_;_=Gd(_))v++;for(;0<y-v;)p=Gd(p),y--;for(;0<v-y;)E=Gd(E),v--;for(;y--;){if(p===E||E!==null&&p===E.alternate)break t;p=Gd(p),E=Gd(E)}p=null}else p=null;h!==null&&vI(d,f,h,p,!1),m!==null&&b!==null&&vI(d,b,m,p,!0)}}e:{if(f=c?sg(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var I=NS;else if(DS(f))if(xD)I=UZ;else{I=mZ;var R=gZ}else h=f.nodeName,!h||h.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&iv(c.elementType)&&(I=NS):I=pZ;if(I&&(I=I(e,c))){ID(d,I,n,u);break e}R&&R(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&Q7(f,"number",f.value)}switch(R=c?sg(c):window,e){case"focusin":(DS(R)||R.contentEditable==="true")&&(vf=R,t3=c,Cg=null);break;case"focusout":Cg=t3=vf=null;break;case"mousedown":n3=!0;break;case"contextmenu":case"mouseup":case"dragend":n3=!1,zS(d,n,u);break;case"selectionchange":if(EZ)break;case"keydown":case"keyup":zS(d,n,u)}var w;if(av)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ef?TD(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(wD&&n.locale!=="ko"&&(Ef||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ef&&(w=_D()):(Fl=u,sv="value"in Fl?Fl.value:Fl.textContent,Ef=!0)),R=V2(c,T),0<R.length&&(T=new MS(T,e,null,n,u),d.push({event:T,listeners:R}),w?T.data=w:(w=SD(n),w!==null&&(T.data=w)))),(w=cZ?uZ(e,n):dZ(e,n))&&(T=V2(c,"onBeforeInput"),0<T.length&&(R=new MS("onBeforeInput","beforeinput",null,n,u),d.push({event:R,listeners:T}),R.data=w)),nq(d,e,c,n,u)}fO(d,t)})}function w0(e,t,n){return{instance:e,listener:t,currentTarget:n}}function V2(e,t){for(var n=t+"Capture",i=[];e!==null;){var r=e,s=r.stateNode;r=r.tag,r!==5&&r!==26&&r!==27||s===null||(r=p0(e,n),r!=null&&i.unshift(w0(e,r,s)),r=p0(e,t),r!=null&&i.push(w0(e,r,s))),e=e.return}return i}function Gd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function vI(e,t,n,i,r){for(var s=t._reactName,o=[];n!==null&&n!==i;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===i)break;a!==5&&a!==26&&a!==27||c===null||(l=c,r?(c=p0(n,s),c!=null&&o.unshift(w0(n,c,l))):r||(c=p0(n,s),c!=null&&o.push(w0(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var oq=/\r\n?/g,aq=/\u0000|\uFFFD/g;function _I(e){return(typeof e=="string"?e:""+e).replace(oq,`
`).replace(aq,"")}function gO(e,t){return t=_I(t),_I(e)===t}function N6(){}function kt(e,t,n,i,r,s){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||oh(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&oh(e,""+i);break;case"className":Mp(e,"class",i);break;case"tabIndex":Mp(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Mp(e,n,i);break;case"style":ED(e,i,s);break;case"data":if(t!=="object"){Mp(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=RU(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof s=="function"&&(n==="formAction"?(t!=="input"&&kt(e,t,"name",r.name,r,null),kt(e,t,"formEncType",r.formEncType,r,null),kt(e,t,"formMethod",r.formMethod,r,null),kt(e,t,"formTarget",r.formTarget,r,null)):(kt(e,t,"encType",r.encType,r,null),kt(e,t,"method",r.method,r,null),kt(e,t,"target",r.target,r,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=RU(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=N6);break;case"onScroll":i!=null&&it("scroll",e);break;case"onScrollEnd":i!=null&&it("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ne(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(ne(60));e.innerHTML=n}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}n=RU(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""+i):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":it("beforetoggle",e),it("toggle",e),MU(e,"popover",i);break;case"xlinkActuate":ta(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ta(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ta(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ta(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ta(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ta(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ta(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ta(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ta(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":MU(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=OK.get(n)||n,MU(e,n,i))}}function C3(e,t,n,i,r,s){switch(n){case"style":ED(e,i,s);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(ne(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(ne(60));e.innerHTML=n}}break;case"children":typeof i=="string"?oh(e,i):(typeof i=="number"||typeof i=="bigint")&&oh(e,""+i);break;case"onScroll":i!=null&&it("scroll",e);break;case"onScrollEnd":i!=null&&it("scrollend",e);break;case"onClick":i!=null&&(e.onclick=N6);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gD.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),s=e[br]||null,s=s!=null?s[n]:null,typeof s=="function"&&e.removeEventListener(t,s,r),typeof i=="function")){typeof s!="function"&&s!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,r);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):MU(e,n,i)}}}function Ei(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",e),it("load",e);var i=!1,r=!1,s;for(s in n)if(n.hasOwnProperty(s)){var o=n[s];if(o!=null)switch(s){case"src":i=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ne(137,t));default:kt(e,t,s,o,n,null)}}r&&kt(e,t,"srcSet",n.srcSet,n,null),i&&kt(e,t,"src",n.src,n,null);return;case"input":it("invalid",e);var a=s=o=r=null,l=null,c=null;for(i in n)if(n.hasOwnProperty(i)){var u=n[i];if(u!=null)switch(i){case"name":r=u;break;case"type":o=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":s=u;break;case"defaultValue":a=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(ne(137,t));break;default:kt(e,t,i,u,n,null)}}UD(e,s,a,l,c,o,r,!1),S2(e);return;case"select":it("invalid",e),i=o=s=null;for(r in n)if(n.hasOwnProperty(r)&&(a=n[r],a!=null))switch(r){case"value":s=a;break;case"defaultValue":o=a;break;case"multiple":i=a;default:kt(e,t,r,a,n,null)}t=s,n=o,e.multiple=!!i,t!=null?Hf(e,!!i,t,!1):n!=null&&Hf(e,!!i,n,!0);return;case"textarea":it("invalid",e),s=r=i=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":i=a;break;case"defaultValue":r=a;break;case"children":s=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(ne(91));break;default:kt(e,t,o,a,n,null)}yD(e,i,r,s),S2(e);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(i=n[l],i!=null))switch(l){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:kt(e,t,l,i,n,null)}return;case"dialog":it("cancel",e),it("close",e);break;case"iframe":case"object":it("load",e);break;case"video":case"audio":for(i=0;i<_0.length;i++)it(_0[i],e);break;case"image":it("error",e),it("load",e);break;case"details":it("toggle",e);break;case"embed":case"source":case"link":it("error",e),it("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(i=n[c],i!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(ne(137,t));default:kt(e,t,c,i,n,null)}return;default:if(iv(t)){for(u in n)n.hasOwnProperty(u)&&(i=n[u],i!==void 0&&C3(e,t,u,i,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(i=n[a],i!=null&&kt(e,t,a,i,n,null))}function lq(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,s=null,o=null,a=null,l=null,c=null,u=null;for(h in n){var d=n[h];if(n.hasOwnProperty(h)&&d!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":l=d;default:i.hasOwnProperty(h)||kt(e,t,h,null,i,d)}}for(var f in i){var h=i[f];if(d=n[f],i.hasOwnProperty(f)&&(h!=null||d!=null))switch(f){case"type":s=h;break;case"name":r=h;break;case"checked":c=h;break;case"defaultChecked":u=h;break;case"value":o=h;break;case"defaultValue":a=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(ne(137,t));break;default:h!==d&&kt(e,t,f,h,i,d)}}q7(e,o,a,l,c,u,s,r);return;case"select":h=o=a=f=null;for(s in n)if(l=n[s],n.hasOwnProperty(s)&&l!=null)switch(s){case"value":break;case"multiple":h=l;default:i.hasOwnProperty(s)||kt(e,t,s,null,i,l)}for(r in i)if(s=i[r],l=n[r],i.hasOwnProperty(r)&&(s!=null||l!=null))switch(r){case"value":f=s;break;case"defaultValue":a=s;break;case"multiple":o=s;default:s!==l&&kt(e,t,r,s,i,l)}t=a,n=o,i=h,f!=null?Hf(e,!!n,f,!1):!!i!=!!n&&(t!=null?Hf(e,!!n,t,!0):Hf(e,!!n,n?[]:"",!1));return;case"textarea":h=f=null;for(a in n)if(r=n[a],n.hasOwnProperty(a)&&r!=null&&!i.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:kt(e,t,a,null,i,r)}for(o in i)if(r=i[o],s=n[o],i.hasOwnProperty(o)&&(r!=null||s!=null))switch(o){case"value":f=r;break;case"defaultValue":h=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(ne(91));break;default:r!==s&&kt(e,t,o,r,i,s)}bD(e,f,h);return;case"option":for(var m in n)if(f=n[m],n.hasOwnProperty(m)&&f!=null&&!i.hasOwnProperty(m))switch(m){case"selected":e.selected=!1;break;default:kt(e,t,m,null,i,f)}for(l in i)if(f=i[l],h=n[l],i.hasOwnProperty(l)&&f!==h&&(f!=null||h!=null))switch(l){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:kt(e,t,l,f,i,h)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var p in n)f=n[p],n.hasOwnProperty(p)&&f!=null&&!i.hasOwnProperty(p)&&kt(e,t,p,null,i,f);for(c in i)if(f=i[c],h=n[c],i.hasOwnProperty(c)&&f!==h&&(f!=null||h!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(ne(137,t));break;default:kt(e,t,c,f,i,h)}return;default:if(iv(t)){for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!==void 0&&!i.hasOwnProperty(b)&&C3(e,t,b,void 0,i,f);for(u in i)f=i[u],h=n[u],!i.hasOwnProperty(u)||f===h||f===void 0&&h===void 0||C3(e,t,u,f,i,h);return}}for(var E in n)f=n[E],n.hasOwnProperty(E)&&f!=null&&!i.hasOwnProperty(E)&&kt(e,t,E,null,i,f);for(d in i)f=i[d],h=n[d],!i.hasOwnProperty(d)||f===h||f==null&&h==null||kt(e,t,d,f,i,h)}var A3=null,M3=null;function $2(e){return e.nodeType===9?e:e.ownerDocument}function wI(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mO(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function R3(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var r8=null;function cq(){var e=window.event;return e&&e.type==="popstate"?e===r8?!1:(r8=e,!0):(r8=null,!1)}var pO=typeof setTimeout=="function"?setTimeout:void 0,uq=typeof clearTimeout=="function"?clearTimeout:void 0,TI=typeof Promise=="function"?Promise:void 0,dq=typeof queueMicrotask=="function"?queueMicrotask:typeof TI<"u"?function(e){return TI.resolve(null).then(e).catch(fq)}:pO;function fq(e){setTimeout(function(){throw e})}function s8(e,t){var n=t,i=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(i===0){e.removeChild(r),C0(t);return}i--}else n!=="$"&&n!=="$?"&&n!=="$!"||i++;n=r}while(n);C0(t)}function k3(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":k3(n),nv(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function hq(e,t,n,i){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[m0])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==r.rel||e.getAttribute("href")!==(r.href==null?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=Hs(e.nextSibling),e===null)break}return null}function gq(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Hs(e.nextSibling),e===null))return null;return e}function Hs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="F!"||t==="F")break;if(t==="/$")return null}}return e}function SI(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}function UO(e,t,n){switch(t=$2(n),e){case"html":if(e=t.documentElement,!e)throw Error(ne(452));return e;case"head":if(e=t.head,!e)throw Error(ne(453));return e;case"body":if(e=t.body,!e)throw Error(ne(454));return e;default:throw Error(ne(451))}}var hs=new Map,II=new Set;function G2(e){return typeof e.getRootNode=="function"?e.getRootNode():e.ownerDocument}var ol=Kt.d;Kt.d={f:mq,r:pq,D:Uq,C:bq,L:yq,m:Eq,X:_q,S:vq,M:wq};function mq(){var e=ol.f(),t=L6();return e||t}function pq(e){var t=Yh(e);t!==null&&t.tag===5&&t.type==="form"?UN(t):ol.r(e)}var Kh=typeof document>"u"?null:document;function bO(e,t,n){var i=Kh;if(i&&typeof t=="string"&&t){var r=Jr(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),II.has(r)||(II.add(r),e={rel:e,crossOrigin:n,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),Ei(t,"link",e),ri(t),i.head.appendChild(t)))}}function Uq(e){ol.D(e),bO("dns-prefetch",e,null)}function bq(e,t){ol.C(e,t),bO("preconnect",e,t)}function yq(e,t,n){ol.L(e,t,n);var i=Kh;if(i&&e&&t){var r='link[rel="preload"][as="'+Jr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+Jr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+Jr(n.imageSizes)+'"]')):r+='[href="'+Jr(e)+'"]';var s=r;switch(t){case"style":s=fh(e);break;case"script":s=Zh(e)}hs.has(s)||(e=Zt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),hs.set(s,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(km(s))||t==="script"&&i.querySelector(Lm(s))||(t=i.createElement("link"),Ei(t,"link",e),ri(t),i.head.appendChild(t)))}}function Eq(e,t){ol.m(e,t);var n=Kh;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Jr(i)+'"][href="'+Jr(e)+'"]',s=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Zh(e)}if(!hs.has(s)&&(e=Zt({rel:"modulepreload",href:e},t),hs.set(s,e),n.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Lm(s)))return}i=n.createElement("link"),Ei(i,"link",e),ri(i),n.head.appendChild(i)}}}function vq(e,t,n){ol.S(e,t,n);var i=Kh;if(i&&e){var r=zf(i).hoistableStyles,s=fh(e);t=t||"default";var o=r.get(s);if(!o){var a={loading:0,preload:null};if(o=i.querySelector(km(s)))a.loading=5;else{e=Zt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=hs.get(s))&&Bv(e,n);var l=o=i.createElement("link");ri(l),Ei(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,BU(o,t,i)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(s,o)}}}function _q(e,t){ol.X(e,t);var n=Kh;if(n&&e){var i=zf(n).hoistableScripts,r=Zh(e),s=i.get(r);s||(s=n.querySelector(Lm(r)),s||(e=Zt({src:e,async:!0},t),(t=hs.get(r))&&zv(e,t),s=n.createElement("script"),ri(s),Ei(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(r,s))}}function wq(e,t){ol.M(e,t);var n=Kh;if(n&&e){var i=zf(n).hoistableScripts,r=Zh(e),s=i.get(r);s||(s=n.querySelector(Lm(r)),s||(e=Zt({src:e,async:!0,type:"module"},t),(t=hs.get(r))&&zv(e,t),s=n.createElement("script"),ri(s),Ei(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(r,s))}}function xI(e,t,n,i){var r=(r=Yl.current)?G2(r):null;if(!r)throw Error(ne(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=fh(n.href),n=zf(r).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=fh(n.href);var s=zf(r).hoistableStyles,o=s.get(e);if(o||(r=r.ownerDocument||r,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,o),(s=r.querySelector(km(e)))&&!s._p&&(o.instance=s,o.state.loading=5),hs.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},hs.set(e,n),s||Tq(r,e,n,o.state))),t&&i===null)throw Error(ne(528,""));return o}if(t&&i!==null)throw Error(ne(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Zh(n),n=zf(r).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(ne(444,e))}}function fh(e){return'href="'+Jr(e)+'"'}function km(e){return'link[rel="stylesheet"]['+e+"]"}function yO(e){return Zt({},e,{"data-precedence":e.precedence,precedence:null})}function Tq(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Ei(t,"link",n),ri(t),e.head.appendChild(t))}function Zh(e){return'[src="'+Jr(e)+'"]'}function Lm(e){return"script[async]"+e}function CI(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Jr(n.href)+'"]');if(i)return t.instance=i,ri(i),i;var r=Zt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),ri(i),Ei(i,"style",r),BU(i,n.precedence,e),t.instance=i;case"stylesheet":r=fh(n.href);var s=e.querySelector(km(r));if(s)return t.state.loading|=4,t.instance=s,ri(s),s;i=yO(n),(r=hs.get(r))&&Bv(i,r),s=(e.ownerDocument||e).createElement("link"),ri(s);var o=s;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ei(s,"link",i),t.state.loading|=4,BU(s,n.precedence,e),t.instance=s;case"script":return s=Zh(n.src),(r=e.querySelector(Lm(s)))?(t.instance=r,ri(r),r):(i=n,(r=hs.get(s))&&(i=Zt({},n),zv(i,r)),e=e.ownerDocument||e,r=e.createElement("script"),ri(r),Ei(r,"link",i),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(ne(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(i=t.instance,t.state.loading|=4,BU(i,n.precedence,e));return t.instance}function BU(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,s=r,o=0;o<i.length;o++){var a=i[o];if(a.dataset.precedence===t)s=a;else if(s!==r)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Bv(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function zv(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zU=null;function AI(e,t,n){if(zU===null){var i=new Map,r=zU=new Map;r.set(n,i)}else r=zU,i=r.get(n),i||(i=new Map,r.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var s=n[r];if(!(s[m0]||s[Oi]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var o=s.getAttribute(t)||"";o=e+o;var a=i.get(o);a?a.push(s):i.set(o,[s])}}return i}function MI(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Sq(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function EO(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var T0=null;function Iq(){}function xq(e,t,n){if(T0===null)throw Error(ne(475));var i=T0;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var r=fh(n.href),s=e.querySelector(km(r));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(i.count++,i=X2.bind(i),e.then(i,i)),t.state.loading|=4,t.instance=s,ri(s);return}s=e.ownerDocument||e,n=yO(n),(r=hs.get(r))&&Bv(n,r),s=s.createElement("link"),ri(s);var o=s;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ei(s,"link",n),t.instance=s}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(i.count++,t=X2.bind(i),e.addEventListener("load",t),e.addEventListener("error",t))}}function Cq(){if(T0===null)throw Error(ne(475));var e=T0;return e.stylesheets&&e.count===0&&L3(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&L3(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}function X2(){if(this.count--,this.count===0){if(this.stylesheets)L3(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var j2=null;function L3(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,j2=new Map,t.forEach(Aq,e),j2=null,X2.call(e))}function Aq(e,t){if(!(t.state.loading&4)){var n=j2.get(e);if(n)var i=n.get(null);else{n=new Map,j2.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<r.length;s++){var o=r[s];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),i=o)}i&&n.set(null,i)}r=t.instance,o=r.getAttribute("data-precedence"),s=n.get(o)||i,s===i&&n.set(null,r),n.set(o,r),this.count++,i=X2.bind(this),r.addEventListener("load",i),r.addEventListener("error",i),s?s.parentNode.insertBefore(r,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var S0={$$typeof:_a,Provider:null,Consumer:null,_currentValue:Iu,_currentValue2:Iu,_threadCount:0};function Mq(e,t,n,i,r,s,o,a){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=My(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=My(0),this.hiddenUpdates=My(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=s,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=a,this.incompleteTransitions=new Map}function vO(e,t,n,i,r,s,o,a,l,c,u,d){return e=new Mq(e,t,n,o,a,l,c,d),t=1,s===!0&&(t|=24),s=is(3,null,null,t),e.current=s,s.stateNode=e,t=gv(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:i,isDehydrated:n,cache:t},Av(s),e}function _O(e){return e?(e=Tf,e):Tf}function wO(e,t,n,i,r,s){r=_O(r),i.context===null?i.context=r:i.pendingContext=r,i=Wl(t),i.payload={element:n},s=s===void 0?null:s,s!==null&&(i.callback=s),n=Kl(e,i,t),n!==null&&(Zi(n,e,t),Dg(n,e,t))}function RI(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Hv(e,t){RI(e,t),(e=e.alternate)&&RI(e,t)}function TO(e){if(e.tag===13){var t=dc(e,67108864);t!==null&&Zi(t,e,67108864),Hv(e,67108864)}}var Y2=!0;function Rq(e,t,n,i){var r=Ge.T;Ge.T=null;var s=Kt.p;try{Kt.p=2,Vv(e,t,n,i)}finally{Kt.p=s,Ge.T=r}}function kq(e,t,n,i){var r=Ge.T;Ge.T=null;var s=Kt.p;try{Kt.p=8,Vv(e,t,n,i)}finally{Kt.p=s,Ge.T=r}}function Vv(e,t,n,i){if(Y2){var r=D3(i);if(r===null)i8(e,t,i,W2,n),kI(e,i);else if(Dq(r,e,t,n,i))i.stopPropagation();else if(kI(e,i),t&4&&-1<Lq.indexOf(e)){for(;r!==null;){var s=Yh(r);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var o=Qc(s.pendingLanes);if(o!==0){var a=s;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Dr(o);a.entanglements[1]|=l,o&=~l}Wo(s),!(dn&6)&&(F2=ko()+500,Rm(0))}}break;case 13:a=dc(s,2),a!==null&&Zi(a,s,2),L6(),Hv(s,2)}if(s=D3(i),s===null&&i8(e,t,i,W2,n),s===r)break;r=s}r!==null&&i.stopPropagation()}else i8(e,t,i,null,n)}}function D3(e){return e=rv(e),$v(e)}var W2=null;function $v(e){if(W2=null,e=hu(e),e!==null){var t=Xh(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=nD(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return W2=e,null}function SO(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bK()){case rD:return 2;case sD:return 8;case T2:case yK:return 32;case oD:return 268435456;default:return 32}default:return 32}}var N3=!1,Ql=null,Jl=null,ec=null,I0=new Map,x0=new Map,Ll=[],Lq="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function kI(e,t){switch(e){case"focusin":case"focusout":Ql=null;break;case"dragenter":case"dragleave":Jl=null;break;case"mouseover":case"mouseout":ec=null;break;case"pointerover":case"pointerout":I0.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":x0.delete(t.pointerId)}}function D1(e,t,n,i,r,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},t!==null&&(t=Yh(t),t!==null&&TO(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Dq(e,t,n,i,r){switch(t){case"focusin":return Ql=D1(Ql,e,t,n,i,r),!0;case"dragenter":return Jl=D1(Jl,e,t,n,i,r),!0;case"mouseover":return ec=D1(ec,e,t,n,i,r),!0;case"pointerover":var s=r.pointerId;return I0.set(s,D1(I0.get(s)||null,e,t,n,i,r)),!0;case"gotpointercapture":return s=r.pointerId,x0.set(s,D1(x0.get(s)||null,e,t,n,i,r)),!0}return!1}function IO(e){var t=hu(e.target);if(t!==null){var n=Xh(t);if(n!==null){if(t=n.tag,t===13){if(t=nD(n),t!==null){e.blockedOn=t,CK(e.priority,function(){if(n.tag===13){var i=Nr(),r=dc(n,i);r!==null&&Zi(r,n,i),Hv(n,i)}});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function HU(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=D3(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);J7=i,n.target.dispatchEvent(i),J7=null}else return t=Yh(n),t!==null&&TO(t),e.blockedOn=n,!1;t.shift()}return!0}function LI(e,t,n){HU(e)&&n.delete(t)}function Nq(){N3=!1,Ql!==null&&HU(Ql)&&(Ql=null),Jl!==null&&HU(Jl)&&(Jl=null),ec!==null&&HU(ec)&&(ec=null),I0.forEach(LI),x0.forEach(LI)}function Bp(e,t){e.blockedOn===t&&(e.blockedOn=null,N3||(N3=!0,qn.unstable_scheduleCallback(qn.unstable_NormalPriority,Nq)))}var zp=null;function DI(e){zp!==e&&(zp=e,qn.unstable_scheduleCallback(qn.unstable_NormalPriority,function(){zp===e&&(zp=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],r=e[t+2];if(typeof i!="function"){if($v(i||n)===null)continue;break}var s=Yh(n);s!==null&&(e.splice(t,3),t-=3,c3(s,{pending:!0,data:r,method:n.method,action:i},i,r))}}))}function C0(e){function t(l){return Bp(l,e)}Ql!==null&&Bp(Ql,e),Jl!==null&&Bp(Jl,e),ec!==null&&Bp(ec,e),I0.forEach(t),x0.forEach(t);for(var n=0;n<Ll.length;n++){var i=Ll[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Ll.length&&(n=Ll[0],n.blockedOn===null);)IO(n),n.blockedOn===null&&Ll.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var r=n[i],s=n[i+1],o=r[br]||null;if(typeof s=="function")o||DI(n);else if(o){var a=null;if(s&&s.hasAttribute("formAction")){if(r=s,o=s[br]||null)a=o.formAction;else if($v(r)!==null)continue}else a=o.action;typeof a=="function"?n[i+1]=a:(n.splice(i,3),i-=3),DI(n)}}}function Gv(e){this._internalRoot=e}O6.prototype.render=Gv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ne(409));var n=t.current,i=Nr();wO(n,i,e,t,null,null)};O6.prototype.unmount=Gv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;e.tag===0&&Yf(),wO(e.current,2,null,e,null,null),L6(),t[jh]=null}};function O6(e){this._internalRoot=e}O6.prototype.unstable_scheduleHydration=function(e){if(e){var t=fD();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ll.length&&t!==0&&t<Ll[n].priority;n++);Ll.splice(n,0,e),n===0&&IO(e)}};var NI=qL.version;if(NI!=="19.0.0")throw Error(ne(527,NI,"19.0.0"));Kt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ne(188)):(e=Object.keys(e).join(","),Error(ne(268,e)));return e=mK(t),e=e!==null?iD(e):null,e=e===null?null:e.stateNode,e};var Oq={bundleType:0,version:"19.0.0",rendererPackageName:"react-dom",currentDispatcherRef:Ge,findFiberByHostInstance:hu,reconcilerVersion:"19.0.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hp.isDisabled&&Hp.supportsFiber)try{_m=Hp.inject(Oq),Lr=Hp}catch{}}v6.createRoot=function(e,t){if(!QL(e))throw Error(ne(299));var n=!1,i="",r=wN,s=TN,o=SN,a=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(a=t.unstable_transitionCallbacks)),t=vO(e,1,!1,null,null,n,i,r,s,o,a,null),e[jh]=t.current,Fv(e.nodeType===8?e.parentNode:e),new Gv(t)};v6.hydrateRoot=function(e,t,n){if(!QL(e))throw Error(ne(299));var i=!1,r="",s=wN,o=TN,a=SN,l=null,c=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(l=n.unstable_transitionCallbacks),n.formState!==void 0&&(c=n.formState)),t=vO(e,1,!0,t,n??null,i,r,s,o,a,l,c),t.context=_O(null),n=t.current,i=Nr(),r=Wl(i),r.callback=null,Kl(n,r,i),t.current.lanes=i,Tm(t,i),Wo(t),e[jh]=t.current,Fv(e),new O6(t)};v6.version="19.0.0";function xO(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xO)}catch(e){console.error(e)}}xO(),XL.exports=v6;var Pq=XL.exports;const CO=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,"at",{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML="",this.append(...e)})};var Fq={VITE_APP_BACKEND_V2_GET_URL:"https://json.excalidraw.com/api/v2/",VITE_APP_BACKEND_V2_POST_URL:"https://json.excalidraw.com/api/v2/post/",VITE_APP_LIBRARY_URL:"https://libraries.excalidraw.com",VITE_APP_LIBRARY_BACKEND:"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries",VITE_APP_PLUS_LP:"https://plus.excalidraw.com",VITE_APP_PLUS_APP:"https://app.excalidraw.com",VITE_APP_AI_BACKEND:"https://oss-ai.excalidraw.com",VITE_APP_WS_SERVER_URL:"https://oss-collab.excalidraw.com",VITE_APP_FIREBASE_CONFIG:'{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}',VITE_APP_ENABLE_TRACKING:"false",VITE_APP_PLUS_EXPORT_PUBLIC_KEY:`MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApQ0jM9Qz8TdFLzcuAZZX
/WvuKSOJxiw6AR/ZcE3eFQWM/mbFdhQgyK8eHGkKQifKzH1xUZjCxyXcxW6ZO02t
kPOPxhz+nxUrIoWCD/V4NGmUA1lxwHuO21HN1gzKrN3xHg5EGjyouR9vibT9VDGF
gq6+4Ic/kJX+AD2MM7Yre2+FsOdysrmuW2Fu3ahuC1uQE7pOe1j0k7auNP0y1q53
PrB8Ts2LUpepWC1l7zIXFm4ViDULuyWXTEpUcHSsEH8vpd1tckjypxCwkipfZsXx
iPszy0o0Dx2iArPfWMXlFAI9mvyFCyFC3+nSvfyAUb2C4uZgCwAuyFh/ydPF4DEE
PQIDAQAB`,VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX:"false",VITE_APP_COLLAPSE_OVERLAY:"false",VITE_APP_ENABLE_ESLINT:"false",VITE_APP_DISABLE_SENTRY:"true",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Bq=new Set(["command_palette","export"]),ut=(e,t,n,i)=>{try{typeof window>"u"||Fq.VITE_WORKER_ID;return}catch(r){console.error("error during analytics",r)}},zq="#ffffff",Hq="#000000",Vq=["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],$q=["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],Gq=["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],Xq=["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],jq=["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],Yq=["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],Wq=["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],Kq=["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],Zq=["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],qq=["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],Qq=["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],Jq=["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],eQ=["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"],li={white:zq,black:Hq,gray:Vq,red:$q,pink:Gq,grape:Xq,violet:jq,indigo:Yq,blue:Wq,cyan:Kq,teal:Zq,green:qq,lime:Qq,yellow:Jq,orange:eQ},tQ=(e,t)=>t.reduce((n,i)=>(i in e&&(n[i]=e[i]),n),{}),nQ=5,lf=5,iQ=4,ag=4,lg=1,_s=[0,2,4,6,8],ws=(e,t)=>t.map(n=>li[e][n]),$e={transparent:"transparent",black:"#1e1e1e",white:"#ffffff",gray:ws("gray",_s),red:ws("red",_s),pink:ws("pink",_s),grape:ws("grape",_s),violet:ws("violet",_s),blue:ws("blue",_s),cyan:ws("cyan",_s),teal:ws("teal",_s),green:ws("green",_s),yellow:ws("yellow",_s),orange:ws("orange",_s),bronze:["#f8f1ee","#eaddd7","#d2bab0","#a18072","#846358"]},AO=tQ($e,["cyan","blue","violet","grape","pink","green","teal","yellow","orange","red"]),MO=[$e.black,$e.red[ag],$e.green[ag],$e.blue[ag],$e.yellow[ag]],RO=[$e.transparent,$e.red[lg],$e.green[lg],$e.blue[lg],$e.yellow[lg]],kO=[$e.white,"#f8f9fa","#f5faff","#fffce8","#fdf8f6"],rQ={transparent:$e.transparent,white:$e.white,gray:$e.gray,black:$e.black,bronze:$e.bronze,...AO},sQ={transparent:$e.transparent,white:$e.white,gray:$e.gray,black:$e.black,bronze:$e.bronze,...AO},oQ=e=>[$e.cyan[e],$e.blue[e],$e.violet[e],$e.grape[e],$e.pink[e],$e.green[e],$e.teal[e],$e.yellow[e],$e.orange[e],$e.red[e]],aQ=(e,t,n)=>`#${((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)}`,Fo=/Mac|iPod|iPhone|iPad/.test(navigator.platform),LO=/^Win/.test(navigator.platform),lQ=/\b(android)\b/i.test(navigator.userAgent),A0="netscape"in window&&navigator.userAgent.indexOf("rv:")>1&&navigator.userAgent.indexOf("Gecko")>1,cQ=navigator.userAgent.indexOf("Chrome")!==-1,uQ=!cQ&&navigator.userAgent.indexOf("Safari")!==-1,DO=/iPad|iPhone/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,dQ=()=>{var e,t;return((t=(e=navigator.brave)==null?void 0:e.isBrave)==null?void 0:t.name)==="isBrave"},O3=typeof window<"u"&&"ResizeObserver"in window,Ra="kj-diagramming",fQ=36,eu=10,VU=8,hQ=5,OI=1,gQ=30,mc=Math.PI/12,mQ="red",Tt={TEXT:"text",CROSSHAIR:"crosshair",GRABBING:"grabbing",GRAB:"grab",POINTER:"pointer",MOVE:"move",AUTO:""},El={MAIN:0,WHEEL:1,SECONDARY:2,TOUCH:-1,ERASER:5},tu={enabled:"all",disabled:"none",inheritFromUI:"var(--ui-pointerEvents)"};var te=(e=>(e.COPY="copy",e.PASTE="paste",e.CUT="cut",e.KEYDOWN="keydown",e.KEYUP="keyup",e.MOUSE_MOVE="mousemove",e.RESIZE="resize",e.UNLOAD="unload",e.FOCUS="focus",e.BLUR="blur",e.DRAG_OVER="dragover",e.DROP="drop",e.GESTURE_END="gestureend",e.BEFORE_UNLOAD="beforeunload",e.GESTURE_START="gesturestart",e.GESTURE_CHANGE="gesturechange",e.POINTER_MOVE="pointermove",e.POINTER_DOWN="pointerdown",e.POINTER_UP="pointerup",e.STATE_CHANGE="statechange",e.WHEEL="wheel",e.TOUCH_START="touchstart",e.TOUCH_END="touchend",e.HASHCHANGE="hashchange",e.VISIBILITY_CHANGE="visibilitychange",e.SCROLL="scroll",e.EXCALIDRAW_LINK="excalidraw-link",e.MENU_ITEM_SELECT="menu.itemSelect",e.MESSAGE="message",e.FULLSCREENCHANGE="fullscreenchange",e))(te||{});const Vp={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},NO={TEST:"test"},hh={SHAPE_ACTIONS_MENU:"App-menu__left",ZOOM_ACTIONS:"zoom-actions",SEARCH_MENU_INPUT_WRAPPER:"layer-ui__search-inputWrapper"},Cf="Xiaolai",M0="Segoe UI Emoji",At={Virgil:1,Helvetica:2,Cascadia:3,Excalifont:5,Nunito:6,"Lilita One":7,"Comic Shanns":8,"Liberation Sans":9,"Roboto Mono":10,"Liberation Mono":11,"Liberation Serif":12,"JetBrains Mono":13,"Adwaita Sans":14},Af={[Cf]:100,[M0]:1e3},OO=e=>{switch(e){case At.Excalifont:return[Cf,M0];default:return[M0]}},xe={LIGHT:"light",DARK:"dark"},tn={strokeColor:"#bbb",strokeWidth:2,strokeStyle:"solid",fillStyle:"solid",roughness:0,roundness:null,backgroundColor:"transparent",radius:8,nameOffsetY:3,nameColorLightTheme:"#999999",nameColorDarkTheme:"#7a7a7a",nameFontSize:14,nameLineHeight:1.25},Xv=1,al=20,Oc=At.Excalifont,Dm="left",K2="top",PO="{version}",Yu=2,Z2=2*Yu,pQ=1e-5,UQ=2*Z2-pQ,$p="#ffffff",bQ="#1e1e1e",yQ="#a2f1a6",q2=20,FO=5,gh={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",jfif:"image/jfif"},ye={text:"text/plain",html:"text/html",json:"application/json",excalidraw:"application/vnd.excalidraw+json",excalidrawlib:"application/vnd.excalidrawlib+json","excalidraw.svg":"image/svg+xml","excalidraw.png":"image/png",binary:"application/octet-stream",...gh},EQ=[ye.text,ye.html,...Object.values(gh)],o8={png:"png",svg:"svg",clipboard:"clipboard"},as={excalidraw:"excalidraw",excalidrawClipboard:"excalidraw/clipboard",excalidrawLibrary:"excalidrawlib",excalidrawClipboardWithAPI:"excalidraw-api/clipboard"},jv=window.EXCALIDRAW_EXPORT_SOURCE||window.location.origin,vQ=500,_Q=300,wQ=500,TQ=1e4,SQ=3e4,IQ=100,P6=.1,Yv=.1,Wv=30,xQ=300,PI=6e4,FI=3e3,Kv="invert(93%) hue-rotate(180deg)",P3={addLibrary:"addLibrary"},F3={addLibrary:"addLibrary"},BI={canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:{saveFileToDisk:!0},loadScene:!0,saveToActiveFile:!0,toggleTheme:null,saveAsImage:!0}},CQ=730,AQ=1e3,MQ=500,RQ=1229,N1=2,Zv=[1,2,3],qh=10,kQ=1440,zI=4*1024*1024,lt="http://www.w3.org/2000/svg",BO=128,F6={excalidraw:2,excalidrawLibrary:2},Nn=5,LQ=.7,DQ=11,Ar={TOP:"top",MIDDLE:"middle",BOTTOM:"bottom"},R0={LEFT:"left",CENTER:"center",RIGHT:"right"},NQ=20,a8=.25,OQ=32,On={LEGACY:1,PROPORTIONAL_RADIUS:2,ADAPTIVE_RADIUS:3},zO={artist:1,cartoonist:2},l8={thin:1,bold:2,extraBold:4},ln={strokeColor:$e.black,backgroundColor:$e.transparent,fillStyle:"solid",strokeWidth:2,strokeStyle:"solid",roughness:zO.artist,opacity:100,locked:!1},Q2="library",ku="search",ls={name:"default",defaultTab:Q2},HO=new Set(["iframe","embeddable","image"]),Gn={selection:"selection",rectangle:"rectangle",diamond:"diamond",ellipse:"ellipse",text:"text",image:"image",eraser:"eraser",frame:"frame",magicframe:"magicframe",laser:"laser"},Hg={MERMAID_TO_EXCALIDRAW:"mermaid-to-excalidraw",PUBLISH_LIBRARY:"publish-library-data"},VO="Untitled",Mf={generalStats:1,elementProperties:2},Kr=1,ti={sharp:"sharp",round:"round",elbow:"elbow"},$O=.3,J2="element";var mu=(e=>(e.ACTIVE="active",e.AWAY="away",e.IDLE="idle",e))(mu||{});const PQ=Zv.includes(devicePixelRatio)?devicePixelRatio:1,gs=()=>({showWelcomeScreen:!1,theme:xe.LIGHT,collaborators:new Map,currentChartType:"bar",currentItemBackgroundColor:ln.backgroundColor,currentItemEndArrowhead:"arrow",currentItemFillStyle:ln.fillStyle,currentItemFontFamily:Oc,currentItemFontSize:al,currentItemOpacity:ln.opacity,currentItemRoughness:ln.roughness,currentItemStartArrowhead:null,currentItemStrokeColor:ln.strokeColor,currentItemRoundness:"round",currentItemArrowType:ti.round,currentItemStrokeStyle:ln.strokeStyle,currentItemStrokeWidth:ln.strokeWidth,currentItemTextAlign:Dm,currentHoveredFontFamily:null,cursorButton:"up",activeEmbeddable:null,newElement:null,editingTextElement:null,editingGroupId:null,editingLinearElement:null,activeTool:{type:"selection",customType:null,locked:ln.locked,lastActiveTool:null},penMode:!1,penDetected:!1,errorMessage:null,exportBackground:!0,exportScale:PQ,exportEmbedScene:!1,exportWithDarkMode:!1,fileHandle:null,gridSize:q2,gridStep:FO,gridModeEnabled:!1,isBindingEnabled:!0,defaultSidebarDockedPreference:!1,isLoading:!1,isResizing:!1,isRotating:!1,lastPointerDownWith:"mouse",multiElement:null,name:null,contextMenu:null,openMenu:null,openPopup:null,openSidebar:null,openDialog:null,pasteDialog:{shown:!1,data:null},previousSelectedElementIds:{},resizingElement:null,scrolledOutside:!1,scrollX:0,scrollY:0,selectedElementIds:{},hoveredElementIds:{},selectedGroupIds:{},selectedElementsAreBeingDragged:!1,selectionElement:null,shouldCacheIgnoreZoom:!1,stats:{open:!1,panels:Mf.generalStats|Mf.elementProperties},startBoundElement:null,suggestedBindings:[],frameRendering:{enabled:!0,clip:!0,name:!0,outline:!0},frameToHighlight:null,editingFrame:null,elementsToHighlight:null,toast:null,viewBackgroundColor:$e.white,zenModeEnabled:!1,zoom:{value:1},viewModeEnabled:!1,pendingImageElementId:null,showHyperlinkPopup:!1,selectedLinearElement:null,snapLines:[],originSnapOffset:{x:0,y:0},objectsSnapModeEnabled:!1,userToFollow:null,followedBy:new Set,isCropping:!1,croppingElementId:null,searchMatches:[]}),FQ=(e=>e)({showWelcomeScreen:{browser:!0,export:!1,server:!1},theme:{browser:!0,export:!1,server:!1},collaborators:{browser:!1,export:!1,server:!1},currentChartType:{browser:!0,export:!1,server:!1},currentItemBackgroundColor:{browser:!0,export:!1,server:!1},currentItemEndArrowhead:{browser:!0,export:!1,server:!1},currentItemFillStyle:{browser:!0,export:!1,server:!1},currentItemFontFamily:{browser:!0,export:!1,server:!1},currentItemFontSize:{browser:!0,export:!1,server:!1},currentItemRoundness:{browser:!0,export:!1,server:!1},currentItemArrowType:{browser:!0,export:!1,server:!1},currentItemOpacity:{browser:!0,export:!1,server:!1},currentItemRoughness:{browser:!0,export:!1,server:!1},currentItemStartArrowhead:{browser:!0,export:!1,server:!1},currentItemStrokeColor:{browser:!0,export:!1,server:!1},currentItemStrokeStyle:{browser:!0,export:!1,server:!1},currentItemStrokeWidth:{browser:!0,export:!1,server:!1},currentItemTextAlign:{browser:!0,export:!1,server:!1},currentHoveredFontFamily:{browser:!1,export:!1,server:!1},cursorButton:{browser:!0,export:!1,server:!1},activeEmbeddable:{browser:!1,export:!1,server:!1},newElement:{browser:!1,export:!1,server:!1},editingTextElement:{browser:!1,export:!1,server:!1},editingGroupId:{browser:!0,export:!1,server:!1},editingLinearElement:{browser:!1,export:!1,server:!1},activeTool:{browser:!0,export:!1,server:!1},penMode:{browser:!0,export:!1,server:!1},penDetected:{browser:!0,export:!1,server:!1},errorMessage:{browser:!1,export:!1,server:!1},exportBackground:{browser:!0,export:!1,server:!1},exportEmbedScene:{browser:!0,export:!1,server:!1},exportScale:{browser:!0,export:!1,server:!1},exportWithDarkMode:{browser:!0,export:!1,server:!1},fileHandle:{browser:!1,export:!1,server:!1},gridSize:{browser:!0,export:!0,server:!0},gridStep:{browser:!0,export:!0,server:!0},gridModeEnabled:{browser:!0,export:!0,server:!0},height:{browser:!1,export:!1,server:!1},isBindingEnabled:{browser:!1,export:!1,server:!1},defaultSidebarDockedPreference:{browser:!0,export:!1,server:!1},isLoading:{browser:!1,export:!1,server:!1},isResizing:{browser:!1,export:!1,server:!1},isRotating:{browser:!1,export:!1,server:!1},lastPointerDownWith:{browser:!0,export:!1,server:!1},multiElement:{browser:!1,export:!1,server:!1},name:{browser:!0,export:!1,server:!1},offsetLeft:{browser:!1,export:!1,server:!1},offsetTop:{browser:!1,export:!1,server:!1},contextMenu:{browser:!1,export:!1,server:!1},openMenu:{browser:!0,export:!1,server:!1},openPopup:{browser:!1,export:!1,server:!1},openSidebar:{browser:!0,export:!1,server:!1},openDialog:{browser:!1,export:!1,server:!1},pasteDialog:{browser:!1,export:!1,server:!1},previousSelectedElementIds:{browser:!0,export:!1,server:!1},resizingElement:{browser:!1,export:!1,server:!1},scrolledOutside:{browser:!0,export:!1,server:!1},scrollX:{browser:!0,export:!1,server:!1},scrollY:{browser:!0,export:!1,server:!1},selectedElementIds:{browser:!0,export:!1,server:!1},hoveredElementIds:{browser:!1,export:!1,server:!1},selectedGroupIds:{browser:!0,export:!1,server:!1},selectedElementsAreBeingDragged:{browser:!1,export:!1,server:!1},selectionElement:{browser:!1,export:!1,server:!1},shouldCacheIgnoreZoom:{browser:!0,export:!1,server:!1},stats:{browser:!0,export:!1,server:!1},startBoundElement:{browser:!1,export:!1,server:!1},suggestedBindings:{browser:!1,export:!1,server:!1},frameRendering:{browser:!1,export:!1,server:!1},frameToHighlight:{browser:!1,export:!1,server:!1},editingFrame:{browser:!1,export:!1,server:!1},elementsToHighlight:{browser:!1,export:!1,server:!1},toast:{browser:!1,export:!1,server:!1},viewBackgroundColor:{browser:!0,export:!0,server:!0},width:{browser:!1,export:!1,server:!1},zenModeEnabled:{browser:!0,export:!1,server:!1},zoom:{browser:!0,export:!1,server:!1},viewModeEnabled:{browser:!1,export:!1,server:!1},pendingImageElementId:{browser:!1,export:!1,server:!1},showHyperlinkPopup:{browser:!1,export:!1,server:!1},selectedLinearElement:{browser:!0,export:!1,server:!1},snapLines:{browser:!1,export:!1,server:!1},originSnapOffset:{browser:!1,export:!1,server:!1},objectsSnapModeEnabled:{browser:!0,export:!1,server:!1},userToFollow:{browser:!1,export:!1,server:!1},followedBy:{browser:!1,export:!1,server:!1},isCropping:{browser:!1,export:!1,server:!1},croppingElementId:{browser:!1,export:!1,server:!1},searchMatches:{browser:!1,export:!1,server:!1}}),qv=(e,t)=>{const n={};for(const i of Object.keys(e)){const r=FQ[i];if(r!=null&&r[t]){const s=e[i];n[i]=s}}return n},GO=e=>qv(e,"browser"),XO=e=>qv(e,"export"),BQ=e=>qv(e,"server"),bo=({activeTool:e})=>e.type==="eraser",mh=({activeTool:e})=>e.type==="hand",zQ="modulepreload",HQ=function(e){return"/"+e},HI={},be=function(t,n,i){let r=Promise.resolve();return n&&n.length>0&&(document.getElementsByTagName("link"),r=Promise.all(n.map(s=>{if(s=HQ(s),s in HI)return;HI[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${a}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":zQ,o||(l.as="script",l.crossOrigin=""),l.href=s,document.head.appendChild(l),o)return new Promise((c,u)=>{l.addEventListener("load",c),l.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})}))),r.then(()=>t()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},VQ=(e,t)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((i,r)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(r.bind(null,new Error("Unknown variable dynamic import: "+t)))})},jO={paste:"Paste",pasteAsPlaintext:"Paste as plaintext",pasteCharts:"Paste charts",selectAll:"Select all",multiSelect:"Add element to selection",moveCanvas:"Move canvas",cut:"Cut",copy:"Copy",copyAsPng:"Copy to clipboard as PNG",copyAsSvg:"Copy to clipboard as SVG",copyText:"Copy to clipboard as text",copySource:"Copy source to clipboard",convertToCode:"Convert to code",bringForward:"Bring forward",sendToBack:"Send to back",bringToFront:"Bring to front",sendBackward:"Send backward",delete:"Delete",copyStyles:"Copy styles",pasteStyles:"Paste styles",stroke:"Stroke",changeStroke:"Change stroke color",background:"Background",changeBackground:"Change background color",fill:"Fill",strokeWidth:"Stroke width",strokeStyle:"Stroke style",strokeStyle_solid:"Solid",strokeStyle_dashed:"Dashed",strokeStyle_dotted:"Dotted",sloppiness:"Sloppiness",opacity:"Opacity",textAlign:"Text align",edges:"Edges",sharp:"Sharp",round:"Round",arrowheads:"Arrowheads",arrowhead_none:"None",arrowhead_arrow:"Arrow",arrowhead_bar:"Bar",arrowhead_circle:"Circle",arrowhead_circle_outline:"Circle (outline)",arrowhead_triangle:"Triangle",arrowhead_triangle_outline:"Triangle (outline)",arrowhead_diamond:"Diamond",arrowhead_diamond_outline:"Diamond (outline)",arrowhead_crowfoot_many:"Crow's foot (many)",arrowhead_crowfoot_one:"Crow's foot (one)",arrowhead_crowfoot_one_or_many:"Crow's foot (one or many)",more_options:"More options",arrowtypes:"Arrow type",arrowtype_sharp:"Sharp arrow",arrowtype_round:"Curved arrow",arrowtype_elbowed:"Elbow arrow",fontSize:"Font size",fontFamily:"Font family",addWatermark:'Add "Made with kj-diagramming"',handDrawn:"Hand-drawn",normal:"Normal",code:"Code",small:"Small",medium:"Medium",large:"Large",veryLarge:"Very large",solid:"Solid",hachure:"Hachure",zigzag:"Zigzag",crossHatch:"Cross-hatch",thin:"Thin",bold:"Bold",left:"Left",center:"Center",right:"Right",extraBold:"Extra bold",architect:"Architect",artist:"Artist",cartoonist:"Cartoonist",fileTitle:"File name",colorPicker:"Color picker",canvasColors:"Used on canvas",canvasBackground:"Canvas background",drawingCanvas:"Drawing canvas",clearCanvas:"Clear canvas",layers:"Layers",actions:"Actions",language:"Language",liveCollaboration:"Live collaboration...",duplicateSelection:"Duplicate",untitled:"Untitled",name:"Name",yourName:"Your name",madeWithExcalidraw:"Made with kj-diagramming",group:"Group selection",ungroup:"Ungroup selection",collaborators:"Collaborators",toggleGrid:"Toggle grid",addToLibrary:"Add to library",removeFromLibrary:"Remove from library",libraryLoadingMessage:"Loading library…",libraries:"Browse libraries",loadingScene:"Loading scene…",loadScene:"Load scene from file",align:"Align",alignTop:"Align top",alignBottom:"Align bottom",alignLeft:"Align left",alignRight:"Align right",centerVertically:"Center vertically",centerHorizontally:"Center horizontally",distributeHorizontally:"Distribute horizontally",distributeVertically:"Distribute vertically",flipHorizontal:"Flip horizontal",flipVertical:"Flip vertical",viewMode:"View mode",share:"Share",showStroke:"Show stroke color picker",showBackground:"Show background color picker",showFonts:"Show font picker",toggleTheme:"Toggle light/dark theme",theme:"Theme",personalLib:"Personal Library",excalidrawLib:"kj-diagramming Library",decreaseFontSize:"Decrease font size",increaseFontSize:"Increase font size",unbindText:"Unbind text",bindText:"Bind text to the container",createContainerFromText:"Wrap text in a container",link:{edit:"Edit link",editEmbed:"Edit embeddable link",create:"Add link",label:"Link",labelEmbed:"Link & embed",empty:"No link is set",hint:"Type or paste your link here",goToElement:"Go to target element"},lineEditor:{edit:"Edit line",editArrow:"Edit arrow"},elementLock:{lock:"Lock",unlock:"Unlock",lockAll:"Lock all",unlockAll:"Unlock all"},statusPublished:"Published",sidebarLock:"Keep sidebar open",selectAllElementsInFrame:"Select all elements in frame",removeAllElementsFromFrame:"Remove all elements from frame",eyeDropper:"Pick color from canvas",textToDiagram:"Text to diagram",prompt:"Prompt",followUs:"Follow us",discordChat:"Discord chat",zoomToFitViewport:"Zoom to fit in viewport",zoomToFitSelection:"Zoom to fit selection",zoomToFit:"Zoom to fit all elements",installPWA:"Install kj-diagramming locally (PWA)",autoResize:"Enable text auto-resizing",imageCropping:"Image cropping",unCroppedDimension:"Uncropped dimension",copyElementLink:"Copy link to object",linkToElement:"Link to object",wrapSelectionInFrame:"Wrap selection in frame"},YO={title:"Link to object",desc:"Click on a shape on canvas or paste a link.",notFound:"Linked object wasn't found on canvas."},WO={noItems:"No items added yet...",hint_emptyLibrary:"Select an item on canvas to add it here, or install a library from the public repository, below.",hint_emptyPrivateLibrary:"Select an item on canvas to add it here."},KO={title:"Find on canvas",noMatch:"No matches found...",singleResult:"result",multipleResults:"results",placeholder:"Find text on canvas..."},ZO={clearReset:"Reset the canvas",exportJSON:"Export to file",exportImage:"Export image...",export:"Save to...",copyToClipboard:"Copy to clipboard",copyLink:"Copy link",save:"Save to current file",saveAs:"Save as",load:"Open",getShareableLink:"Get shareable link",close:"Close",selectLanguage:"Select language",scrollBackToContent:"Scroll back to content",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoom:"Reset zoom",menu:"Menu",done:"Done",edit:"Edit",undo:"Undo",redo:"Redo",resetLibrary:"Reset library",createNewRoom:"Create new room",fullScreen:"Full screen",darkMode:"Dark mode",lightMode:"Light mode",systemMode:"System mode",zenMode:"Zen mode",objectsSnapMode:"Snap to objects",exitZenMode:"Exit zen mode",cancel:"Cancel",clear:"Clear",remove:"Remove",embed:"Toggle embedding",publishLibrary:"Publish",submit:"Submit",confirm:"Confirm",embeddableInteractionButton:"Click to interact"},qO={clearReset:"This will clear the whole canvas. Are you sure?",couldNotCreateShareableLink:"Couldn't create shareable link.",couldNotCreateShareableLinkTooBig:"Couldn't create shareable link: the scene is too big",couldNotLoadInvalidFile:"Couldn't load invalid file",importBackendFailed:"Importing from backend failed.",cannotExportEmptyCanvas:"Cannot export empty canvas.",couldNotCopyToClipboard:"Couldn't copy to clipboard.",decryptFailed:"Couldn't decrypt data.",uploadedSecurly:"The upload has been secured with end-to-end encryption, which means that kj-diagramming server and third parties can't read the content.",loadSceneOverridePrompt:"Loading external drawing will replace your existing content. Do you wish to continue?",collabStopOverridePrompt:`Stopping the session will overwrite your previous, locally stored drawing. Are you sure?

(If you want to keep your local drawing, simply close the browser tab instead.)`,errorAddingToLibrary:"Couldn't add item to the library",errorRemovingFromLibrary:"Couldn't remove item from the library",confirmAddLibrary:"This will add {{numShapes}} shape(s) to your library. Are you sure?",imageDoesNotContainScene:"This image does not seem to contain any scene data. Have you enabled scene embedding during export?",cannotRestoreFromImage:"Scene couldn't be restored from this image file",invalidSceneUrl:"Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid kj-diagramming JSON data.",resetLibrary:"This will clear your library. Are you sure?",removeItemsFromsLibrary:"Delete {{count}} item(s) from library?",invalidEncryptionKey:"Encryption key must be of 22 characters. Live collaboration is disabled.",collabOfflineWarning:`No internet connection available.
Your changes will not be saved!`},QO={unsupportedFileType:"Unsupported file type.",imageInsertError:"Couldn't insert image. Try again later...",fileTooBig:"File is too big. Maximum allowed size is {{maxSize}}.",svgImageInsertError:"Couldn't insert SVG image. The SVG markup looks invalid.",failedToFetchImage:"Failed to fetch image.",cannotResolveCollabServer:"Couldn't connect to the collab server. Please reload the page and try again.",importLibraryError:"Couldn't load library",saveLibraryError:"Couldn't save library to storage. Please save your library to a file locally to make sure you don't lose changes.",collabSaveFailed:"Couldn't save to the backend database. If problems persist, you should save your file locally to ensure you don't lose your work.",collabSaveFailed_sizeExceeded:"Couldn't save to the backend database, the canvas seems to be too big. You should save the file locally to ensure you don't lose your work.",imageToolNotSupported:"Images are disabled.",brave_measure_text_error:{line1:"Looks like you are using Brave browser with the <bold>Aggressively Block Fingerprinting</bold> setting enabled.",line2:"This could result in breaking the <bold>Text Elements</bold> in your drawings.",line3:"We strongly recommend disabling this setting. You can follow <link>these steps</link> on how to do so.",line4:"If disabling this setting doesn't fix the display of text elements, please open an <issueLink>issue</issueLink> on our GitHub, or write us on <discordLink>Discord</discordLink>"},libraryElementTypeError:{embeddable:"Embeddable elements cannot be added to the library.",iframe:"IFrame elements cannot be added to the library.",image:"Support for adding images to the library coming soon!"},asyncPasteFailedOnRead:"Couldn't paste (couldn't read from system clipboard).",asyncPasteFailedOnParse:"Couldn't paste.",copyToSystemClipboardFailed:"Couldn't copy to clipboard."},JO={selection:"Selection",image:"Insert image",rectangle:"Rectangle",diamond:"Diamond",ellipse:"Ellipse",arrow:"Arrow",line:"Line",freedraw:"Draw",text:"Text",library:"Library",lock:"Keep selected tool active after drawing",penMode:"Pen mode - prevent touch",link:"Add / Update link for a selected shape",eraser:"Eraser",frame:"Frame tool",magicframe:"Wireframe to code",embeddable:"Web Embed",laser:"Laser pointer",hand:"Hand (panning tool)",extraTools:"More tools",mermaidToExcalidraw:"Mermaid to kj-diagramming"},eP={rectangle:"Rectangle",diamond:"Diamond",ellipse:"Ellipse",arrow:"Arrow",line:"Line",freedraw:"Freedraw",text:"Text",image:"Image",group:"Group",frame:"Frame",magicframe:"Wireframe to code",embeddable:"Web Embed",selection:"Selection",iframe:"IFrame"},tP={canvasActions:"Canvas actions",selectedShapeActions:"Selected shape actions",shapes:"Shapes"},nP={dismissSearch:"Escape to dismiss search",canvasPanning:"To move canvas, hold mouse wheel or spacebar while dragging, or use the hand tool",linearElement:"Click to start multiple points, drag for single line",arrowTool:"Click to start multiple points, drag for single line. Press {{arrowShortcut}} again to change arrow type.",freeDraw:"Click and drag, release when you're finished",text:"Tip: you can also add text by double-clicking anywhere with the selection tool",embeddable:"Click-drag to create a website embed",text_selected:"Double-click or press ENTER to edit text",text_editing:"Press Escape or CtrlOrCmd+ENTER to finish editing",linearElementMulti:"Click on last point or press Escape or Enter to finish",lockAngle:"You can constrain angle by holding SHIFT",resize:`You can constrain proportions by holding SHIFT while resizing,
hold ALT to resize from the center`,resizeImage:`You can resize freely by holding SHIFT,
hold ALT to resize from the center`,rotate:"You can constrain angles by holding SHIFT while rotating",lineEditor_info:"Hold CtrlOrCmd and Double-click or press CtrlOrCmd + Enter to edit points",lineEditor_pointSelected:`Press Delete to remove point(s),
CtrlOrCmd+D to duplicate, or drag to move`,lineEditor_nothingSelected:`Select a point to edit (hold SHIFT to select multiple),
or hold Alt and click to add new points`,placeImage:"Click to place the image, or click and drag to set its size manually",publishLibrary:"Publish your own library",bindTextToElement:"Press enter to add text",createFlowchart:"Hold CtrlOrCmd and Arrow key to create a flowchart",deepBoxSelect:"Hold CtrlOrCmd to deep select, and to prevent dragging",eraserRevert:"Hold Alt to revert the elements marked for deletion",firefox_clipboard_write:'This feature can likely be enabled by setting the "dom.events.asyncClipboard.clipboardItem" flag to "true". To change the browser flags in Firefox, visit the "about:config" page.',disableSnapping:"Hold CtrlOrCmd to disable snapping",enterCropEditor:"Double click the image or press ENTER to crop the image",leaveCropEditor:"Click outside the image or press ENTER or ESCAPE to finish cropping"},iP={cannotShowPreview:"Cannot show preview",canvasTooBig:"The canvas may be too big.",canvasTooBigTip:"Tip: try moving the farthest elements a bit closer together."},rP={headingMain:"Encountered an error. Try <button>reloading the page</button>.",clearCanvasMessage:"If reloading doesn't work, try <button>clearing the canvas</button>.",clearCanvasCaveat:" This will result in loss of work ",trackedToSentry:"The error with identifier {{eventId}} was tracked on our system.",openIssueMessage:"We were very cautious not to include your scene information on the error. If your scene is not private, please consider following up on our <button>bug tracker</button>. Please include information below by copying and pasting into the GitHub issue.",sceneContent:"Scene content:"},sP={or:"Or"},oP={desc_intro:"Invite people to collaborate on your drawing.",desc_privacy:"Don't worry, the session is end-to-end encrypted, and fully private. Not even our server can see what you draw.",button_startSession:"Start session",button_stopSession:"Stop session",desc_inProgressIntro:"Live-collaboration session is now in progress.",desc_shareLink:"Share this link with anyone you want to collaborate with:",desc_exitSession:"Stopping the session will disconnect you from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version.",shareTitle:"Join a live collaboration session on kj-diagramming"},aP={title:"Error"},lP={disk_title:"Save to disk",disk_details:"Export the scene data to a file from which you can import later.",disk_button:"Save to file",link_title:"Shareable link",link_details:"Export as a read-only link.",link_button:"Export to Link",excalidrawplus_description:"Save the scene to your kj-diagramming workspace.",excalidrawplus_button:"Export",excalidrawplus_exportError:"Couldn't export to kj-diagramming at this moment..."},cP={blog:"Read our blog",click:"click",deepSelect:"Deep select",deepBoxSelect:"Deep select within box, and prevent dragging",createFlowchart:"Create a flowchart from a generic element",navigateFlowchart:"Navigate a flowchart",curvedArrow:"Curved arrow",curvedLine:"Curved line",documentation:"Documentation",doubleClick:"double-click",drag:"drag",editor:"Editor",editLineArrowPoints:"Edit line/arrow points",editText:"Edit text / add label",github:"Found an issue? Submit",howto:"Follow our guides",or:"or",preventBinding:"Prevent arrow binding",tools:"Tools",shortcuts:"Keyboard shortcuts",textFinish:"Finish editing (text editor)",textNewLine:"Add new line (text editor)",title:"Help",view:"View",zoomToFit:"Zoom to fit all elements",zoomToSelection:"Zoom to selection",toggleElementLock:"Lock/unlock selection",movePageUpDown:"Move page up/down",movePageLeftRight:"Move page left/right",cropStart:"Crop image",cropFinish:"Finish image cropping"},uP={title:"Clear canvas"},dP={title:"Publish library",itemName:"Item name",authorName:"Author name",githubUsername:"GitHub username",twitterUsername:"Twitter username",libraryName:"Library name",libraryDesc:"Library description",website:"Website",placeholder:{authorName:"Your name or username",libraryName:"Name of your library",libraryDesc:"Description of your library to help people understand its usage",githubHandle:"GitHub handle (optional), so you can edit the library once submitted for review",twitterHandle:"Twitter username (optional), so we know who to credit when promoting over Twitter",website:"Link to your personal website or elsewhere (optional)"},errors:{required:"Required",website:"Enter a valid URL"},noteDescription:"Submit your library to be included in the <link>public library repository</link> for other people to use in their drawings.",noteGuidelines:"The library needs to be manually approved first. Please read the <link>guidelines</link> before submitting. You will need a GitHub account to communicate and make changes if requested, but it is not strictly required.",noteLicense:"By submitting, you agree the library will be published under the <link>MIT License</link>, which in short means anyone can use them without restrictions.",noteItems:"Each library item must have its own name so it's filterable. The following library items will be included:",atleastOneLibItem:"Please select at least one library item to get started",republishWarning:"Note: some of the selected items are marked as already published/submitted. You should only resubmit items when updating an existing library or submission."},fP={title:"Library submitted",content:"Thank you {{authorName}}. Your library has been submitted for review. You can track the status <link>here</link>"},hP={resetLibrary:"Reset library",removeItemsFromLib:"Remove selected items from library"},gP={header:"Export image",label:{withBackground:"Background",onlySelected:"Only selected",darkMode:"Dark mode",embedScene:"Embed scene",scale:"Scale",padding:"Padding"},tooltip:{embedScene:`Scene data will be saved into the exported PNG/SVG file so that the scene can be restored from it.
Will increase exported file size.`},title:{exportToPng:"Export to PNG",exportToSvg:"Export to SVG",copyPngToClipboard:"Copy PNG to clipboard"},button:{exportToPng:"PNG",exportToSvg:"SVG",copyPngToClipboard:"Copy to clipboard"}},mP={tooltip:"Your drawings are end-to-end encrypted so kj-diagramming's servers will never see them.",link:"Blog post on end-to-end encryption in kj-diagramming"},pP={angle:"Angle",shapes:"Shapes",height:"Height",scene:"Scene",selected:"Selected",storage:"Storage",fullTitle:"Canvas & Shape properties",title:"Properties",generalStats:"General",elementProperties:"Shape properties",total:"Total",version:"Version",versionCopy:"Click to copy",versionNotAvailable:"Version not available",width:"Width"},UP={addedToLibrary:"Added to library",copyStyles:"Copied styles.",copyToClipboard:"Copied to clipboard.",copyToClipboardAsPng:`Copied {{exportSelection}} to clipboard as PNG
({{exportColorScheme}})`,copyToClipboardAsSvg:`Copied {{exportSelection}} to clipboard as SVG
({{exportColorScheme}})`,fileSaved:"File saved.",fileSavedToFilename:"Saved to {filename}",canvas:"canvas",selection:"selection",pasteAsSingleElement:`Use {{shortcut}} to paste as a single element,
or paste into an existing text editor`,unableToEmbed:"Embedding this url is currently not allowed. Raise an issue on GitHub to request the url whitelisted",unrecognizedLinkFormat:"The link you embedded does not match the expected format. Please try to paste the 'embed' string provided by the source site",elementLinkCopied:"Link copied to clipboard"},bP={transparent:"Transparent",black:"Black",white:"White",red:"Red",pink:"Pink",grape:"Grape",violet:"Violet",gray:"Gray",blue:"Blue",cyan:"Cyan",teal:"Teal",green:"Green",yellow:"Yellow",orange:"Orange",bronze:"Bronze"},yP={app:{center_heading:"All your data is saved locally in your browser.",center_heading_plus:"Did you want to go to the kj-diagramming instead?",menuHint:"Export, preferences, languages, ..."},defaults:{menuHint:"Export, preferences, and more...",center_heading:"Diagrams. Made. Simple.",toolbarHint:"Pick a tool & Start drawing!",helpHint:"Shortcuts & help"}},EP={mostUsedCustomColors:"Most used custom colors",colors:"Colors",shades:"Shades",hexCode:"Hex code",noShades:"No shades available for this color"},vP={action:{exportToImage:{title:"Export as image",button:"Export as image",description:"Export the scene data as an image from which you can import later."},saveToDisk:{title:"Save to disk",button:"Save to disk",description:"Export the scene data to a file from which you can import later."},excalidrawPlus:{title:"kj-diagramming",button:"Export to kj-diagramming",description:"Save the scene to your kj-diagramming workspace."}},modal:{loadFromFile:{title:"Load from file",button:"Load from file",description:"Loading from a file will <bold>replace your existing content</bold>.<br></br>You can back up your drawing first using one of the options below."},shareableLink:{title:"Load from link",button:"Replace my content",description:"Loading external drawing will <bold>replace your existing content</bold>.<br></br>You can back up your drawing first by using one of the options below."}}},_P={title:"Mermaid to kj-diagramming",button:"Insert",description:"Currently only <flowchartLink>Flowchart</flowchartLink>,<sequenceLink> Sequence, </sequenceLink> and <classLink>Class </classLink>Diagrams are supported. The other types will be rendered as image in kj-diagramming.",syntax:"Mermaid Syntax",preview:"Preview"},wP={placeholder:"Quick search"},TP={badge:{old:"old"},sceneFonts:"In this scene",availableFonts:"Available fonts",empty:"No fonts found"},SP={empty:"No users found",hint:{text:"Click on user to follow",followStatus:"You're currently following this user",inCall:"User is in a voice call",micMuted:"User's microphone is muted",isSpeaking:"User is speaking"}},IP={title:"Command palette",shortcuts:{select:"Select",confirm:"Confirm",close:"Close"},recents:"Recently used",search:{placeholder:"Search menus, commands, and discover hidden gems",noMatch:"No matching commands..."},itemNotAvailable:"Command is not available...",shortcutHint:"For Command palette, use {{shortcut}}"},Qv={labels:jO,elementLink:YO,library:WO,search:KO,buttons:ZO,alerts:qO,errors:QO,toolBar:JO,element:eP,headings:tP,hints:nP,canvasError:iP,errorSplash:rP,shareDialog:sP,roomDialog:oP,errorDialog:aP,exportDialog:lP,helpDialog:cP,clearCanvasDialog:uP,publishDialog:dP,publishSuccessDialog:fP,confirmDialog:hP,imageExportDialog:gP,encrypted:mP,stats:pP,toast:UP,colors:bP,welcomeScreen:yP,colorPicker:EP,overwriteConfirm:vP,mermaid:_P,quickSearch:wP,fontList:TP,userList:SP,commandPalette:IP},$Q=Object.freeze(Object.defineProperty({__proto__:null,alerts:qO,buttons:ZO,canvasError:iP,clearCanvasDialog:uP,colorPicker:EP,colors:bP,commandPalette:IP,confirmDialog:hP,default:Qv,element:eP,elementLink:YO,encrypted:mP,errorDialog:aP,errorSplash:rP,errors:QO,exportDialog:lP,fontList:TP,headings:tP,helpDialog:cP,hints:nP,imageExportDialog:gP,labels:jO,library:WO,mermaid:_P,overwriteConfirm:vP,publishDialog:dP,publishSuccessDialog:fP,quickSearch:wP,roomDialog:oP,search:KO,shareDialog:sP,stats:pP,toast:UP,toolBar:JO,userList:SP,welcomeScreen:yP},Symbol.toStringTag,{value:"Module"})),xP=100,CP=36,AP={"ar-SA":94,"az-AZ":17,"bg-BG":71,"bn-BD":52,"ca-ES":83,"cs-CZ":86,"da-DK":61,"de-DE":100,"el-GR":80,en:xP,"es-ES":96,"eu-ES":97,"fa-IR":84,"fi-FI":76,"fr-FR":99,"gl-ES":86,"he-IL":77,"hi-IN":76,"hu-HU":76,"id-ID":91,"it-IT":98,"ja-JP":90,kaa:CP,"kab-KAB":76,"kk-KZ":18,"km-KH":83,"ko-KR":100,"ku-TR":87,"lt-LT":48,"lv-LV":77,"mr-IN":98,"my-MM":35,"nb-NO":93,"nl-NL":75,"nn-NO":67,"oc-FR":92,"pa-IN":78,"pl-PL":99,"pt-BR":91,"pt-PT":83,"ro-RO":99,"ru-RU":92,"si-LK":7,"sk-SK":100,"sl-SI":100,"sv-SE":100,"ta-IN":81,"th-TH":44,"tr-TR":87,"uk-UA":93,"vi-VN":49,"zh-CN":100,"zh-HK":22,"zh-TW":100},GQ=Object.freeze(Object.defineProperty({__proto__:null,default:AP,en:xP,kaa:CP},Symbol.toStringTag,{value:"Module"}));var Ha={};let XQ=0;function qt(e,t){const n=`atom${++XQ}`,i={toString(){return(Ha?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?i.read=e:(i.init=e,i.read=jQ,i.write=YQ),i}function jQ(e){return e(this)}function YQ(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const VI=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,B3=e=>"init"in e,c8=e=>!!e.write,eb=new WeakMap,z3=e=>{var t;return H3(e)&&!((t=eb.get(e))!=null&&t[1])},WQ=(e,t)=>{const n=eb.get(e);if(n)n[1]=!0,n[0].forEach(i=>i(t));else if((Ha?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},KQ=e=>{if(eb.has(e))return;const t=[new Set,!1];eb.set(e,t);const n=()=>{t[1]=!0};e.then(n,n),e.onCancel=i=>{t[0].add(i)}},H3=e=>typeof(e==null?void 0:e.then)=="function",$I=e=>"v"in e||"e"in e,Gp=e=>{if("e"in e)throw e.e;if((Ha?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},MP=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},GI=(e,t,n,i,r)=>{var s;if((Ha?"production":void 0)!=="production"&&i===t)throw new Error("[Bug] atom cannot depend on itself");n.d.set(i,r.n),z3(n.v)&&MP(t,n.v,r),(s=r.m)==null||s.t.add(t),e&&ZQ(e,i,t)},O1=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),Vg=(e,t,n)=>{e[t].add(n)},XI=(e,t,n)=>{e.D.has(t)||(e.D.set(t,new Set),Vg(e,"M",()=>{var i;(i=n.m)==null||i.l.forEach(r=>Vg(e,"M",r))}))},ZQ=(e,t,n)=>{const i=e.D.get(t);i&&i.add(n)},qQ=(e,t)=>e.D.get(t),Wc=e=>{let t,n=!1;const i=r=>{try{r()}catch(s){n||(t=s,n=!0)}};for(;e.H.size||e.M.size||e.L.size;)e.D.clear(),e.H.forEach(i),e.H.clear(),e.M.forEach(i),e.M.clear(),e.L.forEach(i),e.L.clear();if(n)throw t},RP=(...[e,t,n,i])=>{const r=(E,y,v)=>{const _="v"in y,I=y.v,R=z3(y.v)?y.v:null;if(H3(v)){KQ(v);for(const w of y.d.keys())MP(E,v,e(w));y.v=v}else y.v=v;delete y.e,delete y.x,(!_||!Object.is(I,y.v))&&(++y.n,R&&WQ(R,v))},s=(E,y)=>{var v;const _=e(y);if($I(_)&&(_.m&&!_.x||Array.from(_.d).every(([S,k])=>s(E,S).n===k)))return _;_.d.clear();let I=!0;const R=S=>{if(VI(y,S)){const N=e(S);if(!$I(N))if(B3(S))r(S,N,S.init);else throw new Error("no atom init");return Gp(N)}const k=s(E,S);try{return Gp(k)}finally{if(I)GI(E,y,_,S,k);else{const N=O1();GI(N,y,_,S,k),d(N,y,_),Wc(N)}}};let w,T;const A={get signal(){return w||(w=new AbortController),w.signal},get setSelf(){return(Ha?"production":void 0)!=="production"&&!c8(y)&&console.warn("setSelf function cannot be used with read-only atom"),!T&&c8(y)&&(T=(...S)=>{if((Ha?"production":void 0)!=="production"&&I&&console.warn("setSelf function cannot be called in sync"),!I)return u(y,...S)}),T}};try{const S=t(y,R,A);if(r(y,_,S),H3(S)){(v=S.onCancel)==null||v.call(S,()=>w==null?void 0:w.abort());const k=()=>{if(_.m){const N=O1();d(N,y,_),Wc(N)}};S.then(k,k)}return _}catch(S){return delete _.v,_.e=S,delete _.x,++_.n,_}finally{I=!1}},o=E=>Gp(s(void 0,E)),a=(E,y,v)=>{var _,I;const R=new Map;for(const w of((_=v.m)==null?void 0:_.t)||[]){const T=e(w);T.m&&R.set(w,T)}for(const w of v.p)R.set(w,e(w));return(I=qQ(E,y))==null||I.forEach(w=>{R.set(w,e(w))}),R},l=(E,y,v)=>{const _=[],I=new Set,R=new Set,w=[[y,v]];for(;w.length>0;){const[T,A]=w[w.length-1];if(R.has(T)){w.pop();continue}if(I.has(T)){_.push([T,A,A.n]),R.add(T),A.x=!0,w.pop();continue}I.add(T);for(const[S,k]of a(E,T,A))T!==S&&!I.has(S)&&w.push([S,k])}Vg(E,"H",()=>{const T=new Set([y]);for(let A=_.length-1;A>=0;--A){const[S,k,N]=_[A];let D=!1;for(const G of k.d.keys())if(G!==S&&T.has(G)){D=!0;break}D&&(s(E,S),d(E,S,k),N!==k.n&&(XI(E,S,k),T.add(S))),delete k.x}})},c=(E,y,...v)=>{let _=!0;const I=w=>Gp(s(E,w)),R=(w,...T)=>{const A=e(w);try{if(VI(y,w)){if(!B3(w))throw new Error("atom not writable");const S=A.n,k=T[0];r(w,A,k),d(E,w,A),S!==A.n&&(XI(E,w,A),l(E,w,A));return}else return c(E,w,...T)}finally{_||Wc(E)}};try{return n(y,I,R,...v)}finally{_=!1}},u=(E,...y)=>{const v=O1();try{return c(v,E,...y)}finally{Wc(v)}},d=(E,y,v)=>{if(v.m&&!z3(v.v)){for(const _ of v.d.keys())v.m.d.has(_)||(f(E,_,e(_)).t.add(y),v.m.d.add(_));for(const _ of v.m.d||[])if(!v.d.has(_)){v.m.d.delete(_);const I=h(E,_,e(_));I==null||I.t.delete(y)}}},f=(E,y,v)=>{if(!v.m){s(E,y);for(const _ of v.d.keys())f(E,_,e(_)).t.add(y);if(v.m={l:new Set,d:new Set(v.d.keys()),t:new Set},c8(y)){const _=v.m;let I;const R=(w,T)=>{let A=!0;I=(...S)=>{try{return c(w,y,...S)}finally{A||Wc(w)}};try{return T()}finally{A=!1}};Vg(E,"L",()=>{const w=R(E,()=>i(y,(...T)=>I(...T)));w&&(_.u=T=>R(T,w))})}}return v.m},h=(E,y,v)=>{if(v.m&&!v.m.l.size&&!Array.from(v.m.t).some(_=>{var I;return(I=e(_).m)==null?void 0:I.d.has(y)})){const _=v.m.u;_&&Vg(E,"L",()=>_(E)),delete v.m;for(const I of v.d.keys()){const R=h(E,I,e(I));R==null||R.t.delete(y)}return}return v.m};return{get:o,set:u,sub:(E,y)=>{const v=O1(),_=e(E),R=f(v,E,_).l;return R.add(y),Wc(v),()=>{R.delete(y);const w=O1();h(w,E,_),Wc(w)}},unstable_derive:E=>RP(...E(e,t,n,i))}},QQ=e=>{const t=new WeakMap,n=new Set;let i,r=0;const s=e.unstable_derive((l,c,u,d)=>(i=l,[f=>{let h=t.get(f);if(!h){const m=l(f);h=new Proxy(m,{set(p,b,E){return b==="m"&&n.add(f),Reflect.set(p,b,E)},deleteProperty(p,b){return b==="m"&&n.delete(f),Reflect.deleteProperty(p,b)}}),t.set(f,h)}return h},c,(f,h,m,...p)=>r?m(f,...p):u(f,h,m,...p),d])),o=s.set;return Object.assign(s,{dev4_get_internal_weak_map:()=>({get:l=>{const c=i(l);if(c.n!==0)return c}}),dev4_get_mounted_atoms:()=>n,dev4_restore_atoms:l=>{o({read:()=>null,write:(u,d)=>{++r;try{for(const[f,h]of l)B3(f)&&d(f,h)}finally{--r}}})}})},Nm=()=>{const e=new WeakMap,n=RP(i=>{if((Ha?"production":void 0)!=="production"&&!i)throw new Error("Atom is undefined or null");let r=e.get(i);return r||(r={d:new Map,p:new Set,n:0},e.set(i,r)),r},(i,...r)=>i.read(...r),(i,...r)=>i.write(...r),(i,...r)=>{var s;return(s=i.onMount)==null?void 0:s.call(i,...r)});return(Ha?"production":void 0)!=="production"?QQ(n):n};let P1;const JQ=()=>(P1||(P1=Nm(),(Ha?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=P1),globalThis.__JOTAI_DEFAULT_STORE__!==P1&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),P1);var kP={};const LP=M.createContext(void 0),B6=e=>{const t=M.useContext(LP);return(e==null?void 0:e.store)||t||JQ()},eJ=({children:e,store:t})=>{const n=M.useRef(void 0);return!t&&!n.current&&(n.current=Nm()),M.createElement(LP.Provider,{value:t||n.current},e)},V3=e=>typeof(e==null?void 0:e.then)=="function",DP=e=>{e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t})},tJ=se.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(DP(e),e)}),u8=new WeakMap,jI=e=>{let t=u8.get(e);return t||(t=new Promise((n,i)=>{let r=e;const s=l=>c=>{r===l&&n(c)},o=l=>c=>{r===l&&i(c)},a=l=>{"onCancel"in l&&typeof l.onCancel=="function"&&l.onCancel(c=>{if((kP?"production":void 0)!=="production"&&c===l)throw new Error("[Bug] p is not updated even after cancelation");V3(c)?(u8.set(c,t),r=c,c.then(s(c),o(c)),a(c)):n(c)})};e.then(s(e),o(e)),a(e)}),u8.set(e,t)),t};function k0(e,t){const n=B6(t),[[i,r,s],o]=M.useReducer(c=>{const u=n.get(e);return Object.is(c[0],u)&&c[1]===n&&c[2]===e?c:[u,n,e]},void 0,()=>[n.get(e),n,e]);let a=i;(r!==n||s!==e)&&(o(),a=n.get(e));const l=t==null?void 0:t.delay;if(M.useEffect(()=>{const c=n.sub(e,()=>{if(typeof l=="number"){const u=n.get(e);V3(u)&&DP(jI(u)),setTimeout(o,l);return}o()});return o(),c},[n,e,l]),M.useDebugValue(a),V3(a)){const c=jI(a);return tJ(c)}return a}function Jv(e,t){const n=B6(t);return M.useCallback((...r)=>{if((kP?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...r)},[n,e])}function ph(e,t){return[k0(e,t),Jv(e,t)]}const YI=new WeakMap;function nJ(e,t){const n=B6(t),i=iJ(n);for(const[r,s]of e)(!i.has(r)||t!=null&&t.dangerouslyForceHydrate)&&(i.add(r),n.set(r,s))}const iJ=e=>{let t=YI.get(e);return t||(t=new WeakSet,YI.set(e,t)),t};function Rf(){return Rf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Rf.apply(this,arguments)}function NP(){const e=M.createContext(null);function t({store:o,initialValues:a=[],children:l}){const c=M.useRef(o);return c.current||(c.current=Nm()),nJ(a,{store:c.current}),g(e.Provider,{value:c.current,children:l})}const n=o=>{const a=M.useContext(e);if(!a)throw new Error("Missing Provider from createIsolation");return B6(Rf({store:a},o))};return{Provider:t,useStore:n,useAtom:(o,a)=>{const l=n();return ph(o,Rf({store:l},a))},useAtomValue:(o,a)=>{const l=n();return k0(o,Rf({store:l},a))},useSetAtom:(o,a)=>{const l=n();return Jv(o,Rf({store:l},a))}}}const{read:fxe,write:hxe}=qt(null);M.createContext({scope:void 0,baseStore:void 0});const OP=NP(),{useAtom:gn,useSetAtom:z6,useAtomValue:PP,useStore:gxe}=OP,rJ=OP.Provider,Ns=Nm(),sJ=85,Sd={code:"en",label:"English"},H6=[Sd,...[{code:"ar-SA",label:"العربية",rtl:!0},{code:"bg-BG",label:"Български"},{code:"ca-ES",label:"Català"},{code:"cs-CZ",label:"Česky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"Ελληνικά"},{code:"es-ES",label:"Español"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"فارسی",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Français"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"עברית",rtl:!0},{code:"hi-IN",label:"हिन्दी"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"日本語"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"Қазақ тілі"},{code:"ko-KR",label:"한국어"},{code:"ku-TR",label:"Kurdî"},{code:"lt-LT",label:"Lietuvių"},{code:"lv-LV",label:"Latviešu"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokmål"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"ਪੰਜਾਬੀ"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Português Brasileiro"},{code:"pt-PT",label:"Português"},{code:"ro-RO",label:"Română"},{code:"ru-RU",label:"Русский"},{code:"sk-SK",label:"Slovenčina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Slovenščina"},{code:"tr-TR",label:"Türkçe"},{code:"uk-UA",label:"Українська"},{code:"zh-CN",label:"简体中文"},{code:"zh-TW",label:"繁體中文"},{code:"vi-VN",label:"Tiếng Việt"},{code:"mr-IN",label:"मराठी"}].filter(e=>AP[e.code]>=sJ).sort((e,t)=>e.label>t.label?1:-1)],FP="__test__";let kf=Sd,$U={};const BP=async e=>{if(kf=e,document.documentElement.dir=kf.rtl?"rtl":"ltr",document.documentElement.lang=kf.code,e.code.startsWith(FP))$U={};else try{$U=await VQ(Object.assign({"./locales/ar-SA.json":()=>be(()=>import("./locales/ar-SA.json-COzfguQB.js"),__vite__mapDeps([])),"./locales/az-AZ.json":()=>be(()=>import("./locales/az-AZ.json-Cat8z999.js"),__vite__mapDeps([])),"./locales/bg-BG.json":()=>be(()=>import("./locales/bg-BG.json-BJJvj3Fj.js"),__vite__mapDeps([])),"./locales/bn-BD.json":()=>be(()=>import("./locales/bn-BD.json-Dg0jTBuU.js"),__vite__mapDeps([])),"./locales/ca-ES.json":()=>be(()=>import("./locales/ca-ES.json-CdoEYpMP.js"),__vite__mapDeps([])),"./locales/cs-CZ.json":()=>be(()=>import("./locales/cs-CZ.json-P-HSsnXq.js"),__vite__mapDeps([])),"./locales/da-DK.json":()=>be(()=>import("./locales/da-DK.json-8Cgla7Eu.js"),__vite__mapDeps([])),"./locales/de-DE.json":()=>be(()=>import("./locales/de-DE.json-DPmtDHbI.js"),__vite__mapDeps([])),"./locales/el-GR.json":()=>be(()=>import("./locales/el-GR.json-3-wCjGCI.js"),__vite__mapDeps([])),"./locales/en.json":()=>be(()=>Promise.resolve().then(()=>$Q),void 0),"./locales/es-ES.json":()=>be(()=>import("./locales/es-ES.json-Bp8UMgNb.js"),__vite__mapDeps([])),"./locales/eu-ES.json":()=>be(()=>import("./locales/eu-ES.json-CxCuJUzr.js"),__vite__mapDeps([])),"./locales/fa-IR.json":()=>be(()=>import("./locales/fa-IR.json-B0-fBWlP.js"),__vite__mapDeps([])),"./locales/fi-FI.json":()=>be(()=>import("./locales/fi-FI.json-KIXPvSj5.js"),__vite__mapDeps([])),"./locales/fr-FR.json":()=>be(()=>import("./locales/fr-FR.json-C15Bn3QU.js"),__vite__mapDeps([])),"./locales/gl-ES.json":()=>be(()=>import("./locales/gl-ES.json-CSkIQsYi.js"),__vite__mapDeps([])),"./locales/he-IL.json":()=>be(()=>import("./locales/he-IL.json-DbyEDtEF.js"),__vite__mapDeps([])),"./locales/hi-IN.json":()=>be(()=>import("./locales/hi-IN.json-BOvIld2g.js"),__vite__mapDeps([])),"./locales/hu-HU.json":()=>be(()=>import("./locales/hu-HU.json-BhNmQYUM.js"),__vite__mapDeps([])),"./locales/id-ID.json":()=>be(()=>import("./locales/id-ID.json-CSx7ASM2.js"),__vite__mapDeps([])),"./locales/it-IT.json":()=>be(()=>import("./locales/it-IT.json-DyssMFSO.js"),__vite__mapDeps([])),"./locales/ja-JP.json":()=>be(()=>import("./locales/ja-JP.json-BbLgXIZL.js"),__vite__mapDeps([])),"./locales/kaa.json":()=>be(()=>import("./locales/kaa.json-BkMXQ5Vc.js"),__vite__mapDeps([])),"./locales/kab-KAB.json":()=>be(()=>import("./locales/kab-KAB.json-DvnseLBO.js"),__vite__mapDeps([])),"./locales/kk-KZ.json":()=>be(()=>import("./locales/kk-KZ.json-D5H6xEkT.js"),__vite__mapDeps([])),"./locales/km-KH.json":()=>be(()=>import("./locales/km-KH.json-BV0IQH-q.js"),__vite__mapDeps([])),"./locales/ko-KR.json":()=>be(()=>import("./locales/ko-KR.json-C8tNgRbE.js"),__vite__mapDeps([])),"./locales/ku-TR.json":()=>be(()=>import("./locales/ku-TR.json-DAkzb7mw.js"),__vite__mapDeps([])),"./locales/lt-LT.json":()=>be(()=>import("./locales/lt-LT.json-AxSBChKv.js"),__vite__mapDeps([])),"./locales/lv-LV.json":()=>be(()=>import("./locales/lv-LV.json-05S75yzt.js"),__vite__mapDeps([])),"./locales/mr-IN.json":()=>be(()=>import("./locales/mr-IN.json-D2WgmrA_.js"),__vite__mapDeps([])),"./locales/my-MM.json":()=>be(()=>import("./locales/my-MM.json-CIm1qvZz.js"),__vite__mapDeps([])),"./locales/nb-NO.json":()=>be(()=>import("./locales/nb-NO.json-DbEBgCKQ.js"),__vite__mapDeps([])),"./locales/nl-NL.json":()=>be(()=>import("./locales/nl-NL.json-CSxTApus.js"),__vite__mapDeps([])),"./locales/nn-NO.json":()=>be(()=>import("./locales/nn-NO.json-FIjypquQ.js"),__vite__mapDeps([])),"./locales/oc-FR.json":()=>be(()=>import("./locales/oc-FR.json-CgJwGEoF.js"),__vite__mapDeps([])),"./locales/pa-IN.json":()=>be(()=>import("./locales/pa-IN.json-D6sKFO9Y.js"),__vite__mapDeps([])),"./locales/percentages.json":()=>be(()=>Promise.resolve().then(()=>GQ),void 0),"./locales/pl-PL.json":()=>be(()=>import("./locales/pl-PL.json-CPEbFbuo.js"),__vite__mapDeps([])),"./locales/pt-BR.json":()=>be(()=>import("./locales/pt-BR.json-CQy3ZIIC.js"),__vite__mapDeps([])),"./locales/pt-PT.json":()=>be(()=>import("./locales/pt-PT.json-DdrtkOO2.js"),__vite__mapDeps([])),"./locales/ro-RO.json":()=>be(()=>import("./locales/ro-RO.json-kyhZ7ww5.js"),__vite__mapDeps([])),"./locales/ru-RU.json":()=>be(()=>import("./locales/ru-RU.json-CXGRFH6a.js"),__vite__mapDeps([])),"./locales/si-LK.json":()=>be(()=>import("./locales/si-LK.json-D8rbKfZA.js"),__vite__mapDeps([])),"./locales/sk-SK.json":()=>be(()=>import("./locales/sk-SK.json-VRiJx3UC.js"),__vite__mapDeps([])),"./locales/sl-SI.json":()=>be(()=>import("./locales/sl-SI.json-GilitV7V.js"),__vite__mapDeps([])),"./locales/sv-SE.json":()=>be(()=>import("./locales/sv-SE.json-F_tmhx26.js"),__vite__mapDeps([])),"./locales/ta-IN.json":()=>be(()=>import("./locales/ta-IN.json-Bb4XJg6y.js"),__vite__mapDeps([])),"./locales/th-TH.json":()=>be(()=>import("./locales/th-TH.json-B_UUla2k.js"),__vite__mapDeps([])),"./locales/tr-TR.json":()=>be(()=>import("./locales/tr-TR.json-BfOHj9iO.js"),__vite__mapDeps([])),"./locales/uk-UA.json":()=>be(()=>import("./locales/uk-UA.json-CeN-HNNU.js"),__vite__mapDeps([])),"./locales/vi-VN.json":()=>be(()=>import("./locales/vi-VN.json-DqLa-N1u.js"),__vite__mapDeps([])),"./locales/zh-CN.json":()=>be(()=>import("./locales/zh-CN.json-B5x7_aMI.js"),__vite__mapDeps([])),"./locales/zh-HK.json":()=>be(()=>import("./locales/zh-HK.json-BYkOMTKx.js"),__vite__mapDeps([])),"./locales/zh-TW.json":()=>be(()=>import("./locales/zh-TW.json-BBZIFbT0.js"),__vite__mapDeps([]))}),`./locales/${kf.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),$U=Qv}Ns.set(zP,e.code)},L0=()=>kf,WI=(e,t)=>{for(let n=0;n<t.length;++n){const i=t[n];if(e[i]===void 0)return;e=e[i]}if(typeof e=="string")return e},L=(e,t,n)=>{if(kf.code.startsWith(FP))return`‪[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]‬`;const i=e.split(".");let r=WI($U,i)||WI(Qv,i)||n;if(r===void 0){const s=`Can't find translation for ${e}`;return console.warn(s),""}if(t)for(const s in t)r=r.replace(`{{${s}}}`,String(t[s]));return r},zP=qt(Sd.code),mn=()=>{const e=PP(zP);return{t:L,langCode:e}};function HP(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=HP(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function me(){for(var e=0,t,n,i="";e<arguments.length;)(t=arguments[e++])&&(n=HP(t))&&(i&&(i+=" "),i+=n);return i}const VP=()=>{const[e,t]=M.useState(null),n=M.useCallback(i=>t(i),[]);return[e,n]};function $3(e,t,n){if(e&&e.length){const[i,r]=t,s=Math.PI/180*n,o=Math.cos(s),a=Math.sin(s);for(const l of e){const[c,u]=l;l[0]=(c-i)*o-(u-r)*a+i,l[1]=(c-i)*a+(u-r)*o+r}}}function oJ(e,t,n){const i=[];e.forEach(r=>i.push(...r)),$3(i,t,n)}function aJ(e,t){return e[0]===t[0]&&e[1]===t[1]}function lJ(e,t,n,i=1){const r=n,s=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,a=[0,0];if(r)for(const c of o)$3(c,a,r);const l=cJ(o,s,i);if(r){for(const c of o)$3(c,a,-r);oJ(l,a,-r)}return l}function cJ(e,t,n){const i=[];for(const c of e){const u=[...c];aJ(u[0],u[u.length-1])||u.push([u[0][0],u[0][1]]),u.length>2&&i.push(u)}const r=[];t=Math.max(t,.1);const s=[];for(const c of i)for(let u=0;u<c.length-1;u++){const d=c[u],f=c[u+1];if(d[1]!==f[1]){const h=Math.min(d[1],f[1]);s.push({ymin:h,ymax:Math.max(d[1],f[1]),x:h===d[1]?d[0]:f[0],islope:(f[0]-d[0])/(f[1]-d[1])})}}if(s.sort((c,u)=>c.ymin<u.ymin?-1:c.ymin>u.ymin?1:c.x<u.x?-1:c.x>u.x?1:c.ymax===u.ymax?0:(c.ymax-u.ymax)/Math.abs(c.ymax-u.ymax)),!s.length)return r;let o=[],a=s[0].ymin,l=0;for(;o.length||s.length;){if(s.length){let c=-1;for(let d=0;d<s.length&&!(s[d].ymin>a);d++)c=d;s.splice(0,c+1).forEach(d=>{o.push({s:a,edge:d})})}if(o=o.filter(c=>!(c.edge.ymax<=a)),o.sort((c,u)=>c.edge.x===u.edge.x?0:(c.edge.x-u.edge.x)/Math.abs(c.edge.x-u.edge.x)),(n!==1||l%t===0)&&o.length>1)for(let c=0;c<o.length;c=c+2){const u=c+1;if(u>=o.length)break;const d=o[c].edge,f=o[u].edge;r.push([[Math.round(d.x),a],[Math.round(f.x),a]])}a+=n,o.forEach(c=>{c.edge.x=c.edge.x+n*c.edge.islope}),l++}return r}function Om(e,t){var n;const i=t.hachureAngle+90;let r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.max(r,.1);let s=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(s=r),lJ(e,r,i,s||1)}class e9{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){const i=Om(t,n);return{type:"fillSketch",ops:this.renderLines(i,n)}}renderLines(t,n){const i=[];for(const r of t)i.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],n));return i}}function V6(e){const t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}class uJ extends e9{fillPolygons(t,n){let i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);const r=Object.assign({},n,{hachureGap:i}),s=Om(t,r),o=Math.PI/180*n.hachureAngle,a=[],l=i*.5*Math.cos(o),c=i*.5*Math.sin(o);for(const[d,f]of s)V6([d,f])&&a.push([[d[0]-l,d[1]+c],[...f]],[[d[0]+l,d[1]-c],[...f]]);return{type:"fillSketch",ops:this.renderLines(a,n)}}}class dJ extends e9{fillPolygons(t,n){const i=this._fillPolygons(t,n),r=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),s=this._fillPolygons(t,r);return i.ops=i.ops.concat(s.ops),i}}class fJ{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});const i=Om(t,n);return this.dotsOnLines(i,n)}dotsOnLines(t,n){const i=[];let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);let s=n.fillWeight;s<0&&(s=n.strokeWidth/2);const o=r/4;for(const a of t){const l=V6(a),c=l/r,u=Math.ceil(c)-1,d=l-u*r,f=(a[0][0]+a[1][0])/2-r/4,h=Math.min(a[0][1],a[1][1]);for(let m=0;m<u;m++){const p=h+d+m*r,b=f-o+Math.random()*2*o,E=p-o+Math.random()*2*o,y=this.helper.ellipse(b,E,s,s,n);i.push(...y.ops)}}return{type:"fillSketch",ops:i}}}class hJ{constructor(t){this.helper=t}fillPolygons(t,n){const i=Om(t,n);return{type:"fillSketch",ops:this.dashedLine(i,n)}}dashedLine(t,n){const i=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,r=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,s=[];return t.forEach(o=>{const a=V6(o),l=Math.floor(a/(i+r)),c=(a+r-l*(i+r))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const f=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let h=0;h<l;h++){const m=h*(i+r),p=m+i,b=[u[0]+m*Math.cos(f)+c*Math.cos(f),u[1]+m*Math.sin(f)+c*Math.sin(f)],E=[u[0]+p*Math.cos(f)+c*Math.cos(f),u[1]+p*Math.sin(f)+c*Math.sin(f)];s.push(...this.helper.doubleLineOps(b[0],b[1],E[0],E[1],n))}}),s}}class gJ{constructor(t){this.helper=t}fillPolygons(t,n){const i=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,r=n.zigzagOffset<0?i:n.zigzagOffset;n=Object.assign({},n,{hachureGap:i+r});const s=Om(t,n);return{type:"fillSketch",ops:this.zigzagLines(s,r,n)}}zigzagLines(t,n,i){const r=[];return t.forEach(s=>{const o=V6(s),a=Math.round(o/(2*n));let l=s[0],c=s[1];l[0]>c[0]&&(l=s[1],c=s[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let d=0;d<a;d++){const f=d*2*n,h=(d+1)*2*n,m=Math.sqrt(2*Math.pow(n,2)),p=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],b=[l[0]+h*Math.cos(u),l[1]+h*Math.sin(u)],E=[p[0]+m*Math.cos(u+Math.PI/4),p[1]+m*Math.sin(u+Math.PI/4)];r.push(...this.helper.doubleLineOps(p[0],p[1],E[0],E[1],i),...this.helper.doubleLineOps(E[0],E[1],b[0],b[1],i))}}),r}}const rr={};function mJ(e,t){let n=e.fillStyle||"hachure";if(!rr[n])switch(n){case"zigzag":rr[n]||(rr[n]=new uJ(t));break;case"cross-hatch":rr[n]||(rr[n]=new dJ(t));break;case"dots":rr[n]||(rr[n]=new fJ(t));break;case"dashed":rr[n]||(rr[n]=new hJ(t));break;case"zigzag-line":rr[n]||(rr[n]=new gJ(t));break;case"hachure":default:n="hachure",rr[n]||(rr[n]=new e9(t));break}return rr[n]}function pJ(){return Math.floor(Math.random()*2**31)}class $P{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const UJ=0,G3=1,GP=2,Xp={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function bJ(e){const t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:UJ,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:G3,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:GP,text:""},t}function d8(e,t){return e.type===t}function t9(e){const t=[],n=bJ(e);let i="BOD",r=0,s=n[r];for(;!d8(s,GP);){let o=0;const a=[];if(i==="BOD")if(s.text==="M"||s.text==="m")r++,o=Xp[s.text],i=s.text;else return t9("M0,0"+e);else d8(s,G3)?o=Xp[i]:(r++,o=Xp[s.text],i=s.text);if(r+o<n.length){for(let l=r;l<r+o;l++){const c=n[l];if(d8(c,G3))a[a.length]=+c.text;else throw new Error("Param not a number: "+i+","+c.text)}if(typeof Xp[i]=="number"){const l={key:i,data:a};t.push(l),r+=o,s=n[r],i==="M"&&(i="L"),i==="m"&&(i="l")}else throw new Error("Bad segment: "+i)}else throw new Error("Path data ended short")}return t}function XP(e){let t=0,n=0,i=0,r=0;const s=[];for(const{key:o,data:a}of e)switch(o){case"M":s.push({key:"M",data:[...a]}),[t,n]=a,[i,r]=a;break;case"m":t+=a[0],n+=a[1],s.push({key:"M",data:[t,n]}),i=t,r=n;break;case"L":s.push({key:"L",data:[...a]}),[t,n]=a;break;case"l":t+=a[0],n+=a[1],s.push({key:"L",data:[t,n]});break;case"C":s.push({key:"C",data:[...a]}),t=a[4],n=a[5];break;case"c":{const l=a.map((c,u)=>u%2?c+n:c+t);s.push({key:"C",data:l}),t=l[4],n=l[5];break}case"Q":s.push({key:"Q",data:[...a]}),t=a[2],n=a[3];break;case"q":{const l=a.map((c,u)=>u%2?c+n:c+t);s.push({key:"Q",data:l}),t=l[2],n=l[3];break}case"A":s.push({key:"A",data:[...a]}),t=a[5],n=a[6];break;case"a":t+=a[5],n+=a[6],s.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,n]});break;case"H":s.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],s.push({key:"H",data:[t]});break;case"V":s.push({key:"V",data:[...a]}),n=a[0];break;case"v":n+=a[0],s.push({key:"V",data:[n]});break;case"S":s.push({key:"S",data:[...a]}),t=a[2],n=a[3];break;case"s":{const l=a.map((c,u)=>u%2?c+n:c+t);s.push({key:"S",data:l}),t=l[2],n=l[3];break}case"T":s.push({key:"T",data:[...a]}),t=a[0],n=a[1];break;case"t":t+=a[0],n+=a[1],s.push({key:"T",data:[t,n]});break;case"Z":case"z":s.push({key:"Z",data:[]}),t=i,n=r;break}return s}function jP(e){const t=[];let n="",i=0,r=0,s=0,o=0,a=0,l=0;for(const{key:c,data:u}of e){switch(c){case"M":t.push({key:"M",data:[...u]}),[i,r]=u,[s,o]=u;break;case"C":t.push({key:"C",data:[...u]}),i=u[4],r=u[5],a=u[2],l=u[3];break;case"L":t.push({key:"L",data:[...u]}),[i,r]=u;break;case"H":i=u[0],t.push({key:"L",data:[i,r]});break;case"V":r=u[0],t.push({key:"L",data:[i,r]});break;case"S":{let d=0,f=0;n==="C"||n==="S"?(d=i+(i-a),f=r+(r-l)):(d=i,f=r),t.push({key:"C",data:[d,f,...u]}),a=u[0],l=u[1],i=u[2],r=u[3];break}case"T":{const[d,f]=u;let h=0,m=0;n==="Q"||n==="T"?(h=i+(i-a),m=r+(r-l)):(h=i,m=r);const p=i+2*(h-i)/3,b=r+2*(m-r)/3,E=d+2*(h-d)/3,y=f+2*(m-f)/3;t.push({key:"C",data:[p,b,E,y,d,f]}),a=h,l=m,i=d,r=f;break}case"Q":{const[d,f,h,m]=u,p=i+2*(d-i)/3,b=r+2*(f-r)/3,E=h+2*(d-h)/3,y=m+2*(f-m)/3;t.push({key:"C",data:[p,b,E,y,h,m]}),a=d,l=f,i=h,r=m;break}case"A":{const d=Math.abs(u[0]),f=Math.abs(u[1]),h=u[2],m=u[3],p=u[4],b=u[5],E=u[6];d===0||f===0?(t.push({key:"C",data:[i,r,b,E,b,E]}),i=b,r=E):(i!==b||r!==E)&&(YP(i,r,b,E,d,f,h,m,p).forEach(function(v){t.push({key:"C",data:v})}),i=b,r=E);break}case"Z":t.push({key:"Z",data:[]}),i=s,r=o;break}n=c}return t}function yJ(e){return Math.PI*e/180}function F1(e,t,n){const i=e*Math.cos(n)-t*Math.sin(n),r=e*Math.sin(n)+t*Math.cos(n);return[i,r]}function YP(e,t,n,i,r,s,o,a,l,c){const u=yJ(o);let d=[],f=0,h=0,m=0,p=0;if(c)[f,h,m,p]=c;else{[e,t]=F1(e,t,-u),[n,i]=F1(n,i,-u);const N=(e-n)/2,D=(t-i)/2;let G=N*N/(r*r)+D*D/(s*s);G>1&&(G=Math.sqrt(G),r=G*r,s=G*s);const V=a===l?-1:1,H=r*r,$=s*s,j=H*$-H*D*D-$*N*N,X=H*D*D+$*N*N,Y=V*Math.sqrt(Math.abs(j/X));m=Y*r*D/s+(e+n)/2,p=Y*-s*N/r+(t+i)/2,f=Math.asin(parseFloat(((t-p)/s).toFixed(9))),h=Math.asin(parseFloat(((i-p)/s).toFixed(9))),e<m&&(f=Math.PI-f),n<m&&(h=Math.PI-h),f<0&&(f=Math.PI*2+f),h<0&&(h=Math.PI*2+h),l&&f>h&&(f=f-Math.PI*2),!l&&h>f&&(h=h-Math.PI*2)}let b=h-f;if(Math.abs(b)>Math.PI*120/180){const N=h,D=n,G=i;l&&h>f?h=f+Math.PI*120/180*1:h=f+Math.PI*120/180*-1,n=m+r*Math.cos(h),i=p+s*Math.sin(h),d=YP(n,i,D,G,r,s,o,0,l,[h,N,m,p])}b=h-f;const E=Math.cos(f),y=Math.sin(f),v=Math.cos(h),_=Math.sin(h),I=Math.tan(b/4),R=4/3*r*I,w=4/3*s*I,T=[e,t],A=[e+R*y,t-w*E],S=[n+R*_,i-w*v],k=[n,i];if(A[0]=2*T[0]-A[0],A[1]=2*T[1]-A[1],c)return[A,S,k].concat(d);{d=[A,S,k].concat(d);const N=[];for(let D=0;D<d.length;D+=3){const G=F1(d[D][0],d[D][1],u),V=F1(d[D+1][0],d[D+1][1],u),H=F1(d[D+2][0],d[D+2][1],u);N.push([G[0],G[1],V[0],V[1],H[0],H[1]])}return N}}const EJ={randOffset:SJ,randOffsetWithRange:IJ,ellipse:wJ,doubleLineOps:xJ};function WP(e,t,n,i,r){return{type:"path",ops:Va(e,t,n,i,r)}}function GU(e,t,n){const i=(e||[]).length;if(i>2){const r=[];for(let s=0;s<i-1;s++)r.push(...Va(e[s][0],e[s][1],e[s+1][0],e[s+1][1],n));return t&&r.push(...Va(e[i-1][0],e[i-1][1],e[0][0],e[0][1],n)),{type:"path",ops:r}}else if(i===2)return WP(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function vJ(e,t){return GU(e,!0,t)}function _J(e,t,n,i,r){const s=[[e,t],[e+n,t],[e+n,t+i],[e,t+i]];return vJ(s,r)}function KI(e,t){let n=JI(e,1*(1+t.roughness*.2),t);if(!t.disableMultiStroke){const i=JI(e,1.5*(1+t.roughness*.22),CJ(t));n=n.concat(i)}return{type:"path",ops:n}}function wJ(e,t,n,i,r){const s=KP(n,i,r);return X3(e,t,r,s).opset}function KP(e,t,n){const i=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),r=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*i)),s=Math.PI*2/r;let o=Math.abs(e/2),a=Math.abs(t/2);const l=1-n.curveFitting;return o+=Re(o*l,n),a+=Re(a*l,n),{increment:s,rx:o,ry:a}}function X3(e,t,n,i){const[r,s]=ex(i.increment,e,t,i.rx,i.ry,1,i.increment*tb(.1,tb(.4,1,n),n),n);let o=nb(r,null,n);if(!n.disableMultiStroke&&n.roughness!==0){const[a]=ex(i.increment,e,t,i.rx,i.ry,1.5,0,n),l=nb(a,null,n);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function ZI(e,t,n,i,r,s,o,a,l){const c=e,u=t;let d=Math.abs(n/2),f=Math.abs(i/2);d+=Re(d*.01,l),f+=Re(f*.01,l);let h=r,m=s;for(;h<0;)h+=Math.PI*2,m+=Math.PI*2;m-h>Math.PI*2&&(h=0,m=Math.PI*2);const p=Math.PI*2/l.curveStepCount,b=Math.min(p/2,(m-h)/2),E=tx(b,c,u,d,f,h,m,1,l);if(!l.disableMultiStroke){const y=tx(b,c,u,d,f,h,m,1.5,l);E.push(...y)}return o&&(a?E.push(...Va(c,u,c+d*Math.cos(h),u+f*Math.sin(h),l),...Va(c,u,c+d*Math.cos(m),u+f*Math.sin(m),l)):E.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+d*Math.cos(h),u+f*Math.sin(h)]})),{type:"path",ops:E}}function qI(e,t){const n=jP(XP(t9(e))),i=[];let r=[0,0],s=[0,0];for(const{key:o,data:a}of n)switch(o){case"M":{s=[a[0],a[1]],r=[a[0],a[1]];break}case"L":i.push(...Va(s[0],s[1],a[0],a[1],t)),s=[a[0],a[1]];break;case"C":{const[l,c,u,d,f,h]=a;i.push(...AJ(l,c,u,d,f,h,s,t)),s=[f,h];break}case"Z":i.push(...Va(s[0],s[1],r[0],r[1],t)),s=[r[0],r[1]];break}return{type:"path",ops:i}}function f8(e,t){const n=[];for(const i of e)if(i.length){const r=t.maxRandomnessOffset||0,s=i.length;if(s>2){n.push({op:"move",data:[i[0][0]+Re(r,t),i[0][1]+Re(r,t)]});for(let o=1;o<s;o++)n.push({op:"lineTo",data:[i[o][0]+Re(r,t),i[o][1]+Re(r,t)]})}}return{type:"fillPath",ops:n}}function cf(e,t){return mJ(t,EJ).fillPolygons(e,t)}function TJ(e,t,n,i,r,s,o){const a=e,l=t;let c=Math.abs(n/2),u=Math.abs(i/2);c+=Re(c*.01,o),u+=Re(u*.01,o);let d=r,f=s;for(;d<0;)d+=Math.PI*2,f+=Math.PI*2;f-d>Math.PI*2&&(d=0,f=Math.PI*2);const h=(f-d)/o.curveStepCount,m=[];for(let p=d;p<=f;p=p+h)m.push([a+c*Math.cos(p),l+u*Math.sin(p)]);return m.push([a+c*Math.cos(f),l+u*Math.sin(f)]),m.push([a,l]),cf([m],o)}function SJ(e,t){return Re(e,t)}function IJ(e,t,n){return tb(e,t,n)}function xJ(e,t,n,i,r){return Va(e,t,n,i,r,!0)}function CJ(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function ZP(e){return e.randomizer||(e.randomizer=new $P(e.seed||0)),e.randomizer.next()}function tb(e,t,n,i=1){return n.roughness*i*(ZP(n)*(t-e)+e)}function Re(e,t,n=1){return tb(-e,e,t,n)}function Va(e,t,n,i,r,s=!1){const o=s?r.disableMultiStrokeFill:r.disableMultiStroke,a=QI(e,t,n,i,r,!0,!1);if(o)return a;const l=QI(e,t,n,i,r,!0,!0);return a.concat(l)}function QI(e,t,n,i,r,s,o){const a=Math.pow(e-n,2)+Math.pow(t-i,2),l=Math.sqrt(a);let c=1;l<200?c=1:l>500?c=.4:c=-.0016668*l+1.233334;let u=r.maxRandomnessOffset||0;u*u*100>a&&(u=l/10);const d=u/2,f=.2+ZP(r)*.2;let h=r.bowing*r.maxRandomnessOffset*(i-t)/200,m=r.bowing*r.maxRandomnessOffset*(e-n)/200;h=Re(h,r,c),m=Re(m,r,c);const p=[],b=()=>Re(d,r,c),E=()=>Re(u,r,c),y=r.preserveVertices;return o?p.push({op:"move",data:[e+(y?0:b()),t+(y?0:b())]}):p.push({op:"move",data:[e+(y?0:Re(u,r,c)),t+(y?0:Re(u,r,c))]}),o?p.push({op:"bcurveTo",data:[h+e+(n-e)*f+b(),m+t+(i-t)*f+b(),h+e+2*(n-e)*f+b(),m+t+2*(i-t)*f+b(),n+(y?0:b()),i+(y?0:b())]}):p.push({op:"bcurveTo",data:[h+e+(n-e)*f+E(),m+t+(i-t)*f+E(),h+e+2*(n-e)*f+E(),m+t+2*(i-t)*f+E(),n+(y?0:E()),i+(y?0:E())]}),p}function JI(e,t,n){const i=[];i.push([e[0][0]+Re(t,n),e[0][1]+Re(t,n)]),i.push([e[0][0]+Re(t,n),e[0][1]+Re(t,n)]);for(let r=1;r<e.length;r++)i.push([e[r][0]+Re(t,n),e[r][1]+Re(t,n)]),r===e.length-1&&i.push([e[r][0]+Re(t,n),e[r][1]+Re(t,n)]);return nb(i,null,n)}function nb(e,t,n){const i=e.length,r=[];if(i>3){const s=[],o=1-n.curveTightness;r.push({op:"move",data:[e[1][0],e[1][1]]});for(let a=1;a+2<i;a++){const l=e[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*e[a+1][0]-o*e[a-1][0])/6,l[1]+(o*e[a+1][1]-o*e[a-1][1])/6],s[2]=[e[a+1][0]+(o*e[a][0]-o*e[a+2][0])/6,e[a+1][1]+(o*e[a][1]-o*e[a+2][1])/6],s[3]=[e[a+1][0],e[a+1][1]],r.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else i===3?(r.push({op:"move",data:[e[1][0],e[1][1]]}),r.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):i===2&&r.push(...Va(e[0][0],e[0][1],e[1][0],e[1][1],n));return r}function ex(e,t,n,i,r,s,o,a){const l=a.roughness===0,c=[],u=[];if(l){e=e/4,u.push([t+i*Math.cos(-e),n+r*Math.sin(-e)]);for(let d=0;d<=Math.PI*2;d=d+e){const f=[t+i*Math.cos(d),n+r*Math.sin(d)];c.push(f),u.push(f)}u.push([t+i*Math.cos(0),n+r*Math.sin(0)]),u.push([t+i*Math.cos(e),n+r*Math.sin(e)])}else{const d=Re(.5,a)-Math.PI/2;u.push([Re(s,a)+t+.9*i*Math.cos(d-e),Re(s,a)+n+.9*r*Math.sin(d-e)]);const f=Math.PI*2+d-.01;for(let h=d;h<f;h=h+e){const m=[Re(s,a)+t+i*Math.cos(h),Re(s,a)+n+r*Math.sin(h)];c.push(m),u.push(m)}u.push([Re(s,a)+t+i*Math.cos(d+Math.PI*2+o*.5),Re(s,a)+n+r*Math.sin(d+Math.PI*2+o*.5)]),u.push([Re(s,a)+t+.98*i*Math.cos(d+o),Re(s,a)+n+.98*r*Math.sin(d+o)]),u.push([Re(s,a)+t+.9*i*Math.cos(d+o*.5),Re(s,a)+n+.9*r*Math.sin(d+o*.5)])}return[u,c]}function tx(e,t,n,i,r,s,o,a,l){const c=s+Re(.1,l),u=[];u.push([Re(a,l)+t+.9*i*Math.cos(c-e),Re(a,l)+n+.9*r*Math.sin(c-e)]);for(let d=c;d<=o;d=d+e)u.push([Re(a,l)+t+i*Math.cos(d),Re(a,l)+n+r*Math.sin(d)]);return u.push([t+i*Math.cos(o),n+r*Math.sin(o)]),u.push([t+i*Math.cos(o),n+r*Math.sin(o)]),nb(u,null,l)}function AJ(e,t,n,i,r,s,o,a){const l=[],c=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let u=[0,0];const d=a.disableMultiStroke?1:2,f=a.preserveVertices;for(let h=0;h<d;h++)h===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(f?0:Re(c[0],a)),o[1]+(f?0:Re(c[0],a))]}),u=f?[r,s]:[r+Re(c[h],a),s+Re(c[h],a)],l.push({op:"bcurveTo",data:[e+Re(c[h],a),t+Re(c[h],a),n+Re(c[h],a),i+Re(c[h],a),u[0],u[1]]});return l}function B1(e){return[...e]}function MJ(e,t=0){const n=e.length;if(n<3)throw new Error("A curve must have at least three points.");const i=[];if(n===3)i.push(B1(e[0]),B1(e[1]),B1(e[2]),B1(e[2]));else{const r=[];r.push(e[0],e[0]);for(let a=1;a<e.length;a++)r.push(e[a]),a===e.length-1&&r.push(e[a]);const s=[],o=1-t;i.push(B1(r[0]));for(let a=1;a+2<r.length;a++){const l=r[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*r[a+1][0]-o*r[a-1][0])/6,l[1]+(o*r[a+1][1]-o*r[a-1][1])/6],s[2]=[r[a+1][0]+(o*r[a][0]-o*r[a+2][0])/6,r[a+1][1]+(o*r[a][1]-o*r[a+2][1])/6],s[3]=[r[a+1][0],r[a+1][1]],i.push(s[1],s[2],s[3])}}return i}function RJ(e,t){return Math.sqrt(XU(e,t))}function XU(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function kJ(e,t,n){const i=XU(t,n);if(i===0)return XU(e,t);let r=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/i;return r=Math.max(0,Math.min(1,r)),XU(e,nu(t,n,r))}function nu(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function LJ(e,t){const n=e[t+0],i=e[t+1],r=e[t+2],s=e[t+3];let o=3*i[0]-2*n[0]-s[0];o*=o;let a=3*i[1]-2*n[1]-s[1];a*=a;let l=3*r[0]-2*s[0]-n[0];l*=l;let c=3*r[1]-2*s[1]-n[1];return c*=c,o<l&&(o=l),a<c&&(a=c),o+a}function j3(e,t,n,i){const r=i||[];if(LJ(e,t)<n){const s=e[t+0];r.length?RJ(r[r.length-1],s)>1&&r.push(s):r.push(s),r.push(e[t+3])}else{const o=e[t+0],a=e[t+1],l=e[t+2],c=e[t+3],u=nu(o,a,.5),d=nu(a,l,.5),f=nu(l,c,.5),h=nu(u,d,.5),m=nu(d,f,.5),p=nu(h,m,.5);j3([o,u,h,p],0,n,r),j3([p,m,f,c],0,n,r)}return r}function DJ(e,t){return ib(e,0,e.length,t)}function ib(e,t,n,i,r){const s=r||[],o=e[t],a=e[n-1];let l=0,c=1;for(let u=t+1;u<n-1;++u){const d=kJ(e[u],o,a);d>l&&(l=d,c=u)}return Math.sqrt(l)>i?(ib(e,t,c+1,i,s),ib(e,c,n,i,s)):(s.length||s.push(o),s.push(a)),s}function n9(e,t=.15,n){const i=[],r=(e.length-1)/3;for(let s=0;s<r;s++){const o=s*3;j3(e,o,t,i)}return n&&n>0?ib(i,0,i.length,n):i}function NJ(e,t,n){const i=t9(e),r=jP(XP(i)),s=[];let o=[],a=[0,0],l=[];const c=()=>{l.length>=4&&o.push(...n9(l,t)),l=[]},u=()=>{c(),o.length&&(s.push(o),o=[])};for(const{key:f,data:h}of r)switch(f){case"M":u(),a=[h[0],h[1]],o.push(a);break;case"L":c(),o.push([h[0],h[1]]);break;case"C":if(!l.length){const m=o.length?o[o.length-1]:a;l.push([m[0],m[1]])}l.push([h[0],h[1]]),l.push([h[2],h[3]]),l.push([h[4],h[5]]);break;case"Z":c(),o.push([a[0],a[1]]);break}if(u(),!n)return s;const d=[];for(const f of s){const h=DJ(f,n);h.length&&d.push(h)}return d}const wr="none";class D0{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return pJ()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,i){return{shape:t,sets:n||[],options:i||this.defaultOptions}}line(t,n,i,r,s){const o=this._o(s);return this._d("line",[WP(t,n,i,r,o)],o)}rectangle(t,n,i,r,s){const o=this._o(s),a=[],l=_J(t,n,i,r,o);if(o.fill){const c=[[t,n],[t+i,n],[t+i,n+r],[t,n+r]];o.fillStyle==="solid"?a.push(f8([c],o)):a.push(cf([c],o))}return o.stroke!==wr&&a.push(l),this._d("rectangle",a,o)}ellipse(t,n,i,r,s){const o=this._o(s),a=[],l=KP(i,r,o),c=X3(t,n,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=X3(t,n,o,l).opset;u.type="fillPath",a.push(u)}else a.push(cf([c.estimatedPoints],o));return o.stroke!==wr&&a.push(c.opset),this._d("ellipse",a,o)}circle(t,n,i,r){const s=this.ellipse(t,n,i,i,r);return s.shape="circle",s}linearPath(t,n){const i=this._o(n);return this._d("linearPath",[GU(t,!1,i)],i)}arc(t,n,i,r,s,o,a=!1,l){const c=this._o(l),u=[],d=ZI(t,n,i,r,s,o,a,!0,c);if(a&&c.fill)if(c.fillStyle==="solid"){const f=Object.assign({},c);f.disableMultiStroke=!0;const h=ZI(t,n,i,r,s,o,!0,!1,f);h.type="fillPath",u.push(h)}else u.push(TJ(t,n,i,r,s,o,c));return c.stroke!==wr&&u.push(d),this._d("arc",u,c)}curve(t,n){const i=this._o(n),r=[],s=KI(t,i);if(i.fill&&i.fill!==wr&&t.length>=3)if(i.fillStyle==="solid"){const o=KI(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{const o=MJ(t),a=n9(o,10,(1+i.roughness)/2);r.push(cf([a],i))}return i.stroke!==wr&&r.push(s),this._d("curve",r,i)}polygon(t,n){const i=this._o(n),r=[],s=GU(t,!0,i);return i.fill&&(i.fillStyle==="solid"?r.push(f8([t],i)):r.push(cf([t],i))),i.stroke!==wr&&r.push(s),this._d("polygon",r,i)}path(t,n){const i=this._o(n),r=[];if(!t)return this._d("path",r,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=i.fill&&i.fill!=="transparent"&&i.fill!==wr,o=i.stroke!==wr,a=!!(i.simplification&&i.simplification<1),l=a?4-4*(i.simplification||1):(1+i.roughness)/2,c=NJ(t,1,l),u=qI(t,i);if(s)if(i.fillStyle==="solid")if(c.length===1){const d=qI(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(d.ops)})}else r.push(f8(c,i));else r.push(cf(c,i));return o&&(a?c.forEach(d=>{r.push(GU(d,!1,i))}):r.push(u)),this._d("path",r,i)}opsToPath(t,n){let i="";for(const r of t.ops){const s=typeof n=="number"&&n>=0?r.data.map(o=>+o.toFixed(n)):r.data;switch(r.op){case"move":i+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":i+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":i+=`L${s[0]} ${s[1]} `;break}}return i.trim()}toPaths(t){const n=t.sets||[],i=t.options||this.defaultOptions,r=[];for(const s of n){let o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:wr};break;case"fillPath":o={d:this.opsToPath(s),stroke:wr,strokeWidth:0,fill:i.fill||wr};break;case"fillSketch":o=this.fillSketch(s,i);break}o&&r.push(o)}return r}fillSketch(t,n){let i=n.fillWeight;return i<0&&(i=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||wr,strokeWidth:i,fill:wr}}_mergedShape(t){return t.filter((n,i)=>i===0?!0:n.op!=="move")}}class OJ{constructor(t,n){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new D0(n)}draw(t){const n=t.sets||[],i=t.options||this.getDefaultOptions(),r=this.ctx,s=t.options.fixedDecimalPlaceDigits;for(const o of n)switch(o.type){case"path":r.save(),r.strokeStyle=i.stroke==="none"?"transparent":i.stroke,r.lineWidth=i.strokeWidth,i.strokeLineDash&&r.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(r.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(r,o,s),r.restore();break;case"fillPath":{r.save(),r.fillStyle=i.fill||"";const a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(r,o,s,a),r.restore();break}case"fillSketch":this.fillSketch(r,o,i);break}}fillSketch(t,n,i){let r=i.fillWeight;r<0&&(r=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=r,this._drawToContext(t,n,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,n,i,r="nonzero"){t.beginPath();for(const s of n.ops){const o=typeof i=="number"&&i>=0?s.data.map(a=>+a.toFixed(i)):s.data;switch(s.op){case"move":t.moveTo(o[0],o[1]);break;case"bcurveTo":t.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":t.lineTo(o[0],o[1]);break}}n.type==="fillPath"?t.fill(r):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,n,i,r,s){const o=this.gen.line(t,n,i,r,s);return this.draw(o),o}rectangle(t,n,i,r,s){const o=this.gen.rectangle(t,n,i,r,s);return this.draw(o),o}ellipse(t,n,i,r,s){const o=this.gen.ellipse(t,n,i,r,s);return this.draw(o),o}circle(t,n,i,r){const s=this.gen.circle(t,n,i,r);return this.draw(s),s}linearPath(t,n){const i=this.gen.linearPath(t,n);return this.draw(i),i}polygon(t,n){const i=this.gen.polygon(t,n);return this.draw(i),i}arc(t,n,i,r,s,o,a=!1,l){const c=this.gen.arc(t,n,i,r,s,o,a,l);return this.draw(c),c}curve(t,n){const i=this.gen.curve(t,n);return this.draw(i),i}path(t,n){const i=this.gen.path(t,n);return this.draw(i),i}}const jp="http://www.w3.org/2000/svg";class PJ{constructor(t,n){this.svg=t,this.gen=new D0(n)}draw(t){const n=t.sets||[],i=t.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,s=r.createElementNS(jp,"g"),o=t.options.fixedDecimalPlaceDigits;for(const a of n){let l=null;switch(a.type){case"path":{l=r.createElementNS(jp,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke",i.stroke),l.setAttribute("stroke-width",i.strokeWidth+""),l.setAttribute("fill","none"),i.strokeLineDash&&l.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break}case"fillPath":{l=r.createElementNS(jp,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",i.fill||""),(t.shape==="curve"||t.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(r,a,i);break}}l&&s.appendChild(l)}return s}fillSketch(t,n,i){let r=i.fillWeight;r<0&&(r=i.strokeWidth/2);const s=t.createElementNS(jp,"path");return s.setAttribute("d",this.opsToPath(n,i.fixedDecimalPlaceDigits)),s.setAttribute("stroke",i.fill||""),s.setAttribute("stroke-width",r+""),s.setAttribute("fill","none"),i.fillLineDash&&s.setAttribute("stroke-dasharray",i.fillLineDash.join(" ").trim()),i.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${i.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,n){return this.gen.opsToPath(t,n)}line(t,n,i,r,s){const o=this.gen.line(t,n,i,r,s);return this.draw(o)}rectangle(t,n,i,r,s){const o=this.gen.rectangle(t,n,i,r,s);return this.draw(o)}ellipse(t,n,i,r,s){const o=this.gen.ellipse(t,n,i,r,s);return this.draw(o)}circle(t,n,i,r){const s=this.gen.circle(t,n,i,r);return this.draw(s)}linearPath(t,n){const i=this.gen.linearPath(t,n);return this.draw(i)}polygon(t,n){const i=this.gen.polygon(t,n);return this.draw(i)}arc(t,n,i,r,s,o,a=!1,l){const c=this.gen.arc(t,n,i,r,s,o,a,l);return this.draw(c)}curve(t,n){const i=this.gen.curve(t,n);return this.draw(i)}path(t,n){const i=this.gen.path(t,n);return this.draw(i)}}const Pc={canvas(e,t){return new OJ(e,t)},svg(e,t){return new PJ(e,t)},generator(e){return new D0(e)},newSeed(){return D0.newSeed()}};let i9=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");var qP="Expected a function",nx=NaN,FJ="[object Symbol]",BJ=/^\s+|\s+$/g,zJ=/^[-+]0x[0-9a-f]+$/i,HJ=/^0b[01]+$/i,VJ=/^0o[0-7]+$/i,$J=parseInt,GJ=typeof va=="object"&&va&&va.Object===Object&&va,XJ=typeof self=="object"&&self&&self.Object===Object&&self,jJ=GJ||XJ||Function("return this")(),YJ=Object.prototype,WJ=YJ.toString,KJ=Math.max,ZJ=Math.min,h8=function(){return jJ.Date.now()};function qJ(e,t,n){var i,r,s,o,a,l,c=0,u=!1,d=!1,f=!0;if(typeof e!="function")throw new TypeError(qP);t=ix(t)||0,rb(n)&&(u=!!n.leading,d="maxWait"in n,s=d?KJ(ix(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f);function h(R){var w=i,T=r;return i=r=void 0,c=R,o=e.apply(T,w),o}function m(R){return c=R,a=setTimeout(E,t),u?h(R):o}function p(R){var w=R-l,T=R-c,A=t-w;return d?ZJ(A,s-T):A}function b(R){var w=R-l,T=R-c;return l===void 0||w>=t||w<0||d&&T>=s}function E(){var R=h8();if(b(R))return y(R);a=setTimeout(E,p(R))}function y(R){return a=void 0,f&&i?h(R):(i=r=void 0,o)}function v(){a!==void 0&&clearTimeout(a),c=0,i=l=r=a=void 0}function _(){return a===void 0?o:y(h8())}function I(){var R=h8(),w=b(R);if(i=arguments,r=this,l=R,w){if(a===void 0)return m(l);if(d)return a=setTimeout(E,t),h(l)}return a===void 0&&(a=setTimeout(E,t)),o}return I.cancel=v,I.flush=_,I}function QJ(e,t,n){var i=!0,r=!0;if(typeof e!="function")throw new TypeError(qP);return rb(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),qJ(e,t,{leading:i,maxWait:t,trailing:r})}function rb(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function JJ(e){return!!e&&typeof e=="object"}function eee(e){return typeof e=="symbol"||JJ(e)&&WJ.call(e)==FJ}function ix(e){if(typeof e=="number")return e;if(eee(e))return nx;if(rb(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=rb(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(BJ,"");var n=HJ.test(e);return n||VJ.test(e)?$J(e.slice(2),n?2:8):zJ.test(e)?nx:+e}var tee=QJ;const Ao=sl(tee);var QP={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(va,function(){var n=function(){this._listeners={}};n.prototype.addEventListener=function(c,u){this._listeners[c]=this._listeners[c]||[],this._listeners[c].indexOf(u)<0&&this._listeners[c].push(u)},n.prototype.removeEventListener=function(c,u){if(this._listeners[c]){var d=this._listeners[c].indexOf(u);d>=0&&this._listeners[c].splice(d,1)}},n.prototype.dispatchEvent=function(c){if(this._listeners[c.type]&&this._listeners[c.type].length)for(var u=this._listeners[c.type].slice(),d=0,f=u.length;d<f;++d)u[d].call(this,c)};var i=function(c){return typeof c.constructor=="function"&&c.constructor.name==="GeneratorFunction"},r=function(c){return{next:function(){var u=c();return u?{value:u}:{done:!0}}}},s=function(c){var u=!1;return{next:function(){return u?{done:!0}:(u=!0,{value:c})}}},o=function(c,u){var d=typeof c;if(d==="object"){if(typeof c.next=="function")return c;if(typeof c.then=="function")return s(c)}return d==="function"?i(c)?c():r(c):s(u.resolve(c))},a=function(c,u,d){this.target=c,this.type=u,this.data=d},l=function(c,u,d){if(n.call(this),typeof u!="number"||Math.floor(u)!==u||u<1)throw new Error("Invalid concurrency");this._concurrency=u,this._options=d||{},this._options.promise=this._options.promise||Promise,this._iterator=o(c,this._options.promise),this._done=!1,this._size=0,this._promise=null,this._callbacks=null};return l.prototype=new n,l.prototype.constructor=l,l.prototype.concurrency=function(c){return typeof c<"u"&&(this._concurrency=c,this.active()&&this._proceed()),this._concurrency},l.prototype.size=function(){return this._size},l.prototype.active=function(){return!!this._promise},l.prototype.promise=function(){return this._promise},l.prototype.start=function(){var c=this,u=this._options.promise;return this._promise=new u(function(d,f){c._callbacks={reject:f,resolve:d},c._proceed()}),this._promise},l.prototype._fireEvent=function(c,u){this.dispatchEvent(new a(this,c,u))},l.prototype._settle=function(c){c?this._callbacks.reject(c):this._callbacks.resolve(),this._promise=null,this._callbacks=null},l.prototype._onPooledPromiseFulfilled=function(c,u){this._size--,this.active()&&(this._fireEvent("fulfilled",{promise:c,result:u}),this._proceed())},l.prototype._onPooledPromiseRejected=function(c,u){this._size--,this.active()&&(this._fireEvent("rejected",{promise:c,error:u}),this._settle(u||new Error("Unknown error")))},l.prototype._trackPromise=function(c){var u=this;c.then(function(d){u._onPooledPromiseFulfilled(c,d)},function(d){u._onPooledPromiseRejected(c,d)}).catch(function(d){u._settle(new Error("Promise processing failed: "+d))})},l.prototype._proceed=function(){if(!this._done){for(var c={done:!1};this._size<this._concurrency&&!(c=this._iterator.next()).done;)this._size++,this._trackPromise(c.value);this._done=c===null||!!c.done}this._done&&this._size===0&&this._settle()},l.PromisePoolEvent=a,l.PromisePool=l,l})})(QP);var nee=QP.exports;const iee=sl(nee),$a=1e-4,He=(e,t,n)=>Math.min(Math.max(e,t),n),Do=(e,t,n="round")=>{const i=Math.pow(10,t);return Math[n]((e+Number.EPSILON)*i)/i},ree=(e,t,n="round")=>{const i=1/t;return Math[n](e*i)/i},Yp=(e,t)=>(e+t)/2,$g=e=>typeof e=="number"&&Number.isFinite(e),rx=(e,t,n=$a)=>Math.abs(e-t)<n,sb=e=>e<0?e+2*Math.PI:e>=2*Math.PI?e-2*Math.PI:e;function Lu(e){return e*Math.PI/180}function Pm(e){return e*180/Math.PI}function see(e){return Math.abs(Math.sin(2*e))<$a}function Ui(e,t,n=0,i=0){return[e-n,t-i]}function _e(e,t=[0,0]){return Ui(e[0]-t[0],e[1]-t[1])}function $n(e,t){return e[0]*t[1]-t[0]*e[1]}function sx(e,t){return e[0]*t[0]+e[1]*t[1]}function Bl(e,t){return[e[0]+t[0],e[1]+t[1]]}function ob(e,t){return[e[0]-t[0],e[1]-t[1]]}function fn(e,t){return Ui(e[0]*t,e[1]*t)}function oee(e){return e[0]*e[0]+e[1]*e[1]}function aee(e){return Math.sqrt(oee(e))}const Fi=e=>{const t=aee(e);return t===0?Ui(0,0):Ui(e[0]/t,e[1]/t)};function C(e,t){return[e,t]}function r9(e){return e.length===2?C(e[0],e[1]):void 0}function Ve(e,t=C(0,0)){return C(t[0]+e[0],t[1]+e[1])}function pu(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&!isNaN(e[0])&&typeof e[1]=="number"&&!isNaN(e[1])}function Zs(e,t){const n=Math.abs;return n(e[0]-t[0])<$a&&n(e[1]-t[1])<$a}function q([e,t],[n,i],r){return C((e-n)*Math.cos(r)-(t-i)*Math.sin(r)+n,(e-n)*Math.sin(r)+(t-i)*Math.cos(r)+i)}function ab(e,t=[0,0]){return C(e[0]+t[0],e[1]+t[1])}function N0(e,t){return C((e[0]+t[0])/2,(e[1]+t[1])/2)}function pt(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function O0(e,t){const n=t[0]-e[0],i=t[1]-e[1];return n*n+i*i}const ca=(e,t,n)=>ab(t,fn(_e(e,t),n)),JP=(e,t,n)=>t[0]<=Math.max(e[0],n[0])&&t[0]>=Math.min(e[0],n[0])&&t[1]<=Math.max(e[1],n[1])&&t[1]>=Math.min(e[1],n[1]);function Y3(e,t){return[e,t]}function lee(e,t){const n=e[1][1]-e[0][1],i=e[0][0]-e[1][0],r=t[1][1]-t[0][1],s=t[0][0]-t[1][0],o=n*s-r*i;if(o!==0){const a=n*e[0][0]+i*e[0][1],l=r*t[0][0]+s*t[0][1];return C((a*s-l*i)/o,(n*l-r*a)/o)}return null}function we(e,t){return[e,t]}const cee=e=>Array.isArray(e)&&e.length===2&&pu(e[0])&&pu(e[0]),Wu=(e,t,n=$a)=>{const i=s9(e,t);return i===0?!0:i<n},s9=(e,t)=>{const[n,i]=e,[[r,s],[o,a]]=t,l=n-r,c=i-s,u=o-r,d=a-s,f=l*u+c*d,h=u*u+d*d;let m=-1;h!==0&&(m=f/h);let p,b;m<0?(p=r,b=s):m>1?(p=o,b=a):(p=r+m*u,b=s+m*d);const E=n-p,y=i-b;return Math.sqrt(E*E+y*y)};function P0(e,t){const n=lee(Y3(e[0],e[1]),Y3(t[0],t[1]));return!n||!Wu(n,t)||!Wu(n,e)?null:n}function W3(e,t){return[e,t]}function uee(e,t){return[we(e[0],C(e[1][0],e[0][1])),we(C(e[1][0],e[0][1]),e[1]),we(e[1],C(e[0][0],e[1][1])),we(C(e[0][0],e[1][1]),e[0])].map(n=>P0(t,n)).filter(n=>!!n)}function xa(e,t,n,i){return[e,t,n,i]}function ox(e,t,n,i=1e-6){return[(e(t+i,n)-e(t-i,n))/(2*i),(e(t,n+i)-e(t,n-i))/(2*i)]}function dee(e,t,n,i=.001,r=10){let s=1/0,o=0;for(;s>=i;){if(o>=r)return null;const a=e(t,n),l=[ox((p,b)=>e(p,b)[0],t,n),ox((p,b)=>e(p,b)[1],t,n)],c=[[-a[0]],[-a[1]]],u=l[0][0]*l[1][1]-l[0][1]*l[1][0];if(u===0)return null;const d=[[l[1][1]/u,-l[0][1]/u],[-l[1][0]/u,l[0][0]/u]],f=[[d[0][0]*c[0][0]+d[0][1]*c[1][0]],[d[1][0]*c[0][0]+d[1][1]*c[1][0]]];t=t+f[0][0],n=n+f[1][0];const[h,m]=e(t,n);s=Math.max(Math.abs(h),Math.abs(m)),o+=1}return[t,n]}const Gg=(e,t)=>C((1-t)**3*e[0][0]+3*(1-t)**2*t*e[1][0]+3*(1-t)*t**2*e[2][0]+t**3*e[3][0],(1-t)**3*e[0][1]+3*(1-t)**2*t*e[1][1]+3*(1-t)*t**2*e[2][1]+t**3*e[3][1]);function eF(e,t){const n=gee(e);if(uee(W3(C(n[0],n[1]),C(n[2],n[3])),t).length===0)return[];const i=a=>C(t[0][0]+a*(t[1][0]-t[0][0]),t[0][1]+a*(t[1][1]-t[0][1])),r=[[.5,0],[.2,0],[.8,0]],s=([a,l])=>{const c=dee((f,h)=>{const m=Gg(e,f),p=i(h);return[m[0]-p[0],m[1]-p[1]]},a,l);if(!c)return null;const[u,d]=c;return u<0||u>1||d<0||d>1?null:Gg(e,u)};let o=s(r[0]);return o?[o]:(o=s(r[1]),o?[o]:(o=s(r[2]),o?[o]:[]))}function fee(e,t,n=.001){const i=(c,u,d,f=n)=>{let h=c,m=u,p;for(;m-h>f;)p=(m+h)/2,d(p-f)<d(p+f)?m=p:h=p;return p};let s=0;for(let c=1/0,u=0;u<30;u++){const d=pt(t,Gg(e,u/30));d<c&&(c=d,s=u)}const o=Math.max((s-1)/30,0),a=Math.min((s+1)/30,1),l=i(o,a,c=>pt(t,Gg(e,c)));return l?Gg(e,l):null}function tF(e,t){const n=fee(e,t);return n?pt(t,n):0}function hee(e){return Array.isArray(e)&&e.length===4&&pu(e[0])&&pu(e[1])&&pu(e[2])&&pu(e[3])}function gee(e){const[t,n,i,r]=e,s=[t[0],n[0],i[0],r[0]],o=[t[1],n[1],i[1],r[1]];return[Math.min(...s),Math.min(...o),Math.max(...s),Math.max(...o)]}function ax(...e){return nF(e)}function lb(e){return nF(e)}const lx=(e,t)=>{const n=e[0],i=e[1];let r=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s][0],l=t[s][1],c=t[o][0],u=t[o][1];(l>i&&u<=i||l<=i&&u>i)&&n<(c-a)*(i-l)/(u-l)+a&&(r=!r)}return r},mee=(e,t,n=$a)=>{let i=!1;for(let r=0,s=t.length-1;r<s;r++)if(Wu(e,we(t[r],t[r+1]),n)){i=!0;break}return i};function nF(e){return pee(e)?e:[...e,e[0]]}function pee(e){return Zs(e[0],e[e.length-1])}function Ri(e,t){return ms([e,t])}const cb=([e,t],[n,i])=>e<=n?t>=n:e>=n?i>=e:!1,ub=([e,t],[n,i])=>{const r=Math.max(e,n),s=Math.min(t,i);return r<=s?ms([r,s]):null},Wp=(e,[t,n])=>e>=t&&e<=n;function Xd([e,t,n],i){const r=(u,d,f)=>(u[0]-f[0])*(d[1]-f[1])-(d[0]-f[0])*(u[1]-f[1]),s=r(i,e,t),o=r(i,t,n),a=r(i,n,e),l=s<0||o<0||a<0,c=s>0||o>0||a>0;return!(l&&c)}const cx=()=>{const e=new Date,t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),i=`${e.getDate()}`.padStart(2,"0"),r=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0");return`${t}-${n}-${i}-${r}${s}`},Xg=e=>e.charAt(0).toUpperCase()+e.slice(1),Uee=e=>e instanceof HTMLElement&&e.className.includes("ToolIcon"),K3=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,bee=e=>K3(e)||e instanceof Element&&!!e.closest("label, button"),ou=e=>e instanceof HTMLElement&&e.dataset.type==="wysiwyg"||e instanceof HTMLBRElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&(e.type==="text"||e.type==="number"||e.type==="password"),Fm=({fontFamily:e})=>{for(const[t,n]of Object.entries(At))if(n===e)return`${t}${OO(n).map(i=>`, ${i}`).join("")}`;return M0},xt=({fontSize:e,fontFamily:t})=>`${e}px ${Fm({fontFamily:t})}`,Ga=(e,t)=>{let n=0,i=null;const r=(...s)=>{i=s,clearTimeout(n),n=window.setTimeout(()=>{i=null,e(...s)},t)};return r.flush=()=>{if(clearTimeout(n),i){const s=i;i=null,e(...s)}},r.cancel=()=>{i=null,clearTimeout(n)},r},Qh=(e,t)=>{let n=null,i=null,r=null;const s=a=>{n=window.requestAnimationFrame(()=>{n=null,e(...a),i=null,r&&(i=r,r=null,s(i))})},o=(...a)=>{i=a,n===null?s(i):t!=null&&t.trailing&&(r=a)};return o.flush=()=>{n!==null&&(cancelAnimationFrame(n),n=null),i&&(e(...r||i),i=r=null)},o.cancel=()=>{i=r=null,n!==null&&(cancelAnimationFrame(n),n=null)},o},Du=e=>1-Math.pow(1-e,4),ux=(e,t,n)=>(t-e)*Du(n)+e,yee=({fromValues:e,toValues:t,onStep:n,duration:i=250,interpolateValue:r,onStart:s,onEnd:o,onCancel:a})=>{let l=!1,c=0,u;function d(f){if(l)return;u===void 0&&(u=f,s==null||s());const h=Math.min(f-u,i),m=Du(h/i),p={};if(Object.keys(e).forEach(b=>{const E=b,y=(t[E]-e[E])*m+e[E];p[E]=y}),n(p),h<i){const b=h/i,E={};Object.keys(e).forEach(y=>{const v=y,_=e[v],I=t[v];let R;R=r?r(_,I,b,v):ux(_,I,b),R==null&&(R=ux(_,I,b)),E[v]=R}),n(E),c=window.requestAnimationFrame(d)}else n(t),o==null||o()}return c=window.requestAnimationFrame(d),()=>{a==null||a(),l=!0,window.cancelAnimationFrame(c)}},Eee=(e,t)=>{if(!e.length||t<1)return[];let n=0,i=0;const r=Array(Math.ceil(e.length/t));for(;n<e.length;)r[i++]=e.slice(n,n+=t);return r},Li=(e,t)=>Math.abs(e-t),Sn=(e,t)=>t.type==="custom"?{...e.activeTool,type:"custom",customType:t.customType,locked:t.locked??e.activeTool.locked}:{...e.activeTool,lastActiveTool:t.lastActiveToolBeforeEraser===void 0?e.activeTool.lastActiveTool:t.lastActiveToolBeforeEraser,type:t.type,customType:null,locked:t.locked??e.activeTool.locked},Q=e=>(e=e.replace(/\bAlt\b/i,"Alt").replace(/\bShift\b/i,"Shift").replace(/\b(Enter|Return)\b/i,"Enter"),Fo?e.replace(/\bCtrlOrCmd\b/gi,"Cmd").replace(/\bAlt\b/i,"Option"):e.replace(/\bCtrlOrCmd\b/gi,"Ctrl")),Pt=({clientX:e,clientY:t},{zoom:n,offsetLeft:i,offsetTop:r,scrollX:s,scrollY:o})=>{const a=(e-i)/n.value-s,l=(t-r)/n.value-o;return{x:a,y:l}},Os=({sceneX:e,sceneY:t},{zoom:n,offsetLeft:i,offsetTop:r,scrollX:s,scrollY:o})=>{const a=(e+s)*n.value+i,l=(t+o)*n.value+r;return{x:a,y:l}},Kp=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),vee="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿Ⰰ-﬜﷾-﹯﻽-",_ee="֑-߿יִ-﷽ﹰ-ﻼ",wee=new RegExp(`^[^${vee}]*[${_ee}]`),iF=e=>wee.test(e),Ps=e=>{const[t,n]=e;return{x:t,y:n}},rF=e=>{if((e==null?void 0:e.name)==="AbortError"){console.warn(e);return}throw e},sF=(e,t,n=0)=>{n<0&&(n=e.length+n),n=Math.min(e.length,Math.max(n,0));let i=n-1;for(;++i<e.length;)if(t(e[i],i,e))return i;return-1},au=(e,t,n=e.length-1)=>{n<0&&(n=e.length+n),n=Math.min(e.length-1,Math.max(n,0));let i=n+1;for(;--i>-1;)if(t(e[i],i,e))return i;return-1},Fs=e=>{const t=e.length===5&&e.substr(4,1)==="0",n=e.length===9&&e.substr(7,2)==="00";return t||n||e===$e.transparent},g8=e=>e.fillStyle!=="solid"||Fs(e.backgroundColor),$6=()=>{let e,t;const n=new Promise((i,r)=>{e=i,t=r});return n.resolve=e,n.reject=t,n},dx=(e,t)=>{const n=[{value:1,symbol:"b"},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"G"}],i=/\.0+$|(\.[0-9]*[1-9])0+$/;let r;for(r=n.length-1;r>0&&!(e>=n[r].value);r--);return(e/n[r].value).toFixed(t).replace(i,"$1")+n[r].symbol},Z3=()=>{var e;return((e=document.querySelector('meta[name="version"]'))==null?void 0:e.content)||PO},Tee=e=>{let t=e.parentElement;for(;t;){if(t===document.body)return document;const{overflowY:n}=window.getComputedStyle(t);if(t.scrollHeight>t.clientHeight&&(n==="auto"||n==="scroll"||n==="overlay"))return t;t=t.parentElement}return document},See=e=>{let t=e.parentElement;for(;t;){if(t.tabIndex>-1){t.focus();return}t=t.parentElement}},o9=e=>{e.preventDefault(),e.returnValue=""},oF=e=>Array.from(e).map(t=>`0${t.toString(16)}`.slice(-2)).join(""),Jh=()=>Date.now(),Se=e=>e instanceof Map?e:e.reduce((t,n)=>(t.set(typeof n=="string"?n:n.id,n),t),new Map),Iee=e=>e.reduce((t,n,i)=>(t.set(n.id,[n,i]),t),new Map),sa=(e,t)=>e.reduce((n,i)=>(n[t?t(i):String(i)]=i,n),{}),xee=e=>e.reduce((t,n,i)=>{const r={...n,prev:null,next:null};if(i!==0){const s=t[i-1];if(r.prev=s,s.next=r,i===e.length-1){const o=t[0];r.next=o,o.prev=r}}return t.push(r),t},[]),Cee=()=>typeof process<"u"&&!0,aF=(e,t)=>new CustomEvent(e,{detail:{nativeEvent:t},cancelable:!0}),jU=(e,t)=>{let n=!1;for(const i in t){const r=t[i];if(typeof r<"u"){if(e[i]===r&&(typeof r!="object"||r===null))continue;n=!0}}return n?{...e,...t}:e},Bm=()=>{try{return window.self===window.top?"top":"iframe"}catch{return"iframe"}},Aee=()=>Bm()==="iframe",zm=e=>!!e&&typeof e=="object"&&"then"in e&&"catch"in e&&"finally"in e,q3=e=>{const t=e==null?void 0:e.querySelectorAll("button, a, input, select, textarea, div[tabindex], label[tabindex]");return t?Array.from(t).filter(n=>n.tabIndex>-1&&!n.disabled):[]},fx=(e,t)=>Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t,vi=(e,t,n,i=!1)=>{const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return i&&console.warn("%cisShallowEqual: objects don't have same properties ->","color: #8B4000",e,t),!1;if(n&&Array.isArray(n)){for(const o of n)if(!(e[o]===t[o]||fx(e[o],t[o])))return i&&console.warn(`%cisShallowEqual: ${o} not equal ->`,"color: #8B4000",e[o],t[o]),!1;return!0}return r.every(o=>{const a=n==null?void 0:n[o],l=a?a(e[o],t[o]):e[o]===t[o]||fx(e[o],t[o]);return!l&&i&&console.warn(`%cisShallowEqual: ${o} not equal ->`,"color: #8B4000",e[o],t[o]),l})},G6=(e,t,{checkForDefaultPrevented:n=!0}={})=>function(r){if(e==null||e(r),!n||!(r!=null&&r.defaultPrevented))return t==null?void 0:t(r)},pc=(e,t,n)=>{if(!t)return e;if(n)return console.error(t),e;throw new Error(t)};function qi(e,t){if(!e)throw new Error(t)}const Mee=e=>{let t,n;const i=function(r){const s=Object.entries(r);if(t){let a=!0;for(const[l,c]of s)if(t.get(l)!==c){a=!1;break}if(a)return n}const o=e(r);return t=new Map(s),n=o,o};return i.clear=()=>{t=void 0,n=void 0},i},lF=(e,t)=>e instanceof Set||e instanceof Map?e.has(t):"includes"in e?e.includes(t):e.hasOwnProperty(t),ka=e=>JSON.parse(JSON.stringify(e)),z1=(e,t)=>vi(e,t)?e:t;function Jt(e,t,n,i){var r;return e?((r=e==null?void 0:e.addEventListener)==null||r.call(e,t,n,i),()=>{var s;(s=e==null?void 0:e.removeEventListener)==null||s.call(e,t,n,i)}):()=>{}}function Ree(e,t=!0){const n=e.length;if(n<4)return"";let i=e[0],r=e[1];const s=e[2];let o=`M${i[0].toFixed(2)},${i[1].toFixed(2)} Q${r[0].toFixed(2)},${r[1].toFixed(2)} ${Yp(r[0],s[0]).toFixed(2)},${Yp(r[1],s[1]).toFixed(2)} T`;for(let a=2,l=n-1;a<l;a++)i=e[a],r=e[a+1],o+=`${Yp(i[0],r[0]).toFixed(2)},${Yp(i[1],r[1]).toFixed(2)} `;return t&&(o+="Z"),o}const cF=e=>e.replace(/\r?\n|\r/g,`
`),ms=e=>e,Uc=async(e,...t)=>new Promise(n=>{n(e(...t))}),kee=(...e)=>Math.max(...e.map(t=>t?1:0))>0,Lee=e=>{try{return JSON.parse(e)}catch{return null}};class hx{constructor(t,n){F(this,"pool");F(this,"entries",{});this.pool=new iee(t,n)}all(){const t=n=>{if(n.data.result){const[i,r]=n.data.result;this.entries[i]=r}};return this.pool.addEventListener("fulfilled",t),this.pool.start().then(()=>(setTimeout(()=>{this.pool.removeEventListener("fulfilled",t)}),Object.values(this.entries)))}}const YU=e=>e.replace(/"/g,"&quot;"),gx=e=>Array.isArray(e)?e:[e],xn=e=>!!e&&e.type==="image"&&!!e.fileId,st=e=>!!e&&e.type==="image",lr=e=>!!e&&e.type==="embeddable",Il=e=>!!e&&e.type==="iframe",ts=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),de=e=>e!=null&&e.type==="text",uF=e=>e!=null&&e.type==="frame",WU=e=>e!=null&&e.type==="magicframe",Ie=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),ps=e=>e!=null&&Dee(e.type),Dee=e=>e==="freedraw",ke=e=>e!=null&&a9(e.type),Be=e=>e!=null&&e.type==="arrow",ge=e=>Be(e)&&e.elbowed,a9=e=>e==="arrow"||e==="line",So=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&dF(e.type),dF=e=>e==="arrow",qs=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Nee=e=>e!=null&&(e.type==="rectangle"||e.type==="diamond"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Nu=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||Be(e)),fF=e=>{const t=e==null?void 0:e.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return pc(t,null),!1}},X6=e=>e.type==="rectangle"||e.type==="ellipse"||e.type==="diamond",Us=e=>{var t;return Nu(e)&&!!((t=e.boundElements)!=null&&t.some(({type:n})=>n==="text"))},Xt=e=>e!==null&&"containerId"in e&&e.containerId!==null&&de(e),e1=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",hF=e=>e==="line"||e==="arrow"||e==="diamond",Oee=(e,t)=>!!((e===On.ADAPTIVE_RADIUS||e===On.LEGACY)&&e1(t.type)||e===On.PROPORTIONAL_RADIUS&&hF(t.type)),Pee=e=>hF(e.type)?{type:On.PROPORTIONAL_RADIUS}:e1(e.type)?{type:On.ADAPTIVE_RADIUS}:null,db=e=>Object.hasOwn(e,"fixedPoint")&&e.fixedPoint!=null;let Fee=new $P(Date.now());const Bo=()=>Math.floor(Fee.next()*2**31),bs=()=>i9(),gF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function Lf(e,t,n){const i=n[0];if(t!=null&&e>=t)throw new Error(e+" >= "+t);if(e.slice(-1)===i||t&&t.slice(-1)===i)throw new Error("trailing zero");if(t){let o=0;for(;(e[o]||i)===t[o];)o++;if(o>0)return t.slice(0,o)+Lf(e.slice(o),t.slice(o),n)}const r=e?n.indexOf(e[0]):0,s=t!=null?n.indexOf(t[0]):n.length;if(s-r>1){const o=Math.round(.5*(r+s));return n[o]}else return t&&t.length>1?t.slice(0,1):n[r]+Lf(e.slice(1),null,n)}function mF(e){if(e.length!==pF(e[0]))throw new Error("invalid integer part of order key: "+e)}function pF(e){if(e>="a"&&e<="z")return e.charCodeAt(0)-97+2;if(e>="A"&&e<="Z")return 90-e.charCodeAt(0)+2;throw new Error("invalid order key head: "+e)}function cg(e){const t=pF(e[0]);if(t>e.length)throw new Error("invalid order key: "+e);return e.slice(0,t)}function mx(e,t){if(e==="A"+t[0].repeat(26))throw new Error("invalid order key: "+e);const n=cg(e);if(e.slice(n.length).slice(-1)===t[0])throw new Error("invalid order key: "+e)}function px(e,t){mF(e);const[n,...i]=e.split("");let r=!0;for(let s=i.length-1;r&&s>=0;s--){const o=t.indexOf(i[s])+1;o===t.length?i[s]=t[0]:(i[s]=t[o],r=!1)}if(r){if(n==="Z")return"a"+t[0];if(n==="z")return null;const s=String.fromCharCode(n.charCodeAt(0)+1);return s>"a"?i.push(t[0]):i.pop(),s+i.join("")}else return n+i.join("")}function Bee(e,t){mF(e);const[n,...i]=e.split("");let r=!0;for(let s=i.length-1;r&&s>=0;s--){const o=t.indexOf(i[s])-1;o===-1?i[s]=t.slice(-1):(i[s]=t[o],r=!1)}if(r){if(n==="a")return"Z"+t.slice(-1);if(n==="A")return null;const s=String.fromCharCode(n.charCodeAt(0)-1);return s<"Z"?i.push(t.slice(-1)):i.pop(),s+i.join("")}else return n+i.join("")}function jd(e,t,n=gF){if(e!=null&&mx(e,n),t!=null&&mx(t,n),e!=null&&t!=null&&e>=t)throw new Error(e+" >= "+t);if(e==null){if(t==null)return"a"+n[0];const l=cg(t),c=t.slice(l.length);if(l==="A"+n[0].repeat(26))return l+Lf("",c,n);if(l<t)return l;const u=Bee(l,n);if(u==null)throw new Error("cannot decrement any more");return u}if(t==null){const l=cg(e),c=e.slice(l.length),u=px(l,n);return u??l+Lf(c,null,n)}const i=cg(e),r=e.slice(i.length),s=cg(t),o=t.slice(s.length);if(i===s)return i+Lf(r,o,n);const a=px(i,n);if(a==null)throw new Error("cannot increment any more");return a<t?a:i+Lf(r,null,n)}function Q3(e,t,n,i=gF){if(n===0)return[];if(n===1)return[jd(e,t,i)];if(t==null){let o=jd(e,t,i);const a=[o];for(let l=0;l<n-1;l++)o=jd(o,t,i),a.push(o);return a}if(e==null){let o=jd(e,t,i);const a=[o];for(let l=0;l<n-1;l++)o=jd(e,o,i),a.push(o);return a.reverse(),a}const r=Math.floor(n/2),s=jd(e,t,i);return[...Q3(e,s,r,i),s,...Q3(s,t,n-r-1,i)]}class zee extends Error{constructor(t="Couldn't export canvas.",n="CANVAS_ERROR"){super(),this.name=n,this.message=t}}class Uh extends DOMException{constructor(t="Request Aborted"){super(t,"AbortError")}}class Uu extends Error{constructor(n="Image Scene Data Error",i="IMAGE_SCENE_DATA_ERROR"){super(n);F(this,"code");this.name="EncodingError",this.code=i}}class Hee extends Error{constructor(){super(...arguments);F(this,"code","ELEMENT_HAS_INVALID_INDEX")}}class UF extends Error{constructor(n="Worker URL is not defined!",i="WORKER_URL_NOT_DEFINED"){super(n);F(this,"code");this.name="WorkerUrlNotDefinedError",this.code=i}}class bF extends Error{constructor(n="Worker has to be in a separate chunk!",i="WORKER_IN_THE_MAIN_CHUNK"){super(n);F(this,"code");this.name="WorkerInTheMainChunkError",this.code=i}}class Bs extends Error{constructor(t){super(t),this.name="ExcalidrawError"}}const zi=(e,t,n)=>{const i=e.split(`
`).map(a=>a||" ").join(`
`),r=parseFloat(t),s=Xee(i,r,n);return{width:u9(i,t),height:s}},yF="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),EF=(e,t)=>{const n=jee(e);return n===0?zi(yF.split("").join(`
`),e,t).width+Nn*2:n+Nn*2},l9=(e,t)=>zi("",e,t).width+Nn*2,Vee=()=>u9(yF,xt({fontSize:al,fontFamily:Oc}))>0,bh=e=>cF(e).replace(/\t/g,"        "),c9=e=>bh(e).split(`
`),$ee=e=>{const t=c9(e.text).length;return e.height/t/e.fontSize},Hm=(e,t)=>e*t,vF=(e,t)=>Hm(e,t)+Nn*2;let m8;class Gee{constructor(){F(this,"canvas");this.canvas=document.createElement("canvas")}getLineWidth(t,n){const i=this.canvas.getContext("2d");return i.font=n,i.measureText(t).width}}const Ku=(e,t)=>(m8||(m8=new Gee),m8.getLineWidth(e,t)),u9=(e,t)=>{const n=c9(e);let i=0;return n.forEach(r=>{i=Math.max(i,Ku(r,t))}),i},Xee=(e,t,n)=>{const i=c9(e).length;return Hm(t,n)*i},Vm=(()=>{const e={};return{calculate:(r,s)=>{const o=r.charCodeAt(0);if(e[s]||(e[s]=[]),!e[s][o]){const a=Ku(r,s);e[s][o]=a}return e[s][o]},getCache:r=>e[r],clearCache:r=>{e[r]=[]}}})(),jee=e=>{const t=Vm.getCache(e);if(!t)return 0;const n=t.filter(i=>i!==void 0);return Math.max(...n)};let p8,Zp,U8;const Yee=e=>(p8||(p8=Et.class(...Object.values(ua))),p8.test(e)),Wee=()=>{if(!Zp)try{Zp=Zee()}catch{Zp=Kee()}return Zp},d9=()=>(U8||(U8=qee()),U8),Xr={WHITESPACE:/\s/u,HYPHEN:/-/u,OPENING:/<\(\[\{/u,CLOSING:/>\)\]\}.,:;!\?…\//u},ua={CHAR:new RegExp("\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}｀＇＾〃〰〆＃＆＊＋－ー／＼＝｜￤〒￢￣","u"),OPENING:/（［｛〈《｟｢「『【〖〔〘〚＜〝/u,CLOSING:/）］｝〉》｠｣」』】〗〕〙〛＞。．，、〟‥？！：；・〜〞/u,CURRENCY:/￥￦￡￠＄/u},Kc={FLAG:new RegExp("\\p{RI}\\p{RI}","u"),JOINER:new RegExp("(?:\\p{Emoji_Modifier}|\\uFE0F\\u20E3?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?","u"),ZWJ:/\u200D/u,ANY:/[\p{Emoji}]/u,MOST:/[\p{Extended_Pictographic}\p{Emoji_Presentation}]/u},Kee=()=>Et.or(d9(),bn.On(Xr.HYPHEN,Xr.WHITESPACE,ua.CHAR)),Zee=()=>Et.or(d9(),bn.Before(Xr.WHITESPACE).Build(),bn.After(Xr.WHITESPACE,Xr.HYPHEN).Build(),bn.Before(ua.CHAR,ua.CURRENCY).NotPrecededBy(Xr.OPENING,ua.OPENING).Build(),bn.After(ua.CHAR).NotFollowedBy(Xr.HYPHEN,Xr.CLOSING,ua.CLOSING).Build(),bn.BeforeMany(ua.OPENING).NotPrecededBy(Xr.OPENING).Build(),bn.AfterMany(ua.CLOSING).NotFollowedBy(Xr.CLOSING).Build(),bn.AfterMany(Xr.CLOSING).FollowedBy(Xr.OPENING).Build()),qee=()=>Et.group(Et.or(Kc.FLAG,Et.and(Kc.MOST,Kc.JOINER,Et.build(`(?:${Kc.ZWJ.source}(?:${Kc.FLAG.source}|${Kc.ANY.source}${Kc.JOINER.source}))*`)))),Et={build:e=>new RegExp(e,"u"),join:(...e)=>e.map(t=>t.source).join(""),and:(...e)=>Et.build(Et.join(...e)),or:(...e)=>Et.build(e.map(t=>t.source).join("|")),group:(...e)=>Et.build(`(${Et.join(...e)})`),class:(...e)=>Et.build(`[${Et.join(...e)}]`)},bn={On:(...e)=>{const t=Et.join(...e);return Et.build(`([${t}])`)},Before:(...e)=>{const t=Et.join(...e),n=()=>Et.build(`(?=[${t}])`);return bn.Chain(n)},After:(...e)=>{const t=Et.join(...e),n=()=>Et.build(`(?<=[${t}])`);return bn.Chain(n)},BeforeMany:(...e)=>{const t=Et.join(...e),n=()=>Et.build(`(?<![${t}])(?=[${t}])`);return bn.Chain(n)},AfterMany:(...e)=>{const t=Et.join(...e),n=()=>Et.build(`(?<=[${t}])(?![${t}])`);return bn.Chain(n)},NotBefore:(...e)=>{const t=Et.join(...e),n=()=>Et.build(`(?![${t}])`);return bn.Chain(n)},NotAfter:(...e)=>{const t=Et.join(...e),n=()=>Et.build(`(?<![${t}])`);return bn.Chain(n)},Chain:e=>({Build:e,PreceededBy:(...t)=>{const n=e(),i=bn.After(...t).Build(),r=()=>Et.and(i,n);return bn.Chain(r)},FollowedBy:(...t)=>{const n=e(),i=bn.Before(...t).Build(),r=()=>Et.and(n,i);return bn.Chain(r)},NotPrecededBy:(...t)=>{const n=e(),i=bn.NotAfter(...t).Build(),r=()=>Et.and(i,n);return bn.Chain(r)},NotFollowedBy:(...t)=>{const n=e(),i=bn.NotBefore(...t).Build(),r=()=>Et.and(n,i);return bn.Chain(r)}})},Qee=e=>{const t=Wee();return e.normalize("NFC").split(t).filter(Boolean)},Id=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;const i=[],r=e.split(`
`);for(const s of r){if(Ku(s,t)<=n){i.push(s);continue}const a=Jee(s,t,n);i.push(...a)}return i.join(`
`)},Jee=(e,t,n)=>{const i=[],s=Qee(e)[Symbol.iterator]();let o="",a=0,l=s.next();for(;!l.done;){const c=l.value,u=o+c,d=nte(c)?a+Vm.calculate(c,t):Ku(u,t);if(/\s/.test(c)||d<=n){o=u,a=d,l=s.next();continue}if(o)i.push(o.trimEnd()),o="",a=0;else{const f=ete(c,t,n),h=f[f.length-1]??"",m=f.slice(0,-1);i.push(...m),o=h,a=Ku(h,t),l=s.next()}}if(o){const c=tte(o,t,n);i.push(c)}return i},ete=(e,t,n)=>{if(d9().test(e))return[e];const i=[],r=Array.from(e);let s="",o=0;for(const a of r){const l=Vm.calculate(a,t),c=o+l;if(c<=n){s=s+a,o=c;continue}s&&i.push(s),s=a,o=l}return s&&i.push(s),i},tte=(e,t,n)=>{if(!(Ku(e,t)>n))return e;let[,r,s]=e.match(/^(.+?)(\s+)$/)??[e,e.trimEnd(),""],o=Ku(r,t);for(const a of Array.from(s)){const l=Vm.calculate(a,t),c=o+l;if(c>n)break;r=r+a,o=c}return r},nte=e=>e.codePointAt(0)!==void 0&&e.codePointAt(1)===void 0;function Ux(e,t,n,i=r=>r){return e*i(.5-t*(.5-n))}function ite(e){return[-e[0],-e[1]]}function Cs(e,t){return[e[0]+t[0],e[1]+t[1]]}function Yr(e,t){return[e[0]-t[0],e[1]-t[1]]}function Ss(e,t){return[e[0]*t,e[1]*t]}function rte(e,t){return[e[0]/t,e[1]/t]}function H1(e){return[e[1],-e[0]]}function bx(e,t){return e[0]*t[0]+e[1]*t[1]}function ste(e,t){return e[0]===t[0]&&e[1]===t[1]}function ote(e){return Math.hypot(e[0],e[1])}function ate(e){return e[0]*e[0]+e[1]*e[1]}function yx(e,t){return ate(Yr(e,t))}function _F(e){return rte(e,ote(e))}function lte(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function V1(e,t,n){let i=Math.sin(n),r=Math.cos(n),s=e[0]-t[0],o=e[1]-t[1],a=s*r-o*i,l=s*i+o*r;return[a+t[0],l+t[1]]}function J3(e,t,n){return Cs(e,Ss(Yr(t,e),n))}function Ex(e,t,n){return Cs(e,Ss(t,n))}var{min:Yd,PI:cte}=Math,vx=.275,$1=cte+1e-4;function ute(e,t={}){let{size:n=16,smoothing:i=.5,thinning:r=.5,simulatePressure:s=!0,easing:o=$=>$,start:a={},end:l={},last:c=!1}=t,{cap:u=!0,easing:d=$=>$*(2-$)}=a,{cap:f=!0,easing:h=$=>--$*$*$+1}=l;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,p=a.taper===!1?0:a.taper===!0?Math.max(n,m):a.taper,b=l.taper===!1?0:l.taper===!0?Math.max(n,m):l.taper,E=Math.pow(n*i,2),y=[],v=[],_=e.slice(0,10).reduce(($,j)=>{let X=j.pressure;if(s){let Y=Yd(1,j.distance/n),le=Yd(1,1-Y);X=Yd(1,$+(le-$)*(Y*vx))}return($+X)/2},e[0].pressure),I=Ux(n,r,e[e.length-1].pressure,o),R,w=e[0].vector,T=e[0].point,A=T,S=T,k=A,N=!1;for(let $=0;$<e.length;$++){let{pressure:j}=e[$],{point:X,vector:Y,distance:le,runningLength:pe}=e[$];if($<e.length-1&&m-pe<3)continue;if(r){if(s){let Ye=Yd(1,le/n),Qe=Yd(1,1-Ye);j=Yd(1,_+(Qe-_)*(Ye*vx))}I=Ux(n,r,j,o)}else I=n/2;R===void 0&&(R=I);let ae=pe<p?d(pe/p):1,ze=m-pe<b?h((m-pe)/b):1;I=Math.max(.01,I*Math.min(ae,ze));let Xe=($<e.length-1?e[$+1]:e[$]).vector,qe=$<e.length-1?bx(Y,Xe):1,Ze=bx(Y,w)<0&&!N,on=qe!==null&&qe<0;if(Ze||on){let Ye=Ss(H1(w),I);for(let Qe=1/13,zt=0;zt<=1;zt+=Qe)S=V1(Yr(X,Ye),X,$1*zt),y.push(S),k=V1(Cs(X,Ye),X,$1*-zt),v.push(k);T=S,A=k,on&&(N=!0);continue}if(N=!1,$===e.length-1){let Ye=Ss(H1(Y),I);y.push(Yr(X,Ye)),v.push(Cs(X,Ye));continue}let _n=Ss(H1(J3(Xe,Y,qe)),I);S=Yr(X,_n),($<=1||yx(T,S)>E)&&(y.push(S),T=S),k=Cs(X,_n),($<=1||yx(A,k)>E)&&(v.push(k),A=k),_=j,w=Y}let D=e[0].point.slice(0,2),G=e.length>1?e[e.length-1].point.slice(0,2):Cs(e[0].point,[1,1]),V=[],H=[];if(e.length===1){if(!(p||b)||c){let $=Ex(D,_F(H1(Yr(D,G))),-(R||I)),j=[];for(let X=1/13,Y=X;Y<=1;Y+=X)j.push(V1($,D,$1*2*Y));return j}}else{if(!(p||b&&e.length===1))if(u)for(let j=1/13,X=j;X<=1;X+=j){let Y=V1(v[0],D,$1*X);V.push(Y)}else{let j=Yr(y[0],v[0]),X=Ss(j,.5),Y=Ss(j,.51);V.push(Yr(D,X),Yr(D,Y),Cs(D,Y),Cs(D,X))}let $=H1(ite(e[e.length-1].vector));if(b||p&&e.length===1)H.push(G);else if(f){let j=Ex(G,$,I);for(let X=1/29,Y=X;Y<1;Y+=X)H.push(V1(j,G,$1*3*Y))}else H.push(Cs(G,Ss($,I)),Cs(G,Ss($,I*.99)),Yr(G,Ss($,I*.99)),Yr(G,Ss($,I)))}return y.concat(H,v.reverse(),V)}function dte(e,t={}){var n;let{streamline:i=.5,size:r=16,last:s=!1}=t;if(e.length===0)return[];let o=.15+(1-i)*.85,a=Array.isArray(e[0])?e:e.map(({x:h,y:m,pressure:p=.5})=>[h,m,p]);if(a.length===2){let h=a[1];a=a.slice(0,-1);for(let m=1;m<5;m++)a.push(J3(a[0],h,m/4))}a.length===1&&(a=[...a,[...Cs(a[0],[1,1]),...a[0].slice(2)]]);let l=[{point:[a[0][0],a[0][1]],pressure:a[0][2]>=0?a[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,u=0,d=l[0],f=a.length-1;for(let h=1;h<a.length;h++){let m=s&&h===f?a[h].slice(0,2):J3(d.point,a[h],o);if(ste(d.point,m))continue;let p=lte(m,d.point);if(u+=p,h<f&&!c){if(u<r)continue;c=!0}d={point:m,pressure:a[h][2]>=0?a[h][2]:.5,vector:_F(Yr(d.point,m)),distance:p,runningLength:u},l.push(d)}return l[0].vector=((n=l[1])==null?void 0:n.vector)||[0,0],l}function fte(e,t={}){return ute(dte(e,t),t)}const wF=(e,t,n)=>{const i=n.reduce((r,s)=>(s.groupIds.includes(e)&&(r[s.id]=!0),r),{});return Object.keys(i).length<2?t.selectedGroupIds[e]||t.editingGroupId===e?{selectedElementIds:t.selectedElementIds,selectedGroupIds:{...t.selectedGroupIds,[e]:!1},editingGroupId:null}:t:{editingGroupId:t.editingGroupId,selectedGroupIds:{...t.selectedGroupIds,[e]:!0},selectedElementIds:{...t.selectedElementIds,...i}}},ji=function(){let e=null,t=null,n=null;const i=(s,o,a,l)=>{if(n!==void 0&&o===t&&s===e&&a.editingGroupId===(n==null?void 0:n.editingGroupId))return n;const c={};for(const f of s){let h=f.groupIds;if(a.editingGroupId){const m=h.indexOf(a.editingGroupId);m>-1&&(h=h.slice(0,m))}if(h.length>0){const m=h[h.length-1];c[m]=!0}}const u={},d=o.reduce((f,h)=>{if(h.isDeleted)return f;const m=h.groupIds.find(p=>c[p]);return m&&(f[h.id]=!0,Array.isArray(u[m])?u[m].push(h.id):u[m]=[h.id]),f},{});for(const f of Object.keys(u))u[f].length<2&&c[f]&&(c[f]=!1);return t=o,e=s,n={editingGroupId:a.editingGroupId,selectedGroupIds:c,selectedElementIds:gt({...a.selectedElementIds,...d},l)},n},r=(s,o,a,l)=>{const c=l?l.scene.getSelectedElements({selectedElementIds:s.selectedElementIds,elements:o}):Fe(o,s);return c.length?i(c,o,s,a):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:gt(s.selectedElementIds,a)}};return r.clearCache=()=>{t=null,e=null,n=null},r}(),TF=(e,t)=>SF(e,t)!=null,SF=(e,t)=>t.groupIds.filter(n=>n!==e.editingGroupId).find(n=>e.selectedGroupIds[n]),Ou=e=>Object.entries(e.selectedGroupIds).filter(([t,n])=>n).map(([t,n])=>t),IF=(e,t)=>{let n={...t,selectedGroupIds:{}};for(const i of e){let r=i.groupIds;if(t.editingGroupId){const s=r.indexOf(t.editingGroupId);s>-1&&(r=r.slice(0,s))}if(r.length>0){const s=r[r.length-1];n={...n,...wF(s,n,e)}}}return n.selectedGroupIds},hte=(e,t)=>({...e,editingGroupId:t.groupIds.length?t.groupIds[0]:null,selectedGroupIds:{},selectedElementIds:{[t.id]:!0}}),F0=(e,t)=>e.groupIds.includes(t),$t=(e,t)=>{const n=[];for(const i of e.values())F0(i,t)&&n.push(i);return n},gte=(e,t)=>e.groupIds.find(n=>t[n]),mte=(e,t,n)=>{const i=[...e],r=t?e.indexOf(t):-1,s=r>-1?r:e.length;for(let o=0;o<s;o++)i[o]=n(i[o]);return i},pte=(e,t,n)=>{const i=[...e],r=n?i.indexOf(n):-1,s=r>-1?r:i.length;return i.splice(s,0,t),i},Ute=(e,t)=>e.filter(n=>!t[n]),j6=(e,t)=>{const n=new Map;return e.forEach(i=>{const r=i.groupIds.length===0?i.id:i.groupIds[i.groupIds.length-1],s=n.get(r)||[],o=Oe(i,t);o&&s.push(o),n.set(r,[...s,i])}),Array.from(n.values())},bte=e=>{const t=new Set;for(const[,n]of e)if(!n.isDeleted)for(const i of n.groupIds??[])t.add(i);return t},xF=e=>{const t=e.flatMap(r=>r.groupIds),n=new Map;let i=0;for(const r of t)n.set(r,(n.get(r)??0)+1),n.get(r)>i&&(i=n.get(r));return i===e.length},yh=e=>e.groupIds.length>0;var f9={};Object.defineProperty(f9,"__esModule",{value:!0});var CF=f9.sanitizeUrl=void 0,yte=/^([^\w]*)(javascript|data|vbscript)/im,Ete=/&#(\w+)(^\w|;)?/g,vte=/&(newline|tab);/gi,_te=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,wte=/^.+(:|&colon;)/gim,Tte=[".","/"];function Ste(e){return Tte.indexOf(e[0])>-1}function Ite(e){return e.replace(Ete,function(t,n){return String.fromCharCode(n)})}function xte(e){var t=Ite(e||"").replace(vte,"").replace(_te,"").trim();if(!t)return"about:blank";if(Ste(t))return t;var n=t.match(wte);if(!n)return t;var i=n[0];return yte.test(i)?"about:blank":t}CF=f9.sanitizeUrl=xte;const Or=e=>(e=e.trim(),e&&CF(YU(e))),AF=e=>!!(e!=null&&e.includes(location.origin)||e!=null&&e.startsWith("/")),h9=e=>{if(e=Or(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e};let eE=[];const oe=e=>(eE=eE.concat(e),e),MF='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',Cte='<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>',RF='<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>',Ate=`data:${ye.svg},${encodeURIComponent(`${MF}${RF}</svg>`)}`,Mte=`data:${ye.svg},${encodeURIComponent(`${MF}${Cte}${RF}</svg>`)}`,Is=e=>{e&&(e.style.cursor="")},It=(e,t)=>{e&&(e.style.cursor=t)};let co,_x;const kF=(e,t)=>{const i=()=>{const r=t===xe.DARK;co=document.createElement("canvas"),co.theme=t,co.height=20,co.width=20;const s=co.getContext("2d");s.lineWidth=1,s.beginPath(),s.arc(co.width/2,co.height/2,5,0,2*Math.PI),s.fillStyle=r?li.black:li.white,s.fill(),s.strokeStyle=r?li.white:li.black,s.stroke(),_x=co.toDataURL(ye.svg)};(!co||co.theme!==t)&&i(),It(e,`url(${_x}) ${20/2} ${20/2}, auto`)},go=(e,t)=>{if(e)if(t.activeTool.type==="selection")Is(e);else if(mh(t))e.style.cursor=Tt.GRAB;else if(bo(t))kF(e,t.theme);else if(t.activeTool.type==="laser"){const n=t.theme===xe.LIGHT?Ate:Mte;e.style.cursor=`url(${n}), auto`}else["image","custom"].includes(t.activeTool.type)?t.activeTool.type!=="image"&&(e.style.cursor=Tt.AUTO):e.style.cursor=Tt.CROSSHAIR},Ai=class Ai{};F(Ai,"rg",new D0),F(Ai,"cache",new WeakMap),F(Ai,"get",t=>Ai.cache.get(t)),F(Ai,"set",(t,n)=>Ai.cache.set(t,n)),F(Ai,"delete",t=>Ai.cache.delete(t)),F(Ai,"destroy",()=>{Ai.cache=new WeakMap}),F(Ai,"generateElementShape",(t,n)=>{const i=n!=null&&n.isExporting?void 0:Ai.get(t);if(i!==void 0)return i;_E.delete(t);const r=r1e(t,Ai.rg,n||{isExporting:!1,canvasBackgroundColor:$e.white,embedsValidationStatus:null});return Ai.cache.set(t,r),r});let Gt=Ai;const Ds=e=>"var(--icon-fill-color)",LF=e=>e===xe.LIGHT?li.white:"#1e1e1e",W=(e,t=512)=>{const{width:n=512,height:i=n,mirror:r,style:s,...o}=typeof t=="number"?{width:t}:t;return g("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${i}`,className:me({"rtl-mirror":r}),style:s,...o,children:typeof e=="string"?g("path",{fill:"currentColor",d:e}):e})},ce={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},Ne={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"};W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("rect",{x:3,y:8,width:18,height:4,rx:1}),g("line",{x1:12,y1:8,x2:12,y2:21}),g("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),g("path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"})]}),ce);const g9=W(P("g",{strokeWidth:"1.25",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),g("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),g("line",{x1:"3",y1:"6",x2:"3",y2:"19"}),g("line",{x1:"12",y1:"6",x2:"12",y2:"19"}),g("line",{x1:"21",y1:"6",x2:"21",y2:"19"})]}),ce),Rte=W(P("svg",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),g("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),ce),kte=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("circle",{cx:"12",cy:"12",r:"1"}),g("circle",{cx:"12",cy:"19",r:"1"}),g("circle",{cx:"12",cy:"5",r:"1"})]}),ce),Lte=W(P("svg",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),g("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),g("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),ce),Y6=W(P("g",{children:[g("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),g("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),g("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:g("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),g("g",{mask:"url(#UnlockedIcon)",children:g("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),Ne),m9=W(P("g",{strokeWidth:"1.25",children:[g("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),g("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),g("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),Ne),Dte=W(P(he,{children:[g("path",{d:"M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),g("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),g("path",{d:"M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:41,height:94,fill:"none"}),Nte=W(P(he,{children:[g("path",{d:"M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),g("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z",fill:"currentColor"}),g("path",{d:"M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:85,height:71,fill:"none"}),Ote=W(P(he,{children:[g("path",{d:"M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),g("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z",fill:"currentColor"}),g("path",{d:"M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:38,height:78,fill:"none"}),tE=W(g("g",{fill:"currentColor",children:g("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),{width:40,height:40,fill:"none"}),Pte=W(P("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z"}),g("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),Fte=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),ce),Bte=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z"})]}),ce),zte=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("circle",{cx:"12",cy:"12",r:"9"})]}),ce),Hte=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),g("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),g("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),ce),Vte=W(g("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),Ne),$te=W(P("g",{strokeWidth:"1.25",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),g("path",{d:"M16 7h4"}),g("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),ce),B0=W(P("g",{strokeWidth:"1.25",children:[g("path",{clipRule:"evenodd",d:"m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z"}),g("path",{d:"m11.25 5.417 3.333 3.333"})]}),Ne),DF=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),g("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),g("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),g("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),g("polyline",{points:"5 20 11 4 13 4 20 20"})]}),ce),Gte=W(P("g",{strokeWidth:"1.25",children:[g("path",{d:"M12.5 6.667h.01"}),g("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z"}),g("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),g("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),Ne),Xte=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"}),g("path",{d:"M18 13.3l-6.3 -6.3"})]}),ce),wx=W(g("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),Ne),Tx=W(g("path",{d:"M5 10h10",strokeWidth:"1.25"}),Ne),jte=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M21 21l-6 -6"}),g("path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403"}),g("path",{d:"M3 4v4h4"})]}),ce),bc=W(g("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),Ne),Yte=W(P("g",{strokeWidth:"1.25",children:[g("polyline",{points:"12 16 18 10 12 4"}),g("polyline",{points:"8 4 2 10 8 16"})]}),Ne),nE=W(P("g",{strokeWidth:"1.25",children:[g("path",{d:"M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z"}),g("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),Ne),iE=W(g("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),Ne),rE=W(g("g",{stroke:"currentColor",strokeLinejoin:"round",children:g("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),{...Ne,strokeWidth:1.5}),NF=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),g("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),g("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),ce),W6=W(g("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),Ne),p9=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("circle",{cx:"12",cy:"12",r:"9"}),g("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),g("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ce),Wte=W(P("g",{strokeWidth:"1.25",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("circle",{cx:"12",cy:"12",r:"9"}),g("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),g("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ce),Sx=W(g("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),Ne),U9=W(g("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),Ne),OF=W(P("g",{strokeWidth:"1.25",children:[g("path",{d:"M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0"}),g("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),Ne),PF=W(P("g",{strokeWidth:"1.25",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),g("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),ce),Kte=W(g("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),fb=W(P("g",{strokeWidth:"1.25",children:[g("path",{d:"M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416"}),g("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),Ne),Zte=W("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),qte=W("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),b9=W(g("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),Ne);W("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512});const Qte=W("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),b8=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),g("path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z"}),g("path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208"})]}),ce),FF=W(P("g",{strokeWidth:"1.25",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M15 8h.01"}),g("path",{d:"M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"}),g("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),g("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),g("path",{d:"M19 16v6"}),g("path",{d:"M22 19l-3 3l-3 -3"})]}),ce),Jte=W("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512});W("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512});W("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512});const ene=W("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z");W("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z");const Ix=W(g("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),Ne),xx=W(g("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),Ne),tne=W("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),y9=W(g("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),Ne),nne=W("M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"),ine=W("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),rne=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1"}),g("path",{d:"M12 14v-11"}),g("path",{d:"M9 6l3 -3l3 3"})]}),ce),sne=W(P(he,{children:[g("path",{fill:"currentColor",d:"M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z"}),g("path",{stroke:"currentColor",fill:"currentColor",d:"M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z"})]}),{width:64,height:64});W(g("path",{stroke:"currentColor",strokeWidth:"40",fill:"currentColor",d:"M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z"}),{width:1024});const BF=P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M12 10l0 10"}),g("path",{d:"M12 10l4 4"}),g("path",{d:"M12 10l-4 4"}),g("path",{d:"M4 4l16 0"})]}),zF=P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M12 5l0 14"}),g("path",{d:"M16 9l-4 -4"}),g("path",{d:"M8 9l4 -4"})]}),Cx=W(zF,ce),Ax=W(zF,{...ce,style:{transform:"rotate(180deg)"}}),Mx=W(BF,ce),Rx=W(BF,{...ce,style:{transform:"rotate(180deg)"}}),kx=W(P(he,{children:[P("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z"})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Lx=W(P(he,{children:[P("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z"})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Dx=W(P(he,{children:[P("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z"})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Nx=W(P(he,{children:[P("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z"})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),one=W(P(he,{children:[P("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z"})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),ane=W(P(he,{children:[P("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z"})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Ox=W(P("g",{stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),g("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),Ne),Px=W(P("g",{stroke:"currentColor",strokeWidth:"1.25",children:[g("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),g("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),Ne),E9=W(P("g",{strokeWidth:"1.5",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("circle",{cx:"9",cy:"7",r:"4"}),g("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),g("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),g("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),ce);W("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z");W("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z");const xd=W(P(he,{children:[g("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:g("path",{d:"M15 5 5 15M5 5l10 10"})}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne);W("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0});const lne=W("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24});W("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512});const Fx=se.memo(({theme:e})=>W(P(he,{children:[g("path",{d:"M25 26H111V111H25",fill:Ds()}),g("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:Ds(),strokeWidth:"2"}),g("path",{d:"M100 100H160V160H100",fill:Ds()}),g("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:Ds(),strokeWidth:"2"}),P("g",{fill:LF(e),stroke:Ds(),strokeWidth:"6",children:[g("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),g("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),g("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),g("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),Bx=se.memo(({theme:e})=>W(P(he,{children:[g("path",{d:"M25 26H111V111H25",fill:Ds()}),g("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:Ds(),strokeWidth:"2"}),g("path",{d:"M100 100H160V160H100",fill:Ds()}),g("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:Ds(),strokeWidth:"2"}),P("g",{fill:LF(e),stroke:Ds(),strokeWidth:"6",children:[g("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),g("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),g("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),g("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),g("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),g("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),cne=W(g("g",{strokeWidth:1.25,children:g("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),Ne),une=W(P(he,{children:[g("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),g("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:g("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"})}),g("g",{mask:"url(#FillHachureIcon)",children:g("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Ne),dne=W(P(he,{children:[P("g",{clipPath:"url(#a)",children:[g("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),g("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:g("path",{d:"M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),g("g",{mask:"url(#FillCrossHatchIcon)",children:g("path",{d:"M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z",fill:"currentColor"})})]}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),fne=W(P(he,{children:[g("g",{clipPath:"url(#a)",children:g("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z",stroke:"currentColor",strokeWidth:"1.25"})}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...Ne,fill:"currentColor"}),HF=W(g(he,{children:g("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),Ne),hne=W(g("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),Ne),gne=W(g("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),Ne);se.memo(({theme:e})=>W(g("path",{d:"M6 10H34",stroke:Ds(),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20}));const mne=W(P("g",{strokeWidth:"2",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M5 12h2"}),g("path",{d:"M17 12h2"}),g("path",{d:"M11 12h2"})]}),ce),pne=W(P("g",{strokeWidth:"2",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 12v.01"}),g("path",{d:"M8 12v.01"}),g("path",{d:"M12 12v.01"}),g("path",{d:"M16 12v.01"}),g("path",{d:"M20 12v.01"})]}),ce),Une=W(g("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),Ne),bne=W(g("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),Ne),yne=W(g("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),Ne),Ene=W(P("svg",{strokeWidth:"1.5",children:[g("path",{d:"M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10"}),g("path",{d:"M13.3333 3.33331V3.34331"}),g("path",{d:"M16.6667 3.33331V3.34331"}),g("path",{d:"M16.6667 6.66669V6.67669"}),g("path",{d:"M16.6667 10V10.01"}),g("path",{d:"M3.33334 13.3333V13.3433"}),g("path",{d:"M16.6667 13.3333V13.3433"}),g("path",{d:"M3.33334 16.6667V16.6767"}),g("path",{d:"M6.66666 16.6667V16.6767"}),g("path",{d:"M10 16.6667V16.6767"}),g("path",{d:"M13.3333 16.6667V16.6767"}),g("path",{d:"M16.6667 16.6667V16.6767"})]}),Ne),vne=W(P("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),g("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),g("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),g("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),g("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),g("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),g("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),g("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),g("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),g("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),g("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),g("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),ce),_ne=W(P("g",{stroke:"currentColor",opacity:.3,strokeWidth:2,children:[g("path",{d:"M12 12l9 0"}),g("path",{d:"M3 9l6 6"}),g("path",{d:"M3 15l6 -6"})]}),ce),sE=se.memo(({flip:e=!1})=>W(P("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",children:[g("path",{d:"M34 10H6M34 10L27 5M34 10L27 15"}),g("path",{d:"M27.5 5L34.5 10L27.5 15"})]}),{width:40,height:20})),wne=se.memo(({flip:e=!1})=>W(P("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[g("path",{d:"M32 10L6 10",strokeWidth:2}),g("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),Tne=se.memo(({flip:e=!1})=>W(P("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[g("path",{d:"M26 10L6 10"}),g("circle",{r:"4",transform:"matrix(-1 0 0 1 30 10)"})]}),{width:40,height:20})),Sne=se.memo(({flip:e=!1})=>W(g("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",children:g("path",{d:"M34 10H5.99996M34 10L34 5M34 10L34 15",stroke:"currentColor",strokeWidth:2,fill:"none"})}),{width:40,height:20})),Ine=se.memo(({flip:e=!1})=>W(P("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[g("path",{d:"M32 10L6 10",strokeWidth:2}),g("path",{d:"M27.5 5.5L34.5 10L27.5 14.5L27.5 5.5"})]}),{width:40,height:20})),xne=se.memo(({flip:e=!1})=>W(P("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",children:[g("path",{d:"M6,9.5H27"}),g("path",{d:"M27,5L34,10L27,14Z",fill:"none"})]}),{width:40,height:20})),Cne=se.memo(({flip:e=!1})=>W(P("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[g("path",{d:"M6,9.5H20"}),g("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),Ane=se.memo(({flip:e=!1})=>W(P("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,children:[g("path",{d:"M6,9.5H20"}),g("path",{d:"M27,5L34,10L27,14L20,9.5Z"})]}),{width:40,height:20})),Mne=se.memo(({flip:e=!1})=>W(g("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:g("path",{d:"M34,10 H6 M15,10 L7,5 M15,10 L7,15"})}),{width:40,height:20})),Rne=se.memo(({flip:e=!1})=>W(g("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:g("path",{d:"M34,10 H6 M15,10 L15,15 L15,5"})}),{width:40,height:20})),kne=se.memo(({flip:e=!1})=>W(g("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:g("path",{d:"M34,10 H6 M15,10 L15,16 L15,4 M15,10 L7,5 M15,10 L7,15"})}),{width:40,height:20})),Lne=W(P(he,{children:[g("g",{clipPath:"url(#a)",children:g("path",{d:"M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Dne=W(P(he,{children:[g("g",{clipPath:"url(#a)",children:g("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Nne=W(P(he,{children:[g("g",{clipPath:"url(#a)",children:g("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),One=W(g(he,{children:g("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),Ne),K6=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 7v-2h13v2"}),g("path",{d:"M10 5v14"}),g("path",{d:"M12 19h-4"}),g("path",{d:"M15 13v-1h6v1"}),g("path",{d:"M18 12v7"}),g("path",{d:"M17 19h2"})]}),ce),Pne=W(g(he,{children:P("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M7 12h10"}),g("path",{d:"M7 5v14"}),g("path",{d:"M17 5v14"}),g("path",{d:"M15 19h4"}),g("path",{d:"M15 5h4"}),g("path",{d:"M5 19h4"}),g("path",{d:"M5 5h4"})]})}),ce),lu=W(g(he,{children:g("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:g("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),Ne),uf=W(P(he,{children:[g("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:g("path",{d:"M5.833 6.667 2.5 10l3.333 3.333M14.167 6.667 17.5 10l-3.333 3.333M11.667 3.333 8.333 16.667"})}),g("defs",{children:g("clipPath",{id:"a",children:g("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),Ne),Fne=W(P("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),g("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),g("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),ce),Bne=W(P("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),g("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),g("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),ce),zne=W(P("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),g("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),g("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),ce),Hne=se.memo(({theme:e})=>W(P("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),g("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),ce)),Vne=se.memo(({theme:e})=>W(P("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),g("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),ce)),$ne=se.memo(({theme:e})=>W(P("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),g("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),g("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),ce)),VF=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M21 19h-18l9 -15"}),g("path",{d:"M20.615 15.171h.015"}),g("path",{d:"M19.515 11.771h.015"}),g("path",{d:"M17.715 8.671h.015"}),g("path",{d:"M15.415 5.971h.015"})]}),ce),Gne=W(g("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"currentColor"}),{width:640,height:512});W(g("path",{d:"M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z"}));const $F=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),g("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),g("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),g("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"})]}),ce),zx=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),g("path",{d:"M7 11l5 5l5 -5"}),g("path",{d:"M12 4l0 12"})]}),ce),$m=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"}),g("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"})]}),ce),Xne=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),g("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),g("path",{d:"M9.15 14.85l8.85 -10.85"}),g("path",{d:"M6 4l8.85 10.85"})]}),ce),jne=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),g("path",{d:"M12 17l0 .01"}),g("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),ce),Yne=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M7 4v16l13 -8z"})]}),ce),Wne=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",strokeWidth:"0",fill:"currentColor"})]}),ce),Kne=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M5 12l5 5l10 -10"})]}),ce),Zne=W(P(he,{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"}),g("path",{d:"M12 9v4"}),g("path",{d:"M12 17h.01"})]}),ce),qne=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M11 7l6 6"}),g("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]}),ce),Qne=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M12 3l-4 7h8z"}),g("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),g("path",{d:"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"})]}),ce),GF=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 7l16 0"}),g("path",{d:"M4 17l16 0"}),g("path",{d:"M7 4l0 16"}),g("path",{d:"M17 4l0 16"})]}),ce),XF=W(g("path",{fill:"currentColor",d:"M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z"})),KU=W(P("g",{strokeWidth:"1.25",children:[g("path",{d:"M4.16602 10H15.8327"}),g("path",{d:"M12.5 13.3333L15.8333 10"}),g("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),Ne),jF=W(P("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[g("path",{clipRule:"evenodd",d:"m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"}),g("path",{d:"m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"})]}),20),YF=W(P("g",{stroke:"currentColor",fill:"none",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z"}),g("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),g("path",{d:"M15 6l3 3"}),g("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),g("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),ce);W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z"}),g("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),g("path",{d:"M15 6l3 3"}),g("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),g("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),ce);W(P("g",{stroke:"currentColor",fill:"none",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),g("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),g("path",{d:"M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348"}),g("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),g("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),g("path",{d:"M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42"})]}),ce);const Jne=W(P("g",{stroke:"currentColor",fill:"none",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),g("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),g("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),g("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),ce),v9=W(P("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),g("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"})]}),ce),eie=W(P("g",{stroke:"currentColor",fill:"none",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),g("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"}),g("path",{d:"M3 3l18 18"})]}),ce),tie=W(P("g",{stroke:"currentColor",fill:"none",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),g("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),g("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),g("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),g("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),g("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),ce),nie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),g("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),g("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),g("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),g("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),g("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),ce),Zu=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),g("path",{d:"M21 21l-6 -6"})]}),ce),iie=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),g("path",{d:"M12 7v5l3 3"}),g("path",{d:"M19 16l-2 3h4l-2 3"})]}),ce),rie=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"}),g("path",{d:"M5 10a7 7 0 0 0 14 0"}),g("path",{d:"M8 21l8 0"}),g("path",{d:"M12 17l0 4"})]}),ce),sie=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 3l18 18"}),g("path",{d:"M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"}),g("path",{d:"M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"}),g("path",{d:"M8 21l8 0"}),g("path",{d:"M12 17l0 4"})]}),ce),WF=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),ce),oie=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"}),g("path",{d:"M12 20v.01"}),g("path",{d:"M16 20v.01"}),g("path",{d:"M8 20v.01"}),g("path",{d:"M4 20v.01"}),g("path",{d:"M4 16v.01"}),g("path",{d:"M4 12v.01"}),g("path",{d:"M4 8v.01"}),g("path",{d:"M4 4v.01"}),g("path",{d:"M8 4v.01"}),g("path",{d:"M12 4v.01"}),g("path",{d:"M16 4v.01"}),g("path",{d:"M20 4v.01"}),g("path",{d:"M20 8v.01"}),g("path",{d:"M20 12v.01"}),g("path",{d:"M20 16v.01"}),g("path",{d:"M20 20v.01"})]}),ce),aie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M5 3v18"}),g("path",{d:"M19 21v-18"}),g("path",{d:"M5 7h14"}),g("path",{d:"M5 15h14"}),g("path",{d:"M8 13v4"}),g("path",{d:"M11 13v4"}),g("path",{d:"M16 13v4"}),g("path",{d:"M14 5v4"}),g("path",{d:"M11 5v4"}),g("path",{d:"M8 5v4"}),g("path",{d:"M3 21h18"})]}),ce),lie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 12l18 0"}),g("path",{d:"M7 16l10 0l-10 5l0 -5"}),g("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),ce),cie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M12 3l0 18"}),g("path",{d:"M16 7l0 10l5 0l-5 -10"}),g("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),ce),KF=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"}),g("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),g("path",{d:"M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]}),ce),_9=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),g("path",{d:"M22 22l-3 -3"}),g("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),g("path",{d:"M3 11v-1"}),g("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),g("path",{d:"M10 3h1"}),g("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),ce),uie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),g("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),g("path",{d:"M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"}),g("path",{d:"M10 15l2 6l2 -6"}),g("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),ce),die=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),g("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),g("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),g("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),g("path",{d:"M11 21v-6l3 6v-6"})]}),ce),fie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0"}),g("path",{d:"M4 8l5 0"}),g("path",{d:"M15 8l4 0"})]}),ce),hie=W(P("g",{strokeWidth:1.25,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1"}),g("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),g("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),g("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),g("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),ce),gie=W(P("g",{stroke:"currentColor",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4"})]}),{...ce,strokeWidth:1.5}),ZF=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"}),g("path",{d:"M21 12h-13l3 -3"}),g("path",{d:"M11 15l-3 -3"})]}),ce),qF=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"}),g("path",{d:"M10 9l5 3l-5 3z"})]}),ce),mie=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M3 6h18"}),g("path",{d:"M3 12h18"}),g("path",{d:"M3 18h18"}),g("path",{d:"M6 3v18"}),g("path",{d:"M12 3v18"}),g("path",{d:"M18 3v18"})]}),ce),pie=W(P("g",{strokeWidth:1.5,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),g("path",{d:"M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),g("path",{d:"M17 5c-6.627 0 -12 5.373 -12 12"})]}),ce),Uie=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M6 18l12 -12"}),g("path",{d:"M18 10v-4h-4"})]}),ce),bie=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7"}),g("path",{d:"M18 4l3 3l-3 3"})]}),ce),yie=W(P("g",{children:[g("path",{d:"M16,12L20,9L16,6"}),g("path",{d:"M6 20c0 -6.075 4.925 -11 11 -11h3"})]}),ce),QF=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M6 9l6 6l6 -6"})]}),ce),Eie=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M6 15l6 -6l6 6"})]}),ce),vie=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M6 15l6 -6l6 6"})]}),ce),Hx=W(P("g",{strokeWidth:"1.25",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),g("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]}),ce),JF=W(P("g",{children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),g("path",{d:"M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),g("path",{d:"M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),g("path",{d:"M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),g("path",{d:"M5 7l0 10"}),g("path",{d:"M7 5l10 0"}),g("path",{d:"M7 19l10 0"}),g("path",{d:"M19 7l0 10"})]}),ce),hb={[At.Excalifont]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},icon:B0},[At.Nunito]:{metrics:{unitsPerEm:1e3,ascender:1011,descender:-353,lineHeight:1.35},icon:lu},[At["Lilita One"]]:{metrics:{unitsPerEm:1e3,ascender:923,descender:-220,lineHeight:1.15},icon:Pne},[At["Comic Shanns"]]:{metrics:{unitsPerEm:1e3,ascender:750,descender:-250,lineHeight:1.25},icon:uf},[At.Virgil]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},icon:B0,deprecated:!0},[At.Helvetica]:{metrics:{unitsPerEm:2048,ascender:1577,descender:-471,lineHeight:1.15},icon:lu,deprecated:!0,local:!0},[At.Cascadia]:{metrics:{unitsPerEm:2048,ascender:1900,descender:-480,lineHeight:1.2},icon:uf,deprecated:!0},[At["Roboto Mono"]]:{metrics:{unitsPerEm:2048,ascender:1900,descender:-500,lineHeight:1.2},icon:uf},[At["JetBrains Mono"]]:{metrics:{unitsPerEm:1e3,ascender:1020,descender:-300,lineHeight:1.35},icon:uf},[At["Liberation Sans"]]:{metrics:{unitsPerEm:2048,ascender:1854,descender:-434,lineHeight:1.15},icon:lu},[At["Liberation Mono"]]:{metrics:{unitsPerEm:2048,ascender:1705,descender:-615,lineHeight:1.15},icon:uf},[At["Liberation Serif"]]:{metrics:{unitsPerEm:2048,ascender:1825,descender:-443,lineHeight:1.15},icon:lu},[At["Adwaita Sans"]]:{metrics:{unitsPerEm:2048,ascender:1984,descender:-494,lineHeight:1.25},icon:lu},[Af.Xiaolai]:{metrics:{unitsPerEm:1e3,ascender:880,descender:-144,lineHeight:1.15},fallback:!0},[Af["Segoe UI Emoji"]]:{metrics:{unitsPerEm:1e3,ascender:886,descender:-374,lineHeight:1.25},local:!0,fallback:!0}},cu={LATIN:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD",LATIN_EXT:"U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",CYRILIC_EXT:"U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",CYRILIC:"U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",VIETNAMESE:"U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB"},w9="local:";class _ie{constructor(t){F(this,"instance");F(this,"debounceTerminate");this.instance=new Worker(t,{type:"module"})}}class T9{constructor(t,n){F(this,"idleWorkers",new Set);F(this,"workerUrl");F(this,"workerTTL");this.workerUrl=t,this.workerTTL=n.ttl||1e3}static create(t,n={}){if(!t)throw new UF;if(!import.meta.url||t.toString()===import.meta.url)throw new bF;return new T9(t,n)}async postMessage(t,n){let i;const r=Array.from(this.idleWorkers).shift();return r?(this.idleWorkers.delete(r),i=r):i=await this.createWorker(),new Promise((s,o)=>{i.instance.onmessage=this.onMessageHandler(i,s),i.instance.onerror=this.onErrorHandler(i,o),i.instance.postMessage(t,n),i.debounceTerminate(()=>o(new Error(`Active worker did not respond for ${this.workerTTL}ms!`)))})}async clear(){for(const t of this.idleWorkers)t.debounceTerminate.cancel(),t.instance.terminate();this.idleWorkers.clear()}async createWorker(){const t=new _ie(this.workerUrl);return t.debounceTerminate=Ga(n=>{t.instance.terminate(),this.idleWorkers.has(t)?(this.idleWorkers.delete(t),console.debug("Job finished! Idle worker has been released from the pool.")):n?n():console.error("Worker has been terminated!")},this.workerTTL),t}onMessageHandler(t,n){return i=>{t.debounceTerminate(),this.idleWorkers.add(t),n(i.data)}}onErrorHandler(t,n){return i=>{t.debounceTerminate(()=>n(i)),t.debounceTerminate.flush(),this.clear()}}}let Vx=typeof Worker<"u";const wie=async(e,t)=>{const{Commands:n,subsetToBase64:i,toBase64:r}=await Sie();return Vx?Uc(async()=>{try{const s=await Iie(),o=e.slice(0),a=await s.postMessage({command:n.Subset,arrayBuffer:o,codePoints:t},{transfer:[o]});return r(a)}catch(s){return Vx=!1,Cee()&&(s instanceof UF||s instanceof bF)||console.error("Failed to use workers for subsetting, falling back to the main thread.",s),i(e,t)}}):i(e,t)};let y8=null,E8=null;const Tie=async()=>(y8||(y8=be(()=>import("./subset-worker.chunk-I0N5k6B_.js"),__vite__mapDeps([0,1]))),y8),Sie=async()=>(E8||(E8=be(()=>import("./subset-shared.chunk-D4cgYcOB.js"),__vite__mapDeps([]))),E8);let v8=null;const Iie=()=>(v8||(v8=Uc(async()=>{const{WorkerUrl:e}=await Tie();return T9.create(e)})),v8);var _8={};const Ff=class Ff{constructor(t,n,i){F(this,"urls");F(this,"fontFace");this.urls=Ff.createUrls(n);const r=this.urls.map(s=>`url(${s}) ${Ff.getFormat(s)}`).join(", ");this.fontFace=new FontFace(t,r,{display:"swap",style:"normal",weight:"400",...i})}toCSS(t){if(!this.getUnicodeRangeRegex().test(t))return;const n=Array.from(t).map(i=>i.codePointAt(0));return this.getContent(n).then(i=>`@font-face { font-family: ${this.fontFace.family}; src: url(${i}); }`)}async getContent(t){let n=0;const i=[];for(;n<this.urls.length;){const r=this.urls[n];try{const s=await this.fetchFont(r);return await wie(s,t)}catch(s){i.push(`"${r.toString()}" returned error "${s}"`)}n++}return console.error(`Failed to fetch font family "${this.fontFace.family}"`,JSON.stringify(i,void 0,2)),this.urls.length?this.urls[this.urls.length-1].toString():""}fetchFont(t){return Uc(async()=>{const n=await fetch(t,{cache:"force-cache",headers:{Accept:"font/woff2"}});if(!n.ok){const r=t instanceof URL?t.toString():"dataurl";throw new Error(`Failed to fetch "${r}": ${n.statusText}`)}return await n.arrayBuffer()})}getUnicodeRangeRegex(){const t=this.fontFace.unicodeRange.split(/,\s*/).map(n=>{const[i,r]=n.replace("U+","").split("-");return r?`\\u{${i}}-\\u{${r}}`:`\\u{${i}}`}).join("");return new RegExp(`[${t}]`,"u")}static createUrls(t){if(t.startsWith("data"))return[t];if(t.startsWith(w9))return[];if(t.startsWith("http"))return[new URL(t)];const n=t.replace(/^\/+/,""),i=[];if(typeof window.EXCALIDRAW_ASSET_PATH=="string"){const r=this.normalizeBaseUrl(window.EXCALIDRAW_ASSET_PATH);i.push(new URL(n,r))}else Array.isArray(window.EXCALIDRAW_ASSET_PATH)&&window.EXCALIDRAW_ASSET_PATH.forEach(r=>{const s=this.normalizeBaseUrl(r);i.push(new URL(n,s))});return i.push(new URL(n,Ff.ASSETS_FALLBACK_URL)),i}static getFormat(t){if(!(t instanceof URL))return"";try{const n=new URL(t).pathname.split(".");return n.length===1?"":`format('${n.pop()}')`}catch{return""}}static normalizeBaseUrl(t){var i;let n=t;return/^\.?\//.test(n)&&(n=new URL(n.replace(/^\.?\/+/,""),(i=window==null?void 0:window.location)==null?void 0:i.origin).toString()),n=`${n.replace(/\/+$/,"")}/`,n}};F(Ff,"ASSETS_FALLBACK_URL",`https://esm.sh/${_8.PKG_NAME?`${_8.PKG_NAME}@${_8.PKG_VERSION}`:"@excalidraw/excalidraw"}/dist/prod/`);let oE=Ff;const xie="/fonts/CascadiaCode/CascadiaCode-Regular.woff2",Cie=[{uri:xie}],Aie="/fonts/ComicShanns/ComicShanns-Regular-279a7b317d12eb88de06167bd672b4b4.woff2",Mie="/fonts/ComicShanns/ComicShanns-Regular-fcb0fc02dcbee4c9846b3e2508668039.woff2",Rie="/fonts/ComicShanns/ComicShanns-Regular-dc6a8806fa96795d7b3be5026f989a17.woff2",kie="/fonts/ComicShanns/ComicShanns-Regular-6e066e8de2ac57ea9283adb9c24d7f0c.woff2",Lie=[{uri:Aie,descriptors:{unicodeRange:"U+20-7e,U+a1-a6,U+a8,U+ab-ac,U+af-b1,U+b4,U+b8,U+bb-bc,U+bf-cf,U+d1-d7,U+d9-de,U+e0-ef,U+f1-f7,U+f9-ff,U+131,U+152-153,U+2c6,U+2da,U+2dc,U+2013-2014,U+2018-201a,U+201c-201d,U+2020-2022,U+2026,U+2039-203a,U+2044,U+20ac,U+2191,U+2193,U+2212"}},{uri:Mie,descriptors:{unicodeRange:"U+100-10f,U+112-125,U+128-130,U+134-137,U+139-13c,U+141-148,U+14c-151,U+154-161,U+164-165,U+168-17f,U+1bf,U+1f7,U+218-21b,U+237,U+1e80-1e85,U+1ef2-1ef3,U+a75b"}},{uri:Rie,descriptors:{unicodeRange:"U+2c7,U+2d8-2d9,U+2db,U+2dd,U+315,U+2190,U+2192,U+2200,U+2203-2204,U+2264-2265,U+f6c3"}},{uri:kie,descriptors:{unicodeRange:"U+3bb"}}],Die=[{uri:w9}],Nie="/fonts/Excalifont/Excalifont-Regular-a88b72a24fb54c9f94e3b5fdaa7481c9.woff2",Oie="/fonts/Excalifont/Excalifont-Regular-be310b9bcd4f1a43f571c46df7809174.woff2",Pie="/fonts/Excalifont/Excalifont-Regular-b9dcf9d2e50a1eaf42fc664b50a3fd0d.woff2",Fie="/fonts/Excalifont/Excalifont-Regular-41b173a47b57366892116a575a43e2b6.woff2",Bie="/fonts/Excalifont/Excalifont-Regular-3f2c5db56cc93c5a6873b1361d730c16.woff2",zie="/fonts/Excalifont/Excalifont-Regular-349fac6ca4700ffec595a7150a0d1e1d.woff2",Hie="/fonts/Excalifont/Excalifont-Regular-623ccf21b21ef6b3a0d87738f77eb071.woff2",Vie=[{uri:Nie,descriptors:{unicodeRange:"U+20-7e,U+a0-a3,U+a5-a6,U+a8-ab,U+ad-b1,U+b4,U+b6-b8,U+ba-ff,U+131,U+152-153,U+2bc,U+2c6,U+2da,U+2dc,U+304,U+308,U+2013-2014,U+2018-201a,U+201c-201e,U+2020,U+2022,U+2024-2026,U+2030,U+2039-203a,U+20ac,U+2122,U+2212"}},{uri:Oie,descriptors:{unicodeRange:"U+100-130,U+132-137,U+139-149,U+14c-151,U+154-17e,U+192,U+1fc-1ff,U+218-21b,U+237,U+1e80-1e85,U+1ef2-1ef3,U+2113"}},{uri:Pie,descriptors:{unicodeRange:"U+400-45f,U+490-491,U+2116"}},{uri:Fie,descriptors:{unicodeRange:"U+37e,U+384-38a,U+38c,U+38e-393,U+395-3a1,U+3a3-3a8,U+3aa-3cf,U+3d7"}},{uri:Bie,descriptors:{unicodeRange:"U+2c7,U+2d8-2d9,U+2db,U+2dd,U+302,U+306-307,U+30a-30c,U+326-328,U+212e,U+2211,U+fb01-fb02"}},{uri:zie,descriptors:{unicodeRange:"U+462-463,U+472-475,U+4d8-4d9,U+4e2-4e3,U+4e6-4e9,U+4ee-4ef"}},{uri:Hie,descriptors:{unicodeRange:"U+300-301,U+303"}}],$ie=[{uri:w9}],Gie="/fonts/JetBrainsMono/JetBrainsMono-Regular.woff2",Xie=[{uri:Gie}],jie="/fonts/LiberationSans/LiberationSans-Regular.woff2",Yie=[{uri:jie}],Wie="/fonts/LiberationMono/LiberationMono-Regular.woff2",Kie=[{uri:Wie}],Zie="/fonts/LiberationSerif/LiberationSerif-Regular.woff2",qie=[{uri:Zie}],Qie="/fonts/Lilita/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2",Jie="/fonts/Lilita/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2",ere=[{uri:Jie,descriptors:{unicodeRange:cu.LATIN_EXT}},{uri:Qie,descriptors:{unicodeRange:cu.LATIN}}],tre="/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2",nre="/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2",ire="/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2",rre="/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2",sre="/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2",ore=[{uri:rre,descriptors:{unicodeRange:cu.CYRILIC_EXT,weight:"500"}},{uri:ire,descriptors:{unicodeRange:cu.CYRILIC,weight:"500"}},{uri:sre,descriptors:{unicodeRange:cu.VIETNAMESE,weight:"500"}},{uri:nre,descriptors:{unicodeRange:cu.LATIN_EXT,weight:"500"}},{uri:tre,descriptors:{unicodeRange:cu.LATIN,weight:"500"}}],are="/fonts/RobotoMono/RobotoMono-Regular.woff2",lre=[{uri:are}],cre="/fonts/AdwaitaSans/AdwaitaSans-Regular.woff2",ure=[{uri:cre}],dre="/fonts/Virgil/Virgil-Regular.woff2",fre=[{uri:dre}],hre="/fonts/Xiaolai/Xiaolai-Regular-09850c4077f3fffe707905872e0e2460.woff2",gre="/fonts/Xiaolai/Xiaolai-Regular-7eb9fffd1aa890d07d0f88cc82e6cfe4.woff2",mre="/fonts/Xiaolai/Xiaolai-Regular-60a3089806700d379f11827ee9843b6b.woff2",pre="/fonts/Xiaolai/Xiaolai-Regular-6fe5c5973cc06f74b2387a631ea36b88.woff2",Ure="/fonts/Xiaolai/Xiaolai-Regular-b96d9226ce77ec94ceca043d712182e6.woff2",bre="/fonts/Xiaolai/Xiaolai-Regular-6ae5b42180ad70b971c91e7eefb8eba2.woff2",yre="/fonts/Xiaolai/Xiaolai-Regular-a4c34be6d42152e64b0df90bc4607f64.woff2",Ere="/fonts/Xiaolai/Xiaolai-Regular-c69f61a4ab18d0488c8d1fc12e7028e8.woff2",vre="/fonts/Xiaolai/Xiaolai-Regular-e3fcf5180fd466c8915c4e8069491054.woff2",_re="/fonts/Xiaolai/Xiaolai-Regular-c1f94158256bb1f3bf665b053d895af9.woff2",wre="/fonts/Xiaolai/Xiaolai-Regular-544fc28abe2c5c30e62383fd4dac255f.woff2",Tre="/fonts/Xiaolai/Xiaolai-Regular-7197d6fda6cba7c3874c53d6381ca239.woff2",Sre="/fonts/Xiaolai/Xiaolai-Regular-70c2eb8d64e71a42a834eb857ea9df51.woff2",Ire="/fonts/Xiaolai/Xiaolai-Regular-069e77aac84590e2e991d0a0176d34f2.woff2",xre="/fonts/Xiaolai/Xiaolai-Regular-41521fade99856108931b4768b1b2648.woff2",Cre="/fonts/Xiaolai/Xiaolai-Regular-a004ddfcb26e67bd6e678c8ed19e25ce.woff2",Are="/fonts/Xiaolai/Xiaolai-Regular-04b718e5623574919c8b0dea5f301444.woff2",Mre="/fonts/Xiaolai/Xiaolai-Regular-7e4bde7e9c7f84cd34d8a845e384c746.woff2",Rre="/fonts/Xiaolai/Xiaolai-Regular-23686f7f29da6e8008c36dd3a80c83d6.woff2",kre="/fonts/Xiaolai/Xiaolai-Regular-69c09cc5fa3e55c74fc4821f76909cc3.woff2",Lre="/fonts/Xiaolai/Xiaolai-Regular-25b7f38e18f035f96cb5e547bd2bd08c.woff2",Dre="/fonts/Xiaolai/Xiaolai-Regular-ba3de316d63c7e339987b16f41a0b879.woff2",Nre="/fonts/Xiaolai/Xiaolai-Regular-12b52b58eb3df36804b9a654ec9ee194.woff2",Ore="/fonts/Xiaolai/Xiaolai-Regular-b1220a3c61f85cc0408deedb4c5f57a2.woff2",Pre="/fonts/Xiaolai/Xiaolai-Regular-4535823663ad81405188a528d8f2b1a2.woff2",Fre="/fonts/Xiaolai/Xiaolai-Regular-3eaa538115d76932653c21d8dc28f207.woff2",Bre="/fonts/Xiaolai/Xiaolai-Regular-7e929f262f30c8ee78bf398150b1a7cd.woff2",zre="/fonts/Xiaolai/Xiaolai-Regular-73e309718fd16cea44b4d54a33581811.woff2",Hre="/fonts/Xiaolai/Xiaolai-Regular-9eb5a99df4e76ac3363453ac9ca288b1.woff2",Vre="/fonts/Xiaolai/Xiaolai-Regular-3e63ed8162808a9e425ed80a8bc79114.woff2",$re="/fonts/Xiaolai/Xiaolai-Regular-cb17fc3db95f6d139afc9d31a8e93293.woff2",Gre="/fonts/Xiaolai/Xiaolai-Regular-c8b71798409ccc126ee264a00aadcf21.woff2",Xre="/fonts/Xiaolai/Xiaolai-Regular-11c345711937f0ba4b8f7b6b919c8440.woff2",jre="/fonts/Xiaolai/Xiaolai-Regular-e480d9c614742d05f0e78f274f1e69e6.woff2",Yre="/fonts/Xiaolai/Xiaolai-Regular-95429962233afd82db1c27df1500a28c.woff2",Wre="/fonts/Xiaolai/Xiaolai-Regular-2cf96d082d35ea3d8106851223ad0d16.woff2",Kre="/fonts/Xiaolai/Xiaolai-Regular-2d43040e86ff03ba677f6f9c04cd0805.woff2",Zre="/fonts/Xiaolai/Xiaolai-Regular-2a26d20a23b00898ce82f09d2ee47c3f.woff2",qre="/fonts/Xiaolai/Xiaolai-Regular-a365e82ed54697a52f27adcea1315fe8.woff2",Qre="/fonts/Xiaolai/Xiaolai-Regular-f5d079153c99a25b9be5b8583c4cc8a7.woff2",Jre="/fonts/Xiaolai/Xiaolai-Regular-10a7ae9a371830a80c3d844acf1c02d7.woff2",ese="/fonts/Xiaolai/Xiaolai-Regular-e4bca6cfa53e499cae0a6be4894a90e9.woff2",tse="/fonts/Xiaolai/Xiaolai-Regular-60a41c7e1c68f22424e6d22df544bc82.woff2",nse="/fonts/Xiaolai/Xiaolai-Regular-7ab2bed91166a9dca83a5ebfbe2a7f38.woff2",ise="/fonts/Xiaolai/Xiaolai-Regular-670ba603758d94268e8606f240a42e12.woff2",rse="/fonts/Xiaolai/Xiaolai-Regular-e656f091b9dc4709722c9f4b84d3c797.woff2",sse="/fonts/Xiaolai/Xiaolai-Regular-15dc6d811c9cd078f9086a740d5a1038.woff2",ose="/fonts/Xiaolai/Xiaolai-Regular-f0f13b5c60e0af5553bd359f5513be1b.woff2",ase="/fonts/Xiaolai/Xiaolai-Regular-8c2f33cee3993174f7e87c28e4bf42ee.woff2",lse="/fonts/Xiaolai/Xiaolai-Regular-761d05e3cd968cf574166867998ef06a.woff2",cse="/fonts/Xiaolai/Xiaolai-Regular-642b26e2e5f5fb780b51b593dbc8c851.woff2",use="/fonts/Xiaolai/Xiaolai-Regular-5572b3513ba8df57a3d5d7303ee6b11b.woff2",dse="/fonts/Xiaolai/Xiaolai-Regular-3c9de2ae0ea4bc91a510942dfa4be8d2.woff2",fse="/fonts/Xiaolai/Xiaolai-Regular-671a2c20b1eb9e4ef8a192833940e319.woff2",hse="/fonts/Xiaolai/Xiaolai-Regular-4dc6d5f188d5c96d44815cd1e81aa885.woff2",gse="/fonts/Xiaolai/Xiaolai-Regular-ce4884f96f11589608b76b726a755803.woff2",mse="/fonts/Xiaolai/Xiaolai-Regular-8f476c4c99813d57cbe6eca4727388ad.woff2",pse="/fonts/Xiaolai/Xiaolai-Regular-5935a5775af3d5c6307ac667bd9ae74e.woff2",Use="/fonts/Xiaolai/Xiaolai-Regular-79f007c1c6d07557120982951ea67998.woff2",bse="/fonts/Xiaolai/Xiaolai-Regular-bafff7a14c27403dcc6cf1432e8ea836.woff2",yse="/fonts/Xiaolai/Xiaolai-Regular-543fa46ace099a7099dad69123399400.woff2",Ese="/fonts/Xiaolai/Xiaolai-Regular-4ddc14ed3eb0c3e46364317dfc0144a3.woff2",vse="/fonts/Xiaolai/Xiaolai-Regular-0fa55a080fcd0f9dc2e0b0058b793df8.woff2",_se="/fonts/Xiaolai/Xiaolai-Regular-66493ba5a8367f2928812f446f47b56a.woff2",wse="/fonts/Xiaolai/Xiaolai-Regular-57862b464a55b18c7bf234ce22907d73.woff2",Tse="/fonts/Xiaolai/Xiaolai-Regular-8d3bcabb847b56243b16afe62adaaf21.woff2",Sse="/fonts/Xiaolai/Xiaolai-Regular-2b77e8ebfb2367ab2662396a60e7d320.woff2",Ise="/fonts/Xiaolai/Xiaolai-Regular-0b5d723fdc4e249c140f0909e87d03b4.woff2",xse="/fonts/Xiaolai/Xiaolai-Regular-cdbce89e82cc1ab53a2decbf5819278f.woff2",Cse="/fonts/Xiaolai/Xiaolai-Regular-739bc1a567439c7cffcd1614644593d2.woff2",Ase="/fonts/Xiaolai/Xiaolai-Regular-72252d73220fa3cd856677888cee1635.woff2",Mse="/fonts/Xiaolai/Xiaolai-Regular-08e0dc436ad0ad61ba5558db0674d762.woff2",Rse="/fonts/Xiaolai/Xiaolai-Regular-cf6ff4e0f491ca0cf3038187a997b9b4.woff2",kse="/fonts/Xiaolai/Xiaolai-Regular-9cfb2a77a4e45025105ad29a1748b90d.woff2",Lse="/fonts/Xiaolai/Xiaolai-Regular-450da755d5bcb70906e1295e559b9602.woff2",Dse="/fonts/Xiaolai/Xiaolai-Regular-0986d134c05864f5025962eef9f994a0.woff2",Nse="/fonts/Xiaolai/Xiaolai-Regular-1ee544f0f1dac422545c505baa788992.woff2",Ose="/fonts/Xiaolai/Xiaolai-Regular-4806e761d750087c2d734fc64596eaff.woff2",Pse="/fonts/Xiaolai/Xiaolai-Regular-33432927cd87d40cfe393c7482bf221f.woff2",Fse="/fonts/Xiaolai/Xiaolai-Regular-be549ab72f0719d606a5c01e2c0219b6.woff2",Bse="/fonts/Xiaolai/Xiaolai-Regular-019d66dcad46dc156b162d267f981c20.woff2",zse="/fonts/Xiaolai/Xiaolai-Regular-b5c1596551c256e0e9cf02028595b092.woff2",Hse="/fonts/Xiaolai/Xiaolai-Regular-e5f453bb04da18eed01675eeebd88bf8.woff2",Vse="/fonts/Xiaolai/Xiaolai-Regular-cf2cc71752631e579e35b0e423bf2638.woff2",$se="/fonts/Xiaolai/Xiaolai-Regular-6f3256af8454371776bc46670d33cc65.woff2",Gse="/fonts/Xiaolai/Xiaolai-Regular-23f228f3999c01983860012330e4be08.woff2",Xse="/fonts/Xiaolai/Xiaolai-Regular-21430ee05a1248901da8d0de08744d47.woff2",jse="/fonts/Xiaolai/Xiaolai-Regular-5330a2119a716e4e7224ed108b085dac.woff2",Yse="/fonts/Xiaolai/Xiaolai-Regular-cd145ce4a0ea18469358df53c207bc1b.woff2",Wse="/fonts/Xiaolai/Xiaolai-Regular-36925dfe329a45086cbb7fc5c20d45ac.woff2",Kse="/fonts/Xiaolai/Xiaolai-Regular-4bfaa8ffa64c5ee560aa2daba7c9cbd3.woff2",Zse="/fonts/Xiaolai/Xiaolai-Regular-112c051027b2d766c19a519f6ee1f4f7.woff2",qse="/fonts/Xiaolai/Xiaolai-Regular-5b0ed6971aaab9c8ad563230bd5471a7.woff2",Qse="/fonts/Xiaolai/Xiaolai-Regular-98f2ad84457de7f3740d9920b8fa8667.woff2",Jse="/fonts/Xiaolai/Xiaolai-Regular-733171b4ffcd17ea1fe1c0ba627173bf.woff2",eoe="/fonts/Xiaolai/Xiaolai-Regular-684d65f1793cac449dde5d59cb3c47fb.woff2",toe="/fonts/Xiaolai/Xiaolai-Regular-cbaaefaaf326668277aa24dfa93c4d28.woff2",noe="/fonts/Xiaolai/Xiaolai-Regular-58fd02350d0bc52cf1ca3bb32ce9766e.woff2",ioe="/fonts/Xiaolai/Xiaolai-Regular-7ccce86603f80a099ddb0cb21d4ae3e3.woff2",roe="/fonts/Xiaolai/Xiaolai-Regular-3717077e38f98d89eae729b6c14e56dc.woff2",soe="/fonts/Xiaolai/Xiaolai-Regular-dbea1af6dcd9860be40c3d18254338f5.woff2",ooe="/fonts/Xiaolai/Xiaolai-Regular-4a0fdb40036e87b40aa08dd30584cb85.woff2",aoe="/fonts/Xiaolai/Xiaolai-Regular-0f626226ba1272e832aea87bafd9720e.woff2",loe="/fonts/Xiaolai/Xiaolai-Regular-938d90c10ff8c20386af7f242c05d6b0.woff2",coe="/fonts/Xiaolai/Xiaolai-Regular-b6d128682ee29e471486354d486a1b90.woff2",uoe="/fonts/Xiaolai/Xiaolai-Regular-e51ef413167c6e14e0c0fdcc585f2fc9.woff2",doe="/fonts/Xiaolai/Xiaolai-Regular-9d81066dd2b337c938df6e90380a00dc.woff2",foe="/fonts/Xiaolai/Xiaolai-Regular-20e7bf72fa05de9adf7dbcc7bf51dde6.woff2",hoe="/fonts/Xiaolai/Xiaolai-Regular-4095eb84ef3874e2600247bee0b04026.woff2",goe="/fonts/Xiaolai/Xiaolai-Regular-4ee10ae43505e2e0bc62656ced49c0fa.woff2",moe="/fonts/Xiaolai/Xiaolai-Regular-7494dc504ae00ee9cd0505f990f88c5d.woff2",poe="/fonts/Xiaolai/Xiaolai-Regular-8de5b863cb50dfefdd07cb11c774d579.woff2",Uoe="/fonts/Xiaolai/Xiaolai-Regular-3e1f8f654357353bf0e04ba5c34b5f7f.woff2",boe="/fonts/Xiaolai/Xiaolai-Regular-2e33e8dc771ef5e1d9127d60a6b73679.woff2",yoe="/fonts/Xiaolai/Xiaolai-Regular-173945821411c09f70c95f98d590e697.woff2",Eoe="/fonts/Xiaolai/Xiaolai-Regular-b358f7a51ece39a3247942b1feabdb29.woff2",voe="/fonts/Xiaolai/Xiaolai-Regular-23ad2d71b280f00b1363b95b7bea94eb.woff2",_oe="/fonts/Xiaolai/Xiaolai-Regular-5882ffa04f32584d26109137e2da4352.woff2",woe="/fonts/Xiaolai/Xiaolai-Regular-a203b91dad570bf05a58c3c3ddb529bf.woff2",Toe="/fonts/Xiaolai/Xiaolai-Regular-bd77e3c7f9e0b072d96af37f73d1aa32.woff2",Soe="/fonts/Xiaolai/Xiaolai-Regular-5a45d991244d4c7140217e1e5f5ca4f4.woff2",Ioe="/fonts/Xiaolai/Xiaolai-Regular-f56414bf9bced67990def8660e306759.woff2",xoe="/fonts/Xiaolai/Xiaolai-Regular-583d166e56ba0de4b77eabb47ef67839.woff2",Coe="/fonts/Xiaolai/Xiaolai-Regular-7f855356ab893b0d2b9c1c83b8116f0e.woff2",Aoe="/fonts/Xiaolai/Xiaolai-Regular-b57aaedfd8ebdf3931f25119dc6a5eb2.woff2",Moe="/fonts/Xiaolai/Xiaolai-Regular-b6fd38ca30869792244804b04bc058da.woff2",Roe="/fonts/Xiaolai/Xiaolai-Regular-452225341522a7942f0f6aab1a5c91a3.woff2",koe="/fonts/Xiaolai/Xiaolai-Regular-866fa7613df6b3fd272bcfd4530c0bb9.woff2",Loe="/fonts/Xiaolai/Xiaolai-Regular-52a84a22fd1369bffeaf21da2d6158dc.woff2",Doe="/fonts/Xiaolai/Xiaolai-Regular-829615148e6357d826b9242eb7fbbd1e.woff2",Noe="/fonts/Xiaolai/Xiaolai-Regular-c99eda15fc26a2941579560f76c3a5cf.woff2",Ooe="/fonts/Xiaolai/Xiaolai-Regular-395c35dd584b56b0789f58a0559beaf1.woff2",Poe="/fonts/Xiaolai/Xiaolai-Regular-203b0e569e3b14aac86a003dc3fa523e.woff2",Foe="/fonts/Xiaolai/Xiaolai-Regular-51a0e808bbc8361236ac521a119758a3.woff2",Boe="/fonts/Xiaolai/Xiaolai-Regular-6e092f71c1e634059ada0e52abadce67.woff2",zoe="/fonts/Xiaolai/Xiaolai-Regular-0f7fb1e0d5015bb1371343153ecf7ce3.woff2",Hoe="/fonts/Xiaolai/Xiaolai-Regular-d0cf73942fea1c74edbdf0b3011f4656.woff2",Voe="/fonts/Xiaolai/Xiaolai-Regular-968cffdc8ee679da094e77ebf50f58ef.woff2",$oe="/fonts/Xiaolai/Xiaolai-Regular-7a07ddc0f0c0f5f4a9bad6ee3dda66b5.woff2",Goe="/fonts/Xiaolai/Xiaolai-Regular-ec181b795ac1fb5a50d700b6e996d745.woff2",Xoe="/fonts/Xiaolai/Xiaolai-Regular-cfb211578629b7e8153b37240de6a9d5.woff2",joe="/fonts/Xiaolai/Xiaolai-Regular-59e9ff77b0efaf684bc09274fb6908c9.woff2",Yoe="/fonts/Xiaolai/Xiaolai-Regular-2adbc89c11e65905393d3dfc468b9d5b.woff2",Woe="/fonts/Xiaolai/Xiaolai-Regular-70e811fd7994e61f408c923de6ddd078.woff2",Koe="/fonts/Xiaolai/Xiaolai-Regular-c4a687ac4f0c2766eefc9f77ed99cddf.woff2",Zoe="/fonts/Xiaolai/Xiaolai-Regular-51502f1206be09c565f1547c406e9558.woff2",qoe="/fonts/Xiaolai/Xiaolai-Regular-1fdc0c67ed57263a80fd108c1f6ccf24.woff2",Qoe="/fonts/Xiaolai/Xiaolai-Regular-e11567fd2accf9957cd0d3c2be937d87.woff2",Joe="/fonts/Xiaolai/Xiaolai-Regular-20cc1bbf50e7efb442756cb605672c1f.woff2",eae="/fonts/Xiaolai/Xiaolai-Regular-5d2898fbc097a7e24c6f38d80587621e.woff2",tae="/fonts/Xiaolai/Xiaolai-Regular-ac9ceb44437becc3e9c4dbfebab7fc2d.woff2",nae="/fonts/Xiaolai/Xiaolai-Regular-c16ed9740b85badf16e86ea782a3062f.woff2",iae="/fonts/Xiaolai/Xiaolai-Regular-aa0d470430e6391eca720c7cfa44446f.woff2",rae="/fonts/Xiaolai/Xiaolai-Regular-f2b54d4e7be0eaefe1c2c56836fa5368.woff2",sae="/fonts/Xiaolai/Xiaolai-Regular-99a16ef6a64934d5781933dbd9c46b2e.woff2",oae="/fonts/Xiaolai/Xiaolai-Regular-c40533fdf4cc57177b12803598af7e59.woff2",aae="/fonts/Xiaolai/Xiaolai-Regular-91ddb2969bf2d31ba02ad82998d1314c.woff2",lae="/fonts/Xiaolai/Xiaolai-Regular-774d4f764a1299da5d28ec2f2ffe0d69.woff2",cae="/fonts/Xiaolai/Xiaolai-Regular-7718fe60986d8b42b1be9c5ace5ccf25.woff2",uae="/fonts/Xiaolai/Xiaolai-Regular-aa5c9ca6cf4fba00433b7aa3fa10671a.woff2",dae="/fonts/Xiaolai/Xiaolai-Regular-4f50e5136e136527280bc902c5817561.woff2",fae="/fonts/Xiaolai/Xiaolai-Regular-093b9ef39a46ceae95a1df18a0a3a326.woff2",hae="/fonts/Xiaolai/Xiaolai-Regular-a0ca5df4258213d7fc9fce80f65ce760.woff2",gae="/fonts/Xiaolai/Xiaolai-Regular-d2666cbed13462c5dc36fa2f15c202ca.woff2",mae="/fonts/Xiaolai/Xiaolai-Regular-1e6fd68f1f3902ce48ce8c69df385622.woff2",pae="/fonts/Xiaolai/Xiaolai-Regular-87599f94b6cc129d505b375798d0d751.woff2",Uae="/fonts/Xiaolai/Xiaolai-Regular-06c77b8c66e51ed6c63ccb502dd8b8af.woff2",bae="/fonts/Xiaolai/Xiaolai-Regular-13ae07ed2e272d26d59bc0691cd7117a.woff2",yae="/fonts/Xiaolai/Xiaolai-Regular-353f33792a8f60dc69323ddf635a269e.woff2",Eae="/fonts/Xiaolai/Xiaolai-Regular-0facdf1ea213ba40261022f5d5ed4493.woff2",vae="/fonts/Xiaolai/Xiaolai-Regular-f8ee5d36068a42b51d0e4a1116cfcec1.woff2",_ae="/fonts/Xiaolai/Xiaolai-Regular-79d494361ae093b69e74ee9dbe65bfd4.woff2",wae="/fonts/Xiaolai/Xiaolai-Regular-74e2263a91439c25b91d5132ce9f4d62.woff2",Tae="/fonts/Xiaolai/Xiaolai-Regular-ee8bae97908d5147b423f77ad0d3c1bb.woff2",Sae="/fonts/Xiaolai/Xiaolai-Regular-56467a5c8840c4d23a60b2f935114848.woff2",Iae="/fonts/Xiaolai/Xiaolai-Regular-145aa02cdd91946e67dc934e1acffe75.woff2",xae="/fonts/Xiaolai/Xiaolai-Regular-54acdfc2166ad7fcbd074f75fd4a56ba.woff2",Cae="/fonts/Xiaolai/Xiaolai-Regular-29cec36cd205b211da97acabaa62f055.woff2",Aae="/fonts/Xiaolai/Xiaolai-Regular-3756e81d3e149cf6099163ee79944fec.woff2",Mae="/fonts/Xiaolai/Xiaolai-Regular-8e9f97f01034820170065b2921b4fb5e.woff2",Rae="/fonts/Xiaolai/Xiaolai-Regular-13d2887ec8ee73c43acdabc52a05af7b.woff2",kae="/fonts/Xiaolai/Xiaolai-Regular-72536a3d71b694a0d53dd90ddceae41e.woff2",Lae="/fonts/Xiaolai/Xiaolai-Regular-603aefd23e350ba7eb124273e3c9bcf1.woff2",Dae="/fonts/Xiaolai/Xiaolai-Regular-095c169f3314805276f603a362766abd.woff2",Nae="/fonts/Xiaolai/Xiaolai-Regular-9544732d2e62d1a429674f8ee41b5d3a.woff2",Oae="/fonts/Xiaolai/Xiaolai-Regular-d3716376641d615e2995605b29bca7b6.woff2",Pae="/fonts/Xiaolai/Xiaolai-Regular-5a1ce3117cfe90c48e8fb4a9a00f694d.woff2",Fae="/fonts/Xiaolai/Xiaolai-Regular-b7d203b051eff504ff59ddca7576b6a9.woff2",Bae="/fonts/Xiaolai/Xiaolai-Regular-4a38cc3e9cf104e69ba246d37f8cf135.woff2",zae="/fonts/Xiaolai/Xiaolai-Regular-982b630266d87db93d2539affb1275c6.woff2",Hae="/fonts/Xiaolai/Xiaolai-Regular-9592bfc861f07bcb8d75c196b370e548.woff2",Vae="/fonts/Xiaolai/Xiaolai-Regular-a7accba310e821da5505f71c03b76bdb.woff2",$ae="/fonts/Xiaolai/Xiaolai-Regular-dac48066b5883d8b4551fc584f0c2a3e.woff2",Gae="/fonts/Xiaolai/Xiaolai-Regular-a1f916d6039285c4ffb900cd654e418f.woff2",Xae="/fonts/Xiaolai/Xiaolai-Regular-95bfd249da4902577b4b7d76ebdd0b44.woff2",jae="/fonts/Xiaolai/Xiaolai-Regular-93fc8f28a33234bcadf1527cafabd502.woff2",Yae="/fonts/Xiaolai/Xiaolai-Regular-903bb6865f3452e2fda42e3a25547bc5.woff2",Wae="/fonts/Xiaolai/Xiaolai-Regular-4aca6a43e59aceee2166b0c7e4e85ef1.woff2",Kae="/fonts/Xiaolai/Xiaolai-Regular-24476a126f129212beb33f66853ea151.woff2",Zae="/fonts/Xiaolai/Xiaolai-Regular-1b611157cd46bb184d4fa4dae2d6a2b8.woff2",qae="/fonts/Xiaolai/Xiaolai-Regular-56a32a7689abd0326e57c10c6c069bb4.woff2",Qae="/fonts/Xiaolai/Xiaolai-Regular-3cc70dbb64df5b21f1326cc24dee2195.woff2",Jae="/fonts/Xiaolai/Xiaolai-Regular-f6032fc06eb20480f096199713f70885.woff2",ele="/fonts/Xiaolai/Xiaolai-Regular-e2ead7ea7da0437f085f42ffc05f8d13.woff2",tle="/fonts/Xiaolai/Xiaolai-Regular-97f7f48ce90c9429bf32ae51469db74d.woff2",nle="/fonts/Xiaolai/Xiaolai-Regular-24a21c1e4449222e8d1898d69ff3a404.woff2",ile="/fonts/Xiaolai/Xiaolai-Regular-726303e0774b4e678bff8c2deb6ca603.woff2",rle="/fonts/Xiaolai/Xiaolai-Regular-5a7fac4b8b23a6e4e5ba0c9bf1756c91.woff2",sle="/fonts/Xiaolai/Xiaolai-Regular-2b7441d46298788ac94e610ffcc709b6.woff2",ole=[{uri:hre,descriptors:{unicodeRange:"U+f9b8-fa6d,U+fe32,U+fe45-fe4f,U+ff02-ff0b,U+ff0d-ff1e,U+ff20-ff2a"}},{uri:gre,descriptors:{unicodeRange:"U+20dd-20de,U+25ef,U+ff2b-ffbe,U+ffc2-ffc7,U+ffca-ffcf,U+ffd2-ffd7,U+ffda-ffdc,U+ffe0-ffe6,U+ffe8-ffee"}},{uri:mre,descriptors:{unicodeRange:"U+d7eb-d7fb,U+f900-f9b7"}},{uri:pre,descriptors:{unicodeRange:"U+d6f2-d7a3,U+d7b0-d7c6,U+d7cb-d7ea"}},{uri:Ure,descriptors:{unicodeRange:"U+d609-d6f1"}},{uri:bre,descriptors:{unicodeRange:"U+d520-d608"}},{uri:yre,descriptors:{unicodeRange:"U+d437-d51f"}},{uri:Ere,descriptors:{unicodeRange:"U+d34e-d436"}},{uri:vre,descriptors:{unicodeRange:"U+d265-d34d"}},{uri:_re,descriptors:{unicodeRange:"U+d17c-d264"}},{uri:wre,descriptors:{unicodeRange:"U+d093-d17b"}},{uri:Tre,descriptors:{unicodeRange:"U+cfaa-d092"}},{uri:Sre,descriptors:{unicodeRange:"U+cec1-cfa9"}},{uri:Ire,descriptors:{unicodeRange:"U+cdd8-cec0"}},{uri:xre,descriptors:{unicodeRange:"U+ccf1-cdd7"}},{uri:Cre,descriptors:{unicodeRange:"U+cc08-ccf0"}},{uri:Are,descriptors:{unicodeRange:"U+cb43-cc07"}},{uri:Mre,descriptors:{unicodeRange:"U+ca83-cb42"}},{uri:Rre,descriptors:{unicodeRange:"U+c9a1-ca82"}},{uri:kre,descriptors:{unicodeRange:"U+c8b8-c9a0"}},{uri:Lre,descriptors:{unicodeRange:"U+c7cf-c8b7"}},{uri:Dre,descriptors:{unicodeRange:"U+c6e6-c7ce"}},{uri:Nre,descriptors:{unicodeRange:"U+c5fd-c6e5"}},{uri:Ore,descriptors:{unicodeRange:"U+c514-c5fc"}},{uri:Pre,descriptors:{unicodeRange:"U+c42b-c513"}},{uri:Fre,descriptors:{unicodeRange:"U+c341-c34e,U+c350-c42a"}},{uri:Bre,descriptors:{unicodeRange:"U+c258-c340"}},{uri:zre,descriptors:{unicodeRange:"U+c16f-c257"}},{uri:Hre,descriptors:{unicodeRange:"U+c086-c16e"}},{uri:Vre,descriptors:{unicodeRange:"U+bf9d-c085"}},{uri:$re,descriptors:{unicodeRange:"U+beb4-bf9c"}},{uri:Gre,descriptors:{unicodeRange:"U+bdcb-beb3"}},{uri:Xre,descriptors:{unicodeRange:"U+bce2-bdca"}},{uri:jre,descriptors:{unicodeRange:"U+bbf9-bce1"}},{uri:Yre,descriptors:{unicodeRange:"U+bb10-bbf8"}},{uri:Wre,descriptors:{unicodeRange:"U+ba27-bb0f"}},{uri:Kre,descriptors:{unicodeRange:"U+b93e-ba26"}},{uri:Zre,descriptors:{unicodeRange:"U+b855-b93d"}},{uri:qre,descriptors:{unicodeRange:"U+b76c-b854"}},{uri:Qre,descriptors:{unicodeRange:"U+b683-b76b"}},{uri:Jre,descriptors:{unicodeRange:"U+b59a-b682"}},{uri:ese,descriptors:{unicodeRange:"U+b4b1-b599"}},{uri:tse,descriptors:{unicodeRange:"U+11fb-11ff,U+b3cd-b4b0"}},{uri:nse,descriptors:{unicodeRange:"U+11e6-11fa,U+b2f9-b3cc"}},{uri:ise,descriptors:{unicodeRange:"U+11d1-11e5,U+b225-b2f8"}},{uri:rse,descriptors:{unicodeRange:"U+11bc-11d0,U+b151-b224"}},{uri:sse,descriptors:{unicodeRange:"U+11a7-11bb,U+b07d-b150"}},{uri:ose,descriptors:{unicodeRange:"U+1191-11a6,U+afaa-b07c"}},{uri:ase,descriptors:{unicodeRange:"U+117c-1190,U+aed6-afa9"}},{uri:lse,descriptors:{unicodeRange:"U+1167-117b,U+ae02-aed5"}},{uri:cse,descriptors:{unicodeRange:"U+1152-115e,U+1160-1166,U+ad2d-ae01"}},{uri:use,descriptors:{unicodeRange:"U+113d-1151,U+ac59-ad2c"}},{uri:dse,descriptors:{unicodeRange:"U+1100-113c,U+9f95-9f98,U+9f9c-9f9e,U+9fa1-9fce,U+9fd0,U+a960-a97c,U+ac00-ac58"}},{uri:fse,descriptors:{unicodeRange:"U+9771-9772,U+9775,U+9777-977b,U+977d-9784,U+9786-978a,U+978c,U+978e-9790,U+9793,U+9795-9797,U+9799-979f,U+97a1-97a2,U+97a4-97aa,U+97ac,U+97ae,U+97b0-97b1,U+97b3,U+97b5-97e5,U+97e8,U+97ee-97f2,U+97f4,U+97f7-982d"}},{uri:hse,descriptors:{unicodeRange:"U+9491,U+9496,U+9498,U+94c7,U+94cf,U+94d3-94d4,U+94da,U+94e6,U+94fb,U+951c,U+9520,U+9527,U+9533,U+953d,U+9543,U+9548,U+954b,U+9555,U+955a,U+9560,U+956e,U+9574-9575,U+9577-957e,U+9580-95e7,U+95ec,U+95ff,U+9607,U+9613,U+9618,U+961b,U+961e,U+9620,U+9623-9629,U+962b-962d,U+962f-9630,U+9637-963a,U+963e,U+9641,U+9643,U+964a,U+964e-964f,U+9651-9653,U+9656-965a,U+965c-965e,U+9660,U+9663,U+9665-9666,U+966b,U+966d-9671,U+9673,U+9678-9684,U+9687,U+9689-968a,U+968c,U+968e,U+9691-9693"}},{uri:gse,descriptors:{unicodeRange:"U+923c-9273,U+9275-928d,U+928f-92ad,U+92af-92c7,U+92c9-92ee"}},{uri:mse,descriptors:{unicodeRange:"U+9159,U+915b-915c,U+915f-9160,U+9166-9168,U+916b,U+916d,U+9173,U+917a-917c,U+9180-9184,U+9186,U+9188,U+918a,U+918e-918f,U+9193-9199,U+919c-91a1,U+91a4-91a9,U+91ab-91ac,U+91b0-91b3,U+91b6-91b9,U+91bb-91c6,U+91c8,U+91cb,U+91d0,U+91d2-91db,U+91dd-923b"}},{uri:pse,descriptors:{unicodeRange:"U+902b-902c,U+9030-9034,U+9037,U+9039-903a,U+903d,U+903f-9040,U+9043,U+9045-9046,U+9048-904c,U+904e,U+9054-9056,U+9059-905a,U+905c-9061,U+9064,U+9066-9067,U+9069-906c,U+906f-9073,U+9076-907c,U+907e,U+9081,U+9084-9087,U+9089-908a,U+908c-9090,U+9092,U+9094,U+9096,U+9098,U+909a,U+909c,U+909e-90a0,U+90a4-90a5,U+90a7-90a9,U+90ab,U+90ad,U+90b2,U+90b7,U+90bc-90bd,U+90bf-90c0,U+90c2-90c3,U+90c6,U+90c8-90c9,U+90cb-90cd,U+90d2,U+90d4-90d6,U+90d8-90da,U+90de-90e0,U+90e3-90e5,U+90e9-90ea,U+90ec,U+90ee,U+90f0-90f3,U+90f5-90f7,U+90f9-90fc,U+90ff-9101,U+9103,U+9105-9118,U+911a-911d,U+911f-9121,U+9124-912e,U+9130,U+9132-9138,U+913a-9142,U+9144-9145,U+9147-9148,U+9151,U+9153-9156,U+9158"}},{uri:Use,descriptors:{unicodeRange:"U+8f03-8f65,U+8f6a,U+8f80,U+8f8c,U+8f92,U+8f9d,U+8fa0-8fa2,U+8fa4-8fa7,U+8faa,U+8fac-8faf,U+8fb2-8fb5,U+8fb7-8fb8,U+8fba-8fbc,U+8fbf-8fc0,U+8fc3,U+8fc6,U+8fc9-8fcd,U+8fcf,U+8fd2,U+8fd6-8fd7,U+8fda,U+8fe0-8fe1,U+8fe3,U+8fe7,U+8fec,U+8fef,U+8ff1-8ff2,U+8ff4-8ff6,U+8ffa-8ffc,U+8ffe-8fff,U+9007-9008,U+900c,U+900e,U+9013,U+9015,U+9018-9019,U+901c,U+9023-9025,U+9027-902a"}},{uri:bse,descriptors:{unicodeRange:"U+8d03-8d1c,U+8d20,U+8d51-8d52,U+8d57,U+8d5f,U+8d65,U+8d68-8d6a,U+8d6c,U+8d6e-8d6f,U+8d71-8d72,U+8d78-8d80,U+8d82-8d83,U+8d86-8d89,U+8d8c-8d90,U+8d92-8d93,U+8d95-8d9e,U+8da0-8da2,U+8da4-8db0,U+8db2,U+8db6-8db7,U+8db9,U+8dbb,U+8dbd,U+8dc0-8dc2,U+8dc5,U+8dc7-8dca,U+8dcd,U+8dd0,U+8dd2-8dd5,U+8dd8-8dd9,U+8ddc,U+8de0-8de2,U+8de5-8de7,U+8de9,U+8ded-8dee,U+8df0-8df2,U+8df4,U+8df6,U+8dfc,U+8dfe-8e04,U+8e06-8e08,U+8e0b,U+8e0d-8e0e,U+8e10-8e13,U+8e15-8e1c,U+8e20-8e21,U+8e24-8e28,U+8e2b,U+8e2d,U+8e30,U+8e32-8e34,U+8e36-8e38,U+8e3b-8e3c,U+8e3e-8e3f,U+8e43,U+8e45-8e46"}},{uri:yse,descriptors:{unicodeRange:"U+8bea,U+8c09,U+8c1e,U+8c38-8c40,U+8c42-8c45,U+8c48,U+8c4a-8c4b,U+8c4d-8c54,U+8c56-8c59,U+8c5b-8c60,U+8c63-8c69,U+8c6c-8c72,U+8c74-8c77,U+8c7b-8c81,U+8c83-8c84,U+8c86-8c88,U+8c8b,U+8c8d-8c93,U+8c95-8c97,U+8c99-8d02"}},{uri:Ese,descriptors:{unicodeRange:"U+8a64-8a78,U+8a7a-8a88,U+8a8b-8a92,U+8a94-8b06,U+8b08-8b1b"}},{uri:vse,descriptors:{unicodeRange:"U+8987-89c0,U+89c3,U+89cd,U+89d3-89d5,U+89d7-89d9,U+89db,U+89dd,U+89df-89e2,U+89e4,U+89e7-89ea,U+89ec-89ee,U+89f0-89f2,U+89f4-89ff,U+8a01-8a06,U+8a08-8a3d,U+8a3f-8a47,U+8a49-8a63"}},{uri:_se,descriptors:{unicodeRange:"U+87e3-87e4,U+87e6-87e9,U+87eb-87ed,U+87ef-87f8,U+87fa-87fd,U+87ff-8802,U+8804-8809,U+880b-8812,U+8814,U+8817-881a,U+881c-8820,U+8823-8831,U+8833-8838,U+883a-883b,U+883d-883f,U+8841-8843,U+8846-884b,U+884e-8853,U+8855-8856,U+8858,U+885a-8860,U+8866-8867,U+886a,U+886d,U+886f,U+8871,U+8873-8876,U+8878-887c,U+8880,U+8883,U+8886-8887,U+8889-888a,U+888c,U+888e-8891,U+8893-8895,U+8897-889b,U+889d-88a1,U+88a3,U+88a5-88aa,U+88ac,U+88ae-88b0,U+88b2-88b6,U+88b8-88bb"}},{uri:wse,descriptors:{unicodeRange:"U+86e7-86e8,U+86ea-86ec,U+86ef,U+86f5-86f7,U+86fa-86fd,U+86ff,U+8701,U+8704-8706,U+870b-870c,U+870e-8711,U+8714,U+8716,U+8719,U+871b,U+871d,U+871f-8720,U+8724,U+8726-8728,U+872a-872d,U+872f-8730,U+8732-8733,U+8735-8736,U+8738-873a,U+873c-873d,U+8740-8746,U+874a-874b,U+874d,U+874f-8752,U+8754-8756,U+8758,U+875a-875f,U+8761-8762,U+8766-876d,U+876f,U+8771-8773,U+8775,U+8777-877a,U+877f-8781,U+8784,U+8786-8787,U+8789-878a,U+878c,U+878e-8792,U+8794-8796,U+8798-879e,U+87a0-87a7,U+87a9-87aa,U+87ae,U+87b0-87b2,U+87b4,U+87b6-87b9,U+87bb-87bc,U+87be-87bf,U+87c1-87c5,U+87c7-87c9,U+87cc-87d0,U+87d4-87da,U+87dc-87df,U+87e1-87e2"}},{uri:Tse,descriptors:{unicodeRange:"U+8604,U+8606-8610,U+8612-8615,U+8617-8626,U+8628,U+862a-8637,U+8639-863b,U+863d-864c,U+8652-8653,U+8655-8659,U+865b-865d,U+865f-8661,U+8663-866a,U+866d,U+866f-8670,U+8672-8678,U+8683-8689,U+868e-8692,U+8694,U+8696-869b,U+869e-86a2,U+86a5-86a6,U+86ab,U+86ad-86ae,U+86b2-86b3,U+86b7-86b9,U+86bb-86bf,U+86c1-86c3,U+86c5,U+86c8,U+86cc-86cd,U+86d2-86d3,U+86d5-86d7,U+86da,U+86dc-86dd,U+86e0-86e3,U+86e5-86e6"}},{uri:Sse,descriptors:{unicodeRange:"U+8456,U+8458,U+845d-8460,U+8462,U+8464-8468,U+846a,U+846e-8470,U+8472,U+8474,U+8477,U+8479,U+847b-8481,U+8483-8486,U+848a,U+848d,U+848f-8496,U+8498,U+849a-849b,U+849d-84a0,U+84a2-84ae,U+84b0-84b1,U+84b3,U+84b5-84b7,U+84bb-84bc,U+84be,U+84c0,U+84c2-84c3,U+84c5-84c8,U+84cb-84cc,U+84ce-84cf,U+84d2,U+84d4-84d5,U+84d7-84dc,U+84de,U+84e1-84e2,U+84e4,U+84e7-84eb,U+84ed-84ef,U+84f1-84fb,U+84fd-84fe,U+8500-850b,U+850d-8510,U+8512,U+8514-8516,U+8518-8519,U+851b-851e,U+8520,U+8522-852a,U+852d-8536,U+853e-8542,U+8544-8547,U+854b-854f"}},{uri:Ise,descriptors:{unicodeRange:"U+82c2-82c3,U+82c5-82c6,U+82c9,U+82d0,U+82d6,U+82d9-82da,U+82dd,U+82e2,U+82e7-82ea,U+82ec-82ee,U+82f0,U+82f2-82f3,U+82f5-82f6,U+82f8,U+82fa,U+82fc-8300,U+830a-830b,U+830d,U+8310,U+8312-8313,U+8316,U+8318-8319,U+831d-8326,U+8329-832a,U+832e,U+8330,U+8332,U+8337,U+833b,U+833d-833f,U+8341-8342,U+8344-8345,U+8348,U+834a-834e,U+8353,U+8355-8359,U+835d,U+8362,U+8370-8376,U+8379-837a,U+837e-8384,U+8387-8388,U+838a-838d,U+838f-8391,U+8394-8397,U+8399-839a,U+839d,U+839f,U+83a1-83a7,U+83ac-83af,U+83b5,U+83bb,U+83be-83bf,U+83c2-83c4,U+83c6,U+83c8-83c9,U+83cb,U+83cd-83ce,U+83d0-83d3,U+83d5,U+83d7,U+83d9-83db,U+83de,U+83e2-83e4,U+83e6-83e8,U+83eb-83ef,U+83f3-83f7,U+83fa-83fc,U+83fe-8400,U+8402,U+8405,U+8407-840a,U+8410,U+8412-8417,U+8419-841b,U+841e-8423,U+8429-8430,U+8432-8437,U+8439-843b,U+843e-8445,U+8447-8450,U+8452-8455"}},{uri:xse,descriptors:{unicodeRange:"U+81a4-81a5,U+81a7,U+81a9,U+81ab-81b2,U+81b4-81b9,U+81bc-81bf,U+81c4-81c5,U+81c7-81c9,U+81cb,U+81cd-81e2,U+81e4-81e6,U+81e8-81e9,U+81eb,U+81ee-81f2,U+81f5-81fa,U+81fd,U+81ff,U+8203,U+8207-820b,U+820e-820f,U+8211,U+8213,U+8215-821a,U+821d,U+8220,U+8224-8227,U+8229,U+822e,U+8232,U+823a,U+823c-823d,U+823f-8243,U+8245-8246,U+8248,U+824a,U+824c-824e,U+8250-8257,U+8259,U+825b-825e,U+8260-8267,U+8269-826d,U+8271,U+8275-8278,U+827b-827c,U+8280-8281,U+8283,U+8285-8287,U+8289,U+828c,U+8290,U+8293-8296,U+829a-829b,U+829e,U+82a0,U+82a2-82a3,U+82a7,U+82b2,U+82b5-82b6,U+82ba-82bc,U+82bf-82c0"}},{uri:Cse,descriptors:{unicodeRange:"U+8059,U+805b-8068,U+806b-8070,U+8072-807e,U+8081-8082,U+8085,U+8088,U+808a,U+808d-8092,U+8094-8095,U+8097,U+8099,U+809e,U+80a3,U+80a6-80a8,U+80ac,U+80b0,U+80b3,U+80b5-80b6,U+80b8-80b9,U+80bb,U+80c5,U+80c7-80cb,U+80cf-80d5,U+80d8,U+80df-80e0,U+80e2-80e3,U+80e6,U+80ee,U+80f5,U+80f7,U+80f9,U+80fb,U+80fe-8101,U+8103-8105,U+8107-8108,U+810b-810c,U+8115,U+8117,U+8119,U+811b-811d,U+811f-812b,U+812d-812e,U+8130,U+8133-8135,U+8137,U+8139-813d,U+813f-8145,U+8147,U+8149,U+814d-814f,U+8152,U+8156-8158,U+815b-815f,U+8161-8164,U+8166,U+8168,U+816a-816c,U+816f,U+8172-8173,U+8175-8178,U+8181,U+8183-8187,U+8189,U+818b-818e,U+8190,U+8192-8197,U+8199-819a,U+819e-81a2"}},{uri:Ase,descriptors:{unicodeRange:"U+7f3c-7f41,U+7f43,U+7f46-7f4f,U+7f52-7f53,U+7f56,U+7f59,U+7f5b-7f5e,U+7f60,U+7f63-7f67,U+7f6b-7f6d,U+7f6f-7f70,U+7f73,U+7f75-7f78,U+7f7a-7f7d,U+7f7f-7f80,U+7f82-7f89,U+7f8b,U+7f8d,U+7f8f-7f93,U+7f95-7f99,U+7f9b-7f9c,U+7fa0,U+7fa2-7fa3,U+7fa5-7fa6,U+7fa8-7fae,U+7fb1,U+7fb3-7fb7,U+7fba-7fbb,U+7fbe,U+7fc0,U+7fc2-7fc4,U+7fc6-7fc9,U+7fcb,U+7fcd,U+7fcf-7fd3,U+7fd6-7fd7,U+7fd9-7fde,U+7fe2-7fe4,U+7fe7-7fe8,U+7fea-7fed,U+7fef,U+7ff2,U+7ff4-7ffa,U+7ffd-7fff,U+8002,U+8007-800a,U+800e-800f,U+8011,U+8013,U+801a-801b,U+801d-801f,U+8021,U+8023-8024,U+802b-8030,U+8032,U+8034,U+8039-803a,U+803c,U+803e,U+8040-8041,U+8044-8045,U+8047-8049,U+804e-8051,U+8053,U+8055-8057"}},{uri:Mse,descriptors:{unicodeRange:"U+7cd8,U+7cda-7cdb,U+7cdd-7cde,U+7ce1-7ce7,U+7ce9-7cee,U+7cf0-7cf7,U+7cf9-7cfa,U+7cfc-7d09,U+7d0b-7d1f,U+7d21,U+7d23-7d26,U+7d28-7d2a,U+7d2c-7d2e,U+7d30-7d6d,U+7d6f-7d76,U+7d78-7d94"}},{uri:Rse,descriptors:{unicodeRange:"U+7afe,U+7b00-7b02,U+7b05,U+7b07,U+7b09,U+7b0c-7b0e,U+7b10,U+7b12-7b13,U+7b16-7b18,U+7b1a,U+7b1c-7b1d,U+7b1f,U+7b21-7b23,U+7b27,U+7b29,U+7b2d,U+7b2f-7b30,U+7b32,U+7b34-7b37,U+7b39,U+7b3b,U+7b3d,U+7b3f-7b44,U+7b46,U+7b48,U+7b4a,U+7b4d-7b4e,U+7b53,U+7b55,U+7b57,U+7b59,U+7b5c,U+7b5e-7b5f,U+7b61,U+7b63-7b6d,U+7b6f-7b70,U+7b73-7b74,U+7b76,U+7b78,U+7b7a,U+7b7c-7b7d,U+7b7f,U+7b81-7b84,U+7b86-7b8c,U+7b8e-7b8f,U+7b91-7b93,U+7b96,U+7b98-7b9b,U+7b9e-7ba0,U+7ba3-7ba5,U+7bae-7bb0,U+7bb2-7bb3,U+7bb5-7bb7,U+7bb9-7bc0,U+7bc2-7bc5,U+7bc8-7bcb,U+7bcd-7bd0,U+7bd2,U+7bd4-7bd8,U+7bdb-7bdc,U+7bde-7be0,U+7be2-7be4,U+7be7-7be9,U+7beb-7bed,U+7bef-7bf0,U+7bf2-7bf6,U+7bf8-7bfb,U+7bfd,U+7bff-7c06,U+7c08-7c0a,U+7c0d-7c0e,U+7c10-7c13"}},{uri:kse,descriptors:{unicodeRange:"U+7a10-7a13,U+7a15-7a16,U+7a18-7a19,U+7a1b-7a1d,U+7a1f,U+7a21-7a22,U+7a24-7a32,U+7a34-7a36,U+7a38,U+7a3a,U+7a3e,U+7a40-7a45,U+7a47-7a50,U+7a52-7a56,U+7a58-7a6f,U+7a71-7a73,U+7a75,U+7a7b-7a7e,U+7a82,U+7a85,U+7a87,U+7a89-7a8c,U+7a8e-7a90,U+7a93-7a94,U+7a99-7a9b,U+7a9e,U+7aa1-7aa4,U+7aa7,U+7aa9-7aab,U+7aae-7ab2,U+7ab4-7abe,U+7ac0-7aca,U+7acc-7ad5,U+7ad7-7ad8,U+7ada-7add,U+7ae1-7ae2,U+7ae4,U+7ae7-7aec,U+7aee,U+7af0-7af8,U+7afb-7afc"}},{uri:Lse,descriptors:{unicodeRange:"U+790d-7912,U+7914-791d,U+791f-7923,U+7925-7933,U+7935-7939,U+793d,U+793f,U+7942-7945,U+7947,U+794a-7952,U+7954-7955,U+7958-7959,U+7961,U+7963-7964,U+7966,U+7969-796c,U+796e,U+7970-7976,U+7979,U+797b-797f,U+7982-7983,U+7986-7989,U+798b-798e,U+7990-7999,U+799b-79a6,U+79a8-79b2,U+79b4-79b8,U+79bc,U+79bf,U+79c2,U+79c4-79c5,U+79c7-79c8,U+79ca,U+79cc,U+79ce-79d0,U+79d3-79d4,U+79d6-79d7,U+79d9-79de,U+79e0-79e2,U+79e5,U+79e8,U+79ea,U+79ec,U+79ee,U+79f1-79f7,U+79f9-79fa,U+79fc,U+79fe-79ff,U+7a01,U+7a04-7a05,U+7a07-7a0a,U+7a0c,U+7a0f"}},{uri:Dse,descriptors:{unicodeRange:"U+77d8-77da,U+77dd-77e1,U+77e4,U+77e6,U+77e8,U+77ea,U+77ef-77f2,U+77f4-77f5,U+77f7,U+77f9-77fc,U+7803-7808,U+780a-780b,U+780e-7810,U+7813,U+7815,U+7819,U+781b,U+781e,U+7820-7822,U+7824,U+7828,U+782a-782b,U+782e-782f,U+7831-7833,U+7835-7836,U+783d,U+783f,U+7841-7844,U+7846,U+7848-784b,U+784d,U+784f,U+7851,U+7853-7854,U+7858-785c,U+785e-7869,U+786f-7876,U+7878-787b,U+787d-7886,U+7888,U+788a-788b,U+788f-7890,U+7892,U+7894-7896,U+7899,U+789d-789e,U+78a0,U+78a2,U+78a4,U+78a6,U+78a8-78af,U+78b5-78b8,U+78ba-78bd,U+78bf-78c0,U+78c2-78c4,U+78c6-78c8,U+78cc-78cf,U+78d1-78d3,U+78d6-78d8,U+78da-78e7,U+78e9-78eb,U+78ed-78f1,U+78f3,U+78f5-78f6,U+78f8-78f9,U+78fb-7900,U+7902-7904,U+7906-790c"}},{uri:Nse,descriptors:{unicodeRange:"U+76af-76b0,U+76b3,U+76b5-76be,U+76c0-76c1,U+76c3-76c4,U+76c7,U+76c9,U+76cb-76cc,U+76d3,U+76d5,U+76d9-76da,U+76dc-76de,U+76e0-76e4,U+76e6-76ed,U+76f0,U+76f3,U+76f5-76f7,U+76fa-76fb,U+76fd,U+76ff-7703,U+7705-7706,U+770a,U+770c,U+770e-7718,U+771b-771e,U+7721,U+7723-7725,U+7727,U+772a-772c,U+772e,U+7730-7734,U+7739,U+773b,U+773d-773f,U+7742,U+7744-7746,U+7748-774f,U+7752-7759,U+775c-7760,U+7764,U+7767,U+7769-776a,U+776d-7778,U+777a-777c,U+7781-7783,U+7786-778b,U+778f-7790,U+7793-779e,U+77a1,U+77a3-77a4,U+77a6,U+77a8,U+77ab,U+77ad-77af,U+77b1-77b2,U+77b4,U+77b6-77ba,U+77bc,U+77be,U+77c0-77cc,U+77ce-77d6"}},{uri:Ose,descriptors:{unicodeRange:"U+7589-758a,U+758c-758e,U+7590,U+7593,U+7595,U+7598,U+759b-759c,U+759e,U+75a2,U+75a6-75aa,U+75ad,U+75b6-75b7,U+75ba-75bb,U+75bf-75c1,U+75c6,U+75cb-75cc,U+75ce-75d1,U+75d3,U+75d7,U+75d9-75da,U+75dc-75dd,U+75df-75e1,U+75e5,U+75e9,U+75ec-75ef,U+75f2-75f3,U+75f5-75f8,U+75fa-75fb,U+75fd-75fe,U+7602,U+7604,U+7606-7609,U+760b,U+760d-760f,U+7611-7614,U+7616,U+761a,U+761c-761e,U+7621,U+7623,U+7627-7628,U+762c,U+762e-762f,U+7631-7632,U+7636-7637,U+7639-763b,U+763d,U+7641-7642,U+7644-764b,U+764e-7653,U+7655,U+7657-765b,U+765d,U+765f-7662,U+7664-766a,U+766c-766e,U+7670-7677,U+7679-767a,U+767c,U+767f-7681,U+7683,U+7685,U+7689-768a,U+768c-768d,U+768f-7690,U+7692,U+7694-7695,U+7697-7698,U+769a-76a3,U+76a5-76ad"}},{uri:Pse,descriptors:{unicodeRange:"U+7492-749b,U+749d,U+749f-74a6,U+74aa-74b9,U+74bb-74d1,U+74d3-74db,U+74dd,U+74df,U+74e1,U+74e5,U+74e7-74ed,U+74f0-74f3,U+74f5,U+74f8-74fe,U+7500-7503,U+7505-750c,U+750e,U+7510,U+7512,U+7514-7517,U+751b,U+751d-751e,U+7520-7524,U+7526-7527,U+752a,U+752e,U+7534,U+7536,U+7539,U+753c-753d,U+753f,U+7541-7544,U+7546-7547,U+7549-754a,U+754d,U+7550-7553,U+7555-7558,U+755d-7564,U+7567-7569,U+756b-7571,U+7573,U+7575-7577,U+757a-757e,U+7580-7582,U+7584-7585,U+7587-7588"}},{uri:Fse,descriptors:{unicodeRange:"U+7372-737d,U+737f-7383,U+7385-7386,U+7388,U+738a,U+738c-738d,U+738f-7390,U+7392-7395,U+7397-739a,U+739c-739e,U+73a0-73a1,U+73a3-73a8,U+73aa,U+73ac-73ad,U+73b1,U+73b4-73b6,U+73b8-73b9,U+73bc-73bf,U+73c1,U+73c3-73c7,U+73cb-73cc,U+73ce,U+73d2-73d8,U+73da-73dd,U+73df,U+73e1-73e4,U+73e6,U+73e8,U+73ea-73ec,U+73ee-73f1,U+73f3-7402,U+7404,U+7407-7408,U+740b-740e,U+7411-7419,U+741c-7421,U+7423-7424,U+7427,U+7429,U+742b,U+742d,U+742f,U+7431-7432,U+7437-743b,U+743d-7440,U+7442-7454,U+7456,U+7458,U+745d,U+7460-746c,U+746e-746f,U+7471-7475,U+7478-747d,U+747f,U+7482,U+7484-7486,U+7488-748a,U+748c-748d,U+748f,U+7491"}},{uri:Bse,descriptors:{unicodeRange:"U+7054-705d,U+705f-706a,U+706e,U+7071-7074,U+7077,U+7079-707b,U+707d,U+7081-7084,U+7086-7088,U+708b-708d,U+708f-7091,U+7093,U+7097-7098,U+709a-709b,U+709e-70aa,U+70b0,U+70b2,U+70b4-70b6,U+70ba,U+70be-70bf,U+70c4-70c7,U+70c9,U+70cb-70d7,U+70da,U+70dc-70de,U+70e0-70e3,U+70e5,U+70ea,U+70ee,U+70f0-70f6,U+70f8,U+70fa-70fc,U+70fe-7108,U+710b-710f,U+7111-7112,U+7114,U+7117,U+711b-7125,U+7127-712e,U+7132-7135,U+7137-7144,U+7146-7149,U+714b,U+714d,U+714f-715b,U+715d,U+715f-7163,U+7165,U+7169-716d,U+716f-7171,U+7174-7177"}},{uri:zse,descriptors:{unicodeRange:"U+722e-722f,U+7232-7234,U+723a,U+723c,U+723e,U+7240-7246,U+7249-724b,U+724e-7251,U+7253-7255,U+7257-7258,U+725a,U+725c,U+725e,U+7260,U+7263-7265,U+7268,U+726a-726d,U+7270-7271,U+7273-7274,U+7276-7278,U+727b-727d,U+7282-7283,U+7285-7289,U+728c,U+728e,U+7290-7291,U+7293-729e,U+72a0-72ab,U+72ae,U+72b1-72b3,U+72b5,U+72ba-72c0,U+72c5-72c7,U+72c9-72cc,U+72cf,U+72d1,U+72d3-72d6,U+72d8,U+72da-72dd,U+72df,U+72e2-72e7,U+72ea-72eb,U+72f5-72f6,U+72f9,U+72fd-7300,U+7302,U+7304-7309,U+730b-730d,U+730f-7312,U+7314,U+7318-731a,U+731f-7320,U+7323-7324,U+7326-7328,U+732d,U+732f-7330,U+7332-7333,U+7335-7336,U+733a-733d,U+7340-734c,U+734e-734f,U+7351,U+7353-7356,U+7358-735f,U+7361-736b,U+736e,U+7370-7371"}},{uri:Hse,descriptors:{unicodeRange:"U+6ec5-6ec6,U+6ec8-6eca,U+6ecc-6ece,U+6ed0,U+6ed2,U+6ed6,U+6ed8-6ed9,U+6edb-6edd,U+6ee3,U+6ee7,U+6eea-6ef3,U+6ef5-6ef8,U+6efa-6f01,U+6f03-6f05,U+6f07-6f08,U+6f0a-6f0e,U+6f10-6f12,U+6f16-6f1f,U+6f21-6f23,U+6f25-6f28,U+6f2c,U+6f2e,U+6f30,U+6f32,U+6f34-6f35,U+6f37-6f3d,U+6f3f-6f45,U+6f48-6f4a,U+6f4c,U+6f4e-6f57,U+6f59-6f5b,U+6f5d,U+6f5f-6f61,U+6f63-6f65,U+6f67-6f6c,U+6f6f-6f71,U+6f73,U+6f75-6f77,U+6f79,U+6f7b,U+6f7d-6f83,U+6f85-6f87,U+6f8a-6f8b,U+6f8f-6f9b,U+6f9d-6fa0,U+6fa2-6fa6,U+6fa8-6fb1"}},{uri:Vse,descriptors:{unicodeRange:"U+6d73,U+6d75-6d76,U+6d79-6d7b,U+6d7d-6d81,U+6d83-6d84,U+6d86-6d87,U+6d8a-6d8b,U+6d8d,U+6d8f-6d90,U+6d92,U+6d96-6d9a,U+6d9c,U+6da2,U+6da5,U+6dac-6dad,U+6db0-6db1,U+6db3-6db4,U+6db6-6db7,U+6db9-6dbe,U+6dc1-6dc3,U+6dc8-6dca,U+6dcd-6dd0,U+6dd2-6dd5,U+6dd7,U+6dda-6ddc,U+6ddf,U+6de2-6de3,U+6de5,U+6de7-6dea,U+6ded,U+6def-6df0,U+6df2,U+6df4-6df6,U+6df8,U+6dfa,U+6dfd-6e04,U+6e06-6e09,U+6e0b,U+6e0f,U+6e12-6e13,U+6e15,U+6e18-6e19,U+6e1b-6e1c,U+6e1e-6e1f,U+6e22,U+6e26-6e28,U+6e2a,U+6e2c,U+6e2e,U+6e30-6e31,U+6e33,U+6e35-6e37,U+6e39,U+6e3b-6e42,U+6e45-6e4c,U+6e4f-6e52,U+6e55,U+6e57,U+6e59-6e5a,U+6e5c-6e5e,U+6e60-6e6a,U+6e6c-6e6d,U+6e6f-6e7d,U+6e80-6e82,U+6e84,U+6e87-6e88,U+6e8a-6e8e,U+6e91-6e97,U+6e99-6e9b,U+6e9d-6e9e,U+6ea0-6ea1,U+6ea3-6ea4,U+6ea6,U+6ea8-6ea9,U+6eab-6eae,U+6eb0,U+6eb3,U+6eb5,U+6eb8-6eb9,U+6ebc,U+6ebe-6ec0,U+6ec3-6ec4"}},{uri:$se,descriptors:{unicodeRange:"U+6bbb-6bbe,U+6bc0,U+6bc3-6bc4,U+6bc6-6bca,U+6bcc,U+6bce,U+6bd0-6bd1,U+6bd8,U+6bda,U+6bdc-6be0,U+6be2-6be9,U+6bec-6bee,U+6bf0-6bf2,U+6bf4,U+6bf6-6bf8,U+6bfa-6bfc,U+6bfe-6c04,U+6c08-6c0c,U+6c0e,U+6c12,U+6c17,U+6c1c-6c1e,U+6c20,U+6c23,U+6c25,U+6c2b-6c2d,U+6c31,U+6c33,U+6c36-6c37,U+6c39-6c3c,U+6c3e-6c3f,U+6c43-6c45,U+6c48,U+6c4b-6c4f,U+6c51-6c53,U+6c56,U+6c58-6c5a,U+6c62-6c63,U+6c65-6c67,U+6c6b-6c6f,U+6c71,U+6c73,U+6c75,U+6c77-6c78,U+6c7a-6c7c,U+6c7f-6c80,U+6c84,U+6c87,U+6c8a-6c8b,U+6c8d-6c8e,U+6c91-6c92,U+6c95-6c98,U+6c9a,U+6c9c-6c9e,U+6ca0,U+6ca2,U+6ca8,U+6cac,U+6caf-6cb0,U+6cb4-6cb7,U+6cba,U+6cc0-6cc3,U+6cc6-6cc8,U+6ccb,U+6ccd-6ccf,U+6cd1-6cd2,U+6cd8-6cda,U+6cdc-6cdd,U+6cdf,U+6ce4,U+6ce6-6ce7,U+6ce9,U+6cec-6ced,U+6cf2,U+6cf4,U+6cf9,U+6cff-6d00,U+6d02-6d03,U+6d05-6d06,U+6d08-6d0a,U+6d0d,U+6d0f-6d11,U+6d13-6d16,U+6d18,U+6d1c-6d1d,U+6d1f-6d24,U+6d26,U+6d28-6d29,U+6d2c-6d2d,U+6d2f-6d30,U+6d34,U+6d36-6d38,U+6d3a,U+6d3f-6d40,U+6d42,U+6d44,U+6d49,U+6d4c,U+6d50,U+6d55-6d58,U+6d5b,U+6d5d,U+6d5f,U+6d61-6d62,U+6d64-6d65,U+6d67-6d68,U+6d6b-6d6d,U+6d70-6d72"}},{uri:Gse,descriptors:{unicodeRange:"U+6967-696a,U+696c-696d,U+696f-6970,U+6972-6976,U+697a-697b,U+697d-697f,U+6981,U+6983,U+6985,U+698a-698c,U+698e-6993,U+6996-6997,U+6999-699a,U+699d-69a6,U+69a9-69aa,U+69ac,U+69ae-69b0,U+69b2-69b3,U+69b5-69b6,U+69b8-69ba,U+69bc-69c0,U+69c2-69c9,U+69cb,U+69cd,U+69cf,U+69d1-69d3,U+69d5-69da,U+69dc-69de,U+69e1-69ec,U+69ee-69f1,U+69f3-69fc,U+69fe,U+6a00-6a09,U+6a0b-6a16,U+6a19-6a1e,U+6a20,U+6a22-6a27,U+6a29,U+6a2b-6a2e,U+6a30,U+6a32-6a34,U+6a36-6a3c,U+6a3f-6a43,U+6a45-6a46,U+6a48-6a4a"}},{uri:Xse,descriptors:{unicodeRange:"U+6830-6831,U+6834-6836,U+683a-683b,U+683f,U+6847,U+684b,U+684d,U+684f,U+6852,U+6856-685f,U+686a,U+686c-6873,U+6875,U+6878-6880,U+6882,U+6884,U+6887-688e,U+6890-6892,U+6894-6896,U+6898-68a1,U+68a3-68a5,U+68a9-68ac,U+68ae,U+68b1-68b2,U+68b4,U+68b6-68bf,U+68c1,U+68c3-68c8,U+68ca,U+68cc,U+68ce-68d1,U+68d3-68d4,U+68d6-68d7,U+68d9,U+68db-68df,U+68e1-68e2,U+68e4-68ed,U+68ef,U+68f2-68f4,U+68f6-68f8,U+68fb,U+68fd-6900,U+6902-6904,U+6906-690a,U+690c,U+690f,U+6911,U+6913-691e,U+6921-6923,U+6925-692c,U+692e-692f,U+6931-6933,U+6935-6938,U+693a-693c,U+693e,U+6940-6941,U+6943-6953,U+6955-6956,U+6958-6959,U+695b-695c,U+695f,U+6961-6962,U+6964-6965"}},{uri:jse,descriptors:{unicodeRange:"U+66b8,U+66ba-66bd,U+66bf-66d8,U+66da,U+66de-66e5,U+66e7-66e8,U+66ea-66ef,U+66f1,U+66f5-66f6,U+66f8,U+66fa-66fb,U+66fd,U+6701-6707,U+670c,U+670e-670f,U+6711-6713,U+6716,U+6718-671a,U+671c,U+671e,U+6720-6725,U+6727,U+6729,U+672e,U+6730,U+6732-6733,U+6736-6739,U+673b-673c,U+673e-673f,U+6741,U+6744-6745,U+6747,U+674a-674b,U+674d,U+6752,U+6754-6755,U+6757-675b,U+675d,U+6762-6764,U+6766-6767,U+676b-676c,U+676e,U+6771,U+6774,U+6776,U+6778-677b,U+677d,U+6780,U+6782-6783,U+6785-6786,U+6788,U+678a,U+678c-678f,U+6791-6794,U+6796,U+6799,U+679b,U+679f-67a1,U+67a4,U+67a6,U+67a9,U+67ac,U+67ae,U+67b1-67b2,U+67b4,U+67b9-67c0,U+67c2,U+67c5-67ce,U+67d5-67d7,U+67db,U+67df,U+67e1,U+67e3-67e4,U+67e6-67e8,U+67ea-67eb,U+67ed-67ee,U+67f2,U+67f5-67fc,U+67fe,U+6801-6804,U+6806,U+680d,U+6810,U+6812,U+6814-6815,U+6818-681c,U+681e-6820,U+6822-6828,U+682b-682f"}},{uri:Yse,descriptors:{unicodeRange:"U+6569-656a,U+656d-656f,U+6571,U+6573,U+6575-6576,U+6578-6586,U+6588-658a,U+658d-658f,U+6592,U+6594-6596,U+6598,U+659a,U+659d-659e,U+65a0,U+65a2-65a3,U+65a6,U+65a8,U+65aa,U+65ac,U+65ae,U+65b1-65b8,U+65ba-65bb,U+65be-65c0,U+65c2,U+65c7-65ca,U+65cd,U+65d0-65d1,U+65d3-65d5,U+65d8-65df,U+65e1,U+65e3-65e4,U+65ea-65eb,U+65f2-65f5,U+65f8-65f9,U+65fb-65ff,U+6601,U+6604-6605,U+6607-6609,U+660b,U+660d,U+6610-6612,U+6616-6618,U+661a-661c,U+661e,U+6621-6624,U+6626,U+6629-662c,U+662e,U+6630,U+6632-6633,U+6637-663b,U+663d,U+663f-6640,U+6642,U+6644-664a,U+664d-664e,U+6650-6651,U+6658-6659,U+665b-665e,U+6660,U+6662-6663,U+6665,U+6667,U+6669-666d,U+6671-6673,U+6675,U+6678-6679,U+667b-667d,U+667f-6681,U+6683,U+6685-6686,U+6688-668b,U+668d-6690,U+6692-6695,U+6698-669c,U+669e-66a6,U+66a9-66ad,U+66af-66b3,U+66b5-66b7"}},{uri:Wse,descriptors:{unicodeRange:"U+5f30,U+5f32-5f38,U+5f3b,U+5f3d-5f3f,U+5f41-5f4f,U+5f51,U+5f54,U+5f59-5f5c,U+5f5e-5f60,U+5f63,U+5f65,U+5f67-5f68,U+5f6b,U+5f6e-5f6f,U+5f72,U+5f74-5f76,U+5f78,U+5f7a,U+5f7d-5f7f,U+5f83,U+5f86,U+5f8d-5f8f,U+5f91,U+5f93-5f94,U+5f96,U+5f9a-5f9b,U+5f9d-5fa0,U+5fa2-5fa7,U+5fa9,U+5fab-5fac,U+5faf-5fb4,U+5fb6,U+5fb8-5fbb,U+5fbe-5fc2,U+5fc7-5fc8,U+5fca-5fcb,U+5fce,U+5fd3-5fd5,U+5fda-5fdc,U+5fde-5fdf,U+5fe2-5fe3,U+5fe5-5fe6,U+5fe8-5fe9,U+5fec,U+5fef-5ff0,U+5ff2-5ff4,U+5ff6-5ff7,U+5ff9-5ffa,U+5ffc,U+6007-6009,U+600b-600c,U+6010-6011,U+6013,U+6017-6018,U+601a,U+601e-601f,U+6022-6024,U+602c-602e,U+6030-6034,U+6036-603a,U+603d-603e,U+6040,U+6044-604a,U+604c,U+604e-604f,U+6051,U+6053-6054,U+6056-6058,U+605b-605c,U+605e-6061,U+6065-6066,U+606e,U+6071-6072,U+6074-6075,U+6077,U+607e,U+6080-6082,U+6085-6088,U+608a-608b,U+608e-6091,U+6093,U+6095,U+6097-6099,U+609c,U+609e,U+60a1-60a2,U+60a4-60a5,U+60a7,U+60a9-60aa,U+60ae,U+60b0,U+60b3,U+60b5-60b7,U+60b9-60ba,U+60bd-60c4,U+60c7-60c9,U+60cc"}},{uri:Kse,descriptors:{unicodeRange:"U+635a-635d,U+6360,U+6364-6366,U+6368,U+636a-636c,U+636f-6370,U+6372-6375,U+6378-6379,U+637c-637f,U+6381,U+6383-6386,U+638b,U+638d,U+6391,U+6393-6395,U+6397,U+6399-639f,U+63a1,U+63a4,U+63a6,U+63ab,U+63af,U+63b1-63b2,U+63b5-63b6,U+63b9,U+63bb,U+63bd,U+63bf-63c3,U+63c5,U+63c7-63c8,U+63ca-63cc,U+63d1,U+63d3-63d5,U+63d7-63dd,U+63df,U+63e2,U+63e4-63e8,U+63eb-63ec,U+63ee-63f1,U+63f3,U+63f5,U+63f7,U+63f9-63fc,U+63fe,U+6403-6404,U+6406-640a,U+640d-640e,U+6411-6412,U+6415-641a,U+641d,U+641f,U+6422-6425,U+6427-6429,U+642b,U+642e-6433,U+6435-6439,U+643b-643c,U+643e,U+6440,U+6442-6443,U+6449,U+644b-6451,U+6453,U+6455-6457,U+6459-645d,U+645f-6466,U+6468,U+646a-646c,U+646e-6477,U+647b-6481,U+6483,U+6486,U+6488-648f"}},{uri:Zse,descriptors:{unicodeRange:"U+61c5-61c7,U+61c9,U+61cc-61d0,U+61d3,U+61d5-61e5,U+61e7-61f4,U+61f6-61fe,U+6200-6205,U+6207,U+6209,U+6213-6214,U+6219,U+621c-621e,U+6220,U+6223,U+6226-6229,U+622b,U+622d,U+622f-6232,U+6235-6236,U+6238-623c,U+6242,U+6244-6246,U+624a,U+624f-6250,U+6255-6257,U+6259-625a,U+625c-6262,U+6264-6265,U+6268,U+6271-6272,U+6274-6275,U+6277-6278,U+627a-627b,U+627d,U+6281-6283,U+6285-6288,U+628b-6290,U+6294,U+6299,U+629c-629e,U+62a3,U+62a6-62a7,U+62a9-62aa,U+62ad-62b0,U+62b2-62b4,U+62b6-62b8,U+62ba,U+62be,U+62c0-62c1,U+62c3,U+62cb,U+62cf,U+62d1,U+62d5,U+62dd-62de,U+62e0-62e1,U+62e4,U+62ea-62eb,U+62f0,U+62f2,U+62f5,U+62f8-62fb,U+6300,U+6303-6306,U+630a-630d,U+630f-6310,U+6312-6315,U+6317-6319,U+631c,U+6326-6327,U+6329,U+632c-632e,U+6330-6331,U+6333-6338,U+633b-633c,U+633e-6341,U+6344,U+6347-6348,U+634a,U+6351-6354,U+6356-6359"}},{uri:qse,descriptors:{unicodeRange:"U+5dd0-5dda,U+5ddc,U+5ddf-5de0,U+5de3-5de4,U+5dea,U+5dec-5ded,U+5df0,U+5df5-5df6,U+5df8-5dfc,U+5dff-5e00,U+5e04,U+5e07,U+5e09-5e0b,U+5e0d-5e0e,U+5e12-5e13,U+5e17,U+5e1e-5e25,U+5e28-5e2c,U+5e2f-5e30,U+5e32-5e36,U+5e39-5e3a,U+5e3e-5e41,U+5e43,U+5e46-5e4b,U+5e4d-5e53,U+5e56-5e5a,U+5e5c-5e5d,U+5e5f-5e60,U+5e63-5e71,U+5e75,U+5e77,U+5e79,U+5e7e,U+5e81-5e83,U+5e85,U+5e88-5e89,U+5e8c-5e8e,U+5e92,U+5e98,U+5e9b,U+5e9d,U+5ea1-5ea4,U+5ea8-5eac,U+5eae-5eb2,U+5eb4,U+5eba-5ebd,U+5ebf-5ec8,U+5ecb-5ed0,U+5ed4-5ed5,U+5ed7-5eda,U+5edc-5ee7,U+5ee9,U+5eeb-5ef3,U+5ef5,U+5ef8-5ef9,U+5efb-5efd,U+5f05-5f07,U+5f09,U+5f0c-5f0e,U+5f10,U+5f12,U+5f14,U+5f16,U+5f19-5f1a,U+5f1c-5f1e,U+5f21-5f24,U+5f28,U+5f2b-5f2c,U+5f2e"}},{uri:Qse,descriptors:{unicodeRange:"U+60cd-60d0,U+60d2-60d4,U+60d6-60d7,U+60d9,U+60db,U+60de,U+60e1-60e5,U+60ea,U+60f1-60f2,U+60f5,U+60f7-60f8,U+60fb-60ff,U+6102-6105,U+6107,U+610a-610c,U+6110-6114,U+6116-6119,U+611b-611e,U+6121-6122,U+6125,U+6128-612a,U+612c-613e,U+6140-6147,U+6149,U+614b,U+614d,U+614f-6150,U+6152-6154,U+6156-615c,U+615e-6161,U+6163-6166,U+6169-616f,U+6171-6174,U+6176,U+6178-618a,U+618c-618d,U+618f-6193,U+6195-619c,U+619e-61a6,U+61aa-61ab,U+61ad-61b6,U+61b8-61bd,U+61bf-61c1,U+61c3-61c4"}},{uri:Jse,descriptors:{unicodeRange:"U+5cf4-5cfa,U+5cfc-5d01,U+5d04-5d05,U+5d08-5d0d,U+5d0f-5d13,U+5d15,U+5d17-5d1a,U+5d1c-5d1d,U+5d1f-5d23,U+5d25,U+5d28,U+5d2a-5d2c,U+5d2f-5d33,U+5d35-5d3c,U+5d3f-5d46,U+5d48-5d49,U+5d4d-5d57,U+5d59-5d5a,U+5d5c,U+5d5e-5d68,U+5d6a,U+5d6d-5d6e,U+5d70-5d73,U+5d75-5d81,U+5d83-5d98,U+5d9a-5d9c,U+5d9e-5db6,U+5db8-5dc4,U+5dc6-5dcc,U+5dce-5dcf"}},{uri:eoe,descriptors:{unicodeRange:"U+5b52,U+5b56,U+5b5e,U+5b60-5b61,U+5b67-5b68,U+5b6b,U+5b6d-5b6f,U+5b72,U+5b74,U+5b76-5b79,U+5b7b-5b7c,U+5b7e-5b7f,U+5b82,U+5b86,U+5b8a,U+5b8d-5b8e,U+5b90-5b92,U+5b94,U+5b96,U+5b9f,U+5ba7-5ba9,U+5bac-5baf,U+5bb1-5bb2,U+5bb7,U+5bba-5bbc,U+5bc0-5bc1,U+5bc3,U+5bc8-5bcb,U+5bcd-5bcf,U+5bd1,U+5bd4-5bdc,U+5be0,U+5be2-5be3,U+5be6-5be7,U+5be9-5bed,U+5bef,U+5bf1-5bf7,U+5bfd-5bfe,U+5c00,U+5c02-5c03,U+5c05,U+5c07-5c08,U+5c0b-5c0e,U+5c10,U+5c12-5c13,U+5c17,U+5c19,U+5c1b,U+5c1e-5c21,U+5c23,U+5c26,U+5c28-5c2b,U+5c2d-5c30,U+5c32-5c33,U+5c35-5c37,U+5c43-5c44,U+5c46-5c47,U+5c4c-5c4d,U+5c52-5c54,U+5c56-5c58,U+5c5a-5c5d,U+5c5f,U+5c62,U+5c64,U+5c67-5c6d,U+5c70,U+5c72-5c78,U+5c7b-5c7e,U+5c80,U+5c83-5c87,U+5c89-5c8b,U+5c8e-5c8f,U+5c92-5c93,U+5c95,U+5c9d-5ca1,U+5ca4-5ca8,U+5caa,U+5cae-5cb0,U+5cb2,U+5cb4,U+5cb6,U+5cb9-5cbc,U+5cbe,U+5cc0,U+5cc2-5cc3,U+5cc5-5cca,U+5ccc-5cd1,U+5cd3-5cd8,U+5cda-5ce0,U+5ce2-5ce3,U+5ce7,U+5ce9,U+5ceb-5cec,U+5cee-5cef,U+5cf1-5cf3"}},{uri:toe,descriptors:{unicodeRange:"U+593b,U+593d-5940,U+5943,U+5945-5946,U+594a,U+594c-594d,U+5950,U+5952-5953,U+5959,U+595b-595f,U+5961,U+5963-5964,U+5966-5972,U+5975,U+5977,U+597a-597c,U+597e-5980,U+5985,U+5989,U+598b-598c,U+598e-5991,U+5994-5995,U+5998,U+599a-599d,U+599f-59a2,U+59a6-59a7,U+59ac-59ad,U+59b0-59b1,U+59b3-59b8,U+59ba,U+59bc-59bd,U+59bf-59c5,U+59c7-59c9,U+59cc-59cf,U+59d5-59d6,U+59d9,U+59db,U+59de-59e2,U+59e4,U+59e6-59e7,U+59e9-59eb,U+59ed-59f8,U+59fa,U+59fc-59fe,U+5a00,U+5a02,U+5a0a-5a0b,U+5a0d-5a10,U+5a12,U+5a14-5a17,U+5a19-5a1b,U+5a1d-5a1e,U+5a21-5a22,U+5a24,U+5a26-5a28,U+5a2a-5a30,U+5a33,U+5a35,U+5a37-5a3b,U+5a3d-5a3f,U+5a41-5a45,U+5a47-5a48,U+5a4b-5a54,U+5a56-5a59,U+5a5b-5a61,U+5a63-5a66,U+5a68-5a69,U+5a6b-5a73,U+5a78-5a79,U+5a7b-5a7e,U+5a80-5a90"}},{uri:noe,descriptors:{unicodeRange:"U+5a91,U+5a93-5a99,U+5a9c-5aa9,U+5aab-5ab1,U+5ab4,U+5ab6-5ab7,U+5ab9-5abd,U+5abf-5ac0,U+5ac3-5ac8,U+5aca-5acb,U+5acd-5ad1,U+5ad3,U+5ad5,U+5ad7,U+5ad9-5adb,U+5add-5adf,U+5ae2,U+5ae4-5ae5,U+5ae7-5ae8,U+5aea,U+5aec-5af0,U+5af2-5b08,U+5b0a-5b15,U+5b18-5b31,U+5b33,U+5b35-5b36,U+5b38-5b3f,U+5b41-5b4f"}},{uri:ioe,descriptors:{unicodeRange:"U+5843,U+5845-584b,U+584e-5850,U+5852-5853,U+5855-5857,U+5859-585d,U+585f-5864,U+5866-586a,U+586d-587d,U+587f,U+5882,U+5884,U+5886-5888,U+588a-5891,U+5894-5898,U+589b-589d,U+58a0-58a7,U+58aa-58bb,U+58bd-58c0,U+58c2-58c4,U+58c6-58d0,U+58d2-58d4,U+58d6-58e3,U+58e5-58ea,U+58ed,U+58ef,U+58f1-58f2,U+58f4-58f5,U+58f7-58f8,U+58fa-5901,U+5903,U+5905-5906,U+5908-590c,U+590e,U+5910-5913,U+5917-5918,U+591b,U+591d-591e,U+5920-5923,U+5926,U+5928,U+592c,U+5930,U+5932-5933,U+5935-5936"}},{uri:roe,descriptors:{unicodeRange:"U+56d0-56d3,U+56d5-56d6,U+56d8-56d9,U+56dc,U+56e3,U+56e5-56ea,U+56ec,U+56ee-56ef,U+56f2-56f3,U+56f6-56f8,U+56fb-56fc,U+5700-5702,U+5705,U+5707,U+570b-571b,U+571d-571e,U+5720-5722,U+5724-5727,U+572b,U+5731-5732,U+5734-5738,U+573c-573d,U+573f,U+5741,U+5743-5746,U+5748-5749,U+574b,U+5752-5756,U+5758-5759,U+5762-5763,U+5765,U+5767,U+576c,U+576e,U+5770-5772,U+5774-5775,U+5778-577a,U+577d-5781,U+5787-578a,U+578d-5791,U+5794-579a,U+579c-579f,U+57a5,U+57a8,U+57aa,U+57ac,U+57af-57b1,U+57b3,U+57b5-57b7,U+57b9-57c1,U+57c4-57ca,U+57cc-57cd,U+57d0-57d1,U+57d3,U+57d6-57d7,U+57db-57dc,U+57de,U+57e1-57e3,U+57e5-57ec,U+57ee,U+57f0-57f3,U+57f5-57f7,U+57fb-57fc,U+57fe-57ff,U+5801,U+5803-5805,U+5808-580a,U+580c,U+580e-5810,U+5812-5814,U+5816-5818,U+581a-581d,U+581f,U+5822-5823,U+5825-5829,U+582b-582f,U+5831-5834,U+5836-5842"}},{uri:soe,descriptors:{unicodeRange:"U+55f9-55fc,U+55ff,U+5602-5607,U+560a-560b,U+560d,U+5610-5617,U+5619-561a,U+561c-561d,U+5620-5622,U+5625-5626,U+5628-562b,U+562e-5630,U+5633,U+5635,U+5637-5638,U+563a,U+563c-563e,U+5640-564b,U+564f-5653,U+5655-5656,U+565a-565b,U+565d-5661,U+5663,U+5665-5667,U+566d-5670,U+5672-5675,U+5677-567a,U+567d-5684,U+5687-568d,U+5690-5692,U+5694-56a2,U+56a4-56ae,U+56b0-56b6,U+56b8-56bb,U+56bd-56c9,U+56cb-56cf"}},{uri:ooe,descriptors:{unicodeRange:"U+5286-5287,U+5289-528f,U+5291-5292,U+5294-529a,U+529c,U+52a4-52a7,U+52ae-52b0,U+52b4-52bd,U+52c0-52c2,U+52c4-52c6,U+52c8,U+52ca,U+52cc-52cf,U+52d1,U+52d3-52d5,U+52d7,U+52d9-52de,U+52e0-52e3,U+52e5-52ef,U+52f1-52f8,U+52fb-52fd,U+5301-5304,U+5307,U+5309-530c,U+530e,U+5311-5314,U+5318,U+531b-531c,U+531e-531f,U+5322,U+5324-5325,U+5327-5329,U+532b-532d,U+532f-5338,U+533c-533d,U+5340,U+5342,U+5344,U+5346,U+534b-534d,U+5350,U+5354,U+5358-5359,U+535b,U+535d,U+5365,U+5368,U+536a,U+536c-536d,U+5372,U+5376,U+5379,U+537b-537e,U+5380-5381,U+5383,U+5387-5388,U+538a,U+538e-5394,U+5396-5397,U+5399,U+539b-539c,U+539e,U+53a0-53a1,U+53a4,U+53a7,U+53aa-53ad,U+53af-53b5,U+53b7-53ba,U+53bc-53be,U+53c0,U+53c3-53c7,U+53ce-53d0,U+53d2-53d3,U+53d5,U+53da,U+53dc-53de,U+53e1-53e2,U+53e7,U+53f4,U+53fa,U+53fe-5400,U+5402,U+5405,U+5407,U+540b,U+5414,U+5418-541a,U+541c,U+5422,U+5424-5425,U+542a,U+5430,U+5433,U+5436-5437,U+543a"}},{uri:aoe,descriptors:{unicodeRange:"U+5101-5105,U+5108-510a,U+510c-5111,U+5113-5120,U+5122-513e,U+5142,U+5147,U+514a,U+514c,U+514e-5150,U+5152-5153,U+5157-5159,U+515b,U+515d-5161,U+5163-5164,U+5166-5167,U+5169-516a,U+516f,U+5172,U+517a,U+517e-517f,U+5183-5184,U+5186-5187,U+518a-518b,U+518e-5191,U+5193-5194,U+5198,U+519a,U+519d-519f,U+51a1,U+51a3,U+51a6-51aa,U+51ad-51ae,U+51b4,U+51b8-51ba,U+51be-51bf,U+51c1-51c3,U+51c5,U+51c8,U+51ca,U+51cd-51ce,U+51d0,U+51d2-51da,U+51dc,U+51de-51df,U+51e2-51e3,U+51e5-51ea,U+51ec,U+51ee,U+51f1-51f2,U+51f4,U+51f7,U+51fe,U+5204-5205,U+5209,U+520b-520c,U+520f-5210,U+5213-5215,U+521c,U+521e-521f,U+5221-5223,U+5225-5227,U+522a,U+522c,U+522f,U+5231-5232,U+5234-5235,U+523c,U+523e,U+5244-5249,U+524b,U+524e-524f,U+5252-5253,U+5255,U+5257-525b,U+525d,U+525f-5260,U+5262-5264,U+5266,U+5268,U+526b-526e,U+5270-5271,U+5273-527c,U+527e,U+5280,U+5283-5285"}},{uri:loe,descriptors:{unicodeRange:"U+543d,U+543f,U+5441-5442,U+5444-5445,U+5447,U+5449,U+544c-544f,U+5451,U+545a,U+545d-5461,U+5463,U+5465,U+5467,U+5469-5470,U+5474,U+5479-547a,U+547e-547f,U+5481,U+5483,U+5485,U+5487-548a,U+548d,U+5491,U+5493,U+5497-5498,U+549c,U+549e-54a2,U+54a5,U+54ae,U+54b0,U+54b2,U+54b5-54b7,U+54b9-54ba,U+54bc,U+54be,U+54c3,U+54c5,U+54ca-54cb,U+54d6,U+54d8,U+54db,U+54e0-54e4,U+54eb-54ec,U+54ef-54f1,U+54f4-54f9,U+54fb,U+54fe,U+5500,U+5502-5505,U+5508,U+550a-550e,U+5512-5513,U+5515-551a,U+551c-551f,U+5521,U+5525-5526,U+5528-5529,U+552b,U+552d,U+5532,U+5534-5536,U+5538-553b,U+553d,U+5540,U+5542,U+5545,U+5547-5548,U+554b-554f,U+5551-5554,U+5557-555b,U+555d-5560,U+5562-5563,U+5568-5569,U+556b,U+556f-5574,U+5579-557a,U+557d,U+557f,U+5585-5586,U+558c-558e,U+5590,U+5592-5593,U+5595-5597,U+559a-559b,U+559e,U+55a0-55a6,U+55a8-55b0,U+55b2,U+55b4,U+55b6,U+55b8,U+55ba,U+55bc,U+55bf-55c3,U+55c6-55c8,U+55ca-55cb,U+55ce-55d0,U+55d5,U+55d7-55db,U+55de,U+55e0,U+55e2,U+55e7,U+55e9,U+55ed-55ee,U+55f0-55f1,U+55f4,U+55f6,U+55f8"}},{uri:coe,descriptors:{unicodeRange:"U+4fe0,U+4fe2,U+4fe4-4fe5,U+4fe7,U+4feb-4fec,U+4ff0,U+4ff2,U+4ff4-4ff7,U+4ff9,U+4ffb-4ffd,U+4fff-500b,U+500e,U+5010-5011,U+5013,U+5015-5017,U+501b,U+501d-501e,U+5020,U+5022-5024,U+5027,U+502b,U+502f-5039,U+503b,U+503d,U+503f-5042,U+5044-5046,U+5049-504b,U+504d,U+5050-5054,U+5056-5059,U+505b,U+505d-5064,U+5066-506b,U+506d-5075,U+5078-507a,U+507c-507d,U+5081-5084,U+5086-5087,U+5089-508c,U+508e-50a2,U+50a4,U+50a6,U+50aa-50ab,U+50ad-50b1,U+50b3-50b9,U+50bc-50ce,U+50d0-50d5,U+50d7-50d9,U+50db-50e5,U+50e8-50eb,U+50ef-50f2,U+50f4,U+50f6-50fa,U+50fc-5100"}},{uri:uoe,descriptors:{unicodeRange:"U+49d5-4a77"}},{uri:doe,descriptors:{unicodeRange:"U+4dac-4dad,U+4daf-4db5,U+4e02,U+4e04-4e06,U+4e0f,U+4e12,U+4e17,U+4e1f-4e21,U+4e23,U+4e26,U+4e29,U+4e2e-4e2f,U+4e31,U+4e33,U+4e35,U+4e37,U+4e3c,U+4e40-4e42,U+4e44,U+4e46,U+4e4a,U+4e51,U+4e55,U+4e57,U+4e5a-4e5b,U+4e62-4e65,U+4e67-4e68,U+4e6a-4e6f,U+4e72,U+4e74-4e7d,U+4e7f-4e85,U+4e87,U+4e8a,U+4e90,U+4e96-4e97,U+4e99,U+4e9c-4e9e,U+4ea3,U+4eaa,U+4eaf-4eb1,U+4eb4,U+4eb6-4eb9,U+4ebc-4ebe,U+4ec8,U+4ecc,U+4ecf-4ed0,U+4ed2,U+4eda-4edc,U+4ee0,U+4ee2,U+4ee6-4ee7,U+4ee9,U+4eed-4eef,U+4ef1,U+4ef4,U+4ef8-4efa,U+4efc,U+4efe,U+4f00,U+4f02-4f08,U+4f0b-4f0c,U+4f12-4f16,U+4f1c-4f1d,U+4f21,U+4f23,U+4f28-4f29,U+4f2c-4f2e,U+4f31,U+4f33,U+4f35,U+4f37,U+4f39,U+4f3b,U+4f3e-4f42,U+4f44-4f45,U+4f47-4f4c,U+4f52,U+4f54,U+4f56,U+4f61-4f62,U+4f66,U+4f68,U+4f6a-4f6b,U+4f6d-4f6e,U+4f71-4f72,U+4f75,U+4f77-4f7a,U+4f7d,U+4f80-4f82,U+4f85-4f87,U+4f8a,U+4f8c,U+4f8e,U+4f90,U+4f92-4f93,U+4f95-4f96,U+4f98-4f9a,U+4f9c,U+4f9e-4f9f,U+4fa1-4fa2,U+4fa4,U+4fab,U+4fad,U+4fb0-4fb4,U+4fb6-4fbe,U+4fc0-4fc2,U+4fc6-4fc9,U+4fcb-4fcd,U+4fd2-4fd6,U+4fd9,U+4fdb"}},{uri:foe,descriptors:{unicodeRange:"U+4933-49d4"}},{uri:hoe,descriptors:{unicodeRange:"U+487a-4932"}},{uri:goe,descriptors:{unicodeRange:"U+47d2-4879,U+2ce7c,U+2ce88,U+2ce93"}},{uri:moe,descriptors:{unicodeRange:"U+4756-47d1,U+2ca02,U+2ca0e,U+2ca7d,U+2caa9,U+2cb29,U+2cb2e,U+2cb31,U+2cb38-2cb39,U+2cb3f,U+2cb41,U+2cb4e,U+2cb5a,U+2cb64,U+2cb69,U+2cb6c,U+2cb6f,U+2cb76,U+2cb78,U+2cb7c,U+2cbb1,U+2cbbf-2cbc0,U+2cbce,U+2cc5f,U+2ccf5-2ccf6,U+2ccfd,U+2ccff,U+2cd02-2cd03,U+2cd0a,U+2cd8b,U+2cd8d,U+2cd8f-2cd90,U+2cd9f-2cda0,U+2cda8,U+2cdad-2cdae,U+2cdd5,U+2ce18,U+2ce1a,U+2ce23,U+2ce26,U+2ce2a"}},{uri:poe,descriptors:{unicodeRange:"U+46c3-4755,U+2c488,U+2c494,U+2c497,U+2c542,U+2c613,U+2c618,U+2c621,U+2c629,U+2c62b-2c62d,U+2c62f,U+2c642,U+2c64a-2c64b,U+2c72c,U+2c72f,U+2c79f,U+2c7c1,U+2c7fd,U+2c8d9,U+2c8de,U+2c8e1,U+2c8f3,U+2c907,U+2c90a,U+2c91d"}},{uri:Uoe,descriptors:{unicodeRange:"U+4629-46c2,U+2bdf7,U+2be29,U+2c029-2c02a,U+2c0a9,U+2c0ca,U+2c1d5,U+2c1d9,U+2c1f9,U+2c27c,U+2c288,U+2c2a4,U+2c317,U+2c35b,U+2c361,U+2c364"}},{uri:boe,descriptors:{unicodeRange:"U+458e-4628,U+2b7a9,U+2b7c5,U+2b7e6,U+2b7f9,U+2b806,U+2b80a,U+2b81c,U+2b8b8,U+2bac7,U+2bb5f,U+2bb62,U+2bb7c,U+2bb83,U+2bc1b,U+2bd77,U+2bd87"}},{uri:yoe,descriptors:{unicodeRange:"U+4449-4511,U+2afa2,U+2b127-2b128,U+2b137-2b138,U+2b1ed"}},{uri:Eoe,descriptors:{unicodeRange:"U+439b-4448,U+2a437,U+2a5f1,U+2a602,U+2a61a,U+2a6b2,U+2a7dd,U+2a8fb,U+2a917,U+2aa30,U+2aa36,U+2aa58"}},{uri:voe,descriptors:{unicodeRange:"U+4275-430d,U+298c6,U+29a72,U+29d98,U+29ddb,U+29e15,U+29e3d,U+29e49"}},{uri:_oe,descriptors:{unicodeRange:"U+4132-41de,U+28bef,U+28c47,U+28c4f,U+28c51,U+28c54,U+28d10,U+28d71,U+28dfb,U+28e1f,U+28e36,U+28e89,U+28e99,U+28eeb,U+28f32,U+28ff8,U+292a0"}},{uri:woe,descriptors:{unicodeRange:"U+41df-4274,U+292b1,U+29490,U+295cf,U+2967f,U+296f0,U+29719,U+29750"}},{uri:Toe,descriptors:{unicodeRange:"U+408e-4131,U+285c8-285c9,U+28678,U+28695,U+286d7,U+286fa,U+287e0,U+28946,U+28949,U+2896b,U+28987-28988,U+289ba-289bb,U+28a1e,U+28a29,U+28a43,U+28a71,U+28a99,U+28acd,U+28add,U+28ae4,U+28b49,U+28bc1"}},{uri:Soe,descriptors:{unicodeRange:"U+3e83-3f2f,U+27139,U+273da-273db,U+273fe,U+27410,U+27449,U+27614-27615,U+27631,U+27684,U+27693,U+2770e,U+27723,U+27752"}},{uri:Ioe,descriptors:{unicodeRange:"U+3f30-3fdb,U+27985,U+27a84,U+27bb3,U+27bbe,U+27bc7,U+27cb8,U+27da0,U+27e10"}},{uri:xoe,descriptors:{unicodeRange:"U+3fdc-408d,U+27fb7,U+27ff9,U+2808a,U+280bb,U+2815d,U+28277,U+28282,U+282e2,U+282f3,U+283cd,U+28408,U+2840c,U+28455,U+28468,U+2856b"}},{uri:Coe,descriptors:{unicodeRange:"U+3dd2-3e82,U+26a58,U+26a8c,U+26ab7,U+26aff,U+26b5c,U+26c21,U+26c29,U+26c73,U+26cdd,U+26e40,U+26e65,U+26f94,U+26ff6-26ff8,U+270f4,U+2710d"}},{uri:Aoe,descriptors:{unicodeRange:"U+3d34-3dd1,U+2648d,U+26676,U+2667e,U+266b0,U+2671d,U+2677c,U+267cc,U+268dd,U+268ea,U+26951,U+2696f,U+269dd,U+269fa,U+26a1e"}},{uri:Moe,descriptors:{unicodeRange:"U+3c76-3d33,U+25d0a,U+25da1,U+25e2e,U+25e56,U+25e62,U+25e65,U+25ec2,U+25ed7-25ed8,U+25ee8,U+25f23,U+25f5c,U+25fd4,U+25fe0,U+25ffb,U+2600c,U+26017,U+26060,U+260ed,U+26221,U+26270,U+26286,U+2634c,U+26402"}},{uri:Roe,descriptors:{unicodeRange:"U+3bda-3c75,U+25771,U+257a9,U+257b4,U+259c4,U+259d4,U+25ae3-25ae4,U+25af1,U+25bb2,U+25c14,U+25c4b,U+25c64"}},{uri:koe,descriptors:{unicodeRange:"U+3b25-3bd9,U+2504a,U+25055,U+25122,U+2512b,U+251a9,U+251cd,U+251e5,U+2521e,U+2524c,U+2542e,U+2548e,U+254d9,U+2550e,U+25532,U+25562,U+255a7-255a8"}},{uri:Loe,descriptors:{unicodeRange:"U+3a6b-3b24,U+24896,U+249db,U+24a4d,U+24a7d,U+24ac9,U+24b56,U+24b6f,U+24c16,U+24d14,U+24dea,U+24e0e,U+24e37,U+24e6a,U+24e8b,U+24eaa"}},{uri:Doe,descriptors:{unicodeRange:"U+39a9-3a6a,U+24096,U+24103,U+241ac,U+241c6,U+241fe,U+243bc,U+243f8,U+244d3,U+24629,U+246a5,U+247f1"}},{uri:Noe,descriptors:{unicodeRange:"U+38e3-39a8,U+23a98,U+23c7f,U+23c97-23c98,U+23cfe,U+23d00,U+23d0e,U+23d40,U+23dd3,U+23df9-23dfa,U+23e23,U+23f7e"}},{uri:Ooe,descriptors:{unicodeRange:"U+3760-382a,U+22ab8,U+22b43,U+22b46,U+22b4f-22b50,U+22ba6,U+22bca,U+22c1d,U+22c24,U+22c55,U+22d4c,U+22de1"}},{uri:Poe,descriptors:{unicodeRange:"U+382b-38e2,U+231b6,U+231c3-231c4,U+231f5,U+23350,U+23372,U+233d0,U+233d2-233d3,U+233d5,U+233da,U+233df,U+233e4,U+2344a-2344b,U+23451,U+23465,U+234e4,U+2355a,U+23594,U+235c4,U+235cb,U+23638-2363a,U+23647,U+2370c,U+2371c,U+2373f,U+23763-23764,U+237e7,U+237ff,U+23824,U+2383d"}},{uri:Foe,descriptors:{unicodeRange:"U+3698-375f,U+22218,U+2231e,U+223ad,U+224dc,U+226f3,U+2285b,U+228ab,U+2298f"}},{uri:Boe,descriptors:{unicodeRange:"U+35e6-3697,U+21c56,U+21cde,U+21d2d,U+21d45,U+21d62,U+21d78,U+21d92,U+21d9c,U+21da1,U+21db7,U+21de0,U+21e33-21e34,U+21f1e,U+21f76,U+21ffa,U+2217b"}},{uri:zoe,descriptors:{unicodeRange:"U+3444-350e,U+20ad3,U+20b1d,U+20b9f,U+20c41,U+20cbf,U+20cd0,U+20d45,U+20de1,U+20e64,U+20e6d,U+20e95,U+20e9d,U+20ea2,U+20f5f,U+210c1,U+21201,U+2123d,U+21255,U+21274,U+2127b"}},{uri:Hoe,descriptors:{unicodeRange:"U+350f-35e5,U+212d7,U+212e4,U+212fd,U+2131b,U+21336,U+21344,U+2139a,U+213c4,U+21413,U+2146d-2146e,U+215d7,U+21647,U+216b4,U+21706,U+21742,U+218bd,U+219c3"}},{uri:Voe,descriptors:{unicodeRange:"U+336d-3443,U+2032b,U+20371,U+20381,U+203f9,U+2044a,U+20509,U+20547,U+205d6,U+20628,U+20676,U+2074f,U+20779,U+20807,U+2083a,U+20895,U+208b9,U+2097c,U+2099d"}},{uri:$oe,descriptors:{unicodeRange:"U+328b-336c,U+2000b,U+20089,U+200a2,U+200a4,U+20164,U+201a2,U+20213"}},{uri:Goe,descriptors:{unicodeRange:"U+3192-31ba,U+31c0-31e3,U+31f0-321e,U+3220-328a,U+1f250-1f251"}},{uri:Xoe,descriptors:{unicodeRange:"U+2f74-2fd5,U+3000,U+3003-3007,U+3012-3013,U+3018-301c,U+3020-3029,U+302f-303f,U+3041-3096,U+3099-30a1"}},{uri:joe,descriptors:{unicodeRange:"U+30a2-30ff,U+3105-312f,U+3131-318e,U+3190-3191"}},{uri:Yoe,descriptors:{unicodeRange:"U+4e36,U+4ea0,U+4f74,U+4f91,U+4f94,U+4fc5,U+507e,U+50ed,U+5182,U+51f5,U+525e,U+5282,U+52f9,U+5326,U+537a,U+53a3,U+5423,U+5459,U+54b4,U+54d9,U+55c9,U+57f4,U+580b,U+5902,U+5925,U+5a08,U+5ab5,U+5b84,U+5be4,U+5c22,U+5cb5,U+5cbd,U+5d3e,U+5e31,U+5e5e,U+5e80,U+5ee8,U+5f82,U+5fc9,U+5fed,U+600a,U+605d,U+609b,U+609d,U+60dd,U+6243,U+6322,U+63ce,U+640c,U+643f,U+6445,U+64d7,U+6534,U+6549,U+656b,U+6603,U+674c,U+680a,U+6864,U+69d4,U+6a65,U+6c2a,U+6c46,U+6c5c,U+6d0e,U+6d48,U+6e2b,U+6eb2,U+6eb7,U+6f89,U+706c,U+70b1,U+7113,U+71d4,U+727f,U+72f3,U+7303,U+7321,U+736c,U+736f,U+74a9,U+74de,U+750d,U+7513,U+7592,U+75c4,U+7605,U+760a,U+761b,U+7625,U+762d,U+7643,U+7707,U+7747,U+77b5,U+7839,U+784e,U+78a5,U+7924,U+793b,U+798a,U+7a03,U+7a06,U+7a78,U+7a80,U+7aad,U+7ba8,U+7be5,U+7cc8,U+7ec1,U+7f0b,U+7f0f,U+7f12,U+7f68,U+7f9d,U+8025,U+809c,U+80ad,U+80b7,U+80e8,U+811e,U+8204,U+8223,U+822d,U+823b,U+824b,U+825a,U+827d,U+827f,U+828f,U+82c8,U+8307,U+831b,U+8347,U+837d,U+839b,U+83a9,U+83f9,U+84b9,U+8579,U+864d,U+867f,U+86b0,U+86d1,U+86d8,U+86f2,U+8764,U+8770,U+8788,U+8797,U+87ac-87ad,U+87b5,U+881b,U+8844,U+88bc,U+88fc,U+8930,U+89cf,U+89d6,U+8ba0,U+8bd4,U+8c02,U+8c2b,U+8c85,U+8e23,U+8f81-8f82,U+8fd5,U+90b6,U+90db,U+914e,U+9164,U+91ad,U+943e,U+94b7-94b8,U+94eb,U+950d,U+9514,U+9516,U+9518,U+9529,U+9538,U+953f,U+954e,U+955f,U+95fc,U+9667,U+96b3,U+9792,U+97b2,U+98a1,U+9969,U+9987,U+9998,U+9a80,U+9a92,U+9a96,U+9adf,U+9cb4,U+9cbd,U+9cd0,U+9cd4,U+9e31,U+9e3a,U+9e71,U+9ee5,U+9eea,U+9ef9,U+9fa0"}},{uri:Woe,descriptors:{unicodeRange:"U+4e0c,U+4e28,U+4e3f,U+4ec2,U+502e,U+50ba,U+5155,U+5181,U+522d,U+5281,U+5290,U+5369,U+53b6,U+54d5,U+54dc,U+54ff,U+552a,U+553c,U+5588,U+55b5,U+5686,U+570a,U+5776,U+5786,U+57a4,U+5820,U+5865,U+58bc,U+5b32,U+5b65,U+5c1c,U+5c66,U+5c6e,U+5c8d,U+5ddb,U+5f2a,U+5f50,U+5f61,U+6067,U+614a,U+615d,U+619d,U+61d4,U+620b,U+6224-6225,U+6343,U+63ad,U+63f2,U+640b,U+6420,U+6434,U+6496,U+64d0,U+6509,U+652e,U+67a8,U+6833,U+6844,U+684a,U+6920,U+6957,U+6971,U+6a8e,U+6a91,U+6aa0,U+6b43,U+6bea,U+6bf5,U+6c15,U+6cd0,U+6ee0,U+6f24,U+6f2d,U+70c0,U+721d,U+728b,U+72c3,U+72e8,U+730a,U+7338-7339,U+734d,U+746d,U+752f,U+754e,U+770d,U+7735,U+778d,U+77a2,U+77e7,U+7857,U+786d,U+78c9,U+78f2,U+791e,U+7953,U+7b58,U+7b9d,U+7bda,U+7cd7,U+7f32-7f33,U+8022,U+8028-8029,U+8035,U+804d,U+8080,U+80c2,U+80e9,U+80ec,U+80f2,U+810e,U+8221,U+8274,U+82b0,U+82e0,U+83b0,U+8487-8488,U+848e,U+84cd,U+84d0,U+8539,U+857a,U+85a8,U+85b7,U+867c,U+871e,U+8723,U+877e,U+878b,U+8793,U+8803,U+88d2,U+8966,U+89cc,U+89eb,U+8b26,U+8c8a,U+8c98,U+8d33,U+8d47,U+8d55,U+8dbc,U+8e40,U+8e94,U+8f77,U+8f79,U+9058,U+91a2,U+91b5,U+928e,U+9494,U+94b6,U+94de,U+94f4,U+94f9,U+950a,U+950e,U+951e,U+952b,U+953c,U+953e,U+9544,U+9561,U+9564,U+9569,U+95f6,U+9603,U+960d,U+963d,U+9674,U+9794,U+97ab,U+98a5,U+9a9f,U+9ab1,U+9ad1,U+9b0f,U+9b2f,U+9c92,U+9c95,U+9cba,U+9cbc,U+9cc6,U+9ccb,U+9cd8,U+9e32,U+9e38,U+9e5b,U+9e7e,U+9eb4,U+9efb-9efc,U+9f3d"}},{uri:Koe,descriptors:{unicodeRange:"U+2e3b,U+2e80-2e99,U+2e9b-2ef3,U+2f00-2f73,U+ffffd"}},{uri:Zoe,descriptors:{unicodeRange:"U+4e69,U+4f1b,U+4f67,U+4f7e,U+4fdc,U+50e6,U+5196,U+5202,U+5233,U+523f,U+52a2,U+536e,U+5476,U+54ad,U+54cf,U+5537,U+561e,U+56dd,U+56df,U+5709,U+572c,U+57cf,U+57f8,U+580d,U+5881,U+589a,U+5941,U+59b2,U+5c25,U+5d24,U+5d74,U+5e42,U+5e8b,U+5eb3,U+5ed2,U+5fad,U+6003,U+603c,U+6083,U+6100,U+6126,U+6206,U+62ca,U+638e,U+63b4,U+6426,U+646d,U+6535,U+65c4,U+66db,U+6715,U+6769,U+6798,U+67c3,U+6861,U+698d,U+69ca,U+69ed,U+69f2,U+69ff,U+6a18,U+6b39,U+6bb3,U+6c0d,U+6cb2,U+6cd6,U+6cf7,U+6cfa,U+6d33,U+6e16,U+6e53-6e54,U+6ebb,U+6fb6,U+709d,U+72ad,U+72f7,U+72fb,U+7313,U+739f,U+74ba,U+754b,U+755b,U+758b,U+75ac,U+75d6,U+7617,U+7635,U+7640,U+76a4,U+76b2,U+775a,U+77bd,U+781f,U+79b3,U+7b2b,U+7b31,U+7b3e,U+7b6e,U+7b9c,U+7c0b,U+7c9e,U+7cc1,U+7ce8,U+7ea5,U+7f21,U+7f27,U+7f74,U+7fb0,U+8031,U+8071,U+80ea,U+8114,U+8160,U+81a6,U+81c1,U+829f,U+82a4,U+82fb,U+831a,U+8333,U+836c,U+83b6,U+83f8,U+8411,U+841c,U+8489,U+848c,U+85a4,U+8627,U+8629,U+866e,U+86b5,U+872e,U+8731,U+877b,U+877d,U+87ea,U+8813,U+8816,U+8864,U+88ce,U+88e5,U+897b,U+89cb,U+89f3,U+8bfc,U+8c35,U+8d46,U+8d4d,U+8dba,U+8e3a,U+8f75,U+8f7e,U+8fd3,U+9161,U+9179,U+917e,U+91a3,U+94ac,U+94d7,U+94e5,U+952a,U+952c,U+9545,U+9565,U+9568,U+956a,U+961d,U+96e0,U+972a,U+9730,U+989f,U+98e7,U+990d,U+9967,U+9993,U+9aa3,U+9ac0,U+9ae1,U+9aeb,U+9af9,U+9c86,U+9c8b,U+9ca0-9ca1,U+9ca3,U+9ce2,U+9e48,U+9e6a,U+9e87,U+9ee2,U+9ee9,U+9f17,U+9f19,U+9f2c,U+9f80"}},{uri:qoe,descriptors:{unicodeRange:"U+4ef3,U+50d6,U+50ec,U+51ab,U+51b1,U+52d6,U+54a9,U+54da,U+55be,U+55cd,U+564d,U+572f,U+574c,U+576b,U+57d8,U+57fd,U+5844,U+59d2,U+5ae0,U+5b16,U+5b37,U+5b5b,U+5b80,U+5d1e,U+5d6b,U+5efe,U+5f11,U+5f56,U+5f58,U+5f73,U+5f8c,U+5fc4,U+5fe4,U+602b,U+6106,U+610d,U+63de,U+63f8,U+641b,U+64e4,U+6634,U+676a,U+67b5,U+681d,U+6883,U+69b1,U+69e0,U+6b37,U+6b9b,U+6d7c,U+6ed7,U+6f36,U+6f72,U+6f8c,U+7035,U+7039,U+7173,U+7178,U+7228,U+728f,U+72b4,U+72ef,U+72f4,U+7331,U+7481,U+74e0,U+7540,U+75c3,U+75e6,U+763c,U+764d,U+76cd,U+7704,U+7743,U+7780,U+7847,U+786a,U+78b9,U+7962,U+7a02,U+7aac,U+7ab3,U+7b0a,U+7b4c,U+7b7b,U+7bfc,U+7c0f,U+7c16,U+7c40,U+7ca2,U+7cc7,U+7cf8,U+7d77,U+7e3b,U+7ea1,U+7ea9,U+7ef2,U+7f02,U+7f07,U+7f0c,U+7f23,U+7f2f,U+7fbc,U+8016,U+8020,U+812c,U+8136,U+8182,U+822f,U+8233,U+825f,U+8268,U+8284,U+8288,U+8291,U+8308,U+8311,U+835b,U+836d,U+83dd,U+8406,U+840f,U+845c,U+84b4,U+84e3,U+850c,U+855e,U+863c,U+86ba,U+86c4,U+86de,U+86f1,U+873e,U+87bd,U+87db,U+880a,U+883c,U+887f,U+88f0,U+890a,U+892b,U+895e,U+89ef,U+8a48,U+8bdc,U+8c18,U+8c33,U+8c94,U+8db1,U+8dcf,U+8dd6,U+8de3,U+8e6f,U+8e90,U+8f7a,U+8fb6,U+902d,U+90be,U+91af,U+936a,U+948b,U+94d8,U+9513,U+953a,U+956c,U+963c,U+9654,U+966c,U+9688,U+97b4,U+996b,U+9a75,U+9a7a,U+9aba,U+9aed,U+9b08,U+9b43,U+9c8e,U+9c94,U+9c9a,U+9e2b,U+9e36,U+9e4b,U+9e4e,U+9e55,U+9e63,U+9e68-9e69,U+9ebd,U+9ec9,U+9f0d,U+9f37,U+9f51"}},{uri:Qoe,descriptors:{unicodeRange:"U+50a7,U+5240,U+5261,U+52ac,U+531a,U+5363,U+5432,U+5452,U+5456,U+5472,U+5478,U+553f,U+5575,U+5581,U+55cc,U+55fe,U+5601,U+572e,U+57d2,U+57ef,U+581e,U+5924,U+5981,U+5997,U+59a3,U+5aaa,U+5ab8,U+5b34,U+5d5d,U+5def,U+5e11,U+5e91,U+5ed1,U+5ef4,U+5f40,U+600d,U+6019,U+601b,U+605a,U+6092,U+60ab,U+6217,U+623d,U+6369,U+65d2,U+6661,U+670a,U+6753,U+67a7,U+6855,U+68f9,U+6939,U+696e,U+6980,U+6a7c,U+6aab,U+6b82,U+6bf3,U+6bf9,U+6c05,U+6c19-6c1a,U+6ca9,U+6cf6,U+6d1a,U+6dab,U+6f74,U+7085,U+7198,U+71b5,U+7256,U+725d,U+727e,U+72fa,U+7322,U+738e,U+73e5,U+750f,U+755a,U+7594,U+75b3,U+760c,U+7615,U+7630,U+763f,U+77ec,U+7817,U+78a1,U+78d9,U+7905,U+7b2a,U+7b2e,U+7b62,U+7b85,U+7bcc,U+7bea,U+7c26,U+7c74,U+7c9c-7c9d,U+7e47,U+7e9b,U+7e9f,U+7ee0,U+7ee8,U+7ef1,U+7f01,U+7f11,U+7f17,U+7f36,U+7f7e,U+7fee,U+802a,U+80cd,U+8112,U+8169,U+8234,U+8279,U+8298,U+82ca,U+82d8,U+82e1,U+83c0,U+83d4,U+83df,U+8401,U+8451,U+845a,U+8476,U+8478,U+84ba,U+84bd,U+84e0,U+851f,U+8548,U+8556,U+8585,U+868d,U+86e9,U+86f4,U+86f8,U+8765,U+8785,U+87ab,U+87ee,U+8832,U+8872,U+88b7,U+88e2-88e3,U+89da,U+8bce,U+8bd3,U+8bd6,U+8bf9,U+8c16,U+8c73,U+8d5c,U+8dde,U+8f6d,U+8f94,U+8fe8,U+9011,U+915e,U+9185,U+918c,U+94ab,U+94d1,U+94f3,U+9515,U+951d,U+9558,U+9567,U+96ce,U+96e9,U+9785,U+9878,U+987c,U+9883,U+98d1,U+9954,U+9963,U+9a93,U+9ac1,U+9acc,U+9b1f,U+9b49,U+9b4d,U+9b51,U+9ca7,U+9cae,U+9cce,U+9cd3,U+9e37,U+9e39,U+9e41,U+9e46,U+9f22,U+9f2f,U+9f39,U+9f85"}},{uri:Joe,descriptors:{unicodeRange:"U+4e5c,U+4edf,U+4f25,U+4f32,U+4f5e,U+4f76,U+4faa,U+4fe6,U+5028,U+5048,U+5250,U+535f,U+538d,U+53c1,U+5412,U+5443,U+54d4,U+54dd,U+5541,U+5550,U+5577,U+55dd,U+55f3,U+560f,U+562c,U+5657-5658,U+5664,U+56af,U+575c,U+577c,U+57b2,U+57da,U+5800,U+5a62,U+5aeb,U+5c3b,U+5ca3,U+5d26,U+5d9d,U+5f01,U+5fb5,U+5fdd,U+5ff8,U+6029,U+6041,U+6079,U+60b1,U+6222,U+629f,U+6332,U+63bc,U+63e0,U+6485,U+65ab,U+65c3,U+65c6,U+668c,U+669d,U+66be,U+67fd,U+6800,U+68fc,U+690b,U+6924,U+6978,U+69a7,U+6a3e,U+6a50,U+6a5b,U+6a97,U+6b24,U+6b8d,U+6baa,U+6c10,U+6c54,U+6ceb,U+6d04,U+6d4d,U+6eb1,U+6ebd,U+7110,U+71b3,U+71f9,U+7230,U+728d,U+7292,U+72b8,U+72d2,U+7360,U+73a2,U+7511,U+75a0,U+75c8,U+779f,U+7826,U+7877,U+7a39,U+7aa8,U+7ae6,U+7b04,U+7b0f,U+7baa,U+7bac,U+7c1f,U+7ccd,U+7ecb,U+7ed4,U+7ed7,U+7efb,U+7f0d,U+7f5f,U+7faf,U+7fd5,U+7fe5,U+8027,U+80bc,U+80dd,U+80fc,U+8132,U+815a,U+8167,U+816d,U+81ca,U+8228,U+82a1,U+82a9,U+82ab,U+82cc,U+8351,U+8368,U+83b8,U+83d8,U+83ea,U+83f0,U+8497,U+84c1,U+858f,U+85ff,U+867b,U+86a8-86a9,U+870a,U+8722,U+876e,U+877c,U+87e5,U+8888,U+88df,U+8919,U+8bcc,U+8bdf,U+8be8,U+8bee,U+8c20,U+8c2f,U+8d36,U+8df8,U+8e05,U+8e2f,U+8f9a,U+9021,U+908b,U+90b4,U+90ba,U+90d0,U+90eb,U+90fe,U+91aa,U+933e,U+9486-9487,U+948d,U+9490,U+94ad,U+94bd,U+94d6,U+94d9,U+9507,U+9546,U+955e,U+956b,U+95e9,U+9604,U+960b,U+9612,U+9615,U+9617,U+96b9,U+989a-989b,U+989e,U+9a78,U+9a7d,U+9aa0,U+9aa2,U+9ac2,U+9b23,U+9b3b,U+9c82,U+9cca,U+9cd9,U+9e28,U+9e5a,U+9e5e,U+9e6c,U+9efe,U+9f0b"}},{uri:eae,descriptors:{unicodeRange:"U+4e47,U+4e8d,U+4f65,U+4f89,U+50ee,U+520e,U+5416,U+5454,U+54bb,U+54c2,U+54d3,U+54de,U+5591,U+55e5,U+560c,U+566b,U+5769,U+578c,U+5793,U+57e4,U+5889,U+593c,U+59ab,U+5ad4,U+5ad8,U+5af1,U+5b53,U+5ba5,U+5c59,U+5c63,U+5d5b,U+5e0f,U+5e14,U+5edb,U+5fbc,U+6004,U+60ad,U+610e,U+61b7,U+624c,U+634c,U+647a,U+64ba,U+65f0,U+6600,U+66f7,U+67e2,U+67f0,U+680c,U+686b,U+6874,U+691f,U+6989,U+6a17,U+6b81,U+6b84,U+6c06-6c07,U+6c3d,U+6d07,U+6d27,U+6d2b,U+6d91,U+6e6b,U+6e8f,U+6fde,U+70bb,U+723b,U+726e,U+72b0,U+72ce,U+72f2,U+7301,U+731e,U+737e,U+7477,U+748e,U+74ff,U+7633,U+7654,U+771a,U+7726,U+7765,U+7768,U+781c,U+7829,U+78d4,U+7913,U+7957,U+79d5,U+79eb,U+7a70,U+7a86,U+7b25,U+7b38,U+7b47,U+7b72,U+7ba6-7ba7,U+7dae,U+7ee1,U+7efe,U+7f26,U+7f31,U+7f35,U+801c,U+8043,U+809f,U+80ab,U+80d7,U+8118,U+8188,U+81cc,U+823e,U+8244,U+824f,U+82b4,U+82c1,U+82e4,U+82f4,U+8306,U+833a,U+835c,U+839c,U+83b3,U+83bc,U+846d,U+867a,U+868b,U+8734,U+87ca,U+886e,U+887e,U+88a2,U+88c9,U+8921,U+8bb5,U+8bf3,U+8c04,U+8c17,U+8c1d,U+8c25,U+8c36,U+8c55,U+8c78,U+8d3d,U+8d40,U+8d59,U+8d67,U+8d91,U+8dbf,U+8deb-8dec,U+8dfd,U+8e14,U+8e41,U+8f8e,U+900b,U+9044,U+9062,U+90cf,U+9123,U+9146,U+9162,U+9172,U+918d,U+9190,U+92c8,U+93ca,U+948c,U+94aa,U+94b2,U+94c8,U+94ca,U+94d5,U+94df,U+94e9-94ea,U+94f7,U+94fc-94fd,U+951b,U+954f,U+9554,U+9559,U+9566,U+9571-9572,U+95f1,U+9608,U+960f,U+97af,U+988f,U+98d5,U+992e,U+9955,U+9ab0,U+9b32,U+9c90,U+9c9e,U+9ca5,U+9ca9,U+9cad,U+9cb1,U+9cc3,U+9e47,U+9ee7,U+9f87"}},{uri:tae,descriptors:{unicodeRange:"U+4e93,U+4ec4,U+4ef5,U+4f27,U+4f7b,U+4fe3,U+5080,U+5121,U+51eb,U+5208,U+52f0,U+53f5,U+5453,U+5466,U+54a6,U+54bf,U+54d0,U+5533,U+5549,U+5556,U+556d,U+558f,U+55f2,U+55f5,U+5627,U+567b,U+56d4,U+571c,U+5739,U+57b4,U+5807,U+58c5,U+59a4,U+59af,U+59d8,U+5a09,U+5a0c,U+5a4a,U+5ad2,U+5b6c,U+5ca2,U+5cac,U+5d03,U+5d6c,U+5db7,U+5ebe,U+5f2d,U+5fea,U+6042,U+6120,U+6175,U+6221,U+623e,U+6339,U+638a,U+643d,U+64b8,U+64e2,U+66e9,U+67b3,U+67c1,U+67d2,U+6832,U+6877,U+68f0,U+6934,U+6966,U+6987,U+6998,U+69c1,U+69ce,U+6a3d,U+6a84,U+6aa9,U+6b87,U+6bd6,U+6c16,U+6c18,U+6cd4,U+6cee,U+6de0,U+6e0c,U+6ecf,U+6f4b,U+70b7,U+7168,U+72d9,U+7352,U+73b3,U+73d0,U+7441,U+74d2,U+75a5,U+75e7-75e8,U+7610,U+7619,U+765e,U+772d,U+7812,U+782c,U+784c,U+7850,U+7856,U+789b,U+78f4,U+7a51,U+7b15,U+7b1e,U+7b24,U+7b5a,U+7bb8,U+7bc1,U+7bd9,U+7ed0,U+7ee6,U+7efa,U+7f1b,U+7f1f,U+7f22,U+7f45,U+7f71,U+7fa7,U+7fbf,U+7ff3,U+8052,U+80b1,U+80db,U+80f4,U+81bb,U+81ec,U+8202,U+8210,U+8249,U+828a,U+828e,U+82e3,U+8315,U+8369,U+8378,U+83a8,U+83aa,U+83b4,U+83e1,U+84fc,U+8538,U+853b,U+859c,U+85ae,U+86b4,U+86c9,U+86cf,U+8725,U+879f,U+87b3,U+887d,U+88fe,U+8a8a,U+8ba7,U+8c07,U+8c14,U+8c30,U+8c47,U+8db5,U+8dd7,U+8e1f,U+8e69,U+8e70,U+8e85,U+8f78,U+8f87,U+8f8b,U+8f8f,U+90c4,U+9143,U+917d,U+948f,U+94cd,U+94d2,U+94ef,U+954a,U+9609-960a,U+96d2,U+9708,U+9765,U+97ea,U+9880,U+98a7,U+996c,U+9980,U+9991,U+9a88,U+9ab6,U+9afb,U+9b47,U+9c87,U+9c9b,U+9cb5,U+9cc7,U+9e2c,U+9e42,U+9e58,U+9ecd,U+9ecf,U+9f8a,U+9f8c"}},{uri:nae,descriptors:{unicodeRange:"U+4ebb,U+4edd,U+4fa9,U+502c,U+50a5,U+51c7,U+51fc,U+523d,U+5241,U+530f,U+5464,U+549d,U+54a3,U+5514,U+5527,U+555c,U+556e,U+5576,U+55b1,U+55b9,U+55eb,U+5624,U+564c,U+5671,U+5685,U+568f,U+56d7,U+56e1,U+57a1,U+57d9,U+5942,U+5a67,U+5c50,U+5c7a,U+5c98,U+5d06,U+5d27,U+5d6f,U+5df3,U+5dfd,U+5e19,U+5ea0,U+5eb9,U+5eea,U+5ffe,U+600f,U+606b,U+6215,U+622c,U+6266,U+62bb,U+62bf,U+6308,U+6387,U+63b8,U+63c4,U+63c6,U+63f6,U+6441,U+6555,U+659b,U+6677,U+66a7,U+6775,U+678b,U+679e,U+6840,U+6849,U+6860,U+68c2,U+6910,U+6a28,U+6a2f,U+6a79,U+6b92-6b93,U+6bc2,U+6bfd,U+6c29,U+6c32,U+6c86,U+6cc5,U+6d0c,U+6d60,U+6da0,U+6ddd,U+6e86,U+6ed3,U+6edf,U+6fb9,U+6fd1,U+6fef,U+7023,U+7080,U+70ca,U+712f,U+7145,U+7284,U+732c,U+73c8,U+73d9,U+740a,U+7457,U+7596,U+759d,U+75a3,U+75d8,U+75e3-75e4,U+75ff,U+7622,U+7688,U+76b4,U+76e5,U+7818,U+7887,U+789a,U+78b2,U+7b08,U+7b33,U+7c2a,U+7ccc,U+7ea8,U+7ec0,U+7fe6,U+8012,U+8084,U+8093,U+80e4,U+80ef,U+8297,U+82a8,U+82be,U+8331,U+8366,U+83c5,U+83fd,U+8473,U+84a1,U+84ca,U+84d1,U+857b,U+85c1,U+85d3,U+8605,U+8662,U+86aa,U+86b1,U+86d4,U+86ed,U+86f3,U+8709,U+8748,U+874c,U+8763,U+89c7,U+89de,U+89e5,U+8a3e,U+8ba6,U+8c00,U+8c21,U+8c49,U+8c7a,U+8d30,U+8df9,U+8e51,U+8e59,U+8f6b,U+8f73,U+8ff3,U+9016,U+9026,U+902f,U+9099,U+909b,U+90c7,U+914a,U+91ae,U+91ba,U+9495,U+94a3,U+94af,U+94ba,U+94bf,U+94cc,U+94e1,U+94f0,U+9531,U+955d,U+95f3,U+9697,U+96bc,U+975b,U+977c,U+98a2,U+998a,U+9994-9995,U+9a9b,U+9ab7,U+9ac5,U+9c91,U+9ccf,U+9cd5,U+9e29,U+9edc,U+9edf,U+9f83,U+9f88-9f89"}},{uri:iae,descriptors:{unicodeRange:"U+4ee8,U+4f22,U+4f43,U+4f57,U+4f5d,U+4f6f,U+4ff8,U+502d,U+507b,U+5345,U+53df,U+53fb,U+544b,U+5482,U+54a7,U+54cc,U+550f,U+5544,U+5555,U+5594,U+55e8,U+55ec,U+55ef,U+564e,U+56f9,U+5704,U+576d,U+5785,U+57ad,U+5914,U+5958,U+599e,U+59aa,U+59be,U+5a06,U+5abe,U+5ae1,U+5b40,U+5bee,U+5cbf,U+5cc4,U+5ccb,U+5d47,U+603f,U+6078,U+607d,U+607f,U+608c,U+609a,U+60fa,U+61ff,U+621b,U+622e,U+626a,U+6371,U+63ae,U+63cd,U+63d6,U+6410,U+6414,U+6421,U+6448,U+64d8,U+6710,U+6748,U+6772,U+680e,U+6954,U+69ab,U+6c68,U+6c8f,U+6ca4,U+6d2e,U+6e4e,U+6e98,U+6fe0,U+7094,U+70e9,U+7116,U+7119,U+723f,U+73c9,U+74e4,U+753e,U+7548,U+75bd,U+75cd,U+7618,U+7634,U+76c5,U+76f1,U+7708,U+7719,U+777e,U+7791,U+77b3,U+7823,U+7827,U+7830,U+7889,U+7893,U+7949,U+795c,U+79e3,U+7a14,U+7a88,U+7a95,U+7aa0,U+7afd,U+7b90,U+7bd1,U+7bfe,U+7da6,U+7ec2,U+7eef,U+7f03-7f04,U+7f08,U+7f58,U+7f61,U+7f9f,U+8174,U+8200,U+828d,U+82c4,U+82d5,U+82dc,U+82f7,U+832d,U+835a,U+840b,U+8438,U+852b,U+869d,U+86ac,U+86d0,U+86f0,U+8782,U+87a8,U+87d1-87d2,U+87e0,U+8839,U+8913,U+891b,U+8934,U+8941,U+89ca,U+89ce,U+8a07,U+8ba3,U+8bc5,U+8bcb,U+8bdb,U+8c11,U+8c15,U+8c29,U+8c32,U+8dc4,U+8dce,U+8ddb,U+8dfa,U+8e09,U+8e1d,U+8e39,U+8e42,U+8e49,U+8e4b,U+8e8f,U+8f71-8f72,U+9004,U+9036,U+9097,U+90dc,U+90e2,U+90e6,U+90ef,U+9104,U+919a,U+91b4,U+938f,U+9497,U+950f,U+9557,U+9562-9563,U+9573,U+9606,U+9649,U+972d,U+973e,U+97a3,U+97eb,U+988c,U+9894,U+98a6,U+9974,U+9977,U+997d,U+9a90,U+9a9d,U+9aef,U+9ca2,U+9ccd,U+9cdf,U+9e20,U+9e4c,U+9e6b,U+9f3e"}},{uri:rae,descriptors:{unicodeRange:"U+4ede,U+4ee1,U+4eeb,U+4fda,U+4ffe,U+5025,U+506c,U+50f3,U+5106,U+520d,U+525c,U+52ad,U+530d,U+5310,U+539d,U+53a9,U+53fc,U+5421,U+5477,U+54e7,U+551b,U+5530,U+557e,U+5599,U+55c4,U+55d1,U+55d4,U+55df,U+55e4,U+55ea,U+5623,U+562d,U+5654,U+56eb,U+56f5,U+57a7,U+57d5,U+57dd,U+584d,U+5880,U+58ec,U+59dd,U+5a32,U+5a55,U+5a75,U+5b51,U+5b71,U+5b73,U+5cd2,U+5ce4,U+5e5b,U+5e96,U+5fd2,U+607b,U+61d1,U+634b,U+636d,U+63b3,U+63ff,U+64c0,U+661d,U+6657,U+66dc,U+67a5,U+6841,U+6867,U+6901,U+699b,U+6a47,U+6b46,U+6c21,U+6c24,U+6c35,U+6c4a,U+6c94,U+6ca3,U+6d39,U+6d63,U+6d6f,U+6d94,U+705e,U+71e7,U+726f,U+72cd,U+72de,U+72f0,U+7325,U+7350,U+7391,U+741a,U+757f,U+7583,U+75b1,U+75b4,U+75b8,U+75c2,U+75f1,U+766f,U+7699,U+7751,U+789c,U+7a17,U+7be6,U+7cb2,U+7ea3,U+7eb0,U+7ebe,U+7eeb,U+7f25,U+7f2c,U+7fb8,U+8026,U+8037,U+8153,U+8171,U+8191,U+8214,U+821b,U+8222,U+826e,U+82eb,U+830c,U+8314,U+8334,U+83d6,U+8418,U+843c,U+84ff,U+8564,U+8572,U+8616,U+866c,U+8693,U+86a3,U+86a7,U+86af,U+86b6,U+86c6,U+86ca,U+8708,U+870d,U+8759,U+8760,U+87af,U+87c6,U+8869,U+88c6,U+89d0,U+8b07,U+8baa-8bab,U+8bc2,U+8be4,U+8bf0,U+8c2a,U+8c62,U+8c89,U+8d49,U+8d6d,U+8d84,U+8d94,U+8db8,U+8dc6,U+8e2e,U+8e3d,U+8e47,U+8e7f,U+9005,U+9051,U+907d,U+9082,U+9088,U+90b0,U+90d3,U+9150,U+949c,U+94a4,U+94b9,U+94cb,U+94e0,U+9509,U+9512,U+951f,U+9534,U+9552-9553,U+965f,U+96b0,U+9791,U+9889,U+9990,U+9a9c,U+9aa7,U+9c88,U+9cb2-9cb3,U+9cb6-9cb7,U+9cc5,U+9cdc,U+9e22,U+9e2a,U+9e57,U+9e67,U+9e73,U+9e82,U+9eb8,U+9ee0,U+9f9b"}},{uri:sae,descriptors:{unicodeRange:"U+4eb5,U+4f09,U+4f5a,U+4f8f,U+4fce,U+4fdf,U+4fea,U+4ff3,U+500c,U+500f,U+504e,U+5088,U+52be,U+5420,U+5457,U+5499,U+549b,U+54c6,U+54d2,U+558b,U+559f,U+55bd,U+55d6,U+565c,U+567c,U+568e,U+5768,U+577b,U+57a9,U+57ed,U+59f9,U+5a11,U+5a40,U+5ae6,U+5b6a,U+5b93,U+5bb8,U+5c15,U+5c99,U+5c9c,U+5cc1,U+5d2e,U+5d4b,U+5d99,U+5e54,U+5e61,U+5fcf-5fd1,U+6002,U+6006,U+6014,U+60af,U+60c6,U+60da,U+60f4,U+621f,U+62c8,U+631b,U+631e,U+63e9,U+64b5,U+655d,U+6619,U+6635,U+6641,U+67ad,U+67b0,U+67b7,U+67e9,U+684e,U+688f,U+695d,U+696b,U+69b7,U+6a58,U+6c26,U+6d35,U+6d43,U+6d9e,U+6dd9,U+6dec,U+6e11,U+6e6e,U+6e9f,U+6ec2,U+6ee2,U+6ef9,U+6f09,U+6f66,U+6f8d,U+6fc2,U+6fc9,U+729f,U+72c8,U+73de,U+7430,U+7566,U+7579,U+75c9,U+75e2,U+75fc,U+762a,U+7638,U+7678,U+76c2,U+76f9,U+778c,U+77cd,U+77dc,U+7800,U+781d,U+782d,U+783b-783c,U+78a3,U+78ec,U+7980,U+7a23,U+7b95,U+7bdd,U+7c0c,U+7c41,U+7c91,U+7cb3,U+7cc5,U+7ecc,U+7f19,U+7fca,U+8006,U+8069,U+807f,U+80bd,U+80ed,U+814b,U+8198,U+82cb,U+82d2,U+834f,U+8360,U+847a,U+84d6,U+84e5,U+8537,U+85d0,U+8671,U+86a4,U+86ce,U+86f9,U+8703,U+8707,U+8737,U+873b,U+8815,U+8936,U+8bc3,U+8bcf,U+8bd2,U+8bd8,U+8be9,U+8c0c,U+8c0f,U+8c4c,U+8d45,U+8d5d,U+8d73,U+8e31,U+8e6d,U+8e76,U+8fe4,U+9041,U+90d7,U+9169,U+92ae,U+94a1,U+94c4,U+94c9,U+94db,U+94e7,U+9503,U+9506,U+9517,U+9528,U+9537,U+9542,U+9549,U+95fe,U+9616,U+961a,U+96c9,U+96f3,U+9701,U+970e,U+9739,U+9753,U+9798,U+98d2-98d3,U+98d9-98da,U+9968,U+996f,U+9984,U+9997,U+9acb,U+9b03,U+9c85,U+9ca8,U+9cab,U+9e49,U+9e51,U+9e66,U+9f10"}},{uri:oae,descriptors:{unicodeRange:"U+4e15,U+4e1e,U+4e2b,U+4eb3,U+4ec9,U+4f0e,U+4f64,U+501c,U+50a9,U+510b,U+51a2,U+51bc,U+527d,U+52d0,U+53fd,U+5429,U+542e,U+5486,U+54af,U+5506,U+5511,U+5522,U+552c,U+556c,U+55b3,U+55d2,U+55e6,U+55fd,U+561f,U+5639,U+5659,U+5662,U+5693,U+572a,U+5892,U+598a,U+5992,U+59a9,U+5a20,U+5ae3,U+5b17,U+5b7d,U+5d34,U+5d3d,U+5d4a,U+5d82,U+5e1a-5e1b,U+5ea5,U+5f0b,U+5f77,U+5fd6,U+5fff,U+6026,U+6035,U+6063,U+60b4,U+60bb,U+60ee,U+612b,U+6194,U+61ca,U+61e6,U+61f5,U+620a,U+6248,U+62a1,U+62d7,U+6376,U+637b,U+652b,U+65bc,U+65cc,U+65ce,U+65d6,U+664c,U+665f,U+6666,U+6684,U+66b9,U+6773,U+6777,U+6787,U+67de,U+6845,U+693d,U+6994,U+6a35,U+6d54,U+6d5c,U+6d8e,U+6dd6,U+6eb4,U+6f2a,U+6f78,U+704f,U+70ec,U+7118,U+714a,U+7172,U+71b9,U+724d,U+728a,U+7337,U+733e,U+7396,U+73b7,U+73cf,U+7428,U+742c,U+742e,U+74ee,U+74f4,U+7525,U+753a,U+7572,U+75d4,U+765c,U+768e,U+7762,U+777d,U+77fd,U+7825,U+7837,U+78b4,U+795f,U+79ed,U+7a1e,U+7b06,U+7b20,U+7ba9,U+7bab,U+7c7c,U+7cbd,U+7cdc,U+7ec9,U+7ef6,U+7f30,U+7f42,U+7f44,U+7f54,U+7f94,U+8004,U+800b,U+8019,U+809b,U+80ae,U+80c4,U+80f1,U+8146,U+816e,U+817c,U+81c0,U+81fc,U+81fe,U+822b,U+830f,U+832f,U+8340,U+8365,U+8385,U+8392,U+83a0,U+8424,U+84af,U+869c,U+8713,U+8717-8718,U+87c0,U+87cb,U+87fe,U+8821,U+8902,U+89d1,U+8bb9,U+8c12,U+8d32,U+8d53,U+8df7,U+8e7c,U+8f7c,U+8f95,U+8fab,U+9052,U+905b,U+9095,U+909d,U+90c5,U+911e,U+9122,U+916a,U+919b,U+948e,U+9492,U+949a,U+94b5,U+94bc,U+94c6,U+94f1,U+9502,U+9511,U+9536,U+956f-9570,U+9602,U+9621,U+9631,U+998b,U+99a5,U+9a81,U+9a9e,U+9ebe,U+9f8b"}},{uri:aae,descriptors:{unicodeRange:"U+4f2b,U+4f3d,U+4fac,U+5043,U+5055,U+5140,U+5156,U+51cb,U+5243,U+531d,U+536f,U+53a5,U+53ae,U+53f1,U+541d,U+5431,U+547b,U+5492,U+5494,U+54a4,U+54aa,U+54ce,U+54fd,U+5509,U+5520,U+553e,U+557b,U+55c5,U+55e1,U+55f7,U+5608,U+5636,U+563b,U+5773,U+57a0,U+5811,U+587e,U+58d5,U+59e3,U+5a29,U+5a6a,U+5a76,U+5a7a,U+5ac9,U+5b62,U+5b95,U+5c49,U+5c8c,U+5cab,U+5cb7,U+5d02,U+5d58,U+5e44,U+5e7a,U+5eff,U+5f29,U+5f89,U+5f9c,U+5fa8,U+6005,U+6043,U+60b8,U+60d8,U+60ec,U+60f0,U+6115,U+618e,U+630e,U+637a,U+6390,U+63ac,U+63b0,U+64de,U+6525,U+6538,U+65ee-65ef,U+6631,U+6636,U+6654,U+677c,U+67b8,U+67d8,U+683e,U+6886,U+68b5,U+692d,U+6963,U+6979,U+6988,U+6b59,U+6b9a,U+6c69,U+6c74,U+6cae,U+6ce0,U+6cef,U+6d95,U+6dc5,U+6dde,U+6de6,U+6dfc,U+6ea7,U+6f15,U+6f29,U+7096,U+70c3,U+7131,U+715c,U+7166,U+7266,U+7317,U+731d,U+7329,U+73e9,U+7425,U+7455,U+7490,U+74ef,U+7519,U+75b5,U+75b9,U+75de,U+7656,U+7663,U+7691,U+7729,U+77fe,U+783e,U+787c,U+795a,U+7a79,U+7abf,U+7b3a,U+7b4f,U+7b60,U+7b75,U+7b8d,U+7bb4,U+7bd3,U+7be1,U+7cbc,U+7edb,U+7f1c,U+7f8c,U+7fb2,U+7fb9,U+7fce,U+7ff1,U+810d,U+81c6,U+82a5,U+82aa,U+82de,U+8317,U+8343,U+835e,U+8364,U+836a,U+853a,U+8543,U+854a,U+8559,U+8568,U+85b0,U+85b9,U+864f,U+86e4,U+8715,U+8845,U+8884,U+88e8,U+88f1,U+8983,U+8be1,U+8c1f,U+8c27,U+8c5a,U+8c82,U+8d58,U+8dbe,U+8f98,U+9035,U+9074,U+90a1,U+9149,U+9157,U+93d6,U+949d,U+94c2,U+94e3-94e4,U+95eb,U+95f0,U+9611,U+9619,U+9642,U+968d,U+9706,U+970f,U+97ed,U+988a,U+9893,U+98e8,U+9a77,U+9a87,U+9aa1,U+9abc,U+9cdd,U+9e2f,U+9e33,U+9e44,U+9e5c,U+9e9d,U+9edd"}},{uri:lae,descriptors:{unicodeRange:"U+4f58,U+4f6c,U+4f70,U+4fd0,U+5014,U+51bd,U+524c,U+5315,U+5323,U+535e,U+540f,U+542d,U+545b,U+548e,U+549a,U+54ab,U+54fc,U+5567,U+556a,U+5600,U+5618,U+563f,U+5669,U+56f1,U+56ff,U+573b,U+574d,U+579b,U+57b8,U+57c2,U+586c,U+58f9,U+595a,U+598d,U+5993,U+5996,U+59d7,U+5b7a,U+5ba6,U+5c4e,U+5c96,U+5ce5,U+5eb6,U+5f08,U+5f99,U+602f,U+6059,U+606c,U+607a,U+60ed,U+61a9,U+620c,U+6249,U+62a8,U+62c4,U+62ed,U+62fd,U+6342,U+6345,U+6396,U+63a3,U+6402,U+6413,U+642a,U+6487,U+64a9,U+64ac,U+64ae,U+64b7,U+659f,U+65a1,U+667e,U+66f3,U+67e0,U+69db,U+69df,U+6aac,U+6b86,U+6c50,U+6c5e,U+6c76,U+6c85,U+6c8c,U+6cde,U+6d19,U+6d52,U+6da7,U+6db8,U+6e1a,U+6e25,U+6e4d,U+6e5f,U+6ec1,U+6f31,U+6f7a,U+6fa7,U+6fe1,U+701b,U+70ab,U+70f7,U+717d,U+71a8,U+7252,U+72c4,U+72e1,U+7315,U+736d,U+73ae,U+73c0,U+73c2,U+740f,U+75a4,U+7600-7601,U+768b,U+76bf,U+76d4,U+7728,U+772f,U+776c,U+77a0,U+77b0,U+77f8,U+783a,U+78d0,U+78fa,U+7977,U+7a37,U+7a92,U+7afa,U+7b71,U+7b94,U+7cef,U+7f28,U+7fe1,U+808b,U+80e5,U+80eb,U+8110,U+8113,U+812f,U+814c,U+81c3,U+8235,U+82d4,U+8309,U+83c1,U+8431,U+8469,U+84bf,U+84d3,U+84df,U+84e6,U+8511,U+8638,U+86c0,U+86db,U+86fe,U+8757,U+8822,U+8882,U+8885,U+8892,U+88f3,U+892a,U+8ba5,U+8bd9,U+8be0,U+8be7,U+8bfd,U+8c1a,U+8d4a,U+8d4e,U+8d66,U+8dda,U+8e0c,U+8e52,U+8e74,U+8e87,U+8f76,U+8fc2,U+8fe6,U+900d,U+9068,U+90ac,U+90b3,U+90b8,U+90e7,U+9119,U+9131,U+915a,U+916e,U+94b4,U+94d0,U+94e2,U+94ec,U+94ff,U+9522,U+9535,U+9556,U+965b,U+96f9,U+9774,U+9981,U+998d,U+998f,U+9a6e,U+9a7f,U+9a8a,U+9b13,U+9c9f,U+9e3e,U+9e43,U+9e6d,U+9e8b,U+9e92,U+9edb,U+9eef"}},{uri:cae,descriptors:{unicodeRange:"U+4e10,U+4e56,U+4e98,U+4ec3,U+4f3a,U+4f5f,U+4f88,U+4f97,U+4fa5,U+4fe8,U+504c,U+5197,U+52fa,U+5364,U+53e8,U+5406,U+543c,U+545c,U+5471,U+5480,U+5495,U+54b3,U+54df,U+54e6,U+54ee,U+557c,U+5583,U+55dc,U+55e3,U+566c,U+592f,U+5944,U+5983,U+59ca,U+59e5,U+5a13,U+5a7f,U+5b09,U+5bd0,U+5e4c,U+5eb5,U+5f1b,U+5f3c,U+608d,U+60cb,U+61a7,U+61ac,U+61cb,U+6233,U+62a0,U+62e7,U+62ee,U+62f4,U+62f7,U+634e,U+6382,U+63c9,U+63ea,U+6400,U+645e,U+6482,U+6556,U+6593,U+6615,U+664f,U+66e6,U+672d,U+675e,U+67da,U+6805,U+6808,U+6868,U+68a2,U+695e,U+69ad,U+6a80,U+6a90,U+6b83,U+6be1,U+6c30,U+6cad,U+6cb1,U+6cf1,U+6d31,U+6d93,U+6dae,U+6dbf,U+6dc6-6dc7,U+6e0d,U+6e32,U+6e3a,U+6e85,U+6eba,U+6f3e,U+6f5e,U+6f7c,U+6fee,U+71ee,U+722a,U+72b7,U+72e9,U+73ba,U+73d1,U+7409,U+7435-7436,U+7459-745a,U+747e,U+7487,U+74e2,U+7504,U+752c-752d,U+7599,U+759f,U+75a1,U+75ca,U+75f0,U+761f,U+7629,U+777f,U+7785,U+77a5,U+77bf,U+78d5,U+7934,U+7940,U+79a7,U+7b19,U+7c38,U+7c95,U+7cb1,U+7ce0,U+7eca,U+7ef7,U+7f2b,U+7f81,U+7fcc,U+8046,U+8148,U+8165,U+819b,U+81ba,U+828b,U+82ae,U+82b7,U+82d3,U+8301,U+830e,U+831c,U+8338,U+837c,U+8393,U+8398,U+83ba,U+83e0,U+83e9,U+853c,U+8654,U+86df,U+8712,U+873f,U+874e,U+8783,U+8859,U+88a4,U+8925,U+8bb7,U+8bff,U+8c19,U+8c1b,U+8c24,U+8c2c,U+8d61,U+8db4,U+8e6c,U+8f8a,U+8fe5,U+8ff8,U+901e,U+90f4,U+912f,U+9163,U+9170,U+91dc,U+949b,U+94a8,U+94b3,U+94c0,U+94e8,U+9525,U+9530,U+9539,U+954c-954d,U+9550,U+955b,U+962a,U+9685,U+96cc,U+9776,U+988d,U+9975,U+9985,U+9a6f,U+9aa5,U+9ab8,U+9c7f,U+9ca4,U+9cb8,U+9e25,U+9e35,U+9e4a"}},{uri:uae,descriptors:{unicodeRange:"U+4ea2,U+4ea5,U+4f36,U+4f84,U+4f8d,U+501a,U+5029,U+516e,U+51a5,U+51c4,U+51f8,U+5201,U+527f,U+5321,U+5352,U+5366,U+53e9,U+54c7,U+5632,U+5676,U+56b7,U+56bc,U+56da,U+56e4,U+5703,U+5729,U+5742,U+57a2-57a3,U+5815,U+58d1,U+5919,U+592d,U+5955,U+5a05,U+5a25,U+5a34,U+5b70,U+5b75,U+5bdd,U+5bf0,U+5c41,U+5c79,U+5c91,U+5c94,U+5ce6,U+5ced,U+5d69,U+5dc5,U+5e16,U+5e27,U+5f27,U+5f95,U+5ffb,U+6020,U+604d,U+6055,U+60e6,U+60eb,U+6123,U+618b,U+61a8,U+620d,U+62c7,U+62ce,U+62d9,U+631f,U+634d,U+6452,U+6479,U+64ce,U+64d2,U+655b,U+660a,U+6726,U+67c4,U+6809,U+6853,U+68e3,U+68f1,U+68fa,U+693f,U+6942,U+6995,U+69a8,U+69b4,U+6a71,U+6b89,U+6bcb,U+6bd3,U+6bd9,U+6c40,U+6cf8,U+6cfe,U+6d85,U+6da3,U+6daa,U+6e0e,U+6e43-6e44,U+6f88,U+7078,U+7099,U+70bd,U+70d9,U+70fd,U+7109,U+7184,U+7239,U+733f,U+73f2,U+748b,U+749c,U+749e,U+759a,U+75d2,U+75eb,U+7620,U+766b,U+7693,U+76cf,U+7738,U+773a,U+776b,U+778e,U+77aa,U+7852,U+78be,U+7948,U+795b,U+7960,U+796f,U+79ba,U+7a20,U+7a96,U+7aa5,U+7b03,U+7b28,U+7b50,U+7b77,U+7bc6,U+7bf1,U+7c27,U+7d0a,U+7ead,U+7ec5,U+7ee2,U+7ef0,U+7efd,U+7f0e,U+7f2e,U+7f79,U+7f9a,U+8098,U+80da,U+80e7,U+80f0,U+80f3,U+80fa,U+818a,U+81e7,U+8237-8238,U+8299,U+82b8,U+82ce,U+837b,U+83bd,U+83cf,U+8426,U+8475,U+85c9,U+85d5,U+85dc,U+85e9,U+871a,U+8747,U+8749,U+888d,U+8910,U+891a,U+8bb4,U+8be3,U+8bec,U+8bf2,U+8c06,U+8c0d,U+8d31,U+8d48,U+8de4,U+8e1e,U+8e4a,U+8e66,U+8f84,U+8f97,U+9083,U+90e1,U+9165,U+91c9,U+94b0,U+94f5,U+9504,U+9532,U+956d,U+95f5,U+95fa,U+9668,U+9698,U+96bd,U+9704,U+9773,U+9890,U+996a,U+997a,U+9a74,U+9a8b,U+9cc4,U+9ccc"}},{uri:dae,descriptors:{unicodeRange:"U+4ea8,U+4f1e,U+4f51,U+4f63,U+4f7c,U+4f83,U+4fa0,U+4fd1,U+4ffa,U+5018,U+5026,U+508d,U+50bb,U+50f5,U+50fb,U+5162,U+5319,U+5320,U+538c,U+5413,U+541f,U+5475,U+54bd,U+54d1,U+5589,U+5598,U+575f,U+57ae,U+57e0,U+5937,U+5974,U+5978,U+59ae,U+5a1f,U+5a49,U+5ab3,U+5b99,U+5b9b,U+5ba0,U+5be1,U+5be5,U+5c09,U+5c27,U+5de2,U+5e9a,U+5f26,U+5f8a,U+5f98,U+6021,U+606d,U+60bc,U+60d5,U+60e7,U+611a,U+614c,U+6254,U+626f,U+6292,U+6296,U+62b9,U+62e2,U+631a,U+631d,U+6320,U+6346,U+63ba,U+6467,U+64bc,U+658b,U+663c,U+6643,U+6652,U+6656,U+6687,U+66d9,U+66dd,U+66f0,U+673d,U+67ab,U+6816-6817,U+68a7,U+68ad,U+68cd,U+68e0,U+6986,U+69fd,U+6b47,U+6bd7,U+6c1f,U+6c2e-6c2f,U+6cbe,U+6de4,U+6e1d,U+6e83,U+6e9c,U+6ed4-6ed5,U+6f4d,U+70f9,U+7130,U+716e,U+718f,U+71ac,U+71e5,U+72fc,U+731c,U+7334,U+73ca,U+7422,U+7426,U+745f,U+7470,U+75af,U+75f4,U+762b,U+763e,U+7696,U+7737,U+7741,U+77a7,U+77bb,U+77ee,U+785d,U+788c,U+78ca,U+7901,U+796d,U+7985,U+79fd,U+7a3c,U+7a57,U+7a74,U+7b5b,U+7caa,U+7cb9,U+7cd5,U+7eac,U+7eb6,U+7ed1,U+7ee5,U+7f20,U+7f2a,U+7f38,U+7f69,U+7fa1,U+8018,U+8038,U+803f,U+804b,U+80a2,U+80be,U+80d6,U+817a,U+81fb,U+820c,U+82ad,U+82af,U+82bd,U+8327,U+8354,U+835f,U+8367,U+836b,U+840c,U+841d,U+8471,U+849c,U+84b2,U+84c9,U+8517,U+851a,U+8549,U+8681,U+8721,U+8776,U+88d9,U+88f9,U+89c5,U+8c1c,U+8c34,U+8d81,U+8d9f,U+8e0a,U+8e72,U+8eb2,U+8fed,U+901b,U+902e,U+906e,U+9091,U+90aa,U+90af,U+915d,U+9171,U+946b,U+9489,U+9499,U+94a5,U+9508,U+9524,U+952d,U+9551,U+9576,U+95f7,U+9600,U+96b6,U+96c0,U+9756,U+97f6,U+98a0,U+98a4,U+997f,U+9a73,U+9a86,U+9ad3,U+9e3d,U+9ed4"}},{uri:fae,descriptors:{unicodeRange:"U+4e4d,U+4e5e,U+4ec7,U+4ed5,U+50da,U+50e7,U+515c,U+51a4,U+51ff,U+5203,U+5254,U+5300,U+533e,U+5375,U+53ee,U+5435,U+543b,U+5455,U+548b,U+548f,U+54d7,U+54fa,U+5578,U+5587,U+55a7,U+560e,U+5760,U+576f,U+5777,U+5830,U+58a9,U+5962,U+59e8,U+5a07,U+5a23,U+5a3c,U+5b5a,U+5bb5,U+5bc5,U+5bde,U+5c7f,U+5cb1,U+5ce8,U+5cea,U+5d29,U+5d4c,U+5e18,U+5f57,U+5f5d,U+5f87,U+5ff1,U+6016,U+601c,U+6064,U+6177,U+61d2,U+625b,U+62e3,U+62f1,U+634f,U+63a0,U+6401,U+6405,U+6495,U+64c2,U+6512,U+6577,U+6590,U+65a7,U+65a9,U+65f7,U+6627,U+6655,U+6714,U+6795,U+67d1,U+67ff,U+68b3,U+68d5,U+68d8,U+6930,U+6960,U+6977,U+69bb,U+69d0,U+6a31,U+6b7c,U+6bb4,U+6c22,U+6c72,U+6c79,U+6c7e,U+6c81,U+6c93,U+6ca5,U+6cbc,U+6ce3,U+6cfb,U+6d3c,U+6da9,U+6df3,U+6e2d,U+6eaf,U+6ec7,U+6f13,U+6f33,U+6f62,U+6fa1,U+7011,U+707c,U+708a,U+70c1,U+70d8,U+70eb,U+711a,U+7194,U+7281,U+7316,U+7357,U+7384,U+7405,U+742a,U+745b,U+7574,U+7578,U+75ea,U+7682,U+7792,U+77d7,U+77e9,U+77eb,U+77f6,U+780c,U+78c5,U+7941,U+79e4,U+7a1a,U+7a9c,U+7ad6,U+7b5d,U+7bf7,U+7c07,U+7c3f,U+7c9f,U+7ca5,U+7cdf,U+7e82,U+7eab,U+7ece,U+7eda,U+7f09,U+7f15,U+7f9e,U+7fdf,U+7fe9,U+803b,U+803d,U+80aa,U+80b4,U+813e,U+8155,U+817b,U+819d,U+821c,U+82b9,U+82df,U+82ef,U+8304,U+83b9,U+8446,U+853d,U+85af,U+85fb,U+8650,U+865e,U+86d9,U+86ee,U+8700,U+8862,U+889c,U+88d4,U+88f8,U+895f,U+8a79,U+8bb3,U+8bb6,U+8bc0,U+8beb,U+8bf5,U+8c23,U+8c79,U+8d1e,U+8dcb,U+8e29,U+8e44,U+8e81,U+8eac,U+8eaf,U+8f8d,U+9050,U+90f8,U+914b,U+948a,U+94be,U+94ee,U+950c,U+9540,U+962e,U+9647,U+9661,U+9699,U+96cf,U+9716,U+9761,U+97a0,U+97e7,U+9a7c,U+9a8f,U+9ae6,U+9cd6,U+9e26"}},{uri:hae,descriptors:{unicodeRange:"U+4fa3,U+4fae,U+4fd8,U+4fef,U+50a3,U+5189,U+5195,U+51db,U+51f3,U+51f9,U+5220,U+5228,U+5288,U+52ff,U+532e,U+533f,U+5351,U+53db,U+53ed,U+5450,U+5484,U+5490,U+54c9,U+54e9,U+5501,U+5507,U+5543,U+55d3,U+56a3,U+575e,U+589f,U+5984,U+59ec,U+5a04,U+5a36,U+5a77,U+5a9a-5a9b,U+5ab2,U+5ac2,U+5ad6,U+5bc7,U+5c2c,U+5c34,U+5c51,U+5cd9,U+5d0e,U+5deb,U+5e3c,U+5e87,U+5ed3,U+5f13,U+5f64,U+5fe1,U+606a,U+6096,U+60df,U+60f6,U+60f9,U+6151,U+620e,U+6241,U+6252,U+6273,U+627c,U+6289,U+62c2,U+62cc,U+62ef,U+6361,U+6363,U+63b7,U+63e3,U+6518,U+66ae,U+6756,U+6789,U+6813,U+6829,U+6862,U+6866,U+6893,U+6897,U+690e,U+6984,U+69cc,U+6a1f,U+6a44,U+6a59,U+6ba1,U+6c13,U+6c90,U+6ca6,U+6cbd,U+6ccc,U+6cd3,U+6cd7,U+6d4a,U+6d4f,U+6d5a,U+6d9f,U+6da1,U+6dcc,U+6ea5,U+6ee4,U+6ee6,U+6f2f,U+6f8e,U+701a,U+7095,U+709c,U+70af,U+70db,U+70e8,U+714e,U+715e,U+71a0,U+71ce,U+7235,U+7280,U+72d0,U+72f8,U+73ab,U+7410,U+745c,U+7480,U+74a7-74a8,U+74e3,U+75ae,U+75f9,U+76b1,U+76ce,U+7736,U+77e2-77e3,U+781a,U+789f,U+797a,U+79be,U+79c3,U+79c6,U+79f8,U+7a8d,U+7a98,U+7aa6,U+7aff,U+7b1b,U+7cd9,U+7d6e,U+7ede,U+7eee,U+7f00,U+7f24,U+7f2d,U+7fd8,U+800d,U+8116,U+8151,U+81b3,U+8205,U+82c7,U+82db,U+832c,U+8335,U+8339,U+8386,U+846b,U+8587,U+8611,U+8682,U+868a,U+868c,U+8774,U+88d8,U+88f4,U+8912,U+8b6c,U+8bbd,U+8c0e,U+8c41,U+8d26,U+8d3b-8d3c,U+8d50,U+8dea,U+8e35,U+8f99,U+8fe2,U+8fe9,U+9017,U+914c,U+916f,U+9175-9176,U+918b,U+94a0,U+94ae,U+94ce,U+94f2,U+951a,U+952f,U+9541,U+9640,U+9672,U+968b,U+96cd,U+96ef,U+9713,U+97ec,U+9885,U+9992,U+9a6d,U+9a79,U+9a85,U+9cbb,U+9cd7,U+9cde,U+9e93,U+9f9f"}},{uri:gae,descriptors:{unicodeRange:"U+4e11,U+4ed7,U+4fcf,U+4fe9,U+4fed,U+50ac,U+50b2,U+5112,U+5180,U+5188,U+51f6,U+522e,U+5265,U+52cb,U+52df,U+5349,U+5367,U+5378,U+537f,U+5395,U+5398,U+53d4,U+543e,U+5440,U+5446,U+54b8,U+5565-5566,U+5580,U+55bb,U+56ca,U+572d,U+573e,U+574e,U+5782-5784,U+58f3,U+5938-5939,U+5948,U+594e,U+5a1c,U+5a74,U+5ae9,U+5b55,U+5b5c,U+5bb0,U+5bd3,U+5bf8,U+5c3f,U+5d14,U+5d2d,U+5df7,U+5dfe,U+5e05-5e06,U+5e1c,U+5e62,U+5e7b,U+5e7d,U+5ed6,U+5f2f,U+5f66,U+5f6c,U+5fa1,U+604b,U+609f,U+60a6,U+60e8,U+6101,U+6124,U+6127,U+6148,U+61be,U+6247,U+62d8,U+62da,U+633d,U+635e,U+6367,U+6380,U+638f,U+63a9,U+63fd,U+641c,U+64e6,U+655e,U+6572,U+6591,U+65a5,U+6691,U+6735,U+67a2-67a3,U+67ef,U+680b,U+6876,U+6905,U+6a0a,U+6a61,U+6b79,U+6bb7,U+6bbf,U+6c41,U+6c55,U+6c83,U+6c9b,U+6ca7,U+6cfc,U+6d46,U+6d51,U+6d74,U+6d9d,U+6daf,U+6dc0,U+6deb,U+6e17,U+6e24,U+6e89,U+6ea2,U+6ef4,U+6f6d,U+707f,U+70b3,U+70e4,U+70ef,U+710a,U+722c,U+725f,U+7261,U+72ee,U+72f1,U+730e,U+732b,U+7433,U+7538,U+75bc,U+7624,U+7709,U+7750,U+7779,U+7802,U+7898,U+78a7,U+78b1,U+78cb,U+78f7,U+7984,U+7a83,U+7aed,U+7b3c,U+7b4b,U+7c92,U+7c98,U+7ca4,U+7eb9,U+7ee3,U+7ef3,U+7ef5,U+7f05,U+7f55,U+7f62,U+7fc1,U+7fd4,U+7fe0,U+8042,U+806a,U+80a0,U+80a4,U+80c3,U+8102,U+8106,U+814a,U+8154,U+8247,U+8258,U+82cd,U+8328,U+832b,U+8389,U+83ca,U+845b,U+846c,U+84b8,U+8574,U+859b,U+8680,U+8695,U+86c7,U+8702,U+886c,U+8896,U+88b1,U+88e4,U+8bc8,U+8c10,U+8c26,U+8c28,U+8c2d,U+8d4c,U+8d63,U+8f67,U+8f74,U+8fc4,U+9006,U+9063,U+90a2,U+90b1,U+90c1,U+9177,U+9189,U+9493,U+949e,U+94fe,U+9610,U+961c,U+96a7,U+96fe,U+978d,U+97f5,U+9888,U+997c,U+9a84,U+9b3c,U+9b44-9b45,U+9b54,U+9e64,U+9f0e,U+9f9a"}},{uri:mae,descriptors:{unicodeRange:"U+4e19,U+4e38,U+4e53,U+4e7e,U+4e9f,U+4ec6,U+4f50,U+4fde,U+502a,U+5154,U+517d,U+51d1,U+51f0,U+5239,U+5256,U+52c9,U+52fe,U+5308,U+532a,U+535c,U+5384,U+53a2,U+53a8,U+53c9,U+53e0,U+5496,U+54ac,U+54c0,U+54c4,U+54e8,U+5561,U+5582,U+561b,U+5631,U+566a,U+5764,U+576a,U+5792,U+57ab,U+584c,U+5885,U+58f6,U+59a8,U+5acc,U+5bc2,U+5c38-5c39,U+5c60,U+5c6f,U+5c82,U+5c90,U+5d16,U+5dcd,U+5e37,U+5e90,U+5eb8,U+5f6a,U+5fcc,U+6012,U+6068,U+6073,U+607c,U+6094,U+6109,U+621a,U+626e,U+6284,U+62d0,U+62e6,U+62fe,U+6321,U+6328,U+632b,U+6349,U+6454,U+65ed,U+660f,U+6674,U+66a8,U+6749,U+674f,U+6760,U+67af,U+6850,U+6854,U+6869,U+68a8,U+68d2,U+68f5,U+6912,U+6b49,U+6b6a,U+6bef,U+6c28,U+6c5d,U+6c82,U+6cab,U+6cb8,U+6cc4,U+6cf5,U+6d47,U+6d78,U+6da4,U+6dc4,U+6dcb,U+6df9,U+6e0a,U+6e23,U+6e5b,U+6eb6,U+6f06,U+6f47,U+6f84,U+6f9c,U+6fd2,U+7076,U+70ac,U+7199,U+723d,U+72ac,U+72ed,U+7476,U+7529,U+752b,U+754f,U+7554,U+75d5,U+7626,U+76ef,U+7720,U+7766,U+7784,U+77ac,U+780d,U+7838,U+7845,U+786b,U+78b3,U+7978,U+79b9,U+79c9,U+79e7,U+7a3d,U+7a84,U+7a9f,U+7b0b,U+7b52,U+7c7d,U+7f1a,U+7fc5,U+7ff0,U+804a,U+8086-8087,U+808c,U+809a,U+80ba,U+810a,U+8180,U+818f,U+81c2,U+81ed,U+8231,U+8292,U+829c,U+82a6,U+82d1,U+8346,U+838e,U+839e,U+83c7,U+83f1,U+8403,U+840e,U+8513,U+857e,U+85e4,U+867e,U+871c,U+87ba,U+87f9,U+884d,U+8944,U+8a93,U+8c05,U+8d2c,U+8d2e,U+8d42-8d43,U+8dfb,U+8e22,U+8eba,U+8f69,U+8f9c,U+8fa3,U+8fa8,U+8fb1,U+900a,U+9038,U+903b,U+9042,U+904f,U+90b5,U+90dd,U+9102,U+9187,U+94a7,U+94c5,U+9523,U+95f8,U+95fd,U+960e,U+964b-964c,U+96c1,U+9709,U+971c,U+97ad,U+9882,U+9965,U+9976,U+9988,U+99a8,U+9a82,U+9a9a,U+9b41,U+9c8d,U+9e45,U+9e70,U+9e9f,U+9f3b,U+9f7f"}},{uri:pae,descriptors:{unicodeRange:"U+4e08,U+4e18,U+4e1b,U+4e22,U+4e27,U+4e32,U+4e52,U+4e73,U+4ead,U+4ed4,U+4ed9,U+4ef0,U+4fa6,U+5076,U+5179,U+51bb,U+51c9,U+51ef,U+51fd,U+524a,U+526a,U+529d,U+52ab,U+5306,U+5339,U+53d9,U+540a,U+5410,U+541e,U+5439,U+54b1,U+54ed,U+5564,U+558a,U+55b7,U+5634,U+574a,U+5751,U+57a6,U+57cb,U+57d4,U+5824,U+582a,U+5835,U+5858,U+5893,U+58e4,U+5951,U+5986,U+59da,U+59fb,U+59ff,U+5a03,U+5a46,U+5ac1,U+5b5d,U+5bfa,U+5c18,U+5c3a,U+5c48,U+5c4f,U+5c61,U+5cb3,U+5d1b,U+5e15,U+5e3d,U+5e99,U+5e9e,U+5eca,U+5f0a,U+5f17-5f18,U+5f25,U+5f7c,U+5fcd,U+6028,U+60a0,U+60ac,U+60d1,U+614e,U+6155,U+6168,U+61c8,U+6208,U+6212,U+6251,U+629a-629b,U+62ab-62ac,U+62fc,U+6323,U+632a,U+63d2,U+643a,U+6491-6492,U+649e,U+64b0,U+64c5,U+659c,U+6614,U+662d,U+6664,U+6670,U+6676,U+6746,U+67cf,U+67d4,U+682a,U+6843,U+6846,U+68da,U+6b3a,U+6b67,U+6c27,U+6c5b,U+6c64,U+6c70,U+6caa,U+6cca,U+6ce1,U+6d12,U+6d45,U+6dd1,U+6dd8,U+6e34,U+6e7f,U+6ee5,U+6f02,U+7092,U+70c2,U+70e6,U+7115,U+7237,U+7272,U+727a,U+72c2,U+739b,U+73b2,U+743c,U+751c,U+758f,U+75b2,U+7686,U+76c6,U+76d2,U+76fc,U+775b,U+77a9,U+7816,U+788e,U+7897,U+78b0,U+79bd,U+7a0d,U+7a91,U+7a9d,U+7ae3,U+7bad,U+7cca,U+7d2b,U+7eb1,U+7f06,U+7f14,U+7f1d,U+7f50,U+7ffc,U+8036,U+80bf,U+80c1,U+80ce,U+80f8,U+8109,U+810f,U+8170,U+8179,U+819c,U+821f,U+8230,U+8236,U+8273,U+829d,U+82f9,U+8305,U+8350,U+83b2,U+83cc,U+8404,U+840d,U+8427,U+8482,U+8679,U+8854,U+886b,U+8bbc,U+8be6,U+8c31,U+8c6b,U+8d4b,U+8dcc,U+8e2a,U+8e48,U+8f90,U+8fb0,U+9022,U+903c,U+903e,U+9065,U+916c,U+917f,U+94a9,U+94c3,U+94dd,U+94ed,U+9510,U+953b,U+96c7,U+970d,U+9738,U+9877,U+987d,U+989c,U+98d8,U+9a70,U+9a91,U+9aa4,U+9b42,U+9b4f,U+9e2d,U+9e3f,U+9e7f,U+9f20"}},{uri:Uae,descriptors:{unicodeRange:"U+4e59,U+4ed3,U+4f0f,U+4f38,U+4f69,U+4fa7,U+4faf,U+4ff1,U+5077,U+5085,U+5144,U+5151,U+51af,U+51b6,U+51cc,U+523a,U+5251,U+5269,U+5272,U+52d8,U+5353,U+5389,U+53f9,U+5401,U+5415,U+541b,U+54f2,U+5524,U+554a,U+559d,U+5609,U+5740,U+575d,U+5806,U+5821,U+586b,U+5915,U+594f,U+5960,U+5999,U+59a5,U+59b9,U+59c6,U+59d1,U+59dc,U+5b5f,U+5b64,U+5b87,U+5bb4,U+5bbf,U+5c16,U+5c1d,U+5c3e,U+5c9a,U+5ca9,U+5cad,U+5cfb,U+5de1,U+5de7,U+5de9,U+5ef7,U+5f04,U+5f70,U+5f79,U+5fc6,U+602a,U+6050,U+6052,U+6070,U+6084,U+60b2,U+60dc,U+60e9,U+6167,U+6170,U+61c2,U+6270,U+6291,U+62b1,U+62bc,U+62dc,U+62df,U+62f3,U+6324,U+633a,U+6377,U+6398,U+63cf,U+640f,U+642c-642d,U+6458,U+6478,U+6500,U+654c,U+6566,U+658c,U+65c1,U+65cb,U+65e8,U+65ec,U+6696-6697,U+6734,U+679a,U+679d,U+67dc,U+67f3-67f4,U+680f,U+683d,U+684c,U+68af,U+699c,U+6bc1,U+6c0f,U+6c1b,U+6c57,U+6c6a,U+6d3d,U+6d6e,U+6d82,U+6db5,U+6dee,U+6e58,U+6eaa,U+6ecb,U+6ede,U+6ee9,U+6f0f,U+6f20,U+6f58,U+704c,U+7070,U+70b8,U+718a,U+7238,U+7262,U+7275,U+72b9,U+72d7,U+72e0,U+741b,U+7434,U+7483,U+74f6-74f7,U+75ab,U+764c,U+7761,U+7855,U+7891,U+78c1,U+79d2,U+7a00,U+7a3b,U+7c97,U+7ea4,U+7eb2,U+7ed2,U+7eea,U+7ef8,U+7f18,U+7fbd,U+8000,U+8010,U+8096,U+809d,U+80a9,U+817f,U+81e3,U+8206,U+8212,U+82ac,U+8302,U+8361,U+8377,U+83f2,U+8461,U+848b,U+84ec,U+8521,U+85aa,U+8870,U+8877,U+8881,U+888b,U+88ad,U+88c2,U+8986,U+8bd1,U+8bf1,U+8d24,U+8d2a,U+8d3e-8d3f,U+8d41,U+8d56,U+8d64,U+8d6b,U+8e0f,U+8f70,U+8f85,U+8f88,U+8fa9,U+9003,U+901d,U+90b9,U+90ce,U+94a6,U+94f8,U+9505,U+95ea,U+95ef,U+95f2,U+95f9,U+9601,U+9605,U+9634,U+966a,U+9677,U+9690,U+9694,U+96d5,U+971e,U+9896-9897,U+9972,U+9a71,U+9a76,U+9a7e,U+9e1f,U+9e23"}},{uri:bae,descriptors:{unicodeRange:"U+4e01,U+4e43,U+4ea6,U+4ef2,U+4eff,U+4f26,U+4f2a,U+4f2f,U+4f5b,U+4fa8,U+4fca,U+4fd7,U+5021,U+504f,U+5141,U+51c0,U+51dd,U+51e4,U+51ed,U+5200,U+5237,U+5427,U+5448,U+54a8,U+5706,U+5708,U+5723,U+575b,U+57c3,U+5899,U+58a8,U+58c1,U+5976,U+5988,U+59bb,U+59d0,U+59d3,U+5a18,U+5a31,U+5a92,U+5b54,U+5b85,U+5baa-5bab,U+5bc4,U+5bd2,U+5be8,U+5bff,U+5c65,U+5d07,U+5e1d,U+5e78,U+5e7c,U+5f03,U+5f1f,U+5f39,U+5f6d,U+5f92,U+5faa,U+5fbd,U+5fe7,U+5ffd,U+60a8,U+60ef,U+6108,U+6162,U+622a,U+6234,U+626b,U+626d,U+62c6,U+62d2,U+62d4,U+62d6,U+62e8,U+6316,U+6355,U+63ed,U+6447,U+64a4,U+65f1,U+6606,U+6628,U+664b,U+6668,U+6682,U+66f9,U+66fc,U+66ff,U+6717,U+6740,U+676d,U+67aa,U+67ec,U+67f1,U+6842,U+6851,U+695a,U+6982,U+6a2a,U+6b20,U+6b23,U+6b32,U+6b96,U+6bc5,U+6beb,U+6c60,U+6c9f,U+6cea,U+6cf3,U+6d1e,U+6d53,U+6d66,U+6d69,U+6d8c,U+6d9b,U+6db2,U+6de1,U+6dfb,U+6e14,U+6ed1,U+6eda,U+6ee8,U+6f2b,U+706d,U+7089,U+708e,U+70ad-70ae,U+70e7,U+7126,U+714c,U+71c3,U+71d5,U+7206,U+7259,U+731b,U+73a9,U+73bb,U+74dc,U+7532,U+7545,U+755c,U+75c7,U+7687,U+76d7,U+76f2,U+788d,U+78e8,U+79e6,U+79e9,U+7a3f,U+7a46,U+7a97,U+7af9,U+7bee,U+7c4d,U+7c89,U+7cd6,U+7eb5,U+7ebd,U+7ed8,U+8017,U+8033,U+80c0,U+80de,U+80f6,U+8138,U+817e,U+81a8,U+820d,U+827e,U+82b3,U+82d7,U+83b1,U+84c4,U+84dd,U+8584,U+864e,U+865a,U+866b,U+86cb,U+88d5,U+89e6,U+8bca,U+8bde,U+8bfa,U+8c0a,U+8c37,U+8c46,U+8c6a,U+8c8c,U+8d1d,U+8d29,U+8d4f,U+8d54,U+8d5a,U+8d60,U+8d62,U+8f7f,U+8f96,U+8f9e-8f9f,U+8fc1,U+8fdf,U+8fea,U+8ff7,U+9012,U+906d,U+9075,U+90a6,U+90bb,U+90ca,U+9178,U+9192,U+91ca,U+94bb,U+94dc,U+94fa,U+9501,U+950b,U+9521,U+955c,U+963b,U+9655,U+9675-9676,U+9887,U+9891,U+9971,U+9a97,U+9ece,U+9ed8"}},{uri:yae,descriptors:{unicodeRange:"U+4e1d,U+4e39,U+4e4c,U+4e4f,U+4e54,U+4e58,U+4e95,U+4ea1,U+4eab,U+4eae,U+4ec1,U+4f10,U+4f19,U+4f30,U+4f34,U+4fb5,U+503e,U+518c,U+5192,U+51a0,U+51ac,U+51b0,U+51e1,U+5211,U+5242,U+52a3,U+52b2,U+52c3,U+52c7,U+52d2,U+52e4,U+5377,U+539a,U+53a6,U+53e5,U+5417,U+5510,U+552f,U+5531,U+574f-5750,U+5761,U+5851,U+5854,U+58ee,U+593a,U+5949,U+5954,U+5a5a,U+5b8b,U+5bbd,U+5c04,U+5c0a,U+5c4b,U+5ce1,U+5cf0,U+5e10,U+5e8a,U+5e9f,U+5ec9,U+5f31,U+5f84,U+5fd8-5fd9,U+5fe0,U+6015,U+6062,U+6069,U+6076,U+6089,U+60a3,U+60ca,U+620f,U+624e,U+6263,U+6298,U+62a2,U+62bd,U+6311,U+6350,U+6389,U+638c,U+63f4,U+6446,U+644a,U+6469,U+64cd,U+654f,U+6562,U+656c,U+65d7,U+65e6,U+65fa,U+660c,U+6653,U+66b4,U+670b,U+672b,U+676f-6770,U+6881,U+6885,U+68a6,U+68cb,U+68ee,U+6b8a,U+6c88-6c89,U+6cc9,U+6ce5,U+6d01,U+6d17,U+6d1b,U+6d59,U+6d6a,U+6da8,U+6df7,U+6e10,U+6e20-6e21,U+6f5c,U+706f,U+70bc,U+719f,U+7267,U+732a,U+73cd,U+7518,U+756a,U+7586,U+7591,U+75db,U+76c8,U+76d0,U+76d6,U+76d8,U+76df,U+76fe,U+77db,U+7801,U+786c,U+795d,U+7965,U+79cb,U+7a77,U+7a7f,U+7aef,U+7b11,U+7bb1,U+7bc7,U+7ea0,U+7eaf,U+7ed5,U+7edc,U+7f13,U+7f29,U+7f34,U+7f8a,U+7ffb,U+8015,U+8058,U+805a,U+8083,U+80af,U+80c6,U+80cc,U+811a,U+8150,U+82e5,U+8336,U+8352,U+83ab,U+8428,U+8463,U+852c,U+8861,U+89c8,U+8bcd,U+8bd7,U+8bda,U+8be2,U+8bef,U+8bf8,U+8c0b,U+8c13,U+8d34,U+8d3a,U+8d74,U+8d76,U+8da3,U+8dd1,U+8ddd,U+8ddf,U+8df3,U+8f68,U+8f6f,U+8f7d,U+8f91,U+8f9b,U+8fbd,U+8fc8,U+8fd4,U+8feb,U+8ff9,U+900f,U+9057,U+907f-9080,U+90d1,U+90ed,U+91ce,U+9519,U+9526,U+95ed,U+9614,U+9635,U+9644,U+9686,U+96c5,U+96ea,U+9707,U+9732,U+9759,U+978b,U+9876,U+9881,U+9910,U+996e,U+9970,U+9c81,U+9e21,U+9ebb,U+9f84"}},{uri:Eae,descriptors:{unicodeRange:"U+4e3d,U+4e4e,U+4e71,U+4e8f,U+4ed8,U+4eea,U+4f0a,U+4f0d,U+4f11,U+4f1f,U+4f24,U+4f3c,U+4f73,U+4fc4,U+500d,U+5012,U+501f,U+503a,U+505c,U+507f,U+50a8,U+514d,U+5178,U+517c,U+51b2,U+51b7,U+520a,U+5238,U+523b,U+52b1,U+535a,U+5371,U+5385,U+53eb-53ec,U+53f3,U+53f6,U+5409,U+542b,U+542f,U+5434,U+5462,U+5473,U+547c,U+54c8,U+54ea,U+56fa,U+5733,U+5757,U+5766,U+5802,U+585e,U+590f,U+591c,U+591f,U+5947,U+594b,U+5987,U+5a01,U+5b59,U+5b63,U+5b88,U+5b97,U+5b9c,U+5bbe,U+5bfb,U+5c01,U+5c1a,U+5c24,U+5c3c,U+5c97,U+5c9b,U+5cb8,U+5de6,U+5e01,U+5e2e,U+5e45,U+5e55,U+5e84,U+5ef6,U+5f02,U+5f52,U+5f69,U+5f7b,U+5f90,U+5fae,U+6000,U+600e,U+6025,U+60e0,U+6276,U+6297,U+62b5,U+62cd,U+62d3,U+62e5,U+62e9,U+62ff,U+6302,U+632f,U+63e1,U+6444,U+64ad,U+653b,U+6551,U+6563,U+65a4,U+65e7,U+6620,U+667a,U+66f2,U+671d,U+6731,U+6742,U+675f,U+6768,U+677e-677f,U+6790,U+67b6,U+67d3,U+6863,U+68b0,U+68c9,U+690d,U+6b8b,U+6bcd,U+6bd2,U+6bd5,U+6c38,U+6c61,U+6cbf,U+6cdb,U+6cf0,U+6d2a,U+6d89,U+6da6,U+6f6e,U+6fb3,U+7075,U+707e,U+70df,U+7164,U+7236,U+725b,U+7389,U+73e0,U+745e,U+74e6,U+751a,U+7537,U+75be,U+76ae,U+76db,U+793c,U+7956,U+7981,U+79d8,U+79df,U+79fb,U+7adf,U+7ae5,U+7b14,U+7b26,U+7b54,U+7b79,U+7d2f,U+7eb8,U+7eba,U+7ec6,U+7ee9,U+7eff,U+7f5a,U+7f6a,U+7f72,U+8089,U+80a5,U+80e1,U+8111,U+8131,U+821e,U+822c,U+8270,U+8499,U+8651,U+867d,U+8840,U+8857,U+8863,U+88c1,U+89c9,U+89d2,U+8a89,U+8bed,U+8bfe,U+8c01,U+8c22,U+8d21,U+8d25,U+8d2f,U+8d5e,U+8d75,U+8d8b,U+8dc3,U+8de8,U+8df5,U+8f6e,U+8f86,U+8f89,U+8fc5,U+8ff0,U+8ffd,U+9014,U+904d,U+90ae,U+9274,U+949f,U+952e,U+969c,U+96c4,U+96e8,U+96f6-96f7,U+97e9,U+987f,U+996d,U+9a7b,U+9aa8,U+9c7c,U+9c9c,U+9e4f,U+9f13,U+9f50"}},{uri:vae,descriptors:{unicodeRange:"U+4e13,U+4e16,U+4e1c,U+4e24,U+4e3e,U+4e49,U+4e61,U+4e66,U+4e89,U+4e8c,U+4e94,U+4e9b,U+4ea4,U+4eac,U+4ebf,U+4eca,U+4ef6-4ef7,U+4efb,U+4f18,U+4f20,U+4f46,U+4f7f,U+4fe1,U+503c,U+505a,U+5146,U+5148,U+515a,U+5171,U+5177,U+519b,U+51b3,U+51c6,U+51e0,U+5212,U+521b,U+522b,U+529e,U+52bf,U+534e-534f,U+5355,U+5357,U+5382,U+539f,U+53bb,U+53bf,U+53c2,U+53c8,U+53ca,U+53d6-53d8,U+53e3,U+53ea,U+53f0,U+540d,U+5411,U+56db,U+56de,U+56e0,U+56e2,U+578b,U+57ce,U+57fa,U+589e,U+5904,U+5934,U+5982,U+5b89,U+5b8c,U+5bfc,U+5c06,U+5c11,U+5c40,U+5c71,U+5e38,U+5e72,U+5e76,U+5e7f,U+5e94,U+5e9c,U+5f0f,U+5f15,U+5f20,U+5f3a,U+5f62,U+5f88,U+5fc5,U+5fd7,U+5feb,U+601d,U+6027,U+60c5,U+60f3,U+610f,U+6216,U+6218,U+624b,U+624d,U+6279,U+628a,U+6295,U+6301,U+6307,U+636e,U+63a5,U+63a8,U+652f,U+6536,U+653e,U+6548,U+6559,U+6570,U+65bd,U+65e0,U+6602,U+660e,U+6613,U+66f4,U+6700,U+670d,U+671f,U+672f,U+6743,U+674e,U+6751,U+6761,U+6784,U+6797,U+679c,U+67e5,U+6807,U+6837,U+683c,U+6b21,U+6b63-6b65,U+6bcf,U+6bd4,U+6c42,U+6c5f,U+6ca1,U+6cbb,U+6d3b,U+6d41,U+6d88,U+6df1,U+70b9,U+7136,U+7269,U+7279,U+7531,U+754c,U+767e,U+76ca,U+76f8,U+770b,U+7740,U+7814,U+79ef,U+7a0b,U+7a0e,U+7a76,U+7b80,U+7cbe,U+7cfb,U+7e41,U+7ea7,U+7ec4,U+7ec7,U+7ed3,U+7ed9,U+7edf,U+7f8e,U+8001,U+804c,U+8054,U+80b2,U+81f3,U+8425,U+8868,U+88ab,U+897f,U+89c1-89c2,U+89c4,U+89c6,U+89e3,U+8ba1,U+8ba4,U+8bae,U+8bb0,U+8bba,U+8bc1,U+8c03,U+8d28,U+8d39,U+8def,U+8f66,U+8f6c,U+8fd0-8fd1,U+9020,U+9053,U+90a3,U+90fd,U+91cc,U+9500,U+9547,U+95e8,U+95f4,U+961f,U+9645,U+9662,U+96be,U+96c6,U+9700,U+9769,U+97e6,U+9875,U+9879,U+9886,U+9898,U+98ce,U+9996,U+2b5af,U+2cc56,U+2e9f5,U+30edd-30ede"}},{uri:_ae,descriptors:{unicodeRange:"U+4e03,U+4e30,U+4e34,U+4e45,U+4e60,U+4e70,U+4e88,U+4e91-4e92,U+4ea9,U+4eb2,U+4ec0,U+4ecb,U+4ecd,U+4ee4,U+4fee,U+5019,U+5047,U+50cf,U+5145,U+516d,U+5170,U+5175,U+5199,U+51cf,U+51fb,U+521a,U+5224,U+5267,U+52aa,U+5347-5348,U+534a,U+5356,U+5361,U+536b,U+5370,U+538b,U+53e4,U+53e6,U+5403,U+5426,U+5428,U+542c,U+5438,U+5668,U+56ed,U+56f4,U+56fe,U+57df,U+592a,U+5957,U+5b69,U+5b81,U+5b8f,U+5b98,U+5b9d,U+5ba1,U+5ba4,U+5bb3,U+5bc6,U+5bdf,U+5c3d,U+5c5e,U+5c81,U+5ddd,U+5de8,U+5dee,U+5e0c,U+5e86,U+5e8f,U+5e93,U+5e95,U+5e97,U+5ea7,U+5ead,U+5eb7,U+5f55,U+5f81,U+5f85,U+5ff5,U+6001,U+613f,U+6258,U+6267,U+6269,U+626c,U+627e,U+62db,U+62ec,U+6325,U+635f,U+6362,U+6388,U+6392,U+63a2,U+63a7,U+63aa,U+641e,U+6545,U+6597,U+65e2,U+65e9,U+661f,U+665a,U+666e-666f,U+66fe,U+6728,U+67d0,U+6811,U+6838,U+6865,U+697c,U+6b22,U+6b27,U+6b4c,U+6b62,U+6b66,U+6b7b,U+6bdb,U+6c47,U+6c49,U+6c7d,U+6c99,U+6cfd,U+6d0b,U+6d25,U+6d32,U+6d3e,U+6d4b,U+6e29,U+6e56,U+6e7e,U+6f14,U+6fc0,U+706b,U+70c8,U+7247,U+72af,U+72b6,U+72ec,U+732e,U+73ed,U+7403,U+7533,U+753b,U+7559,U+7565,U+7597,U+767b,U+773c,U+7763,U+77ed,U+77ff,U+7968,U+798f,U+79bb,U+79c0-79c1,U+7ad9,U+7ae0,U+7b51,U+7b7e,U+7cae,U+7d22,U+7ea2,U+7eb3,U+7eb7,U+7ec3,U+7ec8,U+7ecd,U+7edd,U+7efc,U+7f16,U+7f3a,U+7f51,U+7f57,U+7f6e,U+80dc,U+822a,U+8239,U+826f,U+82cf,U+82e6,U+8349,U+8363,U+83dc,U+8457,U+85cf,U+878d,U+8865,U+8a00,U+8b66,U+8ba2,U+8ba8,U+8bad,U+8bb2,U+8bc9,U+8bd5,U+8bfb,U+8d2b,U+8d35,U+8d37,U+8f7b,U+8f93,U+8fce,U+8fdd,U+9000-9002,U+9010,U+9047,U+9093,U+9152,U+9488,U+94a2,U+9633,U+9636,U+963f,U+9646,U+9648,U+964d,U+9664,U+9669,U+9760,U+97f3,U+987a,U+987e,U+9884,U+98de,U+9986,U+9ed1"}},{uri:wae,descriptors:{unicodeRange:"U+4e14,U+4e25,U+4e48,U+4e50,U+4e5d,U+4e9a,U+4ec5,U+4efd,U+4f17,U+4f4e-4f4f,U+4f55,U+4f59,U+4f60,U+4f8b,U+4f9b,U+4f9d,U+4fbf,U+4fc3,U+5065,U+513f,U+5149,U+514b,U+516b,U+5174,U+517b,U+518d,U+51b5,U+5207,U+5217-5219,U+521d,U+526f,U+529f,U+52a9,U+52b3,U+5305,U+533b,U+5343,U+5360,U+5373-5374,U+5386,U+53cb-53cd,U+53f2,U+53f7,U+544a,U+5468,U+547d,U+54cd,U+552e,U+5584,U+56f0,U+571f,U+5747,U+575a,U+57f9,U+5883,U+58eb,U+58f0,U+5907,U+590d,U+592e,U+5931,U+5956,U+5965,U+5973,U+5979,U+59cb,U+5b57-5b58,U+5b83,U+5ba2-5ba3,U+5bb9,U+5bcc,U+5c42,U+5c45,U+5c4a,U+5dde,U+5df1,U+5df4,U+5e03,U+5e08,U+5e26,U+5e2d,U+5f71,U+5f80,U+5f8b,U+5fb7,U+606f,U+611f,U+6237,U+623f,U+6253,U+627f,U+6293,U+62a4,U+62c5,U+62c9,U+6309,U+6574,U+6599,U+65ad,U+65af,U+65c5,U+65cf,U+6625,U+663e,U+671b,U+672a,U+6750,U+6781,U+6821,U+6839,U+6848,U+68c0,U+6a21,U+6b3e,U+6bb5,U+6c14,U+6cb3,U+6cb9,U+6ce8,U+6e05,U+6e2f,U+6e38,U+6e90,U+6ee1,U+70ed,U+7167,U+7231,U+7248,U+724c,U+7387,U+738b,U+73af,U+7530,U+75c5,U+767d,U+76d1,U+76f4,U+771f,U+77e5,U+77f3,U+7834,U+7840,U+786e,U+793a,U+795e,U+79f0,U+7a33,U+7a7a,U+7a81,U+7ade,U+7b56,U+7b97,U+7c73,U+7c7b,U+7d20,U+7d27,U+7ea6,U+7eaa,U+7ebf,U+7ee7,U+7eed,U+7ef4,U+7fa4,U+8003,U+80a1,U+81f4,U+8272,U+827a,U+8282,U+82b1,U+82f1,U+8303,U+836f,U+83b7,U+843d,U+88c5,U+8ba9,U+8baf,U+8bb8,U+8bbf,U+8bc4,U+8bc6,U+8bdd,U+8be5,U+8bf7,U+8c08,U+8c61,U+8d1f,U+8d22-8d23,U+8d27,U+8d2d,U+8d38,U+8d5b,U+8d70,U+8d85,U+8d8a,U+8db3,U+8eab,U+8f83,U+8fb9,U+8fdc,U+8fde,U+9009,U+901f,U+914d,U+91c7,U+94b1,U+94c1,U+94f6,U+95fb,U+9632,U+9650,U+968f,U+9752,U+975e,U+987b,U+989d,U+98df,U+9999,U+9a6c,U+9a8c,U+9ec4,U+9feb-9fec"}},{uri:Tae,descriptors:{unicodeRange:"U+98fb-990c,U+990e-990f,U+9911-992d,U+992f-9953,U+9956-9962,U+9964,U+9966,U+9973,U+9978-9979,U+997b,U+997e,U+9982-9983,U+9989,U+998c,U+998e,U+999a-99a4,U+99a6-99a7,U+99a9-99c8"}},{uri:Sae,descriptors:{unicodeRange:"U+8e4c-8e50,U+8e53-8e58,U+8e5a-8e65,U+8e67-8e68,U+8e6a-8e6b,U+8e6e,U+8e71,U+8e73,U+8e75,U+8e77-8e7b,U+8e7d-8e7e,U+8e80,U+8e82-8e84,U+8e86,U+8e88-8e8e,U+8e91-8e93,U+8e95-8e9b,U+8e9d,U+8e9f-8eaa,U+8ead-8eae,U+8eb0-8eb1,U+8eb3-8eb9,U+8ebb-8ecd,U+8ecf-8f02"}},{uri:Iae,descriptors:{unicodeRange:"U+2e3a,U+3001-3002,U+3008-3011,U+3014-3017,U+301d-301f,U+4dae,U+4e00,U+4e07,U+4e09-4e0b,U+4e0d-4e0e,U+4e1a,U+4e2a,U+4e2d,U+4e3a-4e3b,U+4e4b,U+4e5f,U+4e86,U+4e8b,U+4e8e,U+4ea7,U+4eba,U+4ece,U+4ed1,U+4ed6,U+4ee3,U+4ee5,U+4eec,U+4f01,U+4f1a,U+4f4d,U+4f53,U+4f5c,U+4fdd,U+5143,U+5165,U+5168,U+516c,U+5173,U+5176,U+5185,U+519c,U+51fa,U+5206,U+5229,U+5230,U+5236,U+524d,U+529b,U+52a0-52a1,U+52a8,U+5316-5317,U+533a,U+5341,U+5362,U+53d1,U+53ef,U+53f8,U+5404,U+5408,U+540c,U+540e,U+5458,U+548c,U+54c1,U+54e5,U+5546,U+559c,U+56fd,U+5728,U+5730,U+573a,U+5916,U+591a,U+5927,U+5929,U+592b,U+597d,U+59d4,U+5b50,U+5b66,U+5b9a,U+5b9e,U+5bb6,U+5bf9,U+5c0f,U+5c14,U+5c31,U+5c55,U+5de5,U+5df2,U+5e02,U+5e73-5e74,U+5ea6,U+5efa,U+5f00,U+5f53,U+5f97,U+5fc3,U+603b,U+6210-6211,U+6240,U+6280,U+62a5,U+63d0,U+6539,U+653f,U+6587,U+65b0,U+65b9,U+65e5,U+65f6,U+662f,U+6708-6709,U+672c,U+673a,U+675c,U+6765,U+6c11,U+6c34,U+6cd5,U+6ce2,U+6d4e,U+6d77,U+73b0,U+7406,U+751f,U+7528,U+7535,U+7684,U+76ee,U+793e,U+79cd,U+79d1,U+7acb,U+7b2c,U+7b49,U+7ba1,U+7ecf,U+8005,U+800c,U+80fd,U+81ea,U+884c,U+8981,U+8bbe,U+8bf4,U+8d44,U+8d77,U+8fbe,U+8fc7,U+8fd8-8fd9,U+8fdb,U+901a,U+90e8,U+91cd,U+91cf,U+91d1,U+9485,U+957f,U+95ee,U+9762,U+9ad8,U+9ea6,U+9f99,U+9fcf,U+9fd4,U+9fed,U+fe10-fe19,U+fe30-fe31,U+fe33-fe44,U+ff01,U+ff0c,U+ff1f,U+2b4e7,U+2b7f7,U+2b7fc,U+2cb2d,U+2cb3b,U+2cb4a,U+2cb5b,U+2cb73"}},{uri:xae,descriptors:{unicodeRange:"U+6490,U+6493-6494,U+6497-6498,U+649a-649d,U+649f-64a3,U+64a5-64a8,U+64aa-64ab,U+64af,U+64b1-64b4,U+64b6,U+64b9,U+64bb,U+64bd-64bf,U+64c1,U+64c3-64c4,U+64c6-64cc,U+64cf,U+64d1,U+64d3-64d6,U+64d9-64dd,U+64df-64e1,U+64e3,U+64e5,U+64e7-64ff,U+6501-6508,U+650a-6511,U+6513-6517,U+6519-6524,U+6526-652a,U+652c-652d,U+6530-6533,U+6537,U+653a,U+653c-653d,U+6540-6544,U+6546-6547,U+654a-654b,U+654d-654e,U+6550,U+6552-6554,U+6557-6558,U+655a,U+655c,U+655f-6561,U+6564-6565,U+6567-6568"}},{uri:Cae,descriptors:{unicodeRange:"U+9695-9696,U+969a-969b,U+969d-96a6,U+96a8-96af,U+96b1-96b2,U+96b4-96b5,U+96b7-96b8,U+96ba-96bb,U+96bf,U+96c2-96c3,U+96c8,U+96ca-96cb,U+96d0-96d1,U+96d3-96d4,U+96d6-96df,U+96e1-96e7,U+96eb-96ee,U+96f0-96f2,U+96f4-96f5,U+96f8,U+96fa-96fd,U+96ff,U+9702-9703,U+9705,U+970a-970c,U+9710-9712,U+9714-9715,U+9717-971b,U+971d,U+971f-9729,U+972b-972c,U+972e-972f,U+9731,U+9733-9737,U+973a-973d,U+973f-9751,U+9754-9755,U+9757-9758,U+975a,U+975c-975d,U+975f,U+9763-9764,U+9766-9768,U+976a-9770"}},{uri:Aae,descriptors:{unicodeRange:"U+6af0-6b1f,U+6b25-6b26,U+6b28-6b31,U+6b33-6b36,U+6b38,U+6b3b-6b3d,U+6b3f-6b42,U+6b44-6b45,U+6b48,U+6b4a-6b4b,U+6b4d-6b58,U+6b5a-6b61,U+6b68-6b69,U+6b6b-6b78,U+6b7a,U+6b7d-6b80,U+6b85,U+6b88,U+6b8c,U+6b8e-6b91,U+6b94-6b95,U+6b97-6b99,U+6b9c-6ba0,U+6ba2-6ba9,U+6bab-6bb2,U+6bb6,U+6bb8-6bba"}},{uri:Mae,descriptors:{unicodeRange:"U+430e-439a,U+29e8a,U+29ec4,U+29edb,U+29ee9,U+29f7e,U+29f83,U+29f8c,U+29fce,U+2a01a,U+2a02f,U+2a082,U+2a0f9,U+2a190,U+2a38c"}},{uri:Rae,descriptors:{unicodeRange:"U+92ef-933d,U+933f-9369,U+936b-9388"}},{uri:kae,descriptors:{unicodeRange:"U+4512-458d,U+2b300,U+2b363,U+2b36f,U+2b372,U+2b37d,U+2b404,U+2b410,U+2b413,U+2b461,U+2b4ef,U+2b4f6,U+2b4f9,U+2b50d-2b50e,U+2b536,U+2b5ae,U+2b5b3,U+2b5e7,U+2b5f4,U+2b61c-2b61d,U+2b626-2b628,U+2b62a,U+2b62c,U+2b695-2b696,U+2b6ad,U+2b6ed"}},{uri:Lae,descriptors:{unicodeRange:"U+88bd-88c0,U+88c3-88c4,U+88c7-88c8,U+88ca-88cd,U+88cf-88d1,U+88d3,U+88d6-88d7,U+88da-88de,U+88e0-88e1,U+88e6-88e7,U+88e9-88ef,U+88f2,U+88f5-88f7,U+88fa-88fb,U+88fd,U+88ff-8901,U+8903-8909,U+890b-890f,U+8911,U+8914-8918,U+891c-8920,U+8922-8924,U+8926-8929,U+892c-892f,U+8931-8933,U+8935,U+8937-8940,U+8942-8943,U+8945-895d,U+8960-8965,U+8967-897a,U+897c-897e,U+8980,U+8982,U+8984-8985"}},{uri:Dae,descriptors:{unicodeRange:"U+4b0b-4ba0"}},{uri:Nae,descriptors:{unicodeRange:"U+7179,U+717b-717c,U+717e-7183,U+7185-7189,U+718b-718e,U+7190-7193,U+7195-7197,U+719a-719e,U+71a1-71a7,U+71a9-71ab,U+71ad-71b2,U+71b4,U+71b6-71b8,U+71ba-71c2,U+71c4-71cd,U+71cf-71d3,U+71d6-71df,U+71e1-71e4,U+71e6,U+71e8-71ed,U+71ef-71f8,U+71fa-7205,U+7207-721c,U+721e-7227,U+7229,U+722b,U+722d"}},{uri:Oae,descriptors:{unicodeRange:"U+982e-9874,U+988b,U+988e,U+9892,U+9895,U+9899,U+98a3,U+98a8-98cd,U+98cf-98d0,U+98d4,U+98d6-98d7,U+98db-98dd,U+98e0-98e6,U+98e9-98fa"}},{uri:Pae,descriptors:{unicodeRange:"U+7c14-7c15,U+7c17-7c1e,U+7c20-7c25,U+7c28-7c29,U+7c2b-7c37,U+7c39-7c3e,U+7c42-7c4c,U+7c4e-7c72,U+7c75-7c7a,U+7c7e-7c88,U+7c8a-7c90,U+7c93-7c94,U+7c96,U+7c99-7c9b,U+7ca0-7ca1,U+7ca3,U+7ca6-7ca9,U+7cab-7cad,U+7caf-7cb0,U+7cb4-7cb8,U+7cba-7cbb,U+7cbf-7cc0,U+7cc2-7cc4,U+7cc6,U+7cc9,U+7ccb,U+7cce-7cd4"}},{uri:Fae,descriptors:{unicodeRange:"U+7d95-7da5,U+7da7-7dad,U+7daf-7e2a"}},{uri:Bae,descriptors:{unicodeRange:"U+4a78-4b0a"}},{uri:zae,descriptors:{unicodeRange:"U+9b30-9b31,U+9b33-9b3a,U+9b3d-9b40,U+9b46,U+9b4a-9b4c,U+9b4e,U+9b50,U+9b52-9b53,U+9b55-9bcf"}},{uri:Hae,descriptors:{unicodeRange:"U+6a4b-6a4f,U+6a51-6a57,U+6a5a,U+6a5c-6a60,U+6a62-6a64,U+6a66-6a70,U+6a72-6a78,U+6a7a-6a7b,U+6a7d-6a7f,U+6a81-6a83,U+6a85-6a8d,U+6a8f,U+6a92-6a96,U+6a98-6a9f,U+6aa1-6aa8,U+6aaa,U+6aad-6aef"}},{uri:Vae,descriptors:{unicodeRange:"U+99c9-9a53"}},{uri:$ae,descriptors:{unicodeRange:"U+8550-8555,U+8557-8558,U+855a-855d,U+855f-8563,U+8565-8567,U+8569-8571,U+8573,U+8575-8578,U+857c-857d,U+857f-8583,U+8586,U+8588-858e,U+8590-859a,U+859d-85a3,U+85a5-85a7,U+85a9,U+85ab-85ad,U+85b1-85b6,U+85b8,U+85ba-85c0,U+85c2-85c8,U+85ca-85ce,U+85d1-85d2,U+85d4,U+85d6-85db,U+85dd-85e3,U+85e5-85e8,U+85ea-85fa,U+85fc-85fe,U+8600-8603"}},{uri:Gae,descriptors:{unicodeRange:"U+6fb2,U+6fb4-6fb5,U+6fb7-6fb8,U+6fba-6fbf,U+6fc1,U+6fc3-6fc8,U+6fca-6fd0,U+6fd3-6fdd,U+6fdf,U+6fe2-6fed,U+6ff0-7010,U+7012-7019,U+701c-7022,U+7024-7034,U+7036-7038,U+703a-704b,U+704d-704e,U+7050-7053"}},{uri:Xae,descriptors:{unicodeRange:"U+4ba1-4c2c"}},{uri:jae,descriptors:{unicodeRange:"U+9a54-9a6b,U+9a72,U+9a83,U+9a89,U+9a8d-9a8e,U+9a94-9a95,U+9a99,U+9aa6,U+9aa9-9aaf,U+9ab2-9ab5,U+9ab9,U+9abb,U+9abd-9abf,U+9ac3-9ac4,U+9ac6-9aca,U+9acd-9ad0,U+9ad2,U+9ad4-9ad7,U+9ad9-9ade,U+9ae0,U+9ae2-9ae5,U+9ae7-9aea,U+9aec,U+9aee,U+9af0-9af8,U+9afa,U+9afc-9b02,U+9b04-9b07,U+9b09-9b0e,U+9b10-9b12,U+9b14-9b1e,U+9b20-9b22,U+9b24-9b2e"}},{uri:Yae,descriptors:{unicodeRange:"U+9d1a-9da1"}},{uri:Wae,descriptors:{unicodeRange:"U+9e13-9e1e,U+9e24,U+9e27,U+9e2e,U+9e30,U+9e34,U+9e3b-9e3c,U+9e40,U+9e4d,U+9e50,U+9e52-9e54,U+9e56,U+9e59,U+9e5d,U+9e5f-9e62,U+9e65,U+9e6e-9e6f,U+9e72,U+9e74-9e7d,U+9e80-9e81,U+9e83-9e86,U+9e89-9e8a,U+9e8c-9e91,U+9e94-9e9c,U+9e9e,U+9ea0-9ea5,U+9ea7-9eb3,U+9eb5-9eb7,U+9eb9-9eba,U+9ebc,U+9ebf-9ec3,U+9ec5-9ec8,U+9eca-9ecc,U+9ed0,U+9ed2-9ed3,U+9ed5-9ed7,U+9ed9-9eda,U+9ede,U+9ee1,U+9ee3-9ee4,U+9ee6,U+9ee8,U+9eeb-9eee,U+9ef0-9ef8"}},{uri:Kae,descriptors:{unicodeRange:"U+8b1c-8b25,U+8b27-8b65,U+8b67-8b6b,U+8b6d-8b9f,U+8bac,U+8bb1,U+8bbb,U+8bc7,U+8bd0"}},{uri:Zae,descriptors:{unicodeRange:"U+4cad-4d2f"}},{uri:qae,descriptors:{unicodeRange:"U+9c4b-9c7b,U+9c7d-9c7e,U+9c80,U+9c83-9c84,U+9c89-9c8a,U+9c8c,U+9c8f,U+9c93,U+9c96-9c99,U+9c9d,U+9caa,U+9cac,U+9caf,U+9cb9,U+9cbe-9cc2,U+9cc8-9cc9,U+9cd1-9cd2,U+9cda-9cdb,U+9ce0-9ce1,U+9ce3-9d19"}},{uri:Qae,descriptors:{unicodeRange:"U+9389-938e,U+9390-93c9,U+93cb-93d5,U+93d7-9410"}},{uri:Jae,descriptors:{unicodeRange:"U+20a0-20b5,U+20b9-20ba,U+20bc-20bd,U+4e2c,U+5107,U+5216,U+5293,U+54f3,U+5523,U+5819,U+5adc,U+5c88,U+5e3b,U+5fee,U+62f6,U+63be,U+6484,U+6499,U+67d9,U+67dd,U+6d5e,U+6f46,U+717a,U+71e0,U+72c1,U+73e7,U+75b0,U+7603,U+7722,U+7809,U+7811,U+7946,U+7967,U+799a,U+7b45,U+7ba2,U+8014,U+80d9,U+8159,U+817d,U+81a3,U+81aa,U+8201,U+833c,U+836e,U+83e5,U+8459,U+84f0,U+8729,U+8753,U+87d3,U+89dc,U+8bf6,U+8c2e,U+8e2c,U+8e9c,U+8e9e,U+8ece,U+8fee,U+9139,U+914f,U+9174,U+9191,U+960c,U+9622,U+9a98,U+9b48,U+9ca6,U+9cb0,U+9da2-9e12,U+9e88,U+9f44,U+9f86"}},{uri:ele,descriptors:{unicodeRange:"U+9bd0-9c4a"}},{uri:tle,descriptors:{unicodeRange:"U+4c2d-4cac"}},{uri:nle,descriptors:{unicodeRange:"U+4d30-4dab"}},{uri:ile,descriptors:{unicodeRange:"U+9411-943d,U+943f-946a,U+946c-9484"}},{uri:rle,descriptors:{unicodeRange:"U+9efa,U+9efd,U+9eff-9f0a,U+9f0c,U+9f0f,U+9f11-9f12,U+9f14-9f16,U+9f18,U+9f1a-9f1f,U+9f21,U+9f23-9f2b,U+9f2d-9f2e,U+9f30-9f36,U+9f38,U+9f3a,U+9f3c,U+9f3f-9f43,U+9f45-9f4f,U+9f52-9f7e,U+9f81-9f82,U+9f8d-9f94"}},{uri:sle,descriptors:{unicodeRange:"U+7e2b-7e3a,U+7e3c-7e40,U+7e42-7e46,U+7e48-7e81,U+7e83-7e9a,U+7e9c-7e9e,U+7eae,U+7eb4,U+7ebb-7ebc,U+7ed6,U+7ee4,U+7eec,U+7ef9,U+7f0a,U+7f10,U+7f1e,U+7f37,U+7f39,U+7f3b"}}],Je=class Je{constructor(t){F(this,"scene");F(this,"getSceneFamilies",()=>Je.getUniqueFamilies(this.scene.getNonDeletedElements()));F(this,"onLoaded",t=>{let n=!0;for(const s of t){const o=`${s.family}-${s.style}-${s.weight}-${s.unicodeRange}`;Je.loadedFontsCache.has(o)||(Je.loadedFontsCache.add(o),n=!1)}if(n)return;let i=!1;const r=this.scene.getNonDeletedElementsMap();for(const s of this.scene.getNonDeletedElements())if(de(s)){i=!0,Gt.delete(s),Vm.clearCache(xt(s));const o=ui(s,r);o&&Gt.delete(o)}i&&this.scene.triggerUpdate()});F(this,"loadSceneFonts",async()=>{const t=this.getSceneFamilies(),n=Je.getCharsPerFamily(this.scene.getNonDeletedElements());return Je.loadFontFaces(t,n)});this.scene=t}static get registered(){return Je._registered?Je._initialized||(Je._registered=new Map([...Je.init().entries(),...Je._registered.entries()])):Je._registered=Je.init(),Je._registered}get registered(){return Je.registered}static async generateFontFaceDeclarations(t){const n=Je.getUniqueFamilies(t),i=Je.getCharsPerFamily(t),r=n.find(l=>OO(l).includes(Cf));if(r){const l=Je.getCharacters(i,r);if(Yee(l)){const c=Af[Cf];i[c]=new Set(l),n.unshift(Af[Cf])}}const s=Je.fontFacesStylesGenerator(n,i),o=3,a=await new hx(s,o).all();return Array.from(new Set(a))}static async loadFontFaces(t,n){for(const{fontFaces:o,metadata:a}of Je.registered.values())if(!a.local)for(const{fontFace:l}of o)window.document.fonts.has(l)||window.document.fonts.add(l);const i=Je.fontFacesLoader(t,n),r=10;return(await new hx(i,r).all()).flat().filter(Boolean)}static*fontFacesLoader(t,n){for(const[i,r]of t.entries()){const s=xt({fontFamily:r,fontSize:16}),o=Je.getCharacters(n,r);window.document.fonts.check(s,o)||(yield Uc(async()=>{var a;try{const l=await window.document.fonts.load(s,o);return[i,l]}catch(l){console.error(`Failed to load font "${s}" from urls "${(a=Je.registered.get(r))==null?void 0:a.fontFaces.map(c=>c.urls)}"`,l)}}))}}static*fontFacesStylesGenerator(t,n){for(const[i,r]of t.entries()){const{fontFaces:s,metadata:o}=Je.registered.get(r)??{};if(!Array.isArray(s)){console.error(`Couldn't find registered fonts for font-family "${r}"`,Je.registered);continue}if(!(o!=null&&o.local))for(const[a,l]of s.entries())yield Uc(async()=>{try{const c=Je.getCharacters(n,r),u=await l.toCSS(c);return u?[i*1e4+a,u]:void 0}catch(c){console.error(`Couldn't transform font-face to css for family "${l.fontFace.family}"`,c)}})}}static register(t,n,...i){const r=At[t]??Af[t];return this.registered.get(r)||this.registered.set(r,{metadata:n,fontFaces:i.map(({uri:o,descriptors:a})=>new oE(t,o,a))}),this.registered}static init(){const t={registered:new Map},n=(i,...r)=>{const s=At[i]??Af[i],o=hb[s]??hb[At.Excalifont];Je.register.call(t,i,o,...r)};return n("Cascadia",...Cie),n("Comic Shanns",...Lie),n("Excalifont",...Vie),n("Helvetica",...$ie),n("JetBrains Mono",...Xie),n("Liberation Sans",...Yie),n("Liberation Mono",...Kie),n("Liberation Serif",...qie),n("Lilita One",...ere),n("Nunito",...ore),n("Roboto Mono",...lre),n("Adwaita Sans",...ure),n("Virgil",...fre),n(Cf,...ole),n(M0,...Die),Je._initialized=!0,t.registered}static getUniqueFamilies(t){return Array.from(t.reduce((n,i)=>(de(i)&&n.add(i.fontFamily),n),new Set))}static getCharsPerFamily(t){const n={};for(const i of t)if(de(i))for(const r of i.originalText)n[i.fontFamily]||(n[i.fontFamily]=new Set),n[i.fontFamily].add(r);return n}static getCharacters(t,n){return t[n]?Array.from(t[n]).join(""):""}static getAllFamilies(){return Array.from(Je.registered.keys())}};F(Je,"loadedFontsCache",new Set),F(Je,"_registered"),F(Je,"_initialized",!1),F(Je,"loadElementsFonts",async t=>{const n=Je.getUniqueFamilies(t),i=Je.getCharsPerFamily(t);return Je.loadFontFaces(n,i)});let Vs=Je;const eB=(e,t,n)=>{var c;const{unitsPerEm:i,ascender:r,descender:s}=((c=Vs.registered.get(e))==null?void 0:c.metadata.metrics)||hb[At.Virgil].metrics,o=t/i,a=(n-o*r+o*s)/2;return o*r+a},qu=e=>{var n;const{lineHeight:t}=((n=Vs.registered.get(e))==null?void 0:n.metadata.metrics)||hb[At.Excalifont].metrics;return t},Qs=(e,{x:t,y:n,strokeColor:i=ln.strokeColor,backgroundColor:r=ln.backgroundColor,fillStyle:s=ln.fillStyle,strokeWidth:o=ln.strokeWidth,strokeStyle:a=ln.strokeStyle,roughness:l=ln.roughness,opacity:c=ln.opacity,width:u=0,height:d=0,angle:f=0,groupIds:h=[],frameId:m=null,index:p=null,roundness:b=null,boundElements:E=null,link:y=null,locked:v=ln.locked,..._})=>((t<-1e6||t>1e6||n<-1e6||n>1e6||u<-1e6||u>1e6||d<-1e6||d>1e6)&&console.error("New element size or position is too large",{x:t,y:n,width:u,height:d,points:_.points}),{id:_.id||bs(),type:e,x:t,y:n,width:u,height:d,angle:f,strokeColor:i,backgroundColor:r,fillStyle:s,strokeWidth:o,strokeStyle:a,roughness:l,opacity:c,groupIds:h,frameId:m,index:p,roundness:b,seed:_.seed??Bo(),version:_.version||1,versionNonce:_.versionNonce??0,isDeleted:!1,boundElements:E,updated:Jh(),link:y,locked:v,customData:_.customData}),Xa=e=>Qs(e.type,e),$x=e=>Qs("embeddable",e),ale=e=>({...Qs("iframe",e)}),S9=e=>Ce({...Qs("frame",e),type:"frame",name:(e==null?void 0:e.name)||null},{}),aE=e=>Ce({...Qs("magicframe",e),type:"magicframe",name:(e==null?void 0:e.name)||null},{}),tB=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),Br=e=>{const t=e.fontFamily||Oc,n=e.fontSize||al,i=e.lineHeight||qu(t),r=bh(e.text),s=zi(r,xt({fontFamily:t,fontSize:n}),i),o=e.textAlign||Dm,a=e.verticalAlign||K2,l=tB({textAlign:o,verticalAlign:a},s),c={...Qs("text",e),text:r,fontSize:n,fontFamily:t,textAlign:o,verticalAlign:a,x:e.x-l.x,y:e.y-l.y,width:s.width,height:s.height,containerId:e.containerId||null,originalText:e.originalText??r,autoResize:e.autoResize??!0,lineHeight:i};return Ce(c,{})},lle=(e,t,n)=>{let{width:i,height:r}=zi(n,xt(e),e.lineHeight);e.autoResize||(i=e.width);const{textAlign:s,verticalAlign:o}=e;let a,l;if(s==="center"&&o===Ar.MIDDLE&&!e.containerId&&e.autoResize){const c=zi(e.text,xt(e),e.lineHeight),u=tB(e,{width:i-c.width,height:r-c.height});a=e.x-u.x,l=e.y-u.y}else{const[c,u,d,f]=De(e,t),[h,m,p,b]=sc(e,i,r,!1),E=(c-h)/2,y=(u-m)/2,v=(d-p)/2,_=(f-b)/2;[a,l]=cle({s:!0,e:s==="center"||s==="left",w:s==="center"||s==="right"},e.x,e.y,e.angle,E,y,v,_)}return{width:i,height:r,x:Number.isFinite(a)?a:e.x,y:Number.isFinite(l)?l:e.y}},cle=(e,t,n,i,r,s,o,a)=>{const l=Math.cos(i),c=Math.sin(i);return e.e&&e.w?t+=r+o:e.e?(t+=r*(1+l),n+=r*c,t+=o*(1-l),n+=o*-c):e.w&&(t+=r*(1-l),n+=r*-c,t+=o*(1+l),n+=o*c),e.n&&e.s?n+=s+a:e.n?(t+=s*c,n+=s*(1-l),t+=a*-c,n+=a*(1+l)):(t+=s*-c,n+=s*(1+l),t+=a*c,n+=a*(1-l)),[t,n]},nB=(e,t,n,i=e.text)=>{if(e.isDeleted)return;(t||!e.autoResize)&&(i=Id(i,xt(e),t?Ka(t,e):e.width));const r=lle(e,n,i);return{text:i,...r}},ule=e=>({...Qs(e.type,e),points:e.points||[],pressures:e.pressures||[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),Pu=e=>({...Qs(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:null,endArrowhead:null}),I9=e=>e.elbowed?{...Qs(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!0,fixedSegments:e.fixedSegments||[],startIsSpecial:!1,endIsSpecial:!1}:{...Qs(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:e.startArrowhead||null,endArrowhead:e.endArrowhead||null,elbowed:!1},iB=e=>({...Qs("image",e),strokeColor:"transparent",status:e.status??"pending",fileId:e.fileId??null,scale:e.scale??[1,1],crop:e.crop??null}),gb=(e,t=0)=>{if(e==null||typeof e!="object")return e;if(Object.prototype.toString.call(e)==="[object Object]"){const i=typeof e.constructor=="function"?Object.create(Object.getPrototypeOf(e)):{};for(const r in e)if(e.hasOwnProperty(r)){if(t===0&&(r==="shape"||r==="canvas"))continue;i[r]=gb(e[r],t+1)}return i}if(Array.isArray(e)){let i=e.length;const r=new Array(i);for(;i--;)r[i]=gb(e[i],t+1);return r}return e},Cd=e=>gb(e),mb=()=>bs(),rB=(e,t,n,i)=>{let r=Cd(n);return r.id=mb(),r.boundElements=null,r.updated=Jh(),r.seed=Bo(),r.groupIds=mte(r.groupIds,e,s=>(t.has(s)||t.set(s,mb()),t.get(s))),i&&(r=Object.assign(r,i)),r},sB=(e,t)=>{const n=[],i=Se(e),r=new Map,s=a=>{if(r.has(a))return r.get(a);if(i.has(a)){const l=mb();return r.set(a,l),l}return null},o=new Map;for(const a of e){const l=gb(a);if(l.id=s(a.id),t!=null&&t.randomizeSeed&&(l.seed=Bo(),y5(l)),l.groupIds&&(l.groupIds=l.groupIds.map(c=>(o.has(c)||o.set(c,mb()),o.get(c)))),"containerId"in l&&l.containerId){const c=s(l.containerId);l.containerId=c}if("boundElements"in l&&l.boundElements&&(l.boundElements=l.boundElements.reduce((c,u)=>{const d=s(u.id);return d&&c.push({...u,id:d}),c},[])),"endBinding"in l&&l.endBinding){const c=s(l.endBinding.elementId);l.endBinding=c?{...l.endBinding,elementId:c}:null}if("startBinding"in l&&l.startBinding){const c=s(l.startBinding.elementId);l.startBinding=c?{...l.startBinding,elementId:c}:null}l.frameId&&(l.frameId=s(l.frameId)),n.push(l)}return n},oB=e=>{const{angle:t,width:n,height:i,x:r,y:s}=e,o=r+n/2,a=s+i/2,l=C(o,a);let c;return e.type==="diamond"?c=ax(q(C(o,s),l,t),q(C(r+n,a),l,t),q(C(o,s+i),l,t),q(C(r,a),l,t)):c=ax(q(C(r,s),l,t),q(C(r+n,s),l,t),q(C(r+n,s+i),l,t),q(C(r,s+i),l,t)),{type:"polygon",data:c}},dle=(e,t,n=10)=>{let[i,r,s,o,a,l]=De(e,t,!0);i-=n,s+=n,r-=n,o+=n;const c=C(a,l),u=q(C(i,r),c,e.angle),d=q(C(s,r),c,e.angle),f=q(C(i,o),c,e.angle),h=q(C(s,o),c,e.angle);return{type:"polygon",data:[u,d,h,f]}},fle=e=>{const{width:t,height:n,angle:i,x:r,y:s}=e;return{type:"ellipse",data:{center:C(r+t/2,s+n/2),angle:i,halfWidth:t/2,halfHeight:n/2}}},Fc=e=>{if(!e)return[];for(const t of e.sets)if(t.type==="path")return t.ops;return e.sets[0].ops},hle=(e,t=C(0,0),n,i)=>{const r=l=>q(C(l[0]+t[0],l[1]+t[1]),i,n),s=Fc(e),o=[];let a=C(0,0);for(const l of s){if(l.op==="move"){const c=r9(l.data);qi(c!=null,"Ops data is not a point"),a=r(c)}if(l.op==="bcurveTo"){const c=r(C(l.data[0],l.data[1])),u=r(C(l.data[2],l.data[3])),d=r(C(l.data[4],l.data[5]));o.push(xa(a,c,u,d)),a=d}}return{type:"polycurve",data:o}},gle=e=>{let t=e[0];const n=[];for(let i=1;i<e.length;i++){const r=e[i];n.push(we(t,r)),t=r}return n},mle=(e,t,n=!1)=>{const i=s=>q(Ve(Bl(_e(s),Ui(e.x,e.y))),t,e.angle),r=gle(e.points.map(s=>i(s)));return n?{type:"polygon",data:lb(r.flat())}:{type:"polyline",data:r}},ple=(e,t,n=C(0,0),i,r)=>{const s=u=>q(C(u[0]+n[0],u[1]+n[1]),r,i);if(e.roundness===null)return{type:"polygon",data:lb(e.points.map(u=>s(u)))};const o=Fc(t),a=[];let l=!1;for(const u of o)u.op==="move"?(l=!l,l&&a.push(C(u.data[0],u.data[1]))):u.op==="bcurveTo"?l&&(a.push(C(u.data[0],u.data[1])),a.push(C(u.data[2],u.data[3])),a.push(C(u.data[4],u.data[5]))):u.op==="lineTo"&&l&&a.push(C(u.data[0],u.data[1]));const c=n9(a,10,5).map(u=>s(u));return{type:"polygon",data:lb(c)}},Ule=(e,t)=>{const{angle:n,halfWidth:i,halfHeight:r,center:s}=t,o=i,a=r,l=Bl(_e(e),fn(_e(s),-1)),[c,u]=q(Ve(l),C(0,0),-n),d=Math.abs(c),f=Math.abs(u);let h=.707,m=.707;for(let E=0;E<3;E++){const y=o*h,v=a*m,_=(o*o-a*a)*h**3/o,I=(a*a-o*o)*m**3/a,R=y-_,w=v-I,T=d-_,A=f-I,S=Math.hypot(w,R),k=Math.hypot(A,T);h=Math.min(1,Math.max(0,(T*S/k+_)/o)),m=Math.min(1,Math.max(0,(A*S/k+I)/a));const N=Math.hypot(m,h);h/=N,m/=N}const[p,b]=[o*h*Math.sign(c),a*m*Math.sign(u)];return pt(C(c,u),C(p,b))},ble=(e,t,n=$a)=>Ule(e,t)<=n,yle=(e,t)=>{const{center:n,angle:i,halfWidth:r,halfHeight:s}=t,o=Bl(_e(e),fn(_e(n),-1)),[a,l]=q(Ve(o),C(0,0),-i);return a/r*(a/r)+l/s*(l/s)<=1},lE=(e,t,n=0)=>{switch(t.type){case"polygon":return mee(e,t.data,n);case"ellipse":return ble(e,t.data,n);case"line":return Wu(e,t.data,n);case"polyline":return lB(e,t.data,n);case"curve":return aB(e,t.data,n);case"polycurve":return Ele(e,t.data,n);default:throw Error(`shape ${t} is not implemented`)}},pb=(e,t)=>{switch(t.type){case"polygon":return lx(e,t.data);case"line":return!1;case"curve":return!1;case"ellipse":return yle(e,t.data);case"polyline":{const n=lb(t.data.flat());return lx(e,n)}case"polycurve":return!1;default:throw Error(`shape ${t} is not implemented`)}},Ele=(e,t,n)=>t.some(i=>aB(e,i,n)),vle=e=>{const[t,n,i,r]=e;return(s,o)=>Math.pow(1-s,3)*r[o]+3*s*Math.pow(1-s,2)*i[o]+3*Math.pow(s,2)*(1-s)*n[o]+t[o]*Math.pow(s,3)},_le=(e,t=10)=>{const n=vle(e);let i=[n(0,0),n(0,1)];const r=[];let s=0;const o=1/t;for(let a=0;a<t;a++)if(s+=o,s<=1){const l=C(n(s,0),n(s,1));r.push(we(i,l)),i=l}return r},aB=(e,t,n)=>lB(e,_le(t),n),lB=(e,t,n=1e-4)=>t.some(i=>Wu(e,i,n)),tt={EQUAL:"Equal",MINUS:"Minus",NUM_ADD:"NumpadAdd",NUM_SUBTRACT:"NumpadSubtract",NUM_ZERO:"Numpad0",BRACKET_RIGHT:"BracketRight",BRACKET_LEFT:"BracketLeft",ONE:"Digit1",TWO:"Digit2",THREE:"Digit3",QUOTE:"Quote",ZERO:"Digit0",SLASH:"Slash",C:"KeyC",D:"KeyD",H:"KeyH",V:"KeyV",Z:"KeyZ",Y:"KeyY",R:"KeyR",S:"KeyS"},z={ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",BACKSPACE:"Backspace",ALT:"Alt",CTRL_OR_CMD:Fo?"metaKey":"ctrlKey",DELETE:"Delete",ENTER:"Enter",ESCAPE:"Escape",QUESTION_MARK:"?",SPACE:" ",TAB:"Tab",CHEVRON_LEFT:"<",CHEVRON_RIGHT:">",PERIOD:".",COMMA:",",SLASH:"/",A:"a",D:"d",E:"e",F:"f",G:"g",H:"h",I:"i",L:"l",O:"o",P:"p",Q:"q",R:"r",S:"s",T:"t",V:"v",X:"x",Y:"y",Z:"z",K:"k",0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9"},wle=new Map([[z.Z,tt.Z],[z.Y,tt.Y]]),Tle=e=>/^[a-z]$/.test(e.toLowerCase()),cE=(e,t)=>{if(t===e.key.toLowerCase())return!0;const n=wle.get(t);return!!(n&&!Tle(e.key)&&e.code===n)},ug=e=>e===z.ARROW_LEFT||e===z.ARROW_RIGHT||e===z.ARROW_DOWN||e===z.ARROW_UP,w8=e=>e.altKey,G1=e=>e.shiftKey,jg=e=>e.shiftKey;function cB(e,t,n){return{center:e,halfWidth:t,halfHeight:n}}const Sle=(e,t)=>{const{halfWidth:n,halfHeight:i,center:r}=t,s=n,o=i,a=Bl(_e(e),fn(_e(r),-1)),l=Math.abs(a[0]),c=Math.abs(a[1]);let u=.707,d=.707;for(let m=0;m<3;m++){const p=s*u,b=o*d,E=(s*s-o*o)*u**3/s,y=(o*o-s*s)*d**3/o,v=p-E,_=b-y,I=l-E,R=c-y,w=Math.hypot(_,v),T=Math.hypot(R,I);u=Math.min(1,Math.max(0,(I*w/T+E)/s)),d=Math.min(1,Math.max(0,(R*w/T+y)/o));const A=Math.hypot(d,u);u/=A,d/=A}const[f,h]=[s*u*Math.sign(a[0]),o*d*Math.sign(a[1])];return pt(Ve(a),C(f,h))};function Ile({center:e,halfWidth:t,halfHeight:n},[i,r]){const[s,o]=e,a=i[0]-s,l=i[1]-o,c=r[0]-s,u=r[1]-o,d=Math.pow(c-a,2)/Math.pow(t,2)+Math.pow(u-l,2)/Math.pow(n,2),f=2*(a*(c-a)/Math.pow(t,2)+l*(u-l)/Math.pow(n,2)),h=Math.pow(a,2)/Math.pow(t,2)+Math.pow(l,2)/Math.pow(n,2)-1,m=(-f+Math.sqrt(Math.pow(f,2)-4*d*h))/(2*d),p=(-f-Math.sqrt(Math.pow(f,2)-4*d*h))/(2*d),b=[C(a+m*(c-a)+s,l+m*(u-l)+o),C(a+p*(c-a)+s,l+p*(u-l)+o)].filter(E=>!isNaN(E[0])&&!isNaN(E[1]));return b.length===2&&Zs(b[0],b[1])?[b[0]]:b}function uB(e,t=0){const n=$s(Math.min(e.width,e.height),e);if(n<=0){const f=W3(C(e.x-t,e.y-t),C(e.x+e.width+t,e.y+e.height+t)),h=we(C(f[0][0]+n,f[0][1]),C(f[1][0]-n,f[0][1])),m=we(C(f[1][0],f[0][1]+n),C(f[1][0],f[1][1]-n)),p=we(C(f[0][0]+n,f[1][1]),C(f[1][0]-n,f[1][1])),b=we(C(f[0][0],f[1][1]-n),C(f[0][0],f[0][1]+n));return[[h,m,p,b],[]]}const i=C(e.x+e.width/2,e.y+e.height/2),r=W3(C(e.x,e.y),C(e.x+e.width,e.y+e.height)),s=we(C(r[0][0]+n,r[0][1]),C(r[1][0]-n,r[0][1])),o=we(C(r[1][0],r[0][1]+n),C(r[1][0],r[1][1]-n)),a=we(C(r[0][0]+n,r[1][1]),C(r[1][0]-n,r[1][1])),l=we(C(r[0][0],r[1][1]-n),C(r[0][0],r[0][1]+n)),c=[fn(Fi(_e(C(r[0][0]-t,r[0][1]-t),i)),t),fn(Fi(_e(C(r[1][0]+t,r[0][1]-t),i)),t),fn(Fi(_e(C(r[1][0]+t,r[1][1]+t),i)),t),fn(Fi(_e(C(r[0][0]-t,r[1][1]+t),i)),t)],u=[xa(Ve(c[0],l[1]),Ve(c[0],C(l[1][0]+2/3*(r[0][0]-l[1][0]),l[1][1]+2/3*(r[0][1]-l[1][1]))),Ve(c[0],C(s[0][0]+2/3*(r[0][0]-s[0][0]),s[0][1]+2/3*(r[0][1]-s[0][1]))),Ve(c[0],s[0])),xa(Ve(c[1],s[1]),Ve(c[1],C(s[1][0]+2/3*(r[1][0]-s[1][0]),s[1][1]+2/3*(r[0][1]-s[1][1]))),Ve(c[1],C(o[0][0]+2/3*(r[1][0]-o[0][0]),o[0][1]+2/3*(r[0][1]-o[0][1]))),Ve(c[1],o[0])),xa(Ve(c[2],o[1]),Ve(c[2],C(o[1][0]+2/3*(r[1][0]-o[1][0]),o[1][1]+2/3*(r[1][1]-o[1][1]))),Ve(c[2],C(a[1][0]+2/3*(r[1][0]-a[1][0]),a[1][1]+2/3*(r[1][1]-a[1][1]))),Ve(c[2],a[1])),xa(Ve(c[3],a[0]),Ve(c[3],C(a[0][0]+2/3*(r[0][0]-a[0][0]),a[0][1]+2/3*(r[1][1]-a[0][1]))),Ve(c[3],C(l[0][0]+2/3*(r[0][0]-l[0][0]),l[0][1]+2/3*(r[1][1]-l[0][1]))),Ve(c[3],l[0]))];return[[we(u[0][3],u[1][0]),we(u[1][3],u[2][0]),we(u[2][3],u[3][0]),we(u[3][3],u[0][0])],u]}function dB(e,t=0){var _;const[n,i,r,s,o,a,l,c]=bH(e),u=$s(Math.abs(n-l),e),d=$s(Math.abs(s-i),e);if(((_=e.roundness)==null?void 0:_.type)==null){const[I,R,w,T]=[C(e.x+n,e.y+i-t),C(e.x+r+t,e.y+s),C(e.x+o,e.y+a+t),C(e.x+l-t,e.y+c)],A=we(C(I[0]+u,I[1]+d),C(R[0]-u,R[1]-d)),S=we(C(R[0]-u,R[1]+d),C(w[0]+u,w[1]-d)),k=we(C(w[0]-u,w[1]-d),C(T[0]+u,T[1]+d)),N=we(C(T[0]+u,T[1]-d),C(I[0]-u,I[1]+d));return[[A,S,k,N],[]]}const f=C(e.x+e.width/2,e.y+e.height/2),[h,m,p,b]=[C(e.x+n,e.y+i),C(e.x+r,e.y+s),C(e.x+o,e.y+a),C(e.x+l,e.y+c)],E=[fn(Fi(_e(m,f)),t),fn(Fi(_e(p,f)),t),fn(Fi(_e(b,f)),t),fn(Fi(_e(h,f)),t)],y=[xa(Ve(E[0],C(m[0]-u,m[1]-d)),Ve(E[0],m),Ve(E[0],m),Ve(E[0],C(m[0]-u,m[1]+d))),xa(Ve(E[1],C(p[0]+u,p[1]-d)),Ve(E[1],p),Ve(E[1],p),Ve(E[1],C(p[0]-u,p[1]-d))),xa(Ve(E[2],C(b[0]+u,b[1]+d)),Ve(E[2],b),Ve(E[2],b),Ve(E[2],C(b[0]+u,b[1]-d))),xa(Ve(E[3],C(h[0]-u,h[1]+d)),Ve(E[3],h),Ve(E[3],h),Ve(E[3],C(h[0]+u,h[1]+d)))];return[[we(y[0][3],y[1][0]),we(y[1][3],y[2][0]),we(y[2][3],y[3][0]),we(y[3][3],y[0][0])],y]}const uE=e=>{if(e.type==="arrow")return!1;const t=!Fs(e.backgroundColor)||Us(e)||ts(e)||de(e);return e.type==="line"||e.type==="freedraw"?t&&ja(e.points):t||st(e)},df=({x:e,y:t,element:n,shape:i,threshold:r=10,frameNameBound:s=null})=>{let o=uE(n)&&pb(C(e,t),i)||lE(C(e,t),i,r);return!o&&s&&(o=pb(C(e,t),{type:"polygon",data:oB(s).data})),o},x9=(e,t,n,i,r=0)=>{let[s,o,a,l]=Js(n,i);return s-=r,o-=r,a+=r,l+=r,JP(C(s,o),C(e,t),C(a,l))},xle=(e,t)=>!df(e)&&!fB(e.x,e.y,gB(e.element,t))&&x9(e.x,e.y,e.element,t),fB=(e,t,n)=>!!n&&pb(C(e,t),n),hB=(e,t,n=0)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return Cle(e,t,n);case"diamond":return Ale(e,t,n);case"ellipse":return Mle(e,t,n);default:throw new Error(`Unimplemented element type '${e.type}'`)}},Cle=(e,t,n=0)=>{const i=C(e.x+e.width/2,e.y+e.height/2),r=q(t[0],i,-e.angle),s=q(t[1],i,-e.angle),[o,a]=uB(e,n);return[...o.map(l=>P0(we(r,s),l)).filter(l=>l!=null).map(l=>q(l,i,e.angle)),...a.flatMap(l=>eF(l,we(r,s))).filter(l=>l!=null).map(l=>q(l,i,e.angle))].filter((l,c,u)=>u.findIndex(d=>Zs(l,d))===c)},Ale=(e,t,n=0)=>{const i=C(e.x+e.width/2,e.y+e.height/2),r=q(t[0],i,-e.angle),s=q(t[1],i,-e.angle),[o,a]=dB(e,n);return[...o.map(l=>P0(we(r,s),l)).filter(l=>l!=null).map(l=>q(l,i,e.angle)),...a.flatMap(l=>eF(l,we(r,s))).filter(l=>l!=null).map(l=>q(l,i,e.angle))].filter((l,c,u)=>u.findIndex(d=>Zs(l,d))===c)},Mle=(e,t,n=0)=>{const i=C(e.x+e.width/2,e.y+e.height/2),r=q(t[0],i,-e.angle),s=q(t[1],i,-e.angle);return Ile(cB(i,e.width/2+n,e.height/2+n),Y3(r,s)).map(o=>q(o,i,e.angle))},C9=[{icon:Pte,value:"selection",key:z.V,numericKey:z[1],fillable:!0},{icon:Fte,value:"rectangle",key:z.R,numericKey:z[2],fillable:!0},{icon:Bte,value:"diamond",key:z.D,numericKey:z[3],fillable:!0},{icon:zte,value:"ellipse",key:z.O,numericKey:z[4],fillable:!0},{icon:Hte,value:"arrow",key:z.A,numericKey:z[5],fillable:!0},{icon:Vte,value:"line",key:z.L,numericKey:z[6],fillable:!0},{icon:B0,value:"freedraw",key:[z.P,z.X],numericKey:z[7],fillable:!1},{icon:DF,value:"text",key:z.T,numericKey:z[8],fillable:!1},{icon:Gte,value:"image",key:null,numericKey:z[9],fillable:!1},{icon:Xte,value:"eraser",key:z.E,numericKey:z[0],fillable:!1}],Rle=e=>{const t=C9.find((n,i)=>n.numericKey!=null&&e===n.numericKey.toString()||n.key&&(typeof n.key=="string"?n.key===e:n.key.includes(e)));return(t==null?void 0:t.value)||null},ha=(e,t)=>{var n;switch(e.type){case"rectangle":case"diamond":case"frame":case"magicframe":case"embeddable":case"image":case"iframe":case"text":case"selection":return oB(e);case"arrow":case"line":{const i=((n=Gt.get(e))==null?void 0:n[0])??Gt.generateElementShape(e,null)[0],[,,,,r,s]=De(e,t);return uE(e)?ple(e,i,C(e.x,e.y),e.angle,C(r,s)):hle(i,C(e.x,e.y),e.angle,C(r,s))}case"ellipse":return fle(e);case"freedraw":{const[,,,,i,r]=De(e,t);return mle(e,C(i,r),uE(e))}}},gB=(e,t)=>{const n=Oe(e,t);return n?e.type==="arrow"?ha({...n,...ue.getBoundTextElementPosition(e,n,t)},t):ha(n,t):null},mB=(e,t)=>{const n=Gt.generateElementShape(e,null);if(!n)return null;const i=Fc(n[0]);let r=C(0,0),s=0,o=1/0,a=null;for(;s<i.length;){const{op:l,data:c}=i[s];if(l==="move"&&(qi(pu(c),"The returned ops is not compatible with a point"),r=c),l==="bcurveTo"){const u=r,d=C(c[0],c[1]),f=C(c[2],c[3]),h=C(c[4],c[5]),m=pt(h,t);m<o&&(o=m,a=[u,d,f,h]),r=h}s++}return a},pB=(e,t,n,i,r)=>{const s=(l,c)=>Math.pow(1-l,3)*i[c]+3*l*Math.pow(1-l,2)*n[c]+3*Math.pow(l,2)*(1-l)*t[c]+e[c]*Math.pow(l,3),o=s(r,0),a=s(r,1);return C(o,a)},kle=(e,t)=>{const n=mB(e,t);if(!n)return[];const i=[];let r=1;for(;r>0;){const s=pB(n[0],n[1],n[2],n[3],r);i.push(C(s[0],s[1])),r-=.05}return i.length&&Zs(i.at(-1),t)&&i.push(C(t[0],t[1])),i},UB=(e,t)=>{const n=[];n[0]=0;const i=kle(e,t);let r=0,s=0;for(;r<i.length-1;){const o=pt(i[r],i[r+1]);s+=o,n.push(s),r++}return n},Lle=(e,t)=>UB(e,t).at(-1),Dle=(e,t,n)=>{const i=UB(e,t),r=i.length-1,s=i.at(-1),o=n*s;let a=0,l=r,c=0;for(;a<l;)c=Math.floor(a+(l-a)/2),i[c]<o?a=c+1:l=c;return i[c]>o&&c--,i[c]===o?c/r:1-(c+(o-i[c])/(i[c+1]-i[c]))/r},_o=(e,t)=>{const n={minX:e.x,minY:e.y,maxX:e.x+e.width,maxY:e.y+e.height,midX:e.x+e.width/2,midY:e.y+e.height/2},i=C(n.midX,n.midY),[r,s]=q(C(n.minX,n.minY),i,e.angle),[o,a]=q(C(n.maxX,n.minY),i,e.angle),[l,c]=q(C(n.maxX,n.maxY),i,e.angle),[u,d]=q(C(n.minX,n.maxY),i,e.angle),f=[Math.min(r,o,l,u),Math.min(s,a,c,d),Math.max(r,o,l,u),Math.max(s,a,c,d)];if(t){const[h,m,p,b]=t;return[f[0]-b,f[1]-h,f[2]+m,f[3]+p]}return f},Eh=(e,t)=>e[0]>t[0]&&e[0]<t[2]&&e[1]>t[1]&&e[1]<t[3],$s=(e,t)=>{var n,i,r,s;if(((n=t.roundness)==null?void 0:n.type)===On.PROPORTIONAL_RADIUS||((i=t.roundness)==null?void 0:i.type)===On.LEGACY)return e*a8;if(((r=t.roundness)==null?void 0:r.type)===On.ADAPTIVE_RADIUS){const o=((s=t.roundness)==null?void 0:s.value)??OQ,a=o/a8;return e<=a?e*a8:o}return 0},ja=(e,t=1)=>{if(e.length>=3){const[n,i]=[e[0],e[e.length-1]];return pt(n,i)<=VU/t}return!1},cn=[1,0],oi=[0,1],ur=[-1,0],dr=[0,-1],qp=(e,t)=>{const n=Pm(Math.atan2(t[1]-e[1],t[0]-e[0]));return n>=315||n<45?dr:n>=45&&n<135?cn:n>=135&&n<225?oi:ur},Qu=e=>{const[t,n]=e,i=Math.abs(t),r=Math.abs(n);return t>r?cn:t<=-r?ur:n>i?oi:dr},z0=(e,t)=>Qu(_e(e,t)),Ea=(e,t)=>Ca(z0(e,t)),hn=(e,t)=>e[0]===t[0]&&e[1]===t[1],Ca=e=>hn(e,cn)||hn(e,ur),bB=(e,t,n)=>{const r=s_(t);if(e.type==="diamond"){if(n[0]<e.x)return ur;if(n[1]<e.y)return dr;if(n[0]>e.x+e.width)return cn;if(n[1]>e.y+e.height)return oi;const c=q(ca(C(e.x+e.width/2,e.y),r,2),r,e.angle),u=q(ca(C(e.x+e.width,e.y+e.height/2),r,2),r,e.angle),d=q(ca(C(e.x+e.width/2,e.y+e.height),r,2),r,e.angle),f=q(ca(C(e.x,e.y+e.height/2),r,2),r,e.angle);return Xd([c,u,r],n)?qp(c,u):Xd([u,d,r],n)?qp(u,d):Xd([d,f,r],n)?qp(d,f):qp(f,c)}const s=ca(C(t[0],t[1]),r,2),o=ca(C(t[2],t[1]),r,2),a=ca(C(t[0],t[3]),r,2),l=ca(C(t[2],t[3]),r,2);return Xd([s,o,r],n)?dr:Xd([o,l,r],n)?cn:Xd([l,a,r],n)?oi:ur},yB=e=>[e[0]===0?0:e[0]>0?-1:1,e[1]===0?0:e[1]>0?-1:1],Z6=(e,t)=>{switch(e.type){case"rectangle":case"image":case"text":case"iframe":case"embeddable":case"frame":case"magicframe":return Nle(e,t);case"diamond":return Ole(e,t);case"ellipse":return Ple(e,t)}},Nle=(e,t)=>{const n=C(e.x+e.width/2,e.y+e.height/2),i=q(t,n,-e.angle),[r,s]=uB(e);return Math.min(...r.map(o=>s9(i,o)),...s.map(o=>tF(o,i)).filter(o=>o!==null))},Ole=(e,t)=>{const n=C(e.x+e.width/2,e.y+e.height/2),i=q(t,n,-e.angle),[r,s]=dB(e);return Math.min(...r.map(o=>s9(i,o)),...s.map(o=>tF(o,i)).filter(o=>o!==null))},Ple=(e,t)=>{const n=C(e.x+e.width/2,e.y+e.height/2);return Sle(q(t,n,-e.angle),cB(n,e.width/2,e.height/2))},Fle=e=>!e[z.CTRL_OR_CMD],bu=e=>e.isBindingEnabled,Wt=5,A9=10,M9=4,Ble=(e,t)=>{const n=[];return t.forEach(i=>{const r=e.getNonDeletedElement(i);r!=null&&n.push(r)}),n},q6=(e,t,n,i,r)=>{const s=new Set,o=new Set;Gx(e,t,n,"start",s,o,i),Gx(e,n,t,"end",s,o,i);const a=Array.from(o).filter(l=>!s.has(l));Ble(r,a).forEach(l=>{var c;ee(l,{boundElements:(c=l.boundElements)==null?void 0:c.filter(u=>u.type!=="arrow"||u.id!==e.id)})})},Gx=(e,t,n,i,r,s,o)=>{if(t!=="keep"){if(t===null){const a=Gle(e,i);a!=null&&s.add(a);return}wB(e)?(n==null||(n==="keep"?!vB(e,t,i):i==="start"||n.id!==t.id))&&(zo(e,t,i,o),r.add(t.id)):(zo(e,t,i,o),r.add(t.id))}},zle=(e,t,n,i)=>{var o,a;const r=TB(e,t,n),s=t==="start"?(o=e.startBinding)==null?void 0:o.elementId:(a=e.endBinding)==null?void 0:a.elementId;if(s){const l=n.get(s);if(qs(l)&&ZU(l,r,n,i))return l}return null},EB=(e,t,n)=>["start","end"].map(i=>zle(e,i,t,n)),Hle=(e,t,n,i,r,s)=>{const a=e.points.length-1,l=n.findIndex(f=>f===0)>-1,c=n.findIndex(f=>f===a)>-1,u=l?t?Df(e,"start",i,r,s):null:ge(e)?"keep":Df(e,"start",i,r,s),d=c?t?Df(e,"end",i,r,s):null:ge(e)?"keep":Df(e,"end",i,r,s);return[u,d]},Vle=(e,t,n,i,r)=>{if(ge(e))return["keep","keep"];const[s,o]=EB(e,t,r),a=s&&i?Df(e,"start",t,n,r):null,l=o&&i?Df(e,"end",t,n,r):null;return[a,l]},Ub=(e,t,n,i,r,s,o)=>{e.forEach(a=>{const[l,c]=s!=null&&s.length?Hle(a,r,s??[],t,n,o):Vle(a,t,n,r,o);q6(a,l,c,t,i)})},T8=(e,t,n)=>e.length>50?[]:e.filter(ke).flatMap(i=>EB(i,t,n)).filter(i=>i!==null).filter(i=>e.filter(r=>r.id===(i==null?void 0:i.id)).length===0),dE=(e,t,n,i,r)=>{t.startBoundElement!=null&&zo(e,t.startBoundElement,"start",i);const s=zs(n,r,i,t.zoom,ge(e),ge(e));s!==null&&(vB(e,s,"end")||zo(e,s,"end",i))},$le=(e,t)=>{let n=e.gap;const i=Gm(t,t.width,t.height);return n>i&&(n=A9+M9),{...e,gap:n}},zo=(e,t,n,i)=>{if(!Be(e))return;const r={elementId:t.id,...ge(e)?{...bb(e,t,n),focus:0,gap:0}:{...$le(Yle(e,t,n,i),t)}};ee(e,{[n==="start"?"startBinding":"endBinding"]:r}),Se(t.boundElements||[]).has(e.id)||ee(t,{boundElements:(t.boundElements||[]).concat({id:e.id,type:"arrow"})})},vB=(e,t,n)=>{const i=e[n==="start"?"endBinding":"startBinding"];return _B(e,i==null?void 0:i.elementId,t)},_B=(e,t,n)=>t===n.id&&wB(e),wB=e=>e.points.length<3,Gle=(e,t)=>{const n=t==="start"?"startBinding":"endBinding",i=e[n];return i==null?null:(ee(e,{[n]:null}),i.elementId)},zs=(e,t,n,i,r,s)=>{if(s){let a=!1;const l=jle(t,u=>qs(u,!1)&&ZU(u,e,n,i,(r||!g8(u))&&!Ie(u))).filter(u=>a?!1:(g8(u)||(a=!0),!0));if(!l||l.length===0)return null;if(l.length===1)return l[0];const c=l.filter(u=>ZU(u,e,n,i,!1));return c.length===1?c[0]:l.sort((u,d)=>d.width**2+d.height**2-(u.width**2+u.height**2)).pop()}return Xle(t,a=>qs(a,!1)&&ZU(a,e,n,i,(r||!g8(a))&&!Ie(a)))},Xle=(e,t)=>{let n=null;for(let i=e.length-1;i>=0;--i){const r=e[i];if(!r.isDeleted&&t(r)){n=r;break}}return n},jle=(e,t)=>{const n=[];for(let i=e.length-1;i>=0;--i){const r=e[i];r.isDeleted||t(r)&&n.push(r)}return n},Yle=(e,t,n,i)=>{const r=n==="start"?-1:1,s=r===-1?0:e.points.length-1,o=s-r,a=ue.getPointAtIndexGlobalCoordinates(e,s,i),l=ue.getPointAtIndexGlobalCoordinates(e,o,i);return{focus:nce(t,l,a),gap:Math.max(1,Z6(t,a))}},pr=(e,t,n)=>{const{newSize:i,simultaneouslyUpdated:r}=n??{},s=Kle(r);qs(e)&&yb(t,e,o=>{var m,p;if(!ke(o)||o.isDeleted||!Wle(o,e))return;const a=o.startBinding?t.get(o.startBinding.elementId):null,l=o.endBinding?t.get(o.endBinding.elementId):null;let c=null,u=null;a&&l&&(c=Js(a,t),u=Js(l,t));const d={startBinding:Xx(e,o.startBinding,i),endBinding:Xx(e,o.endBinding,i)};if(s.has(o.id)){ee(o,d,!0);return}const f=Eb(t,o,(b,E)=>{var y,v;if(b&&qs(b)&&(E==="startBinding"||E==="endBinding")&&(e.id===((y=o[E])==null?void 0:y.elementId)||e.id===((v=o[E==="startBinding"?"endBinding":"startBinding"])==null?void 0:v.elementId)&&!h1e(c,u))){const _=tce(o,E,d[E],b,t);if(_)return{index:E==="startBinding"?0:o.points.length-1,point:_}}return null}).filter(b=>b!==null);ue.movePoints(o,f,{...e.id===((m=o.startBinding)==null?void 0:m.elementId)?{startBinding:d.startBinding}:{},...e.id===((p=o.endBinding)==null?void 0:p.elementId)?{endBinding:d.endBinding}:{}});const h=Oe(o,t);h&&!h.isDeleted&&Wm(o,t,!1)})},Wle=(e,t)=>{var n,i;return((n=e.startBinding)==null?void 0:n.elementId)===t.id||((i=e.endBinding)==null?void 0:i.elementId)===t.id},Kle=e=>new Set((e||[]).map(t=>t.id)),Zle=(e,t,n,i,r,s,o)=>{const a=Qu(_e(t,e));return!n||!i?a:qle(s,n,r,o)?bB(n,i,e):Qu(_e(e,C(n.x+n.width/2,n.y+n.height/2)))},qle=(e,t,n,i)=>{const r=Z6(t,e),s=Gm(t,t.width,t.height,i);return r>s?null:r},H0=(e,t,n)=>{const i=t&&_o(t),r=e.points[n==="start"?0:e.points.length-1],s=C(e.x+r[0],e.y+r[1]),o=Nee(t)?Jle(t,s):s;if(t&&i){const a=s_(i),l=hB(t,we(a,Ve(fn(Fi(_e(o,a)),Math.max(t.width,t.height)),a)))[0],c=pt(o,a),u=Math.max(pt(l??o,a),$a),d=Do(c/u,6);switch(!0){case d>.9:return c-u>Wt||O0(o,l)<$a?o:Ve(fn(Fi(_e(o,l??a)),d>1?Wt:-5),l??a);default:return Qle(o,t,i)}}return o},Qle=(e,t,n)=>{const i=s_(n),r=Qu(_e(e,i));switch(!0){case hn(r,dr):return q(C((n[0]+n[2])/2+.1,n[1]),i,t.angle);case hn(r,cn):return q(C(n[2],(n[1]+n[3])/2+.1),i,t.angle);case hn(r,oi):return q(C((n[0]+n[2])/2-.1,n[3]),i,t.angle);default:return q(C(n[0],(n[1]+n[3])/2-.1),i,t.angle)}},Jle=(e,t)=>{const n=C(e.x+e.width/2,e.y+e.height/2),i=q(t,n,-e.angle);return i[0]<e.x&&i[1]<e.y?i[1]-e.y>-5?q(C(e.x-Wt,e.y),n,e.angle):q(C(e.x,e.y-Wt),n,e.angle):i[0]<e.x&&i[1]>e.y+e.height?i[0]-e.x>-5?q(C(e.x,e.y+e.height+Wt),n,e.angle):q(C(e.x-Wt,e.y+e.height),n,e.angle):i[0]>e.x+e.width&&i[1]>e.y+e.height?i[0]-e.x<e.width+Wt?q(C(e.x+e.width,e.y+e.height+Wt),n,e.angle):q(C(e.x+e.width+Wt,e.y+e.height),n,e.angle):i[0]>e.x+e.width&&i[1]<e.y?i[0]-e.x<e.width+Wt?q(C(e.x+e.width,e.y-Wt),n,e.angle):q(C(e.x+e.width+Wt,e.y),n,e.angle):t},ece=(e,t,n=.05)=>{const{x:i,y:r,width:s,height:o,angle:a}=e,l=C(i+s/2-.1,r+o/2-.1),c=q(t,l,-a),u=He(n*o,5,80),d=He(n*s,5,80);return c[0]<=i+s/2&&c[1]>l[1]-u&&c[1]<l[1]+u?q(C(i-Wt,l[1]),l,a):c[1]<=r+o/2&&c[0]>l[0]-d&&c[0]<l[0]+d?q(C(l[0],r-Wt),l,a):c[0]>=i+s/2&&c[1]>l[1]-u&&c[1]<l[1]+u?q(C(i+s+Wt,l[1]),l,a):c[1]>=r+o/2&&c[0]>l[0]-d&&c[0]<l[0]+d?q(C(l[0],r+o+Wt),l,a):t},tce=(e,t,n,i,r)=>{if(n==null||n.elementId!==i.id&&e.points.length>2)return null;const s=t==="startBinding"?-1:1,o=s===-1?0:e.points.length-1;if(ge(e)&&db(n)){const d=Q6(n.fixedPoint)??bb(e,i,t==="startBinding"?"start":"end").fixedPoint,f=C(i.x+i.width/2,i.y+i.height/2),h=C(i.x+d[0]*i.width,i.y+d[1]*i.height),m=q(h,f,i.angle);return ue.pointFromAbsoluteCoords(e,m,r)}const a=o-s,l=ue.getPointAtIndexGlobalCoordinates(e,a,r),c=ice(i,n.focus,l);let u;if(n.gap===0)u=c;else{const d=ue.getPointAtIndexGlobalCoordinates(e,o,r),f=C(i.x+i.width/2,i.y+i.height/2),h=pt(l,d)+pt(l,f)+Math.max(i.width,i.height)*2,m=hB(i,we(l,Ve(fn(Fi(_e(c,l)),h),l)),n.gap).sort((p,b)=>O0(p,l)-O0(b,l));m.length>1?u=m[0]:m.length===1?u=c:u=d}return ue.pointFromAbsoluteCoords(e,u,r)},bb=(e,t,n,i)=>{const r=[t.x,t.y,t.x+t.width,t.y+t.height],s=H0(e,t,n),o=C(r[0]+(r[2]-r[0])/2,r[1]+(r[3]-r[1])/2),a=q(s,o,-t.angle);return{fixedPoint:Q6([(a[0]-t.x)/t.width,(a[1]-t.y)/t.height])}},Xx=(e,t,n)=>{if(t==null||n==null)return t;const{width:i,height:r}=n,{width:s,height:o}=e,a=Math.max(1,Math.min(Gm(e,i,r),t.gap*(i<r?i/s:r/o)));return{...t,gap:a}},Df=(e,t,n,i,r)=>zs(TB(e,t,n),i,n,r,ge(e),ge(e)),TB=(e,t,n)=>{const i=t==="start"?0:-1;return Ps(ue.getPointAtIndexGlobalCoordinates(e,i,n))},SB=(e,t,n,i)=>{const r=new Set,s=new Set,o=i==="duplicatesServeAsOld",a=new Map([...n].map(([l,c])=>[c,l]));t.forEach(l=>{const{boundElements:c}=l;if(c!=null&&c.length>0&&(c.forEach(u=>{o&&!n.has(u.id)&&r.add(u.id)}),s.add(n.get(l.id))),So(l)){if(l.startBinding!=null){const{elementId:u}=l.startBinding;o&&!n.has(u)&&s.add(u)}if(l.endBinding!=null){const{elementId:u}=l.endBinding;o&&!n.has(u)&&s.add(u)}(l.startBinding!=null||l.endBinding!=null)&&r.add(n.get(l.id))}}),e.filter(({id:l})=>r.has(l)).forEach(l=>{const{startBinding:c,endBinding:u}=l;ee(l,{startBinding:jx(c,n),endBinding:jx(u,n)})}),e.filter(({id:l})=>s.has(l)).forEach(l=>{var d;const c=a.get(l.id),u=(d=e.find(({id:f})=>f===c))==null?void 0:d.boundElements;u&&u.length>0&&ee(l,{boundElements:u.map(f=>n.has(f.id)?{id:n.get(f.id),type:f.type}:f)})})},jx=(e,t)=>e==null?null:{...e,elementId:t.get(e.elementId)??e.elementId},IB=(e,t)=>{const n=Se(e);for(const i of t)Nf.unbindAffected(n,i,ee),Of.unbindAffected(n,i,ee)},Yg=(e,t,n=[])=>{if(!e)return null;const i=e.filter(r=>!t.has(r.id));return i.push(...n.map(r=>({id:r.id,type:r.type}))),i},ZU=(e,{x:t,y:n},i,r,s)=>{const o=Gm(e,e.width,e.height,r),a=ha(e,i);return lE(C(t,n),a,o)||s===!0&&Eh(C(t,n),_o(e))},Gm=(e,t,n,i)=>{const r=i!=null&&i.value&&i.value<1?i.value:1,o=(e.type==="diamond"?1/Math.sqrt(2):1)*Math.min(t,n);return Math.max(16,Math.min(.25*o,32),A9/r+M9)},nce=(e,t,n)=>{const i=C(e.x+e.width/2,e.y+e.height/2);if(Zs(t,n))return 0;const r=q(t,i,-e.angle),s=q(n,i,-e.angle),o=Math.sign($n(_e(s,t),_e(s,i)))*-1,a=we(s,Ve(fn(Fi(_e(s,r)),Math.max(e.width*2,e.height*2)),s)),l=e.type==="diamond"?[we(C(e.x+e.width/2,e.y),C(e.x+e.width/2,e.y+e.height)),we(C(e.x,e.y+e.height/2),C(e.x+e.width,e.y+e.height/2))]:[we(C(e.x,e.y),C(e.x+e.width,e.y+e.height)),we(C(e.x+e.width,e.y),C(e.x,e.y+e.height))],c=e.type==="diamond"?[we(C(e.x+e.width/2,e.y-e.height),C(e.x+e.width/2,e.y+e.height*2)),we(C(e.x-e.width,e.y+e.height/2),C(e.x+e.width*2,e.y+e.height/2))]:[we(C(e.x-e.width,e.y-e.height),C(e.x+e.width*2,e.y+e.height*2)),we(C(e.x+e.width*2,e.y-e.height),C(e.x-e.width,e.y+e.height*2))];return[P0(a,c[0]),P0(a,c[1])].filter(f=>f!==null).sort((f,h)=>O0(f,n)-O0(h,n)).map((f,h)=>o*pt(i,f)/(e.type==="diamond"?pt(l[h][0],l[h][1])/2:Math.sqrt(e.width**2+e.height**2)/2)).sort((f,h)=>Math.abs(f)-Math.abs(h))[0]??0},ice=(e,t,n)=>{const i=C(e.x+e.width/2,e.y+e.height/2);if(t===0)return i;const r=(e.type==="diamond"?[C(e.x,e.y+e.height/2),C(e.x+e.width/2,e.y),C(e.x+e.width,e.y+e.height/2),C(e.x+e.width/2,e.y+e.height)]:[C(e.x,e.y),C(e.x+e.width,e.y),C(e.x+e.width,e.y+e.height),C(e.x,e.y+e.height)]).map(a=>Ve(fn(_e(a,i),Math.abs(t)),i)).map(a=>q(a,i,e.angle)),s=[$n(_e(n,r[0]),_e(r[1],r[0]))>0&&(t>0?$n(_e(n,r[1]),_e(r[2],r[1]))<0:$n(_e(n,r[3]),_e(r[0],r[3]))<0),$n(_e(n,r[1]),_e(r[2],r[1]))>0&&(t>0?$n(_e(n,r[2]),_e(r[3],r[2]))<0:$n(_e(n,r[0]),_e(r[1],r[0]))<0),$n(_e(n,r[2]),_e(r[3],r[2]))>0&&(t>0?$n(_e(n,r[3]),_e(r[0],r[3]))<0:$n(_e(n,r[1]),_e(r[2],r[1]))<0),$n(_e(n,r[3]),_e(r[0],r[3]))>0&&(t>0?$n(_e(n,r[0]),_e(r[1],r[0]))<0:$n(_e(n,r[2]),_e(r[3],r[2]))<0)];return s[0]?t>0?r[1]:r[0]:s[1]?t>0?r[2]:r[1]:s[2]?t>0?r[3]:r[2]:t>0?r[0]:r[3]},rce=new Set(["boundElements","frameId","containerId","startBinding","endBinding"]),yb=(e,t,n)=>{var i;qs(t)&&(((i=t.boundElements)==null?void 0:i.slice())??[]).forEach(({id:s})=>{n(e.get(s),"boundElements",s)})},Eb=(e,t,n)=>{const i=[];if(t.frameId){const r=t.frameId;i.push(n(e.get(r),"frameId",r))}if(Xt(t)){const r=t.containerId;i.push(n(e.get(r),"containerId",r))}if(Be(t)){if(t.startBinding){const r=t.startBinding.elementId;i.push(n(e.get(r),"startBinding",r))}if(t.endBinding){const r=t.endBinding.elementId;i.push(n(e.get(r),"endBinding",r))}}return i};class Nf{static unbindAffected(t,n,i){n&&Eb(t,n,r=>{!r||r.isDeleted||yb(t,r,(s,o,a)=>{a===n.id&&i(r,{boundElements:Yg(r.boundElements,new Set([a]))})})})}}F(Nf,"rebindAffected",(t,n,i)=>{!n||n.isDeleted||Eb(t,n,(r,s)=>{var o,a;if(!r||r.isDeleted){i(n,{[s]:null});return}s!=="frameId"&&((o=r.boundElements)!=null&&o.find(l=>l.id===n.id)||(Be(n)&&i(r,{boundElements:Yg(r.boundElements,new Set,new Array(n))}),de(n)&&((a=r.boundElements)!=null&&a.find(l=>l.type==="text")?i(n,{[s]:null}):i(r,{boundElements:Yg(r.boundElements,new Set,new Array(n))}))))})});class Of{static unbindAffected(t,n,i){n&&yb(t,n,r=>{!r||r.isDeleted||Eb(t,r,(s,o,a)=>{a===n.id&&i(r,{[o]:null})})})}}F(Of,"rebindAffected",(t,n,i)=>{!n||n.isDeleted||yb(t,n,(r,s,o)=>{var a,l;if(!r||r.isDeleted){i(n,{boundElements:Yg(n.boundElements,new Set([o]))});return}de(r)&&(((l=(((a=n.boundElements)==null?void 0:a.slice())??[]).reverse().find(u=>u.type==="text"))==null?void 0:l.id)===r.id?r.containerId!==n.id&&i(r,{containerId:n.id}):(r.containerId!==null&&i(r,{containerId:null}),i(n,{boundElements:Yg(n.boundElements,new Set([r.id]))})))})});const fE=(e,t)=>{const[n,i]=Q6(e);return q(C(t.x+t.width*n,t.y+t.height*i),C(t.x+t.width/2,t.y+t.height/2),t.angle)},sce=(e,t)=>{const n=e.startBinding&&t.get(e.startBinding.elementId),i=e.endBinding&&t.get(e.endBinding.elementId),r=n&&e.startBinding?fE(e.startBinding.fixedPoint,n):C(e.x+e.points[0][0],e.y+e.points[0][1]),s=i&&e.endBinding?fE(e.endBinding.fixedPoint,i):C(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]);return[r,s]},oce=(e,t)=>{const[n,i]=sce(e,t);return[ue.pointFromAbsoluteCoords(e,n,t),ue.pointFromAbsoluteCoords(e,i,t)]},Q6=e=>e&&(Math.abs(e[0]-.5)<1e-4||Math.abs(e[1]-.5)<1e-4)?e.map(t=>Math.abs(t-.5)<1e-4?.5001:t):e;class St{constructor(t,n){this.deleted=t,this.inserted=n}static create(t,n,i,r){const s=i&&r!=="inserted"?i(t):t,o=i&&r!=="deleted"?i(n):n;return new St(s,o)}static calculate(t,n,i,r){if(t===n)return St.empty();const s={},o={};for(const c of this.distinctKeysIterator("full",t,n))s[c]=t[c],o[c]=n[c];const[a,l]=r?r(s,o):[s,o];return St.create(a,l,i)}static empty(){return new St({},{})}static isEmpty(t){return!Object.keys(t.deleted).length&&!Object.keys(t.inserted).length}static mergeObjects(t,n,i){const r={...t};for(const s of Object.keys(i))delete r[s];return{...r,...n}}static mergeArrays(t,n,i,r){return Object.values(St.mergeObjects(sa(t??[],r),sa(n??[],r),sa(i??[],r)))}static diffObjects(t,n,i,r){if(!(!t[i]&&!n[i])&&(typeof t[i]=="object"||typeof n[i]=="object")){const s=t[i]??{},o=n[i]??{},a=St.getLeftDifferences(s,o).reduce((c,u)=>(c[u]=r(s[u]),c),{}),l=St.getRightDifferences(s,o).reduce((c,u)=>(c[u]=r(o[u]),c),{});Object.keys(a).length||Object.keys(l).length?(Reflect.set(t,i,a),Reflect.set(n,i,l)):(Reflect.deleteProperty(t,i),Reflect.deleteProperty(n,i))}}static diffArrays(t,n,i,r){if(!(!t[i]&&!n[i])&&(Array.isArray(t[i])||Array.isArray(n[i]))){const s=Array.isArray(t[i])?t[i]:[],o=Array.isArray(n[i])?n[i]:[],a=sa(St.getLeftDifferences(sa(s,r),sa(o,r))),l=sa(St.getRightDifferences(sa(s,r),sa(o,r)));if(Object.keys(a).length||Object.keys(l).length){const c=s.filter(d=>a[r?r(d):String(d)]),u=o.filter(d=>l[r?r(d):String(d)]);Reflect.set(t,i,c),Reflect.set(n,i,u)}else Reflect.deleteProperty(t,i),Reflect.deleteProperty(n,i)}}static isLeftDifferent(t,n,i=!1){return!!this.distinctKeysIterator("left",t,n,i).next().value}static isRightDifferent(t,n,i=!1){return!!this.distinctKeysIterator("right",t,n,i).next().value}static getLeftDifferences(t,n,i=!1){return Array.from(this.distinctKeysIterator("left",t,n,i))}static getRightDifferences(t,n,i=!1){return Array.from(this.distinctKeysIterator("right",t,n,i))}static*distinctKeysIterator(t,n,i,r=!1){if(n===i)return;let s=[];t==="left"?s=Object.keys(n):t==="right"?s=Object.keys(i):t==="full"?s=Array.from(new Set([...Object.keys(n),...Object.keys(i)])):pc(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(const o of s){const a=n[o],l=i[o];if(a!==l){if(!r&&typeof a=="object"&&typeof l=="object"&&a!==null&&l!==null&&vi(a,l))continue;yield o}}}}class Mi{constructor(t){this.delta=t}static calculate(t,n){const i=St.calculate(t,n,void 0,Mi.postProcess);return new Mi(i)}static empty(){return new Mi(St.create({},{}))}inverse(){const t=St.create(this.delta.inserted,this.delta.deleted);return new Mi(t)}applyTo(t,n){try{const{selectedElementIds:i={},selectedGroupIds:r={}}=this.delta.deleted,{selectedElementIds:s={},selectedGroupIds:o={},selectedLinearElementId:a,editingLinearElementId:l,...c}=this.delta.inserted,u=St.mergeObjects(t.selectedElementIds,s,i),d=St.mergeObjects(t.selectedGroupIds,o,r),f=a&&n.has(a)?new ue(n.get(a)):null,h=l&&n.has(l)?new ue(n.get(l)):null,m={...t,...c,selectedElementIds:u,selectedGroupIds:d,selectedLinearElement:typeof a<"u"?f:t.selectedLinearElement,editingLinearElement:typeof l<"u"?h:t.editingLinearElement},p=this.filterInvisibleChanges(t,m,n);return[m,p]}catch(i){return console.error("Couldn't apply appstate change",i),[t,!1]}}isEmpty(){return St.isEmpty(this.delta)}static postProcess(t,n){try{St.diffObjects(t,n,"selectedElementIds",i=>!0),St.diffObjects(t,n,"selectedGroupIds",i=>i??!1)}catch{console.error("Couldn't postprocess appstate change deltas.")}finally{return[t,n]}}filterInvisibleChanges(t,n,i){const r=_b(t),s=_b(n),o=St.isRightDifferent(Mi.stripElementsProps(r),Mi.stripElementsProps(s)),a=St.isRightDifferent(Mi.stripStandaloneProps(r),Mi.stripStandaloneProps(s));if(!o&&!a)return!1;const l={value:o};if(a){const c=St.getRightDifferences(Mi.stripStandaloneProps(r),Mi.stripStandaloneProps(s));let u=new Set;(c.includes("editingGroupId")||c.includes("selectedGroupIds"))&&(u=bte(i));for(const d of c)switch(d){case"selectedElementIds":n[d]=Mi.filterSelectedElements(n[d],i,l);break;case"selectedGroupIds":n[d]=Mi.filterSelectedGroups(n[d],u,l);break;case"croppingElementId":{const p=n[d],b=p&&i.get(p);b&&!b.isDeleted?l.value=!0:n[d]=null;break}case"editingGroupId":const f=n[d];f?u.has(f)?l.value=!0:n[d]=null:l.value=!0;break;case"selectedLinearElementId":case"editingLinearElementId":const h=Mi.convertToAppStateKey(d),m=n[h];if(!m)l.value=!0;else{const p=i.get(m.elementId);p&&!p.isDeleted?l.value=!0:n[h]=null}break;default:pc(d,`Unknown ObservedElementsAppState's key "${d}"`,!0)}}return l.value}static convertToAppStateKey(t){switch(t){case"selectedLinearElementId":return"selectedLinearElement";case"editingLinearElementId":return"editingLinearElement"}}static filterSelectedElements(t,n,i){const r=Object.keys(t);if(!r.length)return i.value=!0,t;const s={...t};for(const o of r){const a=n.get(o);a&&!a.isDeleted?i.value=!0:delete s[o]}return s}static filterSelectedGroups(t,n,i){if(!Object.keys(t).length)return i.value=!0,t;const s={...t};for(const o of Object.keys(s))n.has(o)?i.value=!0:delete s[o];return s}static stripElementsProps(t){const{editingGroupId:n,selectedGroupIds:i,selectedElementIds:r,editingLinearElementId:s,selectedLinearElementId:o,croppingElementId:a,...l}=t;return l}static stripStandaloneProps(t){const{name:n,viewBackgroundColor:i,...r}=t;return r}}const Ct=class Ct{constructor(t,n,i){this.added=t,this.removed=n,this.updated=i}static create(t,n,i,r={shouldRedistribute:!1}){let s;if(r.shouldRedistribute){const o=new Map,a=new Map,l=new Map,c=[...t,...n,...i];for(const[u,d]of c)this.satisfiesAddition(d)?o.set(u,d):this.satisfiesRemoval(d)?a.set(u,d):l.set(u,d);s=new Ct(o,a,l)}else s=new Ct(t,n,i);return s}static validate(t,n,i){for(const[r,s]of t[n].entries())if(!i(s))throw console.error(`Broken invariant for "${n}" delta, element "${r}", delta:`,s),new Error(`ElementsChange invariant broken for element "${r}".`)}static calculate(t,n){if(t===n)return Ct.empty();const i=new Map,r=new Map,s=new Map;for(const o of t.values())if(!n.get(o.id)){const l={...o,isDeleted:!1},c={isDeleted:!0},u=St.create(l,c,Ct.stripIrrelevantProps);r.set(o.id,u)}for(const o of n.values()){const a=t.get(o.id);if(!a){const l={isDeleted:!0},c={...o,isDeleted:!1},u=St.create(l,c,Ct.stripIrrelevantProps);i.set(o.id,u);continue}if(a.versionNonce!==o.versionNonce){const l=St.calculate(a,o,Ct.stripIrrelevantProps,Ct.postProcess);if(typeof a.isDeleted=="boolean"&&typeof o.isDeleted=="boolean"&&a.isDeleted!==o.isDeleted){a.isDeleted&&!o.isDeleted?i.set(o.id,l):r.set(o.id,l);continue}St.isEmpty(l)||s.set(o.id,l)}}return Ct.create(i,r,s)}static empty(){return Ct.create(new Map,new Map,new Map)}inverse(){const t=s=>{const o=new Map;for(const[a,l]of s.entries())o.set(a,St.create(l.inserted,l.deleted));return o},n=t(this.added),i=t(this.removed),r=t(this.updated);return Ct.create(i,n,r)}isEmpty(){return this.added.size===0&&this.removed.size===0&&this.updated.size===0}applyLatestChanges(t){const n=a=>l=>{const c={};for(const u of Object.keys(l))switch(u){case"boundElements":c[u]=l[u];break;default:c[u]=a[u]}return c},i=a=>{const l=new Map;for(const[c,u]of a.entries()){const d=t.get(c);if(d){const f=St.create(u.deleted,u.inserted,n(d),"inserted");l.set(c,f)}else l.set(c,u)}return l},r=i(this.added),s=i(this.removed),o=i(this.updated);return Ct.create(r,s,o,{shouldRedistribute:!0})}applyTo(t,n){let i=ms(new Map(t)),r;const s={containsVisibleDifference:!1,containsZindexDifference:!1};try{const o=Ct.createApplier(i,n,s),a=o(this.added),l=o(this.removed),c=o(this.updated),u=this.resolveConflicts(t,i);r=new Map([...a,...l,...c,...u])}catch(o){return console.error("Couldn't apply elements change",o),[t,!0]}try{Ct.redrawTextBoundingBoxes(i,r),i=Ct.reorderElements(i,r,s),Ct.redrawBoundArrows(i,r)}catch(o){console.error("Couldn't mutate elements after applying elements change",o)}finally{return[i,s.containsVisibleDifference]}}static applyDelta(t,n,i={containsVisibleDifference:!0,containsZindexDifference:!0}){var o,a;const{boundElements:r,...s}=n.inserted;if((o=n.deleted.boundElements)!=null&&o.length||(a=n.inserted.boundElements)!=null&&a.length){const l=St.mergeArrays(t.boundElements,n.inserted.boundElements,n.deleted.boundElements,c=>c.id);Object.assign(s,{boundElements:l})}if(st(t)){const l=n;(l.deleted.crop||l.inserted.crop)&&Object.assign(s,{crop:l.inserted.crop??null})}if(!i.containsVisibleDifference){const{index:l,...c}=s,u=Ct.checkForVisibleDifference(t,c);i.containsVisibleDifference=u}return i.containsZindexDifference||(i.containsZindexDifference=n.deleted.index!==n.inserted.index),Ce(t,s)}static checkForVisibleDifference(t,n){return t.isDeleted&&n.isDeleted!==!1?!1:t.isDeleted&&n.isDeleted===!1||t.isDeleted===!1&&n.isDeleted?!0:St.isRightDifferent(t,n)}resolveConflicts(t,n){const i=new Map,r=(c,u)=>{const d=n.get(c.id);if(!d)return;let f;t.get(c.id)===d?f=Ce(d,u):f=ee(d,u),i.set(f.id,f),n.set(f.id,f)};for(const[c]of this.removed)Ct.unbindAffected(t,n,c,r);for(const[c]of this.added)Ct.rebindAffected(t,n,c,r);for(const[c]of Array.from(this.updated).filter(([u,d])=>Object.keys({...d.deleted,...d.inserted}).find(f=>rce.has(f)))){const u=n.get(c);!u||u.isDeleted||Ct.rebindAffected(t,n,c,r)}const s=new Map(Array.from(t).filter(([c])=>i.has(c))),{added:o,removed:a,updated:l}=Ct.calculate(s,i);for(const[c,u]of o)this.added.set(c,u);for(const[c,u]of a)this.removed.set(c,u);for(const[c,u]of l)this.updated.set(c,u);return i}static unbindAffected(t,n,i,r){const s=()=>t.get(i),o=()=>n.get(i);Nf.unbindAffected(n,s(),r),Nf.unbindAffected(n,o(),r),Of.unbindAffected(n,s(),r),Of.unbindAffected(n,o(),r)}static rebindAffected(t,n,i,r){const s=()=>t.get(i),o=()=>n.get(i);Nf.unbindAffected(n,s(),r),Nf.rebindAffected(n,o(),r),Of.unbindAffected(n,s(),(a,l)=>{de(a)&&r(a,l)}),Of.rebindAffected(n,o(),r)}static redrawTextBoundingBoxes(t,n){const i=new Map;for(const r of n.values()){if(Xt(r)){const{containerId:s}=r,o=s?t.get(s):void 0;o&&i.set(o.id,{container:o,boundText:r})}if(Us(r)){const s=Wa(r),o=s?t.get(s):void 0;o&&i.set(r.id,{container:r,boundText:o})}}for(const{container:r,boundText:s}of i.values())r.isDeleted||s.isDeleted||Qi(s,r,t,!1)}static redrawBoundArrows(t,n){for(const i of n.values())!i.isDeleted&&qs(i)&&pr(i,t,{changedElements:n})}static reorderElements(t,n,i){if(!i.containsZindexDifference)return t;const r=Array.from(t.values()),s=TH([...r]),o=St.getRightDifferences(r,s,!0).reduce((a,l)=>{const c=r[Number(l)];return c&&n.has(c.id)&&a.set(c.id,c),a},new Map);return!i.containsVisibleDifference&&o.size&&(i.containsVisibleDifference=!0),Se(Vo(s,o))}static postProcess(t,n){try{St.diffArrays(t,n,"boundElements",i=>i.id)}catch{console.error("Couldn't postprocess elements change deltas.")}finally{return[t,n]}}static stripIrrelevantProps(t){const{id:n,updated:i,version:r,versionNonce:s,seed:o,...a}=t;return a}};F(Ct,"satisfiesAddition",({deleted:t,inserted:n})=>t.isDeleted===!0&&!n.isDeleted),F(Ct,"satisfiesRemoval",({deleted:t,inserted:n})=>!t.isDeleted&&n.isDeleted===!0),F(Ct,"satisfiesUpdate",({deleted:t,inserted:n})=>!!t.isDeleted==!!n.isDeleted),F(Ct,"createApplier",(t,n,i)=>{const r=Ct.createGetter(t,n,i);return s=>Array.from(s.entries()).reduce((o,[a,l])=>{const c=r(a,l.inserted);if(c){const u=Ct.applyDelta(c,l,i);t.set(u.id,u),o.set(u.id,u)}return o},new Map)}),F(Ct,"createGetter",(t,n,i)=>(r,s)=>{let o=t.get(r);return o||(o=n.get(r),o&&(i.containsZindexDifference=!0,(s.isDeleted===!1||s.isDeleted!==!0&&o.isDeleted===!1)&&(i.containsVisibleDifference=!0))),o});let vb=Ct;class yo{constructor(){F(this,"subscribers",[])}on(...t){const n=t.flat().filter(i=>typeof i=="function");return this.subscribers.push(...n),()=>this.off(n)}once(...t){const n=t.flat().filter(r=>typeof r=="function");n.push(()=>i());const i=this.on(...n);return i}off(...t){const n=t.flat();this.subscribers=this.subscribers.filter(i=>!n.includes(i))}trigger(...t){for(const n of this.subscribers)n(...t);return this}clear(){this.subscribers=[]}}const xB="__observedAppState",_b=e=>{var n,i;const t={name:e.name,editingGroupId:e.editingGroupId,viewBackgroundColor:e.viewBackgroundColor,selectedElementIds:e.selectedElementIds,selectedGroupIds:e.selectedGroupIds,editingLinearElementId:((n=e.editingLinearElement)==null?void 0:n.elementId)||null,selectedLinearElementId:((i=e.selectedLinearElement)==null?void 0:i.elementId)||null,croppingElementId:e.croppingElementId};return Reflect.defineProperty(t,xB,{value:!0,enumerable:!1}),t},ace=e=>!!Reflect.get(e,xB),Z={IMMEDIATELY:"IMMEDIATELY",NEVER:"NEVER",EVENTUALLY:"EVENTUALLY"};class lce{constructor(t,n){this.elementsChange=t,this.appStateChange=n}}class cce{constructor(){F(this,"onStoreIncrementEmitter",new yo);F(this,"scheduledActions",new Set);F(this,"_snapshot",V0.empty());F(this,"shouldCaptureIncrement",()=>{this.scheduleAction(Z.IMMEDIATELY)});F(this,"shouldUpdateSnapshot",()=>{this.scheduleAction(Z.NEVER)});F(this,"scheduleAction",t=>{this.scheduledActions.add(t),this.satisfiesScheduledActionsInvariant()});F(this,"commit",(t,n)=>{try{this.scheduledActions.has(Z.IMMEDIATELY)?this.captureIncrement(t,n):this.scheduledActions.has(Z.NEVER)&&this.updateSnapshot(t,n)}finally{this.satisfiesScheduledActionsInvariant(),this.scheduledActions=new Set}});F(this,"captureIncrement",(t,n)=>{const i=this.snapshot,r=this.snapshot.maybeClone(t,n);if(i!==r){const s=r.meta.didElementsChange?vb.calculate(i.elements,r.elements):vb.empty(),o=r.meta.didAppStateChange?Mi.calculate(i.appState,r.appState):Mi.empty();(!s.isEmpty()||!o.isEmpty())&&this.onStoreIncrementEmitter.trigger(new lce(s,o)),this.snapshot=r}});F(this,"updateSnapshot",(t,n)=>{const i=this.snapshot.maybeClone(t,n);this.snapshot!==i&&(this.snapshot=i)});F(this,"filterUncomittedElements",(t,n)=>{for(const[i,r]of t.entries()){if(!n.get(i))continue;const o=this.snapshot.elements.get(i);o?o.version<r.version&&n.set(i,o):n.delete(i)}return n});F(this,"clear",()=>{this.snapshot=V0.empty(),this.scheduledActions=new Set});F(this,"satisfiesScheduledActionsInvariant",()=>{if(!(this.scheduledActions.size>=0&&this.scheduledActions.size<=3)){const t=`There can be at most three store actions scheduled at the same time, but there are "${this.scheduledActions.size}".`;console.error(t,this.scheduledActions.values())}})}get snapshot(){return this._snapshot}set snapshot(t){this._snapshot=t}}class V0{constructor(t,n,i={didElementsChange:!1,didAppStateChange:!1,isEmpty:!1}){this.elements=t,this.appState=n,this.meta=i}static empty(){return new V0(new Map,_b(gs()),{didElementsChange:!1,didAppStateChange:!1,isEmpty:!0})}isEmpty(){return this.meta.isEmpty}maybeClone(t,n){const i=this.maybeCreateElementsSnapshot(t),r=this.maybeCreateAppStateSnapshot(n);let s=!1,o=!1;return this.elements!==i&&(s=!0),this.appState!==r&&(o=!0),!s&&!o?this:new V0(i,r,{didElementsChange:s,didAppStateChange:o})}maybeCreateAppStateSnapshot(t){if(!t)return this.appState;const n=ace(t)?t:_b(t);return this.detectChangedAppState(n)?n:this.appState}detectChangedAppState(t){return!vi(this.appState,t,{selectedElementIds:vi,selectedGroupIds:vi})}maybeCreateElementsSnapshot(t){return t?this.detectChangedElements(t)?this.createElementsSnapshot(t):this.elements:this.elements}detectChangedElements(t){if(this.elements===t)return!1;if(this.elements.size!==t.size)return!0;const n=Array.from(t.keys());for(let i=n.length-1;i>=0;i--){const r=this.elements.get(n[i]),s=t.get(n[i]);if(!r||!s||r.id!==s.id||r.versionNonce!==s.versionNonce)return!0}return!1}createElementsSnapshot(t){const n=new Map;for(const[i,r]of this.elements.entries())t.get(i)?n.set(i,r):n.set(i,Ce(r,{isDeleted:!0}));for(const[i,r]of t.entries()){const s=n.get(i);(!s||s&&s.versionNonce!==r.versionNonce)&&n.set(i,Cd(r))}return n}}const uo=new Map,uce=/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/,dce=/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/,fce=/^https:\/\/(?:www\.)?figma\.com/,Yx=/^https:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)/,hce=/^<script[\s\S]*?\ssrc=["'](https:\/\/gist\.github\.com\/.*?)\.js["']/i,Wx=/(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com\/[^/]+\/status\/(\d+)/,gce=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i,mce=/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/,pce=/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i,Kx=/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/,Zx=/^(?:http(?:s)?:\/\/)?(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)\/?(?:\?[^#\s]*)?(?:#[^\s]*)?$/,Uce=/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i,hE=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","link.excalidraw.com","gist.github.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","val.town","giphy.com","reddit.com"]),qx=new Set(["youtube.com","youtu.be","vimeo.com","player.vimeo.com","figma.com","twitter.com","x.com","*.simplepdf.eu","stackblitz.com","reddit.com"]),Wg=e=>`<html><body>${e}</body></html>`,Pf=e=>{if(!e)return null;if(uo.has(e))return uo.get(e);const t=e,n=qx.has(gE(e,qx)||"");let i="generic",r={w:560,h:840};const s=e.match(uce);if(s!=null&&s[2]){const c=s[3]?`&start=${s[3]}`:"",u=e.includes("shorts");switch(i="video",s[1]){case"embed/":case"watch?v=":case"shorts/":e=`https://www.youtube.com/embed/${s[2]}?enablejsapi=1${c}`;break;case"playlist?list=":case"embed/videoseries?list=":e=`https://www.youtube.com/embed/videoseries?list=${s[2]}&enablejsapi=1${c}`;break;default:e=`https://www.youtube.com/embed/${s[2]}?enablejsapi=1${c}`;break}return r=u?{w:315,h:560}:{w:560,h:315},uo.set(t,{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}}const o=e.match(dce);if(o!=null&&o[1]){const c=o==null?void 0:o[1],u=/^\d+$/.test(c)?void 0:new URIError("Invalid embed link format");return i="video",e=`https://player.vimeo.com/video/${c}?api=1`,r={w:560,h:315},uo.set(t,{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:r,type:i,error:u,sandbox:{allowSameOrigin:n}}}if(e.match(fce))return i="generic",e=`https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(e)}`,r={w:550,h:550},uo.set(t,{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}};const l=e.match(mce);if(l)return e=l[1]==="embed"?l[0]:l[0].replace("/v","/embed"),uo.set(t,{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}};if(Wx.test(e)){const c=e.match(Wx)[1],u=YU(`https://twitter.com/x/status/${c}`),d={type:"document",srcdoc:f=>Wg(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${f}"><a href="${u}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return uo.set(t,d),d}if(Zx.test(e)){const[,c,u,d]=e.match(Zx),f=YU(`https://reddit.com/r/${c}/comments/${u}/${d}`),h={type:"document",srcdoc:m=>Wg(`<blockquote class="reddit-embed-bq" data-embed-theme="${m}"><a href="${f}"></a><br></blockquote><script async="" src="https://embed.reddit.com/widgets.js" charset="UTF-8"><\/script>`),intrinsicSize:{w:480,h:480},sandbox:{allowSameOrigin:n}};return uo.set(t,h),h}if(Yx.test(e)){const[,c,u]=e.match(Yx),d=YU(`https://gist.github.com/${c}/${u}`),f={type:"document",srcdoc:()=>Wg(`
          <script src="${d}.js"><\/script>
          <style type="text/css">
            * { margin: 0px; }
            table, .gist { height: 100%; }
            .gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
          </style>
        `),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return uo.set(e,f),f}return uo.set(e,{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:r,type:i,sandbox:{allowSameOrigin:n}}},CB=e=>{let t;Il(e)?t="IFrame element":t=!e.link||(e==null?void 0:e.link)===""?"Empty Web-Embed":e.link;const n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),i=At.Helvetica,r=xt({fontSize:n,fontFamily:i});return Br({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:i,fontSize:n,text:Id(t,r,e.width-20),textAlign:"center",verticalAlign:Ar.MIDDLE,angle:e.angle??0})};oe({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,t,n,i)=>{const r=Sn(t,{type:"embeddable"});return go(i.canvas,{...t,activeTool:r}),{elements:e,appState:{...t,activeTool:Sn(t,{type:"embeddable"})},captureUpdate:Z.EVENTUALLY}}});const gE=(e,t)=>{try{const{hostname:n}=new URL(e),i=n.replace(/^www\./,"");if(t instanceof Set){if(hE.has(i))return i;const s=i.replace(/^([^.]+)/,"*");return hE.has(s)?s:null}const r=t.replace(/^www\./,"");if(i===r)return r}catch{}return null},bce=e=>{const t=e.match(gce);if(t&&t.length===2)return t[1];const n=e.match(Uce);if(n&&n.length===2)return n[1];const i=e.match(hce);if(i&&i.length===2)return i[1];if(Kx.test(e))return`https://giphy.com/embed/${Kx.exec(e)[1]}`;const r=e.match(pce);return r&&r.length===2?r[1]:e},qU=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){const n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(const n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(gE(e,n))return!0;return!1}}return!!gE(e,hE)},Jn=10,yce=(e,t,n,i,r,s,o)=>{var S,k;const{width:a,height:l}=Ya(e),c=n/a,u=i/l,d=(((S=e.crop)==null?void 0:S.x)??0)/c,f=(((k=e.crop)==null?void 0:k.y)??0)/u,h=q(C(r,s),C(e.x+e.width/2,e.y+e.height/2),-e.angle);r=h[0],s=h[1];let m=e.width,p=e.height,b=e.crop??{x:0,y:0,width:n,height:i,naturalWidth:n,naturalHeight:i};const E=b.height,y=b.width,v=e.scale[0]===-1,_=e.scale[1]===-1;let I=s-e.y,R=r-e.x;t.includes("n")&&(p=He(e.height-I,Jn,_?l-f:e.height+f)),t.includes("s")&&(I=s-e.y-e.height,p=He(e.height+I,Jn,_?e.height+f:l-f)),t.includes("e")&&(R=r-e.x-e.width,m=He(e.width+R,Jn,v?e.width+d:a-d)),t.includes("w")&&(m=He(e.width-R,Jn,v?a-d:e.width+d));const w=N=>{N.height=p*u,N.width=m*c};w(b);const T=(N,D)=>{w(D),N.includes("n")&&(_||(D.y+=E-D.height)),N.includes("s")&&_&&(D.y+=E-D.height),N.includes("e")&&v&&(D.x+=y-D.width),N.includes("w")&&(v||(D.x+=y-D.width))};switch(t){case"n":{if(o){const N=d+e.width/2,D=a-d-e.width/2,G=Math.min(N,D)*2;m=He(p*o,Jn,G),p=m/o}T(t,b),o&&(b.x+=(y-b.width)/2);break}case"s":{if(o){const N=d+e.width/2,D=a-d-e.width/2,G=Math.min(N,D)*2;m=He(p*o,Jn,G),p=m/o}T(t,b),o&&(b.x+=(y-b.width)/2);break}case"w":{if(o){const N=f+e.height/2,D=l-f-e.height/2,G=Math.min(N,D)*2;p=He(m/o,Jn,G),m=p*o}T(t,b),o&&(b.y+=(E-b.height)/2);break}case"e":{if(o){const N=f+e.height/2,D=l-f-e.height/2,G=Math.min(N,D)*2;p=He(m/o,Jn,G),m=p*o}T(t,b),o&&(b.y+=(E-b.height)/2);break}case"ne":{if(o)if(R>-I){const N=_?l-f:f+e.height;p=He(m/o,Jn,N),m=p*o}else{const N=v?d+e.width:a-d;m=He(p*o,Jn,N),p=m/o}T(t,b);break}case"nw":{if(o)if(R<I){const N=_?l-f:f+e.height;p=He(m/o,Jn,N),m=p*o}else{const N=v?a-d:d+e.width;m=He(p*o,Jn,N),p=m/o}T(t,b);break}case"se":{if(o)if(R>I){const N=_?f+e.height:l-f;p=He(m/o,Jn,N),m=p*o}else{const N=v?d+e.width:a-d;m=He(p*o,Jn,N),p=m/o}T(t,b);break}case"sw":{if(o)if(-R>I){const N=_?f+e.height:l-f;p=He(m/o,Jn,N),m=p*o}else{const N=v?a-d:d+e.width;m=He(p*o,Jn,N),p=m/o}T(t,b);break}}const A=Ece(e,t,m,p,!!o);return rx(b.width,b.naturalWidth)&&rx(b.height,b.naturalHeight)&&(b=null),{x:A[0],y:A[1],width:m,height:p,crop:b}},Ece=(e,t,n,i,r)=>{const[s,o,a,l]=sc(e,e.width,e.height,!0),c=C(s,o),u=C(a,l),d=N0(c,u),[f,h,m,p]=sc(e,n,i,!0),b=m-f,E=p-h;let y=[...c];if(["n","w","nw"].includes(t)&&(y=[u[0]-Math.abs(b),u[1]-Math.abs(E)]),t==="ne"){const T=[c[0],u[1]];y=[T[0],T[1]-Math.abs(E)]}if(t==="sw"){const T=[u[0],c[1]];y=[T[0]-Math.abs(b),T[1]]}r&&(["s","n"].includes(t)&&(y[0]=d[0]-b/2),["e","w"].includes(t)&&(y[1]=d[1]-E/2));const v=e.angle,_=q(y,d,v),I=[y[0]+Math.abs(b)/2,y[1]+Math.abs(E)/2],R=q(I,d,v);y=q(_,R,-v);const w=[...y];return w[0]+=e.x-f,w[1]+=e.y-h,w},vce=(e,t)=>{if(e.crop){const{width:n,height:i}=Ya(e),[r,s,o,a,l,c]=De(e,t),u=_e(q(C(r,s),C(l,c),e.angle)),d=_e(q(C(o,s),C(l,c),e.angle)),f=Fi(ob(d,u)),h=_e(q(C(r,a),C(l,c),e.angle)),m=ob(h,u),p=Fi(m),{cropX:b,cropY:E}=_ce(e.crop,e.scale),y=Bl(Bl(u,fn(f,-b*n/e.crop.naturalWidth)),fn(p,-E*i/e.crop.naturalHeight)),v=Ve(Bl(Bl(y,fn(f,n/2)),fn(p,i/2))),_=q(Ve(y),v,-e.angle);return{...e,x:_[0],y:_[1],width:n,height:i,crop:null}}return e},Ya=e=>{if(e.crop){const t=e.width/(e.crop.width/e.crop.naturalWidth),n=e.height/(e.crop.height/e.crop.naturalHeight);return{width:t,height:n}}return{width:e.width,height:e.height}},_ce=(e,t)=>{let n=e.x,i=e.y;const r=t[0]===-1,s=t[1]===-1;return r&&(n=e.naturalWidth-Math.abs(n)-e.width),s&&(i=e.naturalHeight-Math.abs(i)-e.height),{cropX:n,cropY:i}},wce=(e,t=!1)=>{const n=e.crop;if(!n)return null;const i=e.scale[0]===-1,r=e.scale[1]===-1;let s=n.x,o=n.y;if(i&&(s=n.naturalWidth-n.width-n.x),r&&(o=n.naturalHeight-n.height-n.y),t)return{x:s,y:o};const{width:a,height:l}=Ya(e);return{x:s/(n.naturalWidth/a),y:o/(n.naturalHeight/l)}},X1=(e,t,n)=>{const i={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:n}};return e.draw(i)},j1=(e,t,n,i,r)=>{if(!i.enabled||!i.clip)return null;const s=Ur(e,r);if(s){const o=t.ownerDocument.createElementNS(lt,"g");return o.setAttributeNS(lt,"clip-path",`url(#${s.id})`),n.forEach(a=>o.appendChild(a)),o}return null},QU=(e,t,n,i,r,s,o,a)=>{var v;const l={x:s,y:o},[c,u,d,f]=De(e,t);let h=(d-c)/2-(e.x-c),m=(f-u)/2-(e.y-u);if(de(e)){const _=ui(e,t);if(Be(_)){const[I,R,w,T]=De(_,t),A=ue.getBoundTextElementPosition(_,e,t);h=(w-I)/2-(A.x-I),m=(T-R)/2-(A.y-R),s=s+A.x-e.x,o=o+A.y-e.y}}const p=180*e.angle/Math.PI;let b=i;if(e.link){const _=i.ownerDocument.createElementNS(lt,"a");_.setAttribute("href",Or(e.link)),b.appendChild(_),b=_}const E=(_,I)=>{b.appendChild(_)},y=(((v=Ur(e,t))==null?void 0:v.opacity)??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{const _=Gt.generateElementShape(e,null),I=X1(n,_,N1);y!==1&&(I.setAttribute("stroke-opacity",`${y}`),I.setAttribute("fill-opacity",`${y}`)),I.setAttribute("stroke-linecap","round"),I.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`);const R=j1(e,b,[I],a.frameRendering,t);E(R||I);break}case"iframe":case"embeddable":{const _=Gt.generateElementShape(e,a),I=X1(n,_,N1),R=e.opacity/100;R!==1&&(I.setAttribute("stroke-opacity",`${R}`),I.setAttribute("fill-opacity",`${R}`)),I.setAttribute("stroke-linecap","round"),I.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`),E(I);const w=CB(e);QU(w,t,n,b,r,w.x+l.x-e.x,w.y+l.y-e.y,a);const T=X1(n,_,N1);for(T.setAttribute("stroke-linecap","round"),T.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`);T.firstChild;)T.removeChild(T.firstChild);const A=$s(Math.min(e.width,e.height),e),S=Pf(h9(e.link||""));if(a.renderEmbeddables===!1||(S==null?void 0:S.type)==="document"){const k=i.ownerDocument.createElementNS(lt,"a");k.setAttribute("href",Or(e.link||"")),k.setAttribute("target","_blank"),k.setAttribute("rel","noopener noreferrer"),k.style.borderRadius=`${A}px`,T.appendChild(k)}else{const k=i.ownerDocument.createElementNS(lt,"foreignObject");k.style.width=`${e.width}px`,k.style.height=`${e.height}px`,k.style.border="none";const N=k.ownerDocument.createElementNS(lt,"div");N.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),N.style.width="100%",N.style.height="100%";const D=N.ownerDocument.createElement("iframe");D.src=(S==null?void 0:S.link)??"",D.style.width="100%",D.style.height="100%",D.style.border="none",D.style.borderRadius=`${A}px`,D.style.top="0",D.style.left="0",D.allowFullscreen=!0,N.appendChild(D),k.appendChild(N),T.appendChild(k)}E(T);break}case"line":case"arrow":{const _=Oe(e,t),I=i.ownerDocument.createElementNS(lt,"mask");if(_){I.setAttribute("id",`mask-${e.id}`);const A=i.ownerDocument.createElementNS(lt,"rect");s=s||0,o=o||0,A.setAttribute("x","0"),A.setAttribute("y","0"),A.setAttribute("fill","#fff"),A.setAttribute("width",`${e.width+100+s}`),A.setAttribute("height",`${e.height+100+o}`),I.appendChild(A);const S=i.ownerDocument.createElementNS(lt,"rect"),k=ue.getBoundTextElementPosition(e,_,t),N=s+k.x-e.x,D=o+k.y-e.y;S.setAttribute("x",N.toString()),S.setAttribute("y",D.toString()),S.setAttribute("fill","#000"),S.setAttribute("width",`${_.width}`),S.setAttribute("height",`${_.height}`),S.setAttribute("opacity","1"),I.appendChild(S)}const R=i.ownerDocument.createElementNS(lt,"g");_&&R.setAttribute("mask",`url(#mask-${e.id})`),R.setAttribute("stroke-linecap","round"),Gt.generateElementShape(e,a).forEach(A=>{const S=X1(n,A,N1);y!==1&&(S.setAttribute("stroke-opacity",`${y}`),S.setAttribute("fill-opacity",`${y}`)),S.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`),e.type==="line"&&ja(e.points)&&e.backgroundColor!=="transparent"&&S.setAttribute("fill-rule","evenodd"),R.appendChild(S)});const T=j1(e,b,[R,I],a.frameRendering,t);T?(E(T),b.appendChild(T)):(E(R),b.append(I));break}case"freedraw":{const _=Gt.generateElementShape(e,a),I=_?X1(n,_,N1):i.ownerDocument.createElementNS(lt,"g");y!==1&&(I.setAttribute("stroke-opacity",`${y}`),I.setAttribute("fill-opacity",`${y}`)),I.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`),I.setAttribute("stroke","none");const R=i.ownerDocument.createElementNS(lt,"path");R.setAttribute("fill",e.strokeColor),R.setAttribute("d",pH(e)),I.appendChild(R);const w=j1(e,b,[I],a.frameRendering,t);E(w||I);break}case"image":{const _=Math.round(e.width),I=Math.round(e.height),R=xn(e)&&r[e.fileId];if(R){const{reuseImages:w=!0}=a;let T=`image-${R.id}`,A=e.width,S=e.height;e.crop&&({width:A,height:S}=Ya(e),T=`image-crop-${R.id}-${kH(`${A}x${S}`)}`),w||(T=`image-${e.id}`);let k=i.querySelector(`#${T}`);if(!k){k=i.ownerDocument.createElementNS(lt,"symbol"),k.id=T;const X=i.ownerDocument.createElementNS(lt,"image");X.setAttribute("href",R.dataURL),X.setAttribute("preserveAspectRatio","none"),e.crop||!w?(X.setAttribute("width",`${A}`),X.setAttribute("height",`${S}`)):(X.setAttribute("width","100%"),X.setAttribute("height","100%")),k.appendChild(X),(b.querySelector("defs")||b).prepend(k)}const N=i.ownerDocument.createElementNS(lt,"use");N.setAttribute("href",`#${T}`),a.exportWithDarkMode&&R.mimeType!==ye.svg&&N.setAttribute("filter",lH);let D=0,G=0;if(e.crop){const{width:X,height:Y}=Ya(e);D=e.crop.x/(e.crop.naturalWidth/X),G=e.crop.y/(e.crop.naturalHeight/Y)}const V=h+D,H=m+G;N.setAttribute("width",`${_+D}`),N.setAttribute("height",`${I+G}`),N.setAttribute("opacity",`${y}`),(e.scale[0]!==1||e.scale[1]!==1)&&N.setAttribute("transform",`translate(${V} ${H}) scale(${e.scale[0]} ${e.scale[1]}) translate(${-V} ${-H})`);const $=i.ownerDocument.createElementNS(lt,"g");if(e.crop){const X=i.ownerDocument.createElementNS(lt,"mask");X.setAttribute("id",`mask-image-crop-${e.id}`),X.setAttribute("fill","#fff");const Y=i.ownerDocument.createElementNS(lt,"rect");Y.setAttribute("x",`${D}`),Y.setAttribute("y",`${G}`),Y.setAttribute("width",`${_}`),Y.setAttribute("height",`${I}`),X.appendChild(Y),b.appendChild(X),$.setAttribute("mask",`url(#${X.id})`)}if($.appendChild(N),$.setAttribute("transform",`translate(${s-D} ${o-G}) rotate(${p} ${V} ${H})`),e.roundness){const X=i.ownerDocument.createElementNS(lt,"clipPath");X.id=`image-clipPath-${e.id}`;const Y=i.ownerDocument.createElementNS(lt,"rect"),le=$s(Math.min(e.width,e.height),e);Y.setAttribute("width",`${e.width}`),Y.setAttribute("height",`${e.height}`),Y.setAttribute("rx",`${le}`),Y.setAttribute("ry",`${le}`),X.appendChild(Y),E(X),$.setAttributeNS(lt,"clip-path",`url(#${X.id})`)}const j=j1(e,b,[$],a.frameRendering,t);E(j||$)}break}case"frame":case"magicframe":{if(a.frameRendering.enabled&&a.frameRendering.outline){const _=document.createElementNS(lt,"rect");_.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`),_.setAttribute("width",`${e.width}px`),_.setAttribute("height",`${e.height}px`),_.setAttribute("rx",tn.radius.toString()),_.setAttribute("ry",tn.radius.toString()),_.setAttribute("fill","none"),_.setAttribute("stroke",tn.strokeColor),_.setAttribute("stroke-width",tn.strokeWidth.toString()),E(_)}break}default:if(de(e)){const _=i.ownerDocument.createElementNS(lt,"g");y!==1&&(_.setAttribute("stroke-opacity",`${y}`),_.setAttribute("fill-opacity",`${y}`)),_.setAttribute("transform",`translate(${s||0} ${o||0}) rotate(${p} ${h} ${m})`);const I=e.text.replace(/\r\n?/g,`
`).split(`
`),R=Hm(e.fontSize,e.lineHeight),w=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,T=eB(e.fontFamily,e.fontSize,R),A=iF(e.text)?"rtl":"ltr",S=e.textAlign==="center"?"middle":e.textAlign==="right"||A==="rtl"?"end":"start";for(let N=0;N<I.length;N++){const D=i.ownerDocument.createElementNS(lt,"text");D.textContent=I[N],D.setAttribute("x",`${w}`),D.setAttribute("y",`${N*R+T}`),D.setAttribute("font-family",Fm(e)),D.setAttribute("font-size",`${e.fontSize}px`),D.setAttribute("fill",e.strokeColor),D.setAttribute("text-anchor",S),D.setAttribute("style","white-space: pre;"),D.setAttribute("direction",A),D.setAttribute("dominant-baseline","alphabetic"),_.appendChild(D)}const k=j1(e,b,[_],a.frameRendering,t);E(k||_)}else throw new Error(`Unimplemented type ${e.type}`)}},Tce=(e,t,n,i,r,s)=>{i&&(e.filter(o=>!ts(o)).forEach(o=>{if(!o.isDeleted){if(de(o)&&o.containerId&&t.has(o.containerId))return;try{QU(o,t,n,i,r,o.x+s.offsetX,o.y+s.offsetY,s);const a=Oe(o,t);a&&QU(a,t,n,i,r,a.x+s.offsetX,a.y+s.offsetY,s)}catch(a){console.error(a)}}}),e.filter(o=>ts(o)).forEach(o=>{if(!o.isDeleted)try{QU(o,t,n,i,r,o.x+s.offsetX,o.y+s.offsetY,s)}catch(a){console.error(a)}}))},Ad=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{}catch{return!1}else if("showOpenFilePicker"in self)return"showOpenFilePicker";return!1})(),Sce=be(Ad?()=>import("./file-open-002ab408-DIuFHtCF.js"):()=>import("./file-open-7c801643-684qeFg4.js"),__vite__mapDeps([]));async function Ice(...e){return(await Sce).default(...e)}be(Ad?()=>import("./directory-open-4ed118d0-BzWybGaI.js"):()=>import("./directory-open-01563666-DWU9wJ6I.js"),__vite__mapDeps([]));const xce=be(Ad?()=>import("./file-save-745eba88-Bb9F9Kg7.js"):()=>import("./file-save-3189631c-x92wctJd.js"),__vite__mapDeps([]));async function Cce(...e){return(await xce).default(...e)}const Qx=500,R9=e=>{var i,r;const t=(i=e.extensions)==null?void 0:i.reduce((s,o)=>(s.push(ye[o]),s),[]),n=(r=e.extensions)==null?void 0:r.reduce((s,o)=>o==="jpg"?s.concat(".jpg",".jpeg"):s.concat(`.${o}`),[]);return Ice({description:e.description,extensions:n,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(s,o,a)=>{const l=Ga(o,Qx),c=()=>{u(),document.addEventListener(te.KEYUP,l),document.addEventListener(te.POINTER_UP,l),l()},u=()=>{var f;if((f=a.files)!=null&&f.length){const h=e.multiple?[...a.files]:a.files[0];s(h)}};requestAnimationFrame(()=>{window.addEventListener(te.FOCUS,c)});const d=window.setInterval(()=>{u()},Qx);return f=>{clearInterval(d),l.cancel(),window.removeEventListener(te.FOCUS,c),document.removeEventListener(te.KEYUP,l),document.removeEventListener(te.POINTER_UP,l),f&&(console.warn("Opening the file was canceled (legacy-fs)."),f(new Uh))}}})},wb=(e,t)=>Cce(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`],mimeTypes:t.mimeTypes},t.fileHandle);/*! pako 2.0.3 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Ace=4,Jx=0,eC=1,Mce=2;function t1(e){let t=e.length;for(;--t>=0;)e[t]=0}const Rce=0,AB=1,kce=2,Lce=3,Dce=258,k9=29,Xm=256,$0=Xm+1+k9,Wf=30,L9=19,MB=2*$0+1,yu=15,S8=16,Nce=7,D9=256,RB=16,kB=17,LB=18,mE=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),JU=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Oce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),DB=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pce=512,ga=new Array(($0+2)*2);t1(ga);const Kg=new Array(Wf*2);t1(Kg);const G0=new Array(Pce);t1(G0);const X0=new Array(Dce-Lce+1);t1(X0);const N9=new Array(k9);t1(N9);const Tb=new Array(Wf);t1(Tb);function I8(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let NB,OB,PB;function x8(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const FB=e=>e<256?G0[e]:G0[256+(e>>>7)],j0=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},hr=(e,t,n)=>{e.bi_valid>S8-n?(e.bi_buf|=t<<e.bi_valid&65535,j0(e,e.bi_buf),e.bi_buf=t>>S8-e.bi_valid,e.bi_valid+=n-S8):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Io=(e,t,n)=>{hr(e,n[t*2],n[t*2+1])},BB=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Fce=e=>{e.bi_valid===16?(j0(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Bce=(e,t)=>{const n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let c,u,d,f,h,m,p=0;for(f=0;f<=yu;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<MB;c++)u=e.heap[c],f=n[n[u*2+1]*2+1]+1,f>l&&(f=l,p++),n[u*2+1]=f,!(u>i)&&(e.bl_count[f]++,h=0,u>=a&&(h=o[u-a]),m=n[u*2],e.opt_len+=m*(f+h),s&&(e.static_len+=m*(r[u*2+1]+h)));if(p!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(f=l;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--c],!(d>i)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},zB=(e,t,n)=>{const i=new Array(yu+1);let r=0,s,o;for(s=1;s<=yu;s++)i[s]=r=r+n[s-1]<<1;for(o=0;o<=t;o++){let a=e[o*2+1];a!==0&&(e[o*2]=BB(i[a]++,a))}},zce=()=>{let e,t,n,i,r;const s=new Array(yu+1);for(n=0,i=0;i<k9-1;i++)for(N9[i]=n,e=0;e<1<<mE[i];e++)X0[n++]=i;for(X0[n-1]=i,r=0,i=0;i<16;i++)for(Tb[i]=r,e=0;e<1<<JU[i];e++)G0[r++]=i;for(r>>=7;i<Wf;i++)for(Tb[i]=r<<7,e=0;e<1<<JU[i]-7;e++)G0[256+r++]=i;for(t=0;t<=yu;t++)s[t]=0;for(e=0;e<=143;)ga[e*2+1]=8,e++,s[8]++;for(;e<=255;)ga[e*2+1]=9,e++,s[9]++;for(;e<=279;)ga[e*2+1]=7,e++,s[7]++;for(;e<=287;)ga[e*2+1]=8,e++,s[8]++;for(zB(ga,$0+1,s),e=0;e<Wf;e++)Kg[e*2+1]=5,Kg[e*2]=BB(e,5);NB=new I8(ga,mE,Xm+1,$0,yu),OB=new I8(Kg,JU,0,Wf,yu),PB=new I8(new Array(0),Oce,0,L9,Nce)},HB=e=>{let t;for(t=0;t<$0;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Wf;t++)e.dyn_dtree[t*2]=0;for(t=0;t<L9;t++)e.bl_tree[t*2]=0;e.dyn_ltree[D9*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0},VB=e=>{e.bi_valid>8?j0(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Hce=(e,t,n,i)=>{VB(e),j0(e,n),j0(e,~n),e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},tC=(e,t,n,i)=>{const r=t*2,s=n*2;return e[r]<e[s]||e[r]===e[s]&&i[t]<=i[n]},C8=(e,t,n)=>{const i=e.heap[n];let r=n<<1;for(;r<=e.heap_len&&(r<e.heap_len&&tC(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!tC(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i},nC=(e,t,n)=>{let i,r,s=0,o,a;if(e.last_lit!==0)do i=e.pending_buf[e.d_buf+s*2]<<8|e.pending_buf[e.d_buf+s*2+1],r=e.pending_buf[e.l_buf+s],s++,i===0?Io(e,r,t):(o=X0[r],Io(e,o+Xm+1,t),a=mE[o],a!==0&&(r-=N9[o],hr(e,r,a)),i--,o=FB(i),Io(e,o,n),a=JU[o],a!==0&&(i-=Tb[o],hr(e,i,a)));while(s<e.last_lit);Io(e,D9,t)},pE=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let o,a,l=-1,c;for(e.heap_len=0,e.heap_max=MB,o=0;o<s;o++)n[o*2]!==0?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):n[o*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,n[c*2]=1,e.depth[c]=0,e.opt_len--,r&&(e.static_len-=i[c*2+1]);for(t.max_code=l,o=e.heap_len>>1;o>=1;o--)C8(e,n,o);c=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C8(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,n[c*2]=n[o*2]+n[a*2],e.depth[c]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,n[o*2+1]=n[a*2+1]=c,e.heap[1]=c++,C8(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Bce(e,t),zB(n,l,e.bl_count)},iC=(e,t,n)=>{let i,r=-1,s,o=t[0*2+1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),t[(n+1)*2+1]=65535,i=0;i<=n;i++)s=o,o=t[(i+1)*2+1],!(++a<l&&s===o)&&(a<c?e.bl_tree[s*2]+=a:s!==0?(s!==r&&e.bl_tree[s*2]++,e.bl_tree[RB*2]++):a<=10?e.bl_tree[kB*2]++:e.bl_tree[LB*2]++,a=0,r=s,o===0?(l=138,c=3):s===o?(l=6,c=3):(l=7,c=4))},rC=(e,t,n)=>{let i,r=-1,s,o=t[0*2+1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),i=0;i<=n;i++)if(s=o,o=t[(i+1)*2+1],!(++a<l&&s===o)){if(a<c)do Io(e,s,e.bl_tree);while(--a!==0);else s!==0?(s!==r&&(Io(e,s,e.bl_tree),a--),Io(e,RB,e.bl_tree),hr(e,a-3,2)):a<=10?(Io(e,kB,e.bl_tree),hr(e,a-3,3)):(Io(e,LB,e.bl_tree),hr(e,a-11,7));a=0,r=s,o===0?(l=138,c=3):s===o?(l=6,c=3):(l=7,c=4)}},Vce=e=>{let t;for(iC(e,e.dyn_ltree,e.l_desc.max_code),iC(e,e.dyn_dtree,e.d_desc.max_code),pE(e,e.bl_desc),t=L9-1;t>=3&&e.bl_tree[DB[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},$ce=(e,t,n,i)=>{let r;for(hr(e,t-257,5),hr(e,n-1,5),hr(e,i-4,4),r=0;r<i;r++)hr(e,e.bl_tree[DB[r]*2+1],3);rC(e,e.dyn_ltree,t-1),rC(e,e.dyn_dtree,n-1)},Gce=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Jx;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return eC;for(n=32;n<Xm;n++)if(e.dyn_ltree[n*2]!==0)return eC;return Jx};let sC=!1;const Xce=e=>{sC||(zce(),sC=!0),e.l_desc=new x8(e.dyn_ltree,NB),e.d_desc=new x8(e.dyn_dtree,OB),e.bl_desc=new x8(e.bl_tree,PB),e.bi_buf=0,e.bi_valid=0,HB(e)},$B=(e,t,n,i)=>{hr(e,(Rce<<1)+(i?1:0),3),Hce(e,t,n)},jce=e=>{hr(e,AB<<1,3),Io(e,D9,ga),Fce(e)},Yce=(e,t,n,i)=>{let r,s,o=0;e.level>0?(e.strm.data_type===Mce&&(e.strm.data_type=Gce(e)),pE(e,e.l_desc),pE(e,e.d_desc),o=Vce(e),r=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=r&&(r=s)):r=s=n+5,n+4<=r&&t!==-1?$B(e,t,n,i):e.strategy===Ace||s===r?(hr(e,(AB<<1)+(i?1:0),3),nC(e,ga,Kg)):(hr(e,(kce<<1)+(i?1:0),3),$ce(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),nC(e,e.dyn_ltree,e.dyn_dtree)),HB(e),i&&VB(e)},Wce=(e,t,n)=>(e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(X0[n]+Xm+1)*2]++,e.dyn_dtree[FB(t)*2]++),e.last_lit===e.lit_bufsize-1);var Kce=Xce,Zce=$B,qce=Yce,Qce=Wce,Jce=jce,eue={_tr_init:Kce,_tr_stored_block:Zce,_tr_flush_block:qce,_tr_tally:Qce,_tr_align:Jce};const tue=(e,t,n,i)=>{let r=e&65535|0,s=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do r=r+t[i++]|0,s=s+r|0;while(--o);r%=65521,s%=65521}return r|s<<16|0};var Y0=tue;const nue=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},iue=new Uint32Array(nue()),rue=(e,t,n,i)=>{const r=iue,s=i+n;e^=-1;for(let o=i;o<s;o++)e=e>>>8^r[(e^t[o])&255];return e^-1};var ei=rue,Ju={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},J6={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:sue,_tr_stored_block:oue,_tr_flush_block:aue,_tr_tally:tc,_tr_align:lue}=eue,{Z_NO_FLUSH:Md,Z_PARTIAL_FLUSH:cue,Z_FULL_FLUSH:uue,Z_FINISH:nc,Z_BLOCK:oC,Z_OK:xo,Z_STREAM_END:aC,Z_STREAM_ERROR:cs,Z_DATA_ERROR:due,Z_BUF_ERROR:A8,Z_DEFAULT_COMPRESSION:fue,Z_FILTERED:hue,Z_HUFFMAN_ONLY:Qp,Z_RLE:gue,Z_FIXED:mue,Z_DEFAULT_STRATEGY:pue,Z_UNKNOWN:Uue,Z_DEFLATED:e5}=J6,bue=9,yue=15,Eue=8,vue=29,_ue=256,UE=_ue+1+vue,wue=30,Tue=19,Sue=2*UE+1,Iue=15,rt=3,zl=258,Gs=zl+rt+1,xue=32,t5=42,bE=69,e2=73,t2=91,n2=103,Eu=113,dg=666,Wn=1,jm=2,ed=3,n1=4,Cue=3,Hl=(e,t)=>(e.msg=Ju[t],t),lC=e=>(e<<1)-(e>4?9:0),Dl=e=>{let t=e.length;for(;--t>=0;)e[t]=0};let Aue=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,ic=Aue;const vl=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},_i=(e,t)=>{aue(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,vl(e.strm)},yt=(e,t)=>{e.pending_buf[e.pending++]=t},Y1=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Mue=(e,t,n,i)=>{let r=e.avail_in;return r>i&&(r=i),r===0?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),n),e.state.wrap===1?e.adler=Y0(e.adler,t,r,n):e.state.wrap===2&&(e.adler=ei(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)},GB=(e,t)=>{let n=e.max_chain_length,i=e.strstart,r,s,o=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Gs?e.strstart-(e.w_size-Gs):0,c=e.window,u=e.w_mask,d=e.prev,f=e.strstart+zl;let h=c[i+o-1],m=c[i+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do if(r=t,!(c[r+o]!==m||c[r+o-1]!==h||c[r]!==c[i]||c[++r]!==c[i+1])){i+=2,r++;do;while(c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&i<f);if(s=zl-(f-i),i=f-zl,s>o){if(e.match_start=t,o=s,s>=a)break;h=c[i+o-1],m=c[i+o]}}while((t=d[t&u])>l&&--n!==0);return o<=e.lookahead?o:e.lookahead},td=e=>{const t=e.w_size;let n,i,r,s,o;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Gs)){e.window.set(e.window.subarray(t,t+t),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,n=i;do r=e.head[--n],e.head[n]=r>=t?r-t:0;while(--i);i=t,n=i;do r=e.prev[--n],e.prev[n]=r>=t?r-t:0;while(--i);s+=t}if(e.strm.avail_in===0)break;if(i=Mue(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=rt)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=ic(e,e.ins_h,e.window[o+1]);e.insert&&(e.ins_h=ic(e,e.ins_h,e.window[o+rt-1]),e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<rt)););}while(e.lookahead<Gs&&e.strm.avail_in!==0)},Rue=(e,t)=>{let n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(td(e),e.lookahead===0&&t===Md)return Wn;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;const i=e.block_start+n;if((e.strstart===0||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,_i(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Gs&&(_i(e,!1),e.strm.avail_out===0))return Wn}return e.insert=0,t===nc?(_i(e,!0),e.strm.avail_out===0?ed:n1):(e.strstart>e.block_start&&(_i(e,!1),e.strm.avail_out===0),Wn)},M8=(e,t)=>{let n,i;for(;;){if(e.lookahead<Gs){if(td(e),e.lookahead<Gs&&t===Md)return Wn;if(e.lookahead===0)break}if(n=0,e.lookahead>=rt&&(e.ins_h=ic(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Gs&&(e.match_length=GB(e,n)),e.match_length>=rt)if(i=tc(e,e.strstart-e.match_start,e.match_length-rt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=rt){e.match_length--;do e.strstart++,e.ins_h=ic(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ic(e,e.ins_h,e.window[e.strstart+1]);else i=tc(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(_i(e,!1),e.strm.avail_out===0))return Wn}return e.insert=e.strstart<rt-1?e.strstart:rt-1,t===nc?(_i(e,!0),e.strm.avail_out===0?ed:n1):e.last_lit&&(_i(e,!1),e.strm.avail_out===0)?Wn:jm},Wd=(e,t)=>{let n,i,r;for(;;){if(e.lookahead<Gs){if(td(e),e.lookahead<Gs&&t===Md)return Wn;if(e.lookahead===0)break}if(n=0,e.lookahead>=rt&&(e.ins_h=ic(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=rt-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Gs&&(e.match_length=GB(e,n),e.match_length<=5&&(e.strategy===hue||e.match_length===rt&&e.strstart-e.match_start>4096)&&(e.match_length=rt-1)),e.prev_length>=rt&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-rt,i=tc(e,e.strstart-1-e.prev_match,e.prev_length-rt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=ic(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=rt-1,e.strstart++,i&&(_i(e,!1),e.strm.avail_out===0))return Wn}else if(e.match_available){if(i=tc(e,0,e.window[e.strstart-1]),i&&_i(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Wn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=tc(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<rt-1?e.strstart:rt-1,t===nc?(_i(e,!0),e.strm.avail_out===0?ed:n1):e.last_lit&&(_i(e,!1),e.strm.avail_out===0)?Wn:jm},kue=(e,t)=>{let n,i,r,s;const o=e.window;for(;;){if(e.lookahead<=zl){if(td(e),e.lookahead<=zl&&t===Md)return Wn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=rt&&e.strstart>0&&(r=e.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){s=e.strstart+zl;do;while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<s);e.match_length=zl-(s-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=rt?(n=tc(e,1,e.match_length-rt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=tc(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(_i(e,!1),e.strm.avail_out===0))return Wn}return e.insert=0,t===nc?(_i(e,!0),e.strm.avail_out===0?ed:n1):e.last_lit&&(_i(e,!1),e.strm.avail_out===0)?Wn:jm},Lue=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(td(e),e.lookahead===0)){if(t===Md)return Wn;break}if(e.match_length=0,n=tc(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(_i(e,!1),e.strm.avail_out===0))return Wn}return e.insert=0,t===nc?(_i(e,!0),e.strm.avail_out===0?ed:n1):e.last_lit&&(_i(e,!1),e.strm.avail_out===0)?Wn:jm};function fo(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}const fg=[new fo(0,0,0,0,Rue),new fo(4,4,8,4,M8),new fo(4,5,16,8,M8),new fo(4,6,32,32,M8),new fo(4,4,16,16,Wd),new fo(8,16,32,32,Wd),new fo(8,16,128,128,Wd),new fo(8,32,128,256,Wd),new fo(32,128,258,1024,Wd),new fo(32,258,258,4096,Wd)],Due=e=>{e.window_size=2*e.w_size,Dl(e.head),e.max_lazy_match=fg[e.level].max_lazy,e.good_match=fg[e.level].good_length,e.nice_match=fg[e.level].nice_length,e.max_chain_length=fg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=rt-1,e.match_available=0,e.ins_h=0};function Nue(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=e5,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Sue*2),this.dyn_dtree=new Uint16Array((2*wue+1)*2),this.bl_tree=new Uint16Array((2*Tue+1)*2),Dl(this.dyn_ltree),Dl(this.dyn_dtree),Dl(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Iue+1),this.heap=new Uint16Array(2*UE+1),Dl(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*UE+1),Dl(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const XB=e=>{if(!e||!e.state)return Hl(e,cs);e.total_in=e.total_out=0,e.data_type=Uue;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?t5:Eu,e.adler=t.wrap===2?0:1,t.last_flush=Md,sue(t),xo},jB=e=>{const t=XB(e);return t===xo&&Due(e.state),t},Oue=(e,t)=>!e||!e.state||e.state.wrap!==2?cs:(e.state.gzhead=t,xo),YB=(e,t,n,i,r,s)=>{if(!e)return cs;let o=1;if(t===fue&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>bue||n!==e5||i<8||i>15||t<0||t>9||s<0||s>mue)return Hl(e,cs);i===8&&(i=9);const a=new Nue;return e.state=a,a.strm=e,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=r+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+rt-1)/rt),a.window=new Uint8Array(a.w_size*2),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<r+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new Uint8Array(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=t,a.strategy=s,a.method=n,jB(e)},Pue=(e,t)=>YB(e,t,e5,yue,Eue,pue),Fue=(e,t)=>{let n,i;if(!e||!e.state||t>oC||t<0)return e?Hl(e,cs):cs;const r=e.state;if(!e.output||!e.input&&e.avail_in!==0||r.status===dg&&t!==nc)return Hl(e,e.avail_out===0?A8:cs);r.strm=e;const s=r.last_flush;if(r.last_flush=t,r.status===t5)if(r.wrap===2)e.adler=0,yt(r,31),yt(r,139),yt(r,8),r.gzhead?(yt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),yt(r,r.gzhead.time&255),yt(r,r.gzhead.time>>8&255),yt(r,r.gzhead.time>>16&255),yt(r,r.gzhead.time>>24&255),yt(r,r.level===9?2:r.strategy>=Qp||r.level<2?4:0),yt(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(yt(r,r.gzhead.extra.length&255),yt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=ei(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=bE):(yt(r,0),yt(r,0),yt(r,0),yt(r,0),yt(r,0),yt(r,r.level===9?2:r.strategy>=Qp||r.level<2?4:0),yt(r,Cue),r.status=Eu);else{let o=e5+(r.w_bits-8<<4)<<8,a=-1;r.strategy>=Qp||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,o|=a<<6,r.strstart!==0&&(o|=xue),o+=31-o%31,r.status=Eu,Y1(r,o),r.strstart!==0&&(Y1(r,e.adler>>>16),Y1(r,e.adler&65535)),e.adler=1}if(r.status===bE)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=ei(e.adler,r.pending_buf,r.pending-n,n)),vl(e),n=r.pending,r.pending===r.pending_buf_size));)yt(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=ei(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=e2)}else r.status=e2;if(r.status===e2)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=ei(e.adler,r.pending_buf,r.pending-n,n)),vl(e),n=r.pending,r.pending===r.pending_buf_size)){i=1;break}r.gzindex<r.gzhead.name.length?i=r.gzhead.name.charCodeAt(r.gzindex++)&255:i=0,yt(r,i)}while(i!==0);r.gzhead.hcrc&&r.pending>n&&(e.adler=ei(e.adler,r.pending_buf,r.pending-n,n)),i===0&&(r.gzindex=0,r.status=t2)}else r.status=t2;if(r.status===t2)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=ei(e.adler,r.pending_buf,r.pending-n,n)),vl(e),n=r.pending,r.pending===r.pending_buf_size)){i=1;break}r.gzindex<r.gzhead.comment.length?i=r.gzhead.comment.charCodeAt(r.gzindex++)&255:i=0,yt(r,i)}while(i!==0);r.gzhead.hcrc&&r.pending>n&&(e.adler=ei(e.adler,r.pending_buf,r.pending-n,n)),i===0&&(r.status=n2)}else r.status=n2;if(r.status===n2&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&vl(e),r.pending+2<=r.pending_buf_size&&(yt(r,e.adler&255),yt(r,e.adler>>8&255),e.adler=0,r.status=Eu)):r.status=Eu),r.pending!==0){if(vl(e),e.avail_out===0)return r.last_flush=-1,xo}else if(e.avail_in===0&&lC(t)<=lC(s)&&t!==nc)return Hl(e,A8);if(r.status===dg&&e.avail_in!==0)return Hl(e,A8);if(e.avail_in!==0||r.lookahead!==0||t!==Md&&r.status!==dg){let o=r.strategy===Qp?Lue(r,t):r.strategy===gue?kue(r,t):fg[r.level].func(r,t);if((o===ed||o===n1)&&(r.status=dg),o===Wn||o===ed)return e.avail_out===0&&(r.last_flush=-1),xo;if(o===jm&&(t===cue?lue(r):t!==oC&&(oue(r,0,0,!1),t===uue&&(Dl(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),vl(e),e.avail_out===0))return r.last_flush=-1,xo}return t!==nc?xo:r.wrap<=0?aC:(r.wrap===2?(yt(r,e.adler&255),yt(r,e.adler>>8&255),yt(r,e.adler>>16&255),yt(r,e.adler>>24&255),yt(r,e.total_in&255),yt(r,e.total_in>>8&255),yt(r,e.total_in>>16&255),yt(r,e.total_in>>24&255)):(Y1(r,e.adler>>>16),Y1(r,e.adler&65535)),vl(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?xo:aC)},Bue=e=>{if(!e||!e.state)return cs;const t=e.state.status;return t!==t5&&t!==bE&&t!==e2&&t!==t2&&t!==n2&&t!==Eu&&t!==dg?Hl(e,cs):(e.state=null,t===Eu?Hl(e,due):xo)},zue=(e,t)=>{let n=t.length;if(!e||!e.state)return cs;const i=e.state,r=i.wrap;if(r===2||r===1&&i.status!==t5||i.lookahead)return cs;if(r===1&&(e.adler=Y0(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){r===0&&(Dl(i.head),i.strstart=0,i.block_start=0,i.insert=0);let l=new Uint8Array(i.w_size);l.set(t.subarray(n-i.w_size,n),0),t=l,n=i.w_size}const s=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,td(i);i.lookahead>=rt;){let l=i.strstart,c=i.lookahead-(rt-1);do i.ins_h=ic(i,i.ins_h,i.window[l+rt-1]),i.prev[l&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=l,l++;while(--c);i.strstart=l,i.lookahead=rt-1,td(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=rt-1,i.match_available=0,e.next_in=o,e.input=a,e.avail_in=s,i.wrap=r,xo};var Hue=Pue,Vue=YB,$ue=jB,Gue=XB,Xue=Oue,jue=Fue,Yue=Bue,Wue=zue,Kue="pako deflate (from Nodeca project)",Zg={deflateInit:Hue,deflateInit2:Vue,deflateReset:$ue,deflateResetKeep:Gue,deflateSetHeader:Xue,deflate:jue,deflateEnd:Yue,deflateSetDictionary:Wue,deflateInfo:Kue};const Zue=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var que=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const i in n)Zue(n,i)&&(e[i]=n[i])}}return e},Que=e=>{let t=0;for(let i=0,r=e.length;i<r;i++)t+=e[i].length;const n=new Uint8Array(t);for(let i=0,r=0,s=e.length;i<s;i++){let o=e[i];n.set(o,r),r+=o.length}return n},n5={assign:que,flattenChunks:Que};let WB=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{WB=!1}const W0=new Uint8Array(256);for(let e=0;e<256;e++)W0[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;W0[254]=W0[254]=1;var Jue=e=>{let t,n,i,r,s,o=e.length,a=0;for(r=0;r<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),s=0,r=0;s<a;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<o&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|n&63):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|n&63):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|n&63);return t};const ede=(e,t)=>{if(t<65534&&e.subarray&&WB)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n};var tde=(e,t)=>{let n,i;const r=t||e.length,s=new Array(r*2);for(i=0,n=0;n<r;){let o=e[n++];if(o<128){s[i++]=o;continue}let a=W0[o];if(a>4){s[i++]=65533,n+=a-1;continue}for(o&=a===2?31:a===3?15:7;a>1&&n<r;)o=o<<6|e[n++]&63,a--;if(a>1){s[i++]=65533;continue}o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|o&1023)}return ede(s,i)},nde=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+W0[e[n]]>t?n:t},K0={string2buf:Jue,buf2string:tde,utf8border:nde};function ide(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var KB=ide;const ZB=Object.prototype.toString,{Z_NO_FLUSH:rde,Z_SYNC_FLUSH:sde,Z_FULL_FLUSH:ode,Z_FINISH:ade,Z_OK:Sb,Z_STREAM_END:lde,Z_DEFAULT_COMPRESSION:cde,Z_DEFAULT_STRATEGY:ude,Z_DEFLATED:dde}=J6;function i5(e){this.options=n5.assign({level:cde,method:dde,chunkSize:16384,windowBits:15,memLevel:8,strategy:ude},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KB,this.strm.avail_out=0;let n=Zg.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Sb)throw new Error(Ju[n]);if(t.header&&Zg.deflateSetHeader(this.strm,t.header),t.dictionary){let i;if(typeof t.dictionary=="string"?i=K0.string2buf(t.dictionary):ZB.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,n=Zg.deflateSetDictionary(this.strm,i),n!==Sb)throw new Error(Ju[n]);this._dict_set=!0}}i5.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?ade:rde,typeof e=="string"?n.input=K0.string2buf(e):ZB.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(s===sde||s===ode)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(r=Zg.deflate(n,s),r===lde)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),r=Zg.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Sb;if(n.avail_out===0){this.onData(n.output);continue}if(s>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};i5.prototype.onData=function(e){this.chunks.push(e)};i5.prototype.onEnd=function(e){e===Sb&&(this.result=n5.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fde(e,t){const n=new i5(t);if(n.push(e,!0),n.err)throw n.msg||Ju[n.err];return n.result}var hde=fde,gde={deflate:hde};const Jp=30,mde=12;var pde=function(t,n){let i,r,s,o,a,l,c,u,d,f,h,m,p,b,E,y,v,_,I,R,w,T,A,S;const k=t.state;i=t.next_in,A=t.input,r=i+(t.avail_in-5),s=t.next_out,S=t.output,o=s-(n-t.avail_out),a=s+(t.avail_out-257),l=k.dmax,c=k.wsize,u=k.whave,d=k.wnext,f=k.window,h=k.hold,m=k.bits,p=k.lencode,b=k.distcode,E=(1<<k.lenbits)-1,y=(1<<k.distbits)-1;e:do{m<15&&(h+=A[i++]<<m,m+=8,h+=A[i++]<<m,m+=8),v=p[h&E];t:for(;;){if(_=v>>>24,h>>>=_,m-=_,_=v>>>16&255,_===0)S[s++]=v&65535;else if(_&16){I=v&65535,_&=15,_&&(m<_&&(h+=A[i++]<<m,m+=8),I+=h&(1<<_)-1,h>>>=_,m-=_),m<15&&(h+=A[i++]<<m,m+=8,h+=A[i++]<<m,m+=8),v=b[h&y];n:for(;;){if(_=v>>>24,h>>>=_,m-=_,_=v>>>16&255,_&16){if(R=v&65535,_&=15,m<_&&(h+=A[i++]<<m,m+=8,m<_&&(h+=A[i++]<<m,m+=8)),R+=h&(1<<_)-1,R>l){t.msg="invalid distance too far back",k.mode=Jp;break e}if(h>>>=_,m-=_,_=s-o,R>_){if(_=R-_,_>u&&k.sane){t.msg="invalid distance too far back",k.mode=Jp;break e}if(w=0,T=f,d===0){if(w+=c-_,_<I){I-=_;do S[s++]=f[w++];while(--_);w=s-R,T=S}}else if(d<_){if(w+=c+d-_,_-=d,_<I){I-=_;do S[s++]=f[w++];while(--_);if(w=0,d<I){_=d,I-=_;do S[s++]=f[w++];while(--_);w=s-R,T=S}}}else if(w+=d-_,_<I){I-=_;do S[s++]=f[w++];while(--_);w=s-R,T=S}for(;I>2;)S[s++]=T[w++],S[s++]=T[w++],S[s++]=T[w++],I-=3;I&&(S[s++]=T[w++],I>1&&(S[s++]=T[w++]))}else{w=s-R;do S[s++]=S[w++],S[s++]=S[w++],S[s++]=S[w++],I-=3;while(I>2);I&&(S[s++]=S[w++],I>1&&(S[s++]=S[w++]))}}else if(_&64){t.msg="invalid distance code",k.mode=Jp;break e}else{v=b[(v&65535)+(h&(1<<_)-1)];continue n}break}}else if(_&64)if(_&32){k.mode=mde;break e}else{t.msg="invalid literal/length code",k.mode=Jp;break e}else{v=p[(v&65535)+(h&(1<<_)-1)];continue t}break}}while(i<r&&s<a);I=m>>3,i-=I,m-=I<<3,h&=(1<<m)-1,t.next_in=i,t.next_out=s,t.avail_in=i<r?5+(r-i):5-(i-r),t.avail_out=s<a?257+(a-s):257-(s-a),k.hold=h,k.bits=m};const Kd=15,cC=852,uC=592,dC=0,R8=1,fC=2,Ude=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),bde=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),yde=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ede=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),vde=(e,t,n,i,r,s,o,a)=>{const l=a.bits;let c=0,u=0,d=0,f=0,h=0,m=0,p=0,b=0,E=0,y=0,v,_,I,R,w,T=null,A=0,S;const k=new Uint16Array(Kd+1),N=new Uint16Array(Kd+1);let D=null,G=0,V,H,$;for(c=0;c<=Kd;c++)k[c]=0;for(u=0;u<i;u++)k[t[n+u]]++;for(h=l,f=Kd;f>=1&&k[f]===0;f--);if(h>f&&(h=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,a.bits=1,0;for(d=1;d<f&&k[d]===0;d++);for(h<d&&(h=d),b=1,c=1;c<=Kd;c++)if(b<<=1,b-=k[c],b<0)return-1;if(b>0&&(e===dC||f!==1))return-1;for(N[1]=0,c=1;c<Kd;c++)N[c+1]=N[c]+k[c];for(u=0;u<i;u++)t[n+u]!==0&&(o[N[t[n+u]]++]=u);if(e===dC?(T=D=o,S=19):e===R8?(T=Ude,A-=257,D=bde,G-=257,S=256):(T=yde,D=Ede,S=-1),y=0,u=0,c=d,w=s,m=h,p=0,I=-1,E=1<<h,R=E-1,e===R8&&E>cC||e===fC&&E>uC)return 1;for(;;){V=c-p,o[u]<S?(H=0,$=o[u]):o[u]>S?(H=D[G+o[u]],$=T[A+o[u]]):(H=96,$=0),v=1<<c-p,_=1<<m,d=_;do _-=v,r[w+(y>>p)+_]=V<<24|H<<16|$|0;while(_!==0);for(v=1<<c-1;y&v;)v>>=1;if(v!==0?(y&=v-1,y+=v):y=0,u++,--k[c]===0){if(c===f)break;c=t[n+o[u]]}if(c>h&&(y&R)!==I){for(p===0&&(p=h),w+=d,m=c-p,b=1<<m;m+p<f&&(b-=k[m+p],!(b<=0));)m++,b<<=1;if(E+=1<<m,e===R8&&E>cC||e===fC&&E>uC)return 1;I=y&R,r[I]=h<<24|m<<16|w-s|0}}return y!==0&&(r[w+y]=c-p<<24|64<<16|0),a.bits=h,0};var qg=vde;const _de=0,qB=1,QB=2,{Z_FINISH:hC,Z_BLOCK:wde,Z_TREES:eU,Z_OK:nd,Z_STREAM_END:Tde,Z_NEED_DICT:Sde,Z_STREAM_ERROR:ys,Z_DATA_ERROR:JB,Z_MEM_ERROR:ez,Z_BUF_ERROR:Ide,Z_DEFLATED:gC}=J6,tz=1,mC=2,pC=3,UC=4,bC=5,yC=6,EC=7,vC=8,_C=9,wC=10,Ib=11,oa=12,k8=13,TC=14,L8=15,SC=16,IC=17,xC=18,CC=19,tU=20,nU=21,AC=22,MC=23,RC=24,kC=25,LC=26,D8=27,DC=28,NC=29,Qt=30,nz=31,xde=32,Cde=852,Ade=592,Mde=15,Rde=Mde,OC=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function kde(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const iz=e=>{if(!e||!e.state)return ys;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=tz,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Cde),t.distcode=t.distdyn=new Int32Array(Ade),t.sane=1,t.back=-1,nd},rz=e=>{if(!e||!e.state)return ys;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,iz(e)},sz=(e,t)=>{let n;if(!e||!e.state)return ys;const i=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15)?ys:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,rz(e))},oz=(e,t)=>{if(!e)return ys;const n=new kde;e.state=n,n.window=null;const i=sz(e,t);return i!==nd&&(e.state=null),i},Lde=e=>oz(e,Rde);let PC=!0,N8,O8;const Dde=e=>{if(PC){N8=new Int32Array(512),O8=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(qg(qB,e.lens,0,288,N8,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;qg(QB,e.lens,0,32,O8,0,e.work,{bits:5}),PC=!1}e.lencode=N8,e.lenbits=9,e.distcode=O8,e.distbits=5},az=(e,t,n,i)=>{let r;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(t.subarray(n-i,n-i+r),s.wnext),i-=r,i?(s.window.set(t.subarray(n-i,n),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},Nde=(e,t)=>{let n,i,r,s,o,a,l,c,u,d,f,h,m,p,b=0,E,y,v,_,I,R,w,T;const A=new Uint8Array(4);let S,k;const N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return ys;n=e.state,n.mode===oa&&(n.mode=k8),o=e.next_out,r=e.output,l=e.avail_out,s=e.next_in,i=e.input,a=e.avail_in,c=n.hold,u=n.bits,d=a,f=l,T=nd;e:for(;;)switch(n.mode){case tz:if(n.wrap===0){n.mode=k8;break}for(;u<16;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(n.wrap&2&&c===35615){n.check=0,A[0]=c&255,A[1]=c>>>8&255,n.check=ei(n.check,A,2,0),c=0,u=0,n.mode=mC;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Qt;break}if((c&15)!==gC){e.msg="unknown compression method",n.mode=Qt;break}if(c>>>=4,u-=4,w=(c&15)+8,n.wbits===0)n.wbits=w;else if(w>n.wbits){e.msg="invalid window size",n.mode=Qt;break}n.dmax=1<<n.wbits,e.adler=n.check=1,n.mode=c&512?wC:oa,c=0,u=0;break;case mC:for(;u<16;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(n.flags=c,(n.flags&255)!==gC){e.msg="unknown compression method",n.mode=Qt;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Qt;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,n.check=ei(n.check,A,2,0)),c=0,u=0,n.mode=pC;case pC:for(;u<32;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}n.head&&(n.head.time=c),n.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,n.check=ei(n.check,A,4,0)),c=0,u=0,n.mode=UC;case UC:for(;u<16;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,n.check=ei(n.check,A,2,0)),c=0,u=0,n.mode=bC;case bC:if(n.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,n.check=ei(n.check,A,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=yC;case yC:if(n.flags&1024&&(h=n.length,h>a&&(h=a),h&&(n.head&&(w=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(s,s+h),w)),n.flags&512&&(n.check=ei(n.check,i,h,s)),a-=h,s+=h,n.length-=h),n.length))break e;n.length=0,n.mode=EC;case EC:if(n.flags&2048){if(a===0)break e;h=0;do w=i[s+h++],n.head&&w&&n.length<65536&&(n.head.name+=String.fromCharCode(w));while(w&&h<a);if(n.flags&512&&(n.check=ei(n.check,i,h,s)),a-=h,s+=h,w)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=vC;case vC:if(n.flags&4096){if(a===0)break e;h=0;do w=i[s+h++],n.head&&w&&n.length<65536&&(n.head.comment+=String.fromCharCode(w));while(w&&h<a);if(n.flags&512&&(n.check=ei(n.check,i,h,s)),a-=h,s+=h,w)break e}else n.head&&(n.head.comment=null);n.mode=_C;case _C:if(n.flags&512){for(;u<16;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(c!==(n.check&65535)){e.msg="header crc mismatch",n.mode=Qt;break}c=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=oa;break;case wC:for(;u<32;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}e.adler=n.check=OC(c),c=0,u=0,n.mode=Ib;case Ib:if(n.havedict===0)return e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=a,n.hold=c,n.bits=u,Sde;e.adler=n.check=1,n.mode=oa;case oa:if(t===wde||t===eU)break e;case k8:if(n.last){c>>>=u&7,u-=u&7,n.mode=D8;break}for(;u<3;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}switch(n.last=c&1,c>>>=1,u-=1,c&3){case 0:n.mode=TC;break;case 1:if(Dde(n),n.mode=tU,t===eU){c>>>=2,u-=2;break e}break;case 2:n.mode=IC;break;case 3:e.msg="invalid block type",n.mode=Qt}c>>>=2,u-=2;break;case TC:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Qt;break}if(n.length=c&65535,c=0,u=0,n.mode=L8,t===eU)break e;case L8:n.mode=SC;case SC:if(h=n.length,h){if(h>a&&(h=a),h>l&&(h=l),h===0)break e;r.set(i.subarray(s,s+h),o),a-=h,s+=h,l-=h,o+=h,n.length-=h;break}n.mode=oa;break;case IC:for(;u<14;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(n.nlen=(c&31)+257,c>>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Qt;break}n.have=0,n.mode=xC;case xC:for(;n.have<n.ncode;){for(;u<3;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}n.lens[N[n.have++]]=c&7,c>>>=3,u-=3}for(;n.have<19;)n.lens[N[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,S={bits:n.lenbits},T=qg(_de,n.lens,0,19,n.lencode,0,n.work,S),n.lenbits=S.bits,T){e.msg="invalid code lengths set",n.mode=Qt;break}n.have=0,n.mode=CC;case CC:for(;n.have<n.nlen+n.ndist;){for(;b=n.lencode[c&(1<<n.lenbits)-1],E=b>>>24,y=b>>>16&255,v=b&65535,!(E<=u);){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(v<16)c>>>=E,u-=E,n.lens[n.have++]=v;else{if(v===16){for(k=E+2;u<k;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(c>>>=E,u-=E,n.have===0){e.msg="invalid bit length repeat",n.mode=Qt;break}w=n.lens[n.have-1],h=3+(c&3),c>>>=2,u-=2}else if(v===17){for(k=E+3;u<k;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}c>>>=E,u-=E,w=0,h=3+(c&7),c>>>=3,u-=3}else{for(k=E+7;u<k;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}c>>>=E,u-=E,w=0,h=11+(c&127),c>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Qt;break}for(;h--;)n.lens[n.have++]=w}}if(n.mode===Qt)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Qt;break}if(n.lenbits=9,S={bits:n.lenbits},T=qg(qB,n.lens,0,n.nlen,n.lencode,0,n.work,S),n.lenbits=S.bits,T){e.msg="invalid literal/lengths set",n.mode=Qt;break}if(n.distbits=6,n.distcode=n.distdyn,S={bits:n.distbits},T=qg(QB,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,S),n.distbits=S.bits,T){e.msg="invalid distances set",n.mode=Qt;break}if(n.mode=tU,t===eU)break e;case tU:n.mode=nU;case nU:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=a,n.hold=c,n.bits=u,pde(e,f),o=e.next_out,r=e.output,l=e.avail_out,s=e.next_in,i=e.input,a=e.avail_in,c=n.hold,u=n.bits,n.mode===oa&&(n.back=-1);break}for(n.back=0;b=n.lencode[c&(1<<n.lenbits)-1],E=b>>>24,y=b>>>16&255,v=b&65535,!(E<=u);){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(y&&!(y&240)){for(_=E,I=y,R=v;b=n.lencode[R+((c&(1<<_+I)-1)>>_)],E=b>>>24,y=b>>>16&255,v=b&65535,!(_+E<=u);){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}c>>>=_,u-=_,n.back+=_}if(c>>>=E,u-=E,n.back+=E,n.length=v,y===0){n.mode=LC;break}if(y&32){n.back=-1,n.mode=oa;break}if(y&64){e.msg="invalid literal/length code",n.mode=Qt;break}n.extra=y&15,n.mode=AC;case AC:if(n.extra){for(k=n.extra;u<k;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=MC;case MC:for(;b=n.distcode[c&(1<<n.distbits)-1],E=b>>>24,y=b>>>16&255,v=b&65535,!(E<=u);){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(!(y&240)){for(_=E,I=y,R=v;b=n.distcode[R+((c&(1<<_+I)-1)>>_)],E=b>>>24,y=b>>>16&255,v=b&65535,!(_+E<=u);){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}c>>>=_,u-=_,n.back+=_}if(c>>>=E,u-=E,n.back+=E,y&64){e.msg="invalid distance code",n.mode=Qt;break}n.offset=v,n.extra=y&15,n.mode=RC;case RC:if(n.extra){for(k=n.extra;u<k;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Qt;break}n.mode=kC;case kC:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Qt;break}h>n.wnext?(h-=n.wnext,m=n.wsize-h):m=n.wnext-h,h>n.length&&(h=n.length),p=n.window}else p=r,m=o-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do r[o++]=p[m++];while(--h);n.length===0&&(n.mode=nU);break;case LC:if(l===0)break e;r[o++]=n.length,l--,n.mode=nU;break;case D8:if(n.wrap){for(;u<32;){if(a===0)break e;a--,c|=i[s++]<<u,u+=8}if(f-=l,e.total_out+=f,n.total+=f,f&&(e.adler=n.check=n.flags?ei(n.check,r,f,o-f):Y0(n.check,r,f,o-f)),f=l,(n.flags?c:OC(c))!==n.check){e.msg="incorrect data check",n.mode=Qt;break}c=0,u=0}n.mode=DC;case DC:if(n.wrap&&n.flags){for(;u<32;){if(a===0)break e;a--,c+=i[s++]<<u,u+=8}if(c!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=Qt;break}c=0,u=0}n.mode=NC;case NC:T=Tde;break e;case Qt:T=JB;break e;case nz:return ez;case xde:default:return ys}return e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=a,n.hold=c,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<Qt&&(n.mode<D8||t!==hC))&&az(e,e.output,e.next_out,f-e.avail_out),d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&&f&&(e.adler=n.check=n.flags?ei(n.check,r,f,e.next_out-f):Y0(n.check,r,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===oa?128:0)+(n.mode===tU||n.mode===L8?256:0),(d===0&&f===0||t===hC)&&T===nd&&(T=Ide),T},Ode=e=>{if(!e||!e.state)return ys;let t=e.state;return t.window&&(t.window=null),e.state=null,nd},Pde=(e,t)=>{if(!e||!e.state)return ys;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,nd):ys},Fde=(e,t)=>{const n=t.length;let i,r,s;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==Ib)?ys:i.mode===Ib&&(r=1,r=Y0(r,t,n,0),r!==i.check)?JB:(s=az(e,t,n,n),s?(i.mode=nz,ez):(i.havedict=1,nd))};var Bde=rz,zde=sz,Hde=iz,Vde=Lde,$de=oz,Gde=Nde,Xde=Ode,jde=Pde,Yde=Fde,Wde="pako inflate (from Nodeca project)",ma={inflateReset:Bde,inflateReset2:zde,inflateResetKeep:Hde,inflateInit:Vde,inflateInit2:$de,inflate:Gde,inflateEnd:Xde,inflateGetHeader:jde,inflateSetDictionary:Yde,inflateInfo:Wde};function Kde(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Zde=Kde;const lz=Object.prototype.toString,{Z_NO_FLUSH:qde,Z_FINISH:Qde,Z_OK:Z0,Z_STREAM_END:P8,Z_NEED_DICT:F8,Z_STREAM_ERROR:Jde,Z_DATA_ERROR:FC,Z_MEM_ERROR:efe}=J6;function r5(e){this.options=n5.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KB,this.strm.avail_out=0;let n=ma.inflateInit2(this.strm,t.windowBits);if(n!==Z0)throw new Error(Ju[n]);if(this.header=new Zde,ma.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=K0.string2buf(t.dictionary):lz.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ma.inflateSetDictionary(this.strm,t.dictionary),n!==Z0)))throw new Error(Ju[n])}r5.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Qde:qde,lz.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),s=ma.inflate(n,o),s===F8&&r&&(s=ma.inflateSetDictionary(n,r),s===Z0?s=ma.inflate(n,o):s===FC&&(s=F8));n.avail_in>0&&s===P8&&n.state.wrap>0&&e[n.next_in]!==0;)ma.inflateReset(n),s=ma.inflate(n,o);switch(s){case Jde:case FC:case F8:case efe:return this.onEnd(s),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||s===P8))if(this.options.to==="string"){let l=K0.utf8border(n.output,n.next_out),c=n.next_out-l,u=K0.buf2string(n.output,l);n.next_out=c,n.avail_out=i-c,c&&n.output.set(n.output.subarray(l,l+c),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(s===Z0&&a===0)){if(s===P8)return s=ma.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};r5.prototype.onData=function(e){this.chunks.push(e)};r5.prototype.onEnd=function(e){e===Z0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n5.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function tfe(e,t){const n=new r5(t);if(n.push(e),n.err)throw n.msg||Ju[n.err];return n.result}var nfe=tfe,ife={inflate:nfe};const{deflate:rfe}=gde,{inflate:sfe}=ife;var cz=rfe,uz=sfe;const i2=12,ofe=()=>{const e=new Uint8Array(i2);return window.crypto.getRandomValues(e)},O9=async e=>{const t=await window.crypto.subtle.generateKey({name:"AES-GCM",length:BO},!0,["encrypt","decrypt"]);return e==="cryptoKey"?t:(await window.crypto.subtle.exportKey("jwk",t)).k},dz=(e,t)=>window.crypto.subtle.importKey("jwk",{alg:"A128GCM",ext:!0,k:e,key_ops:["encrypt","decrypt"],kty:"oct"},{name:"AES-GCM",length:BO},!1,[t]),s5=async(e,t)=>{const n=typeof e=="string"?await dz(e,"encrypt"):e,i=ofe(),r=typeof t=="string"?new TextEncoder().encode(t):t instanceof Uint8Array?t:t instanceof Blob?await Vl(t):t;return{encryptedBuffer:await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},n,r),iv:i}},q0=async(e,t,n)=>{const i=await dz(n,"decrypt");return window.crypto.subtle.decrypt({name:"AES-GCM",iv:e},i,t)},xb=e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(const i of t)n+=String.fromCharCode(i);return n},fz=e=>{const t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0,r=e.length;i<r;i++)n[i]=e.charCodeAt(i);return t},hz=e=>new TextDecoder("utf-8").decode(fz(e)),gz=(e,t=!1)=>t?window.btoa(e):window.btoa(xb(e)),mz=(e,t=!1)=>t?window.atob(e):hz(window.atob(e)),BC=e=>window.atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"=")),pz=({text:e,compress:t})=>{let n;if(t!==!1)try{n=xb(cz(e))}catch(i){console.error("encode: cannot deflate",i)}return{version:"1",encoding:"bstring",compressed:!!n,encoded:n||xb(e)}},Uz=e=>{let t;switch(e.encoding){case"bstring":t=e.compressed?e.encoded:hz(e.encoded);break;default:throw new Error(`decode: unknown encoding "${e.encoding}"`)}return e.compressed?uz(new Uint8Array(fz(t)),{to:"string"}):t},bz=1,r2=4,Kf=4,B8={1:8,2:16,4:32};function Cb(e,t,n,i){if(i!=null){if(i>Math.pow(2,B8[t])-1)throw new Error(`attempting to set value higher than the allocated bytes (value: ${i}, bytes: ${t})`);const s=`setUint${B8[t]}`;return new DataView(e.buffer)[s](n,i),e}const r=`getUint${B8[t]}`;return new DataView(e.buffer)[r](n)}const zC=(...e)=>{const t=new Uint8Array(r2+Kf*e.length+e.reduce((i,r)=>i+r.byteLength,0));let n=0;Cb(t,r2,n,bz),n+=r2;for(const i of e)Cb(t,Kf,n,i.byteLength),n+=Kf,t.set(i,n),n+=i.byteLength;return t},HC=e=>{const t=[];let n=0;const i=Cb(e,Kf,n);if(i>bz)throw new Error(`invalid version ${i}`);for(n+=r2;;){const r=Cb(e,Kf,n);if(n+=Kf,t.push(e.slice(n,n+r)),n+=r,n>=e.byteLength)break}return t},afe=async(e,t)=>{const{encryptedBuffer:n,iv:i}=await s5(t,cz(e));return{iv:i,buffer:new Uint8Array(n)}},yz=async(e,t)=>{const n={version:2,compression:"pako@1",encryption:"AES-GCM"},i=new TextEncoder().encode(JSON.stringify(n)),r=new TextEncoder().encode(JSON.stringify(t.metadata||null)),{iv:s,buffer:o}=await afe(zC(r,e),t.encryptionKey);return zC(i,s,o)},lfe=async(e,t,n,i)=>(t=new Uint8Array(await q0(e,t,n)),i?uz(t):t),Ez=async(e,t)=>{const[n,i,r]=HC(e),s=JSON.parse(new TextDecoder().decode(n));try{const[o,a]=HC(await lfe(i,r,t.decryptionKey,!!s.compression));return{metadata:JSON.parse(new TextDecoder().decode(o)),data:a}}catch(o){throw console.error("Error during decompressing and decrypting the file.",s),o}},vh=e=>{const t=e.map(i=>i[0]),n=e.map(i=>i[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},Ab=(e,t,n,i)=>{const r=n.map(h=>h[e]),s=Math.max(...r),o=Math.min(...r),a=s-o,l=a===0?1:t/a;let c=1/0;const u=n.map(h=>{const m=h[e]*l,p=[...h];return p[e]=m,m<c&&(c=m),p});if(!i||u.length===2)return u;const d=o-c;return u.map(h=>h.map((m,p)=>p===e?m+d:m))};class cfe{constructor(t){F(this,"content",[]);this.scoreFunction=t}sinkDown(t){const n=this.content[t];for(;t>0;){const i=(t+1>>1)-1,r=this.content[i];if(this.scoreFunction(n)<this.scoreFunction(r))this.content[i]=n,this.content[t]=r,t=i;else break}}bubbleUp(t){const n=this.content.length,i=this.content[t],r=this.scoreFunction(i);for(;;){const s=t+1<<1,o=s-1;let a=null,l=0;if(o<n){const c=this.content[o];l=this.scoreFunction(c),l<r&&(a=o)}if(s<n){const c=this.content[s];this.scoreFunction(c)<(a===null?r:l)&&(a=s)}if(a!==null)this.content[t]=this.content[a],this.content[a]=i,t=a;else break}}push(t){this.content.push(t),this.sinkDown(this.content.length-1)}pop(){if(this.content.length===0)return null;const t=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.bubbleUp(0)),t}remove(t){if(this.content.length===0)return;const n=this.content.indexOf(t),i=this.content.pop();n<this.content.length&&(this.content[n]=i,this.scoreFunction(i)<this.scoreFunction(t)?this.sinkDown(n):this.bubbleUp(n))}size(){return this.content.length}rescoreElement(t){this.sinkDown(this.content.indexOf(t))}}const P9=1,Tn=40,ufe=(e,t)=>{const n=e.fixedSegments?e.fixedSegments.slice():null;if(n){const i=[];e.points.map(o=>C(e.x+o[0],e.y+o[1])).forEach((o,a,l)=>{if(a<2)return i.push(o);const c=z0(o,l[a-1]),u=z0(l[a-1],l[a-2]);if(hn(c,u)){const d=(n==null?void 0:n.findIndex(h=>h.index===a-1))??-1,f=(n==null?void 0:n.findIndex(h=>h.index===a))??-1;f!==-1&&(n[f].start=C(l[a-2][0]-e.x,l[a-2][1]-e.y)),d!==-1&&n.splice(d,1),i.splice(-1,1),n.forEach(h=>{h.index>a-1&&(h.index-=1)})}return i.push(o)});const r=[];i.forEach((o,a,l)=>{if(a<3)return r.push(o);if(pt(l[a-2],l[a-1])<P9){const c=(n==null?void 0:n.findIndex(f=>f.index===a-2))??-1,u=(n==null?void 0:n.findIndex(f=>f.index===a-1))??-1;u!==-1&&n.splice(u,1),c!==-1&&n.splice(c,1),r.splice(-2,2),n.forEach(f=>{f.index>a-2&&(f.index-=2)});const d=Ea(o,l[a-1]);return r.push(C(d?o[0]:l[a-2][0],d?l[a-2][1]:o[1]))}r.push(o)});const s=n.filter(o=>o.index!==1&&o.index!==r.length-1);return s.length===0?yc(H9(V9(z9(e,B9(e,t,r.map(o=>C(o[0]-e.x,o[1]-e.y)),e.startBinding&&_h(e.startBinding.elementId,t),e.endBinding&&_h(e.endBinding.elementId,t)))??[])),s,null,null):yc(r,s,e.startIsSpecial,e.endIsSpecial)}return{x:e.x,y:e.y,points:e.points,fixedSegments:e.fixedSegments,startIsSpecial:e.startIsSpecial,endIsSpecial:e.endIsSpecial}},dfe=(e,t,n)=>{var A,S;const i=t.map(k=>k.index),s=(((A=e.fixedSegments)==null?void 0:A.map(k=>k.index))??[]).findIndex(k=>!i.includes(k));if(s===-1||!((S=e.fixedSegments)!=null&&S[s]))return{points:e.points};const o=e.fixedSegments[s].index,a=e.fixedSegments[s-1],l=e.fixedSegments[s+1],c=e.x+(a?a.end[0]:0),u=e.y+(a?a.end[1]:0),d=a?null:e.startBinding,f=l?null:e.endBinding,{startHeading:h,endHeading:m,startGlobalPoint:p,endGlobalPoint:b,hoveredStartElement:E,hoveredEndElement:y,...v}=B9({x:c,y:u,startBinding:d,endBinding:f,startArrowhead:null,endArrowhead:null,points:e.points},n,[C(0,0),C(e.x+((l==null?void 0:l.start[0])??e.points[e.points.length-1][0])-c,e.y+((l==null?void 0:l.start[1])??e.points[e.points.length-1][1])-u)],d&&_h(d.elementId,n),f&&_h(f.elementId,n),{isDragging:!1}),{points:_}=yc(H9(V9(z9(e,{startHeading:h,endHeading:m,startGlobalPoint:p,endGlobalPoint:b,hoveredEndElement:y,...v})??[])),t,null,null),I=[];if(a)for(let k=0;k<a.index;k++)I.push(C(e.x+e.points[k][0],e.y+e.points[k][1]));if(_.forEach(k=>{I.push(C(e.x+(a?a.end[0]:0)+k[0],e.y+(a?a.end[1]:0)+k[1]))}),l)for(let k=l.index;k<e.points.length;k++)I.push(C(e.x+e.points[k][0],e.y+e.points[k][1]));const R=((l==null?void 0:l.index)??e.points.length)-((a==null?void 0:a.index)??0)-1,w=t.map(k=>k.index>o?{...k,index:k.index-R+(_.length-1)}:k),T=I.flatMap((k,N)=>{const D=I[N-1],G=I[N+1];if(D&&G){const V=z0(k,D),H=z0(G,k);if(hn(V,H))return w.forEach($=>{$.index>N&&($.index-=1)}),[];if(hn(V,yB(H)))return w.forEach($=>{$.index>N&&($.index+=1)}),[k,k]}return[k]});return yc(T,w,!1,!1)},ffe=(e,t,n,i,r,s)=>{var I,R;const o=t.map((w,T)=>e.fixedSegments==null||e.fixedSegments[T]===void 0||e.fixedSegments[T].index!==w.index||(w.start[0]!==e.fixedSegments[T].start[0]&&w.end[0]!==e.fixedSegments[T].end[0])!=(w.start[1]!==e.fixedSegments[T].start[1]&&w.end[1]!==e.fixedSegments[T].end[1])?T:null).filter(w=>w!==null).shift();if(o==null)return{points:e.points};const a=((I=e.fixedSegments)==null?void 0:I.findIndex(w=>w.index===1))??-1,l=((R=e.fixedSegments)==null?void 0:R.findIndex(w=>w.index===e.points.length-1))??-1,c=pt(t[o].start,t[o].end),u=c<Tn+5;if(a===-1&&t[o].index===1&&r){const w=Ca(n),A=(w?hn(n,cn):hn(n,oi))?u?c/2:Tn:u?-c/2:-40;t[o].start=C(t[o].start[0]+(w?A:0),t[o].start[1]+(w?0:A))}if(l===-1&&t[o].index===e.points.length-1&&s){const w=Ca(i),A=(w?hn(i,cn):hn(i,oi))?u?c/2:Tn:u?-c/2:-40;t[o].end=C(t[o].end[0]+(w?A:0),t[o].end[1]+(w?0:A))}const d=t.map(w=>({...w,start:C(e.x+w.start[0],e.y+w.start[1]),end:C(e.x+w.end[0],e.y+w.end[1])})),f=e.points.map((w,T)=>C(e.x+w[0],e.y+w[1])),h=d[o].index-1,m=d[o].index,p=d[o].start,b=d[o].end,E=f[h-1]&&!Zs(f[h],f[h-1])?Ea(f[h-1],f[h]):void 0,y=f[m+1]&&!Zs(f[m],f[m+1])?Ea(f[m+1],f[m]):void 0;if(E!==void 0){const w=E?1:0;f[h-1][w]=p[w]}if(f[h]=p,f[m]=b,y!==void 0){const w=y?1:0;f[m+1][w]=b[w]}const v=d.findIndex(w=>w.index===h);if(v!==-1){const w=Ea(d[v].end,d[v].start)?1:0;d[v].start[w]=p[w],d[v].end=p}const _=d.findIndex(w=>w.index===m+1);if(_!==-1){const w=Ea(d[_].end,d[_].start)?1:0;d[_].end[w]=b[w],d[_].start=b}if(a===-1&&h===0){const w=r?Ca(n):Ea(f[1],f[0]);f.unshift(C(w?p[0]:e.x+e.points[0][0],w?e.y+e.points[0][1]:p[1])),r&&f.unshift(C(e.x+e.points[0][0],e.y+e.points[0][1]));for(const T of d)T.index+=r?2:1}if(l===-1&&m===e.points.length-1){const w=Ca(i);f.push(C(w?b[0]:e.x+e.points[e.points.length-1][0],w?e.y+e.points[e.points.length-1][1]:b[1])),s&&f.push(C(e.x+e.points[e.points.length-1][0],e.y+e.points[e.points.length-1][1]))}return yc(f,d.map(w=>({...w,start:C(w.start[0]-e.x,w.start[1]-e.y),end:C(w.end[0]-e.x,w.end[1]-e.y)})),!1,!1)},hfe=(e,t,n,i,r,s,o,a,l)=>{let c=e.startIsSpecial??null,u=e.endIsSpecial??null;const d=t.map((b,E)=>E===0||E===t.length-1?C(e.x+b[0],e.y+b[1]):C(e.x+e.points[E][0],e.y+e.points[E][1])),f=n.map(b=>({...b,start:C(e.x+(b.start[0]-t[0][0]),e.y+(b.start[1]-t[0][1])),end:C(e.x+(b.end[0]-t[0][0]),e.y+(b.end[1]-t[0][1]))})),h=[],m=2+(c?1:0),p=2+(u?1:0);for(;h.length+m<d.length-p;)h.push(d[h.length+m]);{const b=d[c?2:1],E=d[c?3:2],y=Ca(i),v=Ca(Qu(_e(b,E)));if(a&&y===v){const _=y?hn(i,cn):hn(i,oi);if(h.unshift(C(v?s[0]+(_?Tn:-40):E[0],v?E[1]:s[1]+(_?Tn:-40))),h.unshift(C(y?s[0]+(_?Tn:-40):s[0],y?s[1]:s[1]+(_?Tn:-40))),!c){c=!0;for(const I of f)I.index>1&&(I.index+=1)}}else if(h.unshift(C(v?s[0]:b[0],v?b[1]:s[1])),c){c=!1;for(const _ of f)_.index>1&&(_.index-=1)}h.unshift(s)}{const b=d[d.length-(u?3:2)],E=d[d.length-(u?4:3)],y=Ca(r),v=Ea(E,b);if(l&&y===v){const _=y?hn(r,cn):hn(r,oi);h.push(C(v?o[0]+(_?Tn:-40):E[0],v?E[1]:o[1]+(_?Tn:-40))),h.push(C(y?o[0]+(_?Tn:-40):o[0],y?o[1]:o[1]+(_?Tn:-40))),u||(u=!0)}else h.push(C(v?o[0]:b[0],v?b[1]:o[1])),u&&(u=!1)}return h.push(o),yc(h,f.map(({index:b})=>({index:b,start:h[b-1],end:h[b]})).map(b=>({...b,start:C(b.start[0]-s[0],b.start[1]-s[1]),end:C(b.end[0]-s[0],b.end[1]-s[1])})),c,u)},or=1e6,F9=(e,t,n,i)=>{var E,y,v,_,I,R,w,T,A,S,k,N,D,G,V,H,$,j,X,Y,le,pe,ae,ze,Xe;if(e.points.length<2)return{points:n.points??e.points};(e.x<-1e6||e.x>or||e.y<-1e6||e.y>or||e.x+(((v=(y=n==null?void 0:n.points)==null?void 0:y[((E=n==null?void 0:n.points)==null?void 0:E.length)-1])==null?void 0:v[0])??0)<-1e6||e.x+(((R=(I=n==null?void 0:n.points)==null?void 0:I[((_=n==null?void 0:n.points)==null?void 0:_.length)-1])==null?void 0:R[0])??0)>or||e.y+(((A=(T=n==null?void 0:n.points)==null?void 0:T[((w=n==null?void 0:n.points)==null?void 0:w.length)-1])==null?void 0:A[1])??0)<-1e6||e.y+(((N=(k=n==null?void 0:n.points)==null?void 0:k[((S=n==null?void 0:n.points)==null?void 0:S.length)-1])==null?void 0:N[1])??0)>or||e.x+(((V=(G=e==null?void 0:e.points)==null?void 0:G[((D=e==null?void 0:e.points)==null?void 0:D.length)-1])==null?void 0:V[0])??0)<-1e6||e.x+(((j=($=e==null?void 0:e.points)==null?void 0:$[((H=e==null?void 0:e.points)==null?void 0:H.length)-1])==null?void 0:j[0])??0)>or||e.y+(((le=(Y=e==null?void 0:e.points)==null?void 0:Y[((X=e==null?void 0:e.points)==null?void 0:X.length)-1])==null?void 0:le[1])??0)<-1e6||e.y+(((ze=(ae=e==null?void 0:e.points)==null?void 0:ae[((pe=e==null?void 0:e.points)==null?void 0:pe.length)-1])==null?void 0:ze[1])??0)>or)&&console.error("Elbow arrow (or update) is outside reasonable bounds (> 1e6)",{arrow:e,updates:n}),e.x=He(e.x,-1e6,or),e.y=He(e.y,-1e6,or),n.points&&(n.points=n.points.map(([qe,Ze])=>C(He(qe,-1e6,or),He(Ze,-1e6,or))));const r=n.points?n.points&&n.points.length===2?e.points.map((qe,Ze)=>Ze===0?n.points[0]:Ze===e.points.length-1?n.points[1]:qe):n.points.slice():e.points.slice(),s=typeof n.startBinding<"u"?n.startBinding:e.startBinding,o=typeof n.endBinding<"u"?n.endBinding:e.endBinding,a=s&&_h(s.elementId,t),l=o&&_h(o.elementId,t);if(t.size===0&&_z(r)||(a==null?void 0:a.id)!==(s==null?void 0:s.elementId)||(l==null?void 0:l.id)!==(o==null?void 0:o.elementId))return yc(r.map(qe=>C(e.x+qe[0],e.y+qe[1])),e.fixedSegments,e.startIsSpecial,e.endIsSpecial);const{startHeading:c,endHeading:u,startGlobalPoint:d,endGlobalPoint:f,hoveredStartElement:h,hoveredEndElement:m,...p}=B9({x:e.x,y:e.y,startBinding:s,endBinding:o,startArrowhead:e.startArrowhead,endArrowhead:e.endArrowhead,points:e.points},t,r,a,l,i),b=n.fixedSegments??e.fixedSegments??[];return!n.points&&!n.fixedSegments&&!n.startBinding&&!n.endBinding?ufe(e,t):n.startBinding===e.startBinding&&n.endBinding===e.endBinding&&(n.points??[]).every((qe,Ze)=>Zs(qe,e.points[Ze]??C(1/0,1/0)))?{}:b.length===0?yc(H9(V9(z9(e,{startHeading:c,endHeading:u,startGlobalPoint:d,endGlobalPoint:f,hoveredEndElement:m,...p})??[])),b,null,null):(((Xe=e.fixedSegments)==null?void 0:Xe.length)??0)>b.length?dfe(e,b,t):n.points?n.points&&n.fixedSegments?n:hfe(e,r,b,c,u,d,f,h,m):ffe(e,b,c,u,h,m)},B9=(e,t,n,i,r,s)=>{var w,T;const o=ab(n[0],Ui(e.x,e.y)),a=ab(n[n.length-1],Ui(e.x,e.y));let l=i,c=r;if(s!=null&&s.isDragging){const A=Array.from(t.values());l=XC(o,t,A,s==null?void 0:s.zoom)||i,c=XC(a,t,A,s==null?void 0:s.zoom)||r}const u=$C({...e,points:n},"start",(w=e.startBinding)==null?void 0:w.fixedPoint,o,i,l,s==null?void 0:s.isDragging),d=$C({...e,points:n},"end",(T=e.endBinding)==null?void 0:T.fixedPoint,a,r,c,s==null?void 0:s.isDragging),f=GC(u,d,t,l,o),h=GC(d,u,t,c,a),m=[u[0]-2,u[1]-2,u[0]+2,u[1]+2],p=[d[0]-2,d[1]-2,d[0]+2,d[1]+2],b=l?_o(l,pl(f,e.startArrowhead?Wt*6:Wt*2,1)):m,E=c?_o(c,pl(h,e.endArrowhead?Wt*6:Wt*2,1)):p,y=Eh(u,c?_o(c,pl(h,Tn,Tn)):p)||Eh(d,l?_o(l,pl(f,Tn,Tn)):m),v=vz(y?[m,p]:[b,E]),_=pfe(y?m:b,y?p:E,v,y?pl(f,!l&&!c?0:Tn,0):pl(f,!l&&!c?0:Tn-(e.startArrowhead?Wt*6:Wt*2),Tn),y?pl(h,!l&&!c?0:Tn,0):pl(h,!l&&!c?0:Tn-(e.endArrowhead?Wt*6:Wt*2),Tn),y,l&&_o(l),c&&_o(c)),I=VC(_[0],f,u),R=VC(_[1],h,d);return{dynamicAABBs:_,startDonglePosition:I,startGlobalPoint:u,startHeading:f,endDonglePosition:R,endGlobalPoint:d,endHeading:h,commonBounds:v,hoveredStartElement:l,hoveredEndElement:c,boundsOverlap:y,startElementBounds:b,endElementBounds:E}},z9=(e,t)=>{const{dynamicAABBs:n,startDonglePosition:i,startGlobalPoint:r,startHeading:s,endDonglePosition:o,endGlobalPoint:a,endHeading:l,commonBounds:c,hoveredEndElement:u}=t,d=Ufe(n,i||r,s,o||a,l,c),f=i&&iU(i,d),h=o&&iU(o,d),m=iU(a,d);m&&u&&(m.closed=!0);const p=iU(r,d);p&&e.startBinding&&(p.closed=!0);const b=f&&h&&(Eh(f.pos,n[1])||Eh(h.pos,n[0])),E=gfe(f||p,h||m,d,s||cn,l||cn,b?[]:n);if(E){const y=E.map(v=>[v.pos[0],v.pos[1]]);return f&&y.unshift(r),h&&y.push(a),y}return null},pl=(e,t,n)=>{switch(e){case dr:return[t,n,n,n];case cn:return[n,t,n,n];case oi:return[n,n,t,n]}return[n,n,n,t]},gfe=(e,t,n,i,r,s)=>{const o=z8(e.pos,t.pos),a=new cfe(l=>l.f);for(a.push(e);a.size()>0;){const l=a.pop();if(!l||l.closed)continue;if(l===t)return mfe(e,l);l.closed=!0;const c=yfe(l.addr,n);for(let u=0;u<4;u++){const d=c[u];if(!d||d.closed)continue;const f=ca(d.pos,l.pos,.5);if(kee(...s.map(_=>Eh(f,_))))continue;const h=Efe(u),m=l.parent?Qu(_e(l.pos,l.parent.pos)):i,p=yB(m);if(hn(p,h)||jC(e.addr,d.addr)&&hn(h,i)||jC(t.addr,d.addr)&&hn(h,r))continue;const E=m!==h,y=l.g+z8(d.pos,l.pos)+(E?Math.pow(o,3):0),v=d.visited;if(!v||y<d.g){const _=bfe(d,t,h,r);d.visited=!0,d.parent=l,d.h=z8(t.pos,d.pos)+_*Math.pow(o,2),d.g=y,d.f=d.g+d.h,v?a.rescoreElement(d):a.push(d)}}}return null},mfe=(e,t)=>{let n=t;const i=[];for(;n.parent;)i.unshift(n),n=n.parent;return i.unshift(e),i},z8=(e,t)=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),pfe=(e,t,n,i,r,s,o,a)=>{const l=o??e,c=a??t,[u,d,f,h]=i??[0,0,0,0],[m,p,b,E]=r??[0,0,0,0],y=[e[0]>t[2]?e[1]>t[3]||e[3]<t[1]?Math.min((l[0]+c[2])/2,e[0]-h):(l[0]+c[2])/2:e[0]>t[0]?e[0]-h:n[0]-h,e[1]>t[3]?e[0]>t[2]||e[2]<t[0]?Math.min((l[1]+c[3])/2,e[1]-u):(l[1]+c[3])/2:e[1]>t[1]?e[1]-u:n[1]-u,e[2]<t[0]?e[1]>t[3]||e[3]<t[1]?Math.max((l[2]+c[0])/2,e[2]+d):(l[2]+c[0])/2:e[2]<t[2]?e[2]+d:n[2]+d,e[3]<t[1]?e[0]>t[2]||e[2]<t[0]?Math.max((l[3]+c[1])/2,e[3]+f):(l[3]+c[1])/2:e[3]<t[3]?e[3]+f:n[3]+f],v=[t[0]>e[2]?t[1]>e[3]||t[3]<e[1]?Math.min((c[0]+l[2])/2,t[0]-E):(c[0]+l[2])/2:t[0]>e[0]?t[0]-E:n[0]-E,t[1]>e[3]?t[0]>e[2]||t[2]<e[0]?Math.min((c[1]+l[3])/2,t[1]-m):(c[1]+l[3])/2:t[1]>e[1]?t[1]-m:n[1]-m,t[2]<e[0]?t[1]>e[3]||t[3]<e[1]?Math.max((c[2]+l[0])/2,t[2]+p):(c[2]+l[0])/2:t[2]<e[2]?t[2]+p:n[2]+p,t[3]<e[1]?t[0]>e[2]||t[2]<e[0]?Math.max((c[3]+l[1])/2,t[3]+b):(c[3]+l[1])/2:t[3]<e[3]?t[3]+b:n[3]+b],_=vz([y,v]);if(!s&&y[2]-y[0]+v[2]-v[0]>_[2]-_[0]+1e-11&&y[3]-y[1]+v[3]-v[1]>_[3]-_[1]+1e-11){const[I,R]=[(v[0]+v[2])/2,(v[1]+v[3])/2];if(t[0]>e[2]&&e[1]>t[3]){const w=y[2]+(v[0]-y[2])/2,T=v[3]+(y[1]-v[3])/2;return $n(Ui(e[2]-I,e[1]-R),Ui(e[0]-I,e[3]-R))>0?[[y[0],y[1],w,y[3]],[w,v[1],v[2],v[3]]]:[[y[0],T,y[2],y[3]],[v[0],v[1],v[2],T]]}else if(e[2]<t[0]&&e[3]<t[1]){const w=y[2]+(v[0]-y[2])/2,T=y[3]+(v[1]-y[3])/2;return $n(Ui(e[0]-I,e[1]-R),Ui(e[2]-I,e[3]-R))>0?[[y[0],y[1],y[2],T],[v[0],T,v[2],v[3]]]:[[y[0],y[1],w,y[3]],[w,v[1],v[2],v[3]]]}else if(e[0]>t[2]&&e[3]<t[1]){const w=v[2]+(y[0]-v[2])/2,T=y[3]+(v[1]-y[3])/2;return $n(Ui(e[2]-I,e[1]-R),Ui(e[0]-I,e[3]-R))>0?[[w,y[1],y[2],y[3]],[v[0],v[1],w,v[3]]]:[[y[0],y[1],y[2],T],[v[0],T,v[2],v[3]]]}else if(e[0]>t[2]&&e[1]>t[3]){const w=v[2]+(y[0]-v[2])/2,T=v[3]+(y[1]-v[3])/2;return $n(Ui(e[0]-I,e[1]-R),Ui(e[2]-I,e[3]-R))>0?[[w,y[1],y[2],y[3]],[v[0],v[1],w,v[3]]]:[[y[0],T,y[2],y[3]],[v[0],v[1],v[2],T]]}}return[y,v]},Ufe=(e,t,n,i,r,s)=>{const o=new Set,a=new Set;n===ur||n===cn?a.add(t[1]):o.add(t[0]),r===ur||r===cn?a.add(i[1]):o.add(i[0]),e.forEach(u=>{o.add(u[0]),o.add(u[2]),a.add(u[1]),a.add(u[3])}),o.add(s[0]),o.add(s[2]),a.add(s[1]),a.add(s[3]);const l=Array.from(a).sort((u,d)=>u-d),c=Array.from(o).sort((u,d)=>u-d);return{row:l.length,col:c.length,data:l.flatMap((u,d)=>c.map((f,h)=>({f:0,g:0,h:0,closed:!1,visited:!1,parent:null,addr:[h,d],pos:[f,u]})))}},VC=(e,t,n)=>{switch(t){case dr:return C(n[0],e[1]);case cn:return C(e[2],n[1]);case oi:return C(n[0],e[3])}return C(e[0],n[1])},bfe=(e,t,n,i)=>{if(i===cn)switch(n){case cn:return e.pos[0]>=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2;case dr:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case oi:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case ur:return e.pos[1]===t.pos[1]?4:2}else if(i===ur)switch(n){case cn:return e.pos[1]===t.pos[1]?4:2;case dr:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3;case oi:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3;case ur:return e.pos[0]<=t.pos[0]?4:e.pos[1]===t.pos[1]?0:2}else if(i===dr)switch(n){case cn:return e.pos[1]>t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case dr:return e.pos[1]>=t.pos[1]?4:e.pos[0]===t.pos[0]?0:2;case oi:return e.pos[0]===t.pos[0]?4:2;case ur:return e.pos[1]>t.pos[1]&&e.pos[0]>t.pos[0]?1:3}else if(i===oi)switch(n){case cn:return e.pos[1]<t.pos[1]&&e.pos[0]<t.pos[0]?1:3;case dr:return e.pos[0]===t.pos[0]?4:2;case oi:return e.pos[1]<=t.pos[1]?4:e.pos[0]===t.pos[0]?0:2;case ur:return e.pos[1]<t.pos[1]&&e.pos[0]>t.pos[0]?1:3}return 0},yfe=([e,t],n)=>[hg([e,t-1],n),hg([e+1,t],n),hg([e,t+1],n),hg([e-1,t],n)],hg=([e,t],n)=>e<0||e>=n.col||t<0||t>=n.row?null:n.data[t*n.col+e]??null,iU=(e,t)=>{for(let n=0;n<t.col;n++)for(let i=0;i<t.row;i++){const r=hg([n,i],t);if(r&&e[0]===r.pos[0]&&e[1]===r.pos[1])return r}return null},vz=e=>[Math.min(...e.map(t=>t[0])),Math.min(...e.map(t=>t[1])),Math.max(...e.map(t=>t[2])),Math.max(...e.map(t=>t[3]))],_h=(e,t)=>{const n=t.get(e);return n&&qs(n)?n:null},yc=(e,t,n,i)=>{const r=e[0][0],s=e[0][1];let o=e.map(a=>ab(a,fn(_e(e[0]),-1)));return(r<-1e6||r>or||s<-1e6||s>or||r+o[o.length-1][0]<-1e6||s+o[o.length-1][0]>or||r+o[o.length-1][1]<-1e6||s+o[o.length-1][1]>or)&&console.error("Elbow arrow normalization is outside reasonable bounds (> 1e6)",{x:r,y:s,points:o,...vh(o)}),o=o.map(([a,l])=>C(He(a,-1e6,1e6),He(l,-1e6,1e6))),{points:o,x:He(r,-1e6,1e6),y:He(s,-1e6,1e6),fixedSegments:((t==null?void 0:t.length)??0)>0?t:null,...vh(o),startIsSpecial:n,endIsSpecial:i}},H9=e=>{if(e.length>1){let t=Math.abs(e[0][1]-e[1][1])<Math.abs(e[0][0]-e[1][0]);return e.filter((n,i)=>{if(i===0||i===e.length-1)return!0;const r=e[i+1],s=Math.abs(n[1]-r[1])<Math.abs(n[0]-r[0]);return t===s?(t=s,!1):(t=s,!0)})}return e},V9=e=>e.length>=4?e.filter((t,n)=>{if(n===0||n===e.length-1)return!0;const i=e[n-1];return pt(i,t)>P9}):e,Efe=e=>{switch(e){case 0:return dr;case 1:return cn;case 2:return oi}return ur},$C=(e,t,n,i,r,s,o)=>{if(o){if(s){const a=H0(e,s,t);return ece(s,a)}return i}if(r){const a=fE(n||[0,0],r);return Math.abs(Z6(r,a)-Wt)>.01?H0(e,r,t):a}return i},GC=(e,t,n,i,r)=>Zle(e,t,i,i&&_o(i,Array(4).fill(Z6(i,e))),n,r),XC=(e,t,n,i)=>zs(Ps(e),n,t,i,!0,!0),jC=(e,t)=>e[0]===t[0]&&e[1]===t[1],_z=(e,t=P9)=>e.slice(1).map((n,i)=>Math.abs(n[0]-e[i][0])<t||Math.abs(n[1]-e[i][1])<t).every(Boolean),vfe={selection:!0,text:!0,rectangle:!0,diamond:!0,ellipse:!0,line:!0,image:!0,arrow:!0,freedraw:!0,eraser:!1,custom:!0,frame:!0,embeddable:!0,hand:!0,laser:!1,magicframe:!1},_fe=e=>Object.keys(At).includes(e)?At[e]:Oc,Zd=(e,t)=>{if(!t)return null;const n=t.focus||0;return ge(e)?db(t)?{...t,focus:n,fixedPoint:Q6(t.fixedPoint??[0,0])}:null:{...t,focus:n}},Ul=(e,t)=>{const n={type:t.type||e.type,version:e.version||1,versionNonce:e.versionNonce??0,index:e.index??null,isDeleted:e.isDeleted??!1,id:e.id||bs(),fillStyle:e.fillStyle||ln.fillStyle,strokeWidth:e.strokeWidth||ln.strokeWidth,strokeStyle:e.strokeStyle??ln.strokeStyle,roughness:e.roughness??ln.roughness,opacity:e.opacity==null?ln.opacity:e.opacity,angle:e.angle||0,x:t.x??e.x??0,y:t.y??e.y??0,strokeColor:e.strokeColor||ln.strokeColor,backgroundColor:e.backgroundColor||ln.backgroundColor,width:e.width||0,height:e.height||0,seed:e.seed??1,groupIds:e.groupIds??[],frameId:e.frameId??null,roundness:e.roundness?e.roundness:e.strokeSharpness==="round"?{type:e1(e.type)?On.LEGACY:On.PROPORTIONAL_RADIUS}:null,boundElements:e.boundElementIds?e.boundElementIds.map(i=>({type:"arrow",id:i})):e.boundElements??[],updated:e.updated??Jh(),link:e.link?Or(e.link):null,locked:e.locked??!1};return("customData"in e||"customData"in t)&&(n.customData="customData"in t?t.customData:e.customData),{...e,...n,...IH(n),...t}},wfe=e=>{switch(e={...e},e.type){case"text":delete e.rawText;let t=e.fontSize,n=e.fontFamily;if("font"in e){const[u,d]=e.font.split(" ");t=parseFloat(u),n=_fe(d)}const i=typeof e.text=="string"&&e.text||"",r=e.lineHeight||(e.height?$ee(e):qu(e.fontFamily));return e=Ul(e,{fontSize:t,fontFamily:n,text:i,textAlign:e.textAlign||Dm,verticalAlign:e.verticalAlign||K2,containerId:e.containerId??null,originalText:e.originalText||i,autoResize:e.autoResize??!0,lineHeight:r}),!i&&!e.isDeleted&&(e={...e,originalText:i,isDeleted:!0},e=y5(e)),e;case"freedraw":return Ul(e,{points:e.points,lastCommittedPoint:null,simulatePressure:e.simulatePressure,pressures:e.pressures});case"image":return Ul(e,{status:e.status||"pending",fileId:e.fileId,scale:e.scale||[1,1],crop:e.crop??null});case"line":case"draw":const{startArrowhead:s=null,endArrowhead:o=null}=e;let a=e.x,l=e.y,c=!Array.isArray(e.points)||e.points.length<2?[C(0,0),C(e.width,e.height)]:e.points;return(c[0][0]!==0||c[0][1]!==0)&&({points:c,x:a,y:l}=ue.getNormalizedPoints(e)),Ul(e,{type:e.type==="draw"?"line":e.type,startBinding:Zd(e,e.startBinding),endBinding:Zd(e,e.endBinding),lastCommittedPoint:null,startArrowhead:s,endArrowhead:o,points:c,x:a,y:l,...vh(c)});case"arrow":{const{startArrowhead:u=null,endArrowhead:d="arrow"}=e;let f=e.x,h=e.y,m=!Array.isArray(e.points)||e.points.length<2?[C(0,0),C(e.width,e.height)]:e.points;(m[0][0]!==0||m[0][1]!==0)&&({points:m,x:f,y:h}=ue.getNormalizedPoints(e));const p={type:e.type,startBinding:Zd(e,e.startBinding),endBinding:Zd(e,e.endBinding),lastCommittedPoint:null,startArrowhead:u,endArrowhead:d,points:m,x:f,y:h,elbowed:e.elbowed,...vh(m)};return ge(e)?Ul(e,{...p,elbowed:!0,startBinding:Zd(e,e.startBinding),endBinding:Zd(e,e.endBinding),fixedSegments:e.fixedSegments,startIsSpecial:e.startIsSpecial,endIsSpecial:e.endIsSpecial}):Ul(e,p)}case"ellipse":case"rectangle":case"diamond":case"iframe":case"embeddable":return Ul(e,{});case"magicframe":case"frame":return Ul(e,{name:e.name??null})}return null},Tfe=(e,t)=>{if(e.boundElements){const n=e.boundElements.slice(),i=new Set;e.boundElements=n.reduce((r,s)=>{const o=t.get(s.id);if(o&&!i.has(s.id)){if(i.add(s.id),o.isDeleted)return r;r.push(s),de(o)&&!o.containerId&&(o.containerId=e.id)}return r},[])}},Sfe=(e,t)=>{const n=e.containerId?t.get(e.containerId):null;if(!n){e.containerId=null;return}if(!e.isDeleted&&n.boundElements&&!n.boundElements.find(i=>i.id===e.id)){const i=(n.boundElements||(n.boundElements=[])).slice();i.push({type:"text",id:e.id}),n.boundElements=i}},Ife=(e,t)=>{e.frameId&&(t.get(e.frameId)||(e.frameId=null))},id=(e,t,n)=>{const i=new Set,r=t?Se(t):null,s=Za((e||[]).reduce((a,l)=>{if(l.type!=="selection"&&!od(l)){let c=wfe(l);if(c){const u=r==null?void 0:r.get(l.id);u&&u.version>c.version&&(c=y5(c,u.version)),i.has(c.id)&&(c={...c,id:bs()}),i.add(c.id),a.push(c)}}return a},[]));if(!(n!=null&&n.repairBindings))return s;const o=Se(s);for(const a of s)a.frameId&&Ife(a,o),de(a)&&a.containerId?Sfe(a,o):a.boundElements&&Tfe(a,o),n.refreshDimensions&&de(a)&&Object.assign(a,nB(a,ui(a,o),o)),ke(a)&&(a.startBinding&&(!o.has(a.startBinding.elementId)||!Be(a))&&(a.startBinding=null),a.endBinding&&(!o.has(a.endBinding.elementId)||!Be(a))&&(a.endBinding=null));return s.map(a=>{if(ge(a)&&a.startBinding==null&&a.endBinding==null&&!_z(a.points))return{...a,...F9(a,o,{points:[C(0,0),a.points[a.points.length-1]]}),index:a.index};if(ge(a)&&a.startBinding&&a.endBinding&&a.startBinding.elementId===a.endBinding.elementId&&a.points.length>1&&a.points.some(([l,c])=>Math.abs(l)>1e6||Math.abs(c)>1e6)){console.error("Fixing self-bound elbow arrow",a.id);const l=o.get(a.startBinding.elementId);return l?{...a,x:l.x+l.width/2,y:l.y-5,width:l.width,height:l.height,points:[C(0,0),C(0,-10),C(l.width/2+5,-10),C(l.width/2+5,l.height/2+5)]}:(console.error("Bound element not found",a.startBinding.elementId),a)}return a})},xfe=(e,t,n)=>{const i=t[e];return i!==void 0?i:n[e]},YC={isSidebarDocked:(e,t)=>["defaultSidebarDockedPreference",e.isSidebarDocked??xfe("defaultSidebarDockedPreference",e,t)]},wz=(e,t)=>{var r;e=e||{};const n=gs(),i={};for(const s of Object.keys(YC))if(s in e){const[o,a]=YC[s](e,n);i[o]=a}for(const[s,o]of Object.entries(n)){const a=e[s],l=t?t[s]:void 0;i[s]=a!==void 0?a:l!==void 0?l:o}return{...i,cursorButton:(t==null?void 0:t.cursorButton)||"up",penDetected:(t==null?void 0:t.penDetected)??(e.penMode?e.penDetected??!1:!1),activeTool:{...Sn(n,i.activeTool.type&&vfe[i.activeTool.type]?i.activeTool:{type:"selection"}),lastActiveTool:null,locked:i.activeTool.locked??!1},zoom:{value:Aa($g(e.zoom)?e.zoom:((r=e.zoom)==null?void 0:r.value)??n.zoom.value)},openSidebar:typeof e.openSidebar=="string"?{name:ls.name}:i.openSidebar,gridSize:ige($g(e.gridSize)?e.gridSize:q2),gridStep:FH($g(e.gridStep)?e.gridStep:FO),editingFrame:null}},rd=(e,t,n,i)=>({elements:id(e==null?void 0:e.elements,n,i),appState:wz(e==null?void 0:e.appState,t||null),files:(e==null?void 0:e.files)||{}}),WC=e=>{const t=id(Nt(e.elements),null);return t.length?{...e,elements:t}:null},o5=(e=[],t)=>{const n=[];for(const i of e)if(Array.isArray(i)){const r=WC({status:t,elements:i,id:bs(),created:Date.now()});r&&n.push(r)}else{const r=i,s=WC({...r,id:r.id||bs(),status:r.status||t,created:r.created||Date.now()});s&&n.push(s)}return n},Tz=async e=>{let t;if(e.type===ye.png)try{return await(await be(()=>Promise.resolve().then(()=>Kz),void 0)).decodePngMetadata(e)}catch(n){throw n.message==="INVALID"?new Uu("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Uu("Error: cannot restore image")}else if("text"in Blob?t=await e.text():t=await new Promise(n=>{const i=new FileReader;i.readAsText(e,"utf8"),i.onloadend=()=>{i.readyState===FileReader.DONE&&n(i.result)}}),e.type===ye.svg)try{return Yfe({svg:t})}catch(n){throw n.message==="INVALID"?new Uu("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):new Uu("Error: cannot restore image")}return t},Sz=e=>{var t;return e&&((t=e.name.match(/\.(json|excalidraw|png|svg)$/))==null?void 0:t[1])||null},Cfe=e=>e==="png"||e==="svg",$9=e=>{const t=Sz(e);return t==="png"||t==="svg"},Iz=e=>!!e&&Object.values(gh).includes(e),Fu=e=>{const{type:t}=e||{};return Iz(t)},xz=async(e,t,n,i)=>{const r=await Tz(e);let s;try{try{s=JSON.parse(r)}catch(o){throw Fu(e)?new Uu("Image doesn't contain scene","IMAGE_NOT_CONTAINS_SCENE_DATA"):o}if(Bfe(s))return{type:ye.excalidraw,data:rd({elements:LH(s.elements||[]),appState:{theme:t==null?void 0:t.theme,fileHandle:i||e.handle||null,...XO(s.appState||{}),...t?im(s.elements||[],t):{}},files:s.files},t,n,{repairBindings:!0,refreshDimensions:!1})};if(Mz(s))return{type:ye.excalidrawlib,data:s};throw new Error("Error: invalid file")}catch(o){throw o instanceof Uu?o:new Error("Error: invalid file")}},G9=async(e,t,n,i)=>{const r=await xz(e,t,n,i);if(r.type!==ye.excalidraw)throw new Error("Error: invalid file");return r.data},Cz=(e,t="unpublished")=>{const n=JSON.parse(e);if(!Mz(n))throw new Error("Invalid library");const i=n.libraryItems||n.library;return o5(i,t)},Afe=async(e,t="unpublished")=>Cz(await Tz(e),t),Q0=async e=>new Promise(async(t,n)=>{try{zm(e)&&(e=await e),e.toBlob(i=>{if(!i)return n(new zee("Error: Canvas too big","CANVAS_POSSIBLY_TOO_BIG"));t(i)})}catch(i){n(i)}}),Mfe=async e=>{try{const t=await window.crypto.subtle.digest("SHA-1",await Vl(e));return oF(new Uint8Array(t))}catch(t){return console.error(t),i9(40)}},yE=async e=>new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const r=i.result;t(r)},i.onerror=r=>n(r),i.readAsDataURL(e)}),Rfe=(e,t)=>`data:${t};base64,${gz(xb(e),!0)}`,kfe=(e,t="")=>{const n=e.indexOf(","),i=atob(e.slice(n+1)),r=e.slice(0,n).split(":")[1].split(";")[0],s=new ArrayBuffer(i.length),o=new Uint8Array(s);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return new File([s],t,{type:r})},Lfe=e=>mz(e.slice(e.indexOf(",")+1)),EE=async(e,t)=>{if(e.type===ye.svg)return e;const[n,i]=await Promise.all([be(()=>import("./pica-BExwbD6t.js").then(s=>s.p),__vite__mapDeps([])).then(s=>s.default),be(()=>import("./image-blob-reduce.esm-B6b2_-a4.js"),__vite__mapDeps([])).then(s=>s.default)]),r=i({pica:n({features:["js","wasm"]})});if(t.outputType){const{outputType:s}=t;r._create_blob=function(o){return this.pica.toBlob(o.out_canvas,s,.8).then(a=>(o.out_blob=a,o))}}if(!Fu(e))throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"});return new File([await r.toBlob(e,{max:t.maxWidthOrHeight,alpha:!0})],e.name,{type:t.outputType||e.type})},KC=(e,t="")=>new File([new TextEncoder().encode(e)],t,{type:ye.svg}),Dfe=async(e,t="")=>{let n;try{n=await fetch(e)}catch{throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"})}if(!n.ok)throw new Error("Error: failed to fetch image",{cause:"FETCH_ERROR"});const i=await n.blob();if(i.type&&Fu(i)){const r=t||i.name||"";return new File([i],r,{type:i.type})}throw new Error("Error: unsupported file type",{cause:"UNSUPPORTED"})},Nfe=async e=>{const t=e.dataTransfer.files.item(0),n=await Ofe(e);return{file:t?await X9(t):null,fileHandle:n}},Ofe=async e=>{if(Ad)try{return await e.dataTransfer.items[0].getAsFileSystemHandle()||null}catch(t){return console.warn(t.name,t.message),null}return null},ZC=e=>{let t=null;const n=`${[...new Uint8Array(e).slice(0,8)].join(" ")} `,i={png:"137 80 78 71 13 10 26 10 ",jpg:"255 216 255 ",gif:"71 73 70 56 57 97 "};return n===i.png?t=ye.png:n.startsWith(i.jpg)?t=ye.jpg:n.startsWith(i.gif)&&(t=ye.gif),t},gg=(e,t,n)=>new File([e],n||"",{type:t}),X9=async e=>{var t,n;if(e.type){if(Fu(e)){const i=await Vl(e),r=ZC(i);r&&r!==e.type&&(e=gg(i,r,e.name))}}else if((t=e==null?void 0:e.name)!=null&&t.endsWith(".excalidrawlib"))e=gg(await Vl(e),ye.excalidrawlib,e.name);else if((n=e==null?void 0:e.name)!=null&&n.endsWith(".excalidraw"))e=gg(await Vl(e),ye.excalidraw,e.name);else{const i=await Vl(e),r=ZC(i);r&&(e=gg(i,r,e.name))}return e},Vl=e=>"arrayBuffer"in e?e.arrayBuffer():new Promise((t,n)=>{const i=new FileReader;i.onload=r=>{var s;if(!((s=r.target)!=null&&s.result))return n(new Error("Couldn't convert blob to ArrayBuffer"));t(r.target.result)},i.readAsArrayBuffer(e)}),Pfe=(e,t)=>{const n={};for(const i of e)!i.isDeleted&&"fileId"in i&&i.fileId&&t[i.fileId]&&(n[i.fileId]=t[i.fileId]);return n},i1=(e,t,n,i)=>{const r={type:as.excalidraw,version:F6.excalidraw,source:jv,elements:i==="local"?LH(e):ege(e),appState:i==="local"?XO(t):BQ(t),files:i==="local"?Pfe(e,n):void 0};return JSON.stringify(r,null,2)},Az=async(e,t,n,i=t.name||VO)=>{const r=i1(e,t,n,"local"),s=new Blob([r],{type:ye.excalidraw});return{fileHandle:await wb(s,{name:i,extension:"excalidraw",description:"Excalidraw file",fileHandle:$9(t.fileHandle)?null:t.fileHandle})}},Ffe=async(e,t)=>{const n=await R9({description:"Excalidraw files"});return G9(await X9(n),e,t,n.handle)},Bfe=e=>(e==null?void 0:e.type)===as.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),Mz=e=>typeof e=="object"&&e&&e.type===as.excalidrawLibrary&&(e.version===1||e.version===2),Rz=e=>{const t={type:as.excalidrawLibrary,version:F6.excalidrawLibrary,source:jv,libraryItems:e};return JSON.stringify(t,null,2)},zfe=async e=>{const t=Rz(e);await wb(new Blob([t],{type:ye.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})},kz=e=>new Promise((t,n)=>{const i=new Image;i.onload=()=>{t(i)},i.onerror=r=>{n(r)},i.src=e}),Lz=async({fileIds:e,files:t,imageCache:n})=>{const i=new Map,r=new Map;return await Promise.all(e.reduce((s,o)=>{const a=t[o];return a&&!i.has(o)?(i.set(o,!0),s.concat((async()=>{try{if(a.mimeType===ye.binary)throw new Error("Only images can be added to ImageCache");const l=kz(a.dataURL),c={image:l,mimeType:a.mimeType};n.set(o,c);const u=await l;n.set(o,{...c,image:u})}catch{r.set(o,!0)}})())):s},[])),{imageCache:n,updatedFiles:i,erroredFiles:r}},Dz=e=>e.filter(t=>xn(t)),Hfe=e=>(e==null?void 0:e.nodeName.toLowerCase())==="svg",qC=e=>{const t=new DOMParser().parseFromString(e,ye.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!Hfe(n))throw new Error("Invalid SVG");{n.hasAttribute("xmlns")||n.setAttribute("xmlns",lt);let r=n.getAttribute("width"),s=n.getAttribute("height");(r!=null&&r.includes("%")||r==="auto")&&(r=null),(s!=null&&s.includes("%")||s==="auto")&&(s=null);const o=n.getAttribute("viewBox");if(!r||!s){if(r=r||"50",s=s||"50",o){const a=o.match(/\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/);a&&([,r,s]=a)}n.setAttribute("width",r),n.setAttribute("height",s)}return o||n.setAttribute("viewBox",`0 0 ${r} ${s}`),n.outerHTML}},Nz=document.createElement("img");Nz.src=`data:${ye.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`;const Oz=document.createElement("img");Oz.src=`data:${ye.svg}, ${encodeURIComponent('<svg  xmlns="http://www.w3.org/2000/svg"  width="16"  height="16"  viewBox="0 0 24 24"  fill="none"  stroke="#1971c2"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-arrow-big-right-line"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 9v-3.586a1 1 0 0 1 1.707 -.707l6.586 6.586a1 1 0 0 1 0 1.414l-6.586 6.586a1 1 0 0 1 -1.707 -.707v-3.586h-6v-6h6z" /><path d="M3 9v6" /></svg>')}`;const j9=([e,t,n,i],r,s)=>{const o=jhe,a=o/s.zoom.value,l=o/s.zoom.value,c=o/s.zoom.value,u=(e+n)/2,d=(t+i)/2,f=(o-8)/(2*s.zoom.value),h=4/s.zoom.value,m=n+h-f,p=t-h-c+f,[b,E]=q(C(m+a/2,p+l/2),C(u,d),r);return[b-a/2,E-l/2,a,l]},Pz=(e,t,n,[i,r])=>{const s=4/n.zoom.value,[o,a,l,c]=De(e,t),[u,d,f,h]=j9([o,a,l,c],e.angle,n);return i>u-s&&i<u+s+f&&r>d-s&&r<d+h+s},H8=(e,t,n,[i,r],s)=>!e.link||n.selectedElementIds[e.id]?!1:!s&&n.viewModeEnabled&&x9(i,r,e,t)?!0:Pz(e,t,n,C(i,r)),a5=(e,t,n,i,r=!0)=>{e.beginPath(),e.arc(t,n,i,0,Math.PI*2),e.fill(),r&&e.stroke()},l5=(e,t)=>[e.width/t,e.height/t],c5=({canvas:e,scale:t,normalizedWidth:n,normalizedHeight:i,theme:r,isExporting:s,viewBackgroundColor:o})=>{const a=e.getContext("2d");return a.setTransform(1,0,0,1,0,0),a.scale(t,t),s&&r===xe.DARK&&(a.filter=Kv),typeof o=="string"?((o==="transparent"||o.length===5||o.length===9||/(hsla|rgba)\(/.test(o))&&a.clearRect(0,0,n,i),a.save(),a.fillStyle=o,a.fillRect(0,0,n,i),a.restore()):a.clearRect(0,0,n,i),a},Fz=(e,t)=>{const n=window.location.href;try{const i=new URL(n);return i.searchParams.set(J2,e),Or(i.toString())}catch(i){console.error(i)}return Or(n)},Bz=(e,t)=>{if(e.length>0&&Mb(e)){if(e.length===1)return{id:e[0].id,type:"element"};if(e.length>1){const n=Object.keys(t.selectedGroupIds)[0];return n?{id:n,type:"group"}:{id:e[0].groupIds[0],type:"group"}}}return null},Mb=e=>!!(e.length===1||e.length>1&&xF(e)),Zf=e=>{try{const t=new URL(e);return t.searchParams.has(J2)&&t.host===window.location.host}catch{return!1}},Vfe=e=>{try{const{searchParams:t}=new URL(e);if(t.has(J2))return t.get(J2)}catch{}return null},rU={Bold:"#dddddd",Regular:"#e5e5e5"},$fe=(e,t,n,i,r,s,o,a)=>{const l=i%t-t,c=r%t-t,u=t*s.value,d=1/s.value;e.save(),s.value===1&&e.translate(l%1?0:.5,c%1?0:.5);for(let f=l;f<l+o+t*2;f+=t){const h=n>1&&Math.round(f-i)%(n*t)===0;if(!h&&u<10)continue;const m=Math.min(1/s.value,h?4:1);e.lineWidth=m;const p=[m*3,d+(m+d)];e.beginPath(),e.setLineDash(h?[]:p),e.strokeStyle=h?rU.Bold:rU.Regular,e.moveTo(f,c-t),e.lineTo(f,Math.ceil(c+a+t*2)),e.stroke()}for(let f=c;f<c+a+t*2;f+=t){const h=n>1&&Math.round(f-r)%(n*t)===0;if(!h&&u<10)continue;const m=Math.min(1/s.value,h?4:1);e.lineWidth=m;const p=[m*3,d+(m+d)];e.beginPath(),e.setLineDash(h?[]:p),e.strokeStyle=h?rU.Bold:rU.Regular,e.moveTo(l-t,f),e.lineTo(Math.ceil(l+o+t*2),f),e.stroke()}e.restore()},QC=(e,t,n,i)=>{t.translate(e.x+i.scrollX,e.y+i.scrollY),t.beginPath(),t.roundRect?t.roundRect(0,0,e.width,e.height,tn.radius/i.zoom.value):t.rect(0,0,e.width,e.height),t.clip(),t.translate(-(e.x+i.scrollX),-(e.y+i.scrollY))},JC={regularLink:null,elementLink:null},eA=(e,t,n,i)=>{if(e.link&&!n.selectedElementIds[e.id]){const[r,s,o,a]=De(e,i),[l,c,u,d]=j9([r,s,o,a],e.angle,n),f=l+u/2,h=c+d/2;t.save(),t.translate(n.scrollX+f,n.scrollY+h),t.rotate(e.angle);const m=Zf(e.link)?"elementLink":"regularLink";let p=JC[m];if(!p||p.zoom!==n.zoom.value){p=Object.assign(document.createElement("canvas"),{zoom:n.zoom.value}),p.width=u*window.devicePixelRatio*n.zoom.value,p.height=d*window.devicePixelRatio*n.zoom.value,JC[m]=p;const b=p.getContext("2d");b.scale(window.devicePixelRatio*n.zoom.value,window.devicePixelRatio*n.zoom.value),b.fillStyle="#fff",b.fillRect(0,0,u,d),m==="elementLink"?b.drawImage(Oz,0,0,u,d):b.drawImage(Nz,0,0,u,d),b.restore()}t.drawImage(p,l-f,c-h,u,d),t.restore()}},zz=({canvas:e,rc:t,elementsMap:n,allElementsMap:i,visibleElements:r,scale:s,appState:o,renderConfig:a})=>{var p;if(e===null)return;const{renderGrid:l=!0,isExporting:c}=a,[u,d]=l5(e,s),f=c5({canvas:e,scale:s,normalizedWidth:u,normalizedHeight:d,theme:o.theme,isExporting:c,viewBackgroundColor:o.viewBackgroundColor});f.scale(o.zoom.value,o.zoom.value),l&&$fe(f,o.gridSize,o.gridStep,o.scrollX,o.scrollY,o.zoom,u/o.zoom.value,d/o.zoom.value);const h=new Set;r.forEach(b=>{b.groupIds.length>0&&o.frameToHighlight&&o.selectedElementIds[b.id]&&(Ec(b,o.frameToHighlight,n)||b.groupIds.find(E=>h.has(E)))&&b.groupIds.forEach(E=>h.add(E))});const m=new Map;r.filter(b=>!ts(b)).forEach(b=>{var E;try{const y=b.frameId||((E=o.frameToHighlight)==null?void 0:E.id);if(de(b)&&b.containerId&&n.has(b.containerId))return;if(f.save(),y&&o.frameRendering.enabled&&o.frameRendering.clip){const _=vE(b,n,o);_&&aA(b,_,o,n,m)&&QC(_,f,a,o),iu(b,n,i,t,f,a,o)}else iu(b,n,i,t,f,a,o);const v=Oe(b,n);v&&iu(v,n,i,t,f,a,o),f.restore(),c||eA(b,f,o,n)}catch(y){console.error(y,b.id,b.x,b.y,b.width,b.height)}}),r.filter(b=>ts(b)).forEach(b=>{var E;try{const y=()=>{if(iu(b,n,i,t,f,a,o),ts(b)&&(c||lr(b)&&a.embedsValidationStatus.get(b.id)!==!0)&&b.width&&b.height){const _=CB(b);iu(_,n,i,t,f,a,o)}c||eA(b,f,o,n)};if((b.frameId||((E=o.frameToHighlight)==null?void 0:E.id))&&o.frameRendering.enabled&&o.frameRendering.clip){f.save();const _=vE(b,n,o);_&&aA(b,_,o,n,m)&&QC(_,f,a,o),y(),f.restore()}else y()}catch(y){console.error(y)}}),(p=a.pendingFlowchartNodes)==null||p.forEach(b=>{try{iu(b,n,i,t,f,a,o)}catch(E){console.error(E)}})},Hz=Qh(e=>{zz(e)},{trailing:!0}),Vz=(e,t)=>{if(t){Hz(e);return}zz(e)},Gfe=(e,t)=>{if(e.width<=t)return e;const i=document.createElement("canvas").getContext("2d");i.font=xt({fontFamily:e.fontFamily,fontSize:e.fontSize});let r=e.text;if(i.measureText(r).width>t)for(let o=r.length;o>0;o--){const a=`${r.slice(0,o)}...`;if(i.measureText(a).width<=t){r=a;break}}return Ce(e,{text:r,width:t})},Xfe=(e,t)=>{const n=[];for(const i of e){if(Ie(i)){let r=Br({x:i.x,y:i.y-tn.nameOffsetY,fontFamily:At.Helvetica,fontSize:tn.nameFontSize,lineHeight:tn.nameLineHeight,strokeColor:t.exportWithDarkMode?tn.nameColorDarkTheme:tn.nameColorLightTheme,text:oH(i)});r.y-=r.height,r=Gfe(r,i.width),n.push(r)}n.push(i)}return n},$z=(e,t)=>(t=t||gs().frameRendering,{enabled:e?!0:t.enabled,outline:e?!1:t.outline,name:e?!1:t.name,clip:e?!0:t.clip}),Gz=({elements:e,exportingFrame:t,frameRendering:n,exportWithDarkMode:i})=>{let r;return t?r=n_(e,t):n.enabled&&n.name?r=Xfe(e,{exportWithDarkMode:i}):r=e,r},Xz=async(e,t,n,{exportBackground:i,exportPadding:r=qh,viewBackgroundColor:s,exportingFrame:o},a=(c,u)=>{const d=document.createElement("canvas");return d.width=c*t.exportScale,d.height=u*t.exportScale,{canvas:d,scale:t.exportScale}},l=async()=>{await Vs.loadElementsFonts(e)})=>{await l();const c=$z(o??null,t.frameRendering??null);o&&(c.clip=!1);const u=Gz({elements:e,exportingFrame:o,exportWithDarkMode:t.exportWithDarkMode,frameRendering:c});o&&(r=0);const[d,f,h,m]=W9(o?[o]:t_(u),r),{canvas:p,scale:b=1}=a(h,m),E=gs(),{imageCache:y}=await Lz({imageCache:new Map,fileIds:Dz(u).map(v=>v.fileId),files:n});return Vz({canvas:p,rc:Pc.canvas(p),elementsMap:ms(Se(u)),allElementsMap:ms(Se(Za(e))),visibleElements:u,scale:b,appState:{...t,frameRendering:c,viewBackgroundColor:i?s:null,scrollX:-d+r,scrollY:-f+r,zoom:E.zoom,shouldCacheIgnoreZoom:!1,theme:t.exportWithDarkMode?xe.DARK:xe.LIGHT},renderConfig:{canvasBackgroundColor:s,imageCache:y,renderGrid:!1,isExporting:!0,embedsValidationStatus:new Map,elementsPendingErasure:new Set,pendingFlowchartNodes:null}}),p},mg=e=>document.createComment(` ${e} `),Y9=async(e,t,n,i)=>{const r=$z((i==null?void 0:i.exportingFrame)??null,t.frameRendering??null);let{exportPadding:s=qh,exportWithDarkMode:o=!1,viewBackgroundColor:a,exportScale:l=1,exportEmbedScene:c}=t;const{exportingFrame:u=null}=i||{},d=Gz({elements:e,exportingFrame:u,exportWithDarkMode:o,frameRendering:r});u&&(s=0);const[f,h,m,p]=W9(u?[u]:t_(d),s),b=-f+s,E=-h+s,y=document.createElementNS(lt,"svg");y.setAttribute("version","1.1"),y.setAttribute("xmlns",lt),y.setAttribute("viewBox",`0 0 ${m} ${p}`),y.setAttribute("width",`${m*l}`),y.setAttribute("height",`${p*l}`),o&&y.setAttribute("filter",Kv);const v=y.ownerDocument.createElementNS(lt,"defs"),_=y.ownerDocument.createElementNS(lt,"metadata");if(y.appendChild(mg("svg-source:excalidraw")),y.appendChild(_),y.appendChild(v),c)try{jfe({metadataElement:_,payload:i1(e,t,n||{},"local")})}catch(k){console.error(k)}const I=e_(e);if(I.length){const k=Se(e);for(const N of I){const D=y.ownerDocument.createElementNS(lt,"clipPath");D.setAttribute("id",N.id);const[G,V,H,$]=De(N,k),j=(H-G)/2-(N.x-G),X=($-V)/2-(N.y-V),Y=y.ownerDocument.createElementNS(lt,"rect");Y.setAttribute("transform",`translate(${N.x+b} ${N.y+E}) rotate(${N.angle} ${j} ${X})`),Y.setAttribute("width",`${N.width}`),Y.setAttribute("height",`${N.height}`),u||(Y.setAttribute("rx",`${tn.radius}`),Y.setAttribute("ry",`${tn.radius}`)),D.appendChild(Y),v.appendChild(D)}}const R=i!=null&&i.skipInliningFonts?[]:await Vs.generateFontFaceDeclarations(e),w=`
      `,T=y.ownerDocument.createElementNS(lt,"style");if(T.classList.add("style-fonts"),T.appendChild(document.createTextNode(`${w}${R.join(w)}`)),v.appendChild(T),t.exportBackground&&a){const k=y.ownerDocument.createElementNS(lt,"rect");k.setAttribute("x","0"),k.setAttribute("y","0"),k.setAttribute("width",`${m}`),k.setAttribute("height",`${p}`),k.setAttribute("fill",a),y.appendChild(k)}const A=Pc.svg(y),S=(i==null?void 0:i.renderEmbeddables)??!1;return Tce(d,ms(Se(d)),A,y,n||{},{offsetX:b,offsetY:E,isExporting:!0,exportWithDarkMode:o,renderEmbeddables:S,frameRendering:r,canvasBackgroundColor:a,embedsValidationStatus:S?new Map(d.filter(k=>Ie(k)).map(k=>[k.id,!0])):new Map,reuseImages:(i==null?void 0:i.reuseImages)??!0}),y},jfe=({payload:e,metadataElement:t})=>{const n=gz(JSON.stringify(pz({text:e})),!0);t.appendChild(mg(`payload-type:${ye.excalidraw}`)),t.appendChild(mg("payload-version:2")),t.appendChild(mg("payload-start")),t.appendChild(document.createTextNode(n)),t.appendChild(mg("payload-end"))},Yfe=({svg:e})=>{if(e.includes(`payload-type:${ye.excalidraw}`)){const t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");const n=e.match(/<!-- payload-version:(\d+) -->/),r=((n==null?void 0:n[1])||"1")!=="1";try{const s=mz(t[1],r),o=JSON.parse(s);if(!("encoded"in o)){if("type"in o&&o.type===as.excalidraw)return s;throw new Error("FAILED")}return Uz(o)}catch(s){throw console.error(s),new Error("FAILED")}}throw new Error("INVALID")},W9=(e,t)=>{const[n,i,r,s]=wt(e),o=Li(n,r)+t*2,a=Li(i,s)+t*2;return[n,i,o,a]},Wfe=(e,t,n)=>{const[,,i,r]=W9(e,t).map(s=>Math.trunc(s*n));return[i,r]};var K9={};(function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="0.3.0";function n(){for(var c=0,u=new Array(256),d=0;d!=256;++d)c=d,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,u[d]=c;return typeof Int32Array<"u"?new Int32Array(u):u}var i=n(),r=typeof Buffer<"u";function s(c){if(c.length>32768&&r)return a(new Buffer(c));for(var u=-1,d=c.length-1,f=0;f<d;)u=i[(u^c.charCodeAt(f++))&255]^u>>>8,u=i[(u^c.charCodeAt(f++))&255]^u>>>8;return f===d&&(u=u>>>8^i[(u^c.charCodeAt(f))&255]),u^-1}function o(c){if(c.length>1e4)return a(c);for(var u=-1,d=0,f=c.length-3;d<f;)u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255];for(;d<f+3;)u=u>>>8^i[(u^c[d++])&255];return u^-1}function a(c){for(var u=-1,d=0,f=c.length-7;d<f;)u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255],u=u>>>8^i[(u^c[d++])&255];for(;d<f+7;)u=u>>>8^i[(u^c[d++])&255];return u^-1}function l(c){for(var u=-1,d=0,f=c.length,h,m;d<f;)h=c.charCodeAt(d++),h<128?u=u>>>8^i[(u^h)&255]:h<2048?(u=u>>>8^i[(u^(192|h>>6&31))&255],u=u>>>8^i[(u^(128|h&63))&255]):h>=55296&&h<57344?(h=(h&1023)+64,m=c.charCodeAt(d++)&1023,u=u>>>8^i[(u^(240|h>>8&7))&255],u=u>>>8^i[(u^(128|h>>2&63))&255],u=u>>>8^i[(u^(128|m>>6&15|h&3))&255],u=u>>>8^i[(u^(128|m&63))&255]):(u=u>>>8^i[(u^(224|h>>12&15))&255],u=u>>>8^i[(u^(128|h>>6&63))&255],u=u>>>8^i[(u^(128|h&63))&255]);return u^-1}t.table=i,t.bstr=s,t.buf=o,t.str=l})})(K9);var Kfe=K9,Zfe=Jfe,mo=new Uint8Array(4),qfe=new Int32Array(mo.buffer),Qfe=new Uint32Array(mo.buffer);function Jfe(e){if(e[0]!==137)throw new Error("Invalid .png file header");if(e[1]!==80)throw new Error("Invalid .png file header");if(e[2]!==78)throw new Error("Invalid .png file header");if(e[3]!==71)throw new Error("Invalid .png file header");if(e[4]!==13)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[5]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(e[6]!==26)throw new Error("Invalid .png file header");if(e[7]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");for(var t=!1,n=[],i=8;i<e.length;){mo[3]=e[i++],mo[2]=e[i++],mo[1]=e[i++],mo[0]=e[i++];var r=Qfe[0]+4,s=new Uint8Array(r);s[0]=e[i++],s[1]=e[i++],s[2]=e[i++],s[3]=e[i++];var o=String.fromCharCode(s[0])+String.fromCharCode(s[1])+String.fromCharCode(s[2])+String.fromCharCode(s[3]);if(!n.length&&o!=="IHDR")throw new Error("IHDR header missing");if(o==="IEND"){t=!0,n.push({name:o,data:new Uint8Array(0)});break}for(var a=4;a<r;a++)s[a]=e[i++];mo[3]=e[i++],mo[2]=e[i++],mo[1]=e[i++],mo[0]=e[i++];var l=qfe[0],c=Kfe.buf(s);if(c!==l)throw new Error("CRC values for "+o+" header do not match, PNG file is likely corrupted");var u=new Uint8Array(s.buffer.slice(4));n.push({name:o,data:u})}if(!t)throw new Error(".png file ended prematurely: no IEND header was found");return n}const jz=sl(Zfe);var u5={},ehe=the;function the(e,t){if(e=String(e),t=String(t),!/^[\x00-\xFF]+$/.test(e)||!/^[\x00-\xFF]+$/.test(t))throw new Error("Only Latin-1 characters are permitted in PNG tEXt chunks. You might want to consider base64 encoding and/or zEXt compression");if(e.length>=80)throw new Error('Keyword "'+e+'" is longer than the 79-character limit imposed by the PNG specification');for(var n=e.length+t.length+1,i=new Uint8Array(n),r=0,s,o=0;o<e.length;o++){if(!(s=e.charCodeAt(o)))throw new Error("0x00 character is not permitted in tEXt keywords");i[r++]=s}i[r++]=0;for(var a=0;a<t.length;a++){if(!(s=t.charCodeAt(a)))throw new Error("0x00 character is not permitted in tEXt content");i[r++]=s}return{name:"tEXt",data:i}}var nhe=ihe;function ihe(e){e.data&&e.name&&(e=e.data);for(var t=!0,n="",i="",r=0;r<e.length;r++){var s=e[r];if(t)s?i+=String.fromCharCode(s):t=!1;else if(s)n+=String.fromCharCode(s);else throw new Error("Invalid NULL character found. 0x00 character is not permitted in tEXt content")}return{keyword:i,text:n}}u5.encode=ehe;u5.decode=nhe;var rhe=function(e,t,n){var i=[],r=e.length;if(r===0)return i;var s=t<0?Math.max(0,t+r):t||0;for(n!==void 0&&(r=n<0?n+r:n);r-- >s;)i[r-s]=e[r];return i},she=rhe,ohe=K9,ahe=uhe,po=new Uint8Array(4),lhe=new Int32Array(po.buffer),che=new Uint32Array(po.buffer);function uhe(e){var t=8,n=t,i;for(i=0;i<e.length;i++)t+=e[i].data.length,t+=12;var r=new Uint8Array(t);for(r[0]=137,r[1]=80,r[2]=78,r[3]=71,r[4]=13,r[5]=10,r[6]=26,r[7]=10,i=0;i<e.length;i++){var s=e[i],o=s.name,a=s.data,l=a.length,c=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)];che[0]=l,r[n++]=po[3],r[n++]=po[2],r[n++]=po[1],r[n++]=po[0],r[n++]=c[0],r[n++]=c[1],r[n++]=c[2],r[n++]=c[3];for(var u=0;u<l;)r[n++]=a[u++];var d=c.concat(she(a)),f=ohe.buf(d);lhe[0]=f,r[n++]=po[3],r[n++]=po[2],r[n++]=po[1],r[n++]=po[0]}return r}const dhe=sl(ahe),Yz=async e=>{const n=jz(new Uint8Array(await Vl(e))).find(i=>i.name==="tEXt");return n?u5.decode(n.data):null},Wz=async({blob:e,metadata:t})=>{const n=jz(new Uint8Array(await Vl(e))),i=u5.encode(ye.excalidraw,JSON.stringify(pz({text:t,compress:!0})));return n.splice(-1,0,i),new Blob([dhe(n)],{type:ye.png})},fhe=async e=>{const t=await Yz(e);if((t==null?void 0:t.keyword)===ye.excalidraw)try{const n=JSON.parse(t.text);if(!("encoded"in n)){if("type"in n&&n.type===as.excalidraw)return t.text;throw new Error("FAILED")}return Uz(n)}catch(n){throw console.error(n),new Error("FAILED")}throw new Error("INVALID")},Kz=Object.freeze(Object.defineProperty({__proto__:null,decodePngMetadata:fhe,encodePngMetadata:Wz,getTEXtChunk:Yz},Symbol.toStringTag,{value:"Module"})),ks=32,Mt=12,rc=256,Zz=50,uu="NOT_SPREADSHEET",J0="VALID_SPREADSHEET",pg=e=>{const t=/^([-+]?)[$€£¥₩]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,"")):null},V8=(e,t)=>e.slice(1).every(n=>pg(n[t])!==null),tA=e=>{const t=e[0].length;if(t>2)return{type:uu,reason:"More than 2 columns"};if(t===1){if(!V8(e,0))return{type:uu,reason:"Value is not numeric"};const l=pg(e[0][0])===null,c=(l?e.slice(1):e).map(u=>pg(u[0]));return c.length<2?{type:uu,reason:"Less than two rows"}:{type:J0,spreadsheet:{title:l?e[0][0]:null,labels:null,values:c}}}const n=V8(e,0),i=V8(e,1);if(!n&&!i)return{type:uu,reason:"Value is not numeric"};const[r,s]=i?[0,1]:[1,0],o=pg(e[0][s])===null,a=o?e.slice(1):e;return a.length<2?{type:uu,reason:"Less than 2 rows"}:{type:J0,spreadsheet:{title:o?e[0][s]:null,labels:a.map(l=>l[r]),values:a.map(l=>pg(l[s]))}}},hhe=e=>{const t=[];for(let n=0;n<e[0].length;n++){const i=[];for(let r=0;r<e.length;r++)i.push(e[r][n]);t.push(i)}return t},ghe=e=>{let t=e.trim().split(`
`).map(s=>s.trim().split("	"));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
`).map(s=>s.trim().split(","))),t.length===0)return{type:uu,reason:"No values"};const n=t[0].length;if(!t.every(s=>s.length===n))return{type:uu,reason:"All rows don't have same number of columns"};const r=tA(t);if(r.type!==J0){const s=tA(hhe(t));if(s.type===J0)return s}return r},Rb=oQ(iQ),Xs={fillStyle:"hachure",fontFamily:Oc,fontSize:al,opacity:100,roughness:1,strokeColor:$e.black,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:Ar.MIDDLE,locked:!1},qz=e=>{const t=(ks+Mt)*e.values.length+Mt,n=rc+Mt*2;return{chartWidth:t,chartHeight:n}},mhe=(e,t,n,i,r)=>{var s;return((s=e.labels)==null?void 0:s.map((o,a)=>Br({groupIds:[i],backgroundColor:r,...Xs,text:o.length>8?`${o.slice(0,5)}...`:o,x:t+a*(ks+Mt)+Mt*2,y:n+Mt/2,width:ks,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"})))||[]},phe=(e,t,n,i,r)=>{const s=Br({groupIds:[i],backgroundColor:r,...Xs,x:t-Mt,y:n-Mt,text:"0",textAlign:"right"}),o=Br({groupIds:[i],backgroundColor:r,...Xs,x:t-Mt,y:n-rc-s.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[s,o]},Uhe=(e,t,n,i,r)=>{const{chartWidth:s,chartHeight:o}=qz(e),a=Pu({backgroundColor:r,groupIds:[i],...Xs,type:"line",x:t,y:n,width:s,points:[C(0,0),C(s,0)]}),l=Pu({backgroundColor:r,groupIds:[i],...Xs,type:"line",x:t,y:n,height:o,points:[C(0,0),C(0,-280)]}),c=Pu({backgroundColor:r,groupIds:[i],...Xs,type:"line",x:t,y:n-rc-Mt,strokeStyle:"dotted",width:s,opacity:Zz,points:[C(0,0),C(s,0)]});return[a,l,c]},Qz=(e,t,n,i,r,s)=>{const{chartWidth:o}=qz(e),a=e.title?Br({backgroundColor:r,groupIds:[i],...Xs,text:e.title,x:t+o/2,y:n-rc-Mt*2-al,roundness:null,textAlign:"center"}):null;return[...a?[a]:[],...mhe(e,t,n,i,r),...phe(e,t,n,i,r),...Uhe(e,t,n,i,r)]},bhe=(e,t,n)=>{const i=Math.max(...e.values),r=bs(),s=Rb[Math.floor(Math.random()*Rb.length)];return[...e.values.map((a,l)=>{const c=a/i*rc;return Xa({backgroundColor:s,groupIds:[r],...Xs,type:"rectangle",x:t+l*(ks+Mt)+Mt,y:n-c-Mt,width:ks,height:c})}),...Qz(e,t,n,r,s)]},yhe=(e,t,n)=>{const i=Math.max(...e.values),r=bs(),s=Rb[Math.floor(Math.random()*Rb.length)];let o=0;const a=[];for(const p of e.values){const b=o*(ks+Mt),E=-(p/i)*rc;a.push([b,E]),o++}const l=Math.max(...a.map(p=>p[0])),c=Math.max(...a.map(p=>p[1])),u=Math.min(...a.map(p=>p[0])),d=Math.min(...a.map(p=>p[1])),f=Pu({backgroundColor:s,groupIds:[r],...Xs,type:"line",x:t+Mt+ks/2,y:n-Mt,height:c-d,width:l-u,strokeWidth:2,points:a}),h=e.values.map((p,b)=>{const E=b*(ks+Mt)+Mt/2,y=-(p/i)*rc+Mt/2;return Xa({backgroundColor:s,groupIds:[r],...Xs,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+E+ks/2,y:n+y-Mt*2,width:Mt,height:Mt})}),m=e.values.map((p,b)=>{const E=b*(ks+Mt)+Mt/2,y=p/i*rc+Mt/2+Mt;return Pu({backgroundColor:s,groupIds:[r],...Xs,type:"line",x:t+E+ks/2+Mt/2,y:n-y,height:y,strokeStyle:"dotted",opacity:Zz,points:[C(0,0),C(0,y)]})});return[...Qz(e,t,n,r,s),f,...m,...h]},Ehe=(e,t,n,i)=>e==="line"?yhe(t,n,i):bhe(t,n,i),Z9="clipboard"in navigator&&"writeText"in navigator.clipboard,q9="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,vhe=e=>!!([as.excalidraw,as.excalidrawClipboard,as.excalidrawClipboardWithAPI].includes(e==null?void 0:e.type)&&Array.isArray(e.elements)),_he=({types:e,files:t})=>{var i,r,s,o;!e&&!t&&console.warn("createPasteEvent: no types or files provided");const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(const[a,l]of Object.entries(e)){if(typeof l!="string"){t=t||[],t.push(l);continue}try{if((i=n.clipboardData)==null||i.setData(a,l),((r=n.clipboardData)==null?void 0:r.getData(a))!==l)throw new Error(`Failed to set "${a}" as clipboardData item`)}catch(c){throw new Error(c.message)}}if(t){let a=-1;for(const l of t){a++;try{if((s=n.clipboardData)==null||s.items.add(l),((o=n.clipboardData)==null?void 0:o.files[a])!==l)throw new Error(`Failed to set file "${l.name}" as clipboardData item`)}catch(c){throw new Error(c.message)}}}return n},whe=({elements:e,files:t})=>{const n=Se(e),i=new Set(e.filter(a=>Ie(a)));let r=!1;const s=e.reduce((a,l)=>(xn(l)&&(r=!0,t&&t[l.fileId]&&(a[l.fileId]=t[l.fileId])),a),{});r&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");const o={type:as.excalidrawClipboard,elements:e.map(a=>{if(Ur(a,n)&&!i.has(Ur(a,n))){const l=Cd(a);return ee(l,{frameId:null}),l}return a}),files:t?s:void 0};return JSON.stringify(o)},The=async(e,t,n)=>{await Bc(whe({elements:e,files:t}),n)},She=e=>{const t=ghe(e);return t.type===J0?{spreadsheet:t.spreadsheet}:null};function Jz(e){var n;let t=[];for(const i of e.childNodes)if(i.nodeType===3){const r=(n=i.textContent)==null?void 0:n.trim();r&&t.push({type:"text",value:r})}else if(i instanceof HTMLImageElement){const r=i.getAttribute("src");r&&r.startsWith("http")&&t.push({type:"imageUrl",value:r})}else t=t.concat(Jz(i));return t}const Ihe=e=>{var n;const t=(n=e.clipboardData)==null?void 0:n.getData(ye.html);if(!t)return null;try{const i=new DOMParser().parseFromString(t,ye.html),r=Jz(i.body);if(r.length)return{type:"mixedContent",value:r}}catch(i){console.error(`error in parseHTMLFromPaste: ${i.message}`)}return null},xhe=async()=>{var n,i,r,s;const e={};let t;try{t=await((n=navigator.clipboard)==null?void 0:n.read())}catch(o){try{if((i=navigator.clipboard)!=null&&i.readText){console.warn(`navigator.clipboard.readText() failed (${o.message}). Failling back to navigator.clipboard.read()`);const a=await((r=navigator.clipboard)==null?void 0:r.readText());if(a)return{[ye.text]:a}}}catch(a){if((s=navigator.clipboard)!=null&&s.read)console.warn(`navigator.clipboard.readText() failed (${a.message}). Failling back to navigator.clipboard.read()`);else{if(a.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${a.message}`),e;throw a}}throw o}for(const o of t)for(const a of o.types)if(lF(EQ,a))try{if(a===ye.text||a===ye.html)e[a]=await(await o.getType(a)).text();else if(Iz(a)){const l=await o.getType(a),c=gg(l,a,void 0);e[a]=c}else throw new Bs(`Unsupported clipboard type: ${a}`)}catch(l){console.warn(l instanceof Bs?l.message:`Cannot retrieve ${a} from clipboardItem: ${l.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},Che=async(e,t=!1)=>{var n,i;try{const r=!t&&e&&Ihe(e);return r?r.value.every(o=>o.type==="text")?{type:"text",value:((n=e.clipboardData)==null?void 0:n.getData(ye.text))||r.value.map(o=>o.value).join(`
`).trim()}:r:{type:"text",value:(((i=e.clipboardData)==null?void 0:i.getData(ye.text))||"").trim()}}catch{return{type:"text",value:""}}},eH=async(e,t=!1)=>{const n=await Che(e,t);if(n.type==="mixedContent")return{mixedContent:n.value};try{const i=!t&&She(n.value);if(i)return i}catch(i){console.error(i)}try{const i=JSON.parse(n.value),r=i.type===as.excalidrawClipboardWithAPI;if(vhe(i))return{elements:i.elements,files:i.files,text:t?JSON.stringify(i.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:n.value}},Ahe=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[ye.png]:e})])}catch(t){if(zm(e))await navigator.clipboard.write([new window.ClipboardItem({[ye.png]:await e})]);else throw t}},Bc=async(e,t)=>{var n,i;if(Z9)try{await navigator.clipboard.writeText(e||"");return}catch(r){console.error(r)}try{if(t){if((n=t.clipboardData)==null||n.setData(ye.text,e||""),((i=t.clipboardData)==null?void 0:i.getData(ye.text))!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(r){console.error(r)}if(!Mhe(e))throw new Error("Error copying to clipboard.")},Mhe=e=>{e||(e=" ");const t=document.documentElement.getAttribute("dir")==="rtl",n=document.createElement("textarea");n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";const i=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${i}px`,n.style.fontSize="12pt",n.setAttribute("readonly",""),n.value=e,document.body.appendChild(n);let r=!1;try{n.select(),n.setSelectionRange(0,n.value.length),r=document.execCommand("copy")}catch(s){console.error(s)}return n.remove(),r},d5=({elements:e,appState:t,files:n,maxWidthOrHeight:i,getDimensions:r,exportPadding:s,exportingFrame:o})=>{const{elements:a,appState:l}=rd({elements:e,appState:t},null,null),{exportBackground:c,viewBackgroundColor:u}=l;return Xz(a,{...l,offsetTop:0,offsetLeft:0,width:0,height:0},n||{},{exportBackground:c,exportPadding:s,viewBackgroundColor:u,exportingFrame:o},(d,f)=>{const h=document.createElement("canvas");if(i){typeof r=="function"&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");const p=Math.max(d,f),b=i<p?i/p:(t==null?void 0:t.exportScale)??1;return h.width=d*b,h.height=f*b,{canvas:h,scale:b}}const m=(r==null?void 0:r(d,f))||{width:d,height:f};return h.width=m.width,h.height=m.height,{canvas:h,scale:m.scale??1}})},Rhe=async e=>{var r;let{mimeType:t=ye.png,quality:n}=e;t===ye.png&&typeof n=="number"&&console.warn(`"quality" will be ignored for "${ye.png}" mimeType`),t==="image/jpg"&&(t=ye.jpg),t===ye.jpg&&!((r=e.appState)!=null&&r.exportBackground)&&(console.warn(`Defaulting "exportBackground" to "true" for "${ye.jpg}" mimeType`),e={...e,appState:{...e.appState,exportBackground:!0}});const i=await d5(e);return n=n||(/image\/jpe?g/.test(t)?.92:.8),new Promise((s,o)=>{i.toBlob(async a=>{var l;if(!a)return o(new Error("couldn't export to blob"));a&&t===ye.png&&((l=e.appState)!=null&&l.exportEmbedScene)&&(a=await Wz({blob:a,metadata:i1(e.elements,e.appState,e.files||{},"local")})),s(a)},t,n)})},tH=async({elements:e,appState:t=gs(),files:n={},exportPadding:i,renderEmbeddables:r,exportingFrame:s,skipInliningFonts:o,reuseImages:a})=>{const{elements:l,appState:c}=rd({elements:e,appState:t},null,null),u={...c,exportPadding:i};return Y9(l,u,n,{exportingFrame:s,renderEmbeddables:r,skipInliningFonts:o,reuseImages:a})},khe=e=>e.type==="diamond"?[C(e.width/2,0),C(e.width,e.height/2),C(e.width/2,e.height),C(0,e.height/2)]:[C(0,0),C(0+e.width,0),C(0+e.width,e.height),C(0,e.height)],Lhe=e=>ke(e)||ps(e)?e.points:khe(e),nA=e=>{const t=e.reduce((n,[i,r])=>(n.minY=Math.min(n.minY,r),n.minX=Math.min(n.minX,i),n.maxX=Math.max(n.maxX,i),n.maxY=Math.max(n.maxY,r),n),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},Dhe=e=>{const t=Lhe(e),{cx:n,cy:i}=nA(t),r=C(n,i),s=t.map(u=>q(u,r,e.angle)),{minX:o,minY:a,maxX:l,maxY:c}=nA(s);return[o+e.x,a+e.y,l+e.x,c+e.y]},Nhe=(e,t)=>{const n=Dhe(e);return(Wp(n[0],Ri(t[0],t[2]))||Wp(t[0],Ri(n[0],n[2])))&&(Wp(n[1],Ri(t[1],t[3]))||Wp(t[1],Ri(n[1],n[3])))},Ohe=({elements:e,bounds:t,type:n,errorMargin:i=0})=>{var o;fF(t)&&(t=Js(t,Se(e)));const r=[t[0]-i,t[1]-i,t[2]+i,t[3]+i],s=new Set;for(const a of e){if(s.has(a.id))continue;if(Nhe(a,r)){if(s.add(a.id),a.boundElements)for(const c of a.boundElements)s.add(c.id);de(a)&&a.containerId&&s.add(a.containerId),Be(a)&&(a.startBinding&&s.add(a.startBinding.elementId),a.endBinding&&s.add((o=a.endBinding)==null?void 0:o.elementId))}}return e.filter(a=>s.has(a.id))};function iA(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function Phe(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}const Fhe=1e-6;function rA(e,t){const n=_e(e[1],e[0]),i=_e(t,e[0]),r=$n(n,i);return Math.abs(r)<Fhe}function $8(e,t){const n=_e(e[1],e[0]),i=_e(t,e[0]);return $n(n,i)<0}function sA(e,t){return rA(e,t[0])||rA(e,t[1])||($8(e,t[0])?!$8(e,t[1]):$8(e,t[1]))}function Bhe(e,t){return Phe(iA(e),iA(t))&&sA(e,t)&&sA(t,e)}const nH=(e,t,n)=>{const i=Se(e);for(const r of t)if(r.frameId){const s=n.get(r.id),o=n.get(r.frameId);if(s){const a=i.get(s);a&&ee(a,{frameId:o??r.frameId},!1)}}};function Q9(e,t,n){const i=mA(t,n),r=mA(e,n);return i.some(o=>r.some(a=>Bhe(o,a)))}const iH=(e,t,n)=>h5(m_(e,t,n,!1)).filter(i=>!Ie(i)&&!i.frameId||i.frameId===t.id),J9=(e,t,n)=>m_([t],e,n).some(i=>i.id===t.id),Ym=(e,t,n)=>{const[i,r,s,o]=De(t,n),[a,l,c,u]=wt(e);return i<=a&&r<=l&&s>=c&&o>=u},Ec=(e,t,n)=>Ym([e],t,n)||Q9(e,t,n)||J9(e,t,n),oA=(e,t,n)=>{const[i,r,s,o]=De(t,n);return JP(C(i,r),C(e.x,e.y),C(s,o))},zhe=e=>{const t=new Map;for(const n of e){const i=Ie(n)?n.id:n.frameId;i&&!t.has(i)&&t.set(i,Ho(e,i))}return t},Ho=(e,t)=>{const n=[];for(const i of e.values())i.frameId===t&&n.push(i);return n},e_=e=>e.filter(t=>Ie(t)),t_=e=>{const t=Se(e_(e));return e.filter(n=>t.has(n.id)||!n.frameId||!t.has(n.frameId))},s2=(e,t,n,i)=>{const r=Ho(e,t.id),s=new Set(r),o=new Set([...iH(e,t,i),...r.filter(f=>J9(f,t,i))]),a=r.filter(f=>!o.has(f)),l=new Set(Array.from(o).flatMap(f=>f.groupIds));for(const f of a)if(!Q9(f,t,i))f.groupIds.length===0&&s.delete(f);else if(f.groupIds.length>0)for(const h of f.groupIds)l.add(h);for(const f of a)if(f.groupIds.length>0){let h=!0;for(const m of f.groupIds)l.has(m)&&(h=!1);h&&s.delete(f)}const c=Array.from(o).filter(f=>f.groupIds.length===0);for(const f of c)s.add(f);const u=Array.from(o).filter(f=>f.groupIds.length>0),d=IF(u,n);for(const[f,h]of Object.entries(d))if(h){const m=$t(e,f);if(Ym(m,t,i))for(const p of m)s.add(p)}return[...s].filter(f=>!(de(f)&&f.containerId))},Hhe=(e,t,n)=>Vhe(h5(e,iH(e,t,n)),t,n),Vhe=(e,t,n)=>{const i=[],r=new Map;for(const s of e){let o=!1;if(s.groupIds.length>0){if(s.groupIds.some(a=>r.get(a)))o=!0;else{const a=new Set(s.groupIds.flatMap(l=>$t(n,l)));o=!Ym(Array.from(a),t,n)}s.groupIds.forEach(a=>{r.set(a,o)})}o||i.push(s)}return i},Ur=(e,t)=>e.frameId&&t.get(e.frameId)||null,$he=(e,t)=>{const n=new Set,i=Se(e);e=h5(e);for(const o of e)Ie(o)&&o.id!==t.id&&n.add(o.id);const r=new Set,s=[];for(const o of e)if(!(Ie(o)||o.frameId&&n.has(o.frameId)))if(o.groupIds.length){const a=o.groupIds.at(-1);if(!r.has(a)){r.add(a);const l=$t(e,a);if(l.some(c=>Ec(c,t,i)))for(const c of l)s.push(c)}}else Ec(o,t,i)&&s.push(o);return s},Qg=(e,t,n,i)=>{const r=Se(e),s=new Map;for(const c of e.values())c.frameId===n.id&&s.set(c.id,!0);const o=new Set(t.map(c=>c.id)),a=[],l=new Set;for(const c of t)Ie(c)&&c.id!==n.id&&l.add(c.id);for(const c of h5(e,t)){if(Ie(c)||c.frameId&&l.has(c.frameId)||c.frameId&&i.selectedElementIds[c.id]&&i.selectedElementIds[c.frameId])continue;s.has(c.id)||a.push(c);const u=Oe(c,r);u&&!o.has(u.id)&&!s.has(u.id)&&a.push(u)}for(const c of a)ee(c,{frameId:n.id},!1);return e},f5=(e,t)=>{const n=new Map,i=new Map;for(const r of e)if(r.frameId){n.set(r.id,r);const s=i.get(r.frameId)||[];s.push(r);const o=Oe(r,t);o&&(n.set(o.id,o),s.push(o)),i.set(r.frameId,s)}for(const[,r]of n)ee(r,{frameId:null},!1)},rH=(e,t)=>{const n=Ho(e,t.id);return f5(n,Se(e)),e},sH=(e,t,n,i)=>Qg(rH(e,n),t,n,i.state).slice(),wh=(e,t,n)=>{const i=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,elements:e}),r=new Set(i);if(t.editingGroupId)for(const a of i)a.groupIds.length===0?r.add(a):a.groupIds.flatMap(l=>$t(e,l)).forEach(l=>r.add(l));const s=new Set,o=Se(e);return r.forEach(a=>{a.frameId&&!Ie(a)&&!kb(a,o,t)&&s.add(a)}),s.size>0&&f5(s,o),e},h5=(e,t)=>{const n=new Set,i=t||e;for(const o of i.values()){const a=o.groupIds[o.groupIds.length-1];a&&n.add(a)}const r=new Set;for(const o of n)$t(e,o).some(a=>Ie(a))&&r.add(o);const s=[];for(const o of i.values())r.has(o.groupIds[o.groupIds.length-1])||s.push(o);return s},vE=(e,t,n)=>{const i=de(e)&&ui(e,t)||e;return i.frameId&&n.selectedElementIds[i.id]&&n.selectedElementIds[i.frameId]?Ur(i,t):n.selectedElementIds[i.id]&&n.selectedElementsAreBeingDragged?n.frameToHighlight:Ur(i,t)},kb=(e,t,n,i)=>{var l;const r=(i==null?void 0:i.targetFrame)??vE(e,t,n);if(!r)return!1;const s=de(e)&&ui(e,t)||e,o=c=>{i!=null&&i.checkedGroups&&s.groupIds.forEach(u=>{var d;(d=i.checkedGroups)==null||d.set(u,c)})};if(!n.selectedElementIds[s.id]||!n.selectedElementsAreBeingDragged||n.selectedElementIds[s.id]&&n.selectedElementIds[r.id])return!0;if(s.groupIds.length===0)return Ec(s,r,t);for(const c of s.groupIds)if((l=i==null?void 0:i.checkedGroups)!=null&&l.has(c))return i.checkedGroups.get(c);const a=new Set(s.groupIds.filter(c=>i!=null&&i.checkedGroups?!i.checkedGroups.has(c):!0).flatMap(c=>$t(t,c)));if(n.editingGroupId&&n.selectedElementsAreBeingDragged){const c=new Set(Fe(t,n));if(n.frameToHighlight!==null)return!0;c.forEach(d=>{a.delete(d)})}for(const c of a)if(Ie(c))return o(!1),!1;for(const c of a)if(Ec(c,r,t))return o(!0),!0;return!1},aA=(e,t,n,i,r)=>{if(!n.frameRendering||!n.frameRendering.clip)return!1;const s=Q9(e,t,i)||J9(e,t,i);if(s){for(const o of e.groupIds)r==null||r.set(o,!0);return!0}if(!s&&e.groupIds.length>0&&!Ym([e],t,i)){let o=!1;if(n.selectedElementsAreBeingDragged)o=kb(e,i,n,{targetFrame:t,checkedGroups:r});else{o=e.frameId===t.id;for(const a of e.groupIds)r==null||r.set(a,o)}for(const a of e.groupIds)r==null||r.set(a,o);return o}return!1},oH=e=>e.name===null?uF(e)?"Frame":"AI Frame":e.name,n_=(e,t)=>Ohe({elements:e,bounds:t,type:"overlap"}).filter(n=>!n.frameId||n.frameId===t.id),aH=e=>{const t=Se(e);return e.length>1&&e.some(n=>n.frameId&&t.has(n.frameId))},lH="invert(100%) hue-rotate(180deg) saturate(1.25)",Ghe=gs(),cH=(e,t)=>xn(e)&&!t.imageCache.has(e.fileId),uH=(e,t,n)=>{var i;return n.theme===xe.DARK&&xn(e)&&!cH(e,t)&&((i=t.imageCache.get(e.fileId))==null?void 0:i.mimeType)!==ye.svg},g5=e=>{switch(e.type){case"freedraw":return e.strokeWidth*12;case"text":return e.fontSize/2;default:return 20}},dH=(e,t,n,i,r=1)=>{let s=((t==null?void 0:t.opacity)??100)*e.opacity/1e4*r;return(n.has(e.id)||i&&i.some(o=>o.id===e.id)||t&&n.has(t.id))&&(s*=NQ/100),s},Xhe=(e,t,n)=>{const s=g5(e),[o,a,l,c]=De(e,t),u=ke(e)||ps(e)?Li(o,l):e.width,d=ke(e)||ps(e)?Li(a,c):e.height;let f=u*window.devicePixelRatio+s*2,h=d*window.devicePixelRatio+s*2,m=n.value;return(f*m>32767||h*m>32767)&&(m=Math.min(32767/f,32767/h)),f*h*m*m>16777216&&(m=Math.sqrt(16777216/(f*h))),f=Math.floor(f*m),h=Math.floor(h*m),{width:f,height:h,scale:m}},fH=(e,t,n,i,r)=>{var E,y;const s=document.createElement("canvas"),o=s.getContext("2d"),a=g5(e),{width:l,height:c,scale:u}=Xhe(e,t,n);if(!l||!c)return null;s.width=l,s.height=c;let d=-100,f=0;if(ke(e)||ps(e)){const[v,_]=De(e,t);d=e.x>v?Li(e.x,v)*window.devicePixelRatio*u:0,f=e.y>_?Li(e.y,_)*window.devicePixelRatio*u:0,o.translate(d,f)}o.save(),o.translate(a*u,a*u),o.scale(window.devicePixelRatio*u,window.devicePixelRatio*u);const h=Pc.canvas(s);uH(e,i,r)&&(o.filter=lH),o2(e,h,o,i),o.restore();const m=Oe(e,t),p=document.createElement("canvas"),b=p.getContext("2d");if(Be(e)&&m){const[v,_,I,R]=De(e,t),w=Math.max(Li(v,I),Li(_,R));p.width=w*window.devicePixelRatio*u+a*u*10,p.height=w*window.devicePixelRatio*u+a*u*10,b.translate(p.width/2,p.height/2),b.rotate(e.angle),b.drawImage(s,-s.width/2,-s.height/2,s.width,s.height);const[,,,,T,A]=De(m,t);b.rotate(-e.angle);const S=(p.width-s.width)/2,k=(p.height-s.height)/2,N=p.width/2-(T-v)*window.devicePixelRatio*u-S-a*u,D=p.height/2-(A-_)*window.devicePixelRatio*u-k-a*u;b.translate(-N,-D),b.clearRect(-(m.width/2+Nn)*window.devicePixelRatio*u,-(m.height/2+Nn)*window.devicePixelRatio*u,(m.width+Nn*2)*window.devicePixelRatio*u,(m.height+Nn*2)*window.devicePixelRatio*u)}return{element:e,canvas:s,theme:r.theme,scale:u,zoomValue:n.value,canvasOffsetX:d,canvasOffsetY:f,boundTextElementVersion:((E=Oe(e,t))==null?void 0:E.version)||null,containingFrameOpacity:((y=Ur(e,t))==null?void 0:y.opacity)||100,boundTextCanvas:p,angle:e.angle,imageCrop:st(e)?e.crop:null}},jhe=14,hH=document.createElement("img");hH.src=`data:${ye.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;const gH=document.createElement("img");gH.src=`data:${ye.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;const Yhe=(e,t)=>{t.fillStyle="#E7E7E7",t.fillRect(0,0,e.width,e.height);const n=Math.min(e.width,e.height),i=Math.min(n,Math.min(n*.4,100));t.drawImage(e.status==="error"?gH:hH,e.width/2-i/2,e.height/2-i/2,i,i)},o2=(e,t,n,i,r)=>{var s;switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":{n.lineJoin="round",n.lineCap="round",t.draw(Gt.get(e));break}case"arrow":case"line":{n.lineJoin="round",n.lineCap="round",Gt.get(e).forEach(o=>{t.draw(o)});break}case"freedraw":{n.save(),n.fillStyle=e.strokeColor;const o=Zhe(e),a=Gt.get(e);a&&t.draw(a),n.fillStyle=e.strokeColor,n.fill(o),n.restore();break}case"image":{const o=xn(e)?(s=i.imageCache.get(e.fileId))==null?void 0:s.image:void 0;if(o!=null&&!(o instanceof Promise)){e.roundness&&n.roundRect&&(n.beginPath(),n.roundRect(0,0,e.width,e.height,$s(Math.min(e.width,e.height),e)),n.clip());const{x:a,y:l,width:c,height:u}=e.crop?e.crop:{x:0,y:0,width:o.naturalWidth,height:o.naturalHeight};n.drawImage(o,a,l,c,u,0,0,e.width,e.height)}else Yhe(e,n);break}default:if(de(e)){const o=iF(e.text),a=o&&!n.canvas.isConnected;a&&document.body.appendChild(n.canvas),n.canvas.setAttribute("dir",o?"rtl":"ltr"),n.save(),n.font=xt(e),n.fillStyle=e.strokeColor,n.textAlign=e.textAlign;const l=e.text.replace(/\r\n?/g,`
`).split(`
`),c=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,u=Hm(e.fontSize,e.lineHeight),d=eB(e.fontFamily,e.fontSize,u);for(let f=0;f<l.length;f++)n.fillText(l[f],c,f*u+d);n.restore(),a&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},_E=new WeakMap,lA=(e,t,n,i)=>{var d;const r=n?i.zoom:Ghe.zoom,s=_E.get(e),o=s&&s.zoomValue!==r.value&&!(i!=null&&i.shouldCacheIgnoreZoom),a=Oe(e,t),l=(a==null?void 0:a.version)||null,c=st(e)?e.crop:null,u=((d=Ur(e,t))==null?void 0:d.opacity)||100;if(!s||o||s.theme!==i.theme||s.boundTextElementVersion!==l||s.imageCrop!==c||s.containingFrameOpacity!==u||Be(e)&&a&&e.angle!==s.angle){const f=fH(e,t,r,n,i);return f?(_E.set(e,f),f):null}return s},G8=(e,t,n,i,r)=>{const s=e.element,o=g5(s),a=e.scale,[l,c,u,d]=De(s,r),f=((l+u)/2+i.scrollX)*window.devicePixelRatio,h=((c+d)/2+i.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);const m=Oe(s,r);if(Be(s)&&m){const p=(e.boundTextCanvas.width-e.canvas.width)/2,b=(e.boundTextCanvas.height-e.canvas.height)/2;t.translate(f,h),t.drawImage(e.boundTextCanvas,-(u-l)/2*window.devicePixelRatio-p/a-o,-(d-c)/2*window.devicePixelRatio-b/a-o,e.boundTextCanvas.width/a,e.boundTextCanvas.height/a)}else t.translate(f,h),t.rotate(s.angle),"scale"in e.element&&!cH(s,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-f,-h),t.drawImage(e.canvas,(l+i.scrollX)*window.devicePixelRatio-o*e.scale/e.scale,(c+i.scrollY)*window.devicePixelRatio-o*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale);t.restore()},Whe=(e,t,n,i)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";const r=.5/n.zoom.value;t.fillRect(r,r,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=i,t.strokeRect(r,r,e.width,e.height),t.restore()},iu=(e,t,n,i,r,s,o)=>{var l;const a=((l=o.openDialog)==null?void 0:l.name)==="elementLinkSelector"&&!o.selectedElementIds[e.id]&&!o.hoveredElementIds[e.id];switch(r.globalAlpha=dH(e,Ur(e,t),s.elementsPendingErasure,s.pendingFlowchartNodes,a?$O:1),e.type){case"magicframe":case"frame":{o.frameRendering.enabled&&o.frameRendering.outline&&(r.save(),r.translate(e.x+o.scrollX,e.y+o.scrollY),r.fillStyle="rgba(0, 0, 200, 0.04)",r.lineWidth=tn.strokeWidth/o.zoom.value,r.strokeStyle=tn.strokeColor,WU(e)&&(r.strokeStyle=o.theme===xe.LIGHT?"#7affd7":"#1d8264"),r.roundRect?(r.beginPath(),r.roundRect(0,0,e.width,e.height,tn.radius/o.zoom.value),r.stroke(),r.closePath()):r.strokeRect(0,0,e.width,e.height),r.restore());break}case"freedraw":{if(Gt.generateElementShape(e,null),s.isExporting){const[c,u,d,f]=De(e,t),h=(c+d)/2+o.scrollX,m=(u+f)/2+o.scrollY,p=(d-c)/2-(e.x-c),b=(f-u)/2-(e.y-u);r.save(),r.translate(h,m),r.rotate(e.angle),r.translate(-p,-b),o2(e,i,r,s),r.restore()}else{const c=lA(e,n,s,o);if(!c)return;G8(c,r,s,o,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(Gt.generateElementShape(e,s),s.isExporting){const[c,u,d,f]=De(e,t),h=(c+d)/2+o.scrollX,m=(u+f)/2+o.scrollY;let p=(d-c)/2-(e.x-c),b=(f-u)/2-(e.y-u);if(de(e)){const y=ui(e,t);if(Be(y)){const v=ue.getBoundTextElementPosition(y,e,t);p=(d-c)/2-(v.x-c),b=(f-u)/2-(v.y-u)}}r.save(),r.translate(h,m),uH(e,s,o)&&(r.filter="none");const E=Oe(e,t);if(Be(e)&&E){const y=document.createElement("canvas"),v=y.getContext("2d"),_=Math.max(Li(c,d),Li(u,f)),I=g5(e);y.width=_*o.exportScale+I*10*o.exportScale,y.height=_*o.exportScale+I*10*o.exportScale,v.translate(y.width/2,y.height/2),v.scale(o.exportScale,o.exportScale),p=e.width/2-(e.x-c),b=e.height/2-(e.y-u),v.rotate(e.angle);const R=Pc.canvas(y);v.translate(-p,-b),o2(e,R,v,s),v.translate(p,b),v.rotate(-e.angle);const[,,,,w,T]=De(E,t),A=(c+d)/2-w,S=(u+f)/2-T;v.translate(-A,-S),v.clearRect(-E.width/2,-E.height/2,E.width,E.height),r.scale(1/o.exportScale,1/o.exportScale),r.drawImage(y,-y.width/2,-y.height/2,y.width,y.height)}else r.rotate(e.angle),e.type==="image"&&r.scale(e.scale[0],e.scale[1]),r.translate(-p,-b),o2(e,i,r,s);r.restore()}else{const c=lA(e,n,s,o);if(!c)return;const u=r.imageSmoothingEnabled;if(!(o!=null&&o.shouldCacheIgnoreZoom)&&(!e.angle||see(e.angle))&&(r.imageSmoothingEnabled=!1),e.id===o.croppingElementId&&st(c.element)&&c.element.crop!==null){r.save(),r.globalAlpha=.1;const d=fH(vce(c.element,t),n,o.zoom,s,o);d&&G8(d,r,s,o,n),r.restore()}G8(c,r,s,o,n),r.imageSmoothingEnabled=u}break}default:throw new Error(`Unimplemented type ${e.type}`)}r.globalAlpha=1},mH=new WeakMap([]);function Khe(e){const t=pH(e),n=new Path2D(t);return mH.set(e,n),n}function Zhe(e){return mH.get(e)}function pH(e){const t=e.simulatePressure?e.points:e.points.length?e.points.map(([i,r],s)=>[i,r,e.pressures[s]]):[[0,0,.5]],n={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:i=>Math.sin(i*Math.PI/2),last:!!e.lastCommittedPoint};return Qhe(fte(t,n))}function cA(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}const qhe=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;function Qhe(e){if(!e.length)return"";const t=e.length-1;return e.reduce((n,i,r,s)=>(r===t?n.push(i,cA(i,s[0]),"L",s[0],"Z"):n.push(i,cA(i,s[r+1])),n),["M",e[0],"Q"]).join(" ").replace(qhe,"$1")}function X8(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function Jhe(e,t,n){const i=X8(t,n);if(i===0)return X8(e,t);let r=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/i;return r=Math.max(0,Math.min(1,r)),X8(e,e1e(t,n,r))}function e1e(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function t1e(e,t){return wE(e,0,e.length,t)}function wE(e,t,n,i,r){const s=r||[],o=e[t],a=e[n-1];let l=0,c=1;for(let u=t+1;u<n-1;++u){const d=Jhe(e[u],o,a);d>l&&(l=d,c=u)}return Math.sqrt(l)>i?(wE(e,t,c+1,i,s),wE(e,c,n,i,s)):(s.length||s.push(o),s.push(a)),s}const Th=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="line"||e==="freedraw",TE=e=>e!=="image"&&e!=="frame"&&e!=="magicframe",uA=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="freedraw"||e==="arrow"||e==="line",dA=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="ellipse"||e==="diamond"||e==="arrow"||e==="line",SE=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="line"||e==="diamond"||e==="image",fA=e=>e==="arrow",Lb=e=>e==="arrow",n1e=e=>[8,8+e],UH=e=>[1.5,6+e];function i1e(e){const t=e.roughness,n=Math.max(e.width,e.height),i=Math.min(e.width,e.height);return i>=20&&n>=50||i>=15&&e.roundness&&SE(e.type)||ke(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}const Ir=(e,t=!1)=>{const n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?n1e(e.strokeWidth):e.strokeStyle==="dotted"?UH(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:i1e(e),stroke:e.strokeColor,preserveVertices:t||e.roughness<zO.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return n.fillStyle=e.fillStyle,n.fill=Fs(e.backgroundColor)?void 0:e.backgroundColor,e.type==="ellipse"&&(n.curveFitting=1),n;case"line":case"freedraw":return ja(e.points)&&(n.fillStyle=e.fillStyle,n.fill=e.backgroundColor==="transparent"?void 0:e.backgroundColor),n;case"arrow":return n;default:throw new Error(`Unimplemented type ${e.type}`)}},hA=(e,t,n)=>ts(e)&&(t||lr(e)&&(n==null?void 0:n.get(e.id))!==!0)&&Fs(e.backgroundColor)&&Fs(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:Il(e)?{...e,strokeColor:Fs(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:Fs(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,gA=(e,t,n,i,r,s,o)=>{const a=bA(e,t,n,i);if(a===null)return[];const l=(c,u)=>{if(c===null)return[];const[,,d,f,h,m]=c;return[r.line(d,f,h,m,u)]};switch(i){case"dot":case"circle":case"circle_outline":{const[c,u,d]=a;return delete s.strokeLineDash,[r.circle(c,u,d,{...s,fill:i==="circle_outline"?o:e.strokeColor,fillStyle:"solid",stroke:e.strokeColor,roughness:Math.min(.5,s.roughness||0)})]}case"triangle":case"triangle_outline":{const[c,u,d,f,h,m]=a;return delete s.strokeLineDash,[r.polygon([[c,u],[d,f],[h,m],[c,u]],{...s,fill:i==="triangle_outline"?o:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,s.roughness||0)})]}case"diamond":case"diamond_outline":{const[c,u,d,f,h,m,p,b]=a;return delete s.strokeLineDash,[r.polygon([[c,u],[d,f],[h,m],[p,b],[c,u]],{...s,fill:i==="diamond_outline"?o:e.strokeColor,fillStyle:"solid",roughness:Math.min(1,s.roughness||0)})]}case"crowfoot_one":return l(a,s);case"bar":case"arrow":case"crowfoot_many":case"crowfoot_one_or_many":default:{const[c,u,d,f,h,m]=a;if(e.strokeStyle==="dotted"){const p=UH(e.strokeWidth-1);s.strokeLineDash=[p[0],p[1]-1]}else delete s.strokeLineDash;return s.roughness=Math.min(1,s.roughness||0),[r.line(d,f,c,u,s),r.line(h,m,c,u,s),...i==="crowfoot_one_or_many"?l(bA(e,t,n,"crowfoot_one"),s):[]]}}},r1e=(e,t,{isExporting:n,canvasBackgroundColor:i,embedsValidationStatus:r})=>{switch(e.type){case"rectangle":case"iframe":case"embeddable":{let s;if(e.roundness){const o=e.width,a=e.height,l=$s(Math.min(o,a),e);s=t.path(`M ${l} 0 L ${o-l} 0 Q ${o} 0, ${o} ${l} L ${o} ${a-l} Q ${o} ${a}, ${o-l} ${a} L ${l} ${a} Q 0 ${a}, 0 ${a-l} L 0 ${l} Q 0 0, ${l} 0`,Ir(hA(e,n,r),!0))}else s=t.rectangle(0,0,e.width,e.height,Ir(hA(e,n,r),!1));return s}case"diamond":{let s;const[o,a,l,c,u,d,f,h]=bH(e);if(e.roundness){const m=$s(Math.abs(o-f),e),p=$s(Math.abs(c-a),e);s=t.path(`M ${o+m} ${a+p} L ${l-m} ${c-p}
            C ${l} ${c}, ${l} ${c}, ${l-m} ${c+p}
            L ${u+m} ${d-p}
            C ${u} ${d}, ${u} ${d}, ${u-m} ${d-p}
            L ${f+m} ${h+p}
            C ${f} ${h}, ${f} ${h}, ${f+m} ${h-p}
            L ${o-m} ${a+p}
            C ${o} ${a}, ${o} ${a}, ${o+m} ${a+p}`,Ir(e,!0))}else s=t.polygon([[o,a],[l,c],[u,d],[f,h]],Ir(e));return s}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,Ir(e));case"line":case"arrow":{let s;const o=Ir(e),a=e.points.length?e.points:[C(0,0)];if(ge(e)?a.every(l=>Math.abs(l[0])<=1e6&&Math.abs(l[1])<=1e6)?s=[t.path(s1e(a,16),Ir(e,!0))]:(console.error("Elbow arrow with extreme point positions detected. Arrow not rendered.",e.id,JSON.stringify(a)),s=[]):e.roundness?s=[t.curve(a,o)]:o.fill?s=[t.polygon(a,o)]:s=[t.linearPath(a,o)],e.type==="arrow"){const{startArrowhead:l=null,endArrowhead:c="arrow"}=e;if(l!==null){const u=gA(e,s,"start",l,t,o,i);s.push(...u)}if(c!==null){const u=gA(e,s,"end",c,t,o,i);s.push(...u)}}return s}case"freedraw":{let s;if(Khe(e),ja(e.points)){const o=t1e(e.points,.75);s=t.curve(o,{...Ir(e),stroke:"none"})}else s=null;return s}case"frame":case"magicframe":case"text":case"image":return null;default:return pc(e,`generateElementShape(): Unimplemented type ${e==null?void 0:e.type}`),null}},s1e=(e,t)=>{const n=[];for(let r=1;r<e.length-1;r+=1){const s=e[r-1],o=e[r+1],a=e[r],l=Ea(a,s),c=Ea(o,a),u=Math.min(t,pt(e[r],o)/2,pt(e[r],s)/2);l?s[0]<a[0]?n.push([e[r][0]-u,e[r][1]]):n.push([e[r][0]+u,e[r][1]]):s[1]<a[1]?n.push([e[r][0],e[r][1]-u]):n.push([e[r][0],e[r][1]+u]),n.push(e[r]),c?o[0]<a[0]?n.push([e[r][0]-u,e[r][1]]):n.push([e[r][0]+u,e[r][1]]):o[1]<a[1]?n.push([e[r][0],e[r][1]-u]):n.push([e[r][0],e[r][1]+u])}const i=[`M ${e[0][0]} ${e[0][1]}`];for(let r=0;r<n.length;r+=3)i.push(`L ${n[r][0]} ${n[r][1]}`),i.push(`Q ${n[r+1][0]} ${n[r+1][1]}, ${n[r+2][0]} ${n[r+2][1]}`);return i.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),i.join(" ")},Bf=class Bf{static getBounds(t,n){const i=Bf.boundsCache.get(t);if(i!=null&&i.version&&i.version===t.version&&!Xt(t))return i.bounds;const r=Bf.calculateBounds(t,n);return Bf.boundsCache.set(t,{version:t.version,bounds:r}),r}static calculateBounds(t,n){let i;const[r,s,o,a,l,c]=De(t,n);if(ps(t)){const[u,d,f,h]=i_(t.points.map(([m,p])=>q(C(m,p),C(l-t.x,c-t.y),t.angle)));return[u+t.x,d+t.y,f+t.x,h+t.y]}else if(ke(t))i=d1e(t,l,c,n);else if(t.type==="diamond"){const[u,d]=q(C(l,s),C(l,c),t.angle),[f,h]=q(C(l,a),C(l,c),t.angle),[m,p]=q(C(r,c),C(l,c),t.angle),[b,E]=q(C(o,c),C(l,c),t.angle),y=Math.min(u,f,m,b),v=Math.min(d,h,p,E),_=Math.max(u,f,m,b),I=Math.max(d,h,p,E);i=[y,v,_,I]}else if(t.type==="ellipse"){const u=(o-r)/2,d=(a-s)/2,f=Math.cos(t.angle),h=Math.sin(t.angle),m=Math.hypot(u*f,d*h),p=Math.hypot(d*f,u*h);i=[l-m,c-p,l+m,c+p]}else{const[u,d]=q(C(r,s),C(l,c),t.angle),[f,h]=q(C(r,a),C(l,c),t.angle),[m,p]=q(C(o,a),C(l,c),t.angle),[b,E]=q(C(o,s),C(l,c),t.angle),y=Math.min(u,f,m,b),v=Math.min(d,h,p,E),_=Math.max(u,f,m,b),I=Math.max(d,h,p,E);i=[y,v,_,I]}return i}};F(Bf,"boundsCache",new WeakMap);let IE=Bf;const De=(e,t,n=!1)=>{if(ps(e))return a1e(e);if(ke(e))return ue.getElementAbsoluteCoords(e,t,n);if(de(e)){const i=t?ui(e,t):null;if(Be(i)){const{x:r,y:s}=ue.getBoundTextElementPosition(i,e,t);return[r,s,r+e.width,s+e.height,r+e.width/2,s+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},mA=(e,t)=>{const[n,i,r,s,o,a]=De(e,t),l=C(o,a);if(ke(e)||ps(e)){const E=[];let y=0;for(;y<e.points.length-1;)E.push(we(q(C(e.points[y][0]+e.x,e.points[y][1]+e.y),l,e.angle),q(C(e.points[y+1][0]+e.x,e.points[y+1][1]+e.y),l,e.angle))),y++;return E}const[c,u,d,f,h,m,p,b]=[[n,i],[r,i],[n,s],[r,s],[o,i],[o,s],[n,a],[r,a]].map(E=>q(E,l,e.angle));return e.type==="diamond"?[we(h,p),we(h,b),we(m,p),we(m,b)]:e.type==="ellipse"?[we(h,p),we(h,b),we(m,p),we(m,b),we(h,p),we(h,b),we(m,p),we(m,b)]:[we(c,u),we(d,f),we(c,d),we(u,f),we(c,b),we(d,b),we(u,p),we(f,p)]},bH=e=>{const t=Math.floor(e.width/2)+1,n=0,i=e.width,r=Math.floor(e.height/2)+1,s=t,o=e.height;return[t,n,i,r,s,o,0,r]},pA=(e,t,n,i,r)=>{const s=1-e;return Math.pow(s,3)*t+3*Math.pow(s,2)*e*n+3*s*Math.pow(e,2)*i+Math.pow(e,3)*r},UA=(e,t,n,i)=>{const r=t-e,s=n-t,o=i-n,a=3*r-6*s+3*o,l=6*s-6*r,c=3*r,u=l*l-4*a*c;if(!(u>=0))return!1;let f=null,h=null,m=1/0,p=1/0;return a===0?m=p=-c/l:(m=(-l+Math.sqrt(u))/(2*a),p=(-l-Math.sqrt(u))/(2*a)),m>=0&&m<=1&&(f=pA(m,e,t,n,i)),p>=0&&p<=1&&(h=pA(p,e,t,n,i)),[f,h]},o1e=(e,t,n,i)=>{const r=UA(e[0],t[0],n[0],i[0]),s=UA(e[1],t[1],n[1],i[1]);let o=Math.min(e[0],i[0]),a=Math.max(e[0],i[0]);if(r){const u=r.filter(d=>d!==null);o=Math.min(o,...u),a=Math.max(a,...u)}let l=Math.min(e[1],i[1]),c=Math.max(e[1],i[1]);if(s){const u=s.filter(d=>d!==null);l=Math.min(l,...u),c=Math.max(c,...u)}return[o,l,a,c]},m5=(e,t)=>{let n=C(0,0);const{minX:i,minY:r,maxX:s,maxY:o}=e.reduce((a,{op:l,data:c})=>{if(l==="move"){const u=r9(c);qi(u!=null,"Op data is not a point"),n=u}else if(l==="bcurveTo"){const u=C(c[0],c[1]),d=C(c[2],c[3]),f=C(c[4],c[5]),h=t?t(u):u,m=t?t(d):d,p=t?t(f):f,b=t?t(n):n;n=f;const[E,y,v,_]=o1e(b,h,m,p);a.minX=Math.min(a.minX,E),a.minY=Math.min(a.minY,y),a.maxX=Math.max(a.maxX,v),a.maxY=Math.max(a.maxY,_)}return a},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});return[i,r,s,o]},i_=e=>{let t=1/0,n=1/0,i=-1/0,r=-1/0;for(const[s,o]of e)t=Math.min(t,s),n=Math.min(n,o),i=Math.max(i,s),r=Math.max(r,o);return[t,n,i,r]},a1e=e=>{const[t,n,i,r]=i_(e.points),s=t+e.x,o=n+e.y,a=i+e.x,l=r+e.y;return[s,o,a,l,(s+a)/2,(o+l)/2]},l1e=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;case"crowfoot_many":case"crowfoot_one":case"crowfoot_one_or_many":return 20;default:return 15}},c1e=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},bA=(e,t,n,i)=>{if(t.length<1)return null;const r=Fc(t[0]);if(r.length<1)return null;const s=n==="start"?1:r.length-1,o=r[s].data;qi(o.length===6,"Op data length is not 6");const a=C(o[4],o[5]),l=C(o[2],o[3]),c=C(o[0],o[1]),u=r[s-1];let d=C(0,0);if(u.op==="move"){const V=r9(u.data);qi(V!=null,"Op data is not a point"),d=V}else u.op==="bcurveTo"&&(d=C(u.data[4],u.data[5]));const f=(V,H)=>Math.pow(1-V,3)*a[H]+3*V*Math.pow(1-V,2)*l[H]+3*Math.pow(V,2)*(1-V)*c[H]+d[H]*Math.pow(V,3),[h,m]=n==="start"?d:a,[p,b]=[f(.3,0),f(.3,1)],E=Math.hypot(h-p,m-b),y=(h-p)/E,v=(m-b)/E,_=l1e(i);let I=0;{const[V,H]=n==="end"?e.points[e.points.length-1]:e.points[0],[$,j]=e.points.length>1?n==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];I=Math.hypot(V-$,H-j)}const w=Math.min(_,I*(i==="diamond"||i==="diamond_outline"?.25:.5)),T=h-y*w,A=m-v*w;if(i==="dot"||i==="circle"||i==="circle_outline"){const V=Math.hypot(A-m,T-h)+e.strokeWidth-2;return[h,m,V]}const S=c1e(i);if(i==="crowfoot_many"||i==="crowfoot_one_or_many"){const[V,H]=q(C(h,m),C(T,A),Lu(-S)),[$,j]=q(C(h,m),C(T,A),Lu(S));return[T,A,V,H,$,j]}const[k,N]=q(C(T,A),C(h,m),-S*Math.PI/180),[D,G]=q(C(T,A),C(h,m),Lu(S));if(i==="diamond"||i==="diamond_outline"){let V,H;if(n==="start"){const[$,j]=e.points.length>1?e.points[1]:[0,0];[V,H]=q(C(h+w*2,m),C(h,m),Math.atan2(j-m,$-h))}else{const[$,j]=e.points.length>1?e.points[e.points.length-2]:[0,0];[V,H]=q(C(h-w*2,m),C(h,m),Math.atan2(m-j,h-$))}return[h,m,k,N,V,H,D,G]}return[h,m,k,N,D,G]},u1e=e=>{const t=Pc.generator(),n=Ir(e),i=e.roundness?"curve":n.fill?"polygon":"linearPath";return t[i](e.points,n)},d1e=(e,t,n,i)=>{var d;const r=Oe(e,i);if(e.points.length<2){const[f,h]=e.points[0],[m,p]=q(C(e.x+f,e.y+h),C(t,n),e.angle);let b=[m,p,m,p];if(r){const E=ue.getMinMaxXYWithBoundText(e,i,[m,p,m,p],r);b=[E[0],E[1],E[2],E[3]]}return b}const o=((d=Gt.get(e))==null?void 0:d[0])??u1e(e),a=Fc(o),c=m5(a,([f,h])=>q(C(e.x+f,e.y+h),C(t,n),e.angle));let u=[c[0],c[1],c[2],c[3]];if(r){const f=ue.getMinMaxXYWithBoundText(e,i,u,r);u=[f[0],f[1],f[2],f[3]]}return u},Js=(e,t)=>IE.getBounds(e,t),wt=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,i=-1/0,r=1/0,s=-1/0;const o=t||Se(e);return e.forEach(a=>{const[l,c,u,d]=Js(a,o);n=Math.min(n,l),r=Math.min(r,c),i=Math.max(i,u),s=Math.max(s,d)}),[n,r,i,s]},r_=(e,t)=>{const[n,i,r,s]=wt(e);return[n+t.x,i+t.y,r+t.x,s+t.y]},sc=(e,t,n,i)=>{if(!(ke(e)||ps(e)))return[e.x,e.y,e.x+t,e.y+n];const r=Ab(0,t,Ab(1,n,e.points,i),i);let s;if(ps(e))s=i_(r);else{const u=Pc.generator(),d=e.roundness?u.curve(r,Ir(e)):u.linearPath(r,Ir(e)),f=Fc(d);s=m5(f)}const[o,a,l,c]=s;return[o+e.x,a+e.y,l+e.x,c+e.y]},yA=(e,t)=>{const n=Pc.generator(),i=e.roundness==null?n.linearPath(t,Ir(e)):n.curve(t,Ir(e)),r=Fc(i),[s,o,a,l]=m5(r);return[s+e.x,o+e.y,a+e.x,l+e.y]},f1e=(e,t)=>{if(!e.length)return[0,0,0,0];let n=1/0,i=e[0];const r=Se(e);return e.forEach(s=>{const[o,a,l,c]=Js(s,r),u=pt(C((o+l)/2,(a+c)/2),C(t.x,t.y));u<n&&(n=u,i=s)}),Js(i,r)},js=e=>{const[t,n,i,r]=wt(e);return{minX:t,minY:n,maxX:i,maxY:r,width:i-t,height:r-n,midX:(t+i)/2,midY:(n+r)/2}},yH=({scrollX:e,scrollY:t,width:n,height:i,zoom:r})=>[-e,-t,-e+n/r.value,-t+i/r.value],s_=e=>C(e[0]+(e[2]-e[0])/2,e[1]+(e[3]-e[1])/2),h1e=(e,t)=>{if(e==null||t==null)return!1;const[n,i,r,s]=e,[o,a,l,c]=t;return n<l&&r>o&&i<c&&s>a},g1e=8,EA=99999,p5=e=>g1e/e,Xi=class Xi{};F(Xi,"referenceSnapPoints",null),F(Xi,"visibleGaps",null),F(Xi,"setReferenceSnapPoints",t=>{Xi.referenceSnapPoints=t}),F(Xi,"getReferenceSnapPoints",()=>Xi.referenceSnapPoints),F(Xi,"setVisibleGaps",t=>{Xi.visibleGaps=t}),F(Xi,"getVisibleGaps",()=>Xi.visibleGaps),F(Xi,"destroy",()=>{Xi.referenceSnapPoints=null,Xi.visibleGaps=null});let Ms=Xi;const em=e=>e.props.gridModeEnabled??e.state.gridModeEnabled,vc=({event:e,app:t,selectedElements:n})=>e?t.state.objectsSnapModeEnabled&&!e[z.CTRL_OR_CMD]||!t.state.objectsSnapModeEnabled&&e[z.CTRL_OR_CMD]&&!em(t):n.length===1&&n[0].type==="arrow"?!1:t.state.objectsSnapModeEnabled,m1e=(e,t,n=.01)=>Math.abs(e-t)<=n,tm=(e,t,{omitCenter:n,boundingBoxCorners:i,dragOffset:r}={omitCenter:!1,boundingBoxCorners:!1})=>{let s=[];if(e.length===1){const o=e[0];let[a,l,c,u,d,f]=De(o,t);r&&(a+=r.x,c+=r.x,d+=r.x,l+=r.y,u+=r.y,f+=r.y);const h=(c-a)/2,m=(u-l)/2;if((o.type==="diamond"||o.type==="ellipse")&&!i){const p=q(C(a,l+m),C(d,f),o.angle),b=q(C(a+h,l),C(d,f),o.angle),E=q(C(c,l+m),C(d,f),o.angle),y=q(C(a+h,u),C(d,f),o.angle),v=C(d,f);s=n?[p,b,E,y]:[p,b,E,y,v]}else{const p=q(C(a,l),C(d,f),o.angle),b=q(C(c,l),C(d,f),o.angle),E=q(C(a,u),C(d,f),o.angle),y=q(C(c,u),C(d,f),o.angle),v=C(d,f);s=n?[p,b,E,y]:[p,b,E,y,v]}}else if(e.length>1){const[o,a,l,c]=r_(e,r??{x:0,y:0}),u=l-o,d=c-a,f=C(o,a),h=C(l,a),m=C(o,c),p=C(l,c),b=C(o+u/2,a+d/2);s=n?[f,h,m,p]:[f,h,m,p,b]}return s.map(o=>C(nn(o[0]),nn(o[1])))},EH=(e,t,n,i)=>{const r=t.filter(s=>Ie(s)).map(s=>s.id);return NH(e,t,n,i).filter(s=>!(s.frameId&&r.includes(s.frameId)))},p1e=(e,t,n,i)=>{const r=EH(e,t,n,i),s=j6(r,i).filter(d=>!(d.length===1&&Xt(d[0]))).map(d=>wt(d).map(f=>nn(f))),o=s.sort((d,f)=>d[0]-f[0]),a=[];let l=0;e:for(let d=0;d<o.length;d++){const f=o[d];for(let h=d+1;h<o.length;h++){if(++l>EA)break e;const m=o[h],[,p,b,E]=f,[y,v,,_]=m;b<y&&cb(Ri(p,E),Ri(v,_))&&a.push({startBounds:f,endBounds:m,startSide:[C(b,p),C(b,E)],endSide:[C(y,v),C(y,_)],length:y-b,overlap:ub(Ri(p,E),Ri(v,_))})}}const c=s.sort((d,f)=>d[1]-f[1]),u=[];l=0;e:for(let d=0;d<c.length;d++){const f=c[d];for(let h=d+1;h<c.length;h++){if(++l>EA)break e;const m=c[h],[p,,b,E]=f,[y,v,_]=m;E<v&&cb(Ri(p,b),Ri(y,_))&&u.push({startBounds:f,endBounds:m,startSide:[C(p,E),C(b,E)],endSide:[C(y,v),C(_,v)],length:v-E,overlap:ub(Ri(p,b),Ri(y,_))})}}return{horizontalGaps:a,verticalGaps:u}},vA=(e,t,n,i,r,s,o)=>{if(!vc({app:n,event:i,selectedElements:e}))return[];if(e.length===0)return[];const a=Ms.getVisibleGaps();if(a){const{horizontalGaps:l,verticalGaps:c}=a,[u,d,f,h]=r_(e,t).map(b=>nn(b)),m=(u+f)/2,p=(d+h)/2;for(const b of l){if(!cb(Ri(d,h),b.overlap))continue;const E=b.startSide[0][0]+b.length/2,y=nn(E-m);if(b.length>f-u&&Math.abs(y)<=o.x){Math.abs(y)<o.x&&(r.length=0),o.x=Math.abs(y);const S={type:"gap",direction:"center_horizontal",gap:b,offset:y};r.push(S);continue}const[,,_]=b.endBounds,I=u-_,R=nn(b.length-I);if(Math.abs(R)<=o.x){Math.abs(R)<o.x&&(r.length=0),o.x=Math.abs(R);const S={type:"gap",direction:"side_right",gap:b,offset:R};r.push(S);continue}const[w,,,]=b.startBounds,T=w-f,A=nn(T-b.length);if(Math.abs(A)<=o.x){Math.abs(A)<o.x&&(r.length=0),o.x=Math.abs(A);const S={type:"gap",direction:"side_left",gap:b,offset:A};r.push(S);continue}}for(const b of c){if(!cb(Ri(u,f),b.overlap))continue;const E=b.startSide[0][1]+b.length/2,y=nn(E-p);if(b.length>h-d&&Math.abs(y)<=o.y){Math.abs(y)<o.y&&(s.length=0),o.y=Math.abs(y);const S={type:"gap",direction:"center_vertical",gap:b,offset:y};s.push(S);continue}const[,_,,]=b.startBounds,I=_-h,R=nn(I-b.length);if(Math.abs(R)<=o.y){Math.abs(R)<o.y&&(s.length=0),o.y=Math.abs(R);const S={type:"gap",direction:"side_top",gap:b,offset:R};s.push(S);continue}const[,,,w]=b.endBounds,T=nn(d-w),A=b.length-T;if(Math.abs(A)<=o.y){Math.abs(A)<o.y&&(s.length=0),o.y=Math.abs(A);const S={type:"gap",direction:"side_bottom",gap:b,offset:A};s.push(S);continue}}}},U1e=(e,t,n,i)=>{const r=EH(e,t,n,i);return j6(r,i).filter(s=>!(s.length===1&&Xt(s[0]))).flatMap(s=>tm(s,i))},Sh=(e,t,n,i,r,s,o)=>{if(!vc({app:n,event:i,selectedElements:e})||e.length===0&&t.length===0)return[];const a=Ms.getReferenceSnapPoints();if(a)for(const l of t)for(const c of a){const u=c[0]-l[0],d=c[1]-l[1];Math.abs(u)<=o.x&&(Math.abs(u)<o.x&&(r.length=0),r.push({type:"point",points:[l,c],offset:u}),o.x=Math.abs(u)),Math.abs(d)<=o.y&&(Math.abs(d)<o.y&&(s.length=0),s.push({type:"point",points:[l,c],offset:d}),o.y=Math.abs(d))}},b1e=(e,t,n,i,r)=>{var b,E;const s=n.state,o=Fe(e,s);if(!vc({app:n,event:i,selectedElements:o})||o.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=nn(t.x),t.y=nn(t.y);const a=[],l=[],c=p5(s.zoom.value),u={x:c,y:c},d=tm(o,r,{dragOffset:t});Sh(o,d,n,i,a,l,u),vA(o,t,n,i,a,l,u);const f={x:((b=a[0])==null?void 0:b.offset)??0,y:((E=l[0])==null?void 0:E.offset)??0};u.x=0,u.y=0,a.length=0,l.length=0;const h={x:nn(t.x+f.x),y:nn(t.y+f.y)};Sh(o,tm(o,r,{dragOffset:h}),n,i,a,l,u),vA(o,h,n,i,a,l,u);const m=o_(a,l),p=E1e(o,h,[...a,...l].filter(y=>y.type==="gap"));return{snapOffset:f,snapLines:[...m,...p]}},nn=e=>Math.round(e*10**6)/10**6,_A=e=>{const t=new Map;for(const n of e){const i=n.join(",");t.has(i)||t.set(i,n)}return Array.from(t.values())},o_=(e,t)=>{const n={},i={};if(e.length>0){for(const r of e)if(r.type==="point"){const s=nn(r.points[0][0]);n[s]||(n[s]=[]),n[s].push(...r.points.map(o=>C(nn(o[0]),nn(o[1]))))}}if(t.length>0){for(const r of t)if(r.type==="point"){const s=nn(r.points[0][1]);i[s]||(i[s]=[]),i[s].push(...r.points.map(o=>C(nn(o[0]),nn(o[1]))))}}return Object.entries(n).map(([r,s])=>({type:"points",points:_A(s.map(o=>C(Number(r),o[1])).sort((o,a)=>o[1]-a[1]))})).concat(Object.entries(i).map(([r,s])=>({type:"points",points:_A(s.map(o=>C(o[0],Number(r))).sort((o,a)=>o[0]-a[0]))})))},y1e=e=>{const t=new Map;for(const n of e){const i=n.points.flat().map(r=>[nn(r)]).join(",");t.has(i)||t.set(i,n)}return Array.from(t.values())},E1e=(e,t,n)=>{const[i,r,s,o]=r_(e,t),a=[];for(const l of n){const[c,u,d,f]=l.gap.startBounds,[h,m,p,b]=l.gap.endBounds,E=ub(Ri(r,o),l.gap.overlap),y=ub(Ri(i,s),l.gap.overlap);switch(l.direction){case"center_horizontal":{if(E){const v=(E[0]+E[1])/2;a.push({type:"gap",direction:"horizontal",points:[C(l.gap.startSide[0][0],v),C(i,v)]},{type:"gap",direction:"horizontal",points:[C(s,v),C(l.gap.endSide[0][0],v)]})}break}case"center_vertical":{if(y){const v=(y[0]+y[1])/2;a.push({type:"gap",direction:"vertical",points:[C(v,l.gap.startSide[0][1]),C(v,r)]},{type:"gap",direction:"vertical",points:[C(v,o),C(v,l.gap.endSide[0][1])]})}break}case"side_right":{if(E){const v=(E[0]+E[1])/2;a.push({type:"gap",direction:"horizontal",points:[C(d,v),C(h,v)]},{type:"gap",direction:"horizontal",points:[C(p,v),C(i,v)]})}break}case"side_left":{if(E){const v=(E[0]+E[1])/2;a.push({type:"gap",direction:"horizontal",points:[C(s,v),C(c,v)]},{type:"gap",direction:"horizontal",points:[C(d,v),C(h,v)]})}break}case"side_top":{if(y){const v=(y[0]+y[1])/2;a.push({type:"gap",direction:"vertical",points:[C(v,o),C(v,u)]},{type:"gap",direction:"vertical",points:[C(v,f),C(v,m)]})}break}case"side_bottom":{if(y){const v=(y[0]+y[1])/2;a.push({type:"gap",direction:"vertical",points:[C(v,f),C(v,m)]},{type:"gap",direction:"vertical",points:[C(v,b),C(v,r)]})}break}}}return y1e(a.map(l=>({...l,points:l.points.map(c=>C(nn(c[0]),nn(c[1])))})))},wA=(e,t,n,i,r,s)=>{var R,w;if(!vc({event:i,selectedElements:e,app:n})||e.length===0||e.length===1&&!m1e(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[o,a,l,c]=wt(t);s&&(s.includes("e")?l+=r.x:s.includes("w")&&(o+=r.x),s.includes("n")?a+=r.y:s.includes("s")&&(c+=r.y));const u=[];if(s)switch(s){case"e":{u.push(C(l,a),C(l,c));break}case"w":{u.push(C(o,a),C(o,c));break}case"n":{u.push(C(o,a),C(l,a));break}case"s":{u.push(C(o,c),C(l,c));break}case"ne":{u.push(C(l,a));break}case"nw":{u.push(C(o,a));break}case"se":{u.push(C(l,c));break}case"sw":{u.push(C(o,c));break}}const d=p5(n.state.zoom.value),f={x:d,y:d},h=[],m=[];Sh(t,u,n,i,h,m,f);const p={x:((R=h[0])==null?void 0:R.offset)??0,y:((w=m[0])==null?void 0:w.offset)??0};f.x=0,f.y=0,h.length=0,m.length=0;const[b,E,y,v]=wt(e).map(T=>nn(T)),_=[C(b,E),C(b,v),C(y,E),C(y,v)];Sh(e,_,n,i,h,m,f);const I=o_(h,m);return{snapOffset:p,snapLines:I}},v1e=(e,t,n,i,r,s)=>{var m,p;if(!vc({event:n,selectedElements:[e],app:t}))return{snapOffset:{x:0,y:0},snapLines:[]};const o=[C(i.x+r.x,i.y+r.y)],a=p5(t.state.zoom.value),l={x:a,y:a},c=[],u=[];Sh([e],o,t,n,c,u,l);const d={x:((m=c[0])==null?void 0:m.offset)??0,y:((p=u[0])==null?void 0:p.offset)??0};l.x=0,l.y=0,c.length=0,u.length=0;const f=tm([e],s,{boundingBoxCorners:!0,omitCenter:!0});Sh([e],f,t,n,c,u,l);const h=o_(c,u);return{snapOffset:d,snapLines:h}},_1e=(e,t,n,i,r)=>{if(!vc({event:i,selectedElements:[],app:t}))return{originOffset:{x:0,y:0},snapLines:[]};const s=NH(e,[],t.state,r),o=p5(t.state.zoom.value),a={x:o,y:o},l=[],c=[];for(const u of s){const d=tm([u],r);for(const f of d){const h=f[0]-n.x;Math.abs(h)<=Math.abs(a.x)&&(Math.abs(h)<Math.abs(a.x)&&(c.length=0),c.push({type:"pointer",points:[f,C(f[0],n.y)],direction:"vertical"}),a.x=h);const m=f[1]-n.y;Math.abs(m)<=Math.abs(a.y)&&(Math.abs(m)<Math.abs(a.y)&&(l.length=0),l.push({type:"pointer",points:[f,C(n.x,f[1])],direction:"horizontal"}),a.y=m)}}return{originOffset:{x:c.length>0?c[0].points[0][0]-n.x:0,y:l.length>0?l[0].points[0][1]-n.y:0},snapLines:[...c,...l]}},w1e=e=>e===Gn.rectangle||e===Gn.ellipse||e===Gn.diamond||e===Gn.frame||e===Gn.magicframe||e===Gn.image||e===Gn.text,Rn=(e,t,n)=>n?[Math.round(e/n)*n,Math.round(t/n)*n]:[e,t],aa={version:null,points:[],zoom:null},ve=class ve{constructor(t){F(this,"elementId");F(this,"selectedPointsIndices");F(this,"pointerDownState");F(this,"isDragging");F(this,"lastUncommittedPoint");F(this,"pointerOffset");F(this,"startBindingElement");F(this,"endBindingElement");F(this,"hoverPointIndex");F(this,"segmentMidPointHoveredCoords");F(this,"elbowed");this.elementId=t.id,Zs(t.points[0],C(0,0))||console.error("Linear element is not normalized",Error().stack),this.selectedPointsIndices=null,this.lastUncommittedPoint=null,this.isDragging=!1,this.pointerOffset={x:0,y:0},this.startBindingElement="keep",this.endBindingElement="keep",this.pointerDownState={prevSelectedPointsIndices:null,lastClickedPoint:-1,lastClickedIsEndPoint:!1,origin:null,segmentMidpoint:{value:null,index:null,added:!1}},this.hoverPointIndex=-1,this.segmentMidPointHoveredCoords=null,this.elbowed=ge(t)&&t.elbowed}static getElement(t,n){const i=n.get(t);return i||null}static handleBoxSelection(t,n,i,r){if(!n.editingLinearElement||!n.selectionElement)return!1;const{editingLinearElement:s}=n,{selectedPointsIndices:o,elementId:a}=s,l=ve.getElement(a,r);if(!l)return!1;const[c,u,d,f]=De(n.selectionElement,r),m=ve.getPointsGlobalCoordinates(l,r).reduce((p,b,E)=>((b[0]>=c&&b[0]<=d&&b[1]>=u&&b[1]<=f||t.shiftKey&&(o!=null&&o.includes(E)))&&p.push(E),p),[]).filter(p=>!(ge(l)&&p!==0&&p!==l.points.length-1));i({editingLinearElement:{...s,selectedPointsIndices:m.length?m:null}})}static handlePointDragging(t,n,i,r,s,o,a){var m;if(!o)return!1;const{elementId:l}=o,c=a.getNonDeletedElementsMap(),u=ve.getElement(l,c);if(!u||ge(u)&&!o.pointerDownState.lastClickedIsEndPoint&&o.pointerDownState.lastClickedPoint!==0)return!1;const d=ge(u)?(m=o.selectedPointsIndices)==null?void 0:m.reduce((p,b)=>b===0?[0,p[1]]:[p[0],u.points.length-1],[!1,!1]).filter(p=>typeof p=="number"):o.selectedPointsIndices,f=ge(u)?o.pointerDownState.lastClickedPoint>0?u.points.length-1:0:o.pointerDownState.lastClickedPoint,h=u.points[f];if(d&&h){if(jg(t)&&d.length===1&&u.points.length>1){const b=d[0],E=u.points[b===0?1:b-1],[y,v]=ve._getShiftLockedDelta(u,c,E,C(i,r),t[z.CTRL_OR_CMD]?null:n.getEffectiveGridSize());ve.movePoints(u,[{index:b,point:C(y+E[0],v+E[1]),isDragging:b===f}])}else{const b=ve.createPointAt(u,c,i-o.pointerOffset.x,r-o.pointerOffset.y,t[z.CTRL_OR_CMD]?null:n.getEffectiveGridSize()),E=b[0]-h[0],y=b[1]-h[1];ve.movePoints(u,d.map(v=>{const _=v===f?ve.createPointAt(u,c,i-o.pointerOffset.x,r-o.pointerOffset.y,t[z.CTRL_OR_CMD]?null:n.getEffectiveGridSize()):C(u.points[v][0]+E,u.points[v][1]+y);return{index:v,point:_,isDragging:v===f}}))}if(Oe(u,c)&&Wm(u,c,!1),So(u,!1)){const b=[];d[0]===0&&b.push(Ps(ve.getPointGlobalCoordinates(u,u.points[0],c)));const y=d[d.length-1];y===u.points.length-1&&b.push(Ps(ve.getPointGlobalCoordinates(u,u.points[y],c))),b.length&&s(u,b)}return!0}return!1}static handlePointerUp(t,n,i,r){var h;const s=r.getNonDeletedElementsMap(),o=r.getNonDeletedElements(),{elementId:a,selectedPointsIndices:l,isDragging:c,pointerDownState:u}=n,d=ve.getElement(a,s);if(!d)return n;const f={};if(c&&l){for(const m of l)if(m===0||m===d.points.length-1){ja(d.points,i.zoom.value)&&ve.movePoints(d,[{index:m,point:m===0?d.points[d.points.length-1]:d.points[0]}]);const p=bu(i)?zs(Ps(ve.getPointAtIndexGlobalCoordinates(d,m,s)),o,s,i.zoom,ge(d),ge(d)):null;f[m===0?"startBindingElement":"endBindingElement"]=p}}return{...n,...f,selectedPointsIndices:c||t.shiftKey?!c&&t.shiftKey&&((h=u.prevSelectedPointsIndices)!=null&&h.includes(u.lastClickedPoint))?l&&l.filter(m=>m!==u.lastClickedPoint):l:l!=null&&l.includes(u.lastClickedPoint)?[u.lastClickedPoint]:l,isDragging:!1,pointerOffset:{x:0,y:0}}}static isSegmentTooShort(t,n,i,r,s){if(ge(t))return r>=0&&r<t.points.length?pt(n,i)*s.value<ve.POINT_HANDLE_SIZE/2:!1;let o=pt(n,i);return t.points.length>2&&t.roundness&&(o=Lle(t,i)),o*s.value<ve.POINT_HANDLE_SIZE*4}static getSegmentMidPoint(t,n,i,r,s){let o=N0(n,i);if(t.points.length>2&&t.roundness){const a=mB(t,t.points[r]);if(a){const l=Dle(t,t.points[r],.5);o=ve.getPointGlobalCoordinates(t,pB(a[0],a[1],a[2],a[3],l),s)}}return o}static getSegmentMidPointIndex(t,n,i,r){const s=ve.getElement(t.elementId,r);if(!s)return-1;const o=ve.getEditorMidPoints(s,r,n);let a=0;for(;a<o.length;){if(ve.arePointsEqual(i,o[a]))return a+1;a++}return-1}static handlePointerDown(t,n,i,r,s,o){var T;const a=n.state,l=o.getNonDeletedElementsMap(),c=o.getNonDeletedElements(),u={didAddPoint:!1,hitElement:null,linearElementEditor:null};if(!s)return u;const{elementId:d}=s,f=ve.getElement(d,l);if(!f)return u;const h=ve.getSegmentMidpointHitCoords(s,r,a,l);let m=null;if(h)m=ve.getSegmentMidPointIndex(s,a,h,l);else if(t.altKey&&a.editingLinearElement)return s.lastUncommittedPoint==null&&(ee(f,{points:[...f.points,ve.createPointAt(f,l,r.x,r.y,t[z.CTRL_OR_CMD]?null:n.getEffectiveGridSize())]}),u.didAddPoint=!0),i.shouldCaptureIncrement(),u.linearElementEditor={...s,pointerDownState:{prevSelectedPointsIndices:s.selectedPointsIndices,lastClickedPoint:-1,lastClickedIsEndPoint:!1,origin:{x:r.x,y:r.y},segmentMidpoint:{value:h,index:m,added:!1}},selectedPointsIndices:[f.points.length-1],lastUncommittedPoint:null,endBindingElement:zs(r,c,l,n.state.zoom,s.elbowed)},u.didAddPoint=!0,u;const p=ve.getPointIndexUnderCursor(f,l,a.zoom,r.x,r.y);if(p>=0||h)u.hitElement=f;else{const{startBindingElement:A,endBindingElement:S}=s;bu(a)&&So(f)&&q6(f,A,S,l,o)}const[b,E,y,v]=De(f,l),_=(b+y)/2,I=(E+v)/2,R=p>-1&&q(C(f.x+f.points[p][0],f.y+f.points[p][1]),C(_,I),f.angle),w=p>-1||t.shiftKey?t.shiftKey||(T=s.selectedPointsIndices)!=null&&T.includes(p)?T1e([...s.selectedPointsIndices||[],p]):[p]:null;return u.linearElementEditor={...s,pointerDownState:{prevSelectedPointsIndices:s.selectedPointsIndices,lastClickedPoint:p,lastClickedIsEndPoint:p===f.points.length-1,origin:{x:r.x,y:r.y},segmentMidpoint:{value:h,index:m,added:!1}},selectedPointsIndices:w,pointerOffset:R?{x:r.x-R[0],y:r.y-R[1]}:{x:0,y:0}},u}static arePointsEqual(t,n){return!t&&!n?!0:!t||!n?!1:Zs(t,n)}static handlePointerMove(t,n,i,r,s){const o=r.state;if(!o.editingLinearElement)return null;const{elementId:a,lastUncommittedPoint:l}=o.editingLinearElement,c=ve.getElement(a,s);if(!c)return o.editingLinearElement;const{points:u}=c,d=u[u.length-1];if(!t.altKey)return d===l&&ve.deletePoints(c,[u.length-1]),{...o.editingLinearElement,lastUncommittedPoint:null};let f;if(jg(t)&&u.length>=2){const h=u[u.length-2],[m,p]=ve._getShiftLockedDelta(c,s,h,C(n,i),t[z.CTRL_OR_CMD]?null:r.getEffectiveGridSize());f=C(m+h[0],p+h[1])}else f=ve.createPointAt(c,s,n-o.editingLinearElement.pointerOffset.x,i-o.editingLinearElement.pointerOffset.y,t[z.CTRL_OR_CMD]||ge(c)?null:r.getEffectiveGridSize());return d===l?ve.movePoints(c,[{index:c.points.length-1,point:f}]):ve.addPoints(c,[{point:f}]),{...o.editingLinearElement,lastUncommittedPoint:c.points[c.points.length-1]}}static getPointGlobalCoordinates(t,n,i){const[r,s,o,a]=De(t,i),l=(r+o)/2,c=(s+a)/2,{x:u,y:d}=t;return q(C(u+n[0],d+n[1]),C(l,c),t.angle)}static getPointsGlobalCoordinates(t,n){const[i,r,s,o]=De(t,n),a=(i+s)/2,l=(r+o)/2;return t.points.map(c=>{const{x:u,y:d}=t;return q(C(u+c[0],d+c[1]),C(a,l),t.angle)})}static getPointAtIndexGlobalCoordinates(t,n,i){const r=n<0?t.points.length+n:n,[s,o,a,l]=De(t,i),c=(s+a)/2,u=(o+l)/2,d=t.points[r],{x:f,y:h}=t;return q(d?C(f+d[0],h+d[1]):C(f,h),C(c,u),t.angle)}static pointFromAbsoluteCoords(t,n,i){if(ge(t))return C(n[0]-t.x,n[1]-t.y);const[r,s,o,a]=De(t,i),l=(r+o)/2,c=(s+a)/2,[u,d]=q(C(n[0],n[1]),C(l,c),-t.angle);return C(u-t.x,d-t.y)}static getPointIndexUnderCursor(t,n,i,r,s){const o=ve.getPointsGlobalCoordinates(t,n);let a=o.length;for(;--a>-1;){const l=o[a];if(pt(C(r,s),C(l[0],l[1]))*i.value<ve.POINT_HANDLE_SIZE+1)return a}return-1}static createPointAt(t,n,i,r,s){const o=Rn(i,r,s),[a,l,c,u]=De(t,n),d=(a+c)/2,f=(l+u)/2,[h,m]=q(C(o[0],o[1]),C(d,f),-t.angle);return C(h-t.x,m-t.y)}static getNormalizedPoints(t){const{points:n}=t,i=n[0][0],r=n[0][1];return{points:n.map(s=>C(s[0]-i,s[1]-r)),x:t.x+i,y:t.y+r}}static normalizePoints(t){ee(t,ve.getNormalizedPoints(t))}static duplicateSelectedPoints(t,n){qi(t.editingLinearElement,"Not currently editing a linear element");const{selectedPointsIndices:i,elementId:r}=t.editingLinearElement,s=ve.getElement(r,n);qi(s,"The linear element does not exist in the provided Scene"),qi(i!=null,"There are no selected points to duplicate");const{points:o}=s,a=[];let l=!1,c=-1;const u=o.reduce((d,f,h)=>{if(++c,d.push(f),i.includes(h)){const p=o[h+1];p||(l=!0),d.push(p?C((f[0]+p[0])/2,(f[1]+p[1])/2):C(f[0],f[1])),a.push(c+1),++c}return d},[]);if(ee(s,{points:u}),l){const d=s.points[s.points.length-1];ve.movePoints(s,[{index:s.points.length-1,point:C(d[0]+30,d[1]+30)}])}return{...t,editingLinearElement:{...t.editingLinearElement,selectedPointsIndices:a}}}static deletePoints(t,n){let i=0,r=0;if(n.includes(0)){const a=t.points.find((l,c)=>!n.includes(c));a&&(i=a[0],r=a[1])}const o=t.points.reduce((a,l,c)=>(n.includes(c)||a.push(a.length?C(l[0]-i,l[1]-r):C(0,0)),a),[]);ve._updatePoints(t,o,i,r)}static addPoints(t,n){const s=[...t.points,...n.map(o=>o.point)];ve._updatePoints(t,s,0,0)}static movePoints(t,n,i){var u,d,f;const{points:r}=t,[s,o]=((u=n.find(({index:h})=>h===0))==null?void 0:u.point)??C(0,0),[a,l]=C(s-r[0][0],o-r[0][1]),c=ge(t)?[((d=n.find(h=>h.index===0))==null?void 0:d.point)??r[0],((f=n.find(h=>h.index===r.length-1))==null?void 0:f.point)??r[r.length-1]]:r.map((h,m)=>{var b;const p=((b=n.find(E=>E.index===m))==null?void 0:b.point)??h;return C(p[0]-a,p[1]-l)});ve._updatePoints(t,c,a,l,i,{isDragging:n.reduce((h,m)=>h||m.isDragging===!0,!1)})}static shouldAddMidpoint(t,n,i,r){const s=ve.getElement(t.elementId,r);if(s&&ge(s)||!s)return!1;const{segmentMidpoint:o}=t.pointerDownState;if(o.added||o.value===null||o.index===null||t.pointerDownState.origin===null)return!1;const a=t.pointerDownState.origin,l=pt(C(a.x,a.y),C(n.x,n.y));return!(!i.editingLinearElement&&l<eu/i.zoom.value)}static addMidpoint(t,n,i,r,s){const o=ve.getElement(t.elementId,s);if(!o)return;const{segmentMidpoint:a}=t.pointerDownState,l={pointerDownState:t.pointerDownState,selectedPointsIndices:t.selectedPointsIndices},c=ve.createPointAt(o,s,n.x,n.y,r&&!ge(o)?i.getEffectiveGridSize():null),u=[...o.points.slice(0,a.index),c,...o.points.slice(a.index)];return ee(o,{points:u}),l.pointerDownState={...t.pointerDownState,segmentMidpoint:{...t.pointerDownState.segmentMidpoint,added:!0},lastClickedPoint:a.index},l.selectedPointsIndices=[a.index],l}static _updatePoints(t,n,i,r,s,o){if(ge(t)){const a={};(s==null?void 0:s.startBinding)!==void 0&&(a.startBinding=s.startBinding!==null&&db(s.startBinding)?s.startBinding:null),(s==null?void 0:s.endBinding)!==void 0&&(a.endBinding=s.endBinding!==null&&db(s.endBinding)?s.endBinding:null),a.points=Array.from(n),ee(t,a,!0,{isDragging:o==null?void 0:o.isDragging})}else{const a=yA(t,n),l=yA(t,t.points),c=(a[0]+a[2])/2,u=(a[1]+a[3])/2,d=(l[0]+l[2])/2,f=(l[1]+l[3])/2,h=d-c,m=f-u,p=q(C(i,r),C(h,m),t.angle);ee(t,{...s,points:n,x:t.x+p[0],y:t.y+p[1]})}}static _getShiftLockedDelta(t,n,i,r,s){const o=ve.getPointGlobalCoordinates(t,i,n);if(ge(t))return[r[0]-o[0],r[1]-o[1]];const[a,l]=Rn(r[0],r[1],s),{width:c,height:u}=CE(o[0],o[1],a,l);return q(C(c,u),C(0,0),-t.angle)}static moveFixedSegment(t,n,i,r,s){const o=ve.getElement(t.elementId,s);if(!o||!ge(o))return t;if(n&&n>0&&n<o.points.length){const a=Ca(Qu(_e(o.points[n],o.points[n-1]))),l=(o.fixedSegments??[]).reduce((f,h)=>(f[h.index]=h,f),{});l[n]={index:n,start:C(a?o.points[n-1][0]:i-o.x,a?r-o.y:o.points[n-1][1]),end:C(a?o.points[n][0]:i-o.x,a?r-o.y:o.points[n][1])};const c=Object.values(l).sort((f,h)=>f.index-h.index),u=c.map(f=>f.index).reduce((f,h)=>h<n?f+1:f,0);ee(o,{fixedSegments:c});const d=C(o.x+(o.fixedSegments[u].start[0]+o.fixedSegments[u].end[0])/2,o.y+(o.fixedSegments[u].start[1]+o.fixedSegments[u].end[1])/2);return{...t,segmentMidPointHoveredCoords:d,pointerDownState:{...t.pointerDownState,segmentMidpoint:{added:!1,index:o.fixedSegments[u].index,value:d}}}}return t}static deleteFixedSegment(t,n){var i;ee(t,{fixedSegments:(i=t.fixedSegments)==null?void 0:i.filter(r=>r.index!==n)}),ee(t,{},!0)}};F(ve,"POINT_HANDLE_SIZE",10),F(ve,"getEditorMidPoints",(t,n,i)=>{const r=Oe(t,n);return!ge(t)&&!i.editingLinearElement&&t.points.length>2&&!r?[]:(aa.version===t.version&&aa.zoom===i.zoom.value||ve.updateEditorMidPointsCache(t,n,i),aa.points)}),F(ve,"updateEditorMidPointsCache",(t,n,i)=>{const r=ve.getPointsGlobalCoordinates(t,n);let s=0;const o=[];for(;s<r.length-1;){if(ve.isSegmentTooShort(t,t.points[s],t.points[s+1],s,i.zoom)){o.push(null),s++;continue}const a=ve.getSegmentMidPoint(t,r[s],r[s+1],s+1,n);o.push(a),s++}aa.points=o,aa.version=t.version,aa.zoom=i.zoom.value}),F(ve,"getSegmentMidpointHitCoords",(t,n,i,r)=>{const{elementId:s}=t,o=ve.getElement(s,r);if(!o)return null;const a=ve.getPointIndexUnderCursor(o,r,i.zoom,n.x,n.y);if(!ge(o)&&a>=0||ve.getPointsGlobalCoordinates(o,r).length>=3&&!i.editingLinearElement&&!ge(o))return null;const c=(ve.POINT_HANDLE_SIZE+1)/i.zoom.value,u=t.segmentMidPointHoveredCoords;if(u&&pt(C(u[0],u[1]),C(n.x,n.y))<=c)return u;let d=0;const f=ve.getEditorMidPoints(o,r,i);for(;d<f.length;){if(f[d]!==null&&pt(f[d],C(n.x,n.y))<=c)return f[d];d++}return null}),F(ve,"getBoundTextElementPosition",(t,n,i)=>{const r=ve.getPointsGlobalCoordinates(t,i);r.length<2&&ee(n,{isDeleted:!0});let s=0,o=0;if(t.points.length%2===1){const a=Math.floor(t.points.length/2),l=ve.getPointGlobalCoordinates(t,t.points[a],i);s=l[0]-n.width/2,o=l[1]-n.height/2}else{const a=t.points.length/2-1;let l=aa.points[a];t.points.length===2&&(l=N0(r[0],r[1])),(!l||aa.version!==t.version)&&(l=ve.getSegmentMidPoint(t,r[a],r[a+1],a+1,i)),s=l[0]-n.width/2,o=l[1]-n.height/2}return{x:s,y:o}}),F(ve,"getMinMaxXYWithBoundText",(t,n,i,r)=>{let[s,o,a,l]=i;const c=(s+a)/2,u=(o+l)/2,{x:d,y:f}=ve.getBoundTextElementPosition(t,r,n),h=d+r.width,m=f+r.height,p=C(c,u),b=q(C(s,o),p,t.angle),E=q(C(a,o),p,t.angle),y=q(C(d,f),p,-t.angle),v=q(C(h,f),p,-t.angle),_=q(C(d,m),p,-t.angle),I=q(C(h,m),p,-t.angle);return b[0]<E[0]&&b[1]>=E[1]?(s=Math.min(s,_[0]),a=Math.max(a,Math.max(v[0],I[0])),o=Math.min(o,y[1]),l=Math.max(l,I[1])):b[0]>=E[0]&&b[1]>E[1]?(s=Math.min(s,I[0]),a=Math.max(a,Math.max(y[0],v[0])),o=Math.min(o,_[1]),l=Math.max(l,v[1])):b[0]>=E[0]?(s=Math.min(s,v[0]),a=Math.max(a,_[0]),o=Math.min(o,I[1]),l=Math.max(l,y[1])):b[1]<=E[1]&&(s=Math.min(s,Math.min(v[0],y[0])),a=Math.max(a,I[0]),o=Math.min(o,v[1]),l=Math.max(l,_[1])),[s,o,a,l,c,u]}),F(ve,"getElementAbsoluteCoords",(t,n,i=!1)=>{let r,s,o,a,l;if(t.points.length<2||!Gt.get(t)){const{minX:f,minY:h,maxX:m,maxY:p}=t.points.reduce((b,[E,y])=>(b.minY=Math.min(b.minY,y),b.minX=Math.min(b.minX,E),b.maxX=Math.max(b.maxX,E),b.maxY=Math.max(b.maxY,y),b),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});s=f+t.x,o=h+t.y,a=m+t.x,l=p+t.y}else{const f=Gt.generateElementShape(t,null),h=Fc(f[0]),[m,p,b,E]=m5(h);s=m+t.x,o=p+t.y,a=b+t.x,l=E+t.y}const c=(s+a)/2,u=(o+l)/2;if(r=[s,o,a,l,c,u],!i)return r;const d=Oe(t,n);return d&&(r=ve.getMinMaxXYWithBoundText(t,n,[s,o,a,l],d)),r});let ue=ve;const T1e=e=>{let t=[...new Set(e.filter(n=>n!==null&&n!==-1))];return t=t.sort((n,i)=>n-i),t.length?t:null},Ih={},Db=(e,t)=>{const n=Ih[e]||(Ih[e]={height:t});return n.height=t,n},vH=e=>{Ih[e]&&delete Ih[e]},S1e=e=>{var t;return((t=Ih[e])==null?void 0:t.height)??null},Qi=(e,t,n,i=!0)=>{let r;const s={x:e.x,y:e.y,text:e.text,width:e.width,height:e.height,angle:(t==null?void 0:t.angle)??e.angle};s.text=e.text,(t||!e.autoResize)&&(r=t?Ka(t,e):e.width,s.text=Id(e.originalText,xt(e),r));const o=zi(s.text,xt(e),e.lineHeight);if(e.autoResize&&(s.width=o.width),s.height=o.height,t){const a=b5(t,e),l=Ka(t,e);if(!Be(t)&&o.height>a){const f=sd(o.height,t.type);ee(t,{height:f},i),Db(t.id,f)}if(o.width>l){const f=sd(o.width,t.type);ee(t,{width:f},i)}const c={...e,...s},{x:u,y:d}=U5(t,c,n);s.x=u,s.y=d}ee(e,s,i)},_H=(e,t,n)=>{const i=Se(e);t.forEach(r=>{const s=n.get(r.id),o=Wa(r);if(o){const a=n.get(o);if(a){const l=i.get(s);l&&ee(l,{boundElements:(r.boundElements||[]).filter(u=>u.id!==a&&u.id!==o).concat({type:"text",id:a})});const c=i.get(a);c&&de(c)&&ee(c,{containerId:l?s:null})}}})},Wm=(e,t,n,i=!1)=>{if(!Wa(e))return;vH(e.id);const s=Oe(e,t);if(s&&s.text){if(!e)return;let o=s.text,a=s.height,l=s.width;const c=Ka(e,s),u=b5(e,s);let d=e.height;if(i||n!=="n"&&n!=="s"){o&&(o=Id(s.originalText,xt(s),c));const f=zi(o,xt(s),s.lineHeight);a=f.height,l=f.width}if(a>u){d=sd(a,e.type);const f=d-e.height,h=!Be(e)&&(n==="ne"||n==="nw"||n==="n")?e.y-f:e.y;ee(e,{height:d,y:h})}ee(s,{text:o,width:l,height:a}),Be(e)||ee(s,U5(e,s,t))}},U5=(e,t,n)=>{if(Be(e))return ue.getBoundTextElementPosition(e,t,n);const i=I1e(e),r=b5(e,t),s=Ka(e,t);let o,a;return t.verticalAlign===Ar.TOP?a=i.y:t.verticalAlign===Ar.BOTTOM?a=i.y+(r-t.height):a=i.y+(r/2-t.height/2),t.textAlign===R0.LEFT?o=i.x:t.textAlign===R0.RIGHT?o=i.x+(s-t.width):o=i.x+(s/2-t.width/2),{x:o,y:a}},Wa=e=>{var t,n,i;return(t=e==null?void 0:e.boundElements)!=null&&t.length&&((i=(n=e==null?void 0:e.boundElements)==null?void 0:n.find(r=>r.type==="text"))==null?void 0:i.id)||null},Oe=(e,t)=>{if(!e)return null;const n=Wa(e);return n&&t.get(n)||null},ui=(e,t)=>e&&e.containerId&&t.get(e.containerId)||null,j8=(e,t,n)=>{if(!Be(e))return{x:e.x+e.width/2,y:e.y+e.height/2};const i=ue.getPointsGlobalCoordinates(e,n);if(i.length%2===1){const o=Math.floor(e.points.length/2),a=ue.getPointGlobalCoordinates(e,e.points[o],n);return{x:a[0],y:a[1]}}const r=e.points.length/2-1;let s=ue.getEditorMidPoints(e,n,t)[r];return s||(s=ue.getSegmentMidPoint(e,i[r],i[r+1],r+1,n)),{x:s[0],y:s[1]}},I1e=e=>{let t=Nn,n=Nn;return e.type==="ellipse"&&(t+=e.width/2*(1-Math.sqrt(2)/2),n+=e.height/2*(1-Math.sqrt(2)/2)),e.type==="diamond"&&(t+=e.width/4,n+=e.height/4),{x:e.x+t,y:e.y+n}},x1e=(e,t)=>!t||Be(t)?e.angle:t.angle,C1e=(e,t)=>e.some(n=>{if(Xt(n)){const i=ui(n,t);return!Be(i)}return!1}),A1e=(e,t)=>e.some(n=>{if(Xt(n)){const i=ui(n,t);return!Be(i)}return de(n)}),M1e=new Set(["rectangle","ellipse","diamond","arrow"]),R1e=e=>M1e.has(e.type),sd=(e,t)=>{e=Math.ceil(e);const n=Nn*2;return t==="ellipse"?Math.round((e+n)/Math.sqrt(2)*2):t==="arrow"?e+n*8:t==="diamond"?2*(e+n):e+n},Ka=(e,t)=>{const{width:n}=e;if(Be(e)){const i=((t==null?void 0:t.fontSize)??al)*DQ;return Math.max(LQ*n,i)}return e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Nn*2:e.type==="diamond"?Math.round(n/2)-Nn*2:n-Nn*2},b5=(e,t)=>{const{height:n}=e;return Be(e)?n-Nn*8*2<=0?t.height:n:e.type==="ellipse"?Math.round(n/2*Math.sqrt(2))-Nn*2:e.type==="diamond"?Math.round(n/2)-Nn*2:n-Nn*2},wH=(e,t=`

`)=>e.reduce((i,r)=>(de(r)&&i.push(r.text),i),[]).join(t),a_=(e,{shouldThrow:t=!1,includeBoundTextValidation:n=!1,ignoreLogs:i,reconciliationContext:r})=>{const s=[],o=l=>`${l==null?void 0:l.index}:${l==null?void 0:l.id}:${l==null?void 0:l.type}:${l==null?void 0:l.isDeleted}:${l==null?void 0:l.version}:${l==null?void 0:l.versionNonce}`,a=e.map(l=>l.index);for(const[l,c]of a.entries()){const u=a[l-1],d=a[l+1];if(xE(c,u,d)||s.push(`Fractional indices invariant has been compromised: "${o(e[l-1])}", "${o(e[l])}", "${o(e[l+1])}"`),n&&Us(e[l])){const f=e[l],h=Oe(f,Se(e));h&&h.index<=f.index&&s.push(`Fractional indices invariant for bound elements has been compromised: "${o(h)}", "${o(f)}"`)}}if(s.length){const l=new Hee,c=[];if(r&&(c.push("Additional reconciliation context:"),c.push(r.localElements.map(u=>o(u))),c.push(r.remoteElements.map(u=>o(u)))),i||console.error(s.join(`

`),l.stack,e.map(u=>o(u)),...c),t)throw l}},TH=e=>e.sort((t,n)=>TA(t)&&TA(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),Vo=(e,t)=>{try{const n=k1e(e,t),i=SH(e,n),r=e.map(s=>i.has(s)?{...s,...i.get(s)}:s);a_(r,{includeBoundTextValidation:!1,shouldThrow:!0,ignoreLogs:!0});for(const[s,o]of i)ee(s,o,!1)}catch{Za(e)}return e},Za=e=>{const t=L1e(e),n=SH(e,t);for(const[i,r]of n)ee(i,r,!1);return e},k1e=(e,t)=>{const n=[];let i=0;for(;i<e.length;)if(t.has(e[i].id)){const r=[i-1,i];for(;++i<e.length&&t.has(e[i].id);)r.push(i);r.push(i),n.push(r)}else i++;return n},L1e=e=>{const t=[];let n,i,r=-1,s=0;const o=c=>{var f;const u=e[r]?e[r].index:void 0,d=(f=e[c-1])==null?void 0:f.index;return!u&&d||u&&d&&d>u?[d,c-1]:[u,r]},a=c=>{var f;const u=e[s]?e[s].index:void 0;if(u&&c<s)return[u,s];let d=s;for(;++d<e.length;){const h=(f=e[d])==null?void 0:f.index;if(!u&&h||u&&h&&h>u)return[h,d]}return[void 0,d]};let l=0;for(;l<e.length;){const c=e[l].index;if([n,r]=o(l),[i,s]=a(l),xE(c,n,i))l++;else{const u=[r,l];for(;++l<e.length;){const d=e[l].index,[f,h]=o(l),[m,p]=a(l);if(xE(d,f,m))break;[n,r]=[f,h],[i,s]=[m,p],u.push(l)}u.push(s),t.push(u)}}return t},xE=(e,t,n)=>e?t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e:!1,SH=(e,t)=>{var i,r;const n=new Map;for(const s of t){const o=s.shift(),a=s.pop(),l=Q3((i=e[o])==null?void 0:i.index,(r=e[a])==null?void 0:r.index,s.length);for(let c=0;c<s.length;c++){const u=e[s[c]];n.set(u,{index:l[c]})}}return n},TA=e=>!!e.index,SA=e=>{const t=new Map,n=[];for(const i of e)i.isDeleted||(n.push(i),t.set(i.id,i));return{elementsMap:t,elements:n}},D1e=Ao(e=>{window!=null&&window.DEBUG_FRACTIONAL_INDICES&&a_(e,{shouldThrow:NO.TEST==="production",includeBoundTextValidation:!0})},1e3*60,{leading:!0,trailing:!1}),N1e=e=>{const t=["includeBoundTextElement","includeElementsInFrames"];let n="";for(const i of t)n+=`${i}:${e[i]?"1":"0"}`;return n},IA=e=>typeof e=="string",du=class du{constructor(){F(this,"callbacks",new Set);F(this,"nonDeletedElements",[]);F(this,"nonDeletedElementsMap",ms(new Map));F(this,"elements",[]);F(this,"nonDeletedFramesLikes",[]);F(this,"frames",[]);F(this,"elementsMap",ms(new Map));F(this,"selectedElementsCache",{selectedElementIds:null,elements:null,cache:new Map});F(this,"sceneNonce");F(this,"insertElement",t=>{const n=t.frameId?this.getElementIndex(t.frameId):this.elements.length;this.insertElementAtIndex(t,n)});F(this,"insertElements",t=>{var i;if(!t.length)return;const n=(i=t[0])!=null&&i.frameId?this.getElementIndex(t[0].frameId):this.elements.length;this.insertElementsAtIndex(t,n)});F(this,"getContainerElement",t=>t&&t.containerId&&this.getElement(t.containerId)||null);F(this,"getElementsFromId",t=>{const n=this.getNonDeletedElementsMap(),i=n.get(t);return i?[i]:$t(n,t)})}static mapElementToScene(t,n){IA(t)?this.sceneMapById.set(t,n):(this.sceneMapByElement.set(t,n),this.sceneMapById.set(t.id,n))}static getScene(t){return IA(t)?this.sceneMapById.get(t)||null:this.sceneMapByElement.get(t)||null}getSceneNonce(){return this.sceneNonce}getNonDeletedElementsMap(){return this.nonDeletedElementsMap}getElementsIncludingDeleted(){return this.elements}getElementsMapIncludingDeleted(){return this.elementsMap}getNonDeletedElements(){return this.nonDeletedElements}getFramesIncludingDeleted(){return this.frames}getSelectedElements(t){const n=N1e(t),i=(t==null?void 0:t.elements)||this.nonDeletedElements;if(this.selectedElementsCache.elements===i&&this.selectedElementsCache.selectedElementIds===t.selectedElementIds){const s=this.selectedElementsCache.cache.get(n);if(s)return s}else(t==null?void 0:t.elements)==null&&this.selectedElementsCache.cache.clear();const r=Fe(i,{selectedElementIds:t.selectedElementIds},t);return(t==null?void 0:t.elements)==null&&(this.selectedElementsCache.selectedElementIds=t.selectedElementIds,this.selectedElementsCache.elements=this.nonDeletedElements,this.selectedElementsCache.cache.set(n,r)),r}getNonDeletedFramesLikes(){return this.nonDeletedFramesLikes}getElement(t){return this.elementsMap.get(t)||null}getNonDeletedElement(t){const n=this.getElement(t);return n&&ME(n)?n:null}mapElements(t){let n=!1;const i=this.elements.map(r=>{const s=t(r);return s!==r&&(n=!0),s});return n&&this.replaceAllElements(i),n}replaceAllElements(t){const n=t instanceof Array?t:Array.from(t.values()),i=[];D1e(n),this.elements=Za(n),this.elementsMap.clear(),this.elements.forEach(s=>{Ie(s)&&i.push(s),this.elementsMap.set(s.id,s),du.mapElementToScene(s,this)});const r=SA(this.elements);this.nonDeletedElements=r.elements,this.nonDeletedElementsMap=r.elementsMap,this.frames=i,this.nonDeletedFramesLikes=SA(this.frames).elements,this.triggerUpdate()}triggerUpdate(){this.sceneNonce=Bo();for(const t of Array.from(this.callbacks))t()}onUpdate(t){if(this.callbacks.has(t))throw new Error;return this.callbacks.add(t),()=>{if(!this.callbacks.has(t))throw new Error;this.callbacks.delete(t)}}destroy(){this.elements=[],this.nonDeletedElements=[],this.nonDeletedFramesLikes=[],this.frames=[],this.elementsMap.clear(),this.selectedElementsCache.selectedElementIds=null,this.selectedElementsCache.elements=null,this.selectedElementsCache.cache.clear(),du.sceneMapById.forEach((t,n)=>{t===this&&du.sceneMapById.delete(n)}),this.callbacks.clear()}insertElementAtIndex(t,n){if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");const i=[...this.elements.slice(0,n),t,...this.elements.slice(n)];Vo(i,Se([t])),this.replaceAllElements(i)}insertElementsAtIndex(t,n){if(!t.length)return;if(!Number.isFinite(n)||n<0)throw new Error("insertElementAtIndex can only be called with index >= 0");const i=[...this.elements.slice(0,n),...t,...this.elements.slice(n)];Vo(i,Se(t)),this.replaceAllElements(i)}getElementIndex(t){return this.elements.findIndex(n=>n.id===t)}};F(du,"sceneMapByElement",new WeakMap),F(du,"sceneMapById",new Map);let eo=du;const ee=(e,t,n=!0,i)=>{var u,d;let r=!1;const{points:s,fixedSegments:o,fileId:a,startBinding:l,endBinding:c}=t;if(ge(e)&&(Object.keys(t).length===0||typeof s<"u"||typeof o<"u"||typeof l<"u"||typeof c<"u")){const f=ms(((u=eo.getScene(e))==null?void 0:u.getNonDeletedElementsMap())??new Map);t={...t,angle:0,...F9({...e,x:t.x||e.x,y:t.y||e.y},f,{fixedSegments:o,points:s,startBinding:l,endBinding:c},{isDragging:i==null?void 0:i.isDragging})}}else typeof s<"u"&&(t={...vh(s),...t});for(const f in t){const h=t[f];if(typeof h<"u"){if(e[f]===h&&(typeof h!="object"||h===null||f==="groupIds"||f==="scale"))continue;if(f==="scale"){const m=e[f],p=h;if(m[0]===p[0]&&m[1]===p[1])continue}else if(f==="points"){const m=e[f],p=h;if(m.length===p.length){let b=!1,E=m.length;for(;--E;){const y=m[E],v=p[E];if(y[0]!==v[0]||y[1]!==v[1]){b=!0;break}}if(!b)continue}}e[f]=h,r=!0}}return r&&((typeof t.height<"u"||typeof t.width<"u"||typeof a<"u"||typeof s<"u")&&Gt.delete(e),e.version++,e.versionNonce=Bo(),e.updated=Jh(),n&&((d=eo.getScene(e))==null||d.triggerUpdate())),e},Ce=(e,t,n=!1)=>{let i=!1;for(const r in t){const s=t[r];if(typeof s<"u"){if(e[r]===s&&(typeof s!="object"||s===null))continue;i=!0}}return!i&&!n?e:{...e,...t,updated:Jh(),version:e.version+1,versionNonce:Bo()}},y5=(e,t)=>(e.version=(t??e.version)+1,e.versionNonce=Bo(),e.updated=Jh(),e),od=e=>ke(e)||ps(e)?e.points.length<2:e.width===0&&e.height===0,Nb=(e,t,n,i,r)=>{const[s,o,a,l]=Js(e,r),c=Pt({clientX:i.offsetLeft,clientY:i.offsetTop},i),u=Pt({clientX:i.offsetLeft+t,clientY:i.offsetTop+n},i);return c.x<=a&&c.y<=l&&u.x>=s&&u.y>=o},a2=(e,t,n,i,r,s)=>{const[o,a,l,c]=wt(e,r),u=Pt({clientX:i.offsetLeft+((s==null?void 0:s.left)||0),clientY:i.offsetTop+((s==null?void 0:s.top)||0)},i),d=Pt({clientX:i.offsetLeft+t-((s==null?void 0:s.right)||0),clientY:i.offsetTop+n-((s==null?void 0:s.bottom)||0)},i);return o>=u.x&&a>=u.y&&l<=d.x&&c<=d.y},xA=(e,t,n)=>{const i=Math.abs(t),r=Math.abs(n);if(e==="line"||e==="arrow"||e==="freedraw"){const s=Math.round(Math.atan(r/i)/mc)*mc;s===0?n=0:s===Math.PI/2?t=0:n=i*Math.tan(s)*Math.sign(n)||n}else e!=="selection"&&(n=i*Math.sign(n));return{width:t,height:n}},CE=(e,t,n,i)=>{let r=n-e,s=i-t;const o=Math.round(Math.atan(s/r)/mc)*mc;if(o===0)s=0;else if(o===Math.PI/2)r=0;else{const a=Math.tan(o),l=-1,c=t-a*e,u=-1/a,d=-1,f=i-u*n,h=(l*f-d*c)/(a*d-u*l),m=(c*u-f*a)/(a*d-u*l);r=h-e,s=m-t}return{width:r,height:s}},IH=e=>{const t={width:e.width,height:e.height,x:e.x,y:e.y};if(e.width<0){const n=Math.abs(e.width);t.width=n,t.x=e.x-n}if(e.height<0){const n=Math.abs(e.height);t.height=n,t.y=e.y-n}return t},CA={mouse:8,pen:16,touch:28},O1e=16,xH={e:!0,s:!0,n:!0,w:!0},AA={e:!0,s:!0,n:!0,w:!0,nw:!0,se:!0},Y8={e:!0,s:!0,n:!0,w:!0},la=(e,t,n,i,r,s,o)=>{const[a,l]=q(C(e+n/2,t+i/2),C(r,s),o);return[a-n/2,l-i/2,n,i]},l_=e=>!(e.viewport.isMobile||e.isTouchScreen&&(lQ||DO)),Jg=e=>l_(e)?xH:{},c_=([e,t,n,i,r,s],o,a,l,c={},u=4,d=Yu)=>{const f=CA[l],h=f/a.value,m=f/a.value,p=f/a.value,b=f/a.value,E=n-e,y=i-t,v=u/a.value,_=(f-d*2)/(2*a.value),I={nw:c.nw?void 0:la(e-v-p+_,t-v-b+_,h,m,r,s,o),ne:c.ne?void 0:la(n+v-_,t-v-b+_,h,m,r,s,o),sw:c.sw?void 0:la(e-v-p+_,i+v-_,h,m,r,s,o),se:c.se?void 0:la(n+v-_,i+v-_,h,m,r,s,o),rotation:c.rotation?void 0:la(e+E/2-h/2,t-v-b+_-O1e/a.value,h,m,r,s,o)},R=5*CA.mouse/a.value;return Math.abs(E)>R&&(c.n||(I.n=la(e+E/2-h/2,t-v-b+_,h,m,r,s,o)),c.s||(I.s=la(e+E/2-h/2,i+v-_,h,m,r,s,o))),Math.abs(y)>R&&(c.w||(I.w=la(e-v-p+_,t+y/2-m/2,h,m,r,s,o)),c.e||(I.e=la(n+v-_,t+y/2-m/2,h,m,r,s,o))),I},CH=(e,t,n,i="mouse",r=xH)=>{if(e.locked||ge(e))return{};if(e.type==="freedraw"||ke(e)){if(e.points.length===2){const[,o]=e.points;o[0]===0||o[1]===0?r=Y8:o[0]>0&&o[1]<0?r=AA:o[0]>0&&o[1]>0?r=Y8:o[0]<0&&o[1]>0?r=AA:o[0]<0&&o[1]<0&&(r=Y8)}}else Ie(e)&&(r={...r,rotation:!0});const s=ke(e)?Yu+8:st(e)?0:Yu;return c_(De(e,n,!0),e.angle,t,i,r,s,st(e)?0:void 0)},AH=(e,t)=>{if(t.editingLinearElement)return!1;if(e.length>1)return!0;const n=e[0];return ge(n)?!1:ke(n)?n.points.length>2:!0},AE=(e,t,n)=>t>=e[0]&&t<=e[0]+e[2]&&n>=e[1]&&n<=e[1]+e[3],P1e=(e,t,n,i,r,s,o,a)=>{if(!n.selectedElementIds[e.id])return!1;const{rotation:l,...c}=CH(e,s,t,o,Jg(a));if(l&&AE(l,i,r))return"rotation";const u=Object.keys(c).filter(d=>{const f=c[d];return f?AE(f,i,r):!1});if(u.length>0)return u[0];if(l_(a)){const[d,f,h,m,p,b]=De(e,t);if(!(ke(e)&&e.points.length<=2)){const E=st(e)?0:Z2/s.value,y=Z2/s.value,v=MH(C(d-E,f-E),C(h+E,m+E),C(p,b),e.angle);for(const[_,I]of Object.entries(v))if(Wu(C(i,r),I,y))return _}}return!1},MA=(e,t,n,i,r,s,o,a)=>e.reduce((l,c)=>{if(l)return l;const u=P1e(c,o,t,n,i,r,s,a);return u?{element:c,transformHandleType:u}:null},null),RA=([e,t,n,i],r,s,o,a,l)=>{const c=c_([e,t,n,i,(e+n)/2,(t+i)/2],0,o,a,Jg(l)),u=Object.keys(c).find(d=>{const f=c[d];return f&&AE(f,r,s)});if(u)return u;if(l_(l)){const d=(e+n)/2,f=(t+i)/2,h=Z2/o.value,m=MH(C(e-h,t-h),C(n+h,i+h),C(d,f),0);for(const[p,b]of Object.entries(m))if(Wu(C(r,s),b,h))return p}return!1},W8=["ns","nesw","ew","nwse"],F1e=(e,t)=>{const n=W8.indexOf(e);if(n>=0){const i=Math.round(t/(Math.PI/4));e=W8[(n+i)%W8.length]}return e},kA=e=>{const{element:t,transformHandleType:n}=e,i=t&&Math.sign(t.height)*Math.sign(t.width)===-1;let r=null;switch(n){case"n":case"s":r="ns";break;case"w":case"e":r="ew";break;case"nw":case"se":i?r="nesw":r="nwse";break;case"ne":case"sw":i?r="nwse":r="nesw";break;case"rotation":return"grab"}return r&&t&&(r=F1e(r,t.angle)),r?`${r}-resize`:""},MH=([e,t],[n,i],r,s)=>{const o=q(C(e,t),r,s),a=q(C(n,t),r,s),l=q(C(e,i),r,s),c=q(C(n,i),r,s);return{n:[o,a],e:[a,c],s:[c,l],w:[l,o]}},B1e=(e,t,n,i,r,s,o,a,l,c,u,d)=>{if(n.length===1){const[f]=n;if(t==="rotation")ge(f)||(z1e(f,i,r,l,c,s),pr(f,i));else{if(de(f)&&t)return H1e(e,f,i,t,o,l,c),pr(f,i),!0;if(t){const h=n[0].id,m=i.get(h),p=e.get(h);if(m&&p){const{nextWidth:b,nextHeight:E}=Y1e(m,p,i,e,t,l,c,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:o});nm(b,E,m,p,i,e,t,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:o})}}}return!0}else if(n.length>1){if(t==="rotation")return V1e(e,n,i,r,l,c,s,u,d),!0;if(t){const{nextWidth:f,nextHeight:h,flipByX:m,flipByY:p,originalBoundingBox:b}=W1e(n,e,i,t,l,c,{shouldMaintainAspectRatio:a,shouldResizeFromCenter:o});return RH(n,i,t,r,e,{shouldResizeFromCenter:o,shouldMaintainAspectRatio:a,flipByX:m,flipByY:p,nextWidth:f,nextHeight:h,originalBoundingBox:b}),!0}}return!1},z1e=(e,t,n,i,r,s)=>{const[o,a,l,c]=De(e,t),u=(o+l)/2,d=(a+c)/2;let f;Ie(e)?f=0:(f=5*Math.PI/2+Math.atan2(r-d,i-u),s&&(f=f+mc/2,f=f-f%mc),f=sb(f));const h=Wa(e);if(ee(e,{angle:f}),h){const m=n.getElement(h);m&&!Be(e)&&ee(m,{angle:f})}},u_=(e,t,n,i)=>ke(e)||ps(e)?{points:Ab(0,t,Ab(1,n,e.points,i),i)}:{},d_=(e,t,n)=>{let i=e.width;if(Xt(e)){const o=ui(e,t);o&&(i=Ka(o,e))}const s=e.fontSize*(n/i);return s<Xv?null:{size:s}},H1e=(e,t,n,i,r,s,o)=>{const[a,l,c,u,d,f]=De(t,n),[h,m]=q(C(s,o),C(d,f),-t.angle);let p=0,b=0;i!=="e"&&i!=="w"&&(i.includes("e")&&(p=(h-a)/(c-a)),i.includes("w")&&(p=(c-h)/(c-a)),i.includes("n")&&(b=(u-m)/(u-l)),i.includes("s")&&(b=(m-l)/(u-l)));const E=Math.max(p,b);if(E>0){const y=t.width*E,v=t.height*E,_=d_(t,n,y);if(_===null)return;const I=[a,l],R=[c,u],w=[d,f];let T=C(a,l);if(["n","w","nw"].includes(i)&&(T=C(R[0]-Math.abs(y),R[1]-Math.abs(v))),i==="ne"){const V=[I[0],R[1]];T=C(V[0],V[1]-Math.abs(v))}if(i==="sw"){const V=[R[0],I[1]];T=C(V[0]-Math.abs(y),V[1])}["s","n"].includes(i)&&(T[0]=w[0]-y/2),["e","w"].includes(i)&&(T[1]=w[1]-v/2),r&&(T[0]=w[0]-Math.abs(y)/2,T[1]=w[1]-Math.abs(v)/2);const A=t.angle,S=q(T,C(d,f),A),k=C(T[0]+Math.abs(y)/2,T[1]+Math.abs(v)/2),N=q(k,C(d,f),A);T=q(S,N,-A);const[D,G]=T;ee(t,{fontSize:_.size,width:y,height:v,x:D,y:G})}if(i==="e"||i==="w"){const y=e.get(t.id),[v,_,I,R]=sc(y,y.width,y.height,!0),w=C(v,_),T=C(I,R),A=N0(w,T),S=q(C(s,o),A,-y.angle),[k,,N]=sc(t,t.width,t.height,!0),D=N-k,G=T[0]-w[0],V=l9(xt({fontSize:t.fontSize,fontFamily:t.fontFamily}),t.lineHeight);let H=G/D;i.includes("e")&&(H=(S[0]-w[0])/D),i.includes("w")&&(H=(T[0]-S[0])/D);const $=t.width*H<V?V:t.width*H,j=Id(t.originalText,xt(t),Math.abs($)),X=zi(j,xt(t),t.lineHeight),Y=X.height,[le,pe,ae,ze]=sc(y,$,Y,!0),Xe=ae-le,qe=ze-pe;let Ze=[...w];["n","w","nw"].includes(i)&&(Ze=[T[0]-Math.abs(Xe),w[1]]);const on=y.angle,_n=q(Ze,A,on),Ye=C(Ze[0]+Math.abs(Xe)/2,Ze[1]+Math.abs(qe)/2),Qe=q(Ye,A,on);Ze=q(_n,Qe,-on);const zt={width:Math.abs($),height:Math.abs(X.height),x:Ze[0],y:Ze[1],text:j,autoResize:!1};ee(t,zt)}},V1e=(e,t,n,i,r,s,o,a,l)=>{var u;let c=5*Math.PI/2+Math.atan2(s-l,r-a);o&&(c+=mc/2,c-=c%mc);for(const d of t)if(!Ie(d)){const[f,h,m,p]=De(d,n),b=(f+m)/2,E=(h+p)/2,y=((u=e.get(d.id))==null?void 0:u.angle)??d.angle,[v,_]=q(C(b,E),C(a,l),c+y-d.angle);ge(d)?ee(d,{points:oce(d,n)}):ee(d,{x:d.x+(v-b),y:d.y+(_-E),angle:sb(c+y)},!1),pr(d,n,{simultaneouslyUpdated:t});const I=Oe(d,n);I&&!Be(d)&&ee(I,{x:I.x+(v-b),y:I.y+(_-E),angle:sb(c+y)},!1)}i.triggerUpdate()},$1e=(e,t,n,i,r)=>{const[s,o,a,l]=t.length===1?De(t[0],n):wt(t),c=(s+a)/2,u=(o+l)/2,d=t.length===1?t[0].angle:0;switch([i,r]=q(C(i,r),C(c,u),-d),e){case"n":return q(C(i-(s+a)/2,r-o),C(0,0),d);case"s":return q(C(i-(s+a)/2,r-l),C(0,0),d);case"w":return q(C(i-s,r-(o+l)/2),C(0,0),d);case"e":return q(C(i-a,r-(o+l)/2),C(0,0),d);case"nw":return q(C(i-s,r-o),C(0,0),d);case"ne":return q(C(i-a,r-o),C(0,0),d);case"sw":return q(C(i-s,r-l),C(0,0),d);case"se":return q(C(i-a,r-l),C(0,0),d);default:return[0,0]}},G1e=(e,t)=>{const[,[n,i]]=t.points;return e==="nw"&&(n<0||i<0)||e==="ne"&&n>=0||e==="sw"&&n<=0||e==="se"&&(n>0||i>0)?"end":"origin"},X1e=(e,t,n)=>{if(n)return"center";if(t)switch(e){case"n":return"south-side";case"e":return"west-side";case"s":return"north-side";case"w":return"east-side";case"ne":return"bottom-left";case"nw":return"bottom-right";case"se":return"top-left";case"sw":return"top-right"}return["e","se","s"].includes(e)?"top-left":["n","nw","w"].includes(e)?"bottom-right":e==="ne"?"bottom-left":"top-right"},j1e=(e,t,n,i,r,s,o,a,l)=>{const c=X1e(o,a,l),[u,d]=e;switch(c){case"top-left":return{x:u+(t-i)/2+(i-t)/2*Math.cos(s)+(n-r)/2*Math.sin(s),y:d+(n-r)/2+(i-t)/2*Math.sin(s)+(r-n)/2*Math.cos(s)};case"top-right":return{x:u+(t-i)/2*(Math.cos(s)+1)+(n-r)/2*Math.sin(s),y:d+(n-r)/2+(t-i)/2*Math.sin(s)+(r-n)/2*Math.cos(s)};case"bottom-left":return{x:u+(t-i)/2*(1-Math.cos(s))+(r-n)/2*Math.sin(s),y:d+(n-r)/2*(Math.cos(s)+1)+(i-t)/2*Math.sin(s)};case"bottom-right":return{x:u+(t-i)/2*(Math.cos(s)+1)+(r-n)/2*Math.sin(s),y:d+(n-r)/2*(Math.cos(s)+1)+(t-i)/2*Math.sin(s)};case"center":return{x:u-(i-t)/2,y:d-(r-n)/2};case"east-side":return{x:u+(t-i)/2*(Math.cos(s)+1),y:d+(t-i)/2*Math.sin(s)+(n-r)/2};case"west-side":return{x:u+(t-i)/2*(1-Math.cos(s)),y:d+(i-t)/2*Math.sin(s)+(n-r)/2};case"north-side":return{x:u+(t-i)/2+(n-r)/2*Math.sin(s),y:d+(r-n)/2*(Math.cos(s)-1)};case"south-side":return{x:u+(t-i)/2+(r-n)/2*Math.sin(s),y:d+(n-r)/2*(Math.cos(s)+1)}}},nm=(e,t,n,i,r,s,o,{shouldInformMutation:a=!0,shouldMaintainAspectRatio:l=!1,shouldResizeFromCenter:c=!1}={})=>{let u={};const d=Oe(n,r);if(d){const p=s.get(d.id);if(p&&(u={fontSize:p.fontSize}),l){const b={...n,width:e},E=d_(d,r,Ka(b,d));if(E===null)return;u={fontSize:E.size}}else{const b=EF(xt(d),d.lineHeight),E=vF(d.fontSize,d.lineHeight);e=Math.max(e,b),t=Math.max(t,E)}}const f=u_(i,e,t,!0);let h=C(i.x,i.y);if(ke(i)){const[p,b]=Js(i,s);h=C(p,b)}const m=j1e(h,i.width,i.height,e,t,i.angle,o,l,c);if(ke(i)&&f.points){const p=i.x-h[0],b=i.y-h[1];m.x+=p,m.y+=b;const E=f.points[0][0],y=f.points[0][1];m.x+=E,m.y+=y,f.points=f.points.map(v=>C(v[0]-E,v[1]-y))}if(e<0&&(m.x=m.x+e),t<0&&(m.y=m.y+t),"scale"in n&&"scale"in i&&ee(n,{scale:[(Math.sign(e)||i.scale[0])*i.scale[0],(Math.sign(t)||i.scale[1])*i.scale[1]]}),Be(n)&&d&&l){const p=e/n.width*d.fontSize;if(p<Xv)return;u.fontSize=p}if(e!==0&&t!==0&&Number.isFinite(m.x)&&Number.isFinite(m.y)){const p={...m,width:Math.abs(e),height:Math.abs(t),...f};ee(n,p,a),pr(n,r,{newSize:{width:e,height:t}}),d&&u!=null&&ee(d,{fontSize:u.fontSize}),Wm(n,r,o,l)}},Y1e=(e,t,n,i,r,s,o,{shouldMaintainAspectRatio:a=!1,shouldResizeFromCenter:l=!1}={})=>{const[c,u,d,f]=sc(t,t.width,t.height,!0),h=C(c,u),m=C(d,f),p=N0(h,m),b=q(C(s,o),p,-t.angle),[E,y,v,_]=sc(e,e.width,e.height,!0),I=v-E,R=_-y,w=m[0]-h[0],T=m[1]-h[1];let A=w/I,S=T/R;r.includes("e")&&(A=(b[0]-h[0])/I),r.includes("s")&&(S=(b[1]-h[1])/R),r.includes("w")&&(A=(m[0]-b[0])/I),r.includes("n")&&(S=(m[1]-b[1])/R);let k=e.width*A,N=e.height*S;if(l&&(k=2*k-t.width,N=2*N-t.height),a){const D=Math.abs(k)/t.width,G=Math.abs(N)/t.height;if(r.length===1&&(N*=D,k*=G),r.length===2){const V=Math.max(D,G);k=t.width*V*Math.sign(k),N=t.height*V*Math.sign(N)}}return{nextWidth:k,nextHeight:N}},W1e=(e,t,n,i,r,s,{shouldMaintainAspectRatio:o=!1,shouldResizeFromCenter:a=!1}={})=>{const l=e.map(D=>t.get(D.id)),c=l.reduce((D,G)=>{if(!ke(G))return D;const V=Wa(G);if(!V)return D;const H=t.get(V)??null;return Xt(H)?[...D,{...H,...ue.getBoundTextElementPosition(G,H,n)}]:D},[]),u=js(l.map(D=>D).concat(c)),{minX:d,minY:f,maxX:h,maxY:m,midX:p,midY:b}=u,E=h-d,y=m-f,v={ne:[d,m],se:[d,f],sw:[h,f],nw:[h,m],e:[d,f+y/2],w:[h,f+y/2],n:[d+E/2,m],s:[d+E/2,f]},[_,I]=a?[p,b]:v[i],R=a?2:1,w=Math.max(Math.abs(r-_)/E||0,Math.abs(s-I)/y||0)*R;let T=i.includes("e")||i.includes("w")?Math.abs(r-_)*R:E,A=i.includes("n")||i.includes("s")?Math.abs(s-I)*R:y;o&&(T=E*w*Math.sign(r-_),A=y*w*Math.sign(s-I));const S={ne:[r<_,s>I],se:[r<_,s<I],sw:[r>_,s<I],nw:[r>_,s>I],e:[r<_,!1],w:[r>_,!1],n:[!1,s>I],s:[!1,s<I]},[k,N]=S[i].map(D=>D);return{originalBoundingBox:u,nextWidth:T,nextHeight:A,flipByX:k,flipByY:N}},RH=(e,t,n,i,r,{shouldMaintainAspectRatio:s=!1,shouldResizeFromCenter:o=!1,flipByX:a=!1,flipByY:l=!1,nextHeight:c,nextWidth:u,originalBoundingBox:d}={})=>{if(u===void 0&&c===void 0&&a===void 0&&l===void 0||c===0||u===0)return;r||(r=t);const f=e.reduce((R,w)=>{const T=r.get(w.id);return T&&R.push({orig:T,latest:w}),R},[]);let h;if(d)h=d;else{const R=f.reduce((w,{orig:T})=>{if(!ke(T))return w;const A=Wa(T);if(!A)return w;const S=r.get(A)??null;return Xt(S)?[...w,{...S,...ue.getBoundTextElementPosition(T,S,t)}]:w},[]);h=js(f.map(({orig:w})=>w).concat(R))}const{minX:m,minY:p,maxX:b,maxY:E,midX:y,midY:v}=h,_=b-m,I=E-p;if(u===void 0&&c===void 0&&(u=_,c=I),s&&(u===void 0?u=c*(_/I):c===void 0?c=u*(I/_):Math.abs(u/c-_/I)>.001&&(u=c*(_/I))),u&&c){let R=n.includes("e")||n.includes("w")?Math.abs(u)/_:1,w=n.includes("n")||n.includes("s")?Math.abs(c)/I:1,T;n.length===1?T=n.includes("e")||n.includes("w")?R:w:T=Math.max(Math.abs(u)/_||0,Math.abs(c)/I||0);const A={ne:[m,E],se:[m,p],sw:[b,p],nw:[b,E],e:[m,p+I/2],w:[b,p+I/2],n:[m+_/2,E],s:[m+_/2,p]},[S,k]=o?[y,v]:A[n],N=s||f.some($=>$.latest.angle!==0||de($.latest)||yh($.latest));N&&(R=T,w=T);const[D,G]=[a?-1:1,l?-1:1],V=[];for(const{orig:$,latest:j}of f){if(de($)&&Xt($))continue;const X=$.width*R,Y=$.height*w,le=sb($.angle*D*G),pe=ke($)||ps($),ae=$.x-S,ze=$.y-k,Xe=a&&!pe?X:0,qe=l&&!pe?Y:0,Ze=S+D*(ae*R+Xe),on=k+G*(ze*w+qe),_n=u_($,X*D,Y*G,!1),Ye={x:Ze,y:on,width:X,height:Y,angle:le,..._n};if(ge($)&&($.startBinding&&(Ye.startBinding={...$.startBinding,fixedPoint:[a?-$.startBinding.fixedPoint[0]+1:$.startBinding.fixedPoint[0],l?-$.startBinding.fixedPoint[1]+1:$.startBinding.fixedPoint[1]]}),$.endBinding&&(Ye.endBinding={...$.endBinding,fixedPoint:[a?-$.endBinding.fixedPoint[0]+1:$.endBinding.fixedPoint[0],l?-$.endBinding.fixedPoint[1]+1:$.endBinding.fixedPoint[1]]}),$.fixedSegments&&_n.points&&(Ye.fixedSegments=$.fixedSegments.map(zt=>({...zt,start:_n.points[zt.index-1],end:_n.points[zt.index]})))),st($)&&(Ye.scale=[$.scale[0]*D,$.scale[1]*G]),de($)){const zt=d_($,t,X);if(!zt)return;Ye.fontSize=zt.size}const Qe=r.get(Wa($)??"");if(Qe)if(N){const zt=Qe.fontSize*T;if(zt<Xv)return;Ye.boundTextFontSize=zt}else Ye.boundTextFontSize=Qe.fontSize;V.push({element:j,update:Ye})}const H=V.map(({element:$})=>$);for(const{element:$,update:{boundTextFontSize:j,...X}}of V){const{width:Y,height:le,angle:pe}=X;ee($,X,!1,{isDragging:!0}),pr($,t,{simultaneouslyUpdated:H,newSize:{width:Y,height:le}});const ae=Oe($,t);ae&&j&&(ee(ae,{fontSize:j,angle:ke($)?void 0:pe},!1),Wm($,t,n,!0))}i.triggerUpdate()}},K1e=(e,t,n,i,r,s)=>{if(t.length===1&&ge(t[0])&&(t[0].startBinding||t[0].endBinding))return;const o=t.filter(d=>{if(ge(d)&&d.startBinding&&d.endBinding){const f=t.find(m=>{var p;return m.id===((p=d.startBinding)==null?void 0:p.elementId)}),h=t.find(m=>{var p;return m.id===((p=d.endBinding)==null?void 0:p.elementId)});return f&&h}return!0}),a=new Set(o),l=o.filter(d=>Ie(d)).map(d=>d.id);if(l.length>0)for(const d of i.getNonDeletedElements())d.frameId!==null&&l.includes(d.frameId)&&a.add(d);const c=wt(Array.from(a).map(d=>e.originalElements.get(d.id)??d)),u=Z1e(c,n,r,s);a.forEach(d=>{if(LA(e,d,u),!Be(d)){const f=Oe(d,i.getNonDeletedElementsMap());f&&LA(e,f,u),pr(d,i.getElementsMapIncludingDeleted(),{simultaneouslyUpdated:Array.from(a)})}})},Z1e=(e,t,n,i)=>{const[r,s]=e;let o=r+t.x+n.x,a=s+t.y+n.y;if(n.x===0||n.y===0){const[l,c]=Rn(r+t.x,s+t.y,i);n.x===0&&(o=l),n.y===0&&(a=c)}return{x:o-r,y:a-s}},LA=(e,t,n)=>{const i=e.originalElements.get(t.id)??t,r=i.x+n.x,s=i.y+n.y;ee(t,{x:r,y:s})},q1e=(e,t,n)=>{const[i,r]=wt(e);return[t-i,n-r]},DA=({newElement:e,elementType:t,originX:n,originY:i,x:r,y:s,width:o,height:a,shouldMaintainAspectRatio:l,shouldResizeFromCenter:c,zoom:u,widthAspectRatio:d=null,originOffset:f=null,informMutation:h=!0})=>{l&&e.type!=="selection"&&(d?a=o/d:(Math.abs(s-i)>Math.abs(r-n)?{width:o,height:a}=xA(t,a,r<n?-o:o):{width:o,height:a}=xA(t,o,s<i?-a:a),a<0&&(a=-a)));let m=r<n?n-o:n,p=s<i?i-a:i;c&&(o+=o,a+=a,m=n-o/2,p=i-a/2);let b=null;if(de(e)){a=e.height;const E=l9(xt({fontSize:e.fontSize,fontFamily:e.fontFamily}),e.lineHeight);o=Math.max(o,E),Math.abs(r-n)>fQ/u&&(b={autoResize:!1}),p=i,c&&(m=n-o/2)}if(o!==0&&a!==0){let E=null;st(e)&&(E={initialWidth:o,initialHeight:a}),ee(e,{x:m+((f==null?void 0:f.x)??0),y:p+((f==null?void 0:f.y)??0),width:o,height:a,...b,...E},h)}},f_=(e,t)=>{var n;return!!(!e.viewModeEnabled&&((n=e.openDialog)==null?void 0:n.name)!=="elementLinkSelector"&&(e.activeTool.type!=="custom"&&(e.editingTextElement||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser")||Fe(t,e).length))},Nl=e=>e.reduce((t,n)=>t+n.version,0),Q1e=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e[n].versionNonce;return t>>>0},kH=e=>{let t=5381;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);t=(t<<5)+t+i}return t>>>0},J1e=e=>e.filter(t=>!t.isDeleted&&!od(t)),Nt=e=>e.filter(t=>!t.isDeleted),ME=e=>!e.isDeleted,h_=e=>Nt(e).map(t=>a9(t.type)?{...t,lastCommittedPoint:null}:t),ege=e=>h_(e),LH=e=>h_(e),DH=e=>h_(e),g_=e=>{const t=new Set;return e.forEach(n=>{Ie(n)&&t.add(n.id)}),e.filter(n=>!(n.frameId&&t.has(n.frameId)))},m_=(e,t,n,i=!0)=>{const[r,s,o,a]=De(t,n);let l=e.filter(c=>{let[u,d,f,h]=Js(c,n);const m=Ur(c,n);if(m){const[p,b,E,y]=Js(m,n);u=Math.max(p,u),d=Math.max(b,d),f=Math.min(E,f),h=Math.min(y,h)}return c.locked===!1&&c.type!=="selection"&&!Xt(c)&&r<=u&&s<=d&&o>=f&&a>=h});return l=i?g_(l):l,l=l.filter(c=>{const u=Ur(c,n);return u?Ec(c,u,n):!0}),l},NH=(e,t,n,i)=>{const r=new Set(t.map(s=>s.id));return e.filter(s=>{const o=Nb(s,n.width,n.height,n,i);return!r.has(s.id)&&o})},Fn=function(){let e=null,t=null,n=null;const i=(r,s)=>(n!=null&&r===e&&s.selectedElementIds===t||(n=r.some(o=>s.selectedElementIds[o.id]),e=r,t=s.selectedElementIds),n);return i.clearCache=()=>{e=null,t=null,n=null},i}(),tge=(e,t,n)=>{const i=Array.from(new Set(Fe(e,t).map(r=>n(r))));return i.length===1?i[0]:null},Fe=(e,t,n)=>{const i=new Set,r=[];for(const s of e.values()){if(t.selectedElementIds[s.id]){r.push(s),i.add(s.id);continue}if(n!=null&&n.includeBoundTextElement&&Xt(s)&&t.selectedElementIds[s==null?void 0:s.containerId]){r.push(s),i.add(s.id);continue}}if(n!=null&&n.includeElementsInFrames){const s=[];return r.forEach(o=>{Ie(o)&&Ho(e,o.id).forEach(a=>!i.has(a.id)&&s.push(a)),s.push(o)}),s}return r},OH=(e,t)=>t.editingTextElement?[t.editingTextElement]:t.newElement?[t.newElement]:Fe(e,t,{includeBoundTextElement:!0}),gt=(e,t)=>vi(t.selectedElementIds,e)?t.selectedElementIds:e,nge=(e,t)=>{const[n,i,r,s]=t,{x:o,y:a}=Os({sceneX:n,sceneY:i},e),{x:l,y:c}=Os({sceneX:r,sceneY:s},e);return l-o>e.width||c-a>e.height},PH=({scenePoint:e,viewportDimensions:t,zoom:n,offsets:i})=>{let r=(t.width-((i==null?void 0:i.right)??0))/2/n.value-e.x;r+=((i==null?void 0:i.left)??0)/2/n.value;let s=(t.height-((i==null?void 0:i.bottom)??0))/2/n.value-e.y;return s+=((i==null?void 0:i.top)??0)/2/n.value,{scrollX:r,scrollY:s}},im=(e,t)=>{if(e=J1e(e),!e.length)return{scrollX:0,scrollY:0};let[n,i,r,s]=wt(e);nge(t,[n,i,r,s])&&([n,i,r,s]=f1e(e,Pt({clientX:t.scrollX,clientY:t.scrollY},t)));const o=(n+r)/2,a=(i+s)/2;return PH({scenePoint:{x:o,y:a},viewportDimensions:{width:t.width,height:t.height},zoom:t.zoom})},Aa=e=>He(Do(e,6),Yv,Wv),ige=e=>He(Math.round(e),1,100),FH=e=>He(Math.round(e),1,100),qa=({size:e="1em",circleWidth:t=8,synchronized:n=!1,className:i=""})=>{const s=-(se.useRef(Date.now()).current%1600);return g("div",{className:`Spinner ${i}`,children:g("svg",{viewBox:"0 0 100 100",style:{width:e,height:e,"--spinner-delay":n?`${s}ms`:0},children:g("circle",{cx:"50",cy:"50",r:50-t/2,strokeWidth:t,fill:"none",strokeMiterlimit:"10"})})})},Ke=se.forwardRef(({size:e="medium",visible:t=!0,className:n="",...i},r)=>{const{id:s}=qo(),o=se.useRef(null);se.useImperativeHandle(r,()=>o.current);const a=`ToolIcon_size_${e}`,[l,c]=M.useState(!1),u=M.useRef(!0),d=async h=>{var p;const m="onClick"in i&&((p=i.onClick)==null?void 0:p.call(i,h));if(zm(m))try{c(!0),await m}catch(b){if(b instanceof Uh)console.warn(b);else throw b}finally{u.current&&c(!1)}};M.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const f=M.useRef(null);if(i.type==="button"||i.type==="icon"||i.type==="submit"){const h=i.type==="icon"?"button":i.type;return P("button",{className:me("ToolIcon_type_button",a,n,t&&!i.hidden?"ToolIcon_type_button--show":"ToolIcon_type_button--hide",{ToolIcon:!i.hidden,"ToolIcon--selected":i.selected,"ToolIcon--plain":i.type==="icon"}),style:i.style,"data-testid":i["data-testid"],hidden:i.hidden,title:i.title,"aria-label":i["aria-label"],type:h,onClick:d,ref:o,disabled:l||i.isLoading||!!i.disabled,children:[(i.icon||i.label)&&P("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":!!i.disabled,children:[i.icon||i.label,i.keyBindingLabel&&g("span",{className:"ToolIcon__keybinding",children:i.keyBindingLabel}),i.isLoading&&g(qa,{})]}),i.showAriaLabel&&P("div",{className:"ToolIcon__label",children:[i["aria-label"]," ",l&&g(qa,{})]}),i.children]})}return P("label",{className:me("ToolIcon",n),title:i.title,onPointerDown:h=>{var m;f.current=h.pointerType||null,(m=i.onPointerDown)==null||m.call(i,{pointerType:h.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{f.current=null})},children:[g("input",{className:`ToolIcon_type_radio ${a}`,type:"radio",name:i.name,"aria-label":i["aria-label"],"aria-keyshortcuts":i["aria-keyshortcuts"],"data-testid":i["data-testid"],id:`${s}-${i.id}`,onChange:()=>{var h;(h=i.onChange)==null||h.call(i,{pointerType:f.current})},checked:i.checked,ref:o}),P("div",{className:"ToolIcon__icon",children:[i.icon,i.keyBindingLabel&&g("span",{className:"ToolIcon__keybinding",children:i.keyBindingLabel})]})]})});Ke.displayName="ToolButton";const rge=(e,t,n)=>{const i=new Set(Fe(e.filter(u=>Ie(u)),t).map(u=>u.id)),r={},s=n.scene.getNonDeletedElementsMap(),o=new Set;for(const u of i){const d=Ho(e,u);for(const f of d)if(!o.has(f.id)){if(Xt(f)){const h=ui(f,s);h&&(r[h.id]=!0)}else r[f.id]=!0;o.add(f.id)}}let a=!0;const l=e.map(u=>{if(t.selectedElementIds[u.id]){const d=Xt(u)?ui(u,s):null;return u.frameId&&i.has(u.frameId)?(a=!1,r[u.id]=!0,u):d!=null&&d.frameId&&i.has(d==null?void 0:d.frameId)?u:(u.boundElements&&u.boundElements.forEach(f=>{var m,p;const h=n.scene.getNonDeletedElementsMap().get(f.id);h&&ge(h)&&(ee(h,{startBinding:u.id===((m=h.startBinding)==null?void 0:m.elementId)?null:h.startBinding,endBinding:u.id===((p=h.endBinding)==null?void 0:p.elementId)?null:h.endBinding}),ee(h,{points:h.points}))}),Ce(u,{isDeleted:!0}))}return u.frameId&&i.has(u.frameId)?(a=!1,Xt(u)||(r[u.id]=!0),Ce(u,{frameId:null})):Xt(u)&&t.selectedElementIds[u.containerId]?Ce(u,{isDeleted:!0}):u});let c=t.editingGroupId;if(a&&t.editingGroupId){const u=$t(l,t.editingGroupId).filter(d=>!d.isDeleted);if(u.length>1)u[0]&&(r[u[0].id]=!0);else{c=null,u[0]&&(r[u[0].id]=!0);const d=u[0];if(d){const f=d.groupIds.findIndex(m=>m===t.editingGroupId),h=d.groupIds[f+1];if(h){const m=$t(l,h).filter(p=>!p.isDeleted);m.length>1&&(c=h,m.forEach(p=>{r[p.id]=!0}))}}}}return{elements:l,appState:{...t,...ji({selectedElementIds:r,editingGroupId:c},l,t,null)}}},NA=(e,t)=>{if(e.editingGroupId){const n=$t(Nt(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},BH=oe({name:"deleteSelectedElements",label:"labels.delete",icon:bc,trackEvent:{category:"element",action:"delete"},perform:(e,t,n,i)=>{if(t.editingLinearElement){const{elementId:o,selectedPointsIndices:a,startBindingElement:l,endBindingElement:c}=t.editingLinearElement,u=i.scene.getNonDeletedElementsMap(),d=ue.getElement(o,u);if(!d||a==null)return!1;if(d.points.length<2){const h=e.map(p=>p.id===d.id?Ce(p,{isDeleted:!0}):p),m=NA(t,h);return{elements:h,appState:{...m,editingLinearElement:null},captureUpdate:Z.IMMEDIATELY}}const f={startBindingElement:a!=null&&a.includes(0)?null:l,endBindingElement:a!=null&&a.includes(d.points.length-1)?null:c};return ue.deletePoints(d,a),{elements:e,appState:{...t,editingLinearElement:{...t.editingLinearElement,...f,selectedPointsIndices:(a==null?void 0:a[0])>0?[a[0]-1]:[0]}},captureUpdate:Z.IMMEDIATELY}}let{elements:r,appState:s}=rge(e,t,i);return IB(r,r.filter(o=>o.isDeleted)),s=NA(s,r),{elements:r,appState:{...s,activeTool:Sn(t,{type:"selection"}),multiElement:null,activeEmbeddable:null},captureUpdate:Fn(Nt(e),t)?Z.IMMEDIATELY:Z.EVENTUALLY}},keyTest:(e,t,n)=>(e.key===z.BACKSPACE||e.key===z.DELETE)&&!e[z.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n})=>g(Ke,{type:"button",icon:bc,title:L("labels.delete"),"aria-label":L("labels.delete"),onClick:()=>n(null),visible:Fn(Nt(e),t)})}),RE=(e,t)=>e.frameId===t||e.id===t,zH=(e,t,n)=>{let i=[],r=[],s=null,o=-1;const a=Se(n||Fe(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0}));for(;++o<e.length;){const l=e[o];a.get(l.id)?(r.length&&(i=i.concat(r),r=[]),i.push(o),s=o+1):l.isDeleted&&s===o?(s=o+1,r.push(o)):r=[]}return i},sge=e=>{let t=0;return e.reduce((n,i,r)=>(r>0&&e[r-1]!==i-1&&(t=++t),(n[t]||(n[t]=[])).push(i),n),[])},OA=(e,t,n)=>{var i,r;if("containerId"in e&&e.containerId){const s=eo.getScene(e).getElement(e.containerId);if(s)return n==="left"?Math.min(t.indexOf(s),t.indexOf(e)):Math.max(t.indexOf(s),t.indexOf(e))}else{const s=(r=(i=e.boundElements)==null?void 0:i.find(o=>o.type!=="arrow"))==null?void 0:r.id;if(s){const o=eo.getScene(e).getElement(s);if(o)return n==="left"?Math.min(t.indexOf(o),t.indexOf(e)):Math.max(t.indexOf(o),t.indexOf(e))}}},oge=(e,t)=>{let n=-1,i=-1;return e.forEach((r,s)=>{RE(r,t)&&(n===-1&&(n=s),i=s)}),n===-1?[]:e.slice(n,i+1)},age=(e,t,n,i,r)=>{const s=t[n],o=d=>d.isDeleted?!1:r?d.frameId===r:e.editingGroupId?d.groupIds.includes(e.editingGroupId):!0,a=i==="left"?au(t,d=>o(d),Math.max(0,n-1)):sF(t,d=>o(d),n+1),l=t[a];if(!l)return-1;if(e.editingGroupId){if((s==null?void 0:s.groupIds.join(""))===(l==null?void 0:l.groupIds.join("")))return OA(l,t,i)??a;if(!(l!=null&&l.groupIds.includes(e.editingGroupId)))return-1}if(!r&&(l.frameId||Ie(l))){const d=oge(t,l.frameId||l.id);return i==="left"?t.indexOf(d[0]):t.indexOf(d[d.length-1])}if(!l.groupIds.length)return OA(l,t,i)??a;const c=e.editingGroupId?l.groupIds[l.groupIds.indexOf(e.editingGroupId)-1]:l.groupIds[l.groupIds.length-1],u=$t(t,c);return u.length?i==="left"?t.indexOf(u[0]):t.indexOf(u[u.length-1]):a},HH=(e,t)=>t.reduce((n,i)=>{const r=e[i];return n.set(r.id,r),n},new Map),VH=(e,t,n)=>{const i=zH(e,t),r=HH(e,i);let s=sge(i);n==="right"&&(s=s.reverse());const o=new Set(i.filter(a=>Ie(e[a])).map(a=>e[a].id));return s.forEach((a,l)=>{var y;const c=a[0],u=a[a.length-1],d=n==="left"?c:u,f=a.some(v=>{const _=e[v];return _.frameId&&o.has(_.frameId)})?null:(y=e[d])==null?void 0:y.frameId,h=age(t,e,d,n,f);if(h===-1||d===h)return;const m=n==="left"?e.slice(0,h):e.slice(0,c),p=e.slice(c,u+1),b=n==="left"?e.slice(h,c):e.slice(u+1,h+1),E=n==="left"?e.slice(u+1):e.slice(h+1);e=n==="left"?[...m,...p,...b,...E]:[...m,...b,...p,...E]}),Vo(e,r),e},$H=(e,t,n,i,r)=>{const s=zH(e,t,r),o=HH(e,s),a=[];let l,c;if(n==="left"){if(i)l=sF(e,m=>RE(m,i));else if(t.editingGroupId){const m=$t(e,t.editingGroupId);if(!m.length)return e;l=e.indexOf(m[0])}else l=0;c=s[s.length-1]}else{if(i)c=au(e,m=>RE(m,i));else if(t.editingGroupId){const m=$t(e,t.editingGroupId);if(!m.length)return e;c=e.indexOf(m[m.length-1])}else c=e.length-1;l=s[0]}l===-1&&(l=0);for(let m=l;m<c+1;m++)s.includes(m)||a.push(e[m]);const u=Array.from(o.values()),d=e.slice(0,l),f=e.slice(c+1),h=n==="left"?[...d,...u,...a,...f]:[...d,...a,...u,...f];return Vo(h,o),h};function GH(e,t,n,i){const r=Se(Fe(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),s={regularElements:[],frameChildren:new Map},o=new Set;for(const c of e)r.has(c.id)&&Ie(c)&&o.add(c.id);for(const c of e)if(r.has(c.id))if(Ie(c)||c.frameId&&o.has(c.frameId))s.regularElements.push(c);else if(!c.frameId)s.regularElements.push(c);else{const u=s.frameChildren.get(c.frameId)||[];u.push(c),s.frameChildren.set(c.frameId,u)}let a=e;const l=Array.from(s.frameChildren.entries());for(const[c,u]of l)a=i(e,t,n,c,u);return i(a,t,n,null,s.regularElements)}const lge=(e,t)=>VH(e,t,"left"),cge=(e,t)=>VH(e,t,"right"),uge=(e,t)=>GH(e,t,"left",$H),dge=(e,t)=>GH(e,t,"right",$H),fge=oe({name:"sendBackward",label:"labels.sendBackward",keywords:["move down","zindex","layer"],icon:Ax,trackEvent:{category:"element"},perform:(e,t)=>({elements:lge(e,t),appState:t,captureUpdate:Z.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[z.CTRL_OR_CMD]&&!e.shiftKey&&e.code===tt.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>g("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${L("labels.sendBackward")} — ${Q("CtrlOrCmd+[")}`,children:Ax})}),hge=oe({name:"bringForward",label:"labels.bringForward",keywords:["move up","zindex","layer"],icon:Cx,trackEvent:{category:"element"},perform:(e,t)=>({elements:cge(e,t),appState:t,captureUpdate:Z.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[z.CTRL_OR_CMD]&&!e.shiftKey&&e.code===tt.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>g("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${L("labels.bringForward")} — ${Q("CtrlOrCmd+]")}`,children:Cx})}),gge=oe({name:"sendToBack",label:"labels.sendToBack",keywords:["move down","zindex","layer"],icon:Rx,trackEvent:{category:"element"},perform:(e,t)=>({elements:uge(e,t),appState:t,captureUpdate:Z.IMMEDIATELY}),keyTest:e=>Fo?e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.BRACKET_LEFT:e[z.CTRL_OR_CMD]&&e.shiftKey&&e.code===tt.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>g("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${L("labels.sendToBack")} — ${Q(Fo?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")}`,children:Rx})}),mge=oe({name:"bringToFront",label:"labels.bringToFront",keywords:["move up","zindex","layer"],icon:Mx,trackEvent:{category:"element"},perform:(e,t)=>({elements:dge(e,t),appState:t,captureUpdate:Z.IMMEDIATELY}),keyTest:e=>Fo?e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.BRACKET_RIGHT:e[z.CTRL_OR_CMD]&&e.shiftKey&&e.code===tt.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>g("button",{type:"button",className:"zIndexButton",onClick:n=>e(null),title:`${L("labels.bringToFront")} — ${Q(Fo?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")}`,children:Mx})}),pge=oe({name:"selectAll",label:"labels.selectAll",icon:oie,trackEvent:{category:"canvas"},viewMode:!1,perform:(e,t,n,i)=>{if(t.editingLinearElement)return!1;const r=e.filter(s=>!s.isDeleted&&!(de(s)&&s.containerId)&&!s.locked).reduce((s,o)=>(s[o.id]=!0,s),{});return{appState:{...t,...ji({editingGroupId:null,selectedElementIds:r},Nt(e),t,i),selectedLinearElement:Object.keys(r).length===1&&ke(e[0])?new ue(e[0]):null},captureUpdate:Z.IMMEDIATELY}},keyTest:e=>e[z.CTRL_OR_CMD]&&e.key===z.A}),Uge=e=>{const t=e.slice(),n=new Set,i=s=>{var c,u,d;const o=(u=(c=s[0])==null?void 0:c.groupIds)==null?void 0:u.join(""),a=[s[0]],l=[];for(const f of s.slice(1))((d=f.groupIds)==null?void 0:d.join(""))===o?a.push(f):l.push(f);return l.length?[...a,...i(l)]:a},r=new Map;return t.forEach((s,o)=>{var a;if(!r.has(s.id))if((a=s.groupIds)!=null&&a.length){const l=s.groupIds[s.groupIds.length-1],c=t.slice(o).filter(u=>{var f;const d=(f=u==null?void 0:u.groupIds)==null?void 0:f.some(h=>h===l);return d&&r.set(u.id,!0),d});for(const u of i(c))n.add(u)}else n.add(s)}),n.size!==e.length?(console.error("normalizeGroupElementOrder: lost some elements... bailing!"),e):[...n]},bge=e=>{const t=Iee(e),n=e.slice(),i=new Set;return n.forEach((r,s)=>{var o,a;if(r)if((o=r.boundElements)!=null&&o.length)i.add(r),n[s]=null,r.boundElements.forEach(l=>{const c=t.get(l.id);c&&l.type==="text"&&(i.add(c[0]),n[c[1]]=null)});else if(r.type==="text"&&r.containerId){const l=t.get(r.containerId);(a=l==null?void 0:l[0].boundElements)!=null&&a.find(c=>c.id===r.id)||(i.add(r),n[s]=null)}else i.add(r),n[s]=null}),i.size!==e.length?(console.error("normalizeBoundElementsOrder: lost some elements... bailing!"),e):[...i]},yge=e=>bge(Uge(e)),Ege=oe({name:"duplicateSelection",label:"labels.duplicateSelection",icon:nE,trackEvent:{category:"element"},perform:(e,t,n,i)=>{if(t.editingLinearElement)try{const s=ue.duplicateSelectedPoints(t,i.scene.getNonDeletedElementsMap());return{elements:e,appState:s,captureUpdate:Z.IMMEDIATELY}}catch{return!1}const r=vge(e,t);if(i.props.onDuplicate&&r.elements){const s=i.props.onDuplicate(r.elements,e);s&&(r.elements=s)}return{...r,captureUpdate:Z.IMMEDIATELY}},keyTest:e=>e[z.CTRL_OR_CMD]&&e.key===z.D,PanelComponent:({elements:e,appState:t,updateData:n})=>g(Ke,{type:"button",icon:nE,title:`${L("labels.duplicateSelection")} — ${Q("CtrlOrCmd+D")}`,"aria-label":L("labels.duplicateSelection"),onClick:()=>n(null),visible:Fn(Nt(e),t)})}),vge=(e,t)=>{const n=new Map,i=[],r=[],s=new Map,o=new Map,a=Se(e),l=p=>{const E=gx(p).reduce((y,v)=>{if(u.has(v.id))return y;u.set(v.id,!0);const _=rB(t.editingGroupId,n,v,{x:v.x+q2/2,y:v.y+q2/2});return u.set(_.id,!0),o.set(_.id,_),s.set(v.id,_.id),r.push(v),i.push(_),y.push(_),y},[]);return Array.isArray(p)?E:E[0]||null};e=yge(e);const c=Se(Fe(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),u=new Map,d=e.slice(),f=(p,b)=>{qi(p!==-1,"targetIndex === -1 "),!(!Array.isArray(b)&&!b)&&d.splice(p+1,0,...gx(b))},h=new Set(e.filter(p=>c.has(p.id)&&Ie(p)).map(p=>p.id));for(const p of e){if(u.has(p.id)||!c.has(p.id))continue;const b=SF(t,p);if(b){const E=$t(e,b).flatMap(v=>Ie(v)?[...Ho(e,v.id),v]:[v]),y=au(d,v=>{var _;return(_=v.groupIds)==null?void 0:_.includes(b)});f(y,l(E));continue}if(!(p.frameId&&h.has(p.frameId))){if(Ie(p)){const E=p.id,y=Ho(e,E),v=au(d,_=>_.frameId===E||_.id===E);f(v,l([...y,p]));continue}if(Us(p)){const E=Oe(p,a),y=au(d,v=>v.id===p.id||"containerId"in v&&v.containerId===p.id);E?f(y,l([p,E])):f(y,l(p));continue}if(Xt(p)){const E=ui(p,a),y=au(d,v=>v.id===p.id||v.id===(E==null?void 0:E.id));E?f(y,l([E,p])):f(y,l(p));continue}f(au(d,E=>E.id===p.id),l(p))}}_H(d,r,s),SB(d,r,s),nH(d,r,s);const m=g_(i);return{elements:d,appState:{...t,...ji({editingGroupId:t.editingGroupId,selectedElementIds:m.reduce((p,b)=>(Xt(b)||(p[b.id]=!0),p),{})},Nt(d),t,null)}}},XH=M.forwardRef((e,t)=>{const{title:n,className:i,testId:r,active:s,standalone:o,icon:a,onClick:l}=e;return g("button",{type:"button",ref:t,title:n,"data-testid":r,className:me(i,{standalone:o,active:s}),onClick:l,children:a},n)}),Ko=e=>g("div",{className:"buttonList",children:e.options.map(t=>e.type==="button"?g(XH,{icon:t.icon,title:t.text,testId:t.testId,active:t.active??e.value===t.value,onClick:n=>e.onClick(t.value,n)},t.text):P("label",{className:me({active:e.value===t.value}),title:t.text,children:[g("input",{type:"radio",name:e.group,onChange:()=>e.onChange(t.value),checked:e.value===t.value,"data-testid":t.testId}),t.icon]},t.text))}),_ge=({onChange:e,type:t,activeColor:n,topPicks:i})=>{let r;return t==="elementStroke"&&(r=MO),t==="elementBackground"&&(r=RO),t==="canvasBackground"&&(r=kO),i&&(r=i),r?g("div",{className:"color-picker__top-picks",children:r.map(s=>g("button",{className:me("color-picker__button",{active:s===n,"is-transparent":s==="transparent"||!s}),style:{"--swatch-color":s},type:"button",title:s,onClick:()=>e(s),"data-testid":`color-top-pick-${s}`,children:g("div",{className:"color-picker__button-outline"})},s))}):(console.error("Invalid type for TopPicks"),null)},jH=()=>g("div",{style:{width:1,height:"1rem",backgroundColor:"var(--default-border-color)",margin:"0 auto"}}),E5=({palette:e,color:t})=>{for(const[n,i]of Object.entries(e))if(Array.isArray(i)){const r=i.indexOf(t);if(r>-1)return{colorName:n,shade:r}}else if(i===t)return{colorName:n,shade:null};return null},kE=[["q","w","e","r","t"],["a","s","d","f","g"],["z","x","c","v","b"]].flat(),YH=({color:e,palette:t})=>!Object.values(t).flat().includes(e),wge=(e,t,n)=>{const i={elementBackground:"backgroundColor",elementStroke:"strokeColor"},r=e.filter(o=>{if(o.isDeleted)return!1;const a=o[i[t]];return YH({color:a,palette:n})}),s=new Map;return r.forEach(o=>{const a=o[i[t]];s.has(a)?s.set(a,s.get(a)+1):s.set(a,1)}),[...s.entries()].sort((o,a)=>a[1]-o[1]).map(o=>o[0]).slice(0,nQ)},r1=qt(null),PA=(e,t,n)=>(e*299+t*587+n*114)/1e3>=160?"black":"white",Tge=(e,t)=>{if(t){const s=new Option().style;if(s.color=e,s.color){const o=s.color.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(","),a=parseInt(o[0]),l=parseInt(o[1]),c=parseInt(o[2]);return PA(a,l,c)}}if(e==="transparent")return"black";const n=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16);return PA(n,i,r)},p_=({color:e,keyLabel:t,isCustomColor:n=!1,isShade:i=!1})=>P("div",{className:"color-picker__button__hotkey-label",style:{color:Tge(e,n)},children:[i&&"⇧",t]}),Sge=({hex:e,onChange:t,palette:n})=>{const i=E5({color:e||"transparent",palette:n}),[r,s]=gn(r1),o=M.useRef(null);if(M.useEffect(()=>{o.current&&r==="shades"&&o.current.focus()},[i,r]),i){const{colorName:a,shade:l}=i,c=n[a];if(Array.isArray(c))return g("div",{className:"color-picker-content--default shades",children:c.map((u,d)=>P("button",{ref:d===l&&r==="shades"?o:void 0,tabIndex:-1,type:"button",className:me("color-picker__button color-picker__button--large",{active:d===l}),"aria-label":"Shade",title:`${a} - ${d+1}`,style:u?{"--swatch-color":u}:void 0,onClick:()=>{t(u),s("shades")},children:[g("div",{className:"color-picker__button-outline"}),g(p_,{color:u,keyLabel:d+1,isShade:!0})]},d))})}return P("div",{className:"color-picker-content--default",style:{position:"relative"},tabIndex:-1,children:[g("button",{type:"button",tabIndex:-1,className:"color-picker__button color-picker__button--large color-picker__button--no-focus-visible"}),g("div",{tabIndex:-1,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",fontSize:"0.75rem"},children:L("colorPicker.noShades")})]})},Ige=({palette:e,color:t,onChange:n,label:i,activeShade:r})=>{const s=E5({color:t||"transparent",palette:e}),[o,a]=gn(r1),l=M.useRef(null);return M.useEffect(()=>{l.current&&o==="baseColors"&&l.current.focus()},[s==null?void 0:s.colorName,o]),g("div",{className:"color-picker-content--default",children:Object.entries(e).map(([c,u],d)=>{const f=(Array.isArray(u)?u[r]:u)||"transparent",h=kE[d],m=L(`colors.${c.replace(/\d+/,"")}`,null,"");return P("button",{ref:(s==null?void 0:s.colorName)===c?l:void 0,tabIndex:-1,type:"button",className:me("color-picker__button color-picker__button--large",{active:(s==null?void 0:s.colorName)===c,"is-transparent":f==="transparent"||!1}),onClick:()=>{n(f),a("baseColors")},title:`${m}${f.startsWith("#")?` ${f}`:""} — ${h}`,"aria-label":`${m} — ${h}`,style:{"--swatch-color":f},"data-testid":`color-${c}`,children:[g("div",{className:"color-picker__button-outline"}),g(p_,{color:f,keyLabel:h})]},c)})})},xge=({colors:e,color:t,onChange:n,label:i})=>{const[r,s]=gn(r1),o=M.useRef(null);return M.useEffect(()=>{o.current&&o.current.focus()},[t,r]),g("div",{className:"color-picker-content--default",children:e.map((a,l)=>P("button",{ref:t===a?o:void 0,tabIndex:-1,type:"button",className:me("color-picker__button color-picker__button--large",{active:t===a,"is-transparent":a==="transparent"||!a}),onClick:()=>{n(a),s("custom")},title:a,"aria-label":i,style:{"--swatch-color":a},children:[g("div",{className:"color-picker__button-outline"}),g(p_,{color:a,keyLabel:l+1,isCustomColor:!0})]},l))})},K8=(e,t,n)=>{const i=Math.ceil(n/lf);switch(t=t??-1,e){case"ArrowLeft":{const r=t-1;return r<0?n-1:r}case"ArrowRight":return(t+1)%n;case"ArrowDown":{const r=t+lf;return r>=n?t%lf:r}case"ArrowUp":{const r=t-lf,s=r<0?lf*i+r:r;return s>=n?void 0:s}}},Cge=({e,colorObj:t,onChange:n,palette:i,customColors:r,setActiveColorPickerSection:s,activeShade:o})=>{if((t==null?void 0:t.shade)!=null&&["Digit1","Digit2","Digit3","Digit4","Digit5"].includes(e.code)&&e.shiftKey){const a=Number(e.code.slice(-1))-1;return n(i[t.colorName][a]),s("shades"),!0}if(["1","2","3","4","5"].includes(e.key)&&r[Number(e.key)-1])return n(r[Number(e.key)-1]),s("custom"),!0;if(kE.includes(e.key)){const a=kE.indexOf(e.key),l=Object.keys(i)[a],c=i[l],u=Array.isArray(c)?c[o]:c;return n(u),s("baseColors"),!0}return!1},Age=({event:e,activeColorPickerSection:t,palette:n,color:i,onChange:r,customColors:s,setActiveColorPickerSection:o,updateData:a,activeShade:l,onEyeDropperToggle:c,onEscape:u})=>{if(e[z.CTRL_OR_CMD])return!1;if(e.key===z.ESCAPE)return u(e),!0;if(e.key===z.ALT)return c(!0),!0;if(e.key===z.I)return c(),!0;const d=E5({color:i,palette:n});if(e.key===z.TAB){const f={custom:!!s.length,baseColors:!0,shades:(d==null?void 0:d.shade)!=null,hex:!0},h=Object.entries(f).reduce((y,[v,_])=>(_&&y.push(v),y),[]),m=h.indexOf(t),p=e.shiftKey?-1:1,b=m+p>h.length-1?0:m+p<0?h.length-1:m+p,E=h[b];return E&&o(E),E==="custom"?r(s[0]):E==="baseColors"&&(Object.entries(n).find(([v,_])=>Array.isArray(_)?_.includes(i):_===i?v:null)||r($e.black)),e.preventDefault(),e.stopPropagation(),!0}if(Cge({e,colorObj:d,onChange:r,palette:n,customColors:s,setActiveColorPickerSection:o,activeShade:l}))return!0;if(t==="shades"&&d){const{shade:f}=d,h=K8(e.key,f,lf);if(h!==void 0)return r(n[d.colorName][h]),!0}if(t==="baseColors"&&d){const{colorName:f}=d,h=Object.keys(n),m=h.indexOf(f),p=K8(e.key,m,h.length);if(p!==void 0){const b=h[p],E=n[b];return r(Array.isArray(E)?E[l]:E),!0}}if(t==="custom"){const f=s.indexOf(i),h=K8(e.key,f,s.length);if(h!==void 0){const m=s[h];return r(m),!0}}return!1},l2=({children:e})=>g("div",{className:"color-picker__heading",children:e}),Mge=({color:e,onChange:t,label:n,type:i,elements:r,palette:s,updateData:o,children:a,onEyeDropperToggle:l,onEscape:c})=>{const[u]=se.useState(()=>i==="canvasBackground"?[]:wge(r,i,s)),[d,f]=gn(r1),h=E5({color:e,palette:s});M.useEffect(()=>{if(!d){const E=YH({color:e,palette:s}),y=E&&!u.includes(e);f(y?"hex":E?"custom":(h==null?void 0:h.shade)!=null?"shades":"baseColors")}},[d,e,s,f,h,u]);const[m,p]=M.useState((h==null?void 0:h.shade)??(i==="elementBackground"?lg:ag));M.useEffect(()=>{(h==null?void 0:h.shade)!=null&&p(h.shade);const E=y=>{y.key===z.ALT&&l(!1)};return document.addEventListener(te.KEYUP,E,{capture:!0}),()=>{document.removeEventListener(te.KEYUP,E,{capture:!0})}},[h,l]);const b=se.useRef(null);return g("div",{role:"dialog","aria-modal":"true","aria-label":L("labels.colorPicker"),children:P("div",{ref:b,onKeyDown:E=>{Age({event:E,activeColorPickerSection:d,palette:s,color:e,onChange:t,onEyeDropperToggle:l,customColors:u,setActiveColorPickerSection:f,updateData:o,activeShade:m,onEscape:c})&&(E.preventDefault(),E.stopPropagation())},className:"color-picker-content properties-content",tabIndex:-1,children:[!!u.length&&P("div",{children:[g(l2,{children:L("colorPicker.mostUsedCustomColors")}),g(xge,{colors:u,color:e,label:L("colorPicker.mostUsedCustomColors"),onChange:t})]}),P("div",{children:[g(l2,{children:L("colorPicker.colors")}),g(Ige,{color:e,label:n,palette:s,onChange:t,activeShade:m})]}),P("div",{children:[g(l2,{children:L("colorPicker.shades")}),g(Sge,{hex:e,onChange:t,palette:s})]}),a]})})};function e0(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function FA(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function U_(...e){return t=>{let n=!1;const i=e.map(r=>{const s=FA(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():FA(e[r],null)}}}}function zc(...e){return M.useCallback(U_(...e),e)}function Rge(e,t=[]){let n=[];function i(s,o){const a=M.createContext(o),l=n.length;n=[...n,o];const c=d=>{var E;const{scope:f,children:h,...m}=d,p=((E=f==null?void 0:f[e])==null?void 0:E[l])||a,b=M.useMemo(()=>m,Object.values(m));return g(p.Provider,{value:b,children:h})};c.displayName=s+"Provider";function u(d,f){var p;const h=((p=f==null?void 0:f[e])==null?void 0:p[l])||a,m=M.useContext(h);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=n.map(o=>M.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return M.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[i,kge(r,...t)]}function kge(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return M.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Z8(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}var WH=M.forwardRef((e,t)=>{const{children:n,...i}=e,r=M.Children.toArray(n),s=r.find(Dge);if(s){const o=s.props.children,a=r.map(l=>l===s?M.Children.count(o)>1?M.Children.only(null):M.isValidElement(o)?o.props.children:null:l);return g(LE,{...i,ref:t,children:M.isValidElement(o)?M.cloneElement(o,void 0,a):null})}return g(LE,{...i,ref:t,children:n})});WH.displayName="Slot";var LE=M.forwardRef((e,t)=>{const{children:n,...i}=e;if(M.isValidElement(n)){const r=Oge(n),s=Nge(i,n.props);return n.type!==M.Fragment&&(s.ref=t?U_(t,r):r),M.cloneElement(n,s)}return M.Children.count(n)>1?M.Children.only(null):null});LE.displayName="SlotClone";var Lge=({children:e})=>g(he,{children:e});function Dge(e){return M.isValidElement(e)&&e.type===Lge}function Nge(e,t){const n={...t};for(const i in t){const r=e[i],s=t[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...a)=>{s(...a),r(...a)}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Oge(e){var i,r;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Pge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ll=Pge.reduce((e,t)=>{const n=M.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?WH:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g(a,{...o,ref:r})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Fge(e,t){e&&Xn.flushSync(()=>e.dispatchEvent(t))}function _c(e){const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var i;return(i=t.current)==null?void 0:i.call(t,...n)},[])}function Bge(e,t=globalThis==null?void 0:globalThis.document){const n=_c(e);M.useEffect(()=>{const i=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",i,{capture:!0}),()=>t.removeEventListener("keydown",i,{capture:!0})},[n,t])}var zge="DismissableLayer",DE="dismissableLayer.update",Hge="dismissableLayer.pointerDownOutside",Vge="dismissableLayer.focusOutside",BA,KH=M.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ZH=M.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=M.useContext(KH),[u,d]=M.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=M.useState({}),m=zc(t,w=>d(w)),p=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),E=p.indexOf(b),y=u?p.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,_=y>=E,I=Xge(w=>{const T=w.target,A=[...c.branches].some(S=>S.contains(T));!_||A||(r==null||r(w),o==null||o(w),w.defaultPrevented||a==null||a())},f),R=jge(w=>{const T=w.target;[...c.branches].some(S=>S.contains(T))||(s==null||s(w),o==null||o(w),w.defaultPrevented||a==null||a())},f);return Bge(w=>{y===c.layers.size-1&&(i==null||i(w),!w.defaultPrevented&&a&&(w.preventDefault(),a()))},f),M.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(BA=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),zA(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=BA)}},[u,f,n,c]),M.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),zA())},[u,c]),M.useEffect(()=>{const w=()=>h({});return document.addEventListener(DE,w),()=>document.removeEventListener(DE,w)},[]),g(ll.div,{...l,ref:m,style:{pointerEvents:v?_?"auto":"none":void 0,...e.style},onFocusCapture:Z8(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Z8(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Z8(e.onPointerDownCapture,I.onPointerDownCapture)})});ZH.displayName=zge;var $ge="DismissableLayerBranch",Gge=M.forwardRef((e,t)=>{const n=M.useContext(KH),i=M.useRef(null),r=zc(t,i);return M.useEffect(()=>{const s=i.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g(ll.div,{...e,ref:r})});Gge.displayName=$ge;function Xge(e,t=globalThis==null?void 0:globalThis.document){const n=_c(e),i=M.useRef(!1),r=M.useRef(()=>{});return M.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let l=function(){qH(Hge,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>i.current=!0}}function jge(e,t=globalThis==null?void 0:globalThis.document){const n=_c(e),i=M.useRef(!1);return M.useEffect(()=>{const r=s=>{s.target&&!i.current&&qH(Vge,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function zA(){const e=new CustomEvent(DE);document.dispatchEvent(e)}function qH(e,t,n,{discrete:i}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),i?Fge(r,s):r.dispatchEvent(s)}var q8=0;function Yge(){M.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??HA()),document.body.insertAdjacentElement("beforeend",e[1]??HA()),q8++,()=>{q8===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),q8--}},[])}function HA(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Q8="focusScope.autoFocusOnMount",J8="focusScope.autoFocusOnUnmount",VA={bubbles:!1,cancelable:!0},Wge="FocusScope",QH=M.forwardRef((e,t)=>{const{loop:n=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=e,[a,l]=M.useState(null),c=_c(r),u=_c(s),d=M.useRef(null),f=zc(t,p=>l(p)),h=M.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;M.useEffect(()=>{if(i){let p=function(v){if(h.paused||!a)return;const _=v.target;a.contains(_)?d.current=_:_l(d.current,{select:!0})},b=function(v){if(h.paused||!a)return;const _=v.relatedTarget;_!==null&&(a.contains(_)||_l(d.current,{select:!0}))},E=function(v){if(document.activeElement===document.body)for(const I of v)I.removedNodes.length>0&&_l(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",b);const y=new MutationObserver(E);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",b),y.disconnect()}}},[i,a,h.paused]),M.useEffect(()=>{if(a){GA.add(h);const p=document.activeElement;if(!a.contains(p)){const E=new CustomEvent(Q8,VA);a.addEventListener(Q8,c),a.dispatchEvent(E),E.defaultPrevented||(Kge(e0e(JH(a)),{select:!0}),document.activeElement===p&&_l(a))}return()=>{a.removeEventListener(Q8,c),setTimeout(()=>{const E=new CustomEvent(J8,VA);a.addEventListener(J8,u),a.dispatchEvent(E),E.defaultPrevented||_l(p??document.body,{select:!0}),a.removeEventListener(J8,u),GA.remove(h)},0)}}},[a,c,u,h]);const m=M.useCallback(p=>{if(!n&&!i||h.paused)return;const b=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,E=document.activeElement;if(b&&E){const y=p.currentTarget,[v,_]=Zge(y);v&&_?!p.shiftKey&&E===_?(p.preventDefault(),n&&_l(v,{select:!0})):p.shiftKey&&E===v&&(p.preventDefault(),n&&_l(_,{select:!0})):E===y&&p.preventDefault()}},[n,i,h.paused]);return g(ll.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});QH.displayName=Wge;function Kge(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(_l(i,{select:t}),document.activeElement!==n)return}function Zge(e){const t=JH(e),n=$A(t,e),i=$A(t.reverse(),e);return[n,i]}function JH(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $A(e,t){for(const n of e)if(!qge(n,{upTo:t}))return n}function qge(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Qge(e){return e instanceof HTMLInputElement&&"select"in e}function _l(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Qge(e)&&t&&e.select()}}var GA=Jge();function Jge(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=XA(e,t),e.unshift(t)},remove(t){var n;e=XA(e,t),(n=e[0])==null||n.resume()}}}function XA(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}function e0e(e){return e.filter(t=>t.tagName!=="A")}var ad=globalThis!=null&&globalThis.document?M.useLayoutEffect:()=>{},t0e=GL.useId||(()=>{}),n0e=0;function i0e(e){const[t,n]=M.useState(t0e());return ad(()=>{n(i=>i??String(n0e++))},[e]),e||(t?`radix-${t}`:"")}const r0e=["top","right","bottom","left"],wc=Math.min,xr=Math.max,Ob=Math.round,sU=Math.floor,No=e=>({x:e,y:e}),s0e={left:"right",right:"left",bottom:"top",top:"bottom"},o0e={start:"end",end:"start"};function NE(e,t,n){return xr(e,wc(t,n))}function Qa(e,t){return typeof e=="function"?e(t):e}function Ja(e){return e.split("-")[0]}function s1(e){return e.split("-")[1]}function b_(e){return e==="x"?"y":"x"}function y_(e){return e==="y"?"height":"width"}function Tc(e){return["top","bottom"].includes(Ja(e))?"y":"x"}function E_(e){return b_(Tc(e))}function a0e(e,t,n){n===void 0&&(n=!1);const i=s1(e),r=E_(e),s=y_(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Pb(o)),[o,Pb(o)]}function l0e(e){const t=Pb(e);return[OE(e),t,OE(t)]}function OE(e){return e.replace(/start|end/g,t=>o0e[t])}function c0e(e,t,n){const i=["left","right"],r=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:i:t?i:r;case"left":case"right":return t?s:o;default:return[]}}function u0e(e,t,n,i){const r=s1(e);let s=c0e(Ja(e),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),t&&(s=s.concat(s.map(OE)))),s}function Pb(e){return e.replace(/left|right|bottom|top/g,t=>s0e[t])}function d0e(e){return{top:0,right:0,bottom:0,left:0,...e}}function eV(e){return typeof e!="number"?d0e(e):{top:e,right:e,bottom:e,left:e}}function Fb(e){const{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function jA(e,t,n){let{reference:i,floating:r}=e;const s=Tc(t),o=E_(t),a=y_(o),l=Ja(t),c=s==="y",u=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,f=i[a]/2-r[a]/2;let h;switch(l){case"top":h={x:u,y:i.y-r.height};break;case"bottom":h={x:u,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:d};break;case"left":h={x:i.x-r.width,y:d};break;default:h={x:i.x,y:i.y}}switch(s1(t)){case"start":h[o]-=f*(n&&c?-1:1);break;case"end":h[o]+=f*(n&&c?-1:1);break}return h}const f0e=async(e,t,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=jA(c,i,l),f=i,h={},m=0;for(let p=0;p<a.length;p++){const{name:b,fn:E}=a[p],{x:y,y:v,data:_,reset:I}=await E({x:u,y:d,initialPlacement:i,placement:f,strategy:r,middlewareData:h,rects:c,platform:o,elements:{reference:e,floating:t}});u=y??u,d=v??d,h={...h,[b]:{...h[b],..._}},I&&m<=50&&(m++,typeof I=="object"&&(I.placement&&(f=I.placement),I.rects&&(c=I.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):I.rects),{x:u,y:d}=jA(c,f,l)),p=-1)}return{x:u,y:d,placement:f,strategy:r,middlewareData:h}};async function rm(e,t){var n;t===void 0&&(t={});const{x:i,y:r,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Qa(t,e),m=eV(h),b=a[f?d==="floating"?"reference":"floating":d],E=Fb(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=d==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),_=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},I=Fb(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return{top:(E.top-I.top+m.top)/_.y,bottom:(I.bottom-E.bottom+m.bottom)/_.y,left:(E.left-I.left+m.left)/_.x,right:(I.right-E.right+m.right)/_.x}}const h0e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Qa(e,t)||{};if(c==null)return{};const d=eV(u),f={x:n,y:i},h=E_(r),m=y_(h),p=await o.getDimensions(c),b=h==="y",E=b?"top":"left",y=b?"bottom":"right",v=b?"clientHeight":"clientWidth",_=s.reference[m]+s.reference[h]-f[h]-s.floating[m],I=f[h]-s.reference[h],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let w=R?R[v]:0;(!w||!await(o.isElement==null?void 0:o.isElement(R)))&&(w=a.floating[v]||s.floating[m]);const T=_/2-I/2,A=w/2-p[m]/2-1,S=wc(d[E],A),k=wc(d[y],A),N=S,D=w-p[m]-k,G=w/2-p[m]/2+T,V=NE(N,G,D),H=!l.arrow&&s1(r)!=null&&G!==V&&s.reference[m]/2-(G<N?S:k)-p[m]/2<0,$=H?G<N?G-N:G-D:0;return{[h]:f[h]+$,data:{[h]:V,centerOffset:G-V-$,...H&&{alignmentOffset:$}},reset:H}}}),g0e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...b}=Qa(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const E=Ja(r),y=Tc(a),v=Ja(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),I=f||(v||!p?[Pb(a)]:l0e(a)),R=m!=="none";!f&&R&&I.push(...u0e(a,p,m,_));const w=[a,...I],T=await rm(t,b),A=[];let S=((i=s.flip)==null?void 0:i.overflows)||[];if(u&&A.push(T[E]),d){const G=a0e(r,o,_);A.push(T[G[0]],T[G[1]])}if(S=[...S,{placement:r,overflows:A}],!A.every(G=>G<=0)){var k,N;const G=(((k=s.flip)==null?void 0:k.index)||0)+1,V=w[G];if(V)return{data:{index:G,overflows:S},reset:{placement:V}};let H=(N=S.filter($=>$.overflows[0]<=0).sort(($,j)=>$.overflows[1]-j.overflows[1])[0])==null?void 0:N.placement;if(!H)switch(h){case"bestFit":{var D;const $=(D=S.filter(j=>{if(R){const X=Tc(j.placement);return X===y||X==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(X=>X>0).reduce((X,Y)=>X+Y,0)]).sort((j,X)=>j[1]-X[1])[0])==null?void 0:D[0];$&&(H=$);break}case"initialPlacement":H=a;break}if(r!==H)return{reset:{placement:H}}}return{}}}};function YA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function WA(e){return r0e.some(t=>e[t]>=0)}const m0e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:i="referenceHidden",...r}=Qa(e,t);switch(i){case"referenceHidden":{const s=await rm(t,{...r,elementContext:"reference"}),o=YA(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:WA(o)}}}case"escaped":{const s=await rm(t,{...r,altBoundary:!0}),o=YA(s,n.floating);return{data:{escapedOffsets:o,escaped:WA(o)}}}default:return{}}}}};async function p0e(e,t){const{placement:n,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Ja(n),a=s1(n),l=Tc(n)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,d=Qa(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const U0e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:r,y:s,placement:o,middlewareData:a}=t,l=await p0e(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:o}}}}},b0e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:r}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:b=>{let{x:E,y}=b;return{x:E,y}}},...l}=Qa(e,t),c={x:n,y:i},u=await rm(t,l),d=Tc(Ja(r)),f=b_(d);let h=c[f],m=c[d];if(s){const b=f==="y"?"top":"left",E=f==="y"?"bottom":"right",y=h+u[b],v=h-u[E];h=NE(y,h,v)}if(o){const b=d==="y"?"top":"left",E=d==="y"?"bottom":"right",y=m+u[b],v=m-u[E];m=NE(y,m,v)}const p=a.fn({...t,[f]:h,[d]:m});return{...p,data:{x:p.x-n,y:p.y-i,enabled:{[f]:s,[d]:o}}}}}},y0e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:i,placement:r,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Qa(e,t),u={x:n,y:i},d=Tc(r),f=b_(d);let h=u[f],m=u[d];const p=Qa(a,t),b=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const v=f==="y"?"height":"width",_=s.reference[f]-s.floating[v]+b.mainAxis,I=s.reference[f]+s.reference[v]-b.mainAxis;h<_?h=_:h>I&&(h=I)}if(c){var E,y;const v=f==="y"?"width":"height",_=["top","left"].includes(Ja(r)),I=s.reference[d]-s.floating[v]+(_&&((E=o.offset)==null?void 0:E[d])||0)+(_?0:b.crossAxis),R=s.reference[d]+s.reference[v]+(_?0:((y=o.offset)==null?void 0:y[d])||0)-(_?b.crossAxis:0);m<I?m=I:m>R&&(m=R)}return{[f]:h,[d]:m}}}},E0e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,i;const{placement:r,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...c}=Qa(e,t),u=await rm(t,c),d=Ja(r),f=s1(r),h=Tc(r)==="y",{width:m,height:p}=s.floating;let b,E;d==="top"||d==="bottom"?(b=d,E=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(E=d,b=f==="end"?"top":"bottom");const y=p-u.top-u.bottom,v=m-u.left-u.right,_=wc(p-u[b],y),I=wc(m-u[E],v),R=!t.middlewareData.shift;let w=_,T=I;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=v),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(w=y),R&&!f){const S=xr(u.left,0),k=xr(u.right,0),N=xr(u.top,0),D=xr(u.bottom,0);h?T=m-2*(S!==0||k!==0?S+k:xr(u.left,u.right)):w=p-2*(N!==0||D!==0?N+D:xr(u.top,u.bottom))}await l({...t,availableWidth:T,availableHeight:w});const A=await o.getDimensions(a.floating);return m!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function v5(){return typeof window<"u"}function o1(e){return tV(e)?(e.nodeName||"").toLowerCase():"#document"}function Pr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zo(e){var t;return(t=(tV(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function tV(e){return v5()?e instanceof Node||e instanceof Pr(e).Node:!1}function to(e){return v5()?e instanceof Element||e instanceof Pr(e).Element:!1}function $o(e){return v5()?e instanceof HTMLElement||e instanceof Pr(e).HTMLElement:!1}function KA(e){return!v5()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pr(e).ShadowRoot}function Km(e){const{overflow:t,overflowX:n,overflowY:i,display:r}=no(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(r)}function v0e(e){return["table","td","th"].includes(o1(e))}function _5(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function v_(e){const t=__(),n=to(e)?no(e):e;return["transform","translate","scale","rotate","perspective"].some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function _0e(e){let t=Sc(e);for(;$o(t)&&!xh(t);){if(v_(t))return t;if(_5(t))return null;t=Sc(t)}return null}function __(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xh(e){return["html","body","#document"].includes(o1(e))}function no(e){return Pr(e).getComputedStyle(e)}function w5(e){return to(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sc(e){if(o1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||KA(e)&&e.host||Zo(e);return KA(t)?t.host:t}function nV(e){const t=Sc(e);return xh(t)?e.ownerDocument?e.ownerDocument.body:e.body:$o(t)&&Km(t)?t:nV(t)}function sm(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=nV(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),o=Pr(r);if(s){const a=PE(o);return t.concat(o,o.visualViewport||[],Km(r)?r:[],a&&n?sm(a):[])}return t.concat(r,sm(r,[],n))}function PE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function iV(e){const t=no(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=$o(e),s=r?e.offsetWidth:n,o=r?e.offsetHeight:i,a=Ob(n)!==s||Ob(i)!==o;return a&&(n=s,i=o),{width:n,height:i,$:a}}function w_(e){return to(e)?e:e.contextElement}function qf(e){const t=w_(e);if(!$o(t))return No(1);const n=t.getBoundingClientRect(),{width:i,height:r,$:s}=iV(t);let o=(s?Ob(n.width):n.width)/i,a=(s?Ob(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const w0e=No(0);function rV(e){const t=Pr(e);return!__()||!t.visualViewport?w0e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function T0e(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pr(e)?!1:t}function ld(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=w_(e);let o=No(1);t&&(i?to(i)&&(o=qf(i)):o=qf(e));const a=T0e(s,n,i)?rV(s):No(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,u=r.width/o.x,d=r.height/o.y;if(s){const f=Pr(s),h=i&&to(i)?Pr(i):i;let m=f,p=PE(m);for(;p&&i&&h!==m;){const b=qf(p),E=p.getBoundingClientRect(),y=no(p),v=E.left+(p.clientLeft+parseFloat(y.paddingLeft))*b.x,_=E.top+(p.clientTop+parseFloat(y.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=v,c+=_,m=Pr(p),p=PE(m)}}return Fb({width:u,height:d,x:l,y:c})}function T_(e,t){const n=w5(e).scrollLeft;return t?t.left+n:ld(Zo(e)).left+n}function sV(e,t,n){n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=i.left+t.scrollLeft-(n?0:T_(e,i)),s=i.top+t.scrollTop;return{x:r,y:s}}function S0e(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e;const s=r==="fixed",o=Zo(i),a=t?_5(t.floating):!1;if(i===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=No(1);const u=No(0),d=$o(i);if((d||!d&&!s)&&((o1(i)!=="body"||Km(o))&&(l=w5(i)),$o(i))){const h=ld(i);c=qf(i),u.x=h.x+i.clientLeft,u.y=h.y+i.clientTop}const f=o&&!d&&!s?sV(o,l,!0):No(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function I0e(e){return Array.from(e.getClientRects())}function x0e(e){const t=Zo(e),n=w5(e),i=e.ownerDocument.body,r=xr(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=xr(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let o=-n.scrollLeft+T_(e);const a=-n.scrollTop;return no(i).direction==="rtl"&&(o+=xr(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function C0e(e,t){const n=Pr(e),i=Zo(e),r=n.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=__();(!c||c&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}function A0e(e,t){const n=ld(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=$o(e)?qf(e):No(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function ZA(e,t,n){let i;if(t==="viewport")i=C0e(e,n);else if(t==="document")i=x0e(Zo(e));else if(to(t))i=A0e(t,n);else{const r=rV(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Fb(i)}function oV(e,t){const n=Sc(e);return n===t||!to(n)||xh(n)?!1:no(n).position==="fixed"||oV(n,t)}function M0e(e,t){const n=t.get(e);if(n)return n;let i=sm(e,[],!1).filter(a=>to(a)&&o1(a)!=="body"),r=null;const s=no(e).position==="fixed";let o=s?Sc(e):e;for(;to(o)&&!xh(o);){const a=no(o),l=v_(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Km(o)&&!l&&oV(e,o))?i=i.filter(u=>u!==o):r=a,o=Sc(o)}return t.set(e,i),i}function R0e(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e;const o=[...n==="clippingAncestors"?_5(t)?[]:M0e(t,this._c):[].concat(n),i],a=o[0],l=o.reduce((c,u)=>{const d=ZA(t,u,r);return c.top=xr(d.top,c.top),c.right=wc(d.right,c.right),c.bottom=wc(d.bottom,c.bottom),c.left=xr(d.left,c.left),c},ZA(t,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function k0e(e){const{width:t,height:n}=iV(e);return{width:t,height:n}}function L0e(e,t,n){const i=$o(t),r=Zo(t),s=n==="fixed",o=ld(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=No(0);if(i||!i&&!s)if((o1(t)!=="body"||Km(r))&&(a=w5(t)),i){const f=ld(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else r&&(l.x=T_(r));const c=r&&!i&&!s?sV(r,a):No(0),u=o.left+a.scrollLeft-l.x-c.x,d=o.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:o.width,height:o.height}}function e7(e){return no(e).position==="static"}function qA(e,t){if(!$o(e)||no(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zo(e)===n&&(n=n.ownerDocument.body),n}function aV(e,t){const n=Pr(e);if(_5(e))return n;if(!$o(e)){let r=Sc(e);for(;r&&!xh(r);){if(to(r)&&!e7(r))return r;r=Sc(r)}return n}let i=qA(e,t);for(;i&&v0e(i)&&e7(i);)i=qA(i,t);return i&&xh(i)&&e7(i)&&!v_(i)?n:i||_0e(e)||n}const D0e=async function(e){const t=this.getOffsetParent||aV,n=this.getDimensions,i=await n(e.floating);return{reference:L0e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function N0e(e){return no(e).direction==="rtl"}const O0e={convertOffsetParentRelativeRectToViewportRelativeRect:S0e,getDocumentElement:Zo,getClippingRect:R0e,getOffsetParent:aV,getElementRects:D0e,getClientRects:I0e,getDimensions:k0e,getScale:qf,isElement:to,isRTL:N0e};function lV(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function P0e(e,t){let n=null,i;const r=Zo(e);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||t(),!f||!h)return;const m=sU(d),p=sU(r.clientWidth-(u+f)),b=sU(r.clientHeight-(d+h)),E=sU(u),v={rootMargin:-m+"px "+-p+"px "+-b+"px "+-E+"px",threshold:xr(0,wc(1,l))||1};let _=!0;function I(R){const w=R[0].intersectionRatio;if(w!==l){if(!_)return o();w?o(!1,w):i=setTimeout(()=>{o(!1,1e-7)},1e3)}w===1&&!lV(c,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(I,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(I,v)}n.observe(e)}return o(!0),s}function F0e(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=w_(e),u=r||s?[...c?sm(c):[],...sm(t)]:[];u.forEach(E=>{r&&E.addEventListener("scroll",n,{passive:!0}),s&&E.addEventListener("resize",n)});const d=c&&a?P0e(c,n):null;let f=-1,h=null;o&&(h=new ResizeObserver(E=>{let[y]=E;y&&y.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let m,p=l?ld(e):null;l&&b();function b(){const E=ld(e);p&&!lV(p,E)&&n(),p=E,m=requestAnimationFrame(b)}return n(),()=>{var E;u.forEach(y=>{r&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),d==null||d(),(E=h)==null||E.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const B0e=U0e,z0e=b0e,H0e=g0e,V0e=E0e,$0e=m0e,QA=h0e,G0e=y0e,X0e=(e,t,n)=>{const i=new Map,r={platform:O0e,...n},s={...r.platform,_c:i};return f0e(e,t,{...r,platform:s})};var c2=typeof document<"u"?M.useLayoutEffect:M.useEffect;function Bb(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!Bb(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!Bb(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function cV(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function JA(e,t){const n=cV(e);return Math.round(t*n)/n}function t7(e){const t=M.useRef(e);return c2(()=>{t.current=e}),t}function j0e(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=M.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=M.useState(i);Bb(f,i)||h(i);const[m,p]=M.useState(null),[b,E]=M.useState(null),y=M.useCallback(j=>{j!==R.current&&(R.current=j,p(j))},[]),v=M.useCallback(j=>{j!==w.current&&(w.current=j,E(j))},[]),_=s||m,I=o||b,R=M.useRef(null),w=M.useRef(null),T=M.useRef(u),A=l!=null,S=t7(l),k=t7(r),N=t7(c),D=M.useCallback(()=>{if(!R.current||!w.current)return;const j={placement:t,strategy:n,middleware:f};k.current&&(j.platform=k.current),X0e(R.current,w.current,j).then(X=>{const Y={...X,isPositioned:N.current!==!1};G.current&&!Bb(T.current,Y)&&(T.current=Y,Xn.flushSync(()=>{d(Y)}))})},[f,t,n,k,N]);c2(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(j=>({...j,isPositioned:!1})))},[c]);const G=M.useRef(!1);c2(()=>(G.current=!0,()=>{G.current=!1}),[]),c2(()=>{if(_&&(R.current=_),I&&(w.current=I),_&&I){if(S.current)return S.current(_,I,D);D()}},[_,I,D,S,A]);const V=M.useMemo(()=>({reference:R,floating:w,setReference:y,setFloating:v}),[y,v]),H=M.useMemo(()=>({reference:_,floating:I}),[_,I]),$=M.useMemo(()=>{const j={position:n,left:0,top:0};if(!H.floating)return j;const X=JA(H.floating,u.x),Y=JA(H.floating,u.y);return a?{...j,transform:"translate("+X+"px, "+Y+"px)",...cV(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:Y}},[n,a,H.floating,u.x,u.y]);return M.useMemo(()=>({...u,update:D,refs:V,elements:H,floatingStyles:$}),[u,D,V,H,$])}const Y0e=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:r}=typeof e=="function"?e(n):e;return i&&t(i)?i.current!=null?QA({element:i.current,padding:r}).fn(n):{}:i?QA({element:i,padding:r}).fn(n):{}}}},W0e=(e,t)=>({...B0e(e),options:[e,t]}),K0e=(e,t)=>({...z0e(e),options:[e,t]}),Z0e=(e,t)=>({...G0e(e),options:[e,t]}),q0e=(e,t)=>({...H0e(e),options:[e,t]}),Q0e=(e,t)=>({...V0e(e),options:[e,t]}),J0e=(e,t)=>({...$0e(e),options:[e,t]}),eme=(e,t)=>({...Y0e(e),options:[e,t]});var tme="Arrow",uV=M.forwardRef((e,t)=>{const{children:n,width:i=10,height:r=5,...s}=e;return g(ll.svg,{...s,ref:t,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g("polygon",{points:"0,0 30,0 15,10"})})});uV.displayName=tme;var nme=uV;function ime(e,t=[]){let n=[];function i(s,o){const a=M.createContext(o),l=n.length;n=[...n,o];const c=d=>{var E;const{scope:f,children:h,...m}=d,p=((E=f==null?void 0:f[e])==null?void 0:E[l])||a,b=M.useMemo(()=>m,Object.values(m));return g(p.Provider,{value:b,children:h})};c.displayName=s+"Provider";function u(d,f){var p;const h=((p=f==null?void 0:f[e])==null?void 0:p[l])||a,m=M.useContext(h);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=n.map(o=>M.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return M.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[i,rme(r,...t)]}function rme(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return M.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function sme(e){const[t,n]=M.useState(void 0);return ad(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),t}var S_="Popper",[dV,fV]=ime(S_),[ome,hV]=dV(S_),gV=e=>{const{__scopePopper:t,children:n}=e,[i,r]=M.useState(null);return g(ome,{scope:t,anchor:i,onAnchorChange:r,children:n})};gV.displayName=S_;var mV="PopperAnchor",pV=M.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:i,...r}=e,s=hV(mV,n),o=M.useRef(null),a=zc(t,o);return M.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:g(ll.div,{...r,ref:a})});pV.displayName=mV;var I_="PopperContent",[ame,lme]=dV(I_),UV=M.forwardRef((e,t)=>{var Ze,on,_n,Ye,Qe,zt;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:m,...p}=e,b=hV(I_,n),[E,y]=M.useState(null),v=zc(t,Es=>y(Es)),[_,I]=M.useState(null),R=sme(_),w=(R==null?void 0:R.width)??0,T=(R==null?void 0:R.height)??0,A=i+(s!=="center"?"-"+s:""),S=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(c)?c:[c],N=k.length>0,D={padding:S,boundary:k.filter(ume),altBoundary:N},{refs:G,floatingStyles:V,placement:H,isPositioned:$,middlewareData:j}=j0e({strategy:"fixed",placement:A,whileElementsMounted:(...Es)=>F0e(...Es,{animationFrame:h==="always"}),elements:{reference:b.anchor},middleware:[W0e({mainAxis:r+T,alignmentAxis:o}),l&&K0e({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Z0e():void 0,...D}),l&&q0e({...D}),Q0e({...D,apply:({elements:Es,rects:Qo,availableWidth:ao,availableHeight:lo})=>{const{width:Vr,height:sy}=Qo.reference,Vc=Es.floating.style;Vc.setProperty("--radix-popper-available-width",`${ao}px`),Vc.setProperty("--radix-popper-available-height",`${lo}px`),Vc.setProperty("--radix-popper-anchor-width",`${Vr}px`),Vc.setProperty("--radix-popper-anchor-height",`${sy}px`)}}),_&&eme({element:_,padding:a}),dme({arrowWidth:w,arrowHeight:T}),f&&J0e({strategy:"referenceHidden",...D})]}),[X,Y]=EV(H),le=_c(m);ad(()=>{$&&(le==null||le())},[$,le]);const pe=(Ze=j.arrow)==null?void 0:Ze.x,ae=(on=j.arrow)==null?void 0:on.y,ze=((_n=j.arrow)==null?void 0:_n.centerOffset)!==0,[Xe,qe]=M.useState();return ad(()=>{E&&qe(window.getComputedStyle(E).zIndex)},[E]),g("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:$?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Xe,"--radix-popper-transform-origin":[(Ye=j.transformOrigin)==null?void 0:Ye.x,(Qe=j.transformOrigin)==null?void 0:Qe.y].join(" "),...((zt=j.hide)==null?void 0:zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g(ame,{scope:n,placedSide:X,onArrowChange:I,arrowX:pe,arrowY:ae,shouldHideArrow:ze,children:g(ll.div,{"data-side":X,"data-align":Y,...p,ref:v,style:{...p.style,animation:$?void 0:"none"}})})})});UV.displayName=I_;var bV="PopperArrow",cme={top:"bottom",right:"left",bottom:"top",left:"right"},yV=M.forwardRef(function(t,n){const{__scopePopper:i,...r}=t,s=lme(bV,i),o=cme[s.placedSide];return g("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:g(nme,{...r,ref:n,style:{...r.style,display:"block"}})})});yV.displayName=bV;function ume(e){return e!==null}var dme=e=>({name:"transformOrigin",options:e,fn(t){var b,E,y;const{placement:n,rects:i,middlewareData:r}=t,o=((b=r.arrow)==null?void 0:b.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=EV(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((E=r.arrow)==null?void 0:E.x)??0)+a/2,h=(((y=r.arrow)==null?void 0:y.y)??0)+l/2;let m="",p="";return c==="bottom"?(m=o?d:`${f}px`,p=`${-l}px`):c==="top"?(m=o?d:`${f}px`,p=`${i.floating.height+l}px`):c==="right"?(m=`${-l}px`,p=o?d:`${h}px`):c==="left"&&(m=`${i.floating.width+l}px`,p=o?d:`${h}px`),{data:{x:m,y:p}}}});function EV(e){const[t,n="center"]=e.split("-");return[t,n]}var fme=gV,vV=pV,hme=UV,gme=yV,mme="Portal",_V=M.forwardRef((e,t)=>{var a;const{container:n,...i}=e,[r,s]=M.useState(!1);ad(()=>s(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?lK.createPortal(g(ll.div,{...i,ref:t}),o):null});_V.displayName=mme;function pme(e,t){return M.useReducer((n,i)=>t[n][i]??n,e)}var x_=e=>{const{present:t,children:n}=e,i=Ume(t),r=typeof n=="function"?n({present:i.isPresent}):M.Children.only(n),s=zc(i.ref,bme(r));return typeof n=="function"||i.isPresent?M.cloneElement(r,{ref:s}):null};x_.displayName="Presence";function Ume(e){const[t,n]=M.useState(),i=M.useRef({}),r=M.useRef(e),s=M.useRef("none"),o=e?"mounted":"unmounted",[a,l]=pme(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return M.useEffect(()=>{const c=oU(i.current);s.current=a==="mounted"?c:"none"},[a]),ad(()=>{const c=i.current,u=r.current;if(u!==e){const f=s.current,h=oU(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),ad(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const p=oU(i.current).includes(h.animationName);if(h.target===t&&p&&(l("ANIMATION_END"),!r.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},f=h=>{h.target===t&&(s.current=oU(i.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:M.useCallback(c=>{c&&(i.current=getComputedStyle(c)),n(c)},[])}}function oU(e){return(e==null?void 0:e.animationName)||"none"}function bme(e){var i,r;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wV=M.forwardRef((e,t)=>{const{children:n,...i}=e,r=M.Children.toArray(n),s=r.find(Eme);if(s){const o=s.props.children,a=r.map(l=>l===s?M.Children.count(o)>1?M.Children.only(null):M.isValidElement(o)?o.props.children:null:l);return g(FE,{...i,ref:t,children:M.isValidElement(o)?M.cloneElement(o,void 0,a):null})}return g(FE,{...i,ref:t,children:n})});wV.displayName="Slot";var FE=M.forwardRef((e,t)=>{const{children:n,...i}=e;if(M.isValidElement(n)){const r=_me(n),s=vme(i,n.props);return n.type!==M.Fragment&&(s.ref=t?U_(t,r):r),M.cloneElement(n,s)}return M.Children.count(n)>1?M.Children.only(null):null});FE.displayName="SlotClone";var yme=({children:e})=>g(he,{children:e});function Eme(e){return M.isValidElement(e)&&e.type===yme}function vme(e,t){const n={...t};for(const i in t){const r=e[i],s=t[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...a)=>{s(...a),r(...a)}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function _me(e){var i,r;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function wme({prop:e,defaultProp:t,onChange:n=()=>{}}){const[i,r]=Tme({defaultProp:t,onChange:n}),s=e!==void 0,o=s?e:i,a=_c(n),l=M.useCallback(c=>{if(s){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else r(c)},[s,e,r,a]);return[o,l]}function Tme({defaultProp:e,onChange:t}){const n=M.useState(e),[i]=n,r=M.useRef(i),s=_c(t);return M.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),n}var Sme=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},qd=new WeakMap,aU=new WeakMap,lU={},n7=0,TV=function(e){return e&&(e.host||TV(e.parentNode))},Ime=function(e,t){return t.map(function(n){if(e.contains(n))return n;var i=TV(n);return i&&e.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},xme=function(e,t,n,i){var r=Ime(t,Array.isArray(e)?e:[e]);lU[n]||(lU[n]=new WeakMap);var s=lU[n],o=[],a=new Set,l=new Set(r),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};r.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var h=f.getAttribute(i),m=h!==null&&h!=="false",p=(qd.get(f)||0)+1,b=(s.get(f)||0)+1;qd.set(f,p),s.set(f,b),o.push(f),p===1&&m&&aU.set(f,!0),b===1&&f.setAttribute(n,"true"),m||f.setAttribute(i,"true")}catch(E){console.error("aria-hidden: cannot operate on ",f,E)}})};return u(t),a.clear(),n7++,function(){o.forEach(function(d){var f=qd.get(d)-1,h=s.get(d)-1;qd.set(d,f),s.set(d,h),f||(aU.has(d)||d.removeAttribute(i),aU.delete(d)),h||d.removeAttribute(n)}),n7--,n7||(qd=new WeakMap,qd=new WeakMap,aU=new WeakMap,lU={})}},Cme=function(e,t,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),r=Sme(e);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live]"))),xme(i,r,n,"aria-hidden")):function(){return null}},Co=function(){return Co=Object.assign||function(t){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Co.apply(this,arguments)};function SV(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}function Ame(e,t,n){if(n||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return e.concat(s||Array.prototype.slice.call(t))}var u2="right-scroll-bar-position",d2="width-before-scroll-bar",Mme="with-scroll-bars-hidden",Rme="--removed-body-scroll-bar-size";function i7(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function kme(e,t){var n=M.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(i){var r=n.value;r!==i&&(n.value=i,n.callback(i,r))}}}})[0];return n.callback=t,n.facade}var Lme=typeof window<"u"?M.useLayoutEffect:M.useEffect,eM=new WeakMap;function Dme(e,t){var n=kme(null,function(i){return e.forEach(function(r){return i7(r,i)})});return Lme(function(){var i=eM.get(n);if(i){var r=new Set(i),s=new Set(e),o=n.current;r.forEach(function(a){s.has(a)||i7(a,null)}),s.forEach(function(a){r.has(a)||i7(a,o)})}eM.set(n,e)},[e]),n}function Nme(e){return e}function Ome(e,t){t===void 0&&(t=Nme);var n=[],i=!1,r={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,i);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(i=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){i=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return r}function Pme(e){e===void 0&&(e={});var t=Ome(null);return t.options=Co({async:!0,ssr:!1},e),t}var IV=function(e){var t=e.sideCar,n=SV(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return M.createElement(i,Co({},n))};IV.isSideCarExport=!0;function Fme(e,t){return e.useMedium(t),IV}var xV=Pme(),r7=function(){},T5=M.forwardRef(function(e,t){var n=M.useRef(null),i=M.useState({onScrollCapture:r7,onWheelCapture:r7,onTouchMoveCapture:r7}),r=i[0],s=i[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,h=e.noIsolation,m=e.inert,p=e.allowPinchZoom,b=e.as,E=b===void 0?"div":b,y=e.gapMode,v=SV(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=f,I=Dme([n,t]),R=Co(Co({},v),r);return M.createElement(M.Fragment,null,u&&M.createElement(_,{sideCar:xV,removeScrollBar:c,shards:d,noIsolation:h,inert:m,setCallbacks:s,allowPinchZoom:!!p,lockRef:n,gapMode:y}),o?M.cloneElement(M.Children.only(a),Co(Co({},R),{ref:I})):M.createElement(E,Co({},R,{className:l,ref:I}),a))});T5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};T5.classNames={fullWidth:d2,zeroRight:u2};var Bme=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zme(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Bme();return t&&e.setAttribute("nonce",t),e}function Hme(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Vme(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var $me=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zme())&&(Hme(t,n),Vme(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Gme=function(){var e=$me();return function(t,n){M.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},CV=function(){var e=Gme(),t=function(n){var i=n.styles,r=n.dynamic;return e(i,r),null};return t},Xme={left:0,top:0,right:0,gap:0},s7=function(e){return parseInt(e||"",10)||0},jme=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[s7(n),s7(i),s7(r)]},Yme=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Xme;var t=jme(e),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-n+t[2]-t[0])}},Wme=CV(),Qf="data-scroll-locked",Kme=function(e,t,n,i){var r=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(Mme,` {
   overflow: hidden `).concat(i,`;
   padding-right: `).concat(a,"px ").concat(i,`;
  }
  body[`).concat(Qf,`] {
    overflow: hidden `).concat(i,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(i,";"),n==="margin"&&`
    padding-left: `.concat(r,`px;
    padding-top: `).concat(s,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(i,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(i,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(u2,` {
    right: `).concat(a,"px ").concat(i,`;
  }
  
  .`).concat(d2,` {
    margin-right: `).concat(a,"px ").concat(i,`;
  }
  
  .`).concat(u2," .").concat(u2,` {
    right: 0 `).concat(i,`;
  }
  
  .`).concat(d2," .").concat(d2,` {
    margin-right: 0 `).concat(i,`;
  }
  
  body[`).concat(Qf,`] {
    `).concat(Rme,": ").concat(a,`px;
  }
`)},tM=function(){var e=parseInt(document.body.getAttribute(Qf)||"0",10);return isFinite(e)?e:0},Zme=function(){M.useEffect(function(){return document.body.setAttribute(Qf,(tM()+1).toString()),function(){var e=tM()-1;e<=0?document.body.removeAttribute(Qf):document.body.setAttribute(Qf,e.toString())}},[])},qme=function(e){var t=e.noRelative,n=e.noImportant,i=e.gapMode,r=i===void 0?"margin":i;Zme();var s=M.useMemo(function(){return Yme(r)},[r]);return M.createElement(Wme,{styles:Kme(s,!t,r,n?"":"!important")})},BE=!1;if(typeof window<"u")try{var cU=Object.defineProperty({},"passive",{get:function(){return BE=!0,!0}});window.addEventListener("test",cU,cU),window.removeEventListener("test",cU,cU)}catch{BE=!1}var Qd=BE?{passive:!1}:!1,Qme=function(e){return e.tagName==="TEXTAREA"},AV=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qme(e)&&n[t]==="visible")},Jme=function(e){return AV(e,"overflowY")},epe=function(e){return AV(e,"overflowX")},nM=function(e,t){var n=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=MV(e,i);if(r){var s=RV(e,i),o=s[1],a=s[2];if(o>a)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},tpe=function(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;return[t,n,i]},npe=function(e){var t=e.scrollLeft,n=e.scrollWidth,i=e.clientWidth;return[t,n,i]},MV=function(e,t){return e==="v"?Jme(t):epe(t)},RV=function(e,t){return e==="v"?tpe(t):npe(t)},ipe=function(e,t){return e==="h"&&t==="rtl"?-1:1},rpe=function(e,t,n,i,r){var s=ipe(e,window.getComputedStyle(t).direction),o=s*i,a=n.target,l=t.contains(a),c=!1,u=o>0,d=0,f=0;do{var h=RV(e,a),m=h[0],p=h[1],b=h[2],E=p-b-s*m;(m||E)&&MV(e,a)&&(d+=E,f+=m),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},uU=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},iM=function(e){return[e.deltaX,e.deltaY]},rM=function(e){return e&&"current"in e?e.current:e},spe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ope=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},ape=0,Jd=[];function lpe(e){var t=M.useRef([]),n=M.useRef([0,0]),i=M.useRef(),r=M.useState(ape++)[0],s=M.useState(CV)[0],o=M.useRef(e);M.useEffect(function(){o.current=e},[e]),M.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var p=Ame([e.lockRef.current],(e.shards||[]).map(rM),!0).filter(Boolean);return p.forEach(function(b){return b.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var a=M.useCallback(function(p,b){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var E=uU(p),y=n.current,v="deltaX"in p?p.deltaX:y[0]-E[0],_="deltaY"in p?p.deltaY:y[1]-E[1],I,R=p.target,w=Math.abs(v)>Math.abs(_)?"h":"v";if("touches"in p&&w==="h"&&R.type==="range")return!1;var T=nM(w,R);if(!T)return!0;if(T?I=w:(I=w==="v"?"h":"v",T=nM(w,R)),!T)return!1;if(!i.current&&"changedTouches"in p&&(v||_)&&(i.current=I),!I)return!0;var A=i.current||I;return rpe(A,b,p,A==="h"?v:_)},[]),l=M.useCallback(function(p){var b=p;if(!(!Jd.length||Jd[Jd.length-1]!==s)){var E="deltaY"in b?iM(b):uU(b),y=t.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&spe(I.delta,E)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var v=(o.current.shards||[]).map(rM).filter(Boolean).filter(function(I){return I.contains(b.target)}),_=v.length>0?a(b,v[0]):!o.current.noIsolation;_&&b.cancelable&&b.preventDefault()}}},[]),c=M.useCallback(function(p,b,E,y){var v={name:p,delta:b,target:E,should:y,shadowParent:cpe(E)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(_){return _!==v})},1)},[]),u=M.useCallback(function(p){n.current=uU(p),i.current=void 0},[]),d=M.useCallback(function(p){c(p.type,iM(p),p.target,a(p,e.lockRef.current))},[]),f=M.useCallback(function(p){c(p.type,uU(p),p.target,a(p,e.lockRef.current))},[]);M.useEffect(function(){return Jd.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Qd),document.addEventListener("touchmove",l,Qd),document.addEventListener("touchstart",u,Qd),function(){Jd=Jd.filter(function(p){return p!==s}),document.removeEventListener("wheel",l,Qd),document.removeEventListener("touchmove",l,Qd),document.removeEventListener("touchstart",u,Qd)}},[]);var h=e.removeScrollBar,m=e.inert;return M.createElement(M.Fragment,null,m?M.createElement(s,{styles:ope(r)}):null,h?M.createElement(qme,{gapMode:e.gapMode}):null)}function cpe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const upe=Fme(xV,lpe);var kV=M.forwardRef(function(e,t){return M.createElement(T5,Co({},e,{ref:t,sideCar:upe}))});kV.classNames=T5.classNames;var C_="Popover",[LV,mxe]=Rge(C_,[fV]),Zm=fV(),[dpe,Hc]=LV(C_),DV=e=>{const{__scopePopover:t,children:n,open:i,defaultOpen:r,onOpenChange:s,modal:o=!1}=e,a=Zm(t),l=M.useRef(null),[c,u]=M.useState(!1),[d=!1,f]=wme({prop:i,defaultProp:r,onChange:s});return g(fme,{...a,children:g(dpe,{scope:t,contentId:i0e(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:M.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:M.useCallback(()=>u(!0),[]),onCustomAnchorRemove:M.useCallback(()=>u(!1),[]),modal:o,children:n})})};DV.displayName=C_;var NV="PopoverAnchor",fpe=M.forwardRef((e,t)=>{const{__scopePopover:n,...i}=e,r=Hc(NV,n),s=Zm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return M.useEffect(()=>(o(),()=>a()),[o,a]),g(vV,{...s,...i,ref:t})});fpe.displayName=NV;var OV="PopoverTrigger",PV=M.forwardRef((e,t)=>{const{__scopePopover:n,...i}=e,r=Hc(OV,n),s=Zm(n),o=zc(t,r.triggerRef),a=g(ll.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":$V(r.open),...i,ref:o,onClick:e0(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:g(vV,{asChild:!0,...s,children:a})});PV.displayName=OV;var A_="PopoverPortal",[hpe,gpe]=LV(A_,{forceMount:void 0}),FV=e=>{const{__scopePopover:t,forceMount:n,children:i,container:r}=e,s=Hc(A_,t);return g(hpe,{scope:t,forceMount:n,children:g(x_,{present:n||s.open,children:g(_V,{asChild:!0,container:r,children:i})})})};FV.displayName=A_;var Ch="PopoverContent",BV=M.forwardRef((e,t)=>{const n=gpe(Ch,e.__scopePopover),{forceMount:i=n.forceMount,...r}=e,s=Hc(Ch,e.__scopePopover);return g(x_,{present:i||s.open,children:s.modal?g(mpe,{...r,ref:t}):g(ppe,{...r,ref:t})})});BV.displayName=Ch;var mpe=M.forwardRef((e,t)=>{const n=Hc(Ch,e.__scopePopover),i=M.useRef(null),r=zc(t,i),s=M.useRef(!1);return M.useEffect(()=>{const o=i.current;if(o)return Cme(o)},[]),g(kV,{as:wV,allowPinchZoom:!0,children:g(zV,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:e0(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:e0(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:e0(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),ppe=M.forwardRef((e,t)=>{const n=Hc(Ch,e.__scopePopover),i=M.useRef(!1),r=M.useRef(!1);return g(zV,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(i.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),i.current=!1,r.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(i.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),zV=M.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,f=Hc(Ch,n),h=Zm(n);return Yge(),g(QH,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s,children:g(ZH,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g(hme,{"data-state":$V(f.open),role:"dialog",id:f.contentId,...h,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),HV="PopoverClose",Upe=M.forwardRef((e,t)=>{const{__scopePopover:n,...i}=e,r=Hc(HV,n);return g(ll.button,{type:"button",...i,ref:t,onClick:e0(e.onClick,()=>r.onOpenChange(!1))})});Upe.displayName=HV;var bpe="PopoverArrow",VV=M.forwardRef((e,t)=>{const{__scopePopover:n,...i}=e,r=Zm(n);return g(gme,{...r,...i,ref:t})});VV.displayName=bpe;function $V(e){return e?"open":"closed"}var S5=DV,I5=PV,ype=FV,M_=BV,GV=VV;const XV=se.createContext(null),fi=()=>se.useContext(XV),jV=e=>{const[t,n]=M.useState(null),i=Qn(),{theme:r}=fi(),{container:s}=qo();return M.useLayoutEffect(()=>{var o;t&&(t.className="",t.classList.add("excalidraw",...((o=e==null?void 0:e.className)==null?void 0:o.split(/\s+/))||[]),t.classList.toggle("excalidraw--mobile",i.editor.isMobile),t.classList.toggle("theme--dark",r===xe.DARK))},[t,r,i.editor.isMobile,e==null?void 0:e.className]),M.useLayoutEffect(()=>{const o=e!=null&&e.parentSelector?s==null?void 0:s.querySelector(e.parentSelector):document.body;if(!o)return;const a=document.createElement("div");return o.appendChild(a),n(a),()=>{o.removeChild(a)}},[s,e==null?void 0:e.parentSelector]),t};function R_(e,t,n){M.useEffect(()=>{function i(r){const s=r;if(!e.current)return;const o=n==null?void 0:n(s,e.current);if(o===!0)return;if(o===!1)return t(s);e.current.contains(s.target)||!document.documentElement.contains(s.target)||s.target.closest("[data-radix-portal]")||s.target===document.documentElement&&document.body.style.pointerEvents==="none"||s.target.closest("[data-prevent-outside-click]")||t(s)}return document.addEventListener(te.POINTER_DOWN,i),document.addEventListener(te.TOUCH_START,i),()=>{document.removeEventListener(te.POINTER_DOWN,i),document.removeEventListener(te.TOUCH_START,i)}},[e,t,n])}const x5=e=>{const t=M.useRef(e);return Object.assign(t.current,e),t.current},C5=qt(null),Epe=({onCancel:e,onChange:t,onSelect:n,colorPickerType:i})=>{const r=jV({className:"excalidraw-eye-dropper-backdrop",parentSelector:".excalidraw-eye-dropper-container"}),s=fi(),o=P5(),a=oo(),l=Fe(o,s),c=x5({app:a,onCancel:e,onChange:t,onSelect:n,selectedElements:l}),{container:u}=qo();M.useEffect(()=>{const f=d.current;if(!f||!a.canvas||!r)return;let h=!1;const m=a.canvas.getContext("2d"),p=({clientX:R,clientY:w})=>{const T=m.getImageData((R-s.offsetLeft)*window.devicePixelRatio,(w-s.offsetTop)*window.devicePixelRatio,1,1).data;return aQ(T[0],T[1],T[2])},b=({clientX:R,clientY:w,altKey:T})=>{f.style.top=`${w+20}px`,f.style.left=`${R+20}px`;const A=p({clientX:R,clientY:w});h&&c.onChange(i,A,c.selectedElements,{altKey:T}),f.style.background=A},E=()=>{c.onCancel()},y=(R,w)=>{c.onSelect(R,w)},v=R=>{h=!0,R.stopImmediatePropagation()},_=R=>{h=!1,u==null||u.focus(),R.stopImmediatePropagation(),R.preventDefault(),y(p(R),R)},I=R=>{R.key===z.ESCAPE&&(R.preventDefault(),R.stopImmediatePropagation(),E())};return r.tabIndex=-1,r.focus(),b({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),r.addEventListener(te.KEYDOWN,I),r.addEventListener(te.POINTER_DOWN,v),r.addEventListener(te.POINTER_UP,_),window.addEventListener("pointermove",b,{passive:!0}),window.addEventListener(te.BLUR,E),()=>{h=!1,r.removeEventListener(te.KEYDOWN,I),r.removeEventListener(te.POINTER_DOWN,v),r.removeEventListener(te.POINTER_UP,_),window.removeEventListener("pointermove",b),window.removeEventListener(te.BLUR,E)}},[c,a.canvas,r,i,u,s.offsetLeft,s.offsetTop]);const d=M.useRef(null);return R_(d,()=>{e()},f=>!!f.target.closest(".excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop")),r?Xn.createPortal(g("div",{ref:d,className:"excalidraw-eye-dropper-preview"}),r):null},vpe=({color:e,onChange:t,label:n,colorPickerType:i})=>{const r=Qn(),[s,o]=M.useState(e),[a,l]=gn(r1);M.useEffect(()=>{o(e)},[e]);const c=M.useCallback(m=>{const p=m.toLowerCase(),b=_pe(p);b&&t(b),o(p)},[t]),u=M.useRef(null),d=M.useRef(null);M.useEffect(()=>{u.current&&u.current.focus()},[a]);const[f,h]=gn(C5);return M.useEffect(()=>()=>{h(null)},[h]),P("div",{className:"color-picker__input-label",children:[g("div",{className:"color-picker__input-hash",children:"#"}),g("input",{ref:a==="hex"?u:void 0,style:{border:0,padding:0},spellCheck:!1,className:"color-picker-input","aria-label":n,onChange:m=>{c(m.target.value)},value:(s||"").replace(/^#/,""),onBlur:()=>{o(e)},tabIndex:-1,onFocus:()=>l("hex"),onKeyDown:m=>{var p;m.key!==z.TAB&&(m.key===z.ESCAPE&&((p=d.current)==null||p.focus()),m.stopPropagation())}}),!r.editor.isMobile&&P(he,{children:[g("div",{style:{width:"1px",height:"1.25rem",backgroundColor:"var(--default-border-color)"}}),g("div",{ref:d,className:me("excalidraw-eye-dropper-trigger",{selected:f}),onClick:()=>h(m=>m?null:{keepOpenOnAlt:!1,onSelect:p=>t(p),colorPickerType:i}),title:`${L("labels.eyeDropper")} — ${z.I.toLocaleUpperCase()} or ${Q("Alt")} `,children:qne})]})]})},Ys=se.forwardRef(({children:e,padding:t,className:n,style:i},r)=>g("div",{className:me("Island",n),style:{"--padding":t,...i},ref:r,children:e})),YV=se.forwardRef(({className:e,container:t,children:n,style:i,onClose:r,onKeyDown:s,onFocusOutside:o,onPointerLeave:a,onPointerDownOutside:l},c)=>{const u=Qn();return g(ype,{container:t,children:P(M_,{ref:c,className:me("focus-visible-none",e),"data-prevent-outside-click":!0,side:u.editor.isMobile&&!u.viewport.isLandscape?"bottom":"right",align:u.editor.isMobile&&!u.viewport.isLandscape?"center":"start",alignOffset:-16,sideOffset:20,style:{zIndex:"var(--zIndex-popup)"},onPointerLeave:a,onKeyDown:s,onFocusOutside:o,onPointerDownOutside:l,onCloseAutoFocus:d=>{d.stopPropagation(),d.preventDefault(),t&&!bee(document.activeElement)&&t.focus(),r()},children:[g(Ys,{padding:3,style:i,children:n}),g(GV,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})}),sM=e=>{const t=new Option().style;return t.color=e,!!t.color},_pe=e=>Fs(e)?e:sM(`#${e}`)?`#${e}`:sM(e)?e:null,wpe=({type:e,color:t,onChange:n,label:i,elements:r,palette:s=$e,updateData:o})=>{const{container:a}=qo(),[,l]=gn(r1),[c,u]=gn(C5),d=P("div",{children:[g(l2,{children:L("colorPicker.hexCode")}),g(vpe,{color:t,label:i,onChange:m=>{n(m)},colorPickerType:e})]}),f=M.useRef(null),h=()=>{var m,p;(p=(m=f.current)==null?void 0:m.querySelector(".color-picker-content"))==null||p.focus()};return g(YV,{container:a,style:{maxWidth:"13rem"},onFocusOutside:m=>{h(),m.preventDefault()},onPointerDownOutside:m=>{c&&m.preventDefault()},onClose:()=>{o({openPopup:null}),l(null)},children:s?g(Mge,{palette:s,color:t,onChange:m=>{n(m)},onEyeDropperToggle:m=>{u(p=>m?(p=p||{keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},p.keepOpenOnAlt=!0,p):m===!1||p?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:m=>{c?u(null):o({openPopup:null})},label:i,type:e,elements:r,updateData:o,children:d}):d})},Tpe=({label:e,color:t,type:n})=>g(I5,{type:"button",className:me("color-picker__button active-color properties-trigger",{"is-transparent":t==="transparent"||!t}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:L(n==="elementStroke"?"labels.showStroke":"labels.showBackground"),children:g("div",{className:"color-picker__button-outline"})}),k_=({type:e,color:t,onChange:n,label:i,elements:r,palette:s=$e,topPicks:o,updateData:a,appState:l})=>g("div",{children:P("div",{role:"dialog","aria-modal":"true",className:"color-picker-container",children:[g(_ge,{activeColor:t,onChange:n,type:e,topPicks:o}),g(jH,{}),P(S5,{open:l.openPopup===e,onOpenChange:c=>{a({openPopup:c?e:null})},children:[g(Tpe,{color:t,label:i,type:e}),l.openPopup===e&&g(wpe,{type:e,color:t,onChange:n,label:i,elements:r,palette:s,updateData:a})]})]})}),A5=({icon:e})=>g("span",{style:{width:"1em",margin:"0 0.5ex 0 0.5ex",display:"inline-block",lineHeight:0,verticalAlign:"middle"},children:e}),zE=({label:e,open:t,openTrigger:n,children:i,className:r})=>P(he,{children:[P("div",{style:{cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center"},className:r,onClick:n,children:[e,g(A5,{icon:t?Eie:QF})]}),t&&g("div",{style:{display:"flex",flexDirection:"column"},children:i})]}),Spe=qt(!1);function Ipe({options:e,value:t,label:n,onChange:i,onClose:r,numberOfOptionsToAlwaysShow:s=e.length}){const o=Qn(),a=h=>{const m=e.find(p=>p.keyBinding===h.key.toLowerCase());if(!(h.metaKey||h.altKey||h.ctrlKey)&&m)i(m.value),h.preventDefault();else if(h.key===z.TAB){const p=e.findIndex(E=>E.value===t),b=h.shiftKey?(e.length+p-1)%e.length:(p+1)%e.length;i(e[b].value)}else if(ug(h.key)){const p=L0().rtl,b=e.findIndex(E=>E.value===t);if(b!==-1){const E=e.length;let y=b;switch(h.key){case(p?z.ARROW_LEFT:z.ARROW_RIGHT):y=(b+1)%E;break;case(p?z.ARROW_RIGHT:z.ARROW_LEFT):y=(E+b-1)%E;break;case z.ARROW_DOWN:{y=(b+(s??1))%E;break}case z.ARROW_UP:{y=(E+b-(s??1))%E;break}}i(e[y].value)}h.preventDefault()}else(h.key===z.ESCAPE||h.key===z.ENTER)&&(h.preventDefault(),r());h.nativeEvent.stopImmediatePropagation(),h.stopPropagation()},[l,c]=gn(Spe),u=se.useMemo(()=>e.slice(0,s),[e,s]),d=se.useMemo(()=>e.slice(s),[e,s]);M.useEffect(()=>{u.some(h=>h.value===t)||c(!0)},[t,u,c]);const f=h=>g("div",{className:"picker-content",children:h.map((m,p)=>P("button",{type:"button",className:me("picker-option",{active:t===m.value}),onClick:b=>{i(m.value)},title:`${m.text} ${m.keyBinding&&`— ${m.keyBinding.toUpperCase()}`}`,"aria-label":m.text||"none","aria-keyshortcuts":m.keyBinding||void 0,ref:b=>{t===m.value&&setTimeout(()=>{b==null||b.focus()},0)},children:[m.icon,m.keyBinding&&g("span",{className:"picker-keybinding",children:m.keyBinding})]},m.text))});return g(M_,{side:o.editor.isMobile&&!o.viewport.isLandscape?"top":"bottom",align:"start",sideOffset:12,style:{zIndex:"var(--zIndex-popup)"},onKeyDown:a,children:P("div",{className:"picker",role:"dialog","aria-modal":"true","aria-label":n,children:[f(u),d.length>0&&g(zE,{label:L("labels.more_options"),open:l,openTrigger:()=>{c(h=>!h)},className:"picker-collapsible",children:f(d)})]})})}function oM({value:e,label:t,options:n,onChange:i,group:r="",numberOfOptionsToAlwaysShow:s}){var c;const[o,a]=se.useState(!1),l=se.useRef(null);return g("div",{children:P(S5,{open:o,onOpenChange:u=>a(u),children:[g(I5,{name:r,type:"button","aria-label":t,onClick:()=>a(!o),ref:l,className:o?"active":"",children:(c=n.find(u=>u.value===e))==null?void 0:c.icon}),o&&g(Ipe,{options:n,value:e,label:t,onChange:i,onClose:()=>{a(!1)},numberOfOptionsToAlwaysShow:s})]})})}const WV=se.forwardRef(({className:e,placeholder:t,onChange:n},i)=>P("div",{className:me("QuickSearch__wrapper",e),children:[Zu,g("input",{ref:i,className:"QuickSearch__input",type:"text",placeholder:t,onChange:r=>n(r.target.value.trim().toLowerCase())})]})),KV=({className:e,placeholder:t,children:n})=>{const i=!M.Children.count(n);return g("div",{className:me("ScrollableList__wrapper",e),role:"menu",children:i?g("div",{className:"empty",children:t}):n})},zb=({children:e,className:t="",style:n,title:i})=>P("div",{className:`dropdown-menu-group ${t}`,style:n,children:[i&&g("p",{className:"dropdown-menu-group-title",children:i}),e]});zb.displayName="DropdownMenuGroup";const ZV=se.createContext({}),qV=(e="",t=!1,n=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e}
  ${t?"dropdown-menu-item--selected":""} ${n?"dropdown-menu-item--hovered":""}`.trim(),QV=(e,t)=>{const n=M.useContext(ZV);return G6(e,i=>{var s;const r=new CustomEvent(te.MENU_ITEM_SELECT,{bubbles:!0,cancelable:!0});t==null||t(r),r.defaultPrevented||(s=n.onSelect)==null||s.call(n,r)})},JV=({textStyle:e,icon:t,shortcut:n,children:i})=>{const r=Qn();return P(he,{children:[t&&g("div",{className:"dropdown-menu-item__icon",children:t}),g("div",{style:e,className:"dropdown-menu-item__text",children:i}),n&&!r.editor.isMobile&&g("div",{className:"dropdown-menu-item__shortcut",children:n})]})},Er=({icon:e,value:t,order:n,children:i,shortcut:r,className:s,hovered:o,selected:a,textStyle:l,onSelect:c,onClick:u,...d})=>{const f=QV(u,c),h=M.useRef(null);return M.useEffect(()=>{var m,p;o&&(n===0?(m=h.current)==null||m.scrollIntoView({block:"end"}):(p=h.current)==null||p.scrollIntoView({block:"nearest"}))},[o,n]),g("button",{...d,ref:h,value:t,onClick:f,className:qV(s,a,o),title:d.title??d["aria-label"],children:g(JV,{textStyle:l,icon:e,shortcut:r,children:i})})};Er.displayName="DropdownMenuItem";const Ug={GREEN:"green",RED:"red",BLUE:"blue"},L_=({type:e=Ug.BLUE,children:t})=>{const{theme:n}=tp(),i={display:"inline-flex",marginLeft:"auto",padding:"2px 4px",borderRadius:6,fontSize:9,fontFamily:"Cascadia, monospace",border:n===xe.LIGHT?"1.5px solid white":"none"};switch(e){case Ug.GREEN:Object.assign(i,{backgroundColor:"var(--background-color-badge)",color:"var(--color-badge)"});break;case Ug.RED:Object.assign(i,{backgroundColor:"pink",color:"darkred"});break;case Ug.BLUE:default:Object.assign(i,{background:"var(--color-promo)",color:"var(--color-surface-lowest)"})}return g("div",{className:"DropDownMenuItemBadge",style:i,children:t})};L_.displayName="DropdownMenuItemBadge";Er.Badge=L_;const xpe=({event:e,inputRef:t,hoveredFont:n,filteredFonts:i,onClose:r,onSelect:s,onHover:o})=>{var a,l,c;if(!e[z.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===z.F)return(a=t.current)==null||a.focus(),!0;if(e.key===z.ESCAPE)return r(),!0;if(e.key===z.ENTER)return n!=null&&n.value&&s(n.value),!0;if(e.key===z.ARROW_DOWN)return n!=null&&n.next?o(n.next.value):(l=i[0])!=null&&l.value&&o(i[0].value),!0;if(e.key===z.ARROW_UP)return n!=null&&n.prev?o(n.prev.value):(c=i[i.length-1])!=null&&c.value&&o(i[i.length-1].value),!0},Cpe=se.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:i,onLeave:r,onOpen:s,onClose:o})=>{const{container:a}=qo(),{fonts:l}=oo(),{showDeprecatedFonts:c}=ep(),[u,d]=M.useState(""),f=M.useRef(null),h=M.useMemo(()=>Array.from(Vs.registered.entries()).filter(([T,{metadata:A}])=>!A.serverSide&&!A.fallback).map(([T,{metadata:A,fontFaces:S}])=>{var N,D;const k={value:T,icon:A.icon??lu,text:((D=(N=S[0])==null?void 0:N.fontFace)==null?void 0:D.family)??"Unknown"};return A.deprecated&&Object.assign(k,{deprecated:A.deprecated,badge:{type:Ug.RED,placeholder:L("fontList.badge.old")}}),k}).sort((T,A)=>T.text.toLowerCase()>A.text.toLowerCase()?1:-1),[]),m=M.useMemo(()=>new Set(l.getSceneFamilies()),[e]),p=M.useMemo(()=>h.filter(T=>m.has(T.value)),[h,m]),b=M.useMemo(()=>h.filter(T=>!m.has(T.value)&&(c||!T.deprecated)),[h,m,c]),E=M.useMemo(()=>xee([...p,...b].filter(T=>{var A;return(A=T.text)==null?void 0:A.toLowerCase().includes(u)})),[p,b,u]),y=M.useMemo(()=>{var A;let T;return t?T=E.find(S=>S.value===t):e&&(T=E.find(S=>S.value===e)),!T&&u&&((A=E[0])!=null&&A.value?i(E[0].value):r()),T},[t,e,u,E,i,r]),v=M.useCallback(T=>{xpe({event:T,inputRef:f,hoveredFont:y,filteredFonts:E,onSelect:n,onHover:i,onClose:o})&&(T.preventDefault(),T.stopPropagation())},[y,E,n,i,o]);M.useEffect(()=>(s(),()=>{o()}),[]);const _=M.useMemo(()=>E.filter(T=>m.has(T.value)),[E,m]),I=M.useMemo(()=>E.filter(T=>!m.has(T.value)),[E,m]),R=(T,A)=>P(Er,{icon:T.icon,value:T.value,order:A,textStyle:{fontFamily:Fm({fontFamily:T.value})},hovered:T.value===(y==null?void 0:y.value),selected:T.value===e,tabIndex:T.value===e?0:-1,onClick:S=>{n(Number(S.currentTarget.value))},onMouseMove:()=>{(y==null?void 0:y.value)!==T.value&&i(T.value)},children:[T.text,T.badge&&g(L_,{type:T.badge.type,children:T.badge.placeholder})]},T.value),w=[];return _.length&&w.push(g(zb,{title:L("fontList.sceneFonts"),children:_.map(R)},"group_1")),I.length&&w.push(g(zb,{title:L("fontList.availableFonts"),children:I.map((T,A)=>R(T,A+_.length))},"group_2")),P(YV,{className:"properties-content",container:a,style:{width:"15rem"},onClose:o,onPointerLeave:r,onKeyDown:v,children:[g(WV,{ref:f,placeholder:L("quickSearch.placeholder"),onChange:Ga(d,20)}),g(KV,{className:"dropdown-menu fonts manual-hover",placeholder:L("fontList.empty"),children:w.length?w:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),Ape=({selectedFontFamily:e})=>{const t=M.useMemo(()=>!!(e&&!Rpe(e)),[e]);return g(I5,{asChild:!0,children:g("div",{children:g(XH,{standalone:!0,icon:DF,title:L("labels.showFonts"),className:"properties-trigger",testId:"font-family-show-fonts",active:t,onClick:()=>{}})})})},e$=[{value:At.Excalifont,icon:B0,text:L("labels.handDrawn"),testId:"font-family-hand-drawn"},{value:At.Nunito,icon:lu,text:L("labels.normal"),testId:"font-family-normal"},{value:At["Comic Shanns"],icon:uf,text:L("labels.code"),testId:"font-family-code"}],Mpe=new Set(e$.map(e=>e.value)),Rpe=e=>e?Mpe.has(e):!1,kpe=se.memo(({isOpened:e,selectedFontFamily:t,hoveredFontFamily:n,onSelect:i,onHover:r,onLeave:s,onPopupChange:o})=>{const a=M.useMemo(()=>e$,[]),l=M.useCallback(c=>{c&&i(c)},[i]);return P("div",{role:"dialog","aria-modal":"true",className:"FontPicker__container",children:[g(Ko,{type:"button",options:a,value:t,onClick:l}),g(jH,{}),P(S5,{open:e,onOpenChange:o,children:[g(Ape,{selectedFontFamily:t}),e&&g(Cpe,{selectedFontFamily:t,hoveredFontFamily:n,onSelect:l,onHover:r,onLeave:s,onOpen:()=>o(!0),onClose:()=>o(!1)})]})]})},(e,t)=>e.isOpened===t.isOpened&&e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),Lpe=({updateData:e,appState:t,elements:n,testId:i})=>{const r=se.useRef(null),s=se.useRef(null),o=er(n,t,a=>a.opacity,!0,t.currentItemOpacity);return M.useEffect(()=>{if(r.current&&s.current){const a=r.current,l=s.current,c=a.offsetWidth,u=15,d=o/100*(c-u)+u/2;l.style.left=`${d}px`,a.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${o}%, var(--button-bg) ${o}%, var(--button-bg) 100%)`}},[o]),P("label",{className:"control-label",children:[L("labels.opacity"),P("div",{className:"range-wrapper",children:[g("input",{ref:r,type:"range",min:"0",max:"100",step:"10",onChange:a=>{e(+a.target.value)},value:o,className:"range-input","data-testid":i}),g("div",{className:"value-bubble",ref:s,children:o!==0?o:null}),g("div",{className:"zero-label",children:"0"})]})]})},t$=.1,Ji=(e,t,n,i=!1)=>{const r=Se(Fe(e,t,{includeBoundTextElement:i}));return e.map(s=>{var o;return r.get(s.id)||s.id===((o=t.editingTextElement)==null?void 0:o.id)?n(s):s})},er=function(e,t,n,i,r){const s=t.editingTextElement,o=Nt(e);let a=null;return s&&(a=n(s)),a||(Fn(o,t)?a=tge(i===!0?o:o.filter(c=>i(c)),t,n)??(typeof r=="function"?r(!0):r):a=typeof r=="function"?r(!1):r),a},Dpe=(e,t)=>Xt(t)||!t.autoResize?t:ee(t,{x:e.textAlign==="left"?e.x:e.x+(e.width-t.width)/(e.textAlign==="center"?2:1),y:e.y+(e.height-t.height)/2},!1),D_=(e,t,n,i,r)=>{const s=new Set,o=Ji(e,t,l=>{if(de(l)){const c=i(l);s.add(c);let u=Ce(l,{fontSize:c});return Qi(u,n.scene.getContainerElement(l),n.scene.getNonDeletedElementsMap()),u=Dpe(l,u),u}return l},!0),a=Se(o);return Fe(e,t,{includeBoundTextElement:!0}).forEach(l=>{de(l)&&pr(l,a)}),{elements:o,appState:{...t,currentItemFontSize:s.size===1?[...s][0]:r??t.currentItemFontSize},captureUpdate:Z.IMMEDIATELY}};oe({name:"changeStrokeColor",label:"labels.stroke",trackEvent:!1,perform:(e,t,n)=>({...n.currentItemStrokeColor&&{elements:Ji(e,t,i=>TE(i.type)?Ce(i,{strokeColor:n.currentItemStrokeColor}):i,!0)},appState:{...t,...n},captureUpdate:n.currentItemStrokeColor?Z.IMMEDIATELY:Z.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:i})=>P(he,{children:[g("h3",{"aria-hidden":"true",children:L("labels.stroke")}),g(k_,{topPicks:MO,palette:rQ,type:"elementStroke",label:L("labels.stroke"),color:er(e,t,r=>r.strokeColor,!0,t.currentItemStrokeColor),onChange:r=>n({currentItemStrokeColor:r}),elements:e,appState:t,updateData:n})]})});oe({name:"changeBackgroundColor",label:"labels.changeBackground",trackEvent:!1,perform:(e,t,n)=>({...n.currentItemBackgroundColor&&{elements:Ji(e,t,i=>Ce(i,{backgroundColor:n.currentItemBackgroundColor}))},appState:{...t,...n},captureUpdate:n.currentItemBackgroundColor?Z.IMMEDIATELY:Z.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:i})=>P(he,{children:[g("h3",{"aria-hidden":"true",children:L("labels.background")}),g(k_,{topPicks:RO,palette:sQ,type:"elementBackground",label:L("labels.background"),color:er(e,t,r=>r.backgroundColor,!0,t.currentItemBackgroundColor),onChange:r=>n({currentItemBackgroundColor:r}),elements:e,appState:t,updateData:n})]})});oe({name:"changeFillStyle",label:"labels.fill",trackEvent:!1,perform:(e,t,n,i)=>(ut("element","changeFillStyle",`${n} (${i.device.editor.isMobile?"mobile":"desktop"})`),{elements:Ji(e,t,r=>Ce(r,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{const i=Fe(e,t),r=i.length>0&&i.every(s=>s.fillStyle==="zigzag");return P("fieldset",{children:[g("legend",{children:L("labels.fill")}),g(Ko,{type:"button",options:[{value:"hachure",text:`${L(r?"labels.zigzag":"labels.hachure")} (${Q("Alt-Click")})`,icon:r?cne:une,active:r?!0:void 0,testId:"fill-hachure"},{value:"cross-hatch",text:L("labels.crossHatch"),icon:dne,testId:"fill-cross-hatch"},{value:"solid",text:L("labels.solid"),icon:fne,testId:"fill-solid"}],value:er(e,t,s=>s.fillStyle,s=>s.hasOwnProperty("fillStyle"),s=>s?null:t.currentItemFillStyle),onClick:(s,o)=>{const a=o.altKey&&s==="hachure"&&i.every(l=>l.fillStyle==="hachure")?"zigzag":s;n(a)}})]})}});oe({name:"changeStrokeWidth",label:"labels.strokeWidth",trackEvent:!1,perform:(e,t,n)=>({elements:Ji(e,t,i=>Ce(i,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>P("fieldset",{children:[g("legend",{children:L("labels.strokeWidth")}),g(Ko,{group:"stroke-width",options:[{value:l8.thin,text:L("labels.thin"),icon:HF,testId:"strokeWidth-thin"},{value:l8.bold,text:L("labels.bold"),icon:hne,testId:"strokeWidth-bold"},{value:l8.extraBold,text:L("labels.extraBold"),icon:gne,testId:"strokeWidth-extraBold"}],value:er(e,t,i=>i.strokeWidth,i=>i.hasOwnProperty("strokeWidth"),i=>i?null:t.currentItemStrokeWidth),onChange:i=>n(i)})]})});oe({name:"changeSloppiness",label:"labels.sloppiness",trackEvent:!1,perform:(e,t,n)=>({elements:Ji(e,t,i=>Ce(i,{seed:Bo(),roughness:n})),appState:{...t,currentItemRoughness:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>P("fieldset",{children:[g("legend",{children:L("labels.sloppiness")}),g(Ko,{group:"sloppiness",options:[{value:0,text:L("labels.architect"),icon:Une},{value:1,text:L("labels.artist"),icon:bne},{value:2,text:L("labels.cartoonist"),icon:yne}],value:er(e,t,i=>i.roughness,i=>i.hasOwnProperty("roughness"),i=>i?null:t.currentItemRoughness),onChange:i=>n(i)})]})});oe({name:"changeStrokeStyle",label:"labels.strokeStyle",trackEvent:!1,perform:(e,t,n)=>({elements:Ji(e,t,i=>Ce(i,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>P("fieldset",{children:[g("legend",{children:L("labels.strokeStyle")}),g(Ko,{group:"strokeStyle",options:[{value:"solid",text:L("labels.strokeStyle_solid"),icon:HF},{value:"dashed",text:L("labels.strokeStyle_dashed"),icon:mne},{value:"dotted",text:L("labels.strokeStyle_dotted"),icon:pne}],value:er(e,t,i=>i.strokeStyle,i=>i.hasOwnProperty("strokeStyle"),i=>i?null:t.currentItemStrokeStyle),onChange:i=>n(i)})]})});oe({name:"changeOpacity",label:"labels.opacity",trackEvent:!1,perform:(e,t,n)=>({elements:Ji(e,t,i=>Ce(i,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>g(Lpe,{updateData:n,elements:e,appState:t,testId:"opacity"})});oe({name:"changeFontSize",label:"labels.fontSize",trackEvent:!1,perform:(e,t,n,i)=>D_(e,t,i,()=>n,n),PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>P("fieldset",{children:[g("legend",{children:L("labels.fontSize")}),g(Ko,{group:"font-size",options:[{value:16,text:L("labels.small"),icon:Lne,testId:"fontSize-small"},{value:20,text:L("labels.medium"),icon:Dne,testId:"fontSize-medium"},{value:28,text:L("labels.large"),icon:Nne,testId:"fontSize-large"},{value:36,text:L("labels.veryLarge"),icon:One,testId:"fontSize-veryLarge"}],value:er(e,t,r=>{if(de(r))return r.fontSize;const s=Oe(r,i.scene.getNonDeletedElementsMap());return s?s.fontSize:null},r=>de(r)||Oe(r,i.scene.getNonDeletedElementsMap())!==null,r=>r?null:t.currentItemFontSize||al),onChange:r=>n(r)})]})});const aM=oe({name:"decreaseFontSize",label:"labels.decreaseFontSize",icon:K6,trackEvent:!1,perform:(e,t,n,i)=>D_(e,t,i,r=>Math.round(1/(1+t$)*r.fontSize)),keyTest:e=>e[z.CTRL_OR_CMD]&&e.shiftKey&&(e.key===z.CHEVRON_LEFT||e.key===z.COMMA)}),lM=oe({name:"increaseFontSize",label:"labels.increaseFontSize",icon:K6,trackEvent:!1,perform:(e,t,n,i)=>D_(e,t,i,r=>Math.round(r.fontSize*(1+t$))),keyTest:e=>e[z.CTRL_OR_CMD]&&e.shiftKey&&(e.key===z.CHEVRON_RIGHT||e.key===z.PERIOD)});oe({name:"changeFontFamily",label:"labels.fontFamily",trackEvent:!1,perform:(e,t,n,i)=>{var m;const{cachedElements:r,resetAll:s,resetContainers:o,...a}=n;if(s)return{elements:Ji(e,t,b=>{const E=r==null?void 0:r.get(b.id);return E?Ce(b,{...E}):b},!0),appState:{...t,...a},captureUpdate:Z.NEVER};const{currentItemFontFamily:l,currentHoveredFontFamily:c}=n;let u=Z.EVENTUALLY,d,f=!1;if(l)d=l,u=Z.IMMEDIATELY;else if(c){d=c,u=Z.EVENTUALLY;const p=Fe(e,t,{includeBoundTextElement:!0}).filter(b=>de(b));if(p.length>200)f=!0;else{let b=0,E=0;for(;b<p.length&&E<5e3;){const y=p[b];E+=(y==null?void 0:y.originalText.length)||0,b++}E>5e3&&(f=!0)}}const h={appState:{...t,...a},captureUpdate:u};if(d&&!f){const p=new Map;let b=new Set,E=!1;const y=Array.from(Vs.loadedFontsCache.values()),v=(m=Object.entries(At).find(([R,w])=>w===d))==null?void 0:m[0];c&&v&&y.some(R=>R.startsWith(v))&&(E=!0),Object.assign(h,{elements:Ji(e,t,R=>{if(de(R)&&(R.fontFamily!==d||l)){const w=Ce(R,{fontFamily:d,lineHeight:qu(d)}),T=(r==null?void 0:r.get(R.containerId||""))||{},A=i.scene.getContainerElement(R);return o&&A&&T&&ee(A,{...T},!1),E||(b=new Set([...b,...Array.from(w.originalText)])),p.set(w,A),w}return R},!0)});const _=`10px ${Fm({fontFamily:d})}`,I=Array.from(b.values()).join();if(E||window.document.fonts.check(_,I))for(const[R,w]of p)Qi(R,w,i.scene.getNonDeletedElementsMap(),!1);else window.document.fonts.load(_,I).then(R=>{for(const[w,T]of p){const A=i.scene.getElement(w.id),S=T?i.scene.getElement(T.id):null;A&&Qi(A,S,i.scene.getNonDeletedElementsMap(),!1)}i.fonts.onLoaded(R)})}return h},PanelComponent:({elements:e,appState:t,app:n,updateData:i})=>{const r=M.useRef(new Map),s=M.useRef(null),[o,a]=M.useState({}),l=M.useRef(!0),c=M.useMemo(()=>{var d;const u=(f,h)=>er(f,t,m=>{if(de(m))return m.fontFamily;const p=Oe(m,h);return p?p.fontFamily:null},m=>de(m)||Oe(m,h)!==null,m=>m?null:t.currentItemFontFamily||Oc);return o.openPopup==="fontFamily"&&t.openPopup==="fontFamily"?u(Array.from(((d=r.current)==null?void 0:d.values())??[]),r.current):!o.openPopup&&t.openPopup!=="fontFamily"?u(e,n.scene.getNonDeletedElementsMap()):s.current},[o.openPopup,t,e,n.scene]);return M.useEffect(()=>{s.current=c},[c]),M.useEffect(()=>{Object.keys(o).length&&(i(o),a({}))},[o]),M.useEffect(()=>(l.current=!1,()=>{l.current=!0}),[]),P("fieldset",{children:[g("legend",{children:L("labels.fontFamily")}),g(kpe,{isOpened:t.openPopup==="fontFamily",selectedFontFamily:c,hoveredFontFamily:t.currentHoveredFontFamily,onSelect:u=>{a({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:u}),r.current.clear()},onHover:u=>{a({currentHoveredFontFamily:u,cachedElements:new Map(r.current),resetContainers:!0})},onLeave:()=>{a({currentHoveredFontFamily:null,cachedElements:new Map(r.current),resetAll:!0})},onPopupChange:u=>{if(u){r.current.clear();const{editingTextElement:d}=t;if((d==null?void 0:d.type)==="text"){const f=n.scene.getElement(d.id);r.current.set(d.id,Ce(f||d,{},!0))}else{const f=Fe(e,t,{includeBoundTextElement:!0});for(const h of f)r.current.set(h.id,Ce(h,{},!0))}a({openPopup:"fontFamily"})}else{const d={openPopup:null,currentHoveredFontFamily:null,cachedElements:new Map(r.current),resetAll:!0};l.current?i({...o,...d}):a(d),r.current.clear()}}})]})}});oe({name:"changeTextAlign",label:"Change text alignment",trackEvent:!1,perform:(e,t,n,i)=>({elements:Ji(e,t,r=>{if(de(r)){const s=Ce(r,{textAlign:n});return Qi(s,i.scene.getContainerElement(r),i.scene.getNonDeletedElementsMap()),s}return r},!0),appState:{...t,currentItemTextAlign:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>{const r=i.scene.getNonDeletedElementsMap();return P("fieldset",{children:[g("legend",{children:L("labels.textAlign")}),g(Ko,{group:"text-align",options:[{value:"left",text:L("labels.left"),icon:Fne,testId:"align-left"},{value:"center",text:L("labels.center"),icon:Bne,testId:"align-horizontal-center"},{value:"right",text:L("labels.right"),icon:zne,testId:"align-right"}],value:er(e,t,s=>{if(de(s))return s.textAlign;const o=Oe(s,r);return o?o.textAlign:null},s=>de(s)||Oe(s,r)!==null,s=>s?null:t.currentItemTextAlign),onChange:s=>n(s)})]})}});oe({name:"changeVerticalAlign",label:"Change vertical alignment",trackEvent:{category:"element"},perform:(e,t,n,i)=>({elements:Ji(e,t,r=>{if(de(r)){const s=Ce(r,{verticalAlign:n});return Qi(s,i.scene.getContainerElement(r),i.scene.getNonDeletedElementsMap()),s}return r},!0),appState:{...t},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g("fieldset",{children:g(Ko,{group:"text-align",options:[{value:Ar.TOP,text:L("labels.alignTop"),icon:g(Hne,{theme:t.theme}),testId:"align-top"},{value:Ar.MIDDLE,text:L("labels.centerVertically"),icon:g($ne,{theme:t.theme}),testId:"align-middle"},{value:Ar.BOTTOM,text:L("labels.alignBottom"),icon:g(Vne,{theme:t.theme}),testId:"align-bottom"}],value:er(e,t,r=>{if(de(r)&&r.containerId)return r.verticalAlign;const s=Oe(r,i.scene.getNonDeletedElementsMap());return s?s.verticalAlign:null},r=>de(r)||Oe(r,i.scene.getNonDeletedElementsMap())!==null,r=>r?null:Ar.MIDDLE),onChange:r=>n(r)})})});oe({name:"changeRoundness",label:"Change edge roundness",trackEvent:!1,perform:(e,t,n)=>({elements:Ji(e,t,i=>ge(i)?i:Ce(i,{roundness:n==="round"?{type:e1(i.type)?On.ADAPTIVE_RADIUS:On.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{const r=OH(Nt(e),t).some(s=>{var o;return((o=s.roundness)==null?void 0:o.type)===On.LEGACY});return P("fieldset",{children:[g("legend",{children:L("labels.edges")}),g(Ko,{group:"edges",options:[{value:"sharp",text:L("labels.sharp"),icon:Ene},{value:"round",text:L("labels.round"),icon:vne}],value:er(e,t,s=>r?null:s.roundness?"round":"sharp",s=>!Be(s)&&s.hasOwnProperty("roundness"),s=>s?null:t.currentItemRoundness),onChange:s=>n(s)})]})}});const cM=e=>[{value:null,text:L("labels.arrowhead_none"),keyBinding:"q",icon:_ne},{value:"arrow",text:L("labels.arrowhead_arrow"),keyBinding:"w",icon:g(sE,{flip:e})},{value:"triangle",text:L("labels.arrowhead_triangle"),icon:g(Ine,{flip:e}),keyBinding:"e"},{value:"triangle_outline",text:L("labels.arrowhead_triangle_outline"),icon:g(xne,{flip:e}),keyBinding:"r"},{value:"circle",text:L("labels.arrowhead_circle"),keyBinding:"a",icon:g(wne,{flip:e})},{value:"circle_outline",text:L("labels.arrowhead_circle_outline"),keyBinding:"s",icon:g(Tne,{flip:e})},{value:"diamond",text:L("labels.arrowhead_diamond"),icon:g(Cne,{flip:e}),keyBinding:"d"},{value:"diamond_outline",text:L("labels.arrowhead_diamond_outline"),icon:g(Ane,{flip:e}),keyBinding:"f"},{value:"bar",text:L("labels.arrowhead_bar"),keyBinding:"z",icon:g(Sne,{flip:e})},{value:"crowfoot_one",text:L("labels.arrowhead_crowfoot_one"),icon:g(Rne,{flip:e}),keyBinding:"c"},{value:"crowfoot_many",text:L("labels.arrowhead_crowfoot_many"),icon:g(Mne,{flip:e}),keyBinding:"x"},{value:"crowfoot_one_or_many",text:L("labels.arrowhead_crowfoot_one_or_many"),icon:g(kne,{flip:e}),keyBinding:"v"}];oe({name:"changeArrowhead",label:"Change arrowheads",trackEvent:!1,perform:(e,t,n)=>({elements:Ji(e,t,i=>{if(ke(i)){const{position:r,type:s}=n;if(r==="start")return Ce(i,{startArrowhead:s});if(r==="end")return Ce(i,{endArrowhead:s})}return i}),appState:{...t,[n.position==="start"?"currentItemStartArrowhead":"currentItemEndArrowhead"]:n.type},captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{const i=L0().rtl;return P("fieldset",{children:[g("legend",{children:L("labels.arrowheads")}),P("div",{className:"iconSelectList buttonList",children:[g(oM,{label:"arrowhead_start",options:cM(!i),value:er(e,t,r=>ke(r)&&Lb(r.type)?r.startArrowhead:t.currentItemStartArrowhead,!0,t.currentItemStartArrowhead),onChange:r=>n({position:"start",type:r}),numberOfOptionsToAlwaysShow:4}),g(oM,{label:"arrowhead_end",group:"arrowheads",options:cM(!!i),value:er(e,t,r=>ke(r)&&Lb(r.type)?r.endArrowhead:t.currentItemEndArrowhead,!0,t.currentItemEndArrowhead),onChange:r=>n({position:"end",type:r}),numberOfOptionsToAlwaysShow:4})]})]})}});oe({name:"changeArrowType",label:"Change arrow types",trackEvent:!1,perform:(e,t,n,i)=>{var a;const r=Ji(e,t,l=>{if(!Be(l))return l;const c=Ce(l,{roundness:n===ti.round?{type:On.PROPORTIONAL_RADIUS}:null,elbowed:n===ti.elbow,points:n===ti.elbow||l.elbowed?[l.points[0],l.points[l.points.length-1]]:l.points});if(ge(c)){const u=i.scene.getNonDeletedElementsMap();i.dismissLinearEditor();const d=ue.getPointAtIndexGlobalCoordinates(c,0,u),f=ue.getPointAtIndexGlobalCoordinates(c,-1,u),h=!c.startBinding&&zs(Ps(d),e,u,t.zoom,!1,!0),m=!c.endBinding&&zs(Ps(f),e,u,t.zoom,!1,!0),p=h||c.startBinding&&u.get(c.startBinding.elementId),b=m||c.endBinding&&u.get(c.endBinding.elementId),E=h?H0(c,h,"start"):d,y=m?H0(c,m,"end"):f;h&&zo(c,h,"start",u),m&&zo(c,m,"end",u),ee(c,{points:[E,y].map(v=>C(v[0]-c.x,v[1]-c.y)),...p&&c.startBinding?{startBinding:{...c.startBinding,...bb(c,p,"start")}}:{},...b&&c.endBinding?{endBinding:{...c.endBinding,...bb(c,b,"end")}}:{}}),ue.updateEditorMidPointsCache(c,u,i.state)}return c}),s={...t,currentItemArrowType:n},o=(a=t.selectedLinearElement)==null?void 0:a.elementId;if(o){const l=r.find(c=>c.id===o);l&&(s.selectedLinearElement=new ue(l))}return{elements:r,appState:s,captureUpdate:Z.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n})=>P("fieldset",{children:[g("legend",{children:L("labels.arrowtypes")}),g(Ko,{group:"arrowtypes",options:[{value:ti.sharp,text:L("labels.arrowtype_sharp"),icon:Uie,testId:"sharp-arrow"},{value:ti.round,text:L("labels.arrowtype_round"),icon:yie,testId:"round-arrow"},{value:ti.elbow,text:L("labels.arrowtype_elbowed"),icon:bie,testId:"elbow-arrow"}],value:er(e,t,i=>Be(i)?i.elbowed?ti.elbow:i.roundness?ti.round:ti.sharp:null,i=>Be(i),i=>i?null:t.currentItemArrowType),onChange:i=>n(i)})]})});const vu=({viewportX:e,viewportY:t,nextZoom:n},i)=>{const r=e-i.offsetLeft,s=t-i.offsetTop,o=i.zoom.value,a=i.scrollX+(r-r/o),l=i.scrollY+(s-s/o),c=-(r-r/n),u=-(s-s/n);return{scrollX:a+c,scrollY:l+u,zoom:{value:n}}},t0=()=>{const e=document.querySelector(".excalidraw-tooltip");if(e)return e;const t=document.createElement("div");return document.body.appendChild(t),t.classList.add("excalidraw-tooltip"),t},n$=(e,t,n="bottom")=>{const i=e.getBoundingClientRect(),r=window.innerWidth,s=window.innerHeight,o=5;let a=t.left+t.width/2-i.width/2;a<0?a=o:a+i.width>=r&&(a=r-i.width-o);let l;n==="bottom"?(l=t.top+t.height+o,l+i.height>=s&&(l=t.top-i.height-o)):(l=t.top-i.height-o,l<0&&(l=t.top+t.height+o)),Object.assign(e.style,{top:`${l}px`,left:`${a}px`})},Npe=(e,t,n,i)=>{t.classList.add("excalidraw-tooltip--visible"),t.style.minWidth=i?"50ch":"10ch",t.style.maxWidth=i?"50ch":"15ch",t.textContent=n;const r=e.getBoundingClientRect();n$(t,r)},el=({children:e,label:t,long:n=!1,style:i,disabled:r})=>(M.useEffect(()=>()=>t0().classList.remove("excalidraw-tooltip--visible"),[]),r?null:g("div",{className:"excalidraw-tooltip-wrapper",onPointerEnter:s=>Npe(s.currentTarget,t0(),t,n),onPointerLeave:()=>t0().classList.remove("excalidraw-tooltip--visible"),style:i,children:e}));oe({name:"changeViewBackgroundColor",label:"labels.canvasBackground",paletteName:"Change canvas background color",trackEvent:!1,predicate:(e,t,n,i)=>!!i.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},captureUpdate:n.viewBackgroundColor?Z.IMMEDIATELY:Z.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:i})=>g(k_,{palette:null,topPicks:kO,label:L("labels.canvasBackground"),type:"canvasBackground",color:t.viewBackgroundColor,onChange:r=>n({viewBackgroundColor:r}),"data-testid":"canvas-background-picker",elements:e,appState:t,updateData:n})});const n0=oe({name:"clearCanvas",label:"labels.clearCanvas",paletteName:"Clear canvas",icon:bc,trackEvent:{category:"canvas"},predicate:(e,t,n,i)=>{var r;return!!i.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled&&((r=t.openDialog)==null?void 0:r.name)!=="elementLinkSelector"},perform:(e,t,n,i)=>(i.imageCache.clear(),{elements:e.map(r=>Ce(r,{isDeleted:!0})),appState:{...gs(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,gridStep:t.gridStep,gridModeEnabled:t.gridModeEnabled,stats:t.stats,pasteDialog:t.pasteDialog,activeTool:t.activeTool.type==="image"?{...t.activeTool,type:"selection"}:t.activeTool},captureUpdate:Z.IMMEDIATELY})}),uM=oe({name:"zoomIn",label:"buttons.zoomIn",viewMode:!0,icon:wx,trackEvent:{category:"canvas"},perform:(e,t,n,i)=>({appState:{...t,...vu({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Aa(t.zoom.value+P6)},t),userToFollow:null},captureUpdate:Z.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>g(Ke,{type:"button",className:"zoom-in-button zoom-button",icon:wx,title:`${L("buttons.zoomIn")} — ${Q("CtrlOrCmd++")}`,"aria-label":L("buttons.zoomIn"),disabled:t.zoom.value>=Wv,onClick:()=>{e(null)}}),keyTest:e=>(e.code===tt.EQUAL||e.code===tt.NUM_ADD)&&(e[z.CTRL_OR_CMD]||e.shiftKey)}),dM=oe({name:"zoomOut",label:"buttons.zoomOut",icon:Tx,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,i)=>({appState:{...t,...vu({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Aa(t.zoom.value-P6)},t),userToFollow:null},captureUpdate:Z.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>g(Ke,{type:"button",className:"zoom-out-button zoom-button",icon:Tx,title:`${L("buttons.zoomOut")} — ${Q("CtrlOrCmd+-")}`,"aria-label":L("buttons.zoomOut"),disabled:t.zoom.value<=Yv,onClick:()=>{e(null)}}),keyTest:e=>(e.code===tt.MINUS||e.code===tt.NUM_SUBTRACT)&&(e[z.CTRL_OR_CMD]||e.shiftKey)}),fM=oe({name:"resetZoom",label:"buttons.resetZoom",icon:jte,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,i)=>({appState:{...t,...vu({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:Aa(1)},t),userToFollow:null},captureUpdate:Z.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>g(el,{label:L("buttons.resetZoom"),style:{height:"100%"},children:P(Ke,{type:"button",className:"reset-zoom-button zoom-button",title:L("buttons.resetZoom"),"aria-label":L("buttons.resetZoom"),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),"%"]})}),keyTest:e=>(e.code===tt.ZERO||e.code===tt.NUM_ZERO)&&(e[z.CTRL_OR_CMD]||e.shiftKey)}),Ope=(e,t,n=1)=>{const[i,r,s,o]=e,a=s-i,l=t.width/a,c=o-r,u=t.height/c,f=Math.min(l,u)*He(n,.1,1);return Math.min(f,1)},i$=({bounds:e,appState:t,canvasOffsets:n,fitToViewport:i=!1,viewportZoomFactor:r=1,minZoom:s=-1/0,maxZoom:o=1/0})=>{r=He(r,Yv,Wv);const[a,l,c,u]=e,d=(a+c)/2,f=(l+u)/2,h=(n==null?void 0:n.left)??0,m=(n==null?void 0:n.top)??0,p=(n==null?void 0:n.right)??0,b=(n==null?void 0:n.bottom)??0,E=t.width-h-p,y=t.height-m-b;let v;if(i){const R=c-a,w=u-l;v=Math.min(E/R,y/w)*r}else v=Ope(e,{width:E,height:y},r);const _=Aa(He(ree(v,P6,"floor"),s,o)),I=PH({scenePoint:{x:d,y:f},viewportDimensions:{width:t.width,height:t.height},offsets:n,zoom:{value:_}});return{appState:{...t,scrollX:I.scrollX,scrollY:I.scrollY,zoom:{value:_}},captureUpdate:Z.EVENTUALLY}},M5=({canvasOffsets:e,targetElements:t,appState:n,fitToViewport:i,viewportZoomFactor:r,minZoom:s,maxZoom:o})=>{const a=wt(Nt(t));return i$({canvasOffsets:e,bounds:a,appState:n,fitToViewport:i,viewportZoomFactor:r,minZoom:s,maxZoom:o})};oe({name:"zoomToFitSelectionInViewport",label:"labels.zoomToFitViewport",icon:_9,trackEvent:{category:"canvas"},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);return M5({targetElements:r.length?r:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:i.getEditorUIOffsets()})},keyTest:e=>e.code===tt.TWO&&e.shiftKey&&!e.altKey&&!e[z.CTRL_OR_CMD]});oe({name:"zoomToFitSelection",label:"helpDialog.zoomToSelection",icon:_9,trackEvent:{category:"canvas"},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);return M5({targetElements:r.length?r:e,appState:{...t,userToFollow:null},fitToViewport:!0,canvasOffsets:i.getEditorUIOffsets()})},keyTest:e=>e.code===tt.THREE&&e.shiftKey&&!e.altKey&&!e[z.CTRL_OR_CMD]});oe({name:"zoomToFit",label:"helpDialog.zoomToFit",icon:_9,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n,i)=>M5({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:i.getEditorUIOffsets()}),keyTest:e=>e.code===tt.ONE&&e.shiftKey&&!e.altKey&&!e[z.CTRL_OR_CMD]});const Hb=oe({name:"toggleTheme",label:(e,t)=>t.theme===xe.DARK?"buttons.lightMode":"buttons.darkMode",keywords:["toggle","dark","light","mode","theme"],icon:e=>e.theme===xe.LIGHT?iE:rE,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===xe.LIGHT?xe.DARK:xe.LIGHT)},captureUpdate:Z.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===tt.D,predicate:(e,t,n,i)=>!!i.props.UIOptions.canvasActions.toggleTheme});oe({name:"toggleEraserTool",label:"toolBar.eraser",trackEvent:{category:"toolbar"},perform:(e,t)=>{let n;return bo(t)?n=Sn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):n=Sn(t,{type:"eraser",lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:n},captureUpdate:Z.IMMEDIATELY}},keyTest:e=>e.key===z.E});const Ppe=oe({name:"toggleHandTool",label:"toolBar.hand",paletteName:"Toggle hand tool",trackEvent:{category:"toolbar"},icon:$F,viewMode:!1,perform:(e,t,n,i)=>{let r;return mh(t)?r=Sn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):(r=Sn(t,{type:"hand",lastActiveToolBeforeEraser:t.activeTool}),It(i.interactiveCanvas,Tt.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Z.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[z.CTRL_OR_CMD]&&e.key===z.H}),Ts=oe({name:"finalize",label:"",trackEvent:!1,perform:(e,t,n,i)=>{var f;const{interactiveCanvas:r,focusContainer:s,scene:o}=i,a=o.getNonDeletedElementsMap();if(t.editingLinearElement){const{elementId:h,startBindingElement:m,endBindingElement:p}=t.editingLinearElement,b=ue.getElement(h,a);if(b)return So(b)&&q6(b,m,p,a,o),{elements:b.points.length<2||od(b)?e.filter(E=>E.id!==b.id):void 0,appState:{...t,cursorButton:"up",editingLinearElement:null},captureUpdate:Z.IMMEDIATELY}}let l=e;const c=t.pendingImageElementId&&o.getElement(t.pendingImageElementId);c&&ee(c,{isDeleted:!0},!1),window.document.activeElement instanceof HTMLElement&&s();const u=t.multiElement?t.multiElement:((f=t.newElement)==null?void 0:f.type)==="freedraw"?t.newElement:null;if(u){if(u.type!=="freedraw"&&t.lastPointerDownWith!=="touch"){const{points:m,lastCommittedPoint:p}=u;(!p||m[m.length-1]!==p)&&ee(u,{points:u.points.slice(0,-1)})}od(u)&&(l=l.filter(m=>m.id!==u.id));const h=ja(u.points,t.zoom.value);if((u.type==="line"||u.type==="freedraw")&&h){const m=u.points,p=m[0];ee(u,{points:m.map((b,E)=>E===m.length-1?C(p[0],p[1]):b)})}if(So(u)&&!h&&u.points.length>1){const[m,p]=ue.getPointAtIndexGlobalCoordinates(u,-1,Se(e));dE(u,t,{x:m,y:p},a,e)}}(!t.activeTool.locked&&t.activeTool.type!=="freedraw"||!u)&&Is(r);let d;return t.activeTool.type==="eraser"?d=Sn(t,{...t.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):d=Sn(t,{type:"selection"}),{elements:l,appState:{...t,cursorButton:"up",activeTool:(t.activeTool.locked||t.activeTool.type==="freedraw")&&u?t.activeTool:d,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:u&&!t.activeTool.locked&&t.activeTool.type!=="freedraw"?{...t.selectedElementIds,[u.id]:!0}:t.selectedElementIds,selectedLinearElement:u&&ke(u)?new ue(u):t.selectedLinearElement,pendingImageElementId:null},captureUpdate:Z.IMMEDIATELY}},keyTest:(e,t)=>e.key===z.ESCAPE&&(t.editingLinearElement!==null||!t.newElement&&t.multiElement===null)||(e.key===z.ESCAPE||e.key===z.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>g(Ke,{type:"button",icon:ene,title:L("buttons.done"),"aria-label":L("buttons.done"),onClick:t,visible:e.multiElement!=null,size:(n==null?void 0:n.size)||"medium",style:{pointerEvents:"all"}})}),Fpe=e=>{const{id:t}=qo(),[n,i]=M.useState(e.value),r=o=>{e.ignoreFocus||See(o.target);const a=o.target.value;a!==e.value&&e.onChange(a)},s=o=>{if(o.key===z.ENTER){if(o.preventDefault(),o.nativeEvent.isComposing||o.keyCode===229)return;o.currentTarget.blur()}};return P("div",{className:"ProjectName",children:[g("label",{className:"ProjectName-label",htmlFor:"filename",children:`${e.label}:`}),g("input",{type:"text",className:"TextInput",onBlur:r,onKeyDown:s,id:`${t}-filename`,value:n,onChange:o=>i(o.target.value)})]})},Bpe=e=>{const t=e.title||(e.value===xe.DARK?L("buttons.lightMode"):L("buttons.darkMode"));return g(Ke,{type:"icon",icon:e.value===xe.LIGHT?hM.MOON:hM.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===xe.DARK?xe.LIGHT:xe.DARK),"data-testid":"toggle-dark-mode"})},hM={SUN:g("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:g("path",{fill:"currentColor",d:"M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"})}),MOON:g("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:g("path",{fill:"currentColor",d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"})})},R5=(e,{selectedElementIds:t},n)=>{e=Nt(e);const i=n&&Fn(e,{selectedElementIds:t});let r=null,s=i?Fe(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return i&&(s.length===1&&Ie(s[0])?(r=s[0],s=n_(e,r)):s.length>1&&(s=Fe(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:r,exportedElements:ka(s)}},k5=async(e,t,n,i,{exportBackground:r,exportPadding:s=qh,viewBackgroundColor:o,name:a=n.name||VO,fileHandle:l=null,exportingFrame:c=null})=>{if(t.length===0)throw new Error(L("alerts.cannotExportEmptyCanvas"));if(e==="svg"||e==="clipboard-svg"){const d=Y9(t,{exportBackground:r,exportWithDarkMode:n.exportWithDarkMode,viewBackgroundColor:o,exportPadding:s,exportScale:n.exportScale,exportEmbedScene:n.exportEmbedScene&&e==="svg"},i,{exportingFrame:c});if(e==="svg")return wb(d.then(f=>new Blob([f.outerHTML],{type:ye.svg})),{description:"Export to SVG",name:a,extension:n.exportEmbedScene?"excalidraw.svg":"svg",mimeTypes:[gh.svg],fileHandle:l});if(e==="clipboard-svg"){const f=await d.then(h=>h.outerHTML);try{await Bc(f)}catch{throw new Error(L("errors.copyToSystemClipboardFailed"))}return}}const u=Xz(t,n,i,{exportBackground:r,viewBackgroundColor:o,exportPadding:s,exportingFrame:c});if(e==="png"){let d=Q0(u);return n.exportEmbedScene&&(d=d.then(f=>be(()=>Promise.resolve().then(()=>Kz),void 0).then(({encodePngMetadata:h})=>h({blob:f,metadata:i1(t,n,i,"local")})))),wb(d,{description:"Export to PNG",name:a,extension:n.exportEmbedScene?"excalidraw.png":"png",mimeTypes:[gh.png],fileHandle:l})}else if(e==="clipboard")try{const d=Q0(u);await Ahe(d)}catch(d){throw console.warn(d),d.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(L("canvasError.canvasTooBig")):A0&&d.name==="TypeError"?new Error(`${L("alerts.couldNotCopyToClipboard")}

${L("hints.firefox_clipboard_write")}`):new Error(L("alerts.couldNotCopyToClipboard"))}else throw new Error("Unsupported export type")},zpe=async(e,t,n,i)=>{const{exportBackground:r,viewBackgroundColor:s,fileHandle:o}=t,a=Sz(o);if(!o||!Cfe(a))throw new Error("fileHandle should exist and should be of type svg or png when resaving");t={...t,exportEmbedScene:!0};const{exportedElements:l,exportingFrame:c}=R5(e,t,!1);return await k5(a,l,t,n,{exportBackground:r,viewBackgroundColor:s,name:i,fileHandle:o,exportingFrame:c}),{fileHandle:o}},N_=({children:e,checked:t,onChange:n,className:i})=>P("div",{className:me("Checkbox",i,{"is-checked":t}),onClick:r=>{n(!t,r),r.currentTarget.querySelector(".Checkbox-box").focus()},children:[g("button",{type:"button",className:"Checkbox-box",role:"checkbox","aria-checked":t,children:Kte}),g("div",{className:"Checkbox-label",children:e})]}),Hpe=oe({name:"changeProjectName",label:"labels.fileTitle",trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},captureUpdate:Z.EVENTUALLY}),PanelComponent:({appState:e,updateData:t,appProps:n,data:i,app:r})=>g(Fpe,{label:L("labels.fileTitle"),value:r.getName(),onChange:s=>t(s),ignoreFocus:(i==null?void 0:i.ignoreFocus)??!1})}),Vpe=oe({name:"changeExportScale",label:"imageExportDialog.scale",trackEvent:{category:"export",action:"scale"},perform:(e,t,n)=>({appState:{...t,exportScale:n},captureUpdate:Z.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{const i=Nt(e),s=Fn(i,t)?Fe(i,t):i;return g(he,{children:Zv.map(o=>{const[a,l]=Wfe(s,qh,o),c=`${L("imageExportDialog.label.scale")} ${o}x (${a}x${l})`;return g(Ke,{size:"small",type:"radio",icon:`${o}x`,name:"export-canvas-scale",title:c,"aria-label":c,id:"export-canvas-scale",checked:o===t.exportScale,onChange:()=>n(o)},o)})})}}),$pe=oe({name:"changeExportBackground",label:"imageExportDialog.label.withBackground",trackEvent:{category:"export",action:"toggleBackground"},perform:(e,t,n)=>({appState:{...t,exportBackground:n},captureUpdate:Z.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>g(N_,{checked:e.exportBackground,onChange:n=>t(n),children:L("imageExportDialog.label.withBackground")})}),r$=oe({name:"changeExportEmbedScene",label:"imageExportDialog.tooltip.embedScene",trackEvent:{category:"export",action:"embedScene"},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},captureUpdate:Z.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>P(N_,{checked:e.exportEmbedScene,onChange:n=>t(n),children:[L("imageExportDialog.label.embedScene"),g(el,{label:L("imageExportDialog.tooltip.embedScene"),long:!0,children:g("div",{className:"excalidraw-tooltip-icon",children:tne})})]})}),gM=oe({name:"saveToActiveFile",label:"buttons.save",icon:W6,trackEvent:{category:"export"},predicate:(e,t,n,i)=>!!i.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,i)=>{const r=!!t.fileHandle;try{const{fileHandle:s}=$9(t.fileHandle)?await zpe(e,t,i.files,i.getName()):await Az(e,t,i.files,i.getName());return{captureUpdate:Z.EVENTUALLY,appState:{...t,fileHandle:s,toast:r?{message:s!=null&&s.name?L("toast.fileSavedToFilename").replace("{filename}",`"${s.name}"`):L("toast.fileSaved")}:null}}}catch(s){return(s==null?void 0:s.name)!=="AbortError"?console.error(s):console.warn(s),{captureUpdate:Z.EVENTUALLY}}},keyTest:e=>e.key===z.S&&e[z.CTRL_OR_CMD]&&!e.shiftKey}),s$=oe({name:"saveFileToDisk",label:"exportDialog.disk_title",icon:W6,viewMode:!0,trackEvent:{category:"export"},perform:async(e,t,n,i)=>{try{const{fileHandle:r}=await Az(e,{...t,fileHandle:null},i.files,i.getName());return{captureUpdate:Z.EVENTUALLY,appState:{...t,openDialog:null,fileHandle:r,toast:{message:L("toast.fileSaved")}}}}catch(r){return(r==null?void 0:r.name)!=="AbortError"?console.error(r):console.warn(r),{captureUpdate:Z.EVENTUALLY}}},keyTest:e=>e.key===z.S&&e.shiftKey&&e[z.CTRL_OR_CMD],PanelComponent:({updateData:e})=>g(Ke,{type:"button",icon:qte,title:L("buttons.saveAs"),"aria-label":L("buttons.saveAs"),showAriaLabel:Qn().editor.isMobile,hidden:!Ad,onClick:()=>e(null),"data-testid":"save-as-button"})}),HE=oe({name:"loadScene",label:"buttons.load",trackEvent:{category:"export"},predicate:(e,t,n,i)=>!!i.props.UIOptions.canvasActions.loadScene&&!t.viewModeEnabled,perform:async(e,t,n,i)=>{try{const{elements:r,appState:s,files:o}=await Ffe(t,e);return{elements:r,appState:s,files:o,captureUpdate:Z.IMMEDIATELY}}catch(r){return(r==null?void 0:r.name)==="AbortError"?(console.warn(r),!1):{elements:e,appState:{...t,errorMessage:r.message},files:i.files,captureUpdate:Z.EVENTUALLY}}},keyTest:e=>e[z.CTRL_OR_CMD]&&e.key===z.O}),Gpe=oe({name:"exportWithDarkMode",label:"imageExportDialog.label.darkMode",trackEvent:{category:"export",action:"toggleTheme"},perform:(e,t,n)=>({appState:{...t,exportWithDarkMode:n},captureUpdate:Z.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>g("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"-45px",marginBottom:"10px"},children:g(Bpe,{value:e.exportWithDarkMode?xe.DARK:xe.LIGHT,onChange:n=>{t(n===xe.DARK)},title:L("imageExportDialog.label.darkMode")})})});let o$="{}";const Xpe=oe({name:"copyStyles",label:"labels.copyStyles",icon:KF,trackEvent:{category:"element"},perform:(e,t,n,i)=>{const r=[],s=e.find(o=>t.selectedElementIds[o.id]);if(r.push(s),s&&Us(s)){const o=Oe(s,i.scene.getNonDeletedElementsMap());r.push(o)}return s&&(o$=JSON.stringify(r)),{appState:{...t,toast:{message:L("toast.copyStyles")}},captureUpdate:Z.EVENTUALLY}},keyTest:e=>e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.C}),jpe=oe({name:"pasteStyles",label:"labels.pasteStyles",icon:KF,trackEvent:{category:"element"},perform:(e,t,n,i)=>{const r=JSON.parse(o$),s=r[0],o=r[1];if(!fF(s))return{elements:e,captureUpdate:Z.EVENTUALLY};const a=Fe(e,t,{includeBoundTextElement:!0}),l=a.map(c=>c.id);return{elements:e.map(c=>{if(l.includes(c.id)){let u=s;if(de(c)&&c.containerId&&(u=o),!u)return c;let d=Ce(c,{backgroundColor:u==null?void 0:u.backgroundColor,strokeWidth:u==null?void 0:u.strokeWidth,strokeColor:u==null?void 0:u.strokeColor,strokeStyle:u==null?void 0:u.strokeStyle,fillStyle:u==null?void 0:u.fillStyle,opacity:u==null?void 0:u.opacity,roughness:u==null?void 0:u.roughness,roundness:u.roundness?Oee(u.roundness.type,c)?u.roundness:Pee(c):null});if(de(d)){const f=u.fontSize||al,h=u.fontFamily||Oc;d=Ce(d,{fontSize:f,fontFamily:h,textAlign:u.textAlign||Dm,lineHeight:u.lineHeight||qu(h)});let m=null;d.containerId&&(m=a.find(p=>de(d)&&p.id===d.containerId)||null),Qi(d,m,i.scene.getNonDeletedElementsMap())}return d.type==="arrow"&&Be(u)&&(d=Ce(d,{startArrowhead:u.startArrowhead,endArrowhead:u.endArrowhead})),Ie(c)&&(d=Ce(d,{roundness:null,backgroundColor:"transparent"})),d}return c}),captureUpdate:Z.IMMEDIATELY}},keyTest:e=>e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.V});oe({name:"toggleCanvasMenu",label:"buttons.menu",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="canvas"?null:"canvas"},captureUpdate:Z.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>g(Ke,{type:"button",icon:NF,"aria-label":L("buttons.menu"),onClick:t,selected:e.openMenu==="canvas"})});oe({name:"toggleEditMenu",label:"buttons.edit",trackEvent:{category:"menu"},perform:(e,t)=>({appState:{...t,openMenu:t.openMenu==="shape"?null:"shape"},captureUpdate:Z.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n})=>g(Ke,{visible:f_(t,Nt(e)),type:"button",icon:Qte,"aria-label":L("buttons.edit"),onClick:n,selected:t.openMenu==="shape"})});const O_=oe({name:"toggleShortcuts",label:"welcomeScreen.defaults.helpHint",icon:Wte,viewMode:!0,trackEvent:{category:"menu",action:"toggleHelpDialog"},perform:(e,t,n,{focusContainer:i})=>{var r,s;return((r=t.openDialog)==null?void 0:r.name)==="help"&&i(),{appState:{...t,openDialog:((s=t.openDialog)==null?void 0:s.name)==="help"?null:{name:"help"}},captureUpdate:Z.EVENTUALLY}},keyTest:e=>e.key===z.QUESTION_MARK}),Ype=e=>{if(e.length>=2){const t=e[0].groupIds;for(const n of t)if(e.reduce((i,r)=>i&&F0(r,n),!0))return!0}return!1},mM=(e,t,n)=>{const i=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return i.length>=2&&!Ype(i)&&!aH(i)},Wpe=oe({name:"group",label:"labels.group",icon:e=>g(Fx,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,t,n,i)=>{const r=t_(i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}));if(r.length<2)return{appState:t,elements:e,captureUpdate:Z.EVENTUALLY};const s=Ou(t);if(s.length===1){const b=s[0],E=new Set($t(e,b).map(_=>_.id)),y=new Set(r.map(_=>_.id));if(new Set([...Array.from(E),...Array.from(y)]).size===E.size)return{appState:t,elements:e,captureUpdate:Z.EVENTUALLY}}let o=[...e];new Set(r.map(b=>b.frameId)).size>1&&zhe(r).forEach((E,y)=>{f5(E,i.scene.getNonDeletedElementsMap())});const l=bs(),c=Se(r);o=o.map(b=>c.get(b.id)?Ce(b,{groupIds:pte(b.groupIds,l,t.editingGroupId)}):b);const u=$t(o,l),d=u[u.length-1],f=o.lastIndexOf(d),h=o.slice(f+1),m=o.slice(0,f).filter(b=>!F0(b,l)),p=Vo([...m,...u,...h],Se(u));return{appState:{...t,...wF(l,{...t,selectedGroupIds:{}},Nt(o))},elements:p,captureUpdate:Z.IMMEDIATELY}},predicate:(e,t,n,i)=>mM(e,t,i),keyTest:e=>!e.shiftKey&&e[z.CTRL_OR_CMD]&&e.key===z.G,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!mM(e,t,i),type:"button",icon:g(Fx,{theme:t.theme}),onClick:()=>n(null),title:`${L("labels.group")} — ${Q("CtrlOrCmd+G")}`,"aria-label":L("labels.group"),visible:Fn(Nt(e),t)})}),Kpe=oe({name:"ungroup",label:"labels.ungroup",icon:e=>g(Bx,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,t,n,i)=>{const r=Ou(t),s=Se(e);if(r.length===0)return{appState:t,elements:e,captureUpdate:Z.EVENTUALLY};let o=[...e];const a=[];o=o.map(f=>{Xt(f)&&a.push(f.id);const h=Ute(f.groupIds,t.selectedGroupIds);return h.length===f.groupIds.length?f:Ce(f,{groupIds:h})});const l=ji(t,Nt(o),t,null),c=i.scene.getSelectedElements(t),u=new Set(c.filter(f=>f.frameId).map(f=>f.frameId));return e_(e).filter(f=>u.has(f.id)).forEach(f=>{f&&(o=sH(o,s2(o,f,t,s),f,i))}),l.selectedElementIds=Object.entries(l.selectedElementIds).reduce((f,[h,m])=>(m&&!a.includes(h)&&(f[h]=!0),f),{}),{appState:{...t,...l},elements:o,captureUpdate:Z.IMMEDIATELY}},keyTest:e=>e.shiftKey&&e[z.CTRL_OR_CMD]&&e.key===z.G.toUpperCase(),predicate:(e,t)=>Ou(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>g(Ke,{type:"button",hidden:Ou(t).length===0,icon:g(Bx,{theme:t.theme}),onClick:()=>n(null),title:`${L("labels.ungroup")} — ${Q("CtrlOrCmd+Shift+G")}`,"aria-label":L("labels.ungroup"),visible:Fn(Nt(e),t)})}),a$=(e,t,n,i,r,s,o)=>{e.beginPath(),e.moveTo(t+s,n),e.lineTo(t+i-s,n),e.quadraticCurveTo(t+i,n,t+i,n+s),e.lineTo(t+i,n+r-s),e.quadraticCurveTo(t+i,n+r,t+i-s,n+r),e.lineTo(t+s,n+r),e.quadraticCurveTo(t,n+r,t,n+r-s),e.lineTo(t,n+s),e.quadraticCurveTo(t,n,t+s,n),e.closePath(),e.fill(),o&&(e.strokeStyle=o),e.stroke()};function Zpe(e){let t=0;if(e.length===0)return t;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);t=(t<<5)-t+i}return t}const L5=(e,t)=>`hsl(${Math.abs(Zpe((t==null?void 0:t.id)||e))%37*10}, 100%, 83%)`,qpe=e=>{var n;const t=(n=e==null?void 0:e.trim())==null?void 0:n.codePointAt(0);return(t?String.fromCodePoint(t):"?").toUpperCase()},Qpe=({context:e,renderConfig:t,appState:n,normalizedWidth:i,normalizedHeight:r})=>{for(const[s,o]of t.remotePointerViewportCoords){let{x:a,y:l}=o;const c=n.collaborators.get(s);a-=n.offsetLeft,l-=n.offsetTop;const u=11,d=14,f=a<0||a>i-u||l<0||l>r-d;a=Math.max(a,0),a=Math.min(a,i-u),l=Math.max(l,0),l=Math.min(l,r-d);const h=L5(s,c);e.save(),e.strokeStyle=h,e.fillStyle=h;const m=t.remotePointerUserStates.get(s),p=f||m===mu.IDLE||m===mu.AWAY;p&&(e.globalAlpha=.3),t.remotePointerButton.get(s)==="down"&&(e.beginPath(),e.arc(a,l,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle="#ffffff88",e.stroke(),e.closePath(),e.beginPath(),e.arc(a,l,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=h,e.stroke(),e.closePath());const b=n.theme===xe.DARK?"#2f6330":yQ,E=c==null?void 0:c.isSpeaking;E&&(e.fillStyle=b,e.strokeStyle=b,e.lineWidth=10,e.lineJoin="round",e.beginPath(),e.moveTo(a,l),e.lineTo(a+0,l+14),e.lineTo(a+4,l+9),e.lineTo(a+11,l+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=$p,e.strokeStyle=$p,e.lineWidth=6,e.lineJoin="round",e.beginPath(),e.moveTo(a,l),e.lineTo(a+0,l+14),e.lineTo(a+4,l+9),e.lineTo(a+11,l+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=h,e.strokeStyle=h,e.lineWidth=2,e.lineJoin="round",e.beginPath(),p?(e.moveTo(a-1,l-1),e.lineTo(a-1,l+15),e.lineTo(a+5,l+10),e.lineTo(a+12,l+9),e.closePath(),e.fill()):(e.moveTo(a,l),e.lineTo(a+0,l+14),e.lineTo(a+4,l+9),e.lineTo(a+11,l+8),e.closePath(),e.fill(),e.stroke());const y=t.remotePointerUsernames.get(s)||"";if(!f&&y){e.font="600 12px sans-serif";const v=(E?a+0:a)+u/2,_=(E?l+0:l)+d+2,I=5,R=3,w=e.measureText(y),T=w.actualBoundingBoxDescent+w.actualBoundingBoxAscent,A=Math.max(T,12),S=v-1,k=_-1,N=w.width+2+I*2+2,D=A+2+R*2+2;if(e.roundRect?(e.beginPath(),e.roundRect(S,k,N,D,8),e.fillStyle=h,e.fill(),e.strokeStyle=$p,e.stroke(),E&&(e.beginPath(),e.roundRect(S-2,k-2,N+4,D+4,8),e.strokeStyle=b,e.stroke())):a$(e,S,k,N,D,8,$p),e.fillStyle=bQ,e.fillText(y,v+I+1,_+R+w.actualBoundingBoxAscent+Math.floor((A-T)/2)+2),E){e.fillStyle=b;const G=8,V=8,H=5;e.fillRect(S+N+V,k+(D/2-G/2),2,G),e.fillRect(S+N+V+H,k+(D/2-G*2/2),2,G*2),e.fillRect(S+N+V+H*2,k+(D/2-G/2),2,G)}}e.restore(),e.closePath()}},pM=({color:e,onClick:t,name:n,src:i,className:r})=>{const s=qpe(n),[o,a]=M.useState(!1),l=!o&&i,c=l?void 0:{background:e};return g("div",{className:me("Avatar",r),style:c,onClick:t,children:l?g("img",{className:"Avatar-img",src:i,alt:s,referrerPolicy:"no-referrer",onError:()=>a(!0)}):s})};oe({name:"goToCollaborator",label:"Go to a collaborator",viewMode:!0,trackEvent:{category:"collab"},perform:(e,t,n)=>{var i;return!n.socketId||((i=t.userToFollow)==null?void 0:i.socketId)===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},captureUpdate:Z.EVENTUALLY}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||""},openMenu:t.openMenu==="canvas"?null:t.openMenu},captureUpdate:Z.EVENTUALLY}},PanelComponent:({updateData:e,data:t,appState:n})=>{const{socketId:i,collaborator:r,withName:s,isBeingFollowed:o}=t,a=L5(i,r),l=me({"is-followed":o,"is-current-user":r.isCurrentUser===!0,"is-speaking":r.isSpeaking,"is-in-call":r.isInCall,"is-muted":r.isMuted}),c=r.isInCall?r.isSpeaking?P("div",{className:"UserList__collaborator-status-icon-speaking-indicator",title:L("userList.hint.isSpeaking"),children:[g("div",{}),g("div",{}),g("div",{})]}):r.isMuted?g("div",{className:"UserList__collaborator-status-icon-microphone-muted",title:L("userList.hint.micMuted"),children:sie}):g("div",{title:L("userList.hint.inCall"),children:rie}):null;return s?P("div",{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${l}`,style:{"--avatar-size":"1.5rem"},onClick:()=>e(r),children:[g(pM,{color:a,onClick:()=>{},name:r.username||"",src:r.avatarUrl,className:l}),g("div",{className:"UserList__collaborator-name",children:r.username}),P("div",{className:"UserList__collaborator-status-icons","aria-hidden":!0,children:[o&&g("div",{className:"UserList__collaborator-status-icon-is-followed",title:L("userList.hint.followStatus"),children:v9}),c]})]}):P("div",{className:`UserList__collaborator UserList__collaborator--avatar-only ${l}`,children:[g(pM,{color:a,onClick:()=>{e(r)},name:r.username||"",src:r.avatarUrl,className:l}),c&&g("div",{className:"UserList__collaborator-status-icon",children:c})]})}});const Jpe=oe({name:"addToLibrary",trackEvent:{category:"element"},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(const s of HO)if(r.some(o=>o.type===s))return{captureUpdate:Z.EVENTUALLY,appState:{...t,errorMessage:L(`errors.libraryElementTypeError.${s}`)}};return i.library.getLatestLibrary().then(s=>i.library.setLibrary([{id:bs(),status:"unpublished",elements:r.map(Cd),created:Date.now()},...s])).then(()=>({captureUpdate:Z.EVENTUALLY,appState:{...t,toast:{message:L("toast.addedToLibrary")}}})).catch(s=>({captureUpdate:Z.EVENTUALLY,appState:{...t,errorMessage:s.message}}))},label:"labels.addToLibrary"}),eUe=(e,t,n,i)=>{const r=j6(e,t),s=js(e);return r.flatMap(o=>{const a=tUe(o,s,n);return o.map(l=>{const c=ee(l,{x:l.x+a.x,y:l.y+a.y});return pr(l,i.getNonDeletedElementsMap(),{simultaneouslyUpdated:o}),c})})},tUe=(e,t,{axis:n,position:i})=>{const r=js(e),[s,o]=n==="x"?["minX","maxX"]:["minY","maxY"],a={x:0,y:0};return i==="start"?{...a,[n]:t[s]-r[s]}:i==="end"?{...a,[n]:t[o]-r[o]}:{...a,[n]:(t[s]+t[o])/2-(r[s]+r[o])/2}},zr=(e,t)=>{const n=t.scene.getSelectedElements(e);return n.length>1&&!n.some(i=>Ie(i))},a1=(e,t,n,i)=>{const r=n.scene.getSelectedElements(t),s=Se(e),o=eUe(r,s,i,n.scene),a=Se(o);return wh(e.map(l=>a.get(l.id)||l),t,n)};oe({name:"alignTop",label:"labels.alignTop",icon:kx,trackEvent:{category:"element"},predicate:(e,t,n,i)=>zr(t,i),perform:(e,t,n,i)=>({appState:t,elements:a1(e,t,i,{position:"start",axis:"y"}),captureUpdate:Z.IMMEDIATELY}),keyTest:e=>e[z.CTRL_OR_CMD]&&e.shiftKey&&e.key===z.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!zr(t,i),type:"button",icon:kx,onClick:()=>n(null),title:`${L("labels.alignTop")} — ${Q("CtrlOrCmd+Shift+Up")}`,"aria-label":L("labels.alignTop"),visible:Fn(Nt(e),t)})});oe({name:"alignBottom",label:"labels.alignBottom",icon:Lx,trackEvent:{category:"element"},predicate:(e,t,n,i)=>zr(t,i),perform:(e,t,n,i)=>({appState:t,elements:a1(e,t,i,{position:"end",axis:"y"}),captureUpdate:Z.IMMEDIATELY}),keyTest:e=>e[z.CTRL_OR_CMD]&&e.shiftKey&&e.key===z.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!zr(t,i),type:"button",icon:Lx,onClick:()=>n(null),title:`${L("labels.alignBottom")} — ${Q("CtrlOrCmd+Shift+Down")}`,"aria-label":L("labels.alignBottom"),visible:Fn(Nt(e),t)})});oe({name:"alignLeft",label:"labels.alignLeft",icon:Dx,trackEvent:{category:"element"},predicate:(e,t,n,i)=>zr(t,i),perform:(e,t,n,i)=>({appState:t,elements:a1(e,t,i,{position:"start",axis:"x"}),captureUpdate:Z.IMMEDIATELY}),keyTest:e=>e[z.CTRL_OR_CMD]&&e.shiftKey&&e.key===z.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!zr(t,i),type:"button",icon:Dx,onClick:()=>n(null),title:`${L("labels.alignLeft")} — ${Q("CtrlOrCmd+Shift+Left")}`,"aria-label":L("labels.alignLeft"),visible:Fn(Nt(e),t)})});oe({name:"alignRight",label:"labels.alignRight",icon:Nx,trackEvent:{category:"element"},predicate:(e,t,n,i)=>zr(t,i),perform:(e,t,n,i)=>({appState:t,elements:a1(e,t,i,{position:"end",axis:"x"}),captureUpdate:Z.IMMEDIATELY}),keyTest:e=>e[z.CTRL_OR_CMD]&&e.shiftKey&&e.key===z.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!zr(t,i),type:"button",icon:Nx,onClick:()=>n(null),title:`${L("labels.alignRight")} — ${Q("CtrlOrCmd+Shift+Right")}`,"aria-label":L("labels.alignRight"),visible:Fn(Nt(e),t)})});oe({name:"alignVerticallyCentered",label:"labels.centerVertically",icon:Ox,trackEvent:{category:"element"},predicate:(e,t,n,i)=>zr(t,i),perform:(e,t,n,i)=>({appState:t,elements:a1(e,t,i,{position:"center",axis:"y"}),captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!zr(t,i),type:"button",icon:Ox,onClick:()=>n(null),title:L("labels.centerVertically"),"aria-label":L("labels.centerVertically"),visible:Fn(Nt(e),t)})});oe({name:"alignHorizontallyCentered",label:"labels.centerHorizontally",icon:Px,trackEvent:{category:"element"},predicate:(e,t,n,i)=>zr(t,i),perform:(e,t,n,i)=>({appState:t,elements:a1(e,t,i,{position:"center",axis:"x"}),captureUpdate:Z.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!zr(t,i),type:"button",icon:Px,onClick:()=>n(null),title:L("labels.centerHorizontally"),"aria-label":L("labels.centerHorizontally"),visible:Fn(Nt(e),t)})});const nUe=(e,t,n)=>{const[i,r,s,o]=n.axis==="x"?["minX","midX","maxX","width"]:["minY","midY","maxY","height"],a=js(e),l=j6(e,t).map(f=>[f,js(f)]).sort((f,h)=>f[1][r]-h[1][r]);let c=0;for(const f of l)c+=f[1][o];const u=(a[o]-c)/(l.length-1);if(u<0){const f=l.findIndex(b=>b[1][i]===a[i]),h=l.findIndex(b=>b[1][s]===a[s]),m=(l[h][1][r]-l[f][1][r])/(l.length-1);let p=l[f][1][r];return l.flatMap(([b,E],y)=>{const v={x:0,y:0};return y!==f&&y!==h&&(p+=m,v[n.axis]=p-E[r]),b.map(_=>Ce(_,{x:_.x+v.x,y:_.y+v.y}))})}let d=a[i];return l.flatMap(([f,h])=>{const m={x:0,y:0};return m[n.axis]=d-h[i],d+=u,d+=h[o],f.map(p=>Ce(p,{x:p.x+m.x,y:p.y+m.y}))})},l$=(e,t)=>{const n=t.scene.getSelectedElements(e);return n.length>1&&!n.some(i=>Ie(i))},c$=(e,t,n,i)=>{const r=n.scene.getSelectedElements(t),s=nUe(r,n.scene.getNonDeletedElementsMap(),i),o=Se(s);return wh(e.map(a=>o.get(a.id)||a),t,n)};oe({name:"distributeHorizontally",label:"labels.distributeHorizontally",trackEvent:{category:"element"},perform:(e,t,n,i)=>({appState:t,elements:c$(e,t,i,{axis:"x"}),captureUpdate:Z.IMMEDIATELY}),keyTest:e=>!e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.H,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!l$(t,i),type:"button",icon:one,onClick:()=>n(null),title:`${L("labels.distributeHorizontally")} — ${Q("Alt+H")}`,"aria-label":L("labels.distributeHorizontally"),visible:Fn(Nt(e),t)})});oe({name:"distributeVertically",label:"labels.distributeVertically",trackEvent:{category:"element"},perform:(e,t,n,i)=>({appState:t,elements:c$(e,t,i,{axis:"y"}),captureUpdate:Z.IMMEDIATELY}),keyTest:e=>!e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.V,PanelComponent:({elements:e,appState:t,updateData:n,app:i})=>g(Ke,{hidden:!l$(t,i),type:"button",icon:ane,onClick:()=>n(null),title:`${L("labels.distributeVertically")} — ${Q("Alt+V")}`,"aria-label":L("labels.distributeVertically"),visible:Fn(Nt(e),t)})});const iUe=oe({name:"flipHorizontal",label:"labels.flipHorizontal",icon:cie,trackEvent:{category:"element"},perform:(e,t,n,i)=>({elements:wh(u$(e,i.scene.getNonDeletedElementsMap(),t,"horizontal",i),t,i),appState:t,captureUpdate:Z.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===tt.H}),rUe=oe({name:"flipVertical",label:"labels.flipVertical",icon:lie,trackEvent:{category:"element"},perform:(e,t,n,i)=>({elements:wh(u$(e,i.scene.getNonDeletedElementsMap(),t,"vertical",i),t,i),appState:t,captureUpdate:Z.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===tt.V&&!e[z.CTRL_OR_CMD]}),u$=(e,t,n,i,r)=>{const s=Fe(Nt(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),o=sUe(s,t,n,i,r),a=Se(o);return e.map(l=>a.get(l.id)||l)},sUe=(e,t,n,i,r)=>{if(e.every(h=>Be(h)&&(h.startBinding||h.endBinding)))return e.map(h=>{const m=h;return Ce(m,{startArrowhead:m.endArrowhead,endArrowhead:m.startArrowhead})});const{midX:s,midY:o}=js(e);RH(e,t,"nw",r.scene,new Map(Array.from(t.values()).map(h=>[h.id,Cd(h)])),{flipByX:i==="horizontal",flipByY:i==="vertical",shouldResizeFromCenter:!0,shouldMaintainAspectRatio:!0}),Ub(e.filter(ke),t,r.scene.getNonDeletedElements(),r.scene,bu(n),[],n.zoom);const{elbowArrows:a,otherElements:l}=e.reduce((h,m)=>ge(m)?{...h,elbowArrows:h.elbowArrows.concat(m)}:{...h,otherElements:h.otherElements.concat(m)},{elbowArrows:[],otherElements:[]}),{midX:c,midY:u}=js(e),[d,f]=[s-c,o-u];return l.forEach(h=>ee(h,{x:h.x+d,y:h.y+f})),a.forEach(h=>ee(h,{x:h.x+d,y:h.y+f})),e},f2=oe({name:"copy",label:"labels.copy",icon:nE,trackEvent:{category:"element"},perform:async(e,t,n,i)=>{const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await The(r,i.files,n)}catch(s){return{captureUpdate:Z.EVENTUALLY,appState:{...t,errorMessage:s.message}}}return{captureUpdate:Z.EVENTUALLY}},keyTest:void 0}),UM=oe({name:"paste",label:"labels.paste",trackEvent:{category:"element"},perform:async(e,t,n,i)=>{let r;try{r=await xhe()}catch(s){return s.name==="AbortError"||s.name==="NotAllowedError"?!1:(console.error(`actionPaste ${s.name}: ${s.message}`),A0?{captureUpdate:Z.EVENTUALLY,appState:{...t,errorMessage:L("hints.firefox_clipboard_write")}}:{captureUpdate:Z.EVENTUALLY,appState:{...t,errorMessage:L("errors.asyncPasteFailedOnRead")}})}try{i.pasteFromClipboard(_he({types:r}))}catch(s){return console.error(s),{captureUpdate:Z.EVENTUALLY,appState:{...t,errorMessage:L("errors.asyncPasteFailedOnParse")}}}return{captureUpdate:Z.EVENTUALLY}},keyTest:void 0}),bM=oe({name:"cut",label:"labels.cut",icon:Xne,trackEvent:{category:"element"},perform:(e,t,n,i)=>(f2.perform(e,t,n,i),BH.perform(e,t,null,i)),keyTest:e=>e[z.CTRL_OR_CMD]&&e.key===z.X}),yM=oe({name:"copyAsSvg",label:"labels.copyAsSvg",icon:uie,trackEvent:{category:"element"},perform:async(e,t,n,i)=>{if(!i.canvas)return{captureUpdate:Z.EVENTUALLY};const{exportedElements:r,exportingFrame:s}=R5(e,t,!0);try{await k5("clipboard-svg",r,t,i.files,{...t,exportingFrame:s,name:i.getName()});const o=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});return{appState:{toast:{message:L("toast.copyToClipboardAsSvg",{exportSelection:o.length?L("toast.selection"):L("toast.canvas"),exportColorScheme:t.exportWithDarkMode?L("buttons.darkMode"):L("buttons.lightMode")})}},captureUpdate:Z.EVENTUALLY}}catch(o){return console.error(o),{appState:{errorMessage:o.message},captureUpdate:Z.EVENTUALLY}}},predicate:e=>Z9&&e.length>0,keywords:["svg","clipboard","copy"]}),EM=oe({name:"copyAsPng",label:"labels.copyAsPng",icon:die,trackEvent:{category:"element"},perform:async(e,t,n,i)=>{if(!i.canvas)return{captureUpdate:Z.EVENTUALLY};const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:s,exportingFrame:o}=R5(e,t,!0);try{return await k5("clipboard",s,t,i.files,{...t,exportingFrame:o,name:i.getName()}),{appState:{...t,toast:{message:L("toast.copyToClipboardAsPng",{exportSelection:r.length?L("toast.selection"):L("toast.canvas"),exportColorScheme:t.exportWithDarkMode?L("buttons.darkMode"):L("buttons.lightMode")})}},captureUpdate:Z.EVENTUALLY}}catch(a){return console.error(a),{appState:{...t,errorMessage:a.message},captureUpdate:Z.EVENTUALLY}}},predicate:e=>q9&&e.length>0,keyTest:e=>e.code===tt.C&&e.altKey&&e.shiftKey,keywords:["png","clipboard","copy"]}),vM=oe({name:"copyText",label:"labels.copyText",trackEvent:{category:"element"},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});try{Bc(wH(r))}catch{throw new Error(L("errors.copyToSystemClipboardFailed"))}return{captureUpdate:Z.EVENTUALLY}},predicate:(e,t,n,i)=>Z9&&i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(de),keywords:["text","clipboard","copy"]}),_M=oe({name:"gridMode",icon:mie,keywords:["snap"],label:"labels.toggleGrid",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>e.gridModeEnabled},perform(e,t){return{appState:{...t,gridModeEnabled:!this.checked(t),objectsSnapModeEnabled:!1},captureUpdate:Z.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[z.CTRL_OR_CMD]&&e.code===tt.QUOTE}),VE=oe({name:"zenMode",label:"buttons.zenMode",icon:hie,paletteName:"Toggle zen mode",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},captureUpdate:Z.EVENTUALLY}},checked:e=>e.zenModeEnabled,predicate:(e,t,n)=>typeof n.zenModeEnabled>"u",keyTest:e=>!e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.Z}),oUe=oe({name:"objectsSnapMode",label:"buttons.objectsSnapMode",icon:fie,viewMode:!1,trackEvent:{category:"canvas",predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridModeEnabled:!1},captureUpdate:Z.EVENTUALLY}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>"u",keyTest:e=>!e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.S}),$E=oe({name:"stats",label:"stats.fullTitle",icon:aie,paletteName:"Toggle stats",viewMode:!0,trackEvent:{category:"menu"},keywords:["edit","attributes","customize"],perform(e,t){return{appState:{...t,stats:{...t.stats,open:!this.checked(t)}},captureUpdate:Z.EVENTUALLY}},checked:e=>e.stats.open,keyTest:e=>!e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.SLASH}),aUe=oe({name:"unbindText",label:"labels.unbindText",trackEvent:{category:"element"},predicate:(e,t,n,i)=>i.scene.getSelectedElements(t).some(s=>Us(s)),perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t),s=i.scene.getNonDeletedElementsMap();return r.forEach(o=>{var l;const a=Oe(o,s);if(a){const{width:c,height:u}=zi(a.originalText,xt(a),a.lineHeight),d=S1e(o.id);vH(o.id);const{x:f,y:h}=U5(o,a,s);ee(a,{containerId:null,width:c,height:u,text:a.originalText,x:f,y:h}),ee(o,{boundElements:(l=o.boundElements)==null?void 0:l.filter(m=>m.id!==a.id),height:d||o.height})}}),{elements:e,appState:t,captureUpdate:Z.IMMEDIATELY}}}),lUe=oe({name:"bindText",label:"labels.bindText",trackEvent:{category:"element"},predicate:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);if(r.length===2){const s=de(r[0])||de(r[1]);let o;if(Nu(r[0])?o=r[0]:Nu(r[1])&&(o=r[1]),s&&o&&Oe(o,i.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);let s,o;de(r[0])&&Nu(r[1])?(s=r[0],o=r[1]):(s=r[1],o=r[0]),ee(s,{containerId:o.id,verticalAlign:Ar.MIDDLE,textAlign:R0.CENTER,autoResize:!0}),ee(o,{boundElements:(o.boundElements||[]).concat({type:"text",id:s.id})});const a=o.height;return Qi(s,o,i.scene.getNonDeletedElementsMap()),Db(o.id,a),{elements:cUe(e,o,s),appState:{...t,selectedElementIds:{[o.id]:!0}},captureUpdate:Z.IMMEDIATELY}}}),cUe=(e,t,n)=>{const i=e.slice(),r=i.findIndex(o=>o.id===n.id);i.splice(r,1);const s=i.findIndex(o=>o.id===t.id);return i.splice(s+1,0,n),Vo(i,Se([t,n])),i},uUe=(e,t,n)=>{const i=e.slice(),r=i.findIndex(o=>o.id===t.id);i.splice(r,1);const s=i.findIndex(o=>o.id===n.id);return i.splice(s,0,t),Vo(i,Se([t,n])),i},dUe=oe({name:"wrapTextInContainer",label:"labels.createContainerFromText",trackEvent:{category:"element"},predicate:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t),s=r.every(o=>de(o));return r.length>0&&s},perform:(e,t,n,i)=>{var a;const r=i.scene.getSelectedElements(t);let s=e.slice();const o={};for(const l of r)if(de(l)){const c=Xa({type:"rectangle",backgroundColor:t.currentItemBackgroundColor,boundElements:[...l.boundElements||[],{id:l.id,type:"text"}],angle:l.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:t.currentItemStrokeWidth,strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness==="round"?{type:e1("rectangle")?On.ADAPTIVE_RADIUS:On.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:l.x-Nn,y:l.y-Nn,width:sd(l.width,"rectangle"),height:sd(l.height,"rectangle"),groupIds:l.groupIds,frameId:l.frameId});if((a=l.boundElements)!=null&&a.length){const u=l.boundElements.filter(f=>f.type==="arrow").map(f=>f.id);s.filter(f=>u.includes(f.id)).forEach(f=>{let h=f.startBinding,m=f.endBinding;(h==null?void 0:h.elementId)===l.id&&(h={...h,elementId:c.id}),(m==null?void 0:m.elementId)===l.id&&(m={...m,elementId:c.id}),(h||m)&&ee(f,{startBinding:h,endBinding:m},!1)})}ee(l,{containerId:c.id,verticalAlign:Ar.MIDDLE,boundElements:null,textAlign:R0.CENTER,autoResize:!0},!1),Qi(l,c,i.scene.getNonDeletedElementsMap()),s=uUe([...s,c],c,l),o[c.id]=!0}return{elements:s,appState:{...t,selectedElementIds:o},captureUpdate:Z.IMMEDIATELY}}}),P_=380,fUe=42,GE=5,d$=85,hUe=500;let XE=!1;const dU=new Map,gUe=({element:e,elementsMap:t,setAppState:n,onLinkOpen:i,setToast:r,updateEmbedValidationStatus:s})=>{const o=tp(),a=ep(),l=Qn(),c=e.link||"",[u,d]=M.useState(c),f=M.useRef(null),h=o.showHyperlinkPopup==="editor",m=M.useCallback(()=>{var _;if(!f.current)return;const v=Or(f.current.value)||null;if(!e.link&&v&&ut("hyperlink","create"),lr(e)){if(((_=o.activeEmbeddable)==null?void 0:_.element)===e&&n({activeEmbeddable:null}),!v){ee(e,{link:null}),s(e,!1);return}if(!qU(v,a.validateEmbeddable))v&&r({message:L("toast.unableToEmbed"),closable:!0}),e.link&&dU.set(e.id,e.link),ee(e,{link:v}),s(e,!1);else{const{width:I,height:R}=e,w=Pf(v);(w==null?void 0:w.error)instanceof URIError&&r({message:L("toast.unrecognizedLinkFormat"),closable:!0});const T=w?w.intrinsicSize.w/w.intrinsicSize.h:1,A=dU.get(e.id)!==e.link;ee(e,{...A?{width:(w==null?void 0:w.type)==="video"?I>R?I:R*T:I,height:(w==null?void 0:w.type)==="video"&&I>R?I/T:R}:{},link:v}),s(e,!0),dU.has(e.id)&&dU.delete(e.id)}}else ee(e,{link:v})},[e,r,a.validateEmbeddable,o.activeEmbeddable,n,s]);M.useLayoutEffect(()=>()=>{m()},[m]),M.useEffect(()=>{h&&(f!=null&&f.current)&&!(l.viewport.isMobile||l.isTouchScreen)&&f.current.select()},[h,l.viewport.isMobile,l.isTouchScreen]),M.useEffect(()=>{let v=null;const _=I=>{if(h)return;v&&clearTimeout(v),UUe(e,t,o,C(I.clientX,I.clientY))&&(v=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},hUe))};return window.addEventListener(te.POINTER_MOVE,_,!1),()=>{window.removeEventListener(te.POINTER_MOVE,_,!1),v&&clearTimeout(v)}},[o,e,h,n,t]);const p=M.useCallback(()=>{ut("hyperlink","delete"),ee(e,{link:null}),n({showHyperlinkPopup:!1})},[n,e]),b=()=>{ut("hyperlink","edit","popup-ui"),n({showHyperlinkPopup:"editor"})},{x:E,y}=f$(e,o,t);return o.contextMenu||o.selectedElementsAreBeingDragged||o.resizingElement||o.isRotating||o.openMenu||o.viewModeEnabled?null:P("div",{className:"excalidraw-hyperlinkContainer",style:{top:`${y}px`,left:`${E}px`,width:P_,padding:GE},children:[h?g("input",{className:me("excalidraw-hyperlinkContainer-input"),placeholder:L("labels.link.hint"),ref:f,value:u,onChange:v=>d(v.target.value),autoFocus:!0,onKeyDown:v=>{v.stopPropagation(),v[z.CTRL_OR_CMD]&&v.key===z.K&&v.preventDefault(),(v.key===z.ENTER||v.key===z.ESCAPE)&&(m(),n({showHyperlinkPopup:"info"}))}}):e.link?g("a",{href:Or(e.link||""),className:"excalidraw-hyperlinkContainer-link",target:AF(e.link)?"_self":"_blank",onClick:v=>{if(e.link&&i){const _=aF(te.EXCALIDRAW_LINK,v.nativeEvent);i({...e,link:Or(e.link)},_),_.defaultPrevented&&v.preventDefault()}},rel:"noopener noreferrer",children:e.link}):g("div",{className:"excalidraw-hyperlinkContainer-link",children:L("labels.link.empty")}),P("div",{className:"excalidraw-hyperlinkContainer__buttons",children:[!h&&g(Ke,{type:"button",title:L("buttons.edit"),"aria-label":L("buttons.edit"),label:L("buttons.edit"),onClick:b,className:"excalidraw-hyperlinkContainer--edit",icon:B0}),g(Ke,{type:"button",title:L("labels.linkToElement"),"aria-label":L("labels.linkToElement"),label:L("labels.linkToElement"),onClick:()=>{n({openDialog:{name:"elementLinkSelector",sourceElementId:e.id}})},icon:JF}),c&&!lr(e)&&g(Ke,{type:"button",title:L("buttons.remove"),"aria-label":L("buttons.remove"),label:L("buttons.remove"),onClick:p,className:"excalidraw-hyperlinkContainer--remove",icon:bc})]})]})},f$=(e,t,n)=>{const[i,r]=De(e,n),{x:s,y:o}=Os({sceneX:i+e.width/2,sceneY:r},t),a=s-t.offsetLeft-P_/2,l=o-t.offsetTop-d$;return{x:a,y:l}},wM=(e,t)=>{var r;const n=Fe(e,t);return lr(n[0])?"labels.link.editEmbed":(r=n[0])!=null&&r.link?"labels.link.edit":"labels.link.create"};let i0=null;const mUe=(e,t,n)=>{i0&&clearTimeout(i0),i0=window.setTimeout(()=>pUe(e,t,n),xQ)},pUe=(e,t,n)=>{if(!e.link)return;const i=t0();i.classList.add("excalidraw-tooltip--visible"),i.style.maxWidth="20rem",i.textContent=Zf(e.link)?L("labels.link.goToElement"):e.link;const[r,s,o,a]=De(e,n),[l,c,u,d]=j9([r,s,o,a],e.angle,t),f=Os({sceneX:l,sceneY:c},t);n$(i,{left:f.x,top:f.y,width:u,height:d},"top"),ut("hyperlink","tooltip","link-icon"),XE=!0},TM=()=>{i0&&clearTimeout(i0),XE&&(XE=!1,t0().classList.remove("excalidraw-tooltip--visible"))},UUe=(e,t,n,[i,r])=>{const{x:s,y:o}=Pt({clientX:i,clientY:r},n),a=15/n.zoom.value;if(x9(s,o,e,t))return!1;const[l,c,u]=De(e,t);if(s>=l&&s<=u&&o>=c-d$&&o<=c)return!1;const{x:d,y:f}=f$(e,n,t);return!(i>=d-a&&i<=d+P_+GE*2+a&&r>=f-a&&r<=f+a+GE*2+fUe)},h$=oe({name:"hyperlink",label:(e,t)=>wM(e,t),icon:fb,perform:(e,t)=>t.showHyperlinkPopup==="editor"?!1:{elements:e,appState:{...t,showHyperlinkPopup:"editor",openMenu:null},captureUpdate:Z.IMMEDIATELY},trackEvent:{category:"hyperlink",action:"click"},keyTest:e=>e[z.CTRL_OR_CMD]&&e.key===z.K,predicate:(e,t)=>Fe(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{const i=Fe(e,t);return g(Ke,{type:"button",icon:fb,"aria-label":L(wM(e,t)),title:`${lr(e[0])?L("labels.link.labelEmbed"):L("labels.link.label")} - ${Q("CtrlOrCmd+K")}`,onClick:()=>n(null),selected:i.length===1&&!!i[0].link})}}),o7=e=>e.every(t=>!t.locked),bUe=oe({name:"toggleElementLock",label:(e,t,n)=>{const i=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1});return i.length===1&&!Ie(i[0])?i[0].locked?"labels.elementLock.unlock":"labels.elementLock.lock":o7(i)?"labels.elementLock.lockAll":"labels.elementLock.unlockAll"},icon:(e,t)=>{const n=Fe(t,e);return o7(n)?m9:Y6},trackEvent:{category:"element"},predicate:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);return r.length>0&&!r.some(s=>s.locked&&s.frameId)},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!r.length)return!1;const s=o7(r),o=Se(r);return{elements:e.map(a=>o.has(a.id)?Ce(a,{locked:s}):a),appState:{...t,selectedLinearElement:s?null:t.selectedLinearElement},captureUpdate:Z.IMMEDIATELY}},keyTest:(e,t,n,i)=>e.key.toLocaleLowerCase()===z.L&&e[z.CTRL_OR_CMD]&&e.shiftKey&&i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),yUe=oe({name:"unlockAllElements",paletteName:"Unlock all elements",trackEvent:{category:"canvas"},viewMode:!1,icon:Y6,predicate:(e,t)=>Fe(e,t).length===0&&e.some(i=>i.locked),perform:(e,t)=>{const n=e.filter(i=>i.locked);return{elements:e.map(i=>i.locked?Ce(i,{locked:!1}):i),appState:{...t,selectedElementIds:Object.fromEntries(n.map(i=>[i.id,!0]))},captureUpdate:Z.IMMEDIATELY}},label:"labels.elementLock.unlockAll"}),cd=({type:e="button",onSelect:t,selected:n,children:i,className:r="",...s})=>g("button",{onClick:G6(s.onClick,o=>{t()}),type:e,className:me("excalidraw-button",r,{selected:n}),...s,children:i}),Ah=M.forwardRef(({onChange:e,label:t,fullWidth:n,placeholder:i,readonly:r,selectOnRender:s,onKeyDown:o,isRedacted:a=!1,icon:l,className:c,...u},d)=>{const f=M.useRef(null);M.useImperativeHandle(d,()=>f.current),M.useLayoutEffect(()=>{var p,b;s&&((p=f.current)==null||p.focus(),(b=f.current)==null||b.select())},[s]);const[h,m]=M.useState(!1);return P("div",{className:me("ExcTextField",c,{"ExcTextField--fullWidth":n,"ExcTextField--hasIcon":!!l}),onClick:()=>{var p;(p=f.current)==null||p.focus()},children:[l,t&&g("div",{className:"ExcTextField__label",children:t}),P("div",{className:me("ExcTextField__input",{"ExcTextField__input--readonly":r}),children:[g("input",{className:me({"is-redacted":"value"in u&&u.value&&a&&!h}),readOnly:r,value:"value"in u?u.value:void 0,defaultValue:"defaultValue"in u?u.defaultValue:void 0,placeholder:i,ref:f,onChange:p=>e==null?void 0:e(p.target.value),onKeyDown:o}),a&&g(cd,{onSelect:()=>m(!h),style:{border:0,userSelect:"none"},children:h?eie:v9})]})]})}),EUe={toggleTheme:[Q("Shift+Alt+D")],saveScene:[Q("CtrlOrCmd+S")],loadScene:[Q("CtrlOrCmd+O")],clearCanvas:[Q("CtrlOrCmd+Delete")],imageExport:[Q("CtrlOrCmd+Shift+E")],commandPalette:[Q("CtrlOrCmd+/"),Q("CtrlOrCmd+Shift+P")],cut:[Q("CtrlOrCmd+X")],copy:[Q("CtrlOrCmd+C")],paste:[Q("CtrlOrCmd+V")],copyStyles:[Q("CtrlOrCmd+Alt+C")],pasteStyles:[Q("CtrlOrCmd+Alt+V")],selectAll:[Q("CtrlOrCmd+A")],deleteSelectedElements:[Q("Delete")],duplicateSelection:[Q("CtrlOrCmd+D"),Q(`Alt+${L("helpDialog.drag")}`)],sendBackward:[Q("CtrlOrCmd+[")],bringForward:[Q("CtrlOrCmd+]")],sendToBack:[Q(Fo?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")],bringToFront:[Q(Fo?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")],copyAsPng:[Q("Shift+Alt+C")],group:[Q("CtrlOrCmd+G")],ungroup:[Q("CtrlOrCmd+Shift+G")],gridMode:[Q("CtrlOrCmd+'")],zenMode:[Q("Alt+Z")],objectsSnapMode:[Q("Alt+S")],stats:[Q("Alt+/")],addToLibrary:[],flipHorizontal:[Q("Shift+H")],flipVertical:[Q("Shift+V")],viewMode:[Q("Alt+R")],hyperlink:[Q("CtrlOrCmd+K")],toggleElementLock:[Q("CtrlOrCmd+Shift+L")],resetZoom:[Q("CtrlOrCmd+0")],zoomOut:[Q("CtrlOrCmd+-")],zoomIn:[Q("CtrlOrCmd++")],zoomToFitSelection:[Q("Shift+3")],zoomToFit:[Q("Shift+1")],zoomToFitSelectionInViewport:[Q("Shift+2")],toggleEraserTool:[Q("E")],toggleHandTool:[Q("H")],setFrameAsActiveTool:[Q("F")],saveFileToDisk:[Q("CtrlOrCmd+S")],saveToActiveFile:[Q("CtrlOrCmd+S")],toggleShortcuts:[Q("?")],searchMenu:[Q("CtrlOrCmd+F")],wrapSelectionInFrame:[]},Bi=(e,t=0)=>{const n=EUe[e];return n&&n.length>0?n[t]||n[0]:""};var g$={exports:{}};(function(e,t){(function(){var n={};e.exports=n,n.simpleFilter=function(i,r){return r.filter(function(s){return n.test(i,s)})},n.test=function(i,r){return n.match(i,r)!==null},n.match=function(i,r,s){s=s||{};var o=0,a=[],l=r.length,c=0,u=0,d=s.pre||"",f=s.post||"",h=s.caseSensitive&&r||r.toLowerCase(),m;i=s.caseSensitive&&i||i.toLowerCase();for(var p=0;p<l;p++)m=r[p],h[p]===i[o]?(m=d+m+f,o+=1,u+=1+u):u=0,c+=u,a[a.length]=m;return o===i.length?(c=h===i?1/0:c,{rendered:a.join(""),score:c}):null},n.filter=function(i,r,s){return!r||r.length===0?[]:typeof i!="string"?r:(s=s||{},r.reduce(function(o,a,l,c){var u=a;s.extract&&(u=s.extract(a));var d=n.match(i,u,s);return d!=null&&(o[o.length]={string:d.rendered,score:d.score,index:l,original:a}),o},[]).sort(function(o,a){var l=a.score-o.score;return l||o.index-a.index}))}})()})(g$);var vUe=g$.exports;const _Ue=sl(vUe),wUe="\\u0300-\\u036f",TUe="\\ufe20-\\ufe2f",SUe="\\u20d0-\\u20ff",IUe=wUe+TUe+SUe,xUe=`[${IUe}]`,CUe=RegExp(xUe,"g"),AUe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,MUe={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"E",æ:"e",Þ:"T",þ:"t",ß:"s",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",Ĳ:"I",ĳ:"i",Œ:"E",œ:"e",ŉ:"n",ſ:"s"},SM=e=>e.replace(AUe,t=>MUe[t]||t).replace(CUe,""),RUe=M.forwardRef(({children:e,gap:t,align:n,justifyContent:i,className:r,style:s},o)=>g("div",{className:me("Stack Stack_horizontal",r),style:{"--gap":t,alignItems:n,justifyContent:i,...s},ref:o,children:e})),kUe=M.forwardRef(({children:e,gap:t,align:n,justifyContent:i,className:r,style:s},o)=>g("div",{className:me("Stack Stack_vertical",r),style:{"--gap":t,justifyItems:n,justifyContent:i,...s},ref:o,children:e})),ss={Row:RUe,Col:kUe},m$=({className:e="",children:t,onToggle:n,title:i,...r})=>{const s=Qn(),o=me(`dropdown-menu-button ${e}`,"zen-mode-transition",{"dropdown-menu-button--mobile":s.editor.isMobile}).trim();return g("button",{"data-prevent-outside-click":!0,className:o,onClick:n,type:"button","data-testid":"dropdown-menu-button",title:i,...r,children:t})};m$.displayName="DropdownMenuTrigger";const p$=()=>g("div",{style:{height:"1px",backgroundColor:"var(--default-border-color)",margin:".5rem 0"}});p$.displayName="DropdownMenuSeparator";const U$=({children:e,onClickOutside:t,className:n="",onSelect:i,style:r})=>{const s=Qn(),o=M.useRef(null),a=x5({onClickOutside:t});R_(o,()=>{var c;(c=a.onClickOutside)==null||c.call(a)}),M.useEffect(()=>{const c=d=>{var f;d.key===z.ESCAPE&&(d.stopImmediatePropagation(),(f=a.onClickOutside)==null||f.call(a))},u={capture:!0};return document.addEventListener(te.KEYDOWN,c,u),()=>{document.removeEventListener(te.KEYDOWN,c,u)}},[a]);const l=me(`dropdown-menu ${n}`,{"dropdown-menu--mobile":s.editor.isMobile}).trim();return g(ZV.Provider,{value:{onSelect:i},children:g("div",{ref:o,className:l,style:r,"data-testid":"dropdown-menu",children:s.editor.isMobile?g(ss.Col,{className:"dropdown-menu-container",children:e}):g(Ys,{className:"dropdown-menu-container",padding:2,style:{zIndex:2},children:e})})})};U$.displayName="DropdownMenuContent";const r0=({icon:e,shortcut:t,href:n,children:i,onSelect:r,className:s="",selected:o,rel:a="noreferrer",...l})=>{const c=QV(l.onClick,r);return g("a",{...l,href:n,target:"_blank",rel:"noreferrer",className:qV(s,o),title:l.title??l["aria-label"],onClick:c,children:g(JV,{icon:e,shortcut:t,children:i})})};r0.displayName="DropdownMenuItemLink";const LUe=({children:e,className:t="",selected:n,...i})=>g("div",{...i,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?"dropdown-menu-item--selected":""}`.trim(),children:e}),DUe=e=>{const t=se.Children.toArray(e).find(n=>se.isValidElement(n)&&typeof n.type!="string"&&(n==null?void 0:n.type.displayName)&&n.type.displayName==="DropdownMenuTrigger");return t||null},NUe=e=>{const t=se.Children.toArray(e).find(n=>se.isValidElement(n)&&typeof n.type!="string"&&(n==null?void 0:n.type.displayName)&&n.type.displayName==="DropdownMenuContent");return t||null},ot=({children:e,open:t})=>{const n=DUe(e),i=NUe(e);return P(he,{children:[n,t&&i]})};ot.Trigger=m$;ot.Content=U$;ot.Item=Er;ot.ItemLink=r0;ot.ItemCustom=LUe;ot.Group=zb;ot.Separator=p$;ot.displayName="DropdownMenu";var OUe={};const IM=e=>{let t;const n=new Set,i=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(OUe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(i,r,l);return l},PUe=e=>e?IM(e):IM;var b$={exports:{}},y$={},E$={exports:{}},v$={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Mh=M;function FUe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var BUe=typeof Object.is=="function"?Object.is:FUe,zUe=Mh.useState,HUe=Mh.useEffect,VUe=Mh.useLayoutEffect,$Ue=Mh.useDebugValue;function GUe(e,t){var n=t(),i=zUe({inst:{value:n,getSnapshot:t}}),r=i[0].inst,s=i[1];return VUe(function(){r.value=n,r.getSnapshot=t,a7(r)&&s({inst:r})},[e,n,t]),HUe(function(){return a7(r)&&s({inst:r}),e(function(){a7(r)&&s({inst:r})})},[e]),$Ue(n),n}function a7(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!BUe(e,n)}catch{return!0}}function XUe(e,t){return t()}var jUe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?XUe:GUe;v$.useSyncExternalStore=Mh.useSyncExternalStore!==void 0?Mh.useSyncExternalStore:jUe;E$.exports=v$;var YUe=E$.exports;/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var D5=M,WUe=YUe;function KUe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ZUe=typeof Object.is=="function"?Object.is:KUe,qUe=WUe.useSyncExternalStore,QUe=D5.useRef,JUe=D5.useEffect,e2e=D5.useMemo,t2e=D5.useDebugValue;y$.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var s=QUe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=e2e(function(){function l(h){if(!c){if(c=!0,u=h,h=i(h),r!==void 0&&o.hasValue){var m=o.value;if(r(m,h))return d=m}return d=h}if(m=d,ZUe(u,h))return m;var p=i(h);return r!==void 0&&r(m,p)?(u=h,m):(u=h,d=p)}var c=!1,u,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,i,r]);var a=qUe(e,s[0],s[1]);return JUe(function(){o.hasValue=!0,o.value=a},[a]),t2e(a),a};b$.exports=y$;var n2e=b$.exports;const i2e=sl(n2e);var _$={};const{useDebugValue:r2e}=se,{useSyncExternalStoreWithSelector:s2e}=i2e;let xM=!1;const o2e=e=>e;function a2e(e,t=o2e,n){(_$?"production":void 0)!=="production"&&n&&!xM&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xM=!0);const i=s2e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return r2e(i),i}const CM=e=>{(_$?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?PUe(e):e,n=(i,r)=>a2e(t,i,r);return Object.assign(n,t),n},l2e=e=>e?CM(e):CM;var AM,MM;const RM=typeof window<"u"&&((AM=window.document)!=null&&AM.createElement||((MM=window.navigator)==null?void 0:MM.product)==="ReactNative")?se.useLayoutEffect:se.useEffect;function ho(){const e=l2e(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{const n=e(r=>r.set),i=e(r=>r.version);return RM(()=>{n(r=>({version:r.version+1}))},[]),RM(()=>(n(({current:r})=>({current:[...r,t]})),()=>n(({current:r})=>({current:r.filter(s=>s!==t)}))),[t,i]),null},Out:()=>{const t=e(n=>n.current);return se.createElement(se.Fragment,null,t)}}}const w$=se.createContext(null),ir=()=>se.useContext(w$),c2e=NP(),u2e=()=>se.useMemo(()=>({MainMenuTunnel:ho(),WelcomeScreenMenuHintTunnel:ho(),WelcomeScreenToolbarHintTunnel:ho(),WelcomeScreenHelpHintTunnel:ho(),WelcomeScreenCenterTunnel:ho(),FooterCenterTunnel:ho(),DefaultSidebarTriggerTunnel:ho(),DefaultSidebarTabTriggersTunnel:ho(),OverwriteConfirmDialogTunnel:ho(),TTDDialogTriggerTunnel:ho(),tunnelsJotai:c2e}),[]),T$=(e,t)=>{var i;let n=((i=t[0])==null?void 0:i.type)||null;for(const r of t)if(r.type!==n){n=null;break}return TE(e.activeTool.type)&&e.activeTool.type!=="image"&&n!=="image"&&n!=="frame"&&n!=="magicframe"||t.some(r=>TE(r.type))},S$=(e,t)=>Th(e.activeTool.type)||t.some(n=>Th(n.type)),I$=({appState:e,elementsMap:t,renderAction:n,app:i})=>{const r=OH(t,e);let s=!1;r.length===2&&(Us(r[0])||Us(r[1]))&&(s=!0);const o=!!(e.editingTextElement||e.newElement),a=Qn(),l=document.documentElement.getAttribute("dir")==="rtl",c=Th(e.activeTool.type)&&!Fs(e.currentItemBackgroundColor)||r.some(m=>Th(m.type)&&!Fs(m.backgroundColor)),u=r.length===1||s,d=!e.editingLinearElement&&r.length===1&&ke(r[0])&&!ge(r[0]),f=!e.croppingElementId&&r.length===1&&st(r[0]),h=!s&&zr(e,i);return P("div",{className:"panelColumn",children:[g("div",{children:T$(e,r)&&n("changeStrokeColor")}),S$(e,r)&&g("div",{children:n("changeBackgroundColor")}),c&&n("changeFillStyle"),(uA(e.activeTool.type)||r.some(m=>uA(m.type)))&&n("changeStrokeWidth"),(e.activeTool.type==="freedraw"||r.some(m=>m.type==="freedraw"))&&n("changeStrokeShape"),(dA(e.activeTool.type)||r.some(m=>dA(m.type)))&&P(he,{children:[n("changeStrokeStyle"),n("changeSloppiness")]}),(SE(e.activeTool.type)||r.some(m=>SE(m.type)))&&g(he,{children:n("changeRoundness")}),(fA(e.activeTool.type)||r.some(m=>fA(m.type)))&&g(he,{children:n("changeArrowType")}),(e.activeTool.type==="text"||r.some(de))&&P(he,{children:[n("changeFontFamily"),n("changeFontSize"),(e.activeTool.type==="text"||A1e(r,t))&&n("changeTextAlign")]}),C1e(r,t)&&n("changeVerticalAlign"),(Lb(e.activeTool.type)||r.some(m=>Lb(m.type)))&&g(he,{children:n("changeArrowhead")}),n("changeOpacity"),P("fieldset",{children:[g("legend",{children:L("labels.layers")}),P("div",{className:"buttonList",children:[n("sendToBack"),n("sendBackward"),n("bringForward"),n("bringToFront")]})]}),h&&!s&&P("fieldset",{children:[g("legend",{children:L("labels.align")}),P("div",{className:"buttonList",children:[l?P(he,{children:[n("alignRight"),n("alignHorizontallyCentered"),n("alignLeft")]}):P(he,{children:[n("alignLeft"),n("alignHorizontallyCentered"),n("alignRight")]}),r.length>2&&n("distributeHorizontally"),g("div",{style:{flexBasis:"100%",height:0}}),P("div",{style:{display:"flex",flexWrap:"wrap",gap:".5rem",marginTop:"-0.5rem"},children:[n("alignTop"),n("alignVerticallyCentered"),n("alignBottom"),r.length>2&&n("distributeVertically")]})]})]}),!o&&r.length>0&&P("fieldset",{children:[g("legend",{children:L("labels.actions")}),P("div",{className:"buttonList",children:[!a.editor.isMobile&&n("duplicateSelection"),!a.editor.isMobile&&n("deleteSelectedElements"),n("group"),n("ungroup"),u&&n("hyperlink"),f&&n("cropEditor"),d&&n("toggleLinearEditor")]})]})]})},x$=({activeTool:e,appState:t,app:n,UIOptions:i})=>{const[r,s]=M.useState(!1),o=e.type==="frame",a=e.type==="laser",l=e.type==="embeddable",{TTDDialogTriggerTunnel:c}=ir();return P(he,{children:[C9.map(({value:u,icon:d,key:f,numericKey:h,fillable:m},p)=>{var v;if(((v=i.tools)==null?void 0:v[u])===!1)return null;const b=L(`toolBar.${u}`),E=f&&Xg(typeof f=="string"?f:f[0]),y=E?`${E} ${L("helpDialog.or")} ${h}`:`${h}`;return g(Ke,{className:me("Shape",{fillable:m}),type:"radio",icon:d,checked:e.type===u,name:"editor-current-shape",title:`${Xg(b)} — ${y}`,keyBindingLabel:h||E,"aria-label":Xg(b),"aria-keyshortcuts":y,"data-testid":`toolbar-${u}`,onPointerDown:({pointerType:_})=>{!t.penDetected&&_==="pen"&&n.togglePenMode(!0)},onChange:({pointerType:_})=>{t.activeTool.type!==u&&ut("toolbar",u,"ui"),u==="image"?n.setActiveTool({type:u,insertOnCanvasDirectly:_!=="mouse"}):n.setActiveTool({type:u})}},u)}),g("div",{className:"App-toolbar__divider"}),P(ot,{open:r,children:[g(ot.Trigger,{className:me("App-toolbar__extra-tools-trigger",{"App-toolbar__extra-tools-trigger--selected":o||l||a&&!n.props.isCollaborating}),onToggle:()=>s(!r),title:L("toolBar.extraTools"),children:Qne}),P(ot.Content,{onClickOutside:()=>s(!1),onSelect:()=>s(!1),className:"App-toolbar__extra-tools-dropdown",children:[g(ot.Item,{onSelect:()=>n.setActiveTool({type:"frame"}),icon:GF,shortcut:z.F.toLocaleUpperCase(),"data-testid":"toolbar-frame",selected:o,children:L("toolBar.frame")}),g(ot.Item,{onSelect:()=>n.setActiveTool({type:"embeddable"}),icon:Yte,"data-testid":"toolbar-embeddable",selected:l,children:L("toolBar.embeddable")}),g(ot.Item,{onSelect:()=>n.setActiveTool({type:"laser"}),icon:jF,"data-testid":"toolbar-laser",selected:a,shortcut:z.K.toLocaleUpperCase(),children:L("toolBar.laser")}),g("div",{style:{margin:"6px 0",fontSize:14,fontWeight:600},children:"Generate"}),n.props.aiEnabled!==!1&&g(c.Out,{}),g(ot.Item,{onSelect:()=>n.setOpenDialog({name:"ttd",tab:"mermaid"}),icon:XF,"data-testid":"toolbar-embeddable",children:L("toolBar.mermaidToExcalidraw")}),n.props.aiEnabled!==!1&&n.plugins.diagramToCode&&g(he,{children:P(ot.Item,{onSelect:()=>n.onMagicframeToolSelect(),icon:YF,"data-testid":"toolbar-magicframe",children:[L("toolBar.magicframe"),g(ot.Item.Badge,{children:"AI"})]})})]})]})]})},d2e=({renderAction:e,zoom:t})=>g(ss.Col,{gap:1,className:hh.ZOOM_ACTIONS,children:P(ss.Row,{align:"center",children:[e("zoomOut"),e("resetZoom"),e("zoomIn")]})}),f2e=({renderAction:e,className:t})=>P("div",{className:`undo-redo-buttons ${t}`,children:[g("div",{className:"undo-button-container",children:g(el,{label:L("buttons.undo"),children:e("undo")})}),g("div",{className:"redo-button-container",children:P(el,{label:L("buttons.redo"),children:[" ",e("redo")]})})]}),h2e=({actionManager:e,showExitZenModeBtn:t})=>g("button",{type:"button",className:me("disable-zen-mode",{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(VE),children:L("buttons.exitZenMode")}),g2e=({renderAction:e,className:t})=>g("div",{className:`finalize-button ${t}`,children:e("finalize",{size:"small"})}),kM=e=>{const t=M.useRef({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...n)=>t.current.userFn(...n)),t.current.stableFn},Rh=({label:e,onClick:t,className:n,children:i,actionType:r,type:s="button",isLoading:o,...a})=>{const l=r?`Dialog__action-button--${r}`:"";return P("button",{className:me("Dialog__action-button",l,n),type:s,"aria-label":e,onClick:t,...a,children:[i&&g("div",{style:o?{visibility:"hidden"}:{},children:i}),g("div",{style:o?{visibility:"hidden"}:{},children:e}),o&&g("div",{style:{position:"absolute",inset:0},children:g(qa,{})})]})},C$=qt(new Map),LM=async e=>await tH({elements:e,appState:{exportBackground:!1,viewBackgroundColor:$e.white},files:null,renderEmbeddables:!1,skipInliningFonts:!0}),m2e=(e,t,n)=>{const[i,r]=M.useState();return M.useEffect(()=>{if(t)if(e){const s=n.get(e);s?r(s):(async()=>{var a;const o=await LM(t);(a=o.querySelector(".style-fonts"))==null||a.remove(),o&&(n.set(e,o),r(o))})()}else(async()=>{const s=await LM(t);r(s)})()},[e,t,n,r]),i},A$=()=>{const[e]=gn(C$);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:i=>{i.forEach(r=>e.delete(r))},svgCache:e}};class p2e{constructor(){F(this,"jobs",[]);F(this,"running",!1)}tick(){if(this.running)return;const t=this.jobs.shift();t?(this.running=!0,t.promise.resolve(Uc(t.jobFactory,...t.args).finally(()=>{this.running=!1,this.tick()}))):this.running=!1}push(t,...n){const i=$6();return this.jobs.push({jobFactory:t,promise:i,args:n}),this.tick(),i}}const U2e=["excalidraw.com","raw.githubusercontent.com/excalidraw/excalidraw-libraries"],M$=new yo,om=qt({status:"loaded",isInitialized:!1,libraryItems:[]}),W1=e=>ka(e),b2e=(e,t)=>!e.find(n=>n.elements.length!==t.elements.length?!1:n.elements.every((i,r)=>i.id===t.elements[r].id&&i.versionNonce===t.elements[r].versionNonce)),y2e=(e,t)=>{const n=[];for(const i of t)b2e(e,i)&&n.push(i);return[...n,...e]},R$=(e,t)=>{const n=Se(t),i={deletedItems:new Map,addedItems:new Map};for(const s of e)n.has(s.id)||i.deletedItems.set(s.id,s);const r=Se(e);for(const s of t)r.has(s.id)||i.addedItems.set(s.id,s);return i};class E2e{constructor(t){F(this,"currLibraryItems",[]);F(this,"prevLibraryItems",W1(this.currLibraryItems));F(this,"app");F(this,"updateQueue",[]);F(this,"getLastUpdateTask",()=>this.updateQueue[this.updateQueue.length-1]);F(this,"notifyListeners",()=>{var t,n;if(this.updateQueue.length>0)Ns.set(om,i=>({status:"loading",libraryItems:this.currLibraryItems,isInitialized:i.isInitialized}));else{Ns.set(om,{status:"loaded",libraryItems:this.currLibraryItems,isInitialized:!0});try{const i=this.prevLibraryItems;this.prevLibraryItems=W1(this.currLibraryItems);const r=W1(this.currLibraryItems);(n=(t=this.app.props).onLibraryChange)==null||n.call(t,r),M$.trigger(R$(i,r),r)}catch(i){console.error(i)}}});F(this,"destroy",()=>{this.updateQueue=[],this.currLibraryItems=[],Ns.set(C$,new Map)});F(this,"resetLibrary",()=>this.setLibrary([]));F(this,"getLatestLibrary",()=>new Promise(async t=>{try{const n=await(this.getLastUpdateTask()||this.currLibraryItems);this.updateQueue.length>0?t(this.getLatestLibrary()):t(W1(n))}catch{return t(this.currLibraryItems)}}));F(this,"updateLibrary",async({libraryItems:t,prompt:n=!1,merge:i=!1,openLibraryMenu:r=!1,defaultStatus:s="unpublished"})=>(r&&this.app.setState({openSidebar:{name:ls.name,tab:Q2}}),this.setLibrary(()=>new Promise(async(o,a)=>{try{const l=await(typeof t=="function"&&!(t instanceof Blob)?t(this.currLibraryItems):t);let c;l instanceof Blob?c=await Afe(l,s):c=o5(l,s),!n||window.confirm(L("alerts.confirmAddLibrary",{numShapes:c.length}))?(n&&this.app.focusContainer(),o(i?y2e(this.currLibraryItems,c):c)):a(new Uh)}catch(l){a(l)}}))));F(this,"setLibrary",t=>{const n=new Promise(async(i,r)=>{try{await this.getLastUpdateTask(),typeof t=="function"&&(t=t(this.currLibraryItems)),this.currLibraryItems=W1(await t),i(this.currLibraryItems)}catch(s){r(s)}}).catch(i=>{if(i.name==="AbortError")return console.warn("Library update aborted by user"),this.currLibraryItems;throw i}).finally(()=>{this.updateQueue=this.updateQueue.filter(i=>i!==n),this.notifyListeners()});return this.updateQueue.push(n),this.notifyListeners(),n});this.app=t}}const k$=e=>{const n=Math.ceil(Math.sqrt(e.length)),i=[],r=h=>e.slice(h*n,h*n+n).reduce((p,b)=>{const{height:E}=js(b.elements);return Math.max(p,E)},0),s=h=>{let m=0,p=0,b=0;for(const E of e){if(m%n===0&&(p=0),p===h){const{width:y}=js(E.elements);b=Math.max(b,y)}m++,p++}return b};let o=0,a=0,l=0,c=0,u=0,d=0,f=0;for(const h of e){u&&u%n===0&&(a+=l+50,o=0,d=0,f++),d===0&&(l=r(f)),c=s(d);const{minX:m,minY:p,width:b,height:E}=js(h.elements),y=(c-b)/2,v=(l-E)/2;i.push(...h.elements.map(_=>({..._,x:_.x+o+y-m,y:_.y+a+v-p}))),o+=c+50,u++,d++}return i},v2e=(e,t=U2e)=>{if(typeof t=="function"?t(e):t.some(n=>{const i=new URL(`https://${n.replace(/^https?:\/\//,"")}`),{hostname:r,pathname:s}=new URL(e);return new RegExp(`(^|\\.)${i.hostname}$`).test(r)&&new RegExp(`^${i.pathname.replace(/\/+$/,"")}(/+|$)`).test(s)}))return!0;throw new Error(`Invalid or disallowed library URL: "${e}"`)},jE=()=>{const e=new URLSearchParams(window.location.hash.slice(1)).get(F3.addLibrary)||new URLSearchParams(window.location.search).get(P3.addLibrary),t=e?new URLSearchParams(window.location.hash.slice(1)).get("token"):null;return e?{libraryUrl:e,idToken:t}:null},Cl=class Cl{constructor(t){F(this,"adapter");this.adapter=t}static async getLibraryItems(t,n,i=!0){const r=()=>new Promise(async(s,o)=>{try{const a=await t.load({source:n});s(o5((a==null?void 0:a.libraryItems)||[],"published"))}catch(a){o(a)}});return i?Cl.queue.push(r):r()}getLibraryItems(t){return Cl.getLibraryItems(this.adapter,t,!1)}};F(Cl,"queue",new p2e),F(Cl,"run",async(t,n)=>{const i=new Cl(t);return Cl.queue.push(()=>n(i))});let Jf=Cl,s0=0,Vb=0;const YE=e=>kH(e.map(t=>`${t.id}:${Q1e(t.elements)}`).sort().join()),DM=async(e,t)=>{try{return Vb++,await Jf.run(e,async n=>{const i=Se(await n.getLibraryItems("save"));for(const[a]of t.deletedItems)i.delete(a);const r=[];for(const[a,l]of t.addedItems)i.has(a)?i.set(a,l):r.push(l);const s=r.concat(Array.from(i.values())),o=YE(s);return o!==s0&&await e.save({libraryItems:s}),s0=o,s})}finally{Vb--}},_2e=e=>{const{excalidrawAPI:t}=e,n=M.useRef(e);n.current=e;const i=M.useRef(!1);M.useEffect(()=>{if(!t)return;i.current=!1;const r=async({libraryUrl:a,idToken:l})=>{const c=new Promise(async(d,f)=>{try{a=decodeURIComponent(a),a=h9(a),v2e(a,n.current.validateLibraryUrl);const m=await(await fetch(a)).blob();d(m)}catch(h){f(h)}}),u=l!==t.id;await(u&&document.hidden?new Promise(d=>{window.addEventListener("focus",()=>d(),{once:!0})}):null);try{await t.updateLibrary({libraryItems:c,prompt:u,merge:!0,defaultStatus:"published",openLibraryMenu:!0})}catch(d){throw t.updateScene({appState:{errorMessage:d.message}}),d}finally{if(window.location.hash.includes(F3.addLibrary)){const d=new URLSearchParams(window.location.hash.slice(1));d.delete(F3.addLibrary),window.history.replaceState({},Ra,`#${d.toString()}`)}else if(window.location.search.includes(P3.addLibrary)){const d=new URLSearchParams(window.location.search);d.delete(P3.addLibrary),window.history.replaceState({},Ra,`?${d.toString()}`)}}},s=a=>{a.preventDefault();const l=jE();l&&(a.stopImmediatePropagation(),window.history.replaceState({},"",a.oldURL),r(l))},o=jE();if(o&&r(o),"getInitialLibraryItems"in n.current&&n.current.getInitialLibraryItems&&(console.warn("useHandleLibrar `opts.getInitialLibraryItems` is deprecated. Use `opts.adapter` instead."),Promise.resolve(n.current.getInitialLibraryItems()).then(a=>{t.updateLibrary({libraryItems:a,merge:!0})}).catch(a=>{console.error(`UseHandeLibrary getInitialLibraryItems failed: ${a==null?void 0:a.message}`)})),"adapter"in n.current&&n.current.adapter){const a=n.current.adapter,l=n.current.migrationAdapter,c=$6();l?c.resolve(Uc(l.load).then(async u=>{let d=null;try{if(!u)return Jf.getLibraryItems(a,"load");d=o5(u.libraryItems||[],"published");const f=await DM(a,R$([],d));try{await l.clear()}catch(h){console.error(`couldn't delete legacy library data: ${h.message}`)}return f}catch(f){return console.error(`couldn't migrate legacy library data: ${f.message}`),d}}).catch(u=>(console.error(`error during library migration: ${u.message}`),Jf.getLibraryItems(a,"load")))):c.resolve(Uc(Jf.getLibraryItems,a,"load")),t.updateLibrary({libraryItems:c.then(u=>{const d=u||[];return s0=YE(d),d}),merge:!0}).finally(()=>{i.current=!0})}return window.addEventListener(te.HASHCHANGE,s),()=>{window.removeEventListener(te.HASHCHANGE,s)}},[t]),M.useEffect(()=>{const r=M$.on(async(o,a)=>{const l=i.current,c="adapter"in n.current&&n.current.adapter||null;try{c&&s0!==YE(a)&&await DM(c,o)}catch(u){console.error(`couldn't persist library update: ${u.message}`,o),l&&n.current.excalidrawAPI&&n.current.excalidrawAPI.updateScene({appState:{errorMessage:L("errors.saveLibraryError")}})}}),s=o=>{Vb&&o9(o)};return window.addEventListener(te.BEFORE_UNLOAD,s),()=>{window.removeEventListener(te.BEFORE_UNLOAD,s),r(),s0=0,Vb=0}},[])},w2e=({theme:e,id:t,libraryReturnUrl:n})=>{const i=n||window.location.origin+window.location.pathname;return g("a",{className:"library-menu-browse-button",href:`https://libraries.excalidraw.com?target=${window.name||"_blank"}&referrer=${i}&useHash=true&token=${t}&theme=${e}&version=${F6.excalidrawLibrary}`,target:"_excalidraw_libraries",children:L("labels.libraries")})},L$=({libraryReturnUrl:e,theme:t,id:n,style:i,children:r,className:s})=>P("div",{className:me("library-menu-control-buttons",s),style:i,children:[g(w2e,{id:n,libraryReturnUrl:e,theme:t}),r]}),T2e=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,S2e=/{{([\w-]+)}}/,I2e=/<([\w-]+)>/,x2e=/<\/([\w-]+)>/,C2e=(e,t)=>{const n=[{name:"",children:[]}];return e.split(T2e).filter(Boolean).forEach(i=>{const r=i.match(I2e),s=i.match(x2e),o=i.match(S2e);if(r!==null){const a=r[1];t.hasOwnProperty(a)?n.push({name:a,children:[]}):console.warn(`Trans: missed to pass in prop ${a} for interpolating ${e}`)}else if(s!==null)if(s[1]===n[n.length-1].name){const l=n.pop(),c=se.createElement(se.Fragment,{},...l.children),u=t[l.name];typeof u=="function"&&n[n.length-1].children.push(u(c))}else console.warn(`Trans: unexpected end tag ${i} for interpolating ${e}`);else if(o!==null){const a=o[1];t.hasOwnProperty(a)?n[n.length-1].children.push(t[a]):console.warn(`Trans: key ${a} not in props for interpolating ${e}`)}else n[n.length-1].children.push(i)}),n.length!==1&&console.warn(`Trans: stack not empty for interpolating ${e}`),n[0].children},gr=({i18nKey:e,children:t,...n})=>{const{t:i}=mn();return se.createElement(se.Fragment,{},...C2e(i(e),n))};class Bu{static has(t){try{return!!window.localStorage.getItem(t)}catch(n){return console.warn(`localStorage.getItem error: ${n.message}`),!1}}static get(t){try{const n=window.localStorage.getItem(t);return n?JSON.parse(n):null}catch(n){return console.warn(`localStorage.getItem error: ${n.message}`),null}}}F(Bu,"set",(t,n)=>{try{return window.localStorage.setItem(t,JSON.stringify(n)),!0}catch(i){return console.warn(`localStorage.setItem error: ${i.message}`),!1}}),F(Bu,"delete",t=>{try{window.localStorage.removeItem(t)}catch(n){console.warn(`localStorage.removeItem error: ${n.message}`)}});const A2e=async e=>{const i=Math.round(8),r=Math.max(Math.round(128/64),2),s=Eee(e,6),o=document.createElement("canvas");o.width=s[0].length*128+(s[0].length+1)*(i*2)-i*2,o.height=s.length*128+(s.length+1)*(i*2)-i*2;const a=o.getContext("2d");a.fillStyle=li.white,a.fillRect(0,0,o.width,o.height);for(const[l,c]of e.entries()){const u=await d5({elements:c.elements,files:null,maxWidthOrHeight:128}),{width:d,height:f}=u,h=Math.floor(l/6)*(128+i*2),m=l%6*(128+i*2);a.drawImage(u,m+(128-d)/2+i,h+(128-f)/2+i),a.lineWidth=r,a.strokeStyle=li.gray[4],a.strokeRect(m+i/2,h+i/2,128+i,128+i)}return await EE(new File([await Q0(o)],"preview",{type:ye.png}),{outputType:ye.jpg,maxWidthOrHeight:5e3})},M2e=({libItem:e,appState:t,index:n,onChange:i,onRemove:r})=>{const s=M.useRef(null),o=M.useRef(null);return M.useEffect(()=>{const a=s.current;a&&(async()=>{const l=await tH({elements:e.elements,appState:{...t,viewBackgroundColor:li.white,exportBackground:!0},files:null,skipInliningFonts:!0});a.innerHTML=l.outerHTML})()},[e.elements,t]),P("div",{className:"single-library-item",children:[e.status==="published"&&g("span",{className:"single-library-item-status",children:L("labels.statusPublished")}),g("div",{ref:s,className:"single-library-item__svg"}),g(Ke,{"aria-label":L("buttons.remove"),type:"button",icon:xd,className:"single-library-item--remove",onClick:r.bind(null,e.id),title:L("buttons.remove")}),P("div",{style:{display:"flex",margin:"0.8rem 0",width:"100%",fontSize:"14px",fontWeight:500,flexDirection:"column"},children:[P("label",{style:{display:"flex",justifyContent:"space-between",flexDirection:"column"},children:[P("div",{style:{padding:"0.5em 0"},children:[g("span",{style:{fontWeight:500,color:li.gray[6]},children:L("publishDialog.itemName")}),g("span",{"aria-hidden":"true",className:"required",children:"*"})]}),g("input",{type:"text",ref:o,style:{width:"80%",padding:"0.2rem"},defaultValue:e.name,placeholder:"Item name",onChange:a=>{i(a.target.value,n)}})]}),g("span",{className:"error",children:e.error})]})]})},R2e=({onClose:e,libraryItems:t,appState:n,onSuccess:i,onError:r,updateItemsInStorage:s,onRemove:o})=>{const[a,l]=M.useState({authorName:"",githubHandle:"",name:"",description:"",twitterHandle:"",website:""}),[c,u]=M.useState(!1);M.useEffect(()=>{const v=Bu.get(Hg.PUBLISH_LIBRARY);v&&l(v)},[]);const[d,f]=M.useState(t.slice());M.useEffect(()=>{f(t.slice())},[t]);const h=v=>{l({...a,[v.target.name]:v.target.value})},m=async v=>{v.preventDefault(),u(!0);const _=[];let I=!1;if(d.forEach(k=>{let N="";k.name||(N=L("publishDialog.errors.required"),I=!0),_.push({...k,error:N})}),I){f(_),u(!1);return}const R=await A2e(d),w={type:as.excalidrawLibrary,version:F6.excalidrawLibrary,source:jv,libraryItems:d},T=JSON.stringify(w,null,2),A=new Blob([T],{type:"application/json"}),S=new FormData;S.append("excalidrawLib",A),S.append("previewImage",R),S.append("previewImageType",R.type),S.append("title",a.name),S.append("authorName",a.authorName),S.append("githubHandle",a.githubHandle),S.append("name",a.name),S.append("description",a.description),S.append("twitterHandle",a.twitterHandle),S.append("website",a.website),fetch("https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries/submit",{method:"post",body:S}).then(k=>k.ok?k.json().then(({url:N})=>{Bu.delete(Hg.PUBLISH_LIBRARY),i({url:N,authorName:a.authorName,items:d})}):k.json().catch(()=>{throw new Error(k.statusText||"something went wrong")}).then(N=>{throw new Error(N.message||k.statusText||"something went wrong")}),k=>{console.error(k),r(k),u(!1)}).catch(k=>{console.error(k),r(k),u(!1)})},p=()=>{const v=[];return d.forEach((_,I)=>{v.push(g("div",{className:"single-library-item-wrapper",children:g(M2e,{libItem:_,appState:n,index:I,onChange:(R,w)=>{const T=d.slice();T[w].name=R,f(T)},onRemove:o})},I))}),g("div",{className:"selected-library-items",children:v})},b=M.useCallback(()=>{s(d),Bu.set(Hg.PUBLISH_LIBRARY,a),e()},[d,e,s,a]),E=!!t.length,y=t.some(v=>v.status==="published");return g(Hr,{onCloseRequest:b,title:L("publishDialog.title"),className:"publish-library",children:E?P("form",{onSubmit:m,children:[g("div",{className:"publish-library-note",children:g(gr,{i18nKey:"publishDialog.noteDescription",link:v=>g("a",{href:"https://libraries.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:v})})}),g("span",{className:"publish-library-note",children:g(gr,{i18nKey:"publishDialog.noteGuidelines",link:v=>g("a",{href:"https://github.com/excalidraw/excalidraw-libraries#guidelines",target:"_blank",rel:"noopener noreferrer",children:v})})}),g("div",{className:"publish-library-note",children:L("publishDialog.noteItems")}),y&&g("span",{className:"publish-library-note publish-library-warning",children:L("publishDialog.republishWarning")}),p(),P("div",{className:"publish-library__fields",children:[P("label",{children:[P("div",{children:[g("span",{children:L("publishDialog.libraryName")}),g("span",{"aria-hidden":"true",className:"required",children:"*"})]}),g("input",{type:"text",name:"name",required:!0,value:a.name,onChange:h,placeholder:L("publishDialog.placeholder.libraryName")})]}),P("label",{style:{alignItems:"flex-start"},children:[P("div",{children:[g("span",{children:L("publishDialog.libraryDesc")}),g("span",{"aria-hidden":"true",className:"required",children:"*"})]}),g("textarea",{name:"description",rows:4,required:!0,value:a.description,onChange:h,placeholder:L("publishDialog.placeholder.libraryDesc")})]}),P("label",{children:[P("div",{children:[g("span",{children:L("publishDialog.authorName")}),g("span",{"aria-hidden":"true",className:"required",children:"*"})]}),g("input",{type:"text",name:"authorName",required:!0,value:a.authorName,onChange:h,placeholder:L("publishDialog.placeholder.authorName")})]}),P("label",{children:[g("span",{children:L("publishDialog.githubUsername")}),g("input",{type:"text",name:"githubHandle",value:a.githubHandle,onChange:h,placeholder:L("publishDialog.placeholder.githubHandle")})]}),P("label",{children:[g("span",{children:L("publishDialog.twitterUsername")}),g("input",{type:"text",name:"twitterHandle",value:a.twitterHandle,onChange:h,placeholder:L("publishDialog.placeholder.twitterHandle")})]}),P("label",{children:[g("span",{children:L("publishDialog.website")}),g("input",{type:"text",name:"website",pattern:"https?://.+",title:L("publishDialog.errors.website"),value:a.website,onChange:h,placeholder:L("publishDialog.placeholder.website")})]}),g("span",{className:"publish-library-note",children:g(gr,{i18nKey:"publishDialog.noteLicense",link:v=>g("a",{href:"https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",children:v})})})]}),P("div",{className:"publish-library__buttons",children:[g(Rh,{label:L("buttons.cancel"),onClick:b,"data-testid":"cancel-clear-canvas-button"}),g(Rh,{type:"submit",label:L("buttons.submit"),actionType:"primary",isLoading:c})]})]}):g("p",{style:{padding:"1em",textAlign:"center",fontWeight:500},children:L("publishDialog.atleastOneLibItem")})})},k2e=(e,t)=>e.filter(n=>t.includes(n.id)),L2e=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:i,resetLibrary:r,onSelectItems:s,appState:o,className:a})=>{const[l]=gn(om),[c,u]=gn(F_),d=()=>{const S=t.length?L("alerts.removeItemsFromsLibrary",{count:t.length}):L("alerts.resetLibrary"),k=t.length?L("confirmDialog.removeItemsFromLib"):L("confirmDialog.resetLibrary");return g(D$,{onConfirm:()=>{t.length?i():r(),h(!1)},onCancel:()=>{h(!1)},title:k,children:g("p",{children:S})})},[f,h]=M.useState(!1),m=!!t.length,p=m?l.libraryItems.filter(S=>t.includes(S.id)):l.libraryItems,b=L(m?"buttons.remove":"buttons.resetLibrary"),[E,y]=M.useState(!1),[v,_]=M.useState(null),I=M.useCallback(()=>P(Hr,{onCloseRequest:()=>_(null),title:L("publishSuccessDialog.title"),className:"publish-library-success",size:"small",children:[g("p",{children:g(gr,{i18nKey:"publishSuccessDialog.content",authorName:v.authorName,link:S=>g("a",{href:v==null?void 0:v.url,target:"_blank",rel:"noopener noreferrer",children:S})})}),g(Ke,{type:"button",title:L("buttons.close"),"aria-label":L("buttons.close"),label:L("buttons.close"),onClick:()=>_(null),"data-testid":"publish-library-success-close",className:"publish-library-success-close"})]}),[_,v]),R=(S,k)=>{y(!1),_({url:S.url,authorName:S.authorName});const N=k.slice();N.forEach(D=>{t.includes(D.id)&&(D.status="published")}),n.setLibrary(N)},w=async()=>{try{await n.updateLibrary({libraryItems:R9({description:"Excalidraw library files"}),merge:!0,openLibraryMenu:!0})}catch(S){if((S==null?void 0:S.name)==="AbortError"){console.warn(S);return}e({errorMessage:L("errors.importLibraryError")})}},T=async()=>{const S=m?p:await n.getLatestLibrary();zfe(S).catch(rF).catch(k=>{e({errorMessage:k.message})})},A=()=>P(ot,{open:c,children:[g(ot.Trigger,{onToggle:()=>u(!c),children:kte}),P(ot.Content,{onClickOutside:()=>u(!1),onSelect:()=>u(!1),className:"library-menu",children:[!m&&g(ot.Item,{onSelect:w,icon:b9,"data-testid":"lib-dropdown--load",children:L("buttons.load")}),!!p.length&&g(ot.Item,{onSelect:T,icon:W6,"data-testid":"lib-dropdown--export",children:L("buttons.export")}),!!p.length&&g(ot.Item,{onSelect:()=>h(!0),icon:bc,children:b}),m&&g(ot.Item,{icon:Gne,onSelect:()=>y(!0),"data-testid":"lib-dropdown--remove",children:L("buttons.publishLibrary")})]})]});return P("div",{className:me("library-menu-dropdown-container",a),children:[A(),t.length>0&&g("div",{className:"library-actions-counter",children:t.length}),f&&d(),E&&g(R2e,{onClose:()=>y(!1),libraryItems:k2e(l.libraryItems,t),appState:o,onSuccess:S=>R(S,l.libraryItems),onError:S=>window.alert(S),updateItemsInStorage:()=>n.setLibrary(l.libraryItems),onRemove:S=>s(t.filter(k=>k!==S))}),v&&I()]})},NM=({selectedItems:e,onSelectItems:t,className:n})=>{const{library:i}=oo(),{clearLibraryCache:r,deleteItemsFromLibraryCache:s}=A$(),o=fi(),a=zn(),[l]=gn(om),c=async d=>{const f=d.filter(h=>!e.includes(h.id));i.setLibrary(f).catch(()=>{a({errorMessage:L("alerts.errorRemovingFromLibrary")})}),s(e),t([])};return g(L2e,{appState:o,setAppState:a,selectedItems:e,onSelectItems:t,library:i,onRemoveFromLibrary:()=>c(l.libraryItems),resetLibrary:()=>{i.resetLibrary(),r()},className:n})},D2e=M.memo(({id:e,elements:t,isPending:n,onClick:i,selected:r,onToggle:s,onDrag:o,svgCache:a})=>{const l=M.useRef(null),c=m2e(e,t,a);M.useEffect(()=>{const m=l.current;if(m)return c&&(m.innerHTML=c.outerHTML),()=>{m.innerHTML=""}},[c]);const[u,d]=M.useState(!1),f=Qn().editor.isMobile,h=n&&g("div",{className:"library-unit__adder",children:Rte});return P("div",{className:me("library-unit",{"library-unit__active":t,"library-unit--hover":t&&u,"library-unit--selected":r,"library-unit--skeleton":!c}),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[g("div",{className:me("library-unit__dragger",{"library-unit__pulse":!!n}),ref:l,draggable:!!t,onClick:t||n?m=>{e&&m.shiftKey?s(e,m):i(e)}:void 0,onDragStart:m=>{if(!e){m.preventDefault();return}d(!1),o(e,m)}}),h,e&&t&&(u||f||r)&&g(N_,{checked:r,onChange:(m,p)=>s(e,p),className:"library-unit__checkbox"})]})}),N2e=()=>g("div",{className:"library-unit library-unit--skeleton"});function O2e(){return[!1,M.useCallback(t=>t(),[])]}const P2e=se.useTransition||O2e,OM=({children:e})=>g("div",{className:"library-menu-items-container__grid",children:e}),l7=M.memo(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:i,onClick:r,svgCache:s,itemsRenderedPerBatch:o})=>{const[,a]=P2e(),[l,c]=M.useState(0);return M.useEffect(()=>{l<e.length&&a(()=>{c(l+o)})},[l,e.length,a,o]),g(he,{children:e.map((u,d)=>d<l?g(D2e,{elements:u==null?void 0:u.elements,isPending:!(u!=null&&u.id)&&!!(u!=null&&u.elements),onClick:r,svgCache:s,id:u==null?void 0:u.id,selected:i(u.id),onToggle:t,onDrag:n},(u==null?void 0:u.id)??d):g(N2e,{},d))})}),F2e=qt(0),B2e=e=>{const[t,n]=gn(F2e);return M.useEffect(()=>{const{current:i}=e;if(!i)return;const r=Ao(()=>{const{scrollTop:s}=i;n(s)},200);return i.addEventListener("scroll",r),()=>{r.cancel(),i.removeEventListener("scroll",r)}},[e,n]),t},z2e=17,H2e=64;function V2e({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:i,pendingElements:r,theme:s,id:o,libraryReturnUrl:a,onSelectItems:l,selectedItems:c}){const u=M.useRef(null),d=B2e(u);M.useEffect(()=>{var S;d>0&&((S=u.current)==null||S.scrollTo(0,d))},[]);const{svgCache:f}=A$(),h=M.useMemo(()=>t.filter(S=>S.status!=="published"),[t]),m=M.useMemo(()=>t.filter(S=>S.status==="published"),[t]),p=!t.length&&!r.length,b=!r.length&&!h.length&&!m.length,[E,y]=M.useState(null),v=M.useCallback((S,k)=>{const N=!c.includes(S),D=[...h,...m];if(N){if(k.shiftKey&&E){const G=D.findIndex(j=>j.id===E),V=D.findIndex(j=>j.id===S);if(G===-1||V===-1){l([...c,S]);return}const H=Se(c),$=D.reduce((j,X,Y)=>((Y>=G&&Y<=V||H.has(X.id))&&j.push(X.id),j),[]);l($)}else l([...c,S]);y(S)}else y(null),l(c.filter(G=>G!==S))},[E,l,m,c,h]),_=M.useCallback(S=>{let k;return c.includes(S)?k=t.filter(N=>c.includes(N.id)):k=t.filter(N=>N.id===S),k.map(N=>({...N,elements:sB(N.elements,{randomizeSeed:!0})}))},[t,c]),I=M.useCallback((S,k)=>{k.dataTransfer.setData(ye.excalidrawlib,Rz(_(S)))},[_]),R=M.useCallback(S=>S?c.includes(S):!1,[c]),w=M.useCallback(()=>{n(r)},[r,n]),T=M.useCallback(S=>{S&&i(_(S))},[_,i]),A=f.size>=t.length?H2e:z2e;return P("div",{className:"library-menu-items-container",style:r.length||h.length||m.length?{justifyContent:"flex-start"}:{borderBottom:0},children:[!b&&g(NM,{selectedItems:c,onSelectItems:l,className:"library-menu-dropdown-container--in-heading"}),P(ss.Col,{className:"library-menu-items-container__items",align:"start",gap:1,style:{flex:m.length>0?1:"0 1 auto",marginBottom:0},ref:u,children:[P(he,{children:[!b&&g("div",{className:"library-menu-items-container__header",children:L("labels.personalLib")}),e&&g("div",{style:{position:"absolute",top:"var(--container-padding-y)",right:"var(--container-padding-x)",transform:"translateY(50%)"},children:g(qa,{})}),!r.length&&!h.length?P("div",{className:"library-menu-items__no-items",children:[g("div",{className:"library-menu-items__no-items__label",children:L("library.noItems")}),g("div",{className:"library-menu-items__no-items__hint",children:m.length>0?L("library.hint_emptyPrivateLibrary"):L("library.hint_emptyLibrary")})]}):P(OM,{children:[r.length>0&&g(l7,{itemsRenderedPerBatch:A,items:[{id:null,elements:r}],onItemSelectToggle:v,onItemDrag:I,onClick:w,isItemSelected:R,svgCache:f}),g(l7,{itemsRenderedPerBatch:A,items:h,onItemSelectToggle:v,onItemDrag:I,onClick:T,isItemSelected:R,svgCache:f})]})]}),P(he,{children:[(m.length>0||r.length>0||h.length>0)&&g("div",{className:"library-menu-items-container__header library-menu-items-container__header--excal",children:L("labels.excalidrawLib")}),m.length>0?g(OM,{children:g(l7,{itemsRenderedPerBatch:A,items:m,onItemSelectToggle:v,onItemDrag:I,onClick:T,isItemSelected:R,svgCache:f})}):h.length>0?g("div",{style:{margin:"1rem 0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",fontSize:".9rem"},children:L("library.noItems")}):null]}),p&&g(L$,{style:{padding:"16px 0",width:"100%"},id:o,libraryReturnUrl:a,theme:s,children:g(NM,{selectedItems:c,onSelectItems:l})})]})]})}const F_=qt(!1),PM=({children:e})=>g("div",{className:"layer-ui__library",children:e}),$2e=M.memo(({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:i,libraryReturnUrl:r,library:s,id:o,theme:a,selectedItems:l,onSelectItems:c})=>{const[u]=gn(om),d=M.useCallback(m=>{(async(b,E)=>{ut("element","addToLibrary","ui");for(const v of HO)if(b.some(_=>_.type===v))return i({errorMessage:L(`errors.libraryElementTypeError.${v}`)});const y=[{status:"unpublished",elements:b,id:bs(),created:Date.now()},...E];n(),s.setLibrary(y).catch(()=>{i({errorMessage:L("alerts.errorAddingToLibrary")})})})(m,u.libraryItems)},[n,s,i,u.libraryItems]),f=M.useMemo(()=>u.libraryItems,[u]);if(u.status==="loading"&&!u.isInitialized)return g(PM,{children:g("div",{className:"layer-ui__library-message",children:P("div",{children:[g(qa,{size:"2em"}),g("span",{children:L("labels.libraryLoadingMessage")})]})})});const h=u.libraryItems.length>0||t.length>0;return P(PM,{children:[g(V2e,{isLoading:u.status==="loading",libraryItems:f,onAddToLibrary:d,onInsertLibraryItems:e,pendingElements:t,id:o,libraryReturnUrl:r,theme:a,onSelectItems:c,selectedItems:l}),h&&g(L$,{className:"library-menu-control-buttons--at-bottom",style:{padding:"16px 12px 0 12px"},id:o,libraryReturnUrl:r,theme:a})]})}),c7=(e,t)=>({elements:e,pending:Fe(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}),selectedElementIds:t}),G2e=(e,t)=>{const n=P5(),[i,r]=M.useState(()=>c7(n,e.selectedElementIds)),s=M.useRef(new Map);return M.useEffect(()=>{for(const o of i.pending)s.current.set(o.id,o.version)},[i.pending]),M.useEffect(()=>{t.state.cursorButton==="up"&&t.state.activeTool.type==="selection"&&r(o=>{var l;if(!vi(o.selectedElementIds,e.selectedElementIds))return s.current.clear(),c7(n,e.selectedElementIds);const a=t.scene.getNonDeletedElementsMap();for(const c of Object.keys(e.selectedElementIds)){const u=(l=a.get(c))==null?void 0:l.version;if(u&&u!==s.current.get(c))return c7(n,e.selectedElementIds)}return o})},[t,t.state.cursorButton,t.state.activeTool.type,e.selectedElementIds,n]),i.pending},X2e=M.memo(()=>{const e=oo(),{onInsertElements:t}=e,n=ep(),i=fi(),r=zn(),[s,o]=M.useState([]),a=M.useMemo(()=>e.library,[e.library]),l=G2e(i,e),c=M.useCallback(d=>{t(k$(d))},[t]),u=M.useCallback(()=>{r({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[r]);return g($2e,{pendingElements:l,onInsertLibraryItems:c,onAddToLibrary:u,setAppState:r,libraryReturnUrl:n.libraryReturnUrl,library:a,id:e.id,theme:i.theme,selectedItems:s,onSelectItems:o})}),D$=e=>{const{onConfirm:t,onCancel:n,children:i,confirmText:r=L("buttons.confirm"),cancelText:s=L("buttons.cancel"),className:o="",...a}=e,l=zn(),c=z6(F_),{container:u}=qo();return P(Hr,{onCloseRequest:n,size:"small",...a,className:`confirm-dialog ${o}`,children:[i,P("div",{className:"confirm-dialog-buttons",children:[g(Rh,{label:s,onClick:()=>{l({openMenu:null}),c(!1),Xn.flushSync(()=>{n()}),u==null||u.focus()}}),g(Rh,{label:r,onClick:()=>{l({openMenu:null}),c(!1),Xn.flushSync(()=>{t()}),u==null||u.focus()},actionType:"danger"})]})]})},N5=qt(null),j2e=()=>{const[e,t]=gn(N5),n=vr();return e&&e==="clearCanvas"?g(D$,{onConfirm:()=>{n.executeAction(n0),t(null)},onCancel:()=>t(null),title:L("clearCanvasDialog.title"),children:P("p",{className:"clear-canvas__content",children:[" ",L("alerts.clearReset")]})}):null},Y2e={...Hb,category:"App",label:"Toggle theme",perform:({actionManager:e})=>{e.executeAction(Hb,"commandPalette")}},W2e=Object.freeze(Object.defineProperty({__proto__:null,toggleTheme:Y2e},Symbol.toStringTag,{value:"Module"})),N$=oe({name:"copyElementLink",label:"labels.copyElementLink",icon:$m,trackEvent:{category:"element"},perform:async(e,t,n,i)=>{const r=Fe(e,t);try{if(window.location){const s=Bz(r,t);return s?(await Bc(i.props.generateLinkForSelection?i.props.generateLinkForSelection(s.id,s.type):Fz(s.id,s.type)),{appState:{toast:{message:L("toast.elementLinkCopied"),closable:!0}},captureUpdate:Z.EVENTUALLY}):{appState:t,elements:e,app:i,captureUpdate:Z.EVENTUALLY}}}catch(s){console.error(s)}return{appState:t,elements:e,app:i,captureUpdate:Z.EVENTUALLY}},predicate:(e,t)=>Mb(Fe(e,t))}),K2e=oe({name:"linkToElement",label:"labels.linkToElement",icon:JF,perform:(e,t,n,i)=>{const r=Fe(e,t);return r.length!==1||!Mb(r)?{elements:e,appState:t,app:i,captureUpdate:Z.EVENTUALLY}:{appState:{...t,openDialog:{name:"elementLinkSelector",sourceElementId:Fe(e,t)[0].id}},captureUpdate:Z.IMMEDIATELY}},predicate:(e,t,n,i)=>{var s;const r=Fe(e,t);return((s=t.openDialog)==null?void 0:s.name)!=="elementLinkSelector"&&r.length===1&&Mb(r)},trackEvent:!1}),Z2e=qt(null),mt={app:"App",export:"Export",tools:"Tools",editor:"Editor",elements:"Elements",links:"Links"},q2e=e=>{switch(e){case mt.app:return 1;case mt.export:return 2;case mt.editor:return 3;case mt.tools:return 4;case mt.elements:return 5;case mt.links:return 6;default:return 10}},h2=({shortcut:e,className:t,children:n})=>{const i=e.replace("++","+$").split("+");return P("div",{className:me("shortcut",t),children:[i.map((r,s)=>g("div",{className:"shortcut-wrapper",children:g("div",{className:"shortcut-key",children:r==="$"?"+":r})},r)),g("div",{className:"shortcut-desc",children:n})]})},O$=e=>!e.altKey&&e[z.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===z.P||e.key===z.SLASH),FM=Object.assign(e=>{var i;const t=fi(),n=zn();return M.useEffect(()=>{const r=s=>{O$(s)&&(s.preventDefault(),s.stopPropagation(),n(o=>{var l;const a=((l=o.openDialog)==null?void 0:l.name)==="commandPalette"?null:{name:"commandPalette"};return a&&ut("command_palette","open","shortcut"),{openDialog:a}}))};return window.addEventListener(te.KEYDOWN,r,{capture:!0}),()=>window.removeEventListener(te.KEYDOWN,r,{capture:!0})},[n]),((i=t.openDialog)==null?void 0:i.name)!=="commandPalette"?null:g(Q2e,{...e})},{defaultItems:W2e});function Q2e({customCommandPaletteItems:e}){const t=oo(),n=fi(),i=zn(),r=ep(),s=vr(),[o,a]=gn(Z2e),[l,c]=M.useState(null),u=M.useRef(null),d=x5({uiAppState:n,customCommandPaletteItems:e,appProps:r});M.useEffect(()=>{const{uiAppState:R,customCommandPaletteItems:w,appProps:T}=d,A=D=>{let G="";return D.label&&(typeof D.label=="function"?G=L(D.label(t.scene.getNonDeletedElements(),R,t)):G=L(D.label)),G},S=D=>typeof D.icon=="function"?D.icon(R,t.scene.getNonDeletedElements()):D.icon;let k=[];const N=(D,G,V)=>{const H={label:A(D),icon:S(D),category:G,shortcut:Bi(D.name),keywords:D.keywords,predicate:D.predicate,viewMode:D.viewMode,perform:()=>{s.executeAction(D,"commandPalette")}};return V?V(H,D):H};if(R&&t.scene&&s){const D=[s.actions.group,s.actions.ungroup,s.actions.cut,s.actions.copy,s.actions.deleteSelectedElements,s.actions.wrapSelectionInFrame,s.actions.copyStyles,s.actions.pasteStyles,s.actions.bringToFront,s.actions.bringForward,s.actions.sendBackward,s.actions.sendToBack,s.actions.alignTop,s.actions.alignBottom,s.actions.alignLeft,s.actions.alignRight,s.actions.alignVerticallyCentered,s.actions.alignHorizontallyCentered,s.actions.duplicateSelection,s.actions.flipHorizontal,s.actions.flipVertical,s.actions.zoomToFitSelection,s.actions.zoomToFitSelectionInViewport,s.actions.increaseFontSize,s.actions.decreaseFontSize,s.actions.toggleLinearEditor,s.actions.cropEditor,h$,N$,K2e].map(X=>N(X,mt.elements,(Y,le)=>({...Y,predicate:le.predicate?le.predicate:(pe,ae,ze,Xe)=>Fe(pe,ae).length>0}))),G=[s.actions.toggleHandTool,s.actions.setFrameAsActiveTool].map(X=>N(X,mt.tools)),V=[s.actions.undo,s.actions.redo,s.actions.zoomIn,s.actions.zoomOut,s.actions.resetZoom,s.actions.zoomToFit,s.actions.zenMode,s.actions.viewMode,s.actions.gridMode,s.actions.objectsSnapMode,s.actions.toggleShortcuts,s.actions.selectAll,s.actions.toggleElementLock,s.actions.unlockAllElements,s.actions.stats].map(X=>N(X,mt.editor)),H=[s.actions.saveToActiveFile,s.actions.saveFileToDisk,s.actions.copyAsPng,s.actions.copyAsSvg].map(X=>N(X,mt.export));k=[...D,...V,{label:A(n0),icon:S(n0),shortcut:Bi(n0.name),category:mt.editor,keywords:["delete","destroy"],viewMode:!1,perform:()=>{Ns.set(N5,"clearCanvas")}},{label:L("buttons.exportImage"),category:mt.export,icon:FF,shortcut:Bi("imageExport"),keywords:["export","image","png","jpeg","svg","clipboard","picture"],perform:()=>{i({openDialog:{name:"imageExport"}})}},...H];const $=[{label:L("toolBar.library"),category:mt.app,icon:g9,viewMode:!1,perform:()=>{R.openSidebar?i({openSidebar:null}):i({openSidebar:{name:ls.name,tab:ls.defaultTab}})}},{label:L("search.title"),category:mt.app,icon:Zu,viewMode:!0,perform:()=>{s.executeAction(P$)}},{label:L("labels.changeStroke"),keywords:["color","outline"],category:mt.elements,icon:b8,viewMode:!1,predicate:(X,Y)=>{const le=Fe(X,Y);return le.length>0&&T$(Y,le)},perform:()=>{i(X=>({openMenu:X.openMenu==="shape"?null:"shape",openPopup:"elementStroke"}))}},{label:L("labels.changeBackground"),keywords:["color","fill"],icon:b8,category:mt.elements,viewMode:!1,predicate:(X,Y)=>{const le=Fe(X,Y);return le.length>0&&S$(Y,le)},perform:()=>{i(X=>({openMenu:X.openMenu==="shape"?null:"shape",openPopup:"elementBackground"}))}},{label:L("labels.canvasBackground"),keywords:["color"],icon:b8,category:mt.editor,viewMode:!1,perform:()=>{i(X=>({openMenu:X.openMenu==="canvas"?null:"canvas",openPopup:"canvasBackground"}))}},...C9.reduce((X,Y)=>{var on;const{value:le,icon:pe,key:ae,numericKey:ze}=Y;if(((on=T.UIOptions.tools)==null?void 0:on[le])===!1)return X;const qe=ae&&Xg(typeof ae=="string"?ae:ae[0])||ze,Ze={label:L(`toolBar.${le}`),category:mt.tools,shortcut:qe,icon:pe,keywords:["toolbar"],viewMode:!1,perform:({event:_n})=>{le==="image"?t.setActiveTool({type:le,insertOnCanvasDirectly:_n.type===te.KEYDOWN}):t.setActiveTool({type:le})}};return X.push(Ze),X},[]),...G,{label:L("toolBar.lock"),category:mt.tools,icon:R.activeTool.locked?m9:Y6,shortcut:z.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${L("labels.textToDiagram")}...`,category:mt.tools,icon:nie,viewMode:!1,predicate:T.aiEnabled,perform:()=>{i(X=>({...X,openDialog:{name:"ttd",tab:"text-to-diagram"}}))}},{label:`${L("toolBar.mermaidToExcalidraw")}...`,category:mt.tools,icon:XF,viewMode:!1,predicate:T.aiEnabled,perform:()=>{i(X=>({...X,openDialog:{name:"ttd",tab:"mermaid"}}))}}],j=[...k,...$,...w||[]].map(X=>{var Y;return{...X,icon:X.icon||WF,order:X.order??q2e(X.category),haystack:`${SM(X.label.toLocaleLowerCase())} ${((Y=X.keywords)==null?void 0:Y.join(" "))||""}`}});c(j),a(j.find(X=>X.label===(o==null?void 0:o.label))??null)}},[d,t,s,c,o==null?void 0:o.label,a,i]);const[f,h]=M.useState(""),[m,p]=M.useState(null),[b,E]=M.useState({}),y=R=>{i({openDialog:null},R),h("")},v=(R,w)=>{var T;((T=n.openDialog)==null?void 0:T.name)==="commandPalette"&&(w.stopPropagation(),w.preventDefault(),document.body.classList.add("excalidraw-animations-disabled"),y(()=>{R.perform({actionManager:s,event:w}),a(R),requestAnimationFrame(()=>{document.body.classList.remove("excalidraw-animations-disabled")})}))},_=kM(R=>R.viewMode===!1&&n.viewModeEnabled?!1:typeof R.predicate=="function"?R.predicate(t.scene.getNonDeletedElements(),n,r,t):R.predicate===void 0||R.predicate),I=kM(R=>{var S;const w=ou(R.target)||O$(R)||R.key===z.ESCAPE;if(w&&R.key!==z.ARROW_UP&&R.key!==z.ARROW_DOWN&&R.key!==z.ENTER)return;const T=Object.values(b).flat(),A=o&&!f&&_(o);if(R.key===z.ARROW_UP){R.preventDefault();const k=T.findIndex(G=>G.label===(m==null?void 0:m.label));if(A){if(k===0){p(o);return}if(m===o){const G=T[T.length-1];G&&p(G);return}}let N;k===-1?N=T.length-1:N=k===0?T.length-1:(k-1)%T.length;const D=T[N];D&&p(D);return}if(R.key===z.ARROW_DOWN){R.preventDefault();const k=T.findIndex(G=>G.label===(m==null?void 0:m.label));if(A){if(!m||k===T.length-1){p(o);return}if(m===o){const G=T[0];G&&p(G);return}}const N=(k+1)%T.length,D=T[N];D&&p(D);return}if(R.key===z.ENTER&&m&&setTimeout(()=>{v(m,R)}),!w){if(R.stopPropagation(),/^[a-zA-Z0-9]$/.test(R.key)){(S=u==null?void 0:u.current)==null||S.focus();return}R.preventDefault()}});return M.useEffect(()=>(window.addEventListener(te.KEYDOWN,I,{capture:!0}),()=>window.removeEventListener(te.KEYDOWN,I,{capture:!0})),[I]),M.useEffect(()=>{if(!l)return;const R=S=>{const k={};for(const N of S)k[N.category]?k[N.category].push(N):k[N.category]=[N];return k};let w=l.filter(_).sort((S,k)=>S.order-k.order);const T=!f&&o&&_(o);if(!f){E(R(T?w.filter(S=>S.label!==(o==null?void 0:o.label)):w)),p(T?o:w[0]||null);return}const A=SM(f.toLocaleLowerCase().replace(/[<>_| -]/g,""));w=_Ue.filter(A,w,{extract:S=>S.haystack}).sort((S,k)=>k.score-S.score).map(S=>S.original),E(R(w)),p(w[0]??null)},[f,l,_,o]),P(Hr,{onCloseRequest:()=>y(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:"command-palette-dialog",children:[g(Ah,{value:f,placeholder:L("commandPalette.search.placeholder"),onChange:R=>{h(R)},selectOnRender:!0,ref:u}),!t.device.viewport.isMobile&&P("div",{className:"shortcuts-wrapper",children:[g(h2,{shortcut:"↑↓",children:L("commandPalette.shortcuts.select")}),g(h2,{shortcut:"↵",children:L("commandPalette.shortcuts.confirm")}),g(h2,{shortcut:Q("Esc"),children:L("commandPalette.shortcuts.close")})]}),P("div",{className:"commands",children:[o&&!f&&P("div",{className:"command-category",children:[P("div",{className:"command-category-title",children:[L("commandPalette.recents"),g("div",{className:"icon",style:{marginLeft:"6px"},children:iie})]}),g(BM,{command:o,isSelected:o.label===(m==null?void 0:m.label),onClick:R=>v(o,R),disabled:!_(o),onMouseMove:()=>p(o),showShortcut:!t.device.viewport.isMobile,appState:n})]}),Object.keys(b).length>0?Object.keys(b).map((R,w)=>P("div",{className:"command-category",children:[g("div",{className:"command-category-title",children:R}),b[R].map(T=>g(BM,{command:T,isSelected:T.label===(m==null?void 0:m.label),onClick:A=>v(T,A),onMouseMove:()=>p(T),showShortcut:!t.device.viewport.isMobile,appState:n},T.label))]},R)):l?P("div",{className:"no-match",children:[g("div",{className:"icon",children:Zu})," ",L("commandPalette.search.noMatch")]}):null]})]})}const BM=({command:e,isSelected:t,disabled:n,onMouseMove:i,onClick:r,showShortcut:s,appState:o})=>{const a=()=>{};return P("div",{className:me("command-item",{"item-selected":t,"item-disabled":n}),ref:l=>{var c;t&&!n&&((c=l==null?void 0:l.scrollIntoView)==null||c.call(l,{block:"nearest"}))},onClick:n?a:r,onMouseMove:n?a:i,title:n?L("commandPalette.itemNotAvailable"):"",children:[P("div",{className:"name",children:[e.icon&&g(A5,{icon:typeof e.icon=="function"?e.icon(o):e.icon}),e.label]}),s&&e.shortcut&&g(h2,{shortcut:e.shortcut})]})},J2e=oe({name:"toggleLinearEditor",category:mt.elements,label:(e,t,n)=>{const i=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds})[0];return(i==null?void 0:i.type)==="arrow"?"labels.lineEditor.editArrow":"labels.lineEditor.edit"},keywords:["line"],trackEvent:{category:"element"},predicate:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);return!!(!t.editingLinearElement&&r.length===1&&ke(r[0])&&!ge(r[0]))},perform(e,t,n,i){var o;const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0],s=((o=t.editingLinearElement)==null?void 0:o.elementId)===r.id?null:new ue(r);return{appState:{...t,editingLinearElement:s},captureUpdate:Z.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{const i=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds})[0],r=L(i.type==="arrow"?"labels.lineEditor.editArrow":"labels.lineEditor.edit");return g(Ke,{type:"button",icon:pie,title:r,"aria-label":r,onClick:()=>t(null)})}}),P$=oe({name:"searchMenu",icon:Zu,keywords:["search","find"],label:"search.title",viewMode:!0,trackEvent:{category:"search_menu",action:"toggle",predicate:e=>e.gridModeEnabled},perform(e,t,n,i){var r,s;if(((r=t.openSidebar)==null?void 0:r.name)===ls.name&&t.openSidebar.tab===ku){const o=(s=i.excalidrawContainerValue.container)==null?void 0:s.querySelector(`.${hh.SEARCH_MENU_INPUT_WRAPPER} input`);return o!=null&&o.matches(":focus")?{appState:{...t,openSidebar:null},captureUpdate:Z.EVENTUALLY}:(o==null||o.focus(),o==null||o.select(),!1)}return{appState:{...t,openSidebar:{name:ls.name,tab:ku},openDialog:null},captureUpdate:Z.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[z.CTRL_OR_CMD]&&e.key===z.F}),ebe=oe({name:"cropEditor",label:"helpDialog.cropStart",icon:Hx,viewMode:!0,trackEvent:{category:"menu"},keywords:["image","crop"],perform(e,t,n,i){const r=i.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return{appState:{...t,isCropping:!1,croppingElementId:r.id},captureUpdate:Z.IMMEDIATELY}},predicate:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t);return!!(!t.croppingElementId&&r.length===1&&st(r[0]))},PanelComponent:({appState:e,updateData:t,app:n})=>{const i=L("helpDialog.cropStart");return g(Ke,{type:"button",icon:Hx,title:i,"aria-label":i,onClick:()=>t(null)})}});class $b{constructor(t=!0,n=!0){this.isUndoStackEmpty=t,this.isRedoStackEmpty=n}}class _u{constructor(){F(this,"onHistoryChangedEmitter",new yo);F(this,"undoStack",[]);F(this,"redoStack",[])}get isUndoStackEmpty(){return this.undoStack.length===0}get isRedoStackEmpty(){return this.redoStack.length===0}clear(){this.undoStack.length=0,this.redoStack.length=0}record(t,n){const i=o0.create(n,t);i.isEmpty()||(this.undoStack.push(i.inverse()),i.elementsChange.isEmpty()||(this.redoStack.length=0),this.onHistoryChangedEmitter.trigger(new $b(this.isUndoStackEmpty,this.isRedoStackEmpty)))}undo(t,n,i){return this.perform(t,n,i,()=>_u.pop(this.undoStack),r=>_u.push(this.redoStack,r,t))}redo(t,n,i){return this.perform(t,n,i,()=>_u.pop(this.redoStack),r=>_u.push(this.undoStack,r,t))}perform(t,n,i,r,s){try{let o=r();if(o===null)return;let a=t,l=n,c=!1;for(;o;){try{[a,l,c]=o.applyTo(a,l,i)}finally{s(o)}if(c)break;o=r()}return[a,l]}finally{this.onHistoryChangedEmitter.trigger(new $b(this.isUndoStackEmpty,this.isRedoStackEmpty))}}static pop(t){if(!t.length)return null;const n=t.pop();return n!==void 0?n:null}static push(t,n,i){const r=n.inverse().applyLatestChanges(i);return t.push(r)}}class o0{constructor(t,n){this.appStateChange=t,this.elementsChange=n}static create(t,n){return new o0(t,n)}inverse(){return new o0(this.appStateChange.inverse(),this.elementsChange.inverse())}applyTo(t,n,i){const[r,s]=this.elementsChange.applyTo(t,i.elements),[o,a]=this.appStateChange.applyTo(n,r);return[r,o,s||a]}applyLatestChanges(t){const n=this.elementsChange.applyLatestChanges(t);return o0.create(this.appStateChange,n)}isEmpty(){return this.appStateChange.isEmpty()&&this.elementsChange.isEmpty()}}const F$=(e,t)=>{const[n,i]=M.useState(t);return M.useEffect(()=>{const r=e.on(s=>{i(s)});return()=>{r()}},[e]),n},B$=(e,t,n)=>{if(!t.multiElement&&!t.resizingElement&&!t.editingTextElement&&!t.newElement&&!t.selectedElementsAreBeingDragged&&!t.selectionElement&&!e.flowChartCreator.isCreatingChart){const i=n();if(!i)return{captureUpdate:Z.EVENTUALLY};const[r,s]=i,o=Array.from(r.values());return{appState:s,elements:o,captureUpdate:Z.NEVER}}return{captureUpdate:Z.EVENTUALLY}},tbe=(e,t)=>({name:"undo",label:"buttons.undo",icon:Ix,trackEvent:{category:"history"},viewMode:!1,perform:(n,i,r,s)=>B$(s,i,()=>e.undo(Se(n),i,t.snapshot)),keyTest:n=>n[z.CTRL_OR_CMD]&&cE(n,z.Z)&&!n.shiftKey,PanelComponent:({updateData:n,data:i})=>{const{isUndoStackEmpty:r}=F$(e.onHistoryChangedEmitter,new $b(e.isUndoStackEmpty,e.isRedoStackEmpty));return g(Ke,{type:"button",icon:Ix,"aria-label":L("buttons.undo"),onClick:n,size:(i==null?void 0:i.size)||"medium",disabled:r,"data-testid":"button-undo"})}}),nbe=(e,t)=>({name:"redo",label:"buttons.redo",icon:xx,trackEvent:{category:"history"},viewMode:!1,perform:(n,i,r,s)=>B$(s,i,()=>e.redo(Se(n),i,t.snapshot)),keyTest:n=>n[z.CTRL_OR_CMD]&&n.shiftKey&&cE(n,z.Z)||LO&&n.ctrlKey&&!n.shiftKey&&cE(n,z.Y),PanelComponent:({updateData:n,data:i})=>{const{isRedoStackEmpty:r}=F$(e.onHistoryChangedEmitter,new $b(e.isUndoStackEmpty,e.isRedoStackEmpty));return g(Ke,{type:"button",icon:xx,"aria-label":L("buttons.redo"),onClick:n,size:(i==null?void 0:i.size)||"medium",disabled:r,"data-testid":"button-redo"})}}),u7=(e,t,n,i,r,s)=>{if(e.trackEvent)try{typeof e.trackEvent=="object"&&(!e.trackEvent.predicate||e.trackEvent.predicate(n,i,s))&&ut(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${r.device.editor.isMobile?"mobile":"desktop"})`)}catch(o){console.error("error while logging action:",o)}};class ibe{constructor(t,n,i,r){F(this,"actions",{});F(this,"updater");F(this,"getAppState");F(this,"getElementsIncludingDeleted");F(this,"app");F(this,"renderAction",(t,n)=>{const i=this.app.props.UIOptions.canvasActions;if(this.actions[t]&&"PanelComponent"in this.actions[t]&&(!(t in i)||i[t])){const r=this.actions[t],s=r.PanelComponent;s.displayName="PanelComponent";const o=this.getElementsIncludingDeleted(),a=this.getAppState(),l=c=>{u7(r,"ui",a,o,this.app,c),this.updater(r.perform(this.getElementsIncludingDeleted(),this.getAppState(),c,this.app))};return g(s,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:l,appProps:this.app.props,app:this.app,data:n})}return null});F(this,"isActionEnabled",t=>{const n=this.getElementsIncludingDeleted(),i=this.getAppState();return!t.predicate||t.predicate(n,i,this.app.props,this.app)});this.updater=s=>{if(zm(s))s.then(o=>t(o));else return t(s)},this.getAppState=n,this.getElementsIncludingDeleted=i,this.app=r}registerAction(t){this.actions[t.name]=t}registerAll(t){t.forEach(n=>this.registerAction(n))}handleKeyDown(t){const n=this.app.props.UIOptions.canvasActions,i=Object.values(this.actions).sort((l,c)=>(c.keyPriority||0)-(l.keyPriority||0)).filter(l=>(l.name in n?n[l.name]:!0)&&l.keyTest&&l.keyTest(t,this.getAppState(),this.getElementsIncludingDeleted(),this.app));if(i.length!==1)return i.length>1&&console.warn("Canceling as multiple actions match this shortcut",i),!1;const r=i[0];if(this.getAppState().viewModeEnabled&&r.viewMode!==!0)return!1;const s=this.getElementsIncludingDeleted(),o=this.getAppState(),a=null;return u7(r,"keyboard",o,s,this.app,null),t.preventDefault(),t.stopPropagation(),this.updater(i[0].perform(s,o,a,this.app)),!0}executeAction(t,n="api",i=null){const r=this.getElementsIncludingDeleted(),s=this.getAppState();u7(t,n,s,r,this.app,i),this.updater(t.perform(r,s,i,this.app))}}const zM=e=>{const t=Array.from(e.values());return{x:VM(t,n=>n.x)/t.length,y:VM(t,n=>n.y)/t.length}},HM=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),VM=(e,t)=>e.reduce((n,i)=>n+t(i),0),rbe=({children:e,left:t,top:n,onCloseRequest:i,fitInViewport:r=!1,offsetLeft:s=0,offsetTop:o=0,viewportWidth:a=window.innerWidth,viewportHeight:l=window.innerHeight})=>{const c=M.useRef(null);M.useEffect(()=>{const d=c.current;if(!d)return;d.contains(document.activeElement)||d.focus();const f=h=>{var m,p,b;if(h.key===z.TAB){const E=q3(d),{activeElement:y}=document,v=E.findIndex(_=>_===y);y===d?(h.shiftKey?(m=E[E.length-1])==null||m.focus():E[0].focus(),h.preventDefault(),h.stopImmediatePropagation()):v===0&&h.shiftKey?((p=E[E.length-1])==null||p.focus(),h.preventDefault(),h.stopImmediatePropagation()):v===E.length-1&&!h.shiftKey&&((b=E[0])==null||b.focus(),h.preventDefault(),h.stopImmediatePropagation())}};return d.addEventListener("keydown",f),()=>d.removeEventListener("keydown",f)},[]);const u=M.useRef(null);return M.useLayoutEffect(()=>{var d,f;if(r&&c.current&&n!=null&&t!=null){const h=c.current,{width:m,height:p}=h.getBoundingClientRect();if(((d=u.current)==null?void 0:d.top)===n&&((f=u.current)==null?void 0:f.left)===t)return;u.current={top:n,left:t},m>=a?(h.style.width=`${a}px`,h.style.left="0px",h.style.overflowX="scroll"):t+m-s>a?h.style.left=`${a-m-10}px`:h.style.left=`${t}px`,p>=l?(h.style.height=`${l-20}px`,h.style.top="10px",h.style.overflowY="scroll"):n+p-o>l?h.style.top=`${l-p}px`:h.style.top=`${n}px`}},[n,t,r,a,l,s,o]),M.useEffect(()=>{if(i){const d=f=>{var h;(h=c.current)!=null&&h.contains(f.target)||Xn.unstable_batchedUpdates(()=>i(f))};return document.addEventListener("pointerdown",d,!1),()=>document.removeEventListener("pointerdown",d,!1)}},[i]),g("div",{className:"popover",ref:c,tabIndex:-1,children:e})},Vn="separator",sbe=se.memo(({actionManager:e,items:t,top:n,left:i,onClose:r})=>{const s=tp(),o=P5(),a=t.reduce((l,c)=>(c&&(c===Vn||!c.predicate||c.predicate(o,s,e.app.props,e.app))&&l.push(c),l),[]);return g(rbe,{onCloseRequest:()=>{r()},top:n,left:i,fitInViewport:!0,offsetLeft:s.offsetLeft,offsetTop:s.offsetTop,viewportWidth:s.width,viewportHeight:s.height,children:g("ul",{className:"context-menu",onContextMenu:l=>l.preventDefault(),children:a.map((l,c)=>{var f;if(l===Vn)return!a[c-1]||a[c-1]===Vn?null:g("hr",{className:"context-menu-item-separator"},c);const u=l.name;let d="";return l.label&&(typeof l.label=="function"?d=L(l.label(o,s,e.app)):d=L(l.label)),g("li",{"data-testid":u,onClick:()=>{r(()=>{e.executeAction(l,"contextMenu")})},children:P("button",{type:"button",className:me("context-menu-item",{dangerous:u==="deleteSelectedElements",checkmark:(f=l.checked)==null?void 0:f.call(l,s)}),children:[g("div",{className:"context-menu-item__label",children:d}),g("kbd",{className:"context-menu-item__shortcut",children:u?Bi(u):""})]})},c)})})})}),z$=function({onChange:e,value:t,choices:n,name:i}){return g("div",{className:"RadioGroup",children:n.map(r=>P("div",{className:me("RadioGroup__choice",{active:r.value===t}),title:r.ariaLabel,children:[g("input",{name:i,type:"radio",checked:r.value===t,onChange:()=>e(r.value),"aria-label":r.ariaLabel}),r.label]},String(r.value)))})},fU=({title:e,name:t,checked:n,onChange:i,disabled:r=!1})=>g("div",{className:me("Switch",{toggled:n,disabled:r}),children:g("input",{name:t,id:t,title:e,type:"checkbox",checked:n,disabled:r,onChange:()=>i(!n),onKeyDown:s=>{s.key===" "&&i(!n)}})}),Ws=M.forwardRef(({children:e,icon:t,onClick:n,label:i,variant:r="filled",color:s="primary",size:o="medium",fullWidth:a,className:l,status:c},u)=>{const[d,f]=M.useState(!1),h=async p=>{const b=n==null?void 0:n(p);if(zm(b)){const E=window.setTimeout(()=>{f(!0)},50);try{await b}catch(y){if(y instanceof Uh)console.warn(y);else throw y}finally{clearTimeout(E),f(!1)}}},m=d?"loading":c;return s=m==="success"?"success":s,g("button",{className:me("ExcButton",`ExcButton--color-${s}`,`ExcButton--variant-${r}`,`ExcButton--size-${o}`,`ExcButton--status-${m}`,{"ExcButton--fullWidth":a},l),onClick:h,type:"button","aria-label":i,ref:u,disabled:m==="loading"||m==="success",children:P("div",{className:"ExcButton__contents",children:[m==="loading"?g(qa,{className:"ExcButton__statusIcon"}):m==="success"&&g("div",{className:"ExcButton__statusIcon",children:Kne}),t&&g("div",{className:"ExcButton__icon","aria-hidden":!0,children:t}),r!=="icon"&&(e??i)]})})}),obe=2e3,B_=()=>{const[e,t]=M.useState(null),n=M.useRef(0),i=()=>{clearTimeout(n.current),t("success"),n.current=window.setTimeout(()=>{t(null)},obe)},r=M.useCallback(()=>{t(null)},[]);return{copyStatus:e,resetCopyStatus:r,onCopy:i}},abe="filter"in document.createElement("canvas").getContext("2d"),lbe=()=>P("div",{children:[g("h3",{children:L("canvasError.cannotShowPreview")}),g("p",{children:g("span",{children:L("canvasError.canvasTooBig")})}),P("em",{children:["(",L("canvasError.canvasTooBigTip"),")"]})]}),cbe=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:i,onExportImage:r,name:s})=>{const o=Fn(t,e),[a,l]=M.useState(s),[c,u]=M.useState(o),[d,f]=M.useState(e.exportBackground),[h,m]=M.useState(e.exportWithDarkMode),[p,b]=M.useState(e.exportEmbedScene),[E,y]=M.useState(e.exportScale),v=M.useRef(null),[_,I]=M.useState(null),{onCopy:R,copyStatus:w,resetCopyStatus:T}=B_();M.useEffect(()=>{T()},[a,d,h,E,p,T]);const{exportedElements:A,exportingFrame:S}=R5(t,e,c);return M.useEffect(()=>{const k=v.current;if(!k)return;const N=k.offsetWidth,D=k.offsetHeight;N&&d5({elements:A,appState:{...e,name:a,exportBackground:d,exportWithDarkMode:h,exportScale:E,exportEmbedScene:p},files:n,exportPadding:qh,maxWidthOrHeight:Math.max(N,D),exportingFrame:S}).then(G=>(I(null),Q0(G).then(()=>{k.replaceChildren(G)}).catch(V=>{throw V.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(L("canvasError.canvasTooBig")):V}))).catch(G=>{console.error(G),I(G)})},[e,n,A,S,a,d,h,E,p]),P("div",{className:"ImageExportModal",children:[g("h3",{children:L("imageExportDialog.header")}),P("div",{className:"ImageExportModal__preview",children:[g("div",{className:"ImageExportModal__preview__canvas",ref:v,children:_&&g(lbe,{})}),g("div",{className:"ImageExportModal__preview__filename",children:!Ad&&g("input",{type:"text",className:"TextInput",value:a,style:{width:"30ch"},onChange:k=>{l(k.target.value),i.executeAction(Hpe,"ui",k.target.value)}})})]}),P("div",{className:"ImageExportModal__settings",children:[g("h3",{children:L("imageExportDialog.header")}),o&&g(K1,{label:L("imageExportDialog.label.onlySelected"),name:"exportOnlySelected",children:g(fU,{name:"exportOnlySelected",checked:c,onChange:k=>{u(k)}})}),g(K1,{label:L("imageExportDialog.label.withBackground"),name:"exportBackgroundSwitch",children:g(fU,{name:"exportBackgroundSwitch",checked:d,onChange:k=>{f(k),i.executeAction($pe,"ui",k)}})}),abe&&g(K1,{label:L("imageExportDialog.label.darkMode"),name:"exportDarkModeSwitch",children:g(fU,{name:"exportDarkModeSwitch",checked:h,onChange:k=>{m(k),i.executeAction(Gpe,"ui",k)}})}),g(K1,{label:L("imageExportDialog.label.embedScene"),tooltip:L("imageExportDialog.tooltip.embedScene"),name:"exportEmbedSwitch",children:g(fU,{name:"exportEmbedSwitch",checked:p,onChange:k=>{b(k),i.executeAction(r$,"ui",k)}})}),g(K1,{label:L("imageExportDialog.label.scale"),name:"exportScale",children:g(z$,{name:"exportScale",value:E,onChange:k=>{y(k),i.executeAction(Vpe,"ui",k)},choices:Zv.map(k=>({value:k,label:`${k}×`}))})}),P("div",{className:"ImageExportModal__settings__buttons",children:[g(Ws,{className:"ImageExportModal__settings__buttons__button",label:L("imageExportDialog.title.exportToPng"),onClick:()=>r(o8.png,A,{exportingFrame:S}),icon:zx,children:L("imageExportDialog.button.exportToPng")}),g(Ws,{className:"ImageExportModal__settings__buttons__button",label:L("imageExportDialog.title.exportToSvg"),onClick:()=>r(o8.svg,A,{exportingFrame:S}),icon:zx,children:L("imageExportDialog.button.exportToSvg")}),(q9||A0)&&g(Ws,{className:"ImageExportModal__settings__buttons__button",label:L("imageExportDialog.title.copyPngToClipboard"),status:w,onClick:async()=>{await r(o8.clipboard,A,{exportingFrame:S}),R()},icon:$m,children:L("imageExportDialog.button.copyPngToClipboard")})]})]})]})},K1=({label:e,children:t,tooltip:n,name:i})=>P("div",{className:"ImageExportModal__settings__setting",title:e,children:[P("label",{htmlFor:i,className:"ImageExportModal__settings__setting__label",children:[e,n&&g(el,{label:n,long:!0,children:jne})]}),g("div",{className:"ImageExportModal__settings__setting__content",children:t})]}),ube=({elements:e,appState:t,files:n,actionManager:i,onExportImage:r,onCloseRequest:s,name:o})=>{const[{appStateSnapshot:a,elementsSnapshot:l}]=M.useState(()=>({appStateSnapshot:ka(t),elementsSnapshot:ka(e)}));return g(Hr,{onCloseRequest:s,size:"wide",title:!1,children:g(cbe,{elementsSnapshot:l,appStateSnapshot:a,files:n,actionManager:i,onExportImage:r,name:o})})},H$=({children:e,side:t,className:n})=>g("div",{className:me("FixedSideContainer",`FixedSideContainer_side_${t}`,n),children:e}),eh=100,wu=100,$M=e=>{switch(e){case z.ARROW_UP:return"up";case z.ARROW_DOWN:return"down";case z.ARROW_RIGHT:return"right";case z.ARROW_LEFT:return"left";default:return"right"}},V$=(e,t,n,i)=>{const r=[...n.values()].reduce((s,o)=>{var l;let a;if(ge(o)&&(a=o[e==="predecessors"?"startBinding":"endBinding"])&&((l=o[e==="predecessors"?"endBinding":"startBinding"])==null?void 0:l.elementId)===t.id){const c=n.get(a.elementId);if(!c)return s;qi(qs(c),"not an ExcalidrawBindableElement");const u=e==="predecessors"?o.points[o.points.length-1]:[0,0],d=bB(t,_o(t),[u[0]+o.x,u[1]+o.y]);s.push({relative:c,heading:d})}return s},[]);switch(i){case"up":return r.filter(s=>hn(s.heading,dr)).map(s=>s.relative);case"down":return r.filter(s=>hn(s.heading,oi)).map(s=>s.relative);case"right":return r.filter(s=>hn(s.heading,cn)).map(s=>s.relative);case"left":return r.filter(s=>hn(s.heading,ur)).map(s=>s.relative)}},WE=(e,t,n)=>V$("successors",e,t,n),KE=(e,t,n)=>V$("predecessors",e,t,n),dbe=(e,t,n)=>{const i=wu+e.width;if(n==="up"||n==="down"){const a=eh+e.height,l=e.x,c=e.x+e.width;if(t.every(u=>u.x+u.width<l||u.x>c))return{x:0,y:a*(n==="up"?-1:1)}}else if(n==="right"||n==="left"){const a=e.y,l=e.y+e.height;if(t.every(c=>c.y+c.height<a||c.y>l))return{x:(wu+e.width)*(n==="left"?-1:1),y:0}}if(n==="up"||n==="down"){const a=eh+e.height,l=(t.length===0,a),c=t.length===0?0:(t.length+1)%2===0?(t.length+1)/2*i:t.length/2*i*-1;return n==="up"?{x:c,y:l*-1}:{x:c,y:l}}const r=eh+e.height,s=(t.length===0,wu+e.width),o=t.length===0?0:(t.length+1)%2===0?(t.length+1)/2*r:t.length/2*r*-1;return n==="left"?{x:s*-1,y:o}:{x:s,y:o}},fbe=(e,t,n,i)=>{const r=WE(e,t,i),s=KE(e,t,i),o=dbe(e,[...r,...s],i),a=Xa({type:e.type,x:e.x+o.x,y:e.y+o.y,width:e.width,height:e.height,roundness:e.roundness,roughness:e.roughness,backgroundColor:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,opacity:e.opacity,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle});qi(X6(a),"not an ExcalidrawFlowchartNodeElement");const l=$$(e,a,t,i,n);return{nextNode:a,bindingArrow:l}},hbe=(e,t,n,i,r)=>{const s=[];for(let o=0;o<r;o++){let a,l;if(i==="left"||i==="right"){const d=eh*(r-1)+r*e.height,f=e.y+e.height/2-d/2;let h=wu+e.width;i==="left"&&(h*=-1),a=e.x+h;const m=(eh+e.height)*o;l=f+m}else{const d=wu*(r-1)+r*e.width,f=e.x+e.width/2-d/2;let h=eh+e.height;i==="up"&&(h*=-1),l=e.y+h;const m=(wu+e.width)*o;a=f+m}const c=Xa({type:e.type,x:a,y:l,width:e.width,height:e.height,roundness:e.roundness,roughness:e.roughness,backgroundColor:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,opacity:e.opacity,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle});qi(X6(c),"not an ExcalidrawFlowchartNodeElement");const u=$$(e,c,t,i,n);s.push(c),s.push(u)}return s},$$=(e,t,n,i,r)=>{let s,o;switch(i){case"up":{s=e.x+e.width/2,o=e.y-6;break}case"down":{s=e.x+e.width/2,o=e.y+e.height+6;break}case"right":{s=e.x+e.width+6,o=e.y+e.height/2;break}case"left":{s=e.x-6,o=e.y+e.height/2;break}}let l,c;switch(i){case"up":{l=t.x+t.width/2-s,c=t.y+t.height-o+6;break}case"down":{l=t.x+t.width/2-s,c=t.y-o-6;break}case"right":{l=t.x-s-6,c=t.y-o+t.height/2;break}case"left":{l=t.x+t.width-s+6,c=t.y-o+t.height/2;break}}const u=I9({type:"arrow",x:s,y:o,startArrowhead:null,endArrowhead:r.currentItemEndArrowhead,strokeColor:e.strokeColor,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,opacity:e.opacity,roughness:e.roughness,points:[C(0,0),C(l,c)],elbowed:!0});zo(u,e,"start",n),zo(u,t,"end",n);const d=new Map;d.set(e.id,e),d.set(t.id,t),d.set(u.id,u),ue.movePoints(u,[{index:1,point:u.points[1]}]);const f=F9(u,ms(new Map([...n.entries(),[e.id,e],[t.id,t],[u.id,u]])),{points:u.points});return{...u,...f}};class gbe{constructor(){F(this,"isExploring",!1);F(this,"sameLevelNodes",[]);F(this,"sameLevelIndex",0);F(this,"direction",null);F(this,"visitedNodes",new Set)}clear(){this.isExploring=!1,this.sameLevelNodes=[],this.sameLevelIndex=0,this.direction=null,this.visitedNodes.clear()}exploreByDirection(t,n,i){if(!qs(t))return null;if(i!==this.direction&&this.clear(),this.visitedNodes.has(t.id)||this.visitedNodes.add(t.id),this.isExploring&&i===this.direction&&this.sameLevelNodes.length>1)return this.sameLevelIndex=(this.sameLevelIndex+1)%this.sameLevelNodes.length,this.sameLevelNodes[this.sameLevelIndex].id;const r=[...WE(t,n,i),...KE(t,n,i)];if(r.length>0)return this.sameLevelIndex=0,this.isExploring=!0,this.sameLevelNodes=r,this.direction=i,this.visitedNodes.add(r[0].id),r[0].id;if(i===this.direction||!this.isExploring){this.isExploring||this.visitedNodes.add(t.id);const o=["up","right","down","left"].filter(a=>a!==i).map(a=>[...WE(t,n,a),...KE(t,n,a)]).flat().filter(a=>!this.visitedNodes.has(a.id));for(const a of o)if(!this.visitedNodes.has(a.id))return this.visitedNodes.add(a.id),this.isExploring=!0,this.direction=i,a.id}return null}}class mbe{constructor(){F(this,"isCreatingChart",!1);F(this,"numberOfNodes",0);F(this,"direction","right");F(this,"pendingNodes",null)}createNodes(t,n,i,r){if(r!==this.direction){const{nextNode:s,bindingArrow:o}=fbe(t,n,i,r);this.numberOfNodes=1,this.isCreatingChart=!0,this.direction=r,this.pendingNodes=[s,o]}else{this.numberOfNodes+=1;const s=hbe(t,n,i,r,this.numberOfNodes);this.isCreatingChart=!0,this.direction=r,this.pendingNodes=s}if(t.frameId){const s=n.get(t.frameId);qi(s&&uF(s),"not an ExcalidrawFrameElement"),s&&this.pendingNodes.every(o=>Ym([o],s,n)||Ec(o,s,n))&&(this.pendingNodes=this.pendingNodes.map(o=>ee(o,{frameId:t.frameId},!1)))}}clear(){this.isCreatingChart=!1,this.pendingNodes=null,this.direction=null,this.numberOfNodes=0}}const pbe=(e,t)=>{var n,i;for(const[,r]of t)if(r.type==="arrow"&&(((n=r.startBinding)==null?void 0:n.elementId)===e.id||((i=r.endBinding)==null?void 0:i.elementId)===e.id))return!0;return!1},Ube=({appState:e,isMobile:t,device:n,app:i})=>{var u,d;const{activeTool:r,isResizing:s,isRotating:o,lastPointerDownWith:a}=e,l=e.multiElement!==null;if(((u=e.openSidebar)==null?void 0:u.name)===ls.name&&e.openSidebar.tab===ku&&((d=e.searchMatches)!=null&&d.length))return L("hints.dismissSearch");if(e.openSidebar&&!n.editor.canFitSidebar)return null;if(bo(e))return L("hints.eraserRevert");if(r.type==="arrow"||r.type==="line")return l?L("hints.linearElementMulti"):r.type==="arrow"?L("hints.arrowTool",{arrowShortcut:Q("A")}):L("hints.linearElement");if(r.type==="freedraw")return L("hints.freeDraw");if(r.type==="text")return L("hints.text");if(r.type==="embeddable")return L("hints.embeddable");if(e.activeTool.type==="image"&&e.pendingImageElementId)return L("hints.placeImage");const c=i.scene.getSelectedElements(e);if(s&&a==="mouse"&&c.length===1){const f=c[0];return ke(f)&&f.points.length===2?L("hints.lockAngle"):st(f)?L("hints.resizeImage"):L("hints.resize")}if(o&&a==="mouse")return L("hints.rotate");if(c.length===1&&de(c[0]))return L("hints.text_selected");if(e.editingTextElement)return L("hints.text_editing");if(e.croppingElementId)return L("hints.leaveCropEditor");if(c.length===1&&st(c[0]))return L("hints.enterCropEditor");if(r.type==="selection"){if(e.selectionElement&&!c.length&&!e.editingTextElement&&!e.editingLinearElement)return L("hints.deepBoxSelect");if(em(i)&&e.selectedElementsAreBeingDragged)return L("hints.disableSnapping");if(!c.length&&!t)return L("hints.canvasPanning");if(c.length===1){if(ke(c[0]))return e.editingLinearElement?e.editingLinearElement.selectedPointsIndices?L("hints.lineEditor_pointSelected"):L("hints.lineEditor_nothingSelected"):L("hints.lineEditor_info");if(!e.newElement&&!e.selectedElementsAreBeingDragged&&Nu(c[0]))return X6(c[0])?pbe(c[0],i.scene.getNonDeletedElementsMap())?[L("hints.bindTextToElement"),L("hints.createFlowchart")]:[L("hints.bindTextToElement"),L("hints.createFlowchart")]:L("hints.bindTextToElement")}}return null},G$=({appState:e,isMobile:t,device:n,app:i})=>{const r=Ube({appState:e,isMobile:t,device:n,app:i});if(!r)return null;const s=Array.isArray(r)?r.map(o=>Q(o).replace(/\. ?$/,"")).join(". "):Q(r);return g("div",{className:"HintViewer",children:g("span",{children:s})})},X$=({delay:e,theme:t})=>{const[n,i]=M.useState(!!e);return M.useEffect(()=>{if(!e)return;const r=setTimeout(()=>{i(!1)},e);return()=>clearTimeout(r)},[e]),n?null:P("div",{className:me("LoadingMessage",{"LoadingMessage--dark":t===xe.DARK}),children:[g("div",{children:g(qa,{})}),g("div",{className:"LoadingMessage-text",children:L("labels.loadingScene")})]})},bbe="medium",GM={CHECKED:m9,UNCHECKED:Y6},j$=e=>P("label",{className:me("ToolIcon ToolIcon__lock",`ToolIcon_size_${bbe}`,{"is-mobile":e.isMobile}),title:`${e.title} — Q`,children:[g("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-lock"}),g("div",{className:"ToolIcon__icon",children:e.checked?GM.CHECKED:GM.UNCHECKED})]}),am=({heading:e,children:t,...n})=>{const{id:i}=qo(),r=g("h2",{className:"visually-hidden",id:`${i}-${e}-title`,children:L(`headings.${e}`)});return g("section",{...n,"aria-labelledby":`${i}-${e}-title`,children:typeof t=="function"?t(r):P(he,{children:[r,t]})})},Eo=4,$l=6,ybe="rgba(0,0,0,0.3)",Ebe=(e,t,n,i)=>{if(!e.length)return{horizontal:null,vertical:null};const[r,s,o,a]=wt(e),l=t/i.zoom.value,c=n/i.zoom.value,u=t-l,d=n-c,f={top:parseInt(Kp("sat"))||0,bottom:parseInt(Kp("sab"))||0,left:parseInt(Kp("sal"))||0,right:parseInt(Kp("sar"))||0},h=L0().rtl,m=-i.scrollX+u/2+f.left,p=-i.scrollY+d/2+f.top,b=m+l-f.right,E=p+c-f.bottom,y=Math.min(r,m),v=Math.min(s,p),_=Math.max(o,b),I=Math.max(a,E);return{horizontal:m===y&&b===_?null:{x:Math.max(f.left,Eo)+(m-y)/(_-y)*t,y:n-$l-Math.max(Eo,f.bottom),width:(b-m)/(_-y)*t-Math.max(Eo*2,f.left+f.right),height:$l},vertical:p===v&&E===I?null:{x:h?Math.max(f.left,Eo):t-$l-Math.max(f.right,Eo),y:(p-v)/(I-v)*n+Math.max(f.top,Eo),width:$l,height:(E-p)/(I-v)*n-Math.max(Eo*2,f.top+f.bottom)}}},XM=(e,t,n)=>{const[i,r]=[e.horizontal,e.vertical].map(o=>o!=null&&o.x<=t&&t<=o.x+o.width&&o.y<=n&&n<=o.y+o.height);return{isOverEither:i||r,isOverHorizontal:i,isOverVertical:r}},vbe="medium",Y$=e=>e.penDetected?P("label",{className:me("ToolIcon ToolIcon__penMode",`ToolIcon_size_${vbe}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[g("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),g("div",{className:"ToolIcon__icon",children:$te})]}):null,W$=e=>g(Ke,{className:me("Shape",{fillable:!1}),type:"radio",icon:$F,name:"editor-current-shape",checked:e.checked,title:`${e.title} — H`,keyBindingLabel:e.isMobile?void 0:z.H.toLocaleUpperCase(),"aria-label":`${e.title} — H`,"aria-keyshortcuts":z.H,"data-testid":"toolbar-hand",onChange:()=>{var t;return(t=e.onChange)==null?void 0:t.call(e)}}),_be=({appState:e,elements:t,actionManager:n,setAppState:i,onLockToggle:r,onHandToolToggle:s,onPenModeToggle:o,renderTopRightUI:a,renderCustomStats:l,renderSidebars:c,device:u,renderWelcomeScreen:d,UIOptions:f,app:h})=>{var v,_;const{WelcomeScreenCenterTunnel:m,MainMenuTunnel:p,DefaultSidebarTriggerTunnel:b}=ir(),E=()=>P(H$,{side:"top",className:"App-top-bar",children:[d&&g(m.Out,{}),g(am,{heading:"shapes",children:I=>{var R;return g(ss.Col,{gap:4,align:"center",children:P(ss.Row,{gap:1,className:"App-toolbar-container",children:[P(Ys,{padding:1,className:"App-toolbar App-toolbar--mobile",children:[I,g(ss.Row,{gap:1,children:g(x$,{appState:e,activeTool:e.activeTool,UIOptions:f,app:h})})]}),a&&a(!0,e),P("div",{className:"mobile-misc-tools-container",children:[!e.viewModeEnabled&&((R=e.openDialog)==null?void 0:R.name)!=="elementLinkSelector"&&g(b.Out,{}),g(Y$,{checked:e.penMode,onChange:()=>o(null),title:L("toolBar.penMode"),isMobile:!0,penDetected:e.penDetected}),g(j$,{checked:e.activeTool.locked,onChange:r,title:L("toolBar.lock"),isMobile:!0}),g(W$,{checked:mh(e),onChange:()=>s(),title:L("toolBar.hand"),isMobile:!0})]})]})})}}),g(G$,{appState:e,isMobile:!0,device:u,app:h})]}),y=()=>{var I;return e.viewModeEnabled||((I=e.openDialog)==null?void 0:I.name)==="elementLinkSelector"?g("div",{className:"App-toolbar-content",children:g(p.Out,{})}):P("div",{className:"App-toolbar-content",children:[g(p.Out,{}),n.renderAction("toggleEditMenu"),n.renderAction(e.multiElement?"finalize":"duplicateSelection"),n.renderAction("deleteSelectedElements"),P("div",{children:[n.renderAction("undo"),n.renderAction("redo")]})]})};return P(he,{children:[c(),!e.viewModeEnabled&&((v=e.openDialog)==null?void 0:v.name)!=="elementLinkSelector"&&E(),g("div",{className:"App-bottom-bar",style:{marginBottom:$l+Eo*2,marginLeft:$l+Eo*2,marginRight:$l+Eo*2},children:P(Ys,{padding:0,children:[e.openMenu==="shape"&&!e.viewModeEnabled&&((_=e.openDialog)==null?void 0:_.name)!=="elementLinkSelector"&&f_(e,t)?g(am,{className:"App-mobile-menu",heading:"selectedShapeActions",children:g(I$,{appState:e,elementsMap:h.scene.getNonDeletedElementsMap(),renderAction:n.renderAction,app:h})}):null,P("footer",{className:"App-toolbar",children:[y(),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&g("button",{type:"button",className:"scroll-back-to-content",onClick:()=>{i(I=>({...im(t,I)}))},children:L("buttons.scrollBackToContent")})]})]})})]})},jM=e=>{const t=M.useRef(null),[n,i]=M.useState(null);return M.useLayoutEffect(()=>{if(!e.spreadsheet)return;const r=Ehe(e.chartType,e.spreadsheet,0,0);i(r);let s;const o=t.current;return(async()=>{var a;s=await Y9(r,{exportBackground:!1,viewBackgroundColor:li.white},null,{skipInliningFonts:!0}),(a=s.querySelector(".style-fonts"))==null||a.remove(),o.replaceChildren(),o.appendChild(s),e.selected&&o.parentNode.focus()})(),()=>{o.replaceChildren()}},[e.spreadsheet,e.chartType,e.selected]),g("button",{type:"button",className:"ChartPreview",onClick:()=>{n&&e.onClick(e.chartType,n)},children:g("div",{ref:t})})},wbe=({setAppState:e,appState:t,onClose:n})=>{const{onInsertElements:i}=oo(),r=se.useCallback(()=>{n&&n()},[n]),s=(o,a)=>{i(a),ut("paste","chart",o),e({currentChartType:o,pasteDialog:{shown:!1,data:null}})};return g(Hr,{size:"small",onCloseRequest:r,title:L("labels.pasteCharts"),className:"PasteChartDialog",autofocus:!1,children:P("div",{className:"container",children:[g(jM,{chartType:"bar",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="bar",onClick:s}),g(jM,{chartType:"line",spreadsheet:t.pasteDialog.data,selected:t.currentChartType==="line",onClick:s})]})})},Tbe=()=>P("div",{className:"HelpDialog__header",children:[P("a",{className:"HelpDialog__btn",href:"https://docs.excalidraw.com",target:"_blank",rel:"noopener noreferrer",children:[g("div",{className:"HelpDialog__link-icon",children:Sx}),L("helpDialog.documentation")]}),P("a",{className:"HelpDialog__btn",href:"https://plus.excalidraw.com/blog",target:"_blank",rel:"noopener noreferrer",children:[g("div",{className:"HelpDialog__link-icon",children:Sx}),L("helpDialog.blog")]}),P("a",{className:"HelpDialog__btn",href:"https://github.com/excalidraw/excalidraw/issues",target:"_blank",rel:"noopener noreferrer",children:[g("div",{className:"HelpDialog__link-icon",children:U9}),L("helpDialog.github")]}),P("a",{className:"HelpDialog__btn",href:"https://youtube.com/@excalidraw",target:"_blank",rel:"noopener noreferrer",children:[g("div",{className:"HelpDialog__link-icon",children:qF}),"YouTube"]})]}),Sbe=e=>P(he,{children:[g("h3",{children:e.title}),g("div",{className:"HelpDialog__islands-container",children:e.children})]}),d7=e=>P("div",{className:`HelpDialog__island ${e.className}`,children:[g("h4",{className:"HelpDialog__island-title",children:e.caption}),g("div",{className:"HelpDialog__island-content",children:e.children})]});function*Ibe(e,t){let n=!0;for(const i of e)n||(yield t),n=!1,yield i}const xbe=e=>e.replace(/\b[a-z]\b/,t=>t.toUpperCase()),Ue=({label:e,shortcuts:t,isOr:n=!0})=>{const i=t.map(r=>(r.endsWith("++")?[...r.slice(0,-2).split("+"),"+"]:r.split("+")).map(o=>g(Cbe,{children:xbe(o)},o)));return P("div",{className:"HelpDialog__shortcut",children:[g("div",{children:e}),g("div",{className:"HelpDialog__key-container",children:[...Ibe(i,n?L("helpDialog.or"):null)]})]})},Cbe=e=>g("kbd",{className:"HelpDialog__key",...e}),Abe=({onClose:e})=>{const t=se.useCallback(()=>{e&&e()},[e]);return g(he,{children:P(Hr,{onCloseRequest:t,title:L("helpDialog.title"),className:"HelpDialog",children:[g(Tbe,{}),P(Sbe,{title:L("helpDialog.shortcuts"),children:[P(d7,{className:"HelpDialog__island--tools",caption:L("helpDialog.tools"),children:[g(Ue,{label:L("toolBar.hand"),shortcuts:[z.H]}),g(Ue,{label:L("toolBar.selection"),shortcuts:[z.V,z[1]]}),g(Ue,{label:L("toolBar.rectangle"),shortcuts:[z.R,z[2]]}),g(Ue,{label:L("toolBar.diamond"),shortcuts:[z.D,z[3]]}),g(Ue,{label:L("toolBar.ellipse"),shortcuts:[z.O,z[4]]}),g(Ue,{label:L("toolBar.arrow"),shortcuts:[z.A,z[5]]}),g(Ue,{label:L("toolBar.line"),shortcuts:[z.L,z[6]]}),g(Ue,{label:L("toolBar.freedraw"),shortcuts:[z.P,z[7]]}),g(Ue,{label:L("toolBar.text"),shortcuts:[z.T,z[8]]}),g(Ue,{label:L("toolBar.image"),shortcuts:[z[9]]}),g(Ue,{label:L("toolBar.eraser"),shortcuts:[z.E,z[0]]}),g(Ue,{label:L("toolBar.frame"),shortcuts:[z.F]}),g(Ue,{label:L("toolBar.laser"),shortcuts:[z.K]}),g(Ue,{label:L("labels.eyeDropper"),shortcuts:[z.I,"Shift+S","Shift+G"]}),g(Ue,{label:L("helpDialog.editLineArrowPoints"),shortcuts:[Q("CtrlOrCmd+Enter")]}),g(Ue,{label:L("helpDialog.editText"),shortcuts:[Q("Enter")]}),g(Ue,{label:L("helpDialog.textNewLine"),shortcuts:[Q("Enter"),Q("Shift+Enter")]}),g(Ue,{label:L("helpDialog.textFinish"),shortcuts:[Q("Esc"),Q("CtrlOrCmd+Enter")]}),g(Ue,{label:L("helpDialog.curvedArrow"),shortcuts:["A",L("helpDialog.click"),L("helpDialog.click"),L("helpDialog.click")],isOr:!1}),g(Ue,{label:L("helpDialog.curvedLine"),shortcuts:["L",L("helpDialog.click"),L("helpDialog.click"),L("helpDialog.click")],isOr:!1}),g(Ue,{label:L("helpDialog.cropStart"),shortcuts:[L("helpDialog.doubleClick"),Q("Enter")],isOr:!0}),g(Ue,{label:L("helpDialog.cropFinish"),shortcuts:[Q("Enter"),Q("Escape")],isOr:!0}),g(Ue,{label:L("toolBar.lock"),shortcuts:[z.Q]}),g(Ue,{label:L("helpDialog.preventBinding"),shortcuts:[Q("CtrlOrCmd")]}),g(Ue,{label:L("toolBar.link"),shortcuts:[Q("CtrlOrCmd+K")]})]}),P(d7,{className:"HelpDialog__island--view",caption:L("helpDialog.view"),children:[g(Ue,{label:L("buttons.zoomIn"),shortcuts:[Q("CtrlOrCmd++")]}),g(Ue,{label:L("buttons.zoomOut"),shortcuts:[Q("CtrlOrCmd+-")]}),g(Ue,{label:L("buttons.resetZoom"),shortcuts:[Q("CtrlOrCmd+0")]}),g(Ue,{label:L("helpDialog.zoomToFit"),shortcuts:["Shift+1"]}),g(Ue,{label:L("helpDialog.zoomToSelection"),shortcuts:["Shift+2"]}),g(Ue,{label:L("helpDialog.movePageUpDown"),shortcuts:["PgUp/PgDn"]}),g(Ue,{label:L("helpDialog.movePageLeftRight"),shortcuts:["Shift+PgUp/PgDn"]}),g(Ue,{label:L("buttons.zenMode"),shortcuts:[Q("Alt+Z")]}),g(Ue,{label:L("buttons.objectsSnapMode"),shortcuts:[Q("Alt+S")]}),g(Ue,{label:L("labels.toggleGrid"),shortcuts:[Q("CtrlOrCmd+'")]}),g(Ue,{label:L("labels.viewMode"),shortcuts:[Q("Alt+R")]}),g(Ue,{label:L("labels.toggleTheme"),shortcuts:[Q("Alt+Shift+D")]}),g(Ue,{label:L("stats.fullTitle"),shortcuts:[Q("Alt+/")]}),g(Ue,{label:L("search.title"),shortcuts:[Bi("searchMenu")]}),g(Ue,{label:L("commandPalette.title"),shortcuts:A0?[Bi("commandPalette")]:[Bi("commandPalette"),Bi("commandPalette",1)]})]}),P(d7,{className:"HelpDialog__island--editor",caption:L("helpDialog.editor"),children:[g(Ue,{label:L("helpDialog.createFlowchart"),shortcuts:[Q("CtrlOrCmd+Arrow Key")],isOr:!0}),g(Ue,{label:L("helpDialog.navigateFlowchart"),shortcuts:[Q("Alt+Arrow Key")],isOr:!0}),g(Ue,{label:L("labels.moveCanvas"),shortcuts:[Q(`Space+${L("helpDialog.drag")}`),Q(`Wheel+${L("helpDialog.drag")}`)],isOr:!0}),g(Ue,{label:L("buttons.clearReset"),shortcuts:[Q("CtrlOrCmd+Delete")]}),g(Ue,{label:L("labels.delete"),shortcuts:[Q("Delete")]}),g(Ue,{label:L("labels.cut"),shortcuts:[Q("CtrlOrCmd+X")]}),g(Ue,{label:L("labels.copy"),shortcuts:[Q("CtrlOrCmd+C")]}),g(Ue,{label:L("labels.paste"),shortcuts:[Q("CtrlOrCmd+V")]}),g(Ue,{label:L("labels.pasteAsPlaintext"),shortcuts:[Q("CtrlOrCmd+Shift+V")]}),g(Ue,{label:L("labels.selectAll"),shortcuts:[Q("CtrlOrCmd+A")]}),g(Ue,{label:L("labels.multiSelect"),shortcuts:[Q(`Shift+${L("helpDialog.click")}`)]}),g(Ue,{label:L("helpDialog.deepSelect"),shortcuts:[Q(`CtrlOrCmd+${L("helpDialog.click")}`)]}),g(Ue,{label:L("helpDialog.deepBoxSelect"),shortcuts:[Q(`CtrlOrCmd+${L("helpDialog.drag")}`)]}),(q9||A0)&&g(Ue,{label:L("labels.copyAsPng"),shortcuts:[Q("Shift+Alt+C")]}),g(Ue,{label:L("labels.copyStyles"),shortcuts:[Q("CtrlOrCmd+Alt+C")]}),g(Ue,{label:L("labels.pasteStyles"),shortcuts:[Q("CtrlOrCmd+Alt+V")]}),g(Ue,{label:L("labels.sendToBack"),shortcuts:[Q(Fo?"CtrlOrCmd+Alt+[":"CtrlOrCmd+Shift+[")]}),g(Ue,{label:L("labels.bringToFront"),shortcuts:[Q(Fo?"CtrlOrCmd+Alt+]":"CtrlOrCmd+Shift+]")]}),g(Ue,{label:L("labels.sendBackward"),shortcuts:[Q("CtrlOrCmd+[")]}),g(Ue,{label:L("labels.bringForward"),shortcuts:[Q("CtrlOrCmd+]")]}),g(Ue,{label:L("labels.alignTop"),shortcuts:[Q("CtrlOrCmd+Shift+Up")]}),g(Ue,{label:L("labels.alignBottom"),shortcuts:[Q("CtrlOrCmd+Shift+Down")]}),g(Ue,{label:L("labels.alignLeft"),shortcuts:[Q("CtrlOrCmd+Shift+Left")]}),g(Ue,{label:L("labels.alignRight"),shortcuts:[Q("CtrlOrCmd+Shift+Right")]}),g(Ue,{label:L("labels.duplicateSelection"),shortcuts:[Q("CtrlOrCmd+D"),Q(`Alt+${L("helpDialog.drag")}`)]}),g(Ue,{label:L("helpDialog.toggleElementLock"),shortcuts:[Q("CtrlOrCmd+Shift+L")]}),g(Ue,{label:L("buttons.undo"),shortcuts:[Q("CtrlOrCmd+Z")]}),g(Ue,{label:L("buttons.redo"),shortcuts:LO?[Q("CtrlOrCmd+Y"),Q("CtrlOrCmd+Shift+Z")]:[Q("CtrlOrCmd+Shift+Z")]}),g(Ue,{label:L("labels.group"),shortcuts:[Q("CtrlOrCmd+G")]}),g(Ue,{label:L("labels.ungroup"),shortcuts:[Q("CtrlOrCmd+Shift+G")]}),g(Ue,{label:L("labels.flipHorizontal"),shortcuts:[Q("Shift+H")]}),g(Ue,{label:L("labels.flipVertical"),shortcuts:[Q("Shift+V")]}),g(Ue,{label:L("labels.showStroke"),shortcuts:[Q("S")]}),g(Ue,{label:L("labels.showBackground"),shortcuts:[Q("G")]}),g(Ue,{label:L("labels.showFonts"),shortcuts:[Q("Shift+F")]}),g(Ue,{label:L("labels.decreaseFontSize"),shortcuts:[Q("CtrlOrCmd+Shift+<")]}),g(Ue,{label:L("labels.increaseFontSize"),shortcuts:[Q("CtrlOrCmd+Shift+>")]})]})]})]})})},Mbe=4,Rbe=8,kbe=({shouldWrap:e,children:t,username:n})=>e?g(el,{label:n||"Unknown user",children:t}):g(he,{children:t}),f7=({actionManager:e,collaborator:t,socketId:n,withName:i=!1,shouldWrapWithTooltip:r=!1,isBeingFollowed:s})=>{const o={socketId:n,collaborator:t,withName:i,isBeingFollowed:s},a=e.renderAction("goToCollaborator",o);return g(kbe,{username:t.username,shouldWrap:r,children:a},n)},Lbe=["avatarUrl","id","socketId","username","isInCall","isSpeaking","isMuted"],K$=se.memo(({className:e,mobile:t,collaborators:n,userToFollow:i})=>{const r=vr(),s=new Map;n.forEach((p,b)=>{const E=p.id||b;s.set(E,{...p,socketId:b})});const o=Array.from(s.values()).filter(p=>{var b;return(b=p.username)==null?void 0:b.trim()}),[a,l]=se.useState(""),c=o.filter(p=>{var b;return(b=p.username)==null?void 0:b.toLowerCase().includes(a)}),u=se.useRef(null);M.useLayoutEffect(()=>{if(u.current){const p=E=>{const y=Math.max(1,Math.min(8,Math.floor(E/38)));f(y)};if(p(u.current.clientWidth),!O3)return;const b=new ResizeObserver(E=>{for(const y of E){const{width:v}=y.contentRect;p(v)}});return b.observe(u.current),()=>{b.disconnect()}}},[]);const[d,f]=se.useState(Mbe),m=o.slice(0,d-1).map(p=>f7({actionManager:r,collaborator:p,socketId:p.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:p.socketId===i}));return t?g("div",{className:me("UserList UserList_mobile",e),children:o.map(p=>f7({actionManager:r,collaborator:p,socketId:p.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:p.socketId===i}))}):g("div",{className:"UserList__wrapper",ref:u,children:P("div",{className:me("UserList",e),style:{"--max-avatars":d},children:[m,o.length>d-1&&P(S5,{children:[P(I5,{className:"UserList__more",children:["+",o.length-d+1]}),g(M_,{style:{zIndex:2,width:"15rem",textAlign:"left"},align:"end",sideOffset:10,children:P(Ys,{padding:2,children:[o.length>=Rbe&&g(WV,{placeholder:L("quickSearch.placeholder"),onChange:l}),g(KV,{className:"dropdown-menu UserList__collaborators",placeholder:L("userList.empty"),children:c.length>0?[g("div",{className:"hint",children:L("userList.hint.text")}),c.map(p=>f7({actionManager:r,collaborator:p,socketId:p.socketId,withName:!0,isBeingFollowed:p.socketId===i}))]:[]}),g(GV,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})]})]})})},(e,t)=>{if(e.collaborators.size!==t.collaborators.size||e.mobile!==t.mobile||e.className!==t.className||e.userToFollow!==t.userToFollow)return!1;const n=t.collaborators.keys();for(const[i,r]of e.collaborators){const s=t.collaborators.get(i);if(!s||i!==n.next().value||!vi(r,s,Lbe))return!1}return!0}),ZE=({children:e,color:t})=>g("div",{className:"Card",style:{"--card-color":t==="primary"?"var(--color-primary)":li[t][7],"--card-color-darker":t==="primary"?"var(--color-primary-darker)":li[t][8],"--card-color-darkest":t==="primary"?"var(--color-primary-darkest)":li[t][9]},children:e}),Dbe=({elements:e,appState:t,setAppState:n,files:i,actionManager:r,exportOpts:s,canvas:o,onCloseRequest:a})=>{const{onExportToBackend:l}=s;return g("div",{className:"ExportDialog ExportDialog--json",children:P("div",{className:"ExportDialog-cards",children:[s.saveFileToDisk&&P(ZE,{color:"lime",children:[g("div",{className:"Card-icon",children:Jte}),g("h2",{children:L("exportDialog.disk_title")}),P("div",{className:"Card-details",children:[L("exportDialog.disk_details"),!Ad&&r.renderAction("changeProjectName")]}),g(Ke,{className:"Card-button",type:"button",title:L("exportDialog.disk_button"),"aria-label":L("exportDialog.disk_button"),showAriaLabel:!0,onClick:()=>{r.executeAction(s$,"ui")}})]}),l&&P(ZE,{color:"pink",children:[g("div",{className:"Card-icon",children:fb}),g("h2",{children:L("exportDialog.link_title")}),g("div",{className:"Card-details",children:L("exportDialog.link_details")}),g(Ke,{className:"Card-button",type:"button",title:L("exportDialog.link_button"),"aria-label":L("exportDialog.link_button"),showAriaLabel:!0,onClick:async()=>{try{ut("export","link",`ui (${Bm()})`),await l(e,t,i),a()}catch(c){n({errorMessage:c.message})}}})]}),s.renderCustomUI&&s.renderCustomUI(e,t,i,o)]})})},Nbe=({elements:e,appState:t,files:n,actionManager:i,exportOpts:r,canvas:s,setAppState:o})=>{var l;const a=se.useCallback(()=>{o({openDialog:null})},[o]);return g(he,{children:((l=t.openDialog)==null?void 0:l.name)==="jsonExport"&&g(Hr,{onCloseRequest:a,title:L("buttons.export"),children:g(Dbe,{elements:e,appState:t,setAppState:o,files:n,actionManager:i,onCloseRequest:a,exportOpts:r,canvas:s})})})},Obe=e=>g("button",{className:"help-icon",onClick:e.onClick,type:"button",title:`${L("helpDialog.title")} — ?`,"aria-label":L("helpDialog.title"),children:p9}),Z$=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:i})=>{const{FooterCenterTunnel:r,WelcomeScreenHelpHintTunnel:s}=ir(),o=Qn(),a=!e.viewModeEnabled&&e.multiElement&&o.isTouchScreen;return P("footer",{role:"contentinfo",className:"layer-ui__wrapper__footer App-menu App-menu_bottom",children:[g("div",{className:me("layer-ui__wrapper__footer-left zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:g(ss.Col,{gap:2,children:P(am,{heading:"canvasActions",children:[g(d2e,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&g(f2e,{renderAction:t.renderAction,className:me("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})}),a&&g(g2e,{renderAction:t.renderAction,className:me("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled})})]})})}),g(r.Out,{}),g("div",{className:me("layer-ui__wrapper__footer-right zen-mode-transition",{"transition-right":e.zenModeEnabled}),children:P("div",{style:{position:"relative"},children:[i&&g(s.Out,{}),g(Obe,{onClick:()=>t.executeAction(O_)})]})}),g(h2e,{actionManager:t,showExitZenModeBtn:n})]})};Z$.displayName="Footer";const q$=se.createContext({}),Q$=({children:e,className:t})=>{const n=Qn(),i=M.useContext(q$),r=!!(n.editor.canFitSidebar&&i.shouldRenderDockButton);return P("div",{className:me("sidebar__header",t),"data-testid":"sidebar-header",children:[e,P("div",{className:"sidebar__header__buttons",children:[r&&g(el,{label:L("labels.sidebarLock"),children:g(cd,{onSelect:()=>{var s;return(s=i.onDock)==null?void 0:s.call(i,!i.docked)},selected:!!i.docked,className:"sidebar__dock","data-testid":"sidebar-dock","aria-label":L("labels.sidebarLock"),children:Lte})}),g(cd,{"data-testid":"sidebar-close",className:"sidebar__close",onSelect:i.onCloseRequest,"aria-label":L("buttons.close"),children:xd})]})]})};Q$.displayName="SidebarHeader";const J$=({name:e,tab:t,icon:n,title:i,children:r,onToggle:s,className:o,style:a})=>{var u;const l=zn(),c=fi();return P("label",{title:i,className:"sidebar-trigger__label-element",children:[g("input",{className:"ToolIcon_type_checkbox",type:"checkbox",onChange:d=>{var h;(h=document.querySelector(".layer-ui__wrapper"))==null||h.classList.remove("animate");const f=d.target.checked;l({openSidebar:f?{name:e,tab:t}:null}),s==null||s(f)},checked:((u=c.openSidebar)==null?void 0:u.name)===e,"aria-label":i,"aria-keyshortcuts":"0"}),P("div",{className:me("sidebar-trigger",o),style:a,children:[n&&g("div",{children:n}),r&&g("div",{className:"sidebar-trigger__label",children:r})]})]})};J$.displayName="SidebarTrigger";function tr(){return tr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},tr.apply(null,arguments)}function La(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function z_(e,t=[]){let n=[];function i(s,o){const a=M.createContext(o),l=n.length;n=[...n,o];function c(d){const{scope:f,children:h,...m}=d,p=(f==null?void 0:f[e][l])||a,b=M.useMemo(()=>m,Object.values(m));return M.createElement(p.Provider,{value:b},h)}function u(d,f){const h=(f==null?void 0:f[e][l])||a,m=M.useContext(h);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const r=()=>{const s=n.map(o=>M.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return M.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[i,Pbe(r,...t)]}function Pbe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const i=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return M.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Fbe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Bbe(...e){return t=>e.forEach(n=>Fbe(n,t))}function YM(...e){return M.useCallback(Bbe(...e),e)}function zbe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Hbe(...e){return t=>e.forEach(n=>zbe(n,t))}const lm=M.forwardRef((e,t)=>{const{children:n,...i}=e,r=M.Children.toArray(n),s=r.find($be);if(s){const o=s.props.children,a=r.map(l=>l===s?M.Children.count(o)>1?M.Children.only(null):M.isValidElement(o)?o.props.children:null:l);return M.createElement(qE,tr({},i,{ref:t}),M.isValidElement(o)?M.cloneElement(o,void 0,a):null)}return M.createElement(qE,tr({},i,{ref:t}),n)});lm.displayName="Slot";const qE=M.forwardRef((e,t)=>{const{children:n,...i}=e;return M.isValidElement(n)?M.cloneElement(n,{...Gbe(i,n.props),ref:Hbe(t,n.ref)}):M.Children.count(n)>1?M.Children.only(null):null});qE.displayName="SlotClone";const Vbe=({children:e})=>M.createElement(M.Fragment,null,e);function $be(e){return M.isValidElement(e)&&e.type===Vbe}function Gbe(e,t){const n={...t};for(const i in t){const r=e[i],s=t[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...a)=>{s(...a),r(...a)}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Xbe(e){const t=e+"CollectionProvider",[n,i]=z_(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:m,children:p}=h,b=se.useRef(null),E=se.useRef(new Map).current;return se.createElement(r,{scope:m,itemMap:E,collectionRef:b},p)},a=e+"CollectionSlot",l=se.forwardRef((h,m)=>{const{scope:p,children:b}=h,E=s(a,p),y=YM(m,E.collectionRef);return se.createElement(lm,{ref:y},b)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",d=se.forwardRef((h,m)=>{const{scope:p,children:b,...E}=h,y=se.useRef(null),v=YM(m,y),_=s(c,p);return se.useEffect(()=>(_.itemMap.set(y,{ref:y,...E}),()=>void _.itemMap.delete(y))),se.createElement(lm,{[u]:"",ref:v},b)});function f(h){const m=s(e+"CollectionConsumer",h);return se.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const E=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((_,I)=>E.indexOf(_.ref.current)-E.indexOf(I.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:o,Slot:l,ItemSlot:d},f,i]}function jbe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ybe(...e){return t=>e.forEach(n=>jbe(n,t))}function Wbe(...e){return M.useCallback(Ybe(...e),e)}const Kbe=globalThis!=null&&globalThis.document?M.useLayoutEffect:()=>{},Zbe=GL.useId||(()=>{});let qbe=0;function eG(e){const[t,n]=M.useState(Zbe());return Kbe(()=>{n(i=>i??String(qbe++))},[e]),e||(t?`radix-${t}`:"")}const Qbe=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],tG=Qbe.reduce((e,t)=>{const n=M.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?lm:t;return M.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),M.createElement(a,tr({},o,{ref:r}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Jbe(e){const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var i;return(i=t.current)===null||i===void 0?void 0:i.call(t,...n)},[])}function nG(e){const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var i;return(i=t.current)===null||i===void 0?void 0:i.call(t,...n)},[])}function iG({prop:e,defaultProp:t,onChange:n=()=>{}}){const[i,r]=e6e({defaultProp:t,onChange:n}),s=e!==void 0,o=s?e:i,a=nG(n),l=M.useCallback(c=>{if(s){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else r(c)},[s,e,r,a]);return[o,l]}function e6e({defaultProp:e,onChange:t}){const n=M.useState(e),[i]=n,r=M.useRef(i),s=nG(t);return M.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),n}const t6e=M.createContext(void 0);function rG(e){const t=M.useContext(t6e);return e||t||"ltr"}const h7="rovingFocusGroup.onEntryFocus",n6e={bubbles:!1,cancelable:!0},H_="RovingFocusGroup",[QE,sG,i6e]=Xbe(H_),[r6e,oG]=z_(H_,[i6e]),[s6e,o6e]=r6e(H_),a6e=M.forwardRef((e,t)=>M.createElement(QE.Provider,{scope:e.__scopeRovingFocusGroup},M.createElement(QE.Slot,{scope:e.__scopeRovingFocusGroup},M.createElement(l6e,tr({},e,{ref:t}))))),l6e=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:r=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,d=M.useRef(null),f=Wbe(t,d),h=rG(s),[m=null,p]=iG({prop:o,defaultProp:a,onChange:l}),[b,E]=M.useState(!1),y=Jbe(c),v=sG(n),_=M.useRef(!1),[I,R]=M.useState(0);return M.useEffect(()=>{const w=d.current;if(w)return w.addEventListener(h7,y),()=>w.removeEventListener(h7,y)},[y]),M.createElement(s6e,{scope:n,orientation:i,dir:h,loop:r,currentTabStopId:m,onItemFocus:M.useCallback(w=>p(w),[p]),onItemShiftTab:M.useCallback(()=>E(!0),[]),onFocusableItemAdd:M.useCallback(()=>R(w=>w+1),[]),onFocusableItemRemove:M.useCallback(()=>R(w=>w-1),[])},M.createElement(tG.div,tr({tabIndex:b||I===0?-1:0,"data-orientation":i},u,{ref:f,style:{outline:"none",...e.style},onMouseDown:La(e.onMouseDown,()=>{_.current=!0}),onFocus:La(e.onFocus,w=>{const T=!_.current;if(w.target===w.currentTarget&&T&&!b){const A=new CustomEvent(h7,n6e);if(w.currentTarget.dispatchEvent(A),!A.defaultPrevented){const S=v().filter(V=>V.focusable),k=S.find(V=>V.active),N=S.find(V=>V.id===m),G=[k,N,...S].filter(Boolean).map(V=>V.ref.current);aG(G)}}_.current=!1}),onBlur:La(e.onBlur,()=>E(!1))})))}),c6e="RovingFocusGroupItem",u6e=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:r=!1,tabStopId:s,...o}=e,a=eG(),l=s||a,c=o6e(c6e,n),u=c.currentTabStopId===l,d=sG(n),{onFocusableItemAdd:f,onFocusableItemRemove:h}=c;return M.useEffect(()=>{if(i)return f(),()=>h()},[i,f,h]),M.createElement(QE.ItemSlot,{scope:n,id:l,focusable:i,active:r},M.createElement(tG.span,tr({tabIndex:u?0:-1,"data-orientation":c.orientation},o,{ref:t,onMouseDown:La(e.onMouseDown,m=>{i?c.onItemFocus(l):m.preventDefault()}),onFocus:La(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:La(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const p=h6e(m,c.orientation,c.dir);if(p!==void 0){m.preventDefault();let E=d().filter(y=>y.focusable).map(y=>y.ref.current);if(p==="last")E.reverse();else if(p==="prev"||p==="next"){p==="prev"&&E.reverse();const y=E.indexOf(m.currentTarget);E=c.loop?g6e(E,y+1):E.slice(y+1)}setTimeout(()=>aG(E))}})})))}),d6e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function f6e(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function h6e(e,t,n){const i=f6e(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return d6e[i]}function aG(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function g6e(e,t){return e.map((n,i)=>e[(t+i)%e.length])}const m6e=a6e,p6e=u6e;function U6e(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function b6e(...e){return t=>e.forEach(n=>U6e(n,t))}function y6e(...e){return M.useCallback(b6e(...e),e)}const WM=globalThis!=null&&globalThis.document?M.useLayoutEffect:()=>{};function E6e(e,t){return M.useReducer((n,i)=>{const r=t[n][i];return r??n},e)}const lG=e=>{const{present:t,children:n}=e,i=v6e(t),r=typeof n=="function"?n({present:i.isPresent}):M.Children.only(n),s=y6e(i.ref,r.ref);return typeof n=="function"||i.isPresent?M.cloneElement(r,{ref:s}):null};lG.displayName="Presence";function v6e(e){const[t,n]=M.useState(),i=M.useRef({}),r=M.useRef(e),s=M.useRef("none"),o=e?"mounted":"unmounted",[a,l]=E6e(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return M.useEffect(()=>{const c=hU(i.current);s.current=a==="mounted"?c:"none"},[a]),WM(()=>{const c=i.current,u=r.current;if(u!==e){const f=s.current,h=hU(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),WM(()=>{if(t){const c=d=>{const h=hU(i.current).includes(d.animationName);d.target===t&&h&&Xn.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(s.current=hU(i.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:M.useCallback(c=>{c&&(i.current=getComputedStyle(c)),n(c)},[])}}function hU(e){return(e==null?void 0:e.animationName)||"none"}const _6e=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],O5=_6e.reduce((e,t)=>{const n=M.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?lm:t;return M.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),M.createElement(a,tr({},o,{ref:r}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),cG="Tabs",[w6e,pxe]=z_(cG,[oG]),uG=oG(),[T6e,V_]=w6e(cG),S6e=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:i,onValueChange:r,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=rG(a),[d,f]=iG({prop:i,onChange:r,defaultProp:s});return M.createElement(T6e,{scope:n,baseId:eG(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:l},M.createElement(O5.div,tr({dir:u,"data-orientation":o},c,{ref:t})))}),I6e="TabsList",x6e=M.forwardRef((e,t)=>{const{__scopeTabs:n,loop:i=!0,...r}=e,s=V_(I6e,n),o=uG(n);return M.createElement(m6e,tr({asChild:!0},o,{orientation:s.orientation,dir:s.dir,loop:i}),M.createElement(O5.div,tr({role:"tablist","aria-orientation":s.orientation},r,{ref:t})))}),C6e="TabsTrigger",A6e=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:i,disabled:r=!1,...s}=e,o=V_(C6e,n),a=uG(n),l=dG(o.baseId,i),c=fG(o.baseId,i),u=i===o.value;return M.createElement(p6e,tr({asChild:!0},a,{focusable:!r,active:u}),M.createElement(O5.button,tr({type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l},s,{ref:t,onMouseDown:La(e.onMouseDown,d=>{!r&&d.button===0&&d.ctrlKey===!1?o.onValueChange(i):d.preventDefault()}),onKeyDown:La(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(i)}),onFocus:La(e.onFocus,()=>{const d=o.activationMode!=="manual";!u&&!r&&d&&o.onValueChange(i)})})))}),M6e="TabsContent",R6e=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:i,forceMount:r,children:s,...o}=e,a=V_(M6e,n),l=dG(a.baseId,i),c=fG(a.baseId,i),u=i===a.value,d=M.useRef(u);return M.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),M.createElement(lG,{present:r||u},({present:f})=>M.createElement(O5.div,tr({"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0},o,{ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0}}),f&&s))});function dG(e,t){return`${e}-trigger-${t}`}function fG(e,t){return`${e}-content-${t}`}const hG=S6e,gG=x6e,mG=A6e,pG=R6e,UG=({children:e,...t})=>g(gG,{className:"sidebar-triggers",...t,children:e});UG.displayName="SidebarTabTriggers";const bG=({children:e,tab:t,onSelect:n,...i})=>g(mG,{value:t,asChild:!0,onSelect:n,children:g("button",{type:"button",className:"excalidraw-button sidebar-tab-trigger",...i,children:e})});bG.displayName="SidebarTabTrigger";const yG=({children:e,...t})=>{const n=fi(),i=zn();if(!n.openSidebar)return null;const{name:r}=n.openSidebar;return g(hG,{className:"sidebar-tabs-root",value:n.openSidebar.tab,onValueChange:s=>i(o=>({...o,openSidebar:{...o.openSidebar,name:r,tab:s}})),...t,children:e})};yG.displayName="SidebarTabs";const EG=({tab:e,children:t,...n})=>g(pG,{...n,value:e,"data-testid":e,children:t});EG.displayName="SidebarTab";const $_=qt(!1),vG=M.forwardRef(({name:e,children:t,onDock:n,docked:i,className:r,...s},o)=>{const a=zn(),l=z6($_);M.useLayoutEffect(()=>(l(!!i),()=>{l(!1)}),[l,i]);const c=M.useRef({});c.current.onCloseRequest=()=>{a({openSidebar:null})},c.current.onDock=h=>n==null?void 0:n(h),c.current=jU(c.current,{docked:i,shouldRenderDockButton:!!n&&i!=null});const u=M.useRef(null);M.useImperativeHandle(o,()=>u.current);const d=Qn(),f=M.useCallback(()=>{document.querySelector(".Dialog")||a({openSidebar:null})},[a]);return R_(u,M.useCallback(h=>{h.target.closest(".sidebar-trigger")||(!i||!d.editor.canFitSidebar)&&f()},[f,i,d.editor.canFitSidebar])),M.useEffect(()=>{const h=m=>{m.key===z.ESCAPE&&(!i||!d.editor.canFitSidebar)&&f()};return document.addEventListener(te.KEYDOWN,h),()=>{document.removeEventListener(te.KEYDOWN,h)}},[f,i,d.editor.canFitSidebar]),g(Ys,{...s,className:me("sidebar",{"sidebar--docked":i},r),ref:u,children:g(q$.Provider,{value:c.current,children:t})})});vG.displayName="SidebarInner";const Uo=Object.assign(M.forwardRef((e,t)=>{var l;const n=fi(),{onStateChange:i}=e,r=M.useRef(n.openSidebar);M.useEffect(()=>{var c,u,d,f,h;(!n.openSidebar&&((c=r==null?void 0:r.current)==null?void 0:c.name)===e.name||((u=n.openSidebar)==null?void 0:u.name)===e.name&&((d=r==null?void 0:r.current)==null?void 0:d.name)!==e.name||((f=r.current)==null?void 0:f.name)===e.name)&&n.openSidebar!==r.current&&(i==null||i(((h=n.openSidebar)==null?void 0:h.name)!==e.name?null:n.openSidebar)),r.current=n.openSidebar},[n.openSidebar,i,e.name]);const[s,o]=M.useState(!1);return M.useLayoutEffect(()=>(o(!0),()=>o(!1)),[]),s&&((l=n.openSidebar)==null?void 0:l.name)===e.name?M.createElement(vG,{...e,ref:t,key:e.name}):null}),{Header:Q$,TabTriggers:UG,TabTrigger:bG,Tabs:yG,Tab:EG,Trigger:J$});Uo.displayName="Sidebar";const _G=qt({active:!1});async function JE({title:e,description:t,actionLabel:n,color:i}){return new Promise(r=>{Ns.set(_G,{active:!0,onConfirm:()=>r(!0),onClose:()=>r(!1),onReject:()=>r(!1),title:e,description:t,actionLabel:n,color:i})})}const wG=({value:e,shortcut:t,onChange:n,choices:i,children:r,name:s})=>{const o=Qn();return P(he,{children:[P("div",{className:"dropdown-menu-item-base dropdown-menu-item-bare",children:[g("label",{className:"dropdown-menu-item__text",htmlFor:s,children:r}),g(z$,{name:s,value:e,onChange:n,choices:i})]}),t&&!o.editor.isMobile&&g("div",{className:"dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned",children:t})]})};wG.displayName="DropdownMenuItemContentRadio";const TG=()=>{const{t:e}=mn(),t=vr(),n=P5();return t.isActionEnabled(HE)?g(Er,{icon:b9,onSelect:async()=>{(!n.length||await JE({title:e("overwriteConfirm.modal.loadFromFile.title"),actionLabel:e("overwriteConfirm.modal.loadFromFile.button"),color:"warning",description:g(gr,{i18nKey:"overwriteConfirm.modal.loadFromFile.description",bold:r=>g("strong",{children:r}),br:()=>g("br",{})})}))&&t.executeAction(HE)},"data-testid":"load-button",shortcut:Bi("loadScene"),"aria-label":e("buttons.load"),children:e("buttons.load")}):null};TG.displayName="LoadScene";const SG=()=>{const{t:e}=mn(),t=vr();return t.isActionEnabled(gM)?g(Er,{shortcut:Bi("saveScene"),"data-testid":"save-button",onSelect:()=>t.executeAction(gM),icon:Zte,"aria-label":`${e("buttons.save")}`,children:`${e("buttons.save")}`}):null};SG.displayName="SaveToActiveFile";const IG=()=>{const e=zn(),{t}=mn();return g(Er,{icon:FF,"data-testid":"image-export-button",onSelect:()=>e({openDialog:{name:"imageExport"}}),shortcut:Bi("imageExport"),"aria-label":t("buttons.exportImage"),children:t("buttons.exportImage")})};IG.displayName="SaveAsImage";const xG=e=>{const t=zn(),{t:n}=mn();return g(Er,{icon:WF,"data-testid":"command-palette-button",onSelect:()=>{ut("command_palette","open","menu"),t({openDialog:{name:"commandPalette"}})},shortcut:Bi("commandPalette"),"aria-label":n("commandPalette.title"),className:e==null?void 0:e.className,children:n("commandPalette.title")})};xG.displayName="CommandPalette";const CG=e=>{const{t}=mn(),n=vr();return g(Er,{icon:Zu,"data-testid":"search-menu-button",onSelect:()=>{n.executeAction(P$)},shortcut:Bi("searchMenu"),"aria-label":t("search.title"),className:e==null?void 0:e.className,children:t("search.title")})};CG.displayName="SearchMenu";const AG=()=>{const{t:e}=mn(),t=vr();return g(Er,{"data-testid":"help-menu-item",icon:p9,onSelect:()=>t.executeAction(O_),shortcut:"?","aria-label":e("helpDialog.title"),children:e("helpDialog.title")})};AG.displayName="Help";const MG=()=>{const{t:e}=mn(),t=z6(N5);return vr().isActionEnabled(n0)?g(Er,{icon:bc,onSelect:()=>t("clearCanvas"),"data-testid":"clear-canvas-button","aria-label":e("buttons.clearReset"),children:e("buttons.clearReset")}):null};MG.displayName="ClearCanvas";const RG=e=>{const{t}=mn(),n=fi(),i=vr(),r=Bi("toggleTheme");return i.isActionEnabled(Hb)?e!=null&&e.allowSystemTheme?g(wG,{name:"theme",value:e.theme,onChange:s=>e.onSelect(s),choices:[{value:xe.LIGHT,label:rE,ariaLabel:`${t("buttons.lightMode")} - ${r}`},{value:xe.DARK,label:iE,ariaLabel:`${t("buttons.darkMode")} - ${r}`},{value:"system",label:gie,ariaLabel:t("buttons.systemMode")}],children:t("labels.theme")}):g(Er,{onSelect:s=>{if(s.preventDefault(),e!=null&&e.onSelect)e.onSelect(n.theme===xe.DARK?xe.LIGHT:xe.DARK);else return i.executeAction(Hb)},icon:n.theme===xe.DARK?rE:iE,"data-testid":"toggle-dark-mode",shortcut:r,"aria-label":n.theme===xe.DARK?t("buttons.lightMode"):t("buttons.darkMode"),children:n.theme===xe.DARK?t("buttons.lightMode"):t("buttons.darkMode")}):null};RG.displayName="ToggleTheme";const kG=()=>{const{t:e}=mn(),t=fi(),n=vr(),i=ep();return t.viewModeEnabled||!i.UIOptions.canvasActions.changeViewBackgroundColor?null:P("div",{style:{marginTop:"0.5rem"},children:[g("div",{"data-testid":"canvas-background-label",style:{fontSize:".75rem",marginBottom:".5rem"},children:e("labels.canvasBackground")}),g("div",{style:{padding:"0 0.625rem"},children:n.renderAction("changeViewBackgroundColor")})]})};kG.displayName="ChangeCanvasBackground";const LG=()=>{const{t:e}=mn(),t=zn();return g(Er,{icon:W6,onSelect:()=>{t({openDialog:{name:"jsonExport"}})},"data-testid":"json-export-button","aria-label":e("buttons.export"),children:e("buttons.export")})};LG.displayName="Export";const DG=()=>{const{t:e}=mn();return P(he,{children:[g(r0,{icon:U9,href:"https://github.com/excalidraw/excalidraw","aria-label":"GitHub",children:"GitHub"}),g(r0,{icon:PF,href:"https://x.com/excalidraw","aria-label":"X",children:e("labels.followUs")}),g(r0,{icon:OF,href:"https://discord.gg/UexuTaE","aria-label":"Discord",children:e("labels.discordChat")})]})};DG.displayName="Socials";const NG=({onSelect:e,isCollaborating:t})=>{const{t:n}=mn();return g(Er,{"data-testid":"collab-button",icon:E9,className:me({"active-collab":t}),onSelect:e,children:n("labels.liveCollaboration")})};NG.displayName="LiveCollaborationTrigger";const k6e=Object.freeze(Object.defineProperty({__proto__:null,ChangeCanvasBackground:kG,ClearCanvas:MG,CommandPalette:xG,Export:LG,Help:AG,LiveCollaborationTrigger:NG,LoadScene:TG,SaveAsImage:IG,SaveToActiveFile:SG,SearchMenu:CG,Socials:DG,ToggleTheme:RG},Symbol.toStringTag,{value:"Module"})),qm=(e,t)=>{const n=qt(0),i=r=>{const{tunnelsJotai:{useAtom:s}}=ir(),[,o]=s(n),a=M.useRef({preferHost:!1,counter:0});return M.useLayoutEffect(()=>{const l=a.current;return o(c=>{const u=c+1;return l.counter=u,u}),()=>{o(c=>{const u=c-1;return l.counter=u,u||(l.preferHost=!1),u})}},[o]),r.__fallback||(a.current.preferHost=!0),!a.current.counter&&r.__fallback&&a.current.preferHost||a.current.counter>1&&r.__fallback?null:g(t,{...r})};return i.displayName=e,i},vt=Object.assign(qm("MainMenu",({children:e,onSelect:t})=>{var a;const{MainMenuTunnel:n}=ir(),i=Qn(),r=fi(),s=zn(),o=i.editor.isMobile?void 0:()=>s({openMenu:null});return g(n.In,{children:P(ot,{open:r.openMenu==="canvas",children:[g(ot.Trigger,{onToggle:()=>{s({openMenu:r.openMenu==="canvas"?null:"canvas"})},"data-testid":"main-menu-trigger",className:"main-menu-trigger",children:NF}),P(ot.Content,{onClickOutside:o,onSelect:G6(t,()=>{s({openMenu:null})}),children:[e,i.editor.isMobile&&r.collaborators.size>0&&P("fieldset",{className:"UserList-Wrapper",children:[g("legend",{children:L("labels.collaborators")}),g(K$,{mobile:!0,collaborators:r.collaborators,userToFollow:((a=r.userToFollow)==null?void 0:a.socketId)||null})]})]})]})})}),{Trigger:ot.Trigger,Item:ot.Item,ItemLink:ot.ItemLink,ItemCustom:ot.ItemCustom,Group:ot.Group,Separator:ot.Separator,DefaultItems:k6e}),G_=({title:e,children:t,actionLabel:n,onClick:i})=>P("div",{className:"OverwriteConfirm__Actions__Action",children:[g("h4",{children:e}),g("div",{className:"OverwriteConfirm__Actions__Action__content",children:t}),g(Ws,{variant:"outlined",color:"muted",label:n,size:"large",fullWidth:!0,onClick:i})]}),L6e=()=>{const{t:e}=mn(),t=vr(),n=zn();return g(G_,{title:e("overwriteConfirm.action.exportToImage.title"),actionLabel:e("overwriteConfirm.action.exportToImage.button"),onClick:()=>{t.executeAction(r$,"ui",!0),n({openDialog:{name:"imageExport"}})},children:e("overwriteConfirm.action.exportToImage.description")})},D6e=()=>{const{t:e}=mn(),t=vr();return g(G_,{title:e("overwriteConfirm.action.saveToDisk.title"),actionLabel:e("overwriteConfirm.action.saveToDisk.button"),onClick:()=>{t.executeAction(s$,"ui")},children:e("overwriteConfirm.action.saveToDisk.description")})},KM=Object.assign(({children:e})=>g("div",{className:"OverwriteConfirm__Actions",children:e}),{ExportToImage:L6e,SaveToDisk:D6e}),Tu=Object.assign(qm("OverwriteConfirmDialog",({children:e})=>{const{OverwriteConfirmDialogTunnel:t}=ir(),[n,i]=gn(_G);if(!n.active)return null;const r=()=>{n.onClose(),i(o=>({...o,active:!1}))},s=()=>{n.onConfirm(),i(o=>({...o,active:!1}))};return g(t.In,{children:g(Hr,{onCloseRequest:r,title:!1,size:916,children:P("div",{className:"OverwriteConfirm",children:[g("h3",{children:n.title}),P("div",{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[g("div",{className:"OverwriteConfirm__Description__icon",children:Zne}),g("div",{children:n.description}),g("div",{className:"OverwriteConfirm__Description__spacer"}),g(Ws,{color:n.color,size:"large",label:n.actionLabel,onClick:s})]}),g(KM,{children:e})]})})})}),{Actions:KM,Action:G_});var N6e="Expected a function",ZM=NaN,O6e="[object Symbol]",P6e=/^\s+|\s+$/g,F6e=/^[-+]0x[0-9a-f]+$/i,B6e=/^0b[01]+$/i,z6e=/^0o[0-7]+$/i,H6e=parseInt,V6e=typeof va=="object"&&va&&va.Object===Object&&va,$6e=typeof self=="object"&&self&&self.Object===Object&&self,G6e=V6e||$6e||Function("return this")(),X6e=Object.prototype,j6e=X6e.toString,Y6e=Math.max,W6e=Math.min,g7=function(){return G6e.Date.now()};function K6e(e,t,n){var i,r,s,o,a,l,c=0,u=!1,d=!1,f=!0;if(typeof e!="function")throw new TypeError(N6e);t=qM(t)||0,e4(n)&&(u=!!n.leading,d="maxWait"in n,s=d?Y6e(qM(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f);function h(R){var w=i,T=r;return i=r=void 0,c=R,o=e.apply(T,w),o}function m(R){return c=R,a=setTimeout(E,t),u?h(R):o}function p(R){var w=R-l,T=R-c,A=t-w;return d?W6e(A,s-T):A}function b(R){var w=R-l,T=R-c;return l===void 0||w>=t||w<0||d&&T>=s}function E(){var R=g7();if(b(R))return y(R);a=setTimeout(E,p(R))}function y(R){return a=void 0,f&&i?h(R):(i=r=void 0,o)}function v(){a!==void 0&&clearTimeout(a),c=0,i=l=r=a=void 0}function _(){return a===void 0?o:y(g7())}function I(){var R=g7(),w=b(R);if(i=arguments,r=this,l=R,w){if(a===void 0)return m(l);if(d)return a=setTimeout(E,t),h(l)}return a===void 0&&(a=setTimeout(E,t)),o}return I.cancel=v,I.flush=_,I}function e4(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Z6e(e){return!!e&&typeof e=="object"}function q6e(e){return typeof e=="symbol"||Z6e(e)&&j6e.call(e)==O6e}function qM(e){if(typeof e=="number")return e;if(q6e(e))return ZM;if(e4(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=e4(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(P6e,"");var n=B6e.test(e);return n||z6e.test(e)?H6e(e.slice(2),n?2:8):F6e.test(e)?ZM:+e}var Q6e=K6e;const J6e=sl(Q6e),e5e=qt(""),OG=qt(null),t5e=350,n5e=()=>{const e=oo(),t=zn(),n=M.useRef(null),[i,r]=gn(e5e),s=i.trim(),[o,a]=M.useState(!1),[l,c]=M.useState({nonce:null,items:[]}),u=M.useRef(null),d=M.useRef(void 0),[f,h]=gn(OG),m=e.scene.getNonDeletedElementsMap();M.useEffect(()=>{o||(s!==u.current||e.scene.getSceneNonce()!==d.current)&&(u.current=null,QM(s,e,(v,_)=>{c({nonce:Bo(),items:v}),u.current=s,d.current=e.scene.getSceneNonce(),t({searchMatches:v.map(I=>({id:I.textElement.id,focus:!1,matchedLines:I.matchedLines}))})}))},[o,s,m,e,t,h,d]);const p=()=>{l.items.length>0&&h(v=>v===null?0:(v+1)%l.items.length)},b=()=>{l.items.length>0&&h(v=>v===null?0:v-1<0?l.items.length-1:v-1)};M.useEffect(()=>{t(v=>({searchMatches:v.searchMatches.map((_,I)=>I===f?{..._,focus:!0}:{..._,focus:!1})}))},[f,t]),M.useEffect(()=>{var v,_,I,R;if(l.items.length>0&&f!==null){const w=l.items[f];if(w){const T=e.state.zoom.value,A=Br({text:w.searchQuery,x:w.textElement.x+(((v=w.matchedLines[0])==null?void 0:v.offsetX)??0),y:w.textElement.y+(((_=w.matchedLines[0])==null?void 0:_.offsetY)??0),width:(I=w.matchedLines[0])==null?void 0:I.width,height:(R=w.matchedLines[0])==null?void 0:R.height,fontSize:w.textElement.fontSize,fontFamily:w.textElement.fontFamily}),S=14,k=w.textElement.fontSize,N=k*T<S;if(!a2([A],e.canvas.width/window.devicePixelRatio,e.canvas.height/window.devicePixelRatio,{offsetLeft:e.state.offsetLeft,offsetTop:e.state.offsetTop,scrollX:e.state.scrollX,scrollY:e.state.scrollY,zoom:e.state.zoom},e.scene.getNonDeletedElementsMap(),e.getEditorUIOffsets())||N){let D;N?k>=S?D={fitToContent:!0}:D={fitToViewport:!0,maxZoom:Do(S/k,1)}:D={fitToContent:!0},e.scrollToContent(A,{animate:!0,duration:300,...D,canvasOffsets:e.getEditorUIOffsets()})}}}},[f,l,e]),M.useEffect(()=>()=>{h(null),u.current=null,d.current=void 0,t({searchMatches:[]}),a(!1)},[t,h]);const E=x5({goToNextItem:p,goToPreviousItem:b,searchMatches:l});M.useEffect(()=>{const v=_=>{var I,R,w;if(_.key===z.ESCAPE&&!e.state.openDialog&&!e.state.openPopup){_.preventDefault(),_.stopPropagation(),t({openSidebar:null});return}_[z.CTRL_OR_CMD]&&_.key===z.F&&(_.preventDefault(),_.stopPropagation(),(I=n.current)!=null&&I.matches(":focus")?t({openSidebar:null}):(e.state.openDialog&&t({openDialog:null}),(R=n.current)==null||R.focus(),(w=n.current)==null||w.select())),_.target instanceof HTMLElement&&_.target.closest(".layer-ui__search")&&E.searchMatches.items.length&&(_.key===z.ENTER&&(_.stopPropagation(),E.goToNextItem()),_.key===z.ARROW_UP?(_.stopPropagation(),E.goToPreviousItem()):_.key===z.ARROW_DOWN&&(_.stopPropagation(),E.goToNextItem()))};return Jt(window,te.KEYDOWN,v,{capture:!0,passive:!1})},[t,E,e]);const y=`${l.items.length} ${l.items.length===1?L("search.singleResult"):L("search.multipleResults")}`;return P("div",{className:"layer-ui__search",children:[g("div",{className:"layer-ui__search-header",children:g(Ah,{className:hh.SEARCH_MENU_INPUT_WRAPPER,value:i,ref:n,placeholder:L("search.placeholder"),icon:Zu,onChange:v=>{r(v),a(!0);const _=v.trim();QM(_,e,(I,R)=>{c({nonce:Bo(),items:I}),h(R),u.current=_,d.current=e.scene.getSceneNonce(),t({searchMatches:I.map(w=>({id:w.textElement.id,focus:!1,matchedLines:w.matchedLines}))}),a(!1)})},selectOnRender:!0})}),P("div",{className:"layer-ui__search-count",children:[l.items.length>0&&P(he,{children:[f!==null&&f>-1?P("div",{children:[f+1," / ",y]}):g("div",{children:y}),P("div",{className:"result-nav",children:[g(cd,{onSelect:()=>{p()},className:"result-nav-btn",children:QF}),g(cd,{onSelect:()=>{b()},className:"result-nav-btn",children:vie})]})]}),l.items.length===0&&s&&u.current&&g("div",{style:{margin:"1rem auto"},children:L("search.noMatch")})]}),g(o5e,{matches:l,onItemClick:h,focusIndex:f,searchQuery:s})]})},i5e=e=>{const t=[e.preview.moreBefore?"...":"",e.preview.previewText.slice(0,e.preview.indexInSearchQuery),e.preview.previewText.slice(e.preview.indexInSearchQuery,e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.previewText.slice(e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.moreAfter?"...":""];return g("div",{tabIndex:-1,className:me("layer-ui__result-item",{active:e.highlighted}),onClick:e.onClick,ref:n=>{e.highlighted&&(n==null||n.scrollIntoView({behavior:"auto",block:"nearest"}))},children:g("div",{className:"preview-text",children:t.flatMap((n,i)=>g(M.Fragment,{children:i===2?g("b",{children:n}):n},i))})})},r5e=e=>g("div",{className:"layer-ui__search-result-container",children:e.matches.items.map((t,n)=>g(i5e,{searchQuery:e.searchQuery,preview:t.preview,highlighted:n===e.focusIndex,onClick:()=>e.onItemClick(n)},t.textElement.id+t.index))}),s5e=(e,t)=>e.matches.nonce===t.matches.nonce&&e.focusIndex===t.focusIndex,o5e=M.memo(r5e,s5e),a5e=(e,t,n)=>{const s=e.slice(0,t),o=s.split(/\s+/),a=s.endsWith(" "),l=o.length-2-1-(a?0:1);let c=o.slice(l<=0?0:l).join(" ")+(a?" ":"");c=c.length>20?c.slice(-20):c;const d=e.slice(t+n.length),f=d.split(/\s+/),h=!d.startsWith(" "),m=h?6:5,p=(h?"":" ")+f.slice(0,m).join(" ");return{indexInSearchQuery:c.length,previewText:c+n+p,moreBefore:l>0,moreAfter:f.length>m}},l5e=(e,t)=>{const n=e.split(`
`),i=[];let r=0;for(let s=0;s<n.length;s++){let o=n[s];const a=n[s+1];if(a){const l=t.indexOf(a,r);if(l>o.length+r){let c=l-(o.length+r);for(;c>0;)o+=" ",c--}}i.push(o),r=r+o.length}return i.join(`
`)},c5e=(e,t,n)=>{const r=l5e(e.text,e.originalText).split(`
`),s=[];let o=0,a=0;for(const d of r){const f=o,h=f+d.length-1;s.push({line:d,startIndex:f,endIndex:h,lineNumber:a}),o=h+1,a++}let l=n,c=e.originalText.slice(n,n+t.length);const u=[];for(const d of s){if(c==="")break;if(l>=d.startIndex&&l<=d.endIndex){const f=d.endIndex+1-l,h=d.line.slice(0,l-d.startIndex),m=c.slice(0,f);c=c.slice(f);const p=zi(h,xt(e),e.lineHeight);if(h===""&&(p.width=0),e.textAlign!=="left"&&d.line.length>0){const _=zi(d.line,xt(e),e.lineHeight),I=e.textAlign==="center"?(e.width-_.width)/2:e.width-_.width;p.width+=I}const{width:b,height:E}=zi(m,xt(e),e.lineHeight),y=p.width,v=d.lineNumber*p.height;u.push({offsetX:y,offsetY:v,width:b,height:E}),l+=f}}return u},u5e=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&"),QM=J6e((e,t,n)=>{if(!e||e===""){n([],null);return}const r=t.scene.getNonDeletedElements().filter(c=>de(c));r.sort((c,u)=>c.y-u.y);const s=[],o=new RegExp(u5e(e),"gi");for(const c of r){let u=null;const d=c.originalText;for(;(u=o.exec(d))!==null;){const f=a5e(d,u.index,e),h=c5e(c,e,u.index);h.length>0&&s.push({textElement:c,searchQuery:e,preview:f,index:u.index,matchedLines:h})}}const a=new Set(t.visibleElements.map(c=>c.id)),l=s.findIndex(c=>a.has(c.textElement.id))??null;n(s,l)},t5e),PG=qm("DefaultSidebarTrigger",e=>{const{DefaultSidebarTriggerTunnel:t}=ir();return g(t.In,{children:g(Uo.Trigger,{...e,className:"default-sidebar-trigger",name:ls.name})})});PG.displayName="DefaultSidebarTrigger";const FG=({children:e})=>{const{DefaultSidebarTabTriggersTunnel:t}=ir();return g(t.In,{children:e})};FG.displayName="DefaultTabTriggers";const JM=Object.assign(qm("DefaultSidebar",({children:e,className:t,onDock:n,docked:i,...r})=>{var c;const s=fi(),o=zn(),{DefaultSidebarTabTriggersTunnel:a}=ir(),l=((c=s.openSidebar)==null?void 0:c.tab)===ku;return M.createElement(Uo,{...r,name:"default",key:"default",className:me("default-sidebar",t),docked:l||(i??s.defaultSidebarDockedPreference),onDock:l||n===!1||!n&&i!=null?void 0:G6(n,u=>{o({defaultSidebarDockedPreference:u})})},P(Uo.Tabs,{children:[g(Uo.Header,{children:P(Uo.TabTriggers,{children:[g(Uo.TabTrigger,{tab:ku,children:Zu}),g(Uo.TabTrigger,{tab:Q2,children:g9}),g(a.Out,{})]})}),g(Uo.Tab,{tab:Q2,children:g(X2e,{})}),g(Uo.Tab,{tab:ku,children:g(n5e,{})}),e]}))}),{Trigger:PG,TabTriggers:FG}),d5e="small",f5e=e=>P("label",{className:me("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${d5e}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[g("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-LaserPointer"}),g("div",{className:"ToolIcon__icon",children:jF})]}),h5e=e=>{const[t,n]=M.useState(!0);return M.useEffect(()=>{const i=async()=>{await BP(r),n(!1)},r=H6.find(s=>s.code===e.langCode)||Sd;i()},[e.langCode]),t?g(X$,{theme:e.theme}):e.children},BG=({children:e})=>{const{FooterCenterTunnel:t}=ir(),n=fi();return g(t.In,{children:g("div",{className:me("footer-center zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})};BG.displayName="FooterCenter";const g5e=()=>g("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ExcalidrawLogo-icon",children:g("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),m5e=()=>P("svg",{viewBox:"0 0 450 55",xmlns:"http://www.w3.org/2000/svg",fill:"none",className:"ExcalidrawLogo-text",children:[g("path",{d:"M429.27 96.74c2.47-1.39 4.78-3.02 6.83-4.95 1.43-1.35 2.73-2.86 3.81-4.51-.66.9-1.4 1.77-2.23 2.59-2.91 2.84-5.72 5.09-8.42 6.87h.01ZM343.6 69.36c.33 3.13.58 6.27.79 9.4.09 1.37.18 2.75.25 4.12-.12-4.46-.27-8.93-.5-13.39-.11-2.08-.24-4.16-.4-6.24-.06 1.79-.11 3.85-.13 6.11h-.01ZM378.47 98.34c.01-.37.07-1.13.01-6.51-.11 1.9-.22 3.81-.31 5.71-.07 1.42-.22 2.91-.16 4.35.39.03.78.07 1.17.1-.92-.85-.76-2.01-.72-3.66l.01.01ZM344.09 86.12c-.09-2.41-.22-4.83-.39-7.24v12.21c.15-.05.32-.09.47-.14.05-1.61-.03-3.23-.09-4.83h.01ZM440.69 66.79c-.22-.34-.45-.67-.69-.99-3.71-4.87-9.91-7.14-15.65-8.55-1.05-.26-2.12-.49-3.18-.71 2.29.59 4.48 1.26 6.64 2.02 7.19 2.54 10.57 5.41 12.88 8.23ZM305.09 72.46l1.2 3.6c.84 2.53 1.67 5.06 2.46 7.61.24.78.5 1.57.73 2.36.22-.04.44-.08.67-.12a776.9 776.9 0 0 1-5.01-13.57c-.02.04-.03.09-.05.13v-.01ZM345.49 90.25v.31c1.48-.42 3.05-.83 4.66-1.2-1.56.25-3.12.52-4.66.89ZM371.02 90.22c0-.57-.04-1.14-.11-1.71-.06-.02-.12-.04-.19-.05-.21-.05-.43-.08-.65-.11.42.16.74.88.95 1.87ZM398.93 54.23c-.13 0-.27-.01-.4-.02l.03.4c.11-.15.23-.27.37-.38ZM401.57 62.28v-.15c-1.22-.24-2.86-.61-3.23-1.25-.09-.15-.18-.51-.27-.98-.09.37-.2.73-.33 1.09 1.24.56 2.52.98 3.83 1.29ZM421.73 88.68c-2.97 1.65-6.28 3.12-9.69 3.68v.18c4.72-.14 11.63-3.85 16.33-8.38-2.04 1.75-4.33 3.24-6.63 4.53l-.01-.01ZM411.28 80.92c-.05-1.2-.09-2.4-.15-3.6-.21 5.66-.46 11.38-.47 14.51.24-.02.48-.04.71-.07.15-3.61.05-7.23-.09-10.83v-.01Z",transform:"translate(-144.023 -51.76)"}),g("path",{d:"M425.38 67.41c-3.5-1.45-7.19-2.57-14.06-3.62.09 1.97.06 4.88-.03 8.12.03.04.06.09.06.15.19 1.36.28 2.73.37 4.1.25 3.77.39 7.55.41 11.33 0 1.38-.01 2.76-.07 4.13 1.4-.25 2.78-.65 4.12-1.15 4.07-1.5 7.94-3.78 11.28-6.54 2.33-1.92 5.13-4.49 5.88-7.58.63-3.53-2.45-6.68-7.97-8.96l.01.02ZM411.35 92.53v-.06l-.34.03c.11.01.22.03.34.03ZM314.26 64.06c-.23-.59-.47-1.17-.7-1.75.57 1.62 1.11 3.25 1.6 4.9l.15.54 2.35 6.05c.32.82.66 1.64.98 2.46-1.38-4.1-2.83-8.17-4.39-12.2h.01ZM156.82 103.07c-.18.13-.38.23-.58.33 1.32-.03 2.66-.2 3.93-.34.86-.09 1.72-.22 2.58-.33-2.12.1-4.12.17-5.94.34h.01ZM210.14 68.88s.03.04.05.07c.18-.31.39-.64.58-.96-.21.3-.42.6-.64.89h.01ZM201.65 82.8c-.5.77-1.02 1.56-1.49 2.37 1.11-1.55 2.21-3.1 3.2-4.59-.23.23-.49.51-.75.79-.32.47-.65.95-.96 1.43ZM194.03 98.66c-.33-.4-.65-.84-1.05-1.17-.24-.2-.07-.49.17-.56-.23-.26-.42-.5-.63-.75 1.51-2.55 3.93-5.87 6.4-9.28-.17-.08-.29-.28-.2-.49.04-.09.09-.17.13-.26-1.21 1.78-2.42 3.55-3.61 5.33-.87 1.31-1.74 2.64-2.54 4-.29.5-.63 1.04-.87 1.61.81.65 1.63 1.27 2.47 1.88-.09-.11-.18-.21-.27-.32v.01ZM307.79 82.93c-1-3.17-2.05-6.32-3.1-9.48-1.62 4.08-3.69 9.17-6.16 15.19 3.32-1.04 6.77-1.87 10.27-2.5-.32-1.08-.67-2.15-1.01-3.21ZM149.5 80.7c.05-1.71.04-3.43 0-5.14-.1 2.26-.16 4.51-.22 6.77-.02.73-.03 1.46-.04 2.19.14-1.27.2-2.55.24-3.82h.02ZM228.98 98.3c.39 1.25.91 3.03.94 3.91.06-.03.12-.07.17-.1.08-1.29-.55-2.65-1.11-3.81ZM307.72 53.36c.81.5 1.53 1.04 2.07 1.49-.38-.8-.78-1.58-1.21-2.35-.17.03-.34.06-.51.11-.43.12-.86.26-1.29.41.35-.01.53.1.94.34ZM283.69 96.14c3.91-7.25 6.89-13.35 8.88-18.15l1.1-2.66c-1.27 2.64-2.56 5.27-3.83 7.9-1.53 3.15-3.06 6.31-4.58 9.47-.87 1.81-1.76 3.62-2.54 5.47.04.02.07.04.11.07.05.05.1.09.15.14.05-.73.27-1.48.71-2.24ZM289.92 103.23s-.04.01-.05.03c0-.02.04-.03.05-.04.05-.05.11-.1.16-.15l.21-.21c-.55 0-1.5-.27-2.55-.72.4.26.8.51 1.22.74.24.13.48.26.73.37.05.02.1.03.14.05a.27.27 0 0 1 .08-.07h.01ZM269.23 68.49c-.39-.19-.82-.48-1.33-.87-3.06-1.56-6.31-2.78-9.36-2.35-3.5.49-5.7 1.11-7.74 2.44 5.71-2.6 12.82-2.07 18.44.79l-.01-.01ZM177.87 53.69l1.06.03c-.96-.22-2-.25-2.89-.3-4.95-.26-9.99.33-14.86 1.19-2.44.43-4.88.95-7.28 1.59 9.09-1.76 15.69-2.77 23.97-2.51ZM219.85 55.51c-.18.12-.36.27-.56.45-.45.53-.86 1.11-1.26 1.66-1.91 2.61-3.71 5.31-5.57 7.95l-.12.18 8.05-10.11c-.18-.05-.36-.1-.55-.13h.01ZM510.71 54.1c.12-.15.29-.3.53-.45.69-.4 3.72-.63 5.87-.74-.36-.02-.73-.04-1.09-.05-1.84-.03-3.67.09-5.49.35.05.3.12.59.18.88v.01ZM510.76 86.02c1.37-3.07 2.49-6.27 3.57-9.46.55-1.64 1.12-3.3 1.6-4.97-1.59 4.01-3.67 9.14-6.2 15.3.24-.08.5-.14.74-.22.1-.22.19-.44.29-.65ZM566.95 75.76c.11-.02.23.03.31.11-.05-.13-.09-.26-.14-.39-.05.09-.11.18-.17.28ZM511.33 86.41c3.08-.89 6.24-1.62 9.46-2.14-1.51-3.98-2.98-7.96-4.39-11.87-.05.15-.09.31-.14.46-1.02 3.32-2.15 6.61-3.39 9.85-.48 1.25-.98 2.49-1.53 3.7h-.01ZM578.24 74.45c.11-.44.23-.87.35-1.31-.31.7-.64 1.39-.97 2.08.09.21.19.4.28.61.12-.46.23-.92.35-1.38h-.01ZM520.62 53.11c-.09 0-.18-.01-.28-.02.38.34.29 1.08.93 2.53l6.65 17.15c2.2 5.68 4.69 11.36 7.41 16.87l1.06 2.17c-2.95-7.05-5.92-14.08-8.87-21.13-1.58-3.79-3.16-7.59-4.7-11.4-.78-1.92-1.73-3.89-2.25-5.91-.03-.1 0-.19.04-.26h.01ZM578.78 77.87c1.45-5.77 3.07-10.43 3.58-13.36.05-.34.16-.88.31-1.55-.67 1.79-1.37 3.56-2.08 5.33-.12.43-.23.86-.35 1.29-.65 2.43-1.29 4.86-1.9 7.3.14.33.29.65.43 1l.01-.01ZM545.3 94.66c.02-.44.03-.83.05-1.12.02-1.01.05-2.02.11-3.02.03-6.66-.46-14.33-1.46-22.8-.13-.42-.27-1.24-.56-2.89 0-.02 0-.04-.01-.06.62 6.61.95 13.25 1.32 19.87.17 3.08.33 6.16.52 9.23.02.25.03.52.04.78l-.01.01ZM580.77 102.81c.13.2.27.38.37.49.27-.11.53-.22.8-.32-.43.09-.82.05-1.17-.16v-.01ZM530.48 104.07h.33c-.36-.13-.71-.32-1.04-.56.14.24.3.47.45.7.06-.08.14-.13.26-.13v-.01ZM542.63 58.82c.06.23.11.47.15.71.14-.33.36-.62.7-.86-.28.05-.57.11-.85.15ZM583.81 57.87c.15-.7.29-1.41.42-2.11-.14.45-.28.9-.42 1.34-.46 1.44-.89 2.89-1.31 4.34.44-1.19.88-2.37 1.31-3.57ZM523.62 91.48c-4.66 1.17-9.05 2.89-14.02 5.27 4.65-1.84 9.48-3.29 14.28-4.63-.09-.22-.17-.41-.26-.64ZM460.64 78.3c-.04-2.9-.11-5.81-.28-8.71-.1-1.68-.17-3.43-.5-5.09-.07.02-.14.03-.2.05.3 6.54.45 12.17.51 17.12.17-.07.34-.14.51-.2 0-1.06-.01-2.11-.03-3.17h-.01ZM470.63 63.24c-3.38-.26-6.81.32-10.1 1.1.41 2.01.47 4.14.57 6.18.18 3.55.25 7.11.27 10.67 3.31-1.38 6.5-3.12 9.3-5.35 1.96-1.56 3.86-3.41 5.02-5.66.73-1.41 1.19-3.22.26-4.65-1.09-1.7-3.46-2.14-5.32-2.29ZM460.29 63.68c1-.24 2.01-.46 3.04-.65-1.15.16-2.37.38-3.71.69v.13c.07-.02.15-.04.22-.05.11-.13.3-.18.45-.11v-.01ZM457.24 100.96c.43-.03.86-.07 1.29-.11.14-.49.27-.99.38-1.49-.44.7-1 1.23-1.67 1.6ZM482.88 104.98c-.18.23-.36.38-.55.47.14.09.27.19.4.28a70.76 70.76 0 0 0 4.37-4.63c.76-.89 1.52-1.81 2.19-2.77-.3-.27-.61-.53-.92-.79-.07 1.94-4.62 6.32-5.49 7.45v-.01Z",transform:"translate(-144.023 -51.76)"}),g("path",{d:"M474.36 63.31c-.4-.16-.84-.27-1.29-.37 1.56.42 3.08 1.22 3.76 2.74.62 1.4.32 2.95-.28 4.32.7-1.22.94-2.34.74-3.47-.24-1.33-1.19-2.54-2.93-3.21v-.01ZM477.34 89.18c-1.2-.81-2.4-1.62-3.6-2.42-.14.1-.26.19-.4.29 1.4.67 2.73 1.39 4 2.13ZM465.88 93.85c.37.25.74.5 1.1.75.46.32.92.65 1.38.97-1.57-1.2-2.01-1.61-2.49-1.72h.01ZM574.92 90.06c-2.28-5.21-4.93-11.13-5.67-12.26-.1-.15-1.57-3.01-1.63-3.08 0 0-.01.02-.02.02.4 1.37 1.09 2.69 1.65 3.99 2.14 4.95 4.36 9.86 6.67 14.73.6 1.26 1.21 2.52 1.83 3.78-.75-2.01-1.64-4.45-2.83-7.18ZM448.73 65.29c.1.2.22.38.34.57.22-.02.43-.06.65-.08v-.08c-.14-.05-.25 0-.99-.41ZM460.16 94.81c-.02.31-.06.59-.1.89-.03 1.71-.33 3.43-.79 5.07.15-.02.3-.03.45-.05.01-.04.02-.08.03-.11.09-.34.15-.69.2-1.03.17-1.07.25-2.16.33-3.24.05-.69.08-1.39.12-2.08-.27.1-.27.26-.24.57v-.02Z",transform:"translate(-144.023 -51.76)"}),g("path",{d:"m328.67 98.12-3.22-6.58c-1.29-2.63-2.53-5.29-3.72-7.97-.25-.85-.52-1.69-.79-2.53-.81-2.57-1.67-5.12-2.55-7.67-1.92-5.53-3.9-11.08-6.32-16.41-.72-1.58-1.46-3.44-2.63-4.79-.03-.17-.16-.29-.34-.36a.282.282 0 0 0-.23-.04c-.06-.01-.12 0-.18.01-.74.06-1.5.38-2.19.61-2.22.77-4.4 1.64-6.63 2.38-.03-.08-.06-.16-.09-.25-.15-.42-.82-.24-.67.19.03.09.07.19.1.28l-.18.06c-.36.11-.28.6 0 .68.18 1.18.63 2.36.98 3.49.03.09.06.17.08.26-.08.23-.17.46-.24.64-.37.98-.79 1.94-1.21 2.9-1.27 2.89-2.62 5.75-3.98 8.6-3.18 6.67-6.44 13.31-9.64 19.97-1.08 2.25-2.2 4.5-3.15 6.81-.13.32.24.5.5.37 1.34 1.33 2.84 2.5 4.4 3.57.65.44 1.31.87 2.01 1.24.4.22.86.48 1.33.5.24.01.35-.19.33-.37.11-.1.21-.21.28-.28.41-.41.81-.84 1.2-1.26.85-.92 1.69-1.87 2.5-2.84 6.31-2.34 12.6-4.31 18.71-5.84 2.14 5.3 3.43 8.43 3.97 9.58.55 1.05 1.15 1.88 1.82 2.52 1.32.56 6.96-.03 9.23-1.96.87-1.28 1.19-2.67.93-4.15-.09-.5-.22-.95-.4-1.33l-.01-.03Zm-20.09-45.61c.43.77.83 1.56 1.21 2.35-.54-.45-1.27-.99-2.07-1.49-.42-.24-.6-.35-.94-.34.43-.15.85-.29 1.29-.41.17-.05.34-.08.51-.11Zm-25.86 45.66c.78-1.85 1.67-3.66 2.54-5.47 1.51-3.16 3.05-6.31 4.58-9.47 1.28-2.63 2.56-5.26 3.83-7.9l-1.1 2.66c-1.99 4.79-4.97 10.9-8.88 18.15-.43.76-.66 1.51-.71 2.24-.05-.05-.1-.09-.15-.14a.259.259 0 0 0-.11-.07Zm6.24 4.71c-.42-.23-.82-.48-1.22-.74 1.05.45 2 .72 2.55.72l-.21.21c-.05.05-.11.1-.16.15-.01.01-.04.03-.05.04 0-.02.03-.02.05-.03a.27.27 0 0 0-.08.07c-.05-.02-.1-.03-.14-.05-.25-.1-.49-.24-.73-.37h-.01Zm15.73-29.43c1.05 3.15 2.1 6.31 3.1 9.48.34 1.06.69 2.13 1.01 3.21-3.5.63-6.95 1.46-10.27 2.5 2.48-6.03 4.54-11.11 6.16-15.19Zm4.79 12.57c-.23-.79-.49-1.58-.73-2.36-.79-2.54-1.63-5.08-2.46-7.61l-1.2-3.6c.02-.04.04-.09.05-.13 1.6 4.45 3.28 9 5.01 13.57l-.67.12v.01Zm5.83-18.27-.15-.54c-.49-1.64-1.03-3.28-1.6-4.9.23.58.47 1.17.7 1.75 1.56 4.03 3.01 8.1 4.39 12.2-.33-.82-.67-1.64-.98-2.46l-2.35-6.05h-.01ZM390.43 79.37c-.13-10.43-.22-17.5-.24-19.97-.24-1.6.21-2.88-.65-3.65-.14-.13-.32-.23-.52-.32h.03c.45 0 .45-.69 0-.7-1.75-.03-3.5-.04-5.25-.14-1.38-.08-2.76-.21-4.15-.31-.07 0-.12.01-.17.04-.21-.07-.47.03-.45.31l.03.45c-.11.14-.19.3-.22.5-.21 1.26-.32 13.67-.36 23.59-.32 5.79-.67 11.57-.97 17.36-.09 1.73-.29 3.54-.21 5.3-.39.02-.38.64.04.69v.12c.05.44.74.45.7 0v-.06c1.1.09 2.2.21 3.3.3 1.14.19 2.44.2 3.29.17 1.73-.05 2.92-.05 3.8-.37.45-.05.9-.11 1.35-.17.44-.06.25-.73-.19-.67h-.01c.24-.32.45-.72.62-1.25.66-1.84.41-6.36.34-11.33l-.13-9.9.02.01Zm-12.26 18.17c.09-1.91.2-3.81.31-5.71.06 5.38 0 6.14-.01 6.51-.05 1.65-.21 2.81.72 3.66-.39-.04-.78-.07-1.17-.1-.06-1.44.09-2.93.16-4.35l-.01-.01ZM588.97 53.85c-2.06-.25-3.17-.51-3.76-.6a.3.3 0 0 1 .04-.08c.22-.39-.39-.75-.6-.35-.56 1.02-.9 2.19-1.26 3.29-.61 1.88-1.17 3.78-1.72 5.68-.63 2.19-1.24 4.39-1.83 6.59-.81 2.03-1.67 4.05-2.61 6.03-1.7-3.64-3.11-6.04-4.03-7.57-2.26-3.74-2.85-5.48-3.57-6.08l.31-.09c.43-.12.25-.8-.19-.67-1.06.3-2.12.6-3.17.95-.93.32-1.85.69-2.76 1.07-.13.05-.19.16-.22.27-.04.02-.08.05-.11.07-.04-.06-.07-.12-.11-.18a.354.354 0 0 0-.48-.12c-.16.09-.22.32-.13.48l.33.54c0 .09.02.18.06.28.51 1.16.78 1.38.72 1.47-2.42 3.44-5.41 7.86-6.2 9.1-1.27 1.97-2.01 3.14-2.45 3.84l-.91-6.56-.43-4.1c-.19-1.85-.37-3.23-.53-4.13-.19-1.1-.3-2.15-.45-3.16-.2-1.36-.29-2.06-.47-2.42h.04c.45.02.45-.68 0-.7-3.43-.16-6.81.94-10.17 1.48-.24-.22-.73-.04-.58.32.24.59.33 1.25.43 1.87.17 1.06.29 2.13.4 3.2.32 3.09.53 6.2.74 9.3.44 6.75.77 13.51 1.17 20.26.11 1.95.13 3.96.46 5.89.05.3.37.31.55.14.74 1.71 2.87 1.27 6.13 1.27 1.34 0 2.39.04 2.99-.11.02.32.48.53.63.18 3.61-8.26 7.41-16.46 12.05-24.2.03-.05.04-.1.05-.15.3.73.64 1.45.94 2.16.97 2.26 1.97 4.52 2.98 6.76 2.26 5.03 4.54 10.07 7.09 14.96.47.9.94 1.79 1.47 2.65.2.32.4.67.66.96-.18.25 0 .68.34.54.91-.38 1.82-.75 2.76-1.07 1.04-.35 2.11-.65 3.17-.95.39-.11.28-.66-.07-.68.62-.4.95-.96.87-1.91-.3-3.34.72-7.47.86-8.52l2.14-11.43c1.75-10.74 3.13-17.51 3.23-20.86.02-.49.08-2.84.13-3.24.17-1.25.48-1-4.96-1.65l.03-.02Zm-46.19 5.67c-.04-.24-.09-.48-.15-.71l.85-.15c-.34.24-.56.53-.7.86Zm1.95 25.12c-.36-6.63-.7-13.26-1.32-19.87 0 .02 0 .04.01.06.29 1.65.44 2.47.56 2.89 1 8.46 1.5 16.14 1.46 22.8-.06.99-.1 2-.11 3.02-.01.29-.03.68-.05 1.12-.01-.26-.03-.53-.04-.78-.19-3.08-.35-6.16-.52-9.23l.01-.01Zm36.4 18.66c-.11-.11-.24-.29-.37-.49.35.21.74.26 1.17.16-.27.11-.53.22-.8.32v.01Zm-.89-33.72c.12-.43.23-.86.35-1.29.71-1.77 1.41-3.55 2.08-5.33-.15.68-.26 1.22-.31 1.55-.5 2.94-2.13 7.59-3.58 13.36-.15-.35-.29-.66-.43-1 .61-2.44 1.25-4.87 1.9-7.3l-.01.01Zm3.56-12.48c.14-.44.28-.89.42-1.34-.13.7-.27 1.41-.42 2.11-.43 1.19-.86 2.38-1.31 3.57.42-1.45.85-2.9 1.31-4.34Zm-5.22 16.05c-.11.44-.23.87-.35 1.31-.12.46-.23.92-.35 1.38-.1-.22-.19-.4-.28-.61.34-.69.66-1.38.97-2.08h.01Zm-11.64 2.62c.06-.1.12-.19.17-.28.05.13.09.26.14.39a.398.398 0 0 0-.31-.11Zm2.3 2.98c-.56-1.3-1.25-2.63-1.65-3.99 0 0 .01-.02.02-.02.06.08 1.52 2.93 1.63 3.08.73 1.13 3.38 7.04 5.67 12.26 1.2 2.73 2.08 5.17 2.83 7.18-.62-1.25-1.23-2.51-1.83-3.78-2.31-4.87-4.53-9.78-6.67-14.73ZM275.92 87.03c-1.06-2.18-1.13-3.45-2.44-2.93-1.52.57-2.94 1.3-4.5 2.1-1.4.72-2.68 1.44-3.92 2.12.01-.25-.24-.5-.51-.34-4.8 2.93-12.41 4.7-17.28 1.31-1.98-1.77-3.32-4.15-3.97-5.78-.29-.95-.49-1.94-.63-2.93-.14-3.34 1.58-6.53 3.9-9.12.8-.79 1.68-1.51 2.66-2.12 3.7-2.3 8.22-3.07 12.51-2.51 2.71.35 5.32 1.24 7.71 2.55.39.22.75-.39.35-.6-.18-.1-.37-.18-.55-.27.56.27 1.03.33 1.51.19l-.48.39c-.15.11-.23.3-.13.48.09.15.33.24.48.13 1.3-.97 2.46-2.09 3.45-3.37.37-.29.64-.6.65-.97v-.02c.08-.33-.03-.7-.21-1.08-.31-.87-.98-2.01-2.19-3.26-2.43-2.52-3.79-3.45-5.68-4.26-1.14-.49-3.12-1.06-4.42-1.23-3.28-.42-10.64-1.21-18.18 4.11-7.74 5.46-11.94 12.3-12.23 20.61-.08 2.06.04 3.98.34 5.71.74 4.18 2.57 8 5.44 11.34 4.26 4.99 9.76 7.52 16.34 7.52 4.85 0 9.69-1.77 14.89-4.62.23-.12.45-.23.68-.35 2.19-1.1 4.37-2.23 6.46-3.5.49-.3 1.03-.61 1.5-.98 1.47-.87 1.11-1.12.49-2.95-.39-1.14-.76-2.7-2.06-5.36l.02-.01Zm-17.38-21.76c3.05-.42 6.31.79 9.36 2.35.51.39.94.68 1.33.87-5.61-2.86-12.72-3.39-18.44-.79 2.05-1.33 4.24-1.95 7.74-2.44l.01.01ZM443.67 72.67c-.4-2.2-1.15-4.33-2.37-6.22-1.49-2.32-3.58-4.19-5.91-5.64-6.17-3.81-13.75-5.11-20.83-6.01-3.23-.41-6.47-.69-9.72-.92l-1.39-.12c-.85-.07-1.52-.1-2.05-.1-1.08-.06-2.17-.12-3.25-.17-.08 0-.14.02-.19.05-.1.05-.18.14-.16.3.27 2.55-.01 5.12-.92 7.52-.15.38.4.56.62.28 1.32.59 2.68 1.05 4.08 1.37 0 2.78-.14 7.58-.33 12.91 0 0 0 .02-.01.03-.61 3.66-.79 7.42-1 11.12-.23 4.01-.43 8.03-.44 12.05 0 .64 0 1.28.03 1.93.02.31 0 .68.15.96.06.11.14.16.24.17-.2.17-.21.54.11.59 3.83.67 7.78.71 11.68.25 2.3-.19 4.87-.65 7.65-1.56 1.85-.54 3.67-1.18 5.43-1.91 7.2-3.02 14.31-8.07 17.35-15.53.76-1.86 1.17-3.8 1.31-5.75.3-1.93.28-3.82-.09-5.58l.01-.02Zm-19.32-15.42c5.74 1.41 11.94 3.68 15.65 8.55.25.32.47.65.69.99-2.3-2.82-5.68-5.69-12.88-8.23-2.16-.76-4.35-1.43-6.64-2.02 1.06.21 2.13.45 3.18.71Zm-25.82-3.04c.13 0 .27.01.4.02-.14.1-.26.23-.37.38 0-.13-.02-.26-.03-.4Zm34.82 22.17c-.75 3.09-3.55 5.66-5.88 7.58-3.35 2.76-7.21 5.03-11.28 6.54-1.33.49-2.71.9-4.12 1.15.06-1.38.08-2.76.07-4.13-.02-3.78-.16-7.56-.41-11.33-.09-1.37-.18-2.74-.37-4.1 0-.06-.03-.11-.06-.15.09-3.25.12-6.16.03-8.12 6.86 1.05 10.56 2.17 14.06 3.62 5.52 2.28 8.59 5.44 7.97 8.96l-.01-.02Zm-22 16.15c-.12 0-.23-.02-.34-.03l.34-.03v.06Zm-.69-.7c0-3.13.26-8.84.47-14.51.06 1.2.11 2.41.15 3.6.15 3.6.25 7.23.09 10.83-.24.03-.48.05-.71.07v.01Zm-12.33-30.94c.37.63 2.01 1.01 3.23 1.25v.15c-1.31-.31-2.59-.73-3.83-1.29.12-.36.23-.72.33-1.09.08.48.18.84.27.98Zm13.7 31.65v-.18c3.41-.56 6.71-2.02 9.69-3.68 2.31-1.28 4.59-2.78 6.63-4.53-4.69 4.53-11.61 8.24-16.33 8.38l.01.01Zm24.07-.75c-2.05 1.93-4.37 3.56-6.83 4.95 2.7-1.78 5.52-4.03 8.42-6.87.82-.82 1.56-1.69 2.23-2.59-1.08 1.65-2.38 3.16-3.81 4.51h-.01ZM187.16 92.14c-.79-2.47-2.1-7.12-3.1-6.87-.19-.01-2.09.77-4.08 1.54-3.06 1.18-5.91 2.13-10.09 2.82-2.74.42-5.87 1.01-10.61 1.06.04-3.34.05-6.01.05-7.99 7.97-.65 12.33-2.11 16.37-3.55 1.11-.39 2.69-1.01 2.63-1.8-.08-.35-.55-1.39-1.17-2.61-.47-1.16-.98-2.31-1.61-3.38-.42-.71-1.04-1.69-1.86-2.06-.11-.08-.22-.13-.29-.12-.02 0-.04 0-.07.01-.19-.04-.39-.05-.6-.01-.17.03-.24.15-.25.28-.04.02-.09.04-.14.05-4.33 1.48-8.85 2.33-13.24 3.61a499.1 499.1 0 0 0-.31-8.19c4.51-.99 8.88-1.38 13.11-1.82 3.68-.38 6.28.12 7.47.34.59.11.9.16 1.16.18h.1c-.1.37.44.66.62.28.02-.04.03-.08.05-.13.15.2.53.22.62-.1.17-.58.19-1.21.21-1.81v-.36c.03-.15.05-.3.07-.45.52-2.47.33-5.09-.64-7.44-.11-.27-.44-.28-.6-.14-.08-.21-.15-.42-.24-.62-.19-.41-.79-.05-.6.35.03.07.05.15.09.22-.98-.42-2.15-.54-3.17-.63-2.17-.19-4.37-.14-6.54 0-5.7.35-11.4 1.3-16.91 2.79-2.08.56-4.13 1.22-6.14 2-4.54 1.05-3.79 1.51-2.17 6.07.18.51.46 1.68.54 1.94.82 2.47 1.08 2.13 3.1 2.13s0 .05 0 .08h.52c-.48 2.66-.51 5.45-.62 8.13-.15 3.48-.22 6.96-.28 10.45 0 .41-.01.82-.02 1.23-.16.29-.33.57-.51.85-.05.38-.09.77-.14 1.18-.42 3.52-.59 6.48-.52 8.8v.34c.02.47.05.76.06.87.16 1.57-.26 3.47 1.35 3.79 1.61.32 3.5.55 4.85.55.11 0 .22-.02.33-.02 1.79.24 3.67.05 5.45-.12 2.85-.28 5.69-.7 8.51-1.19 3.03-.53 6.05-1.14 9.04-1.86 2.4-.58 4.82-1.19 7.13-2.06.51-.19 1.73-.57 2.46-1.14 1.81-.68 2.18-1 1.57-2.67-.23-.62-.48-1.49-.91-2.78l-.03-.02Zm-11.12-38.71c.89.05 1.93.08 2.89.3-.33 0-.68-.02-1.06-.03-8.28-.26-14.88.75-23.97 2.51 2.41-.64 4.85-1.16 7.28-1.59 4.87-.86 9.91-1.45 14.86-1.19Zm-26.53 22.13c.03 1.71.04 3.43 0 5.14-.04 1.27-.11 2.55-.24 3.82 0-.73.02-1.46.04-2.19.05-2.26.12-4.51.22-6.77h-.02Zm6.73 27.85c.2-.1.4-.21.58-.33 1.82-.17 3.82-.24 5.94-.34-.86.11-1.72.24-2.58.33-1.27.14-2.61.31-3.93.34h-.01ZM534.48 85.44c-3.52-8.38-7.07-16.75-10.5-25.17-.63-1.54-1.25-3.09-1.86-4.65-.31-.8-.65-1.6-.87-2.43-.04-.17-.17-.24-.31-.25.1-.2 0-.51-.29-.53-1.59-.08-3.18-.22-4.78-.25-1.96-.03-3.91.13-5.84.42-.31.05-.31.38-.13.56-.03.06-.05.14-.04.22.23 1.54.63 3.06 1.16 4.53.13.35.27.7.41 1.06l-2.68 6.18c-.11.03-.2.09-.25.22-.67 1.9-1.52 3.73-2.34 5.56a536.85 536.85 0 0 1-3.9 8.45c-2.64 5.64-5.34 11.25-7.91 16.93-.44.97-.88 1.94-1.29 2.93-.2.48-.47 1-.55 1.52v.05c-.02.12.02.26.16.34 1.19.73 2.41 1.41 3.66 2.05 1.2.62 2.45 1.25 3.76 1.61.43.12.62-.55.19-.67-1.13-.31-2.2-.83-3.24-1.36 1.09.36 2.1.69 2.75.93 2.82 1.01 2.38 1.1 4.3-3.75 2.1-1.09 4.34-1.96 6.53-2.79 4.35-1.64 8.8-3.03 13.27-4.29.82 2.01 1.77 3.97 2.72 5.92.35.83.62 1.45.79 1.82.22.42.45.8.69 1.15.17.33.33.67.5 1 .42.8.84 1.63 1.4 2.35.23.29.6 0 .55-.31 1.53-.02 3.06-.07 4.58-.27.92-.12 1.82-.32 2.71-.54 1.39-.27 3.85-1.11 3.74-1.42-.67-1.96-1.55-3.87-2.34-5.78-1.57-3.78-3.16-7.56-4.75-11.33v-.01Zm-11.65-26.16c1.54 3.81 3.12 7.6 4.7 11.4 2.94 7.05 5.91 14.09 8.87 21.13l-1.06-2.17c-2.71-5.51-5.2-11.19-7.41-16.87l-6.65-17.15c-.65-1.45-.55-2.19-.93-2.53.09 0 .18.01.28.02a.29.29 0 0 0-.04.26c.52 2.02 1.47 3.98 2.25 5.91h-.01Zm-6.58 13.58c.05-.15.09-.31.14-.46 1.41 3.92 2.88 7.9 4.39 11.87-3.22.52-6.38 1.25-9.46 2.14.55-1.22 1.05-2.46 1.53-3.7 1.24-3.24 2.37-6.53 3.39-9.85h.01Zm-.23-20c.36 0 .73.03 1.09.05-2.15.1-5.18.33-5.87.74-.24.15-.41.3-.53.45-.06-.29-.13-.58-.18-.88 1.82-.26 3.65-.39 5.49-.35v-.01Zm-.09 18.72c-.49 1.67-1.05 3.33-1.6 4.97-1.07 3.19-2.19 6.38-3.57 9.46-.09.21-.19.43-.29.65-.25.07-.5.14-.74.22 2.53-6.16 4.61-11.29 6.2-15.3Zm-6.34 25.16c4.97-2.38 9.37-4.1 14.02-5.27l.26.64c-4.8 1.35-9.63 2.8-14.28 4.63Zm20.17 6.76c.33.23.68.42 1.04.56h-.33c-.12 0-.21.06-.26.13-.15-.23-.31-.45-.45-.7v.01ZM226.57 91.75c-3.55-4.74-6.68-9.11-9.31-12.99 9.2-15.25 10.05-17.81 10.35-18.38.17-.34 1.09-2.27.64-2.53-1.13-.65-1.03-.65-2.97-1.71-1.19-.65-3.04-1.61-4.53-2.12-1.71-.59-1.24-.36-3 2.77-.06.1-.11.2-.17.3-.75 1.02-1.48 2.05-2.2 3.09-1.88 2.71-3.73 5.45-5.69 8.1-3.68-4.91-6.88-8.76-9.51-11.43-.15-.15-.3-.29-.46-.42-1.27-1.28-7.24 3.53-7.93 5.58-.09.09-.19.16-.28.25-.27.26.03.64.33.58.19.65.5 1.29.94 1.91 3.85 5.06 7.19 9.76 9.94 14-1.23 2.61-3.06 5-4.67 7.38l-2.28 3.33c-.5.66-.93 1.23-1.29 1.69-.67.93-2.09 2.61-2.3 3.87-.51.85-1.16 1.84-1.29 2.83-.06.44.61.63.67.19.01-.08.04-.15.06-.22 1.36 1.08 2.76 2.11 4.19 3.11 1.3.91 2.62 1.85 4.04 2.56.21.1.4 0 .48-.17.24.07.48.14.72.2.44.1.62-.57.19-.67-2.02-.48-3.77-1.57-5.23-3.02-.47-.46-.9-.96-1.32-1.46 1.74 1.35 4.2 2.89 5.89 4.14 1.39 1.03 2.85-2.27 4.22-4.2 1.86-2.64 3.96-5.86 5.52-8.29l10.39 14.51c.67.81 1.14 1.21 1.57 1.36-.05.24.12.51.41.4 1.53-.58 3.05-1.19 4.54-1.87 1.52-.69 3.06-1.45 4.36-2.5a.28.28 0 0 0 .12-.23c1.66-1.1.81-1.74-1.41-4.91-1.13-1.58-1.71-2.36-3.7-5.01l-.03-.02Zm2.41 6.54c.56 1.15 1.19 2.52 1.11 3.81-.06.04-.12.07-.17.1-.03-.88-.55-2.66-.94-3.91Zm-16.51-32.73c1.86-2.65 3.65-5.35 5.57-7.95.4-.55.81-1.13 1.26-1.66.19-.18.38-.33.56-.45.18.03.36.08.55.13l-8.05 10.11.12-.18h-.01ZM192.7 95.48c.79-1.37 1.66-2.69 2.54-4 1.19-1.79 2.4-3.56 3.61-5.33-.04.09-.09.17-.13.26-.1.22.03.41.2.49-2.47 3.42-4.89 6.73-6.4 9.28.21.24.4.48.63.75-.24.07-.4.36-.17.56.4.33.72.77 1.05 1.17.09.11.18.21.27.32-.84-.61-1.66-1.24-2.47-1.88.24-.57.58-1.11.87-1.61v-.01Zm7.46-10.32c.47-.81.98-1.59 1.49-2.37.31-.48.64-.95.96-1.43.26-.29.52-.56.75-.79-.99 1.48-2.09 3.03-3.2 4.59Zm10.03-16.22s-.03-.05-.05-.07c.22-.29.43-.59.64-.89-.2.32-.4.65-.58.96h-.01ZM371.54 87.96c-.01-.08-.01-.16-.03-.23-.06-.38-.58-.29-.66.03-.3-.05-.6-.08-.81-.11-1.14-.15-2.29-.19-3.44-.2 1.04-.09 2.09-.18 3.14-.23.45-.02.45-.72 0-.7-6.57.35-13.14 1.23-19.65 2.11-1.53.21-3.05.42-4.57.68-.01 0-.02.01-.04.01-.04-3.33-.13-6.66-.24-9.99-.19-5.7-.4-11.41-.88-17.1-.13-1.51-.23-3.07-.49-4.58 0-.25 0-.48-.02-.68-.06-1.19-.04-2.61-.68-2.78-.16-.07-.72-.16-1.5-.24.22-.17.16-.62-.2-.63-1.19-.04-2.39.09-3.57.23-1.2.14-2.41.32-3.59.6-.16-.1-.41-.06-.5.12-.06.02-.13.03-.19.05-.35.1-.29.55-.03.66-.26.6-.19 2.27-.21 3-.02.66-.66 33.73-.9 40.3-.03.65.06 1.12.04 1.45-.16 3.05.87 4.96 6.34 3.93 1.09-.08 2.75-.77 5.36-1.43 4.13-1.04 5.78-1.52 6.2-1.65 6.43-1.69 6.78-1.97 11.72-2.43.55-.05 4.8-.38 6.03-.3.64.04 1.19.07 1.65.1.09 0 .16-.03.24-.05.1.27.56.33.66-.02.39-1.32.61-2.71.78-4.08.2-1.61.29-3.24.15-4.86.24.03.52-.23.38-.53-.09-.2-.27-.33-.49-.43v-.02Zm-.63.56c.07.57.11 1.14.11 1.71-.21-.99-.53-1.71-.95-1.87.22.03.44.06.65.11.06.01.12.04.19.05Zm-25.41 1.73c1.54-.36 3.1-.64 4.66-.89-1.61.37-3.18.77-4.66 1.2v-.31Zm-.86-7.37c-.07-1.37-.16-2.75-.25-4.12-.21-3.13-.45-6.27-.79-9.4.02-2.25.08-4.31.13-6.11.16 2.08.29 4.16.4 6.24.23 4.46.38 8.93.5 13.39h.01Zm-.94-4c.16 2.41.29 4.83.39 7.24.06 1.6.14 3.22.09 4.83-.15.05-.32.09-.47.14V78.88h-.01ZM483.72 92.83c-3.05-2.28-6.22-4.4-9.38-6.51 8.86-6.49 13.49-12.95 13.73-19.23.04-.76 0-1.5-.13-2.2-.67-3.82-3.5-6.68-8.39-8.48.13.04.27.08.4.13 3.92 1.39 7.74 4.23 8.5 8.56.34 1.95-.05 3.96-.98 5.69-.21.4.39.75.6.35 1.86-3.46 1.46-7.55-.97-10.63-3.53-4.47-9.76-5.88-15.16-6.16-2.32-.12-4.64-.04-6.95.19-6 .32-12.71 1.68-17.63 3.21-.37.11-.67.23-.92.35-.2-.17-.62.02-.57.37v.03c-.64.68-.18 1.64.48 3.21.38.91.67 1.89 1.15 2.58.32.76.68 1.51 1.13 2.19.14.21.38.19.53.07.19-.02.38-.05.57-.08v1.57c-.06.06-.1.13-.11.23-.27 4.18-.34 8.38-.48 12.57l-.3 9.03c-.24 3.91-.44 6.77-.46 7.26-.05.88-.11 1.95.07 2.81-.01.22-.02.43-.04.65 0 .11-.02.23-.03.35 0 .05-.03.27-.01.16-.05.4.5.59.64.28.05.04.12.08.2.08 1.75.13 3.5.28 5.25.3 1.69.02 3.38-.12 5.06-.32.08.23.36.39.55.15.06-.08.11-.17.16-.26.18-.09.24-.32.18-.48.05-.2.1-.4.13-.6.16-.86.25-1.74.33-2.62.11-1.17.17-2.34.23-3.51.15-.01.32-.03.52-.04.36-.03 1.73-.15 2.06-.15.39 0 .7-.02.95-.04 1.76 1.11 3.45 2.35 5.14 3.55 2.83 2.01 5.64 4.04 8.47 6.04 1.42 1 2.85 2 4.29 2.97.1.06.19.07.27.04.08 0 .17-.02.25-.1 1.61-1.56 3.15-3.18 4.6-4.88.75-.88 1.49-1.78 2.15-2.73.01.01.03.02.04.03.34.3.83-.2.49-.49-2.16-1.9-4.34-3.76-6.64-5.48l.03-.01Zm-6.38-3.65a55.72 55.72 0 0 0-4-2.13c.14-.1.26-.19.4-.29 1.2.81 2.4 1.61 3.6 2.42Zm-20.1 11.78c.67-.37 1.23-.91 1.67-1.6-.11.5-.24 1-.38 1.49-.43.04-.86.08-1.29.11Zm2.38-37.24c1.34-.31 2.56-.52 3.71-.69-1.03.19-2.04.41-3.04.65-.14-.07-.34-.02-.45.11-.07.02-.15.04-.22.05v-.13.01Zm.04.84c.07-.02.14-.03.2-.05.34 1.66.41 3.41.5 5.09.17 2.9.24 5.81.28 8.71l.03 3.17c-.17.07-.34.14-.51.2-.06-4.96-.21-10.58-.51-17.12h.01Zm16.04 5.62c-1.16 2.25-3.06 4.1-5.02 5.66-2.8 2.23-5.99 3.97-9.3 5.35-.01-3.56-.09-7.12-.27-10.67-.1-2.04-.16-4.16-.57-6.18 3.3-.78 6.72-1.36 10.1-1.1 1.85.14 4.23.59 5.32 2.29.92 1.43.46 3.24-.26 4.65Zm.85-.18c.6-1.37.9-2.92.28-4.32-.67-1.52-2.2-2.32-3.76-2.74.46.1.89.21 1.29.37 1.74.67 2.69 1.88 2.93 3.21.2 1.13-.05 2.25-.74 3.47V70Zm-27.47-4.14c-.12-.19-.23-.38-.34-.57.74.42.85.36.99.41v.08c-.22.03-.43.06-.65.08Zm11.21 30.46c-.08 1.08-.16 2.17-.33 3.24-.05.35-.11.69-.2 1.03 0 .04-.02.07-.03.11-.15.02-.3.04-.45.05.45-1.64.76-3.36.79-5.07.03-.29.08-.57.1-.89-.03-.31-.03-.47.24-.57-.04.69-.07 1.39-.12 2.08v.02Zm5.6-2.47c.48.11.92.52 2.49 1.72-.46-.32-.92-.65-1.38-.97-.37-.25-.73-.5-1.1-.75h-.01Zm21.23 7.24a70.76 70.76 0 0 1-4.37 4.63c-.14-.09-.27-.19-.4-.28.19-.09.37-.24.55-.47.87-1.14 5.43-5.51 5.49-7.45.31.26.62.53.92.79-.67.97-1.42 1.88-2.19 2.77v.01Z",fill:"currentColor",transform:"translate(-144.023 -51.76)"})]}),zG=({style:e,size:t="small",withText:n})=>P("div",{className:`ExcalidrawLogo is-${t}`,style:e,children:[g(g5e,{}),n&&g(m5e,{})]}),X_=({icon:e,shortcut:t,children:n})=>{const i=Qn();return P(he,{children:[g("div",{className:"welcome-screen-menu-item__icon",children:e}),g("div",{className:"welcome-screen-menu-item__text",children:n}),t&&!i.editor.isMobile&&g("div",{className:"welcome-screen-menu-item__shortcut",children:t})]})};X_.displayName="WelcomeScreenMenuItemContent";const Qm=({onSelect:e,children:t,icon:n,shortcut:i,className:r="",...s})=>g("button",{...s,type:"button",className:`welcome-screen-menu-item ${r}`,onClick:e,children:g(X_,{icon:n,shortcut:i,children:t})});Qm.displayName="WelcomeScreenMenuItem";const HG=({children:e,href:t,icon:n,shortcut:i,className:r="",...s})=>g("a",{...s,className:`welcome-screen-menu-item ${r}`,href:t,target:"_blank",rel:"noreferrer",children:g(X_,{icon:n,shortcut:i,children:e})});HG.displayName="WelcomeScreenMenuItemLink";const so=({children:e})=>{const{WelcomeScreenCenterTunnel:t}=ir();return g(t.In,{children:g("div",{className:"welcome-screen-center",children:e||P(he,{children:[g(j_,{}),g(Y_,{children:L("welcomeScreen.defaults.center_heading")}),P(W_,{children:[g(Z_,{}),g(K_,{})]})]})})})};so.displayName="Center";const j_=({children:e})=>g("div",{className:"welcome-screen-center__logo excalifont welcome-screen-decor",children:e||g(zG,{withText:!0})});j_.displayName="Logo";const Y_=({children:e})=>g("div",{className:"welcome-screen-center__heading welcome-screen-decor excalifont",children:e});Y_.displayName="Heading";const W_=({children:e})=>g("div",{className:"welcome-screen-menu",children:e});W_.displayName="Menu";const K_=()=>{const e=vr();return g(Qm,{onSelect:()=>e.executeAction(O_),shortcut:"?",icon:p9,children:L("helpDialog.title")})};K_.displayName="MenuItemHelp";const Z_=()=>{const e=fi(),t=vr();return e.viewModeEnabled?null:g(Qm,{onSelect:()=>t.executeAction(HE),shortcut:Bi("loadScene"),icon:b9,children:L("buttons.load")})};Z_.displayName="MenuItemLoadScene";const VG=({onSelect:e})=>{const{t}=mn();return g(Qm,{shortcut:null,onSelect:e,icon:E9,children:t("labels.liveCollaboration")})};VG.displayName="MenuItemLiveCollaborationTrigger";so.Logo=j_;so.Heading=Y_;so.Menu=W_;so.MenuItem=Qm;so.MenuItemLink=HG;so.MenuItemHelp=K_;so.MenuItemLoadScene=Z_;so.MenuItemLiveCollaborationTrigger=VG;const q_=({children:e})=>{const{WelcomeScreenMenuHintTunnel:t}=ir();return g(t.In,{children:P("div",{className:"excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu",children:[Dte,g("div",{className:"welcome-screen-decor-hint__label",children:e||L("welcomeScreen.defaults.menuHint")})]})})};q_.displayName="MenuHint";const Q_=({children:e})=>{const{WelcomeScreenToolbarHintTunnel:t}=ir();return g(t.In,{children:P("div",{className:"excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar",children:[g("div",{className:"welcome-screen-decor-hint__label",children:e||L("welcomeScreen.defaults.toolbarHint")}),Ote]})})};Q_.displayName="ToolbarHint";const J_=({children:e})=>{const{WelcomeScreenHelpHintTunnel:t}=ir();return g(t.In,{children:P("div",{className:"excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help",children:[g("div",{children:e||L("welcomeScreen.defaults.helpHint")}),Nte]})})};J_.displayName="HelpHint";const sr=e=>g(he,{children:e.children||P(he,{children:[g(so,{}),g(q_,{}),g(Q_,{}),g(J_,{})]})});sr.displayName="WelcomeScreen";sr.Center=so;sr.Hints={MenuHint:q_,ToolbarHint:Q_,HelpHint:J_};const $G=({isCollaborating:e,onSelect:t,...n})=>{const i=fi(),r=i.width<830;return P(cd,{...n,className:me("collab-button",{active:e}),type:"button",onSelect:t,style:{position:"relative",width:r?void 0:"auto"},title:L("labels.liveCollaboration"),children:[r?y9:L("labels.share"),i.collaborators.size>0&&g("div",{className:"CollabButton-collaborators",children:i.collaborators.size})]})};$G.displayName="LiveCollaborationTrigger";const p5e=(e,t,n)=>{var i,r,s;return!!(t&&(t.id===((i=e.editingTextElement)==null?void 0:i.id)||t.id===((r=e.resizingElement)==null?void 0:r.id)||t.id===((s=e.newElement)==null?void 0:s.id)||t.version>n.version||t.version===n.version&&t.versionNonce<n.versionNonce))},U5e=Ao((e,t,n)=>{if(window!=null&&window.DEBUG_FRACTIONAL_INDICES){const i=Za(e.map(r=>({...r})));a_(i,{shouldThrow:NO.TEST==="production",includeBoundTextValidation:!0,reconciliationContext:{localElements:t,remoteElements:n}})}},1e3*60,{leading:!0,trailing:!1}),ew=(e,t,n)=>{const i=Se(e),r=[],s=new Set;for(const a of t)if(!s.has(a.id)){const l=i.get(a.id),c=p5e(n,l,a);l&&c?(r.push(l),s.add(l.id)):(r.push(a),s.add(a.id))}for(const a of e)s.has(a.id)||(r.push(a),s.add(a.id));const o=TH(r);return U5e(o,e,t),Za(o),o},b5e=.01,tl=(e,t)=>!(t==="height"&&de(e)||t==="width"&&de(e)||t==="angle"&&Ie(e)),Di=(e,t)=>{const n=e+t/2;return n-n%t},Gb=(e,t,n)=>Object.keys(e).map(i=>({original:(n??t).get(i),latest:t.get(i)})).filter(i=>i.original!==void 0&&i.latest!==void 0),cm=(e,t,n,i,r,s,o,a=!0)=>{const l=i.get(n.id);if(!l)return;const[c,u]=[n.x+n.width/2,n.y+n.height/2],[d,f]=q(C(n.x,n.y),C(c,u),n.angle),h=e-d,m=t-f,[p,b]=q(C(e,t),C(c+h,u+m),-n.angle);ee(l,{x:p,y:b},a),t4(l,i,r,s);const E=Oe(n,o);if(E){const y=i.get(E.id);y&&ee(y,{x:E.x+h,y:E.y+m},a)}},tw=(e,t)=>{const i=Ou(t).map(r=>$t(e,r).reduce((s,o)=>(s[o.id]=!0,s),{}));return e.filter(r=>!yh(r)).forEach(r=>{i.push({[r.id]:!0})}),i},t4=(e,t,n,i,r)=>{ke(e)?Ub([e],t,n,i,!0,[],r==null?void 0:r.zoom):pr(e,t,r)},cl=({label:e,icon:t,dragInputCallback:n,value:i,elements:r,editable:s=!0,shouldKeepAspectRatio:o,property:a,scene:l,appState:c,sensitivity:u=1})=>{const d=oo(),f=M.useRef(null),h=M.useRef(null),[m,p]=M.useState(i.toString()),b=M.useRef(null);b.current||(b.current={originalAppState:ka(c),originalElements:r,lastUpdatedValue:m,updatePending:!1}),M.useEffect(()=>{const v=i.toString();p(v),b.current.lastUpdatedValue=v},[i]);const E=(v,_,I)=>{if(!b.current.updatePending)return!1;b.current.updatePending=!1;const R=Number(v);if(isNaN(R)){p(i.toString());return}const w=Number(R.toFixed(2)),T=Number(i);(isNaN(T)||Math.abs(w-T)>=b5e)&&(b.current.lastUpdatedValue=v,n({accumulatedChange:0,instantChange:0,originalElements:_,originalElementsMap:d.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:o,shouldChangeByStepSize:!1,scene:l,nextValue:w,property:a,originalAppState:I,setInputValue:A=>p(String(A))}),d.syncActionResult({captureUpdate:Z.IMMEDIATELY}))},y=M.useRef({});return y.current.handleInputValue=E,M.useEffect(()=>{const v=f.current,_=y.current;return()=>{var R;const I=v==null?void 0:v.value;I&&((R=_.handleInputValue)==null||R.call(_,I,b.current.originalElements,b.current.originalAppState)),window.removeEventListener(te.POINTER_MOVE,_.onPointerMove,!1),window.removeEventListener(te.POINTER_UP,_.onPointerUp,!1)}},[s]),s?P("div",{className:me("drag-input-container",!s&&"disabled"),"data-testid":e,children:[g("div",{className:"drag-input-label",ref:h,onPointerDown:v=>{if(f.current&&s){document.body.classList.add("excalidraw-cursor-resize"),Number(f.current.value);let _=null,I=d.scene.getNonDeletedElements().reduce((N,D)=>(N.set(D.id,Cd(D)),N),new Map),R=r.map(N=>I.get(N.id));const w=ka(c);let T=0,A=0;const S=N=>{if(_&&I!==null&&R!==null){const D=N.clientX-_.x;D!==0&&(A+=D,Math.abs(A)>=u&&(A=Math.sign(A)*Math.floor(Math.abs(A)/u),T+=A,n({accumulatedChange:T,instantChange:A,originalElements:R,originalElementsMap:I,shouldKeepAspectRatio:o,shouldChangeByStepSize:N.shiftKey,property:a,scene:l,originalAppState:w,setInputValue:G=>p(String(G))}),A=0))}_={x:N.clientX,y:N.clientY}},k=()=>{window.removeEventListener(te.POINTER_MOVE,S,!1),d.syncActionResult({captureUpdate:Z.IMMEDIATELY}),_=null,T=0,A=0,R=null,I=null,document.body.classList.remove("excalidraw-cursor-resize"),window.removeEventListener(te.POINTER_UP,k,!1)};y.current.onPointerMove=S,y.current.onPointerUp=k,window.addEventListener(te.POINTER_MOVE,S,!1),window.addEventListener(te.POINTER_UP,k,!1)}},onPointerEnter:()=>{h.current&&(h.current.style.cursor="ew-resize")},children:t?g(A5,{icon:t}):e}),g("input",{className:"drag-input",autoComplete:"off",spellCheck:"false",onKeyDown:v=>{if(s){const _=v.target;_ instanceof HTMLInputElement&&v.key===z.ENTER&&(E(_.value,r,c),d.focusContainer())}},ref:f,value:m,onChange:v=>{b.current.updatePending=!0,p(v.target.value)},onFocus:v=>{v.target.select(),b.current.originalElements=r,b.current.originalAppState=ka(c)},onBlur:v=>{m?s&&E(v.target.value,b.current.originalElements,b.current.originalAppState):p(i.toString())},disabled:!s})]}):null},eR=10,y5e=e=>e.type==="image",E5e=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldKeepAspectRatio:i,shouldChangeByStepSize:r,nextValue:s,property:o,originalAppState:a,instantChange:l,scene:c})=>{const u=c.getNonDeletedElementsMap(),d=t[0],f=u.get(d.id);if(d&&f){const h=i||y5e(d),m=d.width/d.height;if(a.croppingElementId===d.id){const v=u.get(d.id);if(!v||!st(v)||!v.crop)return;const _=v.crop;let I={..._};const R=v.scale[0]===-1,w=v.scale[1]===-1,{width:T,height:A}=Ya(v),S=_.naturalWidth/T,k=_.naturalHeight/A,N=R?_.width+_.x:_.naturalWidth-_.x,D=w?_.height+_.y:_.naturalHeight-_.y,G=Jn*S,V=Jn*k;if(s!==void 0){if(o==="width"){const Y=s*S,le=He(Y,G,N);I={...I,width:le,x:R?_.x+_.width-le:_.x}}else if(o==="height"){const Y=s*k,le=He(Y,V,D);I={...I,height:le,y:w?_.y+_.height-le:_.y}}ee(v,{crop:I,width:I.width/(_.naturalWidth/T),height:I.height/(_.naturalHeight/A)});return}const H=o==="width"?l:0,$=o==="height"?l:0,j=He(_.width+H,G,N),X=He(_.height+$,G,D);I={..._,x:R?_.x+_.width-j:_.x,y:w?_.y+_.height-X:_.y,width:j,height:X},ee(v,{crop:I,width:I.width/(_.naturalWidth/T),height:I.height/(_.naturalHeight/A)});return}if(s!==void 0){const v=Math.max(o==="width"?s:h?s*m:d.width,Kr),_=Math.max(o==="height"?s:h?s/m:d.height,Kr);nm(v,_,f,d,u,n,o==="width"?"e":"s",{shouldMaintainAspectRatio:h});return}const p=o==="width"?e:0,b=o==="height"?e:0;let E=Math.max(0,d.width+p);o==="width"&&(r?E=Di(E,eR):E=Math.round(E));let y=Math.max(0,d.height+b);o==="height"&&(r?y=Di(y,eR):y=Math.round(y)),h&&(o==="width"?y=Math.round(E/m*100)/100:E=Math.round(y*m*100)/100),y=Math.max(Kr,y),E=Math.max(Kr,E),nm(E,y,f,d,u,n,o==="width"?"e":"s",{shouldMaintainAspectRatio:h})}},tR=({property:e,element:t,scene:n,appState:i})=>{let r=Do(e==="width"?t.width:t.height,2);if(i.croppingElementId&&i.croppingElementId===t.id&&st(t)&&t.crop){const{width:s,height:o}=Ya(t);if(e==="width"){const a=s/t.crop.naturalWidth;r=Do(t.crop.width*a,2)}if(e==="height"){const a=o/t.crop.naturalHeight;r=Do(t.crop.height*a,2)}}return g(cl,{label:e==="width"?"W":"H",elements:[t],dragInputCallback:E5e,value:r,editable:tl(t,e),scene:n,appState:i,property:e})},v5e=15,_5e=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:i,scene:r})=>{const s=r.getNonDeletedElementsMap(),o=r.getNonDeletedElements(),a=t[0];if(a&&!ge(a)){const l=s.get(a.id);if(!l)return;if(i!==void 0){const m=Lu(i);ee(l,{angle:m}),t4(l,s,o,r);const p=Oe(l,s);p&&!Be(l)&&ee(p,{angle:m});return}const c=Math.round(Pm(a.angle)*100)/100,u=Math.round(e);let d=(c+u)%360;n&&(d=Di(d,v5e)),d=d<0?d+360:d;const f=Lu(d);ee(l,{angle:f}),t4(l,s,o,r);const h=Oe(l,s);h&&!Be(l)&&ee(h,{angle:f})}},w5e=({element:e,scene:t,appState:n,property:i})=>g(cl,{label:"A",icon:VF,value:Math.round(Pm(e.angle)%360*100)/100,elements:[e],dragInputCallback:_5e,editable:tl(e,"angle"),scene:t,appState:n,property:i}),nR=4,T5e=4,S5e=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:i,scene:r})=>{const s=r.getNonDeletedElementsMap(),o=t[0];if(o){const a=s.get(o.id);if(!a||!de(a))return;let l;if(i!==void 0)l=Math.max(Math.round(i),nR);else if(o.type==="text"){const c=Math.round(o.fontSize),u=Math.round(e);l=Math.max(c+u,nR),n&&(l=Di(l,T5e))}l&&(ee(a,{fontSize:l}),Qi(a,r.getContainerElement(a),r.getNonDeletedElementsMap()))}},I5e=({element:e,scene:t,appState:n,property:i})=>{const r=de(e)?e:Us(e)?Oe(e,t.getNonDeletedElementsMap()):null;return r?g(cl,{label:"F",value:Math.round(r.fontSize*10)/10,elements:[r],dragInputCallback:S5e,icon:K6,appState:n,scene:t,property:i}):null},ef=10,x5e=(e,t,n,i)=>{const r=i.x-e,s=i.y-t,o=i.width*n,a=i.height*n,l=e+r*n,c=t+s*n;return{width:o,height:a,x:l,y:c,...u_(i,o,a,!1),...de(i)?{fontSize:i.fontSize*n}:{}}},C5e=(e,t,n,i,r,s,o,a)=>{const l=x5e(e,t,i,s);ee(r,l,!1);const c=Oe(s,a);if(c){const u=c.fontSize*i;pr(r,o,{newSize:{width:l.width,height:l.height}});const d=o.get(c.id);d&&de(d)&&(ee(d,{fontSize:u},!1),Wm(r,o,n==="width"?"e":"s",!0))}},iR=(e,t,n,i,r,s,o,a,l,c)=>{s==="width"?t=Math.round(e/i*100)/100:e=Math.round(t*i*100)/100;const u=t/n;for(let d=0;d<a.length;d++){const f=a[d],h=o[d];C5e(r[0],r[1],s,u,h,f,l,c)}},A5e=({accumulatedChange:e,originalElements:t,originalElementsMap:n,originalAppState:i,shouldChangeByStepSize:r,nextValue:s,scene:o,property:a})=>{const l=o.getNonDeletedElementsMap(),c=tw(t,i);if(s!==void 0){for(const f of c){const h=Gb(f,l,n);if(h.length>1){const m=h.map(A=>A.latest),p=h.map(A=>A.original),[b,E,y,v]=wt(p),_=y-b,I=v-E,R=_/I,w=Math.max(Kr,a==="width"?Math.max(0,s):_),T=Math.max(Kr,a==="height"?Math.max(0,s):I);iR(w,T,I,R,C(b,E),a,m,p,l,n)}else{const[m]=h,p=m==null?void 0:m.latest,b=m==null?void 0:m.original;if(p&&b&&tl(p,a)){let E=a==="width"?Math.max(0,s):p.width;a==="width"&&(r?E=Di(E,ef):E=Math.round(E));let y=a==="height"?Math.max(0,s):p.height;a==="height"&&(r?y=Di(y,ef):y=Math.round(y)),E=Math.max(Kr,E),y=Math.max(Kr,y),nm(E,y,p,b,l,n,a==="width"?"e":"s",{shouldInformMutation:!1})}}}o.triggerUpdate();return}const u=a==="width"?e:0,d=a==="height"?e:0;for(const f of c){const h=Gb(f,l,n);if(h.length>1){const m=h.map(A=>A.latest),p=h.map(A=>A.original),[b,E,y,v]=wt(p),_=y-b,I=v-E,R=_/I;let w=Math.max(0,_+u);a==="width"&&(r?w=Di(w,ef):w=Math.round(w));let T=Math.max(0,I+d);a==="height"&&(r?T=Di(T,ef):T=Math.round(T)),w=Math.max(Kr,w),T=Math.max(Kr,T),iR(w,T,I,R,C(b,E),a,m,p,l,n)}else{const[m]=h,p=m==null?void 0:m.latest,b=m==null?void 0:m.original;if(p&&b&&tl(p,a)){let E=Math.max(0,b.width+u);a==="width"&&(r?E=Di(E,ef):E=Math.round(E));let y=Math.max(0,b.height+d);a==="height"&&(r?y=Di(y,ef):y=Math.round(y)),E=Math.max(Kr,E),y=Math.max(Kr,y),nm(E,y,p,b,l,n,a==="width"?"e":"s",{shouldInformMutation:!1})}}}o.triggerUpdate()},rR=({property:e,elements:t,elementsMap:n,atomicUnits:i,scene:r,appState:s})=>{const o=M.useMemo(()=>i.map(c=>{const u=Gb(c,n);if(u.length>1){const[f,h,m,p]=wt(u.map(b=>b.latest));return Math.round((e==="width"?m-f:p-h)*100)/100}const[d]=u;return Math.round((e==="width"?d.latest.width:d.latest.height)*100)/100}),[n,i,e]),a=new Set(o).size===1?Math.round(o[0]*100)/100:"Mixed",l=o.length>0;return g(cl,{label:e==="width"?"W":"H",elements:t,dragInputCallback:A5e,value:a,editable:l,appState:s,property:e,scene:r})},M5e=15,R5e=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:i,property:r,scene:s})=>{const o=s.getNonDeletedElementsMap(),a=t.map(c=>o.get(c.id)).filter(c=>c&&!yh(c)&&tl(c,r)),l=t.filter(c=>!yh(c)&&tl(c,r));if(i!==void 0){const c=Lu(i);for(const u of a){if(!u)continue;ee(u,{angle:c},!1);const d=Oe(u,o);d&&!Be(u)&&ee(d,{angle:c},!1)}s.triggerUpdate();return}for(let c=0;c<a.length;c++){const u=a[c];if(!u)continue;const d=l[c],f=Math.round(Pm(d.angle)*100)/100,h=Math.round(e);let m=(f+h)%360;n&&(m=Di(m,M5e)),m=m<0?m+360:m;const p=Lu(m);ee(u,{angle:p},!1);const b=Oe(u,o);b&&!Be(u)&&ee(b,{angle:p},!1)}s.triggerUpdate()},k5e=({elements:e,scene:t,appState:n,property:i})=>{const r=e.filter(l=>!yh(l)&&tl(l,"angle")),s=r.map(l=>Math.round(Pm(l.angle)%360*100)/100),o=new Set(s).size===1?s[0]:"Mixed",a=r.some(l=>tl(l,"angle"));return g(cl,{label:"A",icon:VF,value:o,elements:e,dragInputCallback:R5e,editable:a,appState:n,scene:t,property:i})},sR=4,L5e=4,D5e=(e,t)=>e.reduce((n,i)=>{if(!i||yh(i))return n;if(de(i))return n.push(i),n;if(Us(i)){const r=Oe(i,t);if(r)return n.push(r),n}return n},[]),N5e=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:i,scene:r})=>{const s=r.getNonDeletedElementsMap(),o=t.map(l=>s.get(l.id));let a;if(i){a=Math.max(Math.round(i),sR);for(const l of o)ee(l,{fontSize:a},!1),Qi(l,r.getContainerElement(l),s,!1);r.triggerUpdate()}else{const l=t;for(let c=0;c<o.length;c++){const u=o[c],d=l[c],f=Math.round(d.fontSize),h=Math.round(e);let m=Math.max(f+h,sR);n&&(m=Di(m,L5e)),ee(u,{fontSize:m},!1),Qi(u,r.getContainerElement(u),s,!1)}r.triggerUpdate()}},O5e=({elements:e,scene:t,appState:n,property:i,elementsMap:r})=>{const s=D5e(e,r);if(!s.length)return null;const o=s.map(c=>Math.round(c.fontSize*10)/10),a=new Set(o).size===1?o[0]:"Mixed",l=o.length>0;return g(cl,{label:"F",icon:K6,elements:s,dragInputCallback:N5e,value:a,editable:l,scene:t,property:i,appState:n})},oR=10,P5e=({accumulatedChange:e,instantChange:t,originalElements:n,originalElementsMap:i,shouldChangeByStepSize:r,nextValue:s,property:o,scene:a,originalAppState:l})=>{const c=a.getNonDeletedElementsMap(),u=a.getNonDeletedElements(),d=n[0],[f,h]=[d.x+d.width/2,d.y+d.height/2],[m,p]=q(C(d.x,d.y),C(f,h),d.angle);if(l.croppingElementId===d.id){const _=c.get(d.id);if(!_||!st(_)||!_.crop)return;const I=_.crop;let R=I;const w=_.scale[0]===-1,T=_.scale[1]===-1,{width:A,height:S}=Ya(_);if(s!==void 0){if(o==="x"){const D=s*(I.naturalWidth/A);w?R={...I,x:He(I.naturalWidth-D-I.width,0,I.naturalWidth-I.width)}:R={...I,x:He(s*(I.naturalWidth/A),0,I.naturalWidth-I.width)}}o==="y"&&(R={...I,y:He(s*(I.naturalHeight/S),0,I.naturalHeight-I.height)}),ee(_,{crop:R});return}const k=(o==="x"?t:0)*(w?-1:1),N=(o==="y"?t:0)*(T?-1:1);R={...I,x:He(I.x+k,0,I.naturalWidth-I.width),y:He(I.y+N,0,I.naturalHeight-I.height)},ee(_,{crop:R});return}if(s!==void 0){cm(o==="x"?s:m,o==="y"?s:p,d,c,u,a,i);return}const b=o==="x"?e:0,E=o==="y"?e:0,y=o==="x"?Math.round(r?Di(d.x+b,oR):m+b):m,v=o==="y"?Math.round(r?Di(d.y+E,oR):p+E):p;cm(y,v,d,c,u,a,i)},aR=({property:e,element:t,elementsMap:n,scene:i,appState:r})=>{const[s,o]=q(C(t.x,t.y),C(t.x+t.width/2,t.y+t.height/2),t.angle);let a=Do(e==="x"?s:o,2);if(r.croppingElementId===t.id&&st(t)&&t.crop){const l=wce(t);l&&(a=Do(e==="x"?l.x:l.y,2))}return g(cl,{label:e==="x"?"X":"Y",elements:[t],dragInputCallback:P5e,scene:i,value:a,property:e,appState:r})},F5e=10,B5e=(e,t,n,i,r,s,o,a)=>{for(let l=0;l<i.length;l++){const c=r[l],[u,d]=[c.x+c.width/2,c.y+c.height/2],[f,h]=q(C(c.x,c.y),C(u,d),c.angle),m=e==="x"?Math.round(f+t):f,p=e==="y"?Math.round(h+n):h;cm(m,p,c,s,i,a,o,!1)}},z5e=(e,t,n,i,r,s,o)=>{const[a,l,,]=wt(n),c=e-a,u=t-l;for(let d=0;d<n.length;d++){const f=n[d],h=i.get(f.id);if(h&&(!de(h)||!h.containerId)){const[m,p]=[h.x+h.width/2,h.y+h.height/2],[b,E]=q(C(h.x,h.y),C(m,p),h.angle);cm(b+c,E+u,f,i,r,o,s,!1)}}},H5e=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:i,nextValue:r,property:s,scene:o,originalAppState:a})=>{var h,m;const l=o.getNonDeletedElementsMap(),c=o.getNonDeletedElements();if(r!==void 0){for(const p of tw(t,a)){const b=Gb(p,l,n);if(b.length>1){const[E,y,,]=wt(b.map(I=>I.latest));z5e(s==="x"?r:E,s==="y"?r:y,b.map(I=>I.original),l,c,n,o)}else{const E=(h=b[0])==null?void 0:h.original,y=(m=b[0])==null?void 0:m.latest;if(E&&y&&tl(y,s)){const[v,_]=[E.x+E.width/2,E.y+E.height/2],[I,R]=q(C(E.x,E.y),C(v,_),E.angle);cm(s==="x"?r:I,s==="y"?r:R,E,l,c,o,n,!1)}}}o.triggerUpdate();return}const u=i?Di(e,F5e):e;B5e(s,s==="x"?u:0,s==="y"?u:0,t,t,l,n,o),o.triggerUpdate()},lR=({property:e,elements:t,elementsMap:n,atomicUnits:i,scene:r,appState:s})=>{const o=M.useMemo(()=>i.map(l=>{const c=Object.keys(l).map(p=>n.get(p)).filter(p=>p!==void 0);if(c.length>1){const[p,b]=wt(c);return Math.round((e==="x"?p:b)*100)/100}const[u]=c,[d,f]=[u.x+u.width/2,u.y+u.height/2],[h,m]=q(C(u.x,u.y),C(d,f),u.angle);return Math.round((e==="x"?h:m)*100)/100}),[i,n,e]),a=new Set(o).size===1?o[0]:"Mixed";return g(cl,{label:e==="x"?"X":"Y",elements:t,dragInputCallback:H5e,value:a,property:e,scene:r,appState:s})},cR=5,V5e=({property:e,scene:t,appState:n,setAppState:i})=>g(cl,{label:"Grid step",sensitivity:8,elements:[],dragInputCallback:({nextValue:r,instantChange:s,shouldChangeByStepSize:o,setInputValue:a})=>{i(l=>{let c;return r?c=r:s&&(c=o?Di(l.gridStep+cR*Math.sign(s),cR):l.gridStep+s),c?(c=FH(c),a(c),{gridStep:c}):(a(l.gridStep),null)})},scene:t,value:n.gridStep,property:e,appState:n}),$5e=50,pa=e=>{const t=tp(),n=e.app.scene.getSceneNonce()||1,i=e.app.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}),r=em(e.app);return g(G5e,{...e,appState:t,sceneNonce:n,selectedElements:i,gridModeEnabled:r})},Ht=({children:e,columns:t=1,heading:n,style:i,...r})=>g("div",{className:me("exc-stats__row",{"exc-stats__row--heading":n}),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,...i},...r,children:e});Ht.displayName="StatsRow";const Xb=({children:e,order:t,style:n,...i})=>g("div",{className:"exc-stats__rows",style:{order:t,...n},...i,children:e});Xb.displayName="StatsRows";pa.StatsRow=Ht;pa.StatsRows=Xb;const G5e=M.memo(({app:e,onClose:t,renderCustomStats:n,selectedElements:i,appState:r,sceneNonce:s,gridModeEnabled:o})=>{const a=e.scene,l=a.getNonDeletedElements(),c=a.getNonDeletedElementsMap(),u=zn(),d=i.length===1?i[0]:null,f=i.length>1?i:null,h=r.croppingElementId&&st(d),m=h?Ya(d):null,[p,b]=M.useState({width:0,height:0}),E=M.useMemo(()=>Ao(_=>{const I=wt(_);b({width:Math.round(I[2])-Math.round(I[0]),height:Math.round(I[3])-Math.round(I[1])})},$5e),[]);M.useEffect(()=>{E(l)},[s,l,E]),M.useEffect(()=>()=>E.cancel(),[E]);const y=M.useMemo(()=>tw(i,r),[i,r]),v=M.useMemo(()=>aH(i),[i]);return g("div",{className:"exc-stats",children:P(Ys,{padding:3,children:[P("div",{className:"title",children:[g("h2",{children:L("stats.title")}),g("div",{className:"close",onClick:t,children:xd})]}),P(zE,{label:g("h3",{children:L("stats.generalStats")}),open:!!(r.stats.panels&Mf.generalStats),openTrigger:()=>u(_=>({stats:{open:!0,panels:_.stats.panels^Mf.generalStats}})),children:[P(Xb,{children:[g(Ht,{heading:!0,children:L("stats.scene")}),P(Ht,{columns:2,children:[g("div",{children:L("stats.shapes")}),g("div",{children:l.length})]}),P(Ht,{columns:2,children:[g("div",{children:L("stats.width")}),g("div",{children:p.width})]}),P(Ht,{columns:2,children:[g("div",{children:L("stats.height")}),g("div",{children:p.height})]}),o&&P(he,{children:[g(Ht,{heading:!0,children:"Canvas"}),g(Ht,{children:g(V5e,{property:"gridStep",scene:a,appState:r,setAppState:u})})]})]}),n==null?void 0:n(l,r)]}),!v&&i.length>0&&g("div",{id:"elementStats",style:{marginTop:12},children:g(zE,{label:g("h3",{children:L("stats.elementProperties")}),open:!!(r.stats.panels&Mf.elementProperties),openTrigger:()=>u(_=>({stats:{open:!0,panels:_.stats.panels^Mf.elementProperties}})),children:P(Xb,{children:[d&&P(he,{children:[h&&g(Ht,{heading:!0,children:L("labels.unCroppedDimension")}),r.croppingElementId&&st(d)&&m&&P(Ht,{columns:2,children:[g("div",{children:L("stats.width")}),g("div",{children:Do(m.width,2)})]}),r.croppingElementId&&st(d)&&m&&P(Ht,{columns:2,children:[g("div",{children:L("stats.height")}),g("div",{children:Do(m.height,2)})]}),g(Ht,{heading:!0,"data-testid":"stats-element-type",children:r.croppingElementId?L("labels.imageCropping"):L(`element.${d.type}`)}),g(Ht,{children:g(aR,{element:d,property:"x",elementsMap:c,scene:a,appState:r})}),g(Ht,{children:g(aR,{element:d,property:"y",elementsMap:c,scene:a,appState:r})}),g(Ht,{children:g(tR,{property:"width",element:d,scene:a,appState:r})}),g(Ht,{children:g(tR,{property:"height",element:d,scene:a,appState:r})}),!ge(d)&&g(Ht,{children:g(w5e,{property:"angle",element:d,scene:a,appState:r})}),g(Ht,{children:g(I5e,{property:"fontSize",element:d,scene:a,appState:r})})]}),f&&P(he,{children:[xF(f)&&g(Ht,{heading:!0,children:L("element.group")}),P(Ht,{columns:2,style:{margin:"0.3125rem 0"},children:[g("div",{children:L("stats.shapes")}),g("div",{children:i.length})]}),g(Ht,{children:g(lR,{property:"x",elements:f,elementsMap:c,atomicUnits:y,scene:a,appState:r})}),g(Ht,{children:g(lR,{property:"y",elements:f,elementsMap:c,atomicUnits:y,scene:a,appState:r})}),g(Ht,{children:g(rR,{property:"width",elements:f,elementsMap:c,atomicUnits:y,scene:a,appState:r})}),g(Ht,{children:g(rR,{property:"height",elements:f,elementsMap:c,atomicUnits:y,scene:a,appState:r})}),g(Ht,{children:g(k5e,{property:"angle",elements:f,scene:a,appState:r})}),g(Ht,{children:g(O5e,{property:"fontSize",elements:f,scene:a,appState:r,elementsMap:c})})]})]})})})]})})},(e,t)=>e.sceneNonce===t.sceneNonce&&e.selectedElements===t.selectedElements&&e.appState.stats.panels===t.appState.stats.panels&&e.gridModeEnabled===t.gridModeEnabled&&e.appState.gridStep===t.appState.gridStep&&e.appState.croppingElementId===t.appState.croppingElementId),GG=({children:e,icon:t})=>{const{TTDDialogTriggerTunnel:n}=ir(),i=zn();return g(n.In,{children:P(ot.Item,{onSelect:()=>{ut("ai","dialog open","ttd"),i({openDialog:{name:"ttd",tab:"text-to-diagram"}})},icon:t??tie,children:[e??L("labels.textToDiagram"),g(ot.Item.Badge,{children:"AI"})]})})};GG.displayName="TTDDialogTrigger";const gU={width:100,height:0},Gl=100,X5e=(e,t,n)=>{const i=Br({x:0,y:0,textAlign:R0.CENTER,verticalAlign:Ar.MIDDLE,...t,containerId:e.id,strokeColor:t.strokeColor||e.strokeColor});return Object.assign(e,{boundElements:(e.boundElements||[]).concat({type:"text",id:i.id})}),Qi(i,e,n),[e,i]},uR=(e,t,n,i,r)=>{let s,o;if(Object.assign(e,{startBinding:(e==null?void 0:e.startBinding)||null,endBinding:e.endBinding||null}),t){const u=(t==null?void 0:t.width)??Gl,d=(t==null?void 0:t.height)??Gl;let f;t.id&&(f=i.getElement(t.id),f||console.error(`No element for start binding with id ${t.id} found`));const h=t.x||e.x-u,m=t.y||e.y-d/2,p=f?f.type:t.type;if(p){if(p==="text"){let b="";f&&f.type==="text"?b=f.text:t.type==="text"&&(b=t.text),b||console.error(`No text found for start binding text element for ${e.id}`),s=Br({x:h,y:m,type:"text",...f,...t,text:b}),Object.assign(s,{x:t.x||e.x-s.width,y:t.y||e.y-s.height/2})}else switch(p){case"rectangle":case"ellipse":case"diamond":{s=Xa({x:h,y:m,width:u,height:d,...f,...t,type:p});break}default:pc(e,`Unhandled element start type "${t.type}"`,!0)}zo(e,s,"start",r)}}if(n){const u=(n==null?void 0:n.height)??Gl,d=(n==null?void 0:n.width)??Gl;let f;n.id&&(f=i.getElement(n.id),f||console.error(`No element for end binding with id ${n.id} found`));const h=n.x||e.x+e.width,m=n.y||e.y-u/2,p=f?f.type:n.type;if(p){if(p==="text"){let b="";f&&f.type==="text"?b=f.text:n.type==="text"&&(b=n.text),b||console.error(`No text found for end binding text element for ${e.id}`),o=Br({x:h,y:m,type:"text",...f,...n,text:b}),Object.assign(o,{y:n.y||e.y-o.height/2})}else switch(p){case"rectangle":case"ellipse":case"diamond":{o=Xa({x:h,y:m,width:d,height:u,...f,...n,type:p});break}default:pc(e,`Unhandled element end type "${p}"`,!0)}zo(e,o,"end",r)}}if(e.points.length<2)return{linearElement:e,startBoundElement:s,endBoundElement:o};const a=e.points.length-1,l=.5,c=ka(e.points);return e.points[a][0]>e.points[a-1][0]&&(c[0][0]=l,c[a][0]-=l),e.points[a][0]<e.points[a-1][0]&&(c[0][0]=-.5,c[a][0]+=l),e.points[a][1]>e.points[a-1][1]&&(c[0][1]=l,c[a][1]-=l),e.points[a][1]<e.points[a-1][1]&&(c[0][1]=-.5,c[a][1]+=l),Object.assign(e,{points:c}),{linearElement:e,startBoundElement:s,endBoundElement:o}};class j5e{constructor(){F(this,"excalidrawElements",new Map);F(this,"add",t=>{t&&this.excalidrawElements.set(t.id,t)});F(this,"getElements",()=>Za(Array.from(this.excalidrawElements.values())));F(this,"getElementsMap",()=>ms(Se(this.getElements())));F(this,"getElement",t=>this.excalidrawElements.get(t))}}const n4=(e,t)=>{var a,l,c;if(!e)return[];const n=ka(e),i=new j5e,r=new Map,s=new Map;for(const u of n){let d;const f=u.id;switch((t==null?void 0:t.regenerateIds)!==!1&&Object.assign(u,{id:bs()}),u.type){case"rectangle":case"ellipse":case"diamond":{const m=(a=u==null?void 0:u.label)!=null&&a.text&&u.width===void 0?0:(u==null?void 0:u.width)||Gl,p=(l=u==null?void 0:u.label)!=null&&l.text&&u.height===void 0?0:(u==null?void 0:u.height)||Gl;d=Xa({...u,width:m,height:p});break}case"line":{const m=u.width||gU.width,p=u.height||gU.height;d=Pu({width:m,height:p,points:[C(0,0),C(m,p)],...u});break}case"arrow":{const m=u.width||gU.width,p=u.height||gU.height;d=I9({width:m,height:p,endArrowhead:"arrow",points:[C(0,0),C(m,p)],...u,type:"arrow"}),Object.assign(d,vh(d.points));break}case"text":{const m=(u==null?void 0:u.fontFamily)||Oc,p=(u==null?void 0:u.fontSize)||al,b=(u==null?void 0:u.lineHeight)||qu(m),E=u.text??"",y=bh(E),v=zi(y,xt({fontFamily:m,fontSize:p}),b);d=Br({width:v.width,height:v.height,fontFamily:m,fontSize:p,...u});break}case"image":{d=iB({width:(u==null?void 0:u.width)||Gl,height:(u==null?void 0:u.height)||Gl,...u});break}case"frame":{d=S9({x:0,y:0,...u});break}case"magicframe":{d=aE({x:0,y:0,...u});break}case"freedraw":case"iframe":case"embeddable":{d=u;break}default:d=u,pc(u,`Unhandled element type "${u.type}"`,!0)}i.getElement(d.id)?console.error(`Duplicate id found for ${d.id}`):(i.add(d),r.set(d.id,u),f&&s.set(f,d.id))}const o=i.getElementsMap();for(const[u,d]of r){const f=i.getElement(u);switch(d.type){case"rectangle":case"ellipse":case"diamond":case"arrow":{if((c=d.label)!=null&&c.text){let[h,m]=X5e(f,d==null?void 0:d.label,o);if(i.add(h),i.add(m),Be(h)){const p=d.type==="arrow"?d==null?void 0:d.start:void 0,b=d.type==="arrow"?d==null?void 0:d.end:void 0;if(p&&p.id){const _=s.get(p.id);_&&Object.assign(p,{id:_})}if(b&&b.id){const _=s.get(b.id);_&&Object.assign(b,{id:_})}const{linearElement:E,startBoundElement:y,endBoundElement:v}=uR(h,p,b,i,o);h=E,i.add(E),i.add(y),i.add(v)}}else switch(d.type){case"arrow":{const{start:h,end:m}=d;if(h&&h.id){const y=s.get(h.id);Object.assign(h,{id:y})}if(m&&m.id){const y=s.get(m.id);Object.assign(m,{id:y})}const{linearElement:p,startBoundElement:b,endBoundElement:E}=uR(f,h,m,i,o);i.add(p),i.add(b),i.add(E);break}}break}}}for(const[u,d]of r){if(d.type!=="frame"&&d.type!=="magicframe")continue;const f=i.getElement(u);if(!f)throw new Error(`Excalidraw element with id ${u} doesn't exist`);const h=[];d.children.forEach(w=>{var S;const T=s.get(w);if(!T)throw new Error(`Element with ${w} wasn't mapped correctly`);const A=i.getElement(T);if(!A)throw new Error(`Frame element with id ${T} doesn't exist`);Object.assign(A,{frameId:f.id}),(S=A==null?void 0:A.boundElements)==null||S.forEach(k=>{const N=i.getElement(k.id);if(!N)throw new Error(`Bound element with id ${k.id} doesn't exist`);Object.assign(N,{frameId:f.id}),h.push(N)}),h.push(A)});let[m,p,b,E]=wt(h);const y=10;m=m-y,p=p-y,b=b+y,E=E+y;const v=(f==null?void 0:f.x)||m,_=(f==null?void 0:f.y)||p,I=(f==null?void 0:f.width)||b-m,R=(f==null?void 0:f.height)||E-p;Object.assign(f,{x:v,y:_,width:I,height:R})}return i.getElements()},Y5e=e=>{const t=oo();return M.useLayoutEffect(()=>{t.setPlugins({diagramToCode:{generate:e.generate}})},[t,e.generate]),null};CO();const W5e=e=>{var j,X,Y,le;const{onChange:t,initialData:n,excalidrawAPI:i,isCollaborating:r=!1,onPointerUpdate:s,renderTopRightUI:o,langCode:a=Sd.code,viewModeEnabled:l,zenModeEnabled:c,gridModeEnabled:u,libraryReturnUrl:d,theme:f,name:h,renderCustomStats:m,onPaste:p,detectScroll:b=!0,handleKeyboardGlobally:E=!1,onLibraryChange:y,autoFocus:v=!1,generateIdForFile:_,onLinkOpen:I,generateLinkForSelection:R,onPointerDown:w,onPointerUp:T,onScrollChange:A,onDuplicate:S,children:k,validateEmbeddable:N,renderEmbeddable:D,aiEnabled:G,showDeprecatedFonts:V}=e,H=(j=e.UIOptions)==null?void 0:j.canvasActions,$={...e.UIOptions,canvasActions:{...BI.canvasActions,...H},tools:{image:((Y=(X=e.UIOptions)==null?void 0:X.tools)==null?void 0:Y.image)??!0}};return H!=null&&H.export&&($.canvasActions.export.saveFileToDisk=((le=H.export)==null?void 0:le.saveFileToDisk)??BI.canvasActions.export.saveFileToDisk),$.canvasActions.toggleTheme===null&&typeof f>"u"&&($.canvasActions.toggleTheme=!0),M.useEffect(()=>{(async()=>{await be(()=>import("./roundRect-0PYZxl1G.js"),__vite__mapDeps([]))})();const ae=ze=>{typeof ze.scale=="number"&&ze.scale!==1&&ze.preventDefault()};return document.addEventListener("touchmove",ae,{passive:!1}),()=>{document.removeEventListener("touchmove",ae)}},[]),g(rJ,{store:Ns,children:g(h5e,{langCode:a,theme:f,children:g(uw,{onChange:t,initialData:n,excalidrawAPI:i,isCollaborating:r,onPointerUpdate:s,renderTopRightUI:o,langCode:a,viewModeEnabled:l,zenModeEnabled:c,gridModeEnabled:u,libraryReturnUrl:d,theme:f,name:h,renderCustomStats:m,UIOptions:$,onPaste:p,detectScroll:b,handleKeyboardGlobally:E,onLibraryChange:y,autoFocus:v,generateIdForFile:_,onLinkOpen:I,generateLinkForSelection:R,onPointerDown:w,onPointerUp:T,onScrollChange:A,onDuplicate:S,validateEmbeddable:N,renderEmbeddable:D,aiEnabled:G!==!1,showDeprecatedFonts:V,children:k})})})},K5e=(e,t)=>{if(e.children!==t.children)return!1;const{initialData:n,UIOptions:i={},...r}=e,{initialData:s,UIOptions:o={},...a}=t,l=Object.keys(i),c=Object.keys(o);return l.length!==c.length?!1:l.every(d=>d==="canvasActions"?Object.keys(i.canvasActions).every(h=>{var m,p,b,E;return h==="export"&&((m=i==null?void 0:i.canvasActions)!=null&&m.export)&&((p=o==null?void 0:o.canvasActions)!=null&&p.export)?i.canvasActions.export.saveFileToDisk===o.canvasActions.export.saveFileToDisk:((b=i==null?void 0:i.canvasActions)==null?void 0:b[h])===((E=o==null?void 0:o.canvasActions)==null?void 0:E[h])}):i[d]===o[d])&&vi(r,a)},XG=se.memo(W5e,K5e);XG.displayName="Excalidraw";const Z5e=({canvasRef:e,setError:t})=>{const n=e.current;if(!n)return;const i=n.parentElement;i&&(i.style.background="",t(null),n.replaceChildren())},jG=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:i,data:r})=>{const s=e.current,o=s==null?void 0:s.parentElement;if(!(!s||!o)){if(!n){Z5e({canvasRef:e,setError:i});return}try{const a=await t.api;let l;try{l=await a.parseMermaidToExcalidraw(n)}catch{l=await a.parseMermaidToExcalidraw(n.replace(/"/g,"'"))}const{elements:c,files:u={}}=l;i(null),r.current={elements:n4(c,{regenerateIds:!0}),files:u};const d=await d5({elements:r.current.elements,files:r.current.files,exportPadding:qh,maxWidthOrHeight:Math.max(o.offsetWidth,o.offsetHeight)*window.devicePixelRatio});try{await Q0(d)}catch(f){throw f.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(L("canvasError.canvasTooBig")):f}o.style.background="var(--default-bg-color)",s.replaceChildren(d)}catch(a){throw o.style.background="var(--default-bg-color)",n&&i(a),a}}},nw=e=>{Bu.set(Hg.MERMAID_TO_EXCALIDRAW,e)},YG=({app:e,data:t,text:n,shouldSaveMermaidDataToStorage:i})=>{const{elements:r,files:s}=t.current;r.length&&(e.addElementsFromPasteOrLibrary({elements:r,files:s,position:"center",fitToContent:!0}),e.setOpenDialog(null),i&&n&&nw(n))},WG=({children:e})=>g("div",{className:"ttd-dialog-panels",children:e}),jb=({label:e,children:t,panelAction:n,panelActionDisabled:i=!1,onTextSubmitInProgess:r,renderTopRight:s,renderSubmitShortcut:o,renderBottomRight:a})=>P("div",{className:"ttd-dialog-panel",children:[P("div",{className:"ttd-dialog-panel__header",children:[g("label",{children:e}),s==null?void 0:s()]}),t,P("div",{className:me("ttd-dialog-panel-button-container",{invisible:!n}),style:{display:"flex",alignItems:"center"},children:[P(cd,{className:"ttd-dialog-panel-button",onSelect:n?n.action:()=>{},disabled:i||r,children:[P("div",{className:me({invisible:r}),children:[n==null?void 0:n.label,(n==null?void 0:n.icon)&&g("span",{children:n.icon})]}),r&&g(qa,{})]}),!i&&!r&&(o==null?void 0:o()),a==null?void 0:a()]})]}),KG=({input:e,placeholder:t,onChange:n,onKeyboardSubmit:i})=>{const r=M.useRef(null),s=M.useRef(i);return s.current=i,M.useEffect(()=>{if(!s.current)return;const o=r.current;if(o){const a=l=>{var c;l[z.CTRL_OR_CMD]&&l.key===z.ENTER&&(l.preventDefault(),(c=s.current)==null||c.call(s))};return o.addEventListener(te.KEYDOWN,a),()=>{o.removeEventListener(te.KEYDOWN,a)}}},[]),g("textarea",{className:"ttd-dialog-input",onChange:n,value:e,placeholder:t,autoFocus:!0,ref:r})},q5e=({error:e})=>P("div",{"data-testid":"ttd-dialog-output-error",className:"ttd-dialog-output-error",children:["Error! ",g("p",{children:e})]}),ZG=({error:e,canvasRef:t,loaded:n})=>P("div",{className:"ttd-dialog-output-wrapper",children:[e&&g(q5e,{error:e.message}),n?g("div",{ref:t,style:{opacity:e?"0.15":1},className:"ttd-dialog-output-canvas-container"}):g(qa,{size:"2rem"})]}),qG=()=>P("div",{className:"ttd-dialog-submit-shortcut",children:[g("div",{className:"ttd-dialog-submit-shortcut__key",children:Q("CtrlOrCmd")}),g("div",{className:"ttd-dialog-submit-shortcut__key",children:Q("Enter")})]}),Q5e=`flowchart TD
 A[Christmas] -->|Get money| B(Go shopping)
 B --> C{Let me think}
 C -->|One| D[Laptop]
 C -->|Two| E[iPhone]
 C -->|Three| F[Car]`,dR=Ga(nw,300),J5e=({mermaidToExcalidrawLib:e})=>{const[t,n]=M.useState(()=>Bu.get(Hg.MERMAID_TO_EXCALIDRAW)||Q5e),i=M.useDeferredValue(t.trim()),[r,s]=M.useState(null),o=M.useRef(null),a=M.useRef({elements:[],files:null}),l=oo();M.useEffect(()=>{jG({canvasRef:o,data:a,mermaidToExcalidrawLib:e,setError:s,mermaidDefinition:i}).catch(u=>{}),dR(i)},[i,e]),M.useEffect(()=>()=>{dR.flush()},[]);const c=()=>{YG({app:l,data:a,text:t,shouldSaveMermaidDataToStorage:!0})};return P(he,{children:[g("div",{className:"ttd-dialog-desc",children:g(gr,{i18nKey:"mermaid.description",flowchartLink:u=>g("a",{href:"https://mermaid.js.org/syntax/flowchart.html",children:u}),sequenceLink:u=>g("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",children:u}),classLink:u=>g("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",children:u})})}),P(WG,{children:[g(jb,{label:L("mermaid.syntax"),children:g(KG,{input:t,placeholder:"Write Mermaid diagram defintion here...",onChange:u=>n(u.target.value),onKeyboardSubmit:()=>{c()}})}),g(jb,{label:L("mermaid.preview"),panelAction:{action:()=>{c()},label:L("mermaid.button"),icon:KU},renderSubmitShortcut:()=>g(qG,{}),children:g(ZG,{canvasRef:o,loaded:e.loaded,error:r})})]})]})},QG=e=>{const t=zn(),n=M.useRef(null),i=M.useRef(0);return g(hG,{ref:n,className:"ttd-dialog-tabs-root",value:e.tab,onValueChange:r=>{var o;if(!r)return;const s=(o=n.current)==null?void 0:o.closest(".Modal__content");if(s){const a=s.offsetHeight||0;a>i.current&&(i.current=a,s.style.minHeight=`min(${i.current}px, 100%)`)}e.dialog==="ttd"&&lF(["text-to-diagram","mermaid"],r)&&t({openDialog:{name:e.dialog,tab:r}})},children:e.children})};QG.displayName="TTDDialogTabs";const JG=({children:e,...t})=>g(gG,{className:"ttd-dialog-triggers",...t,children:e});JG.displayName="TTDDialogTabTriggers";const i4=({children:e,tab:t,onSelect:n,...i})=>g(mG,{value:t,asChild:!0,onSelect:n,children:g("button",{type:"button",className:"ttd-dialog-tab-trigger",...i,children:e})});i4.displayName="TTDDialogTabTrigger";const r4=({tab:e,children:t,...n})=>g(pG,{...n,value:e,children:t});r4.displayName="TTDDialogTab";const m7=3,tf=1e3,eye=qt(null),tye=qt(null),eX=e=>{var n;const t=fi();return((n=t.openDialog)==null?void 0:n.name)!=="ttd"?null:g(nye,{...e,tab:t.openDialog.tab})},nye=qm("TTDDialogBase",({tab:e,...t})=>{const n=oo(),i=zn(),r=M.useRef(null),[s,o]=gn(tye),[a,l]=M.useState((s==null?void 0:s.prompt)??""),c=a.trim(),u=R=>{l(R.target.value),o(w=>({generatedResponse:(w==null?void 0:w.generatedResponse)??null,prompt:R.target.value}))},[d,f]=M.useState(!1),[h,m]=gn(eye),p=async()=>{if(c.length>tf||c.length<m7||d||(h==null?void 0:h.rateLimitRemaining)===0||"__fallback"in t){c.length<m7&&I(new Error(`Prompt is too short (min ${m7} characters)`)),c.length>tf&&I(new Error(`Prompt is too long (max ${tf} characters)`));return}try{f(!0),ut("ai","generate","ttd");const{generatedResponse:R,error:w,rateLimit:T,rateLimitRemaining:A}=await t.onTextSubmit(c);if(typeof R=="string"&&o(S=>({generatedResponse:R,prompt:(S==null?void 0:S.prompt)??null})),$g(T)&&$g(A)&&m({rateLimit:T,rateLimitRemaining:A}),w){I(w);return}if(!R){I(new Error("Generation failed"));return}try{await jG({canvasRef:r,data:v,mermaidToExcalidrawLib:E,setError:I,mermaidDefinition:R}),ut("ai","mermaid parse success","ttd")}catch(S){console.info(`%cTTD mermaid render errror: ${S.message}`,"color: red"),console.info(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
TTD mermaid definition render errror: ${S.message}`,"color: yellow"),ut("ai","mermaid parse failed","ttd"),I(new Error("Generated an invalid diagram :(. You may also try a different prompt."))}}catch(R){let w=R.message;(!w||w==="Failed to fetch")&&(w="Request failed"),I(new Error(w))}finally{f(!1)}},b=M.useRef(p);b.current=p;const[E,y]=M.useState({loaded:!1,api:be(()=>import("./index-BNUs3Dpc.js").then(R=>R.bs),__vite__mapDeps([]))});M.useEffect(()=>{(async()=>{await E.api,y(w=>({...w,loaded:!0}))})()},[E.api]);const v=M.useRef({elements:[],files:null}),[_,I]=M.useState(null);return g(Hr,{className:"ttd-dialog",onCloseRequest:()=>{n.setOpenDialog(null)},size:1200,title:!1,...t,autofocus:!1,children:P(QG,{dialog:"ttd",tab:e,children:["__fallback"in t&&t.__fallback?g("p",{className:"dialog-mermaid-title",children:L("mermaid.title")}):P(JG,{children:[g(i4,{tab:"text-to-diagram",children:P("div",{style:{display:"flex",alignItems:"center"},children:[L("labels.textToDiagram"),g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1px 6px",marginLeft:"10px",fontSize:10,borderRadius:"12px",background:"var(--color-promo)",color:"var(--color-surface-lowest)"},children:"AI Beta"})]})}),g(i4,{tab:"mermaid",children:"Mermaid"})]}),g(r4,{className:"ttd-dialog-content",tab:"mermaid",children:g(J5e,{mermaidToExcalidrawLib:E})}),!("__fallback"in t)&&P(r4,{className:"ttd-dialog-content",tab:"text-to-diagram",children:[g("div",{className:"ttd-dialog-desc",children:"Currently we use Mermaid as a middle step, so you'll get best results if you describe a diagram, workflow, flow chart, and similar."}),P(WG,{children:[g(jb,{label:L("labels.prompt"),panelAction:{action:p,label:"Generate",icon:KU},onTextSubmitInProgess:d,panelActionDisabled:c.length>tf||(h==null?void 0:h.rateLimitRemaining)===0,renderTopRight:()=>h?P("div",{className:"ttd-dialog-rate-limit",style:{fontSize:12,marginLeft:"auto",color:h.rateLimitRemaining===0?"var(--color-danger)":void 0},children:[h.rateLimitRemaining," requests left today"]}):null,renderSubmitShortcut:()=>g(qG,{}),renderBottomRight:()=>{if(typeof(s==null?void 0:s.generatedResponse)=="string")return P("div",{className:"excalidraw-link",style:{marginLeft:"auto",fontSize:14},onClick:()=>{typeof(s==null?void 0:s.generatedResponse)=="string"&&(nw(s.generatedResponse),i({openDialog:{name:"ttd",tab:"mermaid"}}))},children:["View as Mermaid",g(A5,{icon:KU})]});const R=c.length/tf;return R>.8?P("div",{style:{marginLeft:"auto",fontSize:12,fontFamily:"monospace",color:R>1?"var(--color-danger)":void 0},children:["Length: ",c.length,"/",tf]}):null},children:g(KG,{onChange:u,input:a,placeholder:"Describe what you want to see...",onKeyboardSubmit:()=>{b.current()}})}),g(jb,{label:"Preview",panelAction:{action:()=>{console.info("Panel action clicked"),YG({app:n,data:v})},label:"Insert",icon:KU},children:g(ZG,{canvasRef:r,error:_,loaded:E.loaded})})]})]})]})})}),iye=({sourceElementId:e,onClose:t,elementsMap:n,appState:i,generateLinkForSelection:r=Fz})=>{var d;const s=((d=n.get(e))==null?void 0:d.link)??null,[o,a]=M.useState(s),[l,c]=M.useState(!1);M.useEffect(()=>{const f=Fe(n,i);let h=s;if(f.length>0&&r){const m=Bz(f,i);m&&(h=Or(r(m.id,m.type)))}a(h)},[n,i,i.selectedElementIds,s,r]);const u=M.useCallback(()=>{var f;if(o&&o!==((f=n.get(e))==null?void 0:f.link)){const h=n.get(e);h&&ee(h,{link:o})}if(!o&&l&&e){const h=n.get(e);h&&ee(h,{link:null})}t==null||t()},[e,o,n,l,t]);return M.useEffect(()=>{const f=h=>{var m,p;((m=i.openDialog)==null?void 0:m.name)==="elementLinkSelector"&&h.key===z.ENTER&&u(),((p=i.openDialog)==null?void 0:p.name)==="elementLinkSelector"&&h.key===z.ESCAPE&&(t==null||t())};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[i,t,u]),P("div",{className:"ElementLinkDialog",children:[P("div",{className:"ElementLinkDialog__header",children:[g("h2",{children:L("elementLink.title")}),g("p",{children:L("elementLink.desc")})]}),P("div",{className:"ElementLinkDialog__input",children:[g(Ah,{value:o??"",onChange:f=>{l||c(!0),a(f)},onKeyDown:f=>{f.key===z.ENTER&&u()},className:"ElementLinkDialog__input-field",selectOnRender:!0}),s&&o&&g(Ke,{type:"button",title:L("buttons.remove"),"aria-label":L("buttons.remove"),label:L("buttons.remove"),onClick:()=>{a(null),c(!0)},className:"ElementLinkDialog__remove",icon:bc})]}),P("div",{className:"ElementLinkDialog__actions",children:[g(Rh,{label:L("buttons.cancel"),onClick:()=>{t==null||t()},style:{marginRight:10}}),g(Rh,{label:L("buttons.confirm"),onClick:u,actionType:"primary"})]})]})},rye=({UIOptions:e})=>P(vt,{__fallback:!0,children:[g(vt.DefaultItems.LoadScene,{}),g(vt.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&g(vt.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&g(vt.DefaultItems.SaveAsImage,{}),g(vt.DefaultItems.SearchMenu,{}),g(vt.DefaultItems.Help,{}),g(vt.DefaultItems.ClearCanvas,{}),g(vt.Separator,{}),g(vt.Group,{title:"Excalidraw links",children:g(vt.DefaultItems.Socials,{})}),g(vt.Separator,{}),g(vt.DefaultItems.ToggleTheme,{}),g(vt.DefaultItems.ChangeCanvasBackground,{})]}),sye=()=>P(Tu,{__fallback:!0,children:[g(Tu.Actions.SaveToDisk,{}),g(Tu.Actions.ExportToImage,{})]}),oye=({actionManager:e,appState:t,files:n,setAppState:i,elements:r,canvas:s,onLockToggle:o,onHandToolToggle:a,onPenModeToggle:l,showExitZenModeBtn:c,renderTopRightUI:u,renderCustomStats:d,UIOptions:f,onExportImage:h,renderWelcomeScreen:m,children:p,app:b,isCollaborating:E,generateLinkForSelection:y})=>{var H,$,j;const v=Qn(),_=u2e(),I=_.tunnelsJotai.Provider,[R,w]=gn(C5),T=()=>f.canvasActions.export?g(Nbe,{elements:r,appState:t,files:n,actionManager:e,exportOpts:f.canvasActions.export,canvas:s,setAppState:i}):null,A=()=>{var X;return!f.canvasActions.saveAsImage||((X=t.openDialog)==null?void 0:X.name)!=="imageExport"?null:g(ube,{elements:r,appState:t,files:n,actionManager:e,onExportImage:h,onCloseRequest:()=>i({openDialog:null}),name:b.getName()})},S=()=>P("div",{style:{position:"relative"},children:[g(_.MainMenuTunnel.Out,{}),m&&g(_.WelcomeScreenMenuHintTunnel.Out,{})]}),k=()=>g(am,{heading:"selectedShapeActions",className:me("selected-shape-actions zen-mode-transition",{"transition-left":t.zenModeEnabled}),children:g(Ys,{className:hh.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:g(I$,{appState:t,elementsMap:b.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:b})})}),N=()=>{var le,pe,ae,ze,Xe;const X=f_(t,r),Y=t.stats.open&&!t.zenModeEnabled&&!t.viewModeEnabled&&((le=t.openDialog)==null?void 0:le.name)!=="elementLinkSelector";return g(H$,{side:"top",children:P("div",{className:"App-menu App-menu_top",children:[P(ss.Col,{gap:6,className:me("App-menu_top__left"),children:[S(),X&&k()]}),!t.viewModeEnabled&&((pe=t.openDialog)==null?void 0:pe.name)!=="elementLinkSelector"&&g(am,{heading:"shapes",className:"shapes-section",children:qe=>P("div",{style:{position:"relative"},children:[m&&g(_.WelcomeScreenToolbarHintTunnel.Out,{}),g(ss.Col,{gap:4,align:"start",children:P(ss.Row,{gap:1,className:me("App-toolbar-container",{"zen-mode":t.zenModeEnabled}),children:[P(Ys,{padding:1,className:me("App-toolbar",{"zen-mode":t.zenModeEnabled}),children:[g(G$,{appState:t,isMobile:v.editor.isMobile,device:v,app:b}),qe,P(ss.Row,{gap:1,children:[g(Y$,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>l(null),title:L("toolBar.penMode"),penDetected:t.penDetected}),g(j$,{checked:t.activeTool.locked,onChange:o,title:L("toolBar.lock")}),g("div",{className:"App-toolbar__divider"}),g(W$,{checked:mh(t),onChange:()=>a(),title:L("toolBar.hand"),isMobile:!0}),g(x$,{appState:t,activeTool:t.activeTool,UIOptions:f,app:b})]})]}),E&&g(Ys,{style:{marginLeft:8,alignSelf:"center",height:"fit-content"},children:g(f5e,{title:L("toolBar.laser"),checked:t.activeTool.type===Gn.laser,onChange:()=>b.setActiveTool({type:Gn.laser}),isMobile:!0})})]})})]})}),P("div",{className:me("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":t.zenModeEnabled}),children:[t.collaborators.size>0&&g(K$,{collaborators:t.collaborators,userToFollow:((ae=t.userToFollow)==null?void 0:ae.socketId)||null}),u==null?void 0:u(v.editor.isMobile,t),!t.viewModeEnabled&&((ze=t.openDialog)==null?void 0:ze.name)!=="elementLinkSelector"&&(!G||((Xe=t.openSidebar)==null?void 0:Xe.name)!==ls.name)&&g(_.DefaultSidebarTriggerTunnel.Out,{}),Y&&g(pa,{app:b,onClose:()=>{e.executeAction($E)},renderCustomStats:d})]})]})})},D=()=>g(JM,{__fallback:!0,onDock:X=>{ut("sidebar",`toggleDock (${X?"dock":"undock"})`,`(${v.editor.isMobile?"mobile":"desktop"})`)}}),G=PP($_),V=P(he,{children:[p,g(rye,{UIOptions:f}),g(JM.Trigger,{__fallback:!0,icon:g9,title:Xg(L("toolBar.library")),onToggle:X=>{X&&ut("sidebar",`${ls.name} (open)`,`button (${v.editor.isMobile?"mobile":"desktop"})`)},tab:ls.defaultTab,children:L("toolBar.library")}),g(sye,{}),((H=t.openDialog)==null?void 0:H.name)==="ttd"&&g(eX,{__fallback:!0}),t.isLoading&&g(X$,{delay:250}),t.errorMessage&&g(dw,{onClose:()=>i({errorMessage:null}),children:t.errorMessage}),R&&!v.editor.isMobile&&g(Epe,{colorPickerType:R.colorPickerType,onCancel:()=>{w(null)},onChange:(X,Y,le,{altKey:pe})=>{var ae;if(!(X!=="elementBackground"&&X!=="elementStroke"))if(le.length){for(const ze of le)ee(ze,{[pe&&R.swapPreviewOnAlt?X==="elementBackground"?"strokeColor":"backgroundColor":X==="elementBackground"?"backgroundColor":"strokeColor"]:Y},!1),Gt.delete(ze);(ae=eo.getScene(le[0]))==null||ae.triggerUpdate()}else i(X==="elementBackground"?{currentItemBackgroundColor:Y}:{currentItemStrokeColor:Y})},onSelect:(X,Y)=>{var le;w(pe=>pe!=null&&pe.keepOpenOnAlt&&Y.altKey?pe:null),(le=R==null?void 0:R.onSelect)==null||le.call(R,X,Y)}}),(($=t.openDialog)==null?void 0:$.name)==="help"&&g(Abe,{onClose:()=>{i({openDialog:null})}}),g(j2e,{}),((j=t.openDialog)==null?void 0:j.name)==="elementLinkSelector"&&g(iye,{sourceElementId:t.openDialog.sourceElementId,onClose:()=>{i({openDialog:null})},elementsMap:b.scene.getNonDeletedElementsMap(),appState:t,generateLinkForSelection:y}),g(_.OverwriteConfirmDialogTunnel.Out,{}),A(),T(),t.pasteDialog.shown&&g(wbe,{setAppState:i,appState:t,onClose:()=>i({pasteDialog:{shown:!1,data:null}})}),v.editor.isMobile&&g(_be,{app:b,appState:t,elements:r,actionManager:e,renderJSONExportDialog:T,renderImageExportDialog:A,setAppState:i,onLockToggle:o,onHandToolToggle:a,onPenModeToggle:l,renderTopRightUI:u,renderCustomStats:d,renderSidebars:D,device:v,renderWelcomeScreen:m,UIOptions:f}),!v.editor.isMobile&&P(he,{children:[P("div",{className:"layer-ui__wrapper",style:t.openSidebar&&G&&v.editor.canFitSidebar?{width:"calc(100% - var(--right-sidebar-width))"}:{},children:[m&&g(_.WelcomeScreenCenterTunnel.Out,{}),N(),g(Z$,{appState:t,actionManager:e,showExitZenModeBtn:c,renderWelcomeScreen:m}),t.scrolledOutside&&g("button",{type:"button",className:"scroll-back-to-content",onClick:()=>{i(X=>({...im(r,X)}))},children:L("buttons.scrollBackToContent")})]}),D()]})]});return g(XV.Provider,{value:t,children:g(I,{children:g(w$.Provider,{value:_,children:V})})})},fR=e=>{const{suggestedBindings:t,startBoundElement:n,cursorButton:i,scrollX:r,scrollY:s,...o}=e;return o},aye=(e,t)=>{if(e.children!==t.children)return!1;const{canvas:n,appState:i,...r}=e,{canvas:s,appState:o,...a}=t;return vi(fR(i),fR(o),{selectedElementIds:vi,selectedGroupIds:vi})&&vi(r,a)},lye=se.memo(oye,aye),cye=5e3,uye=({message:e,onClose:t,closable:n=!1,duration:i=cye,style:r})=>{const s=M.useRef(0),o=i!==1/0,a=M.useCallback(()=>{o&&(s.current=window.setTimeout(()=>t(),i))},[t,i,o]);return M.useEffect(()=>{if(o)return a(),()=>clearTimeout(s.current)},[a,e,i,o]),P("div",{className:"Toast",onMouseEnter:o?()=>clearTimeout(s==null?void 0:s.current):void 0,onMouseLeave:o?a:void 0,style:r,children:[g("p",{className:"Toast__message",children:e}),n&&g(Ke,{icon:xd,"aria-label":"close",type:"icon",onClick:t,className:"close"})]})},hR=oe({name:"viewMode",label:"labels.viewMode",paletteName:"Toggle view mode",icon:v9,viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},captureUpdate:Z.EVENTUALLY}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>"u",keyTest:e=>!e[z.CTRL_OR_CMD]&&e.altKey&&e.code===tt.R}),tX=(e,t)=>{const n=t.scene.getSelectedElements(e);return n.length===1&&Ie(n[0])},dye=oe({name:"selectAllElementsInFrame",label:"labels.selectAllElementsInFrame",trackEvent:{category:"canvas"},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t).at(0)||null;if(Ie(r)){const s=Ho(Nt(e),r.id).filter(o=>!(o.type==="text"&&o.containerId));return{elements:e,appState:{...t,selectedElementIds:s.reduce((o,a)=>(o[a.id]=!0,o),{})},captureUpdate:Z.IMMEDIATELY}}return{elements:e,appState:t,captureUpdate:Z.EVENTUALLY}},predicate:(e,t,n,i)=>tX(t,i)}),fye=oe({name:"removeAllElementsFromFrame",label:"labels.removeAllElementsFromFrame",trackEvent:{category:"history"},perform:(e,t,n,i)=>{const r=i.scene.getSelectedElements(t).at(0)||null;return Ie(r)?{elements:rH(e,r),appState:{...t,selectedElementIds:{[r.id]:!0}},captureUpdate:Z.IMMEDIATELY}:{elements:e,appState:t,captureUpdate:Z.EVENTUALLY}},predicate:(e,t,n,i)=>tX(t,i)});oe({name:"updateFrameRendering",label:"labels.updateFrameRendering",viewMode:!0,trackEvent:{category:"canvas"},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},captureUpdate:Z.EVENTUALLY}),checked:e=>e.frameRendering.enabled});oe({name:"setFrameAsActiveTool",label:"toolBar.frame",trackEvent:{category:"toolbar"},icon:GF,viewMode:!1,perform:(e,t,n,i)=>{const r=Sn(t,{type:"frame"});return go(i.interactiveCanvas,{...t,activeTool:r}),{elements:e,appState:{...t,activeTool:Sn(t,{type:"frame"})},captureUpdate:Z.EVENTUALLY}},keyTest:e=>!e[z.CTRL_OR_CMD]&&!e.shiftKey&&!e.altKey&&e.key.toLocaleLowerCase()===z.F});const hye=oe({name:"wrapSelectionInFrame",label:"labels.wrapSelectionInFrame",trackEvent:{category:"element"},predicate:(e,t,n,i)=>{const r=Fe(e,t);return r.length>0&&!r.some(s=>Ie(s))},perform:(e,t,n,i)=>{const r=Fe(e,t),[s,o,a,l]=wt(r,i.scene.getNonDeletedElementsMap()),c=16,u=S9({x:s-c,y:o-c,width:a-s+c*2,height:l-o+c*2});if(t.editingGroupId){const f=$t(r,t.editingGroupId);for(const h of f){const m=h.groupIds.indexOf(t.editingGroupId);ee(h,{groupIds:h.groupIds.slice(0,m)},!1)}}return{elements:Qg([...i.scene.getElementsIncludingDeleted(),u],r,u,t),appState:{selectedElementIds:{[u.id]:!0}},captureUpdate:Z.IMMEDIATELY}}}),gye=()=>P("div",{"data-testid":"brave-measure-text-error",children:[g("p",{children:g(gr,{i18nKey:"errors.brave_measure_text_error.line1",bold:e=>g("span",{style:{fontWeight:600},children:e})})}),g("p",{children:g(gr,{i18nKey:"errors.brave_measure_text_error.line2",bold:e=>g("span",{style:{fontWeight:600},children:e})})}),g("p",{children:g(gr,{i18nKey:"errors.brave_measure_text_error.line3",link:e=>g("a",{href:"http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser",children:e})})}),g("p",{children:g(gr,{i18nKey:"errors.brave_measure_text_error.line4",issueLink:e=>g("a",{href:"https://github.com/excalidraw/excalidraw/issues/new",children:e}),discordLink:e=>P("a",{href:"https://discord.gg/UexuTaE",children:[e,"."]})})})]}),en=e=>t=>{Xn.unstable_batchedUpdates(e,t)},p7=e=>Qh(t=>{Xn.unstable_batchedUpdates(e,t)}),iw=(()=>{let e;try{const n=M.version.split(".");e=Number(n[0])>17}catch{e=!1}let t=!1;return()=>window.EXCALIDRAW_THROTTLE_RENDER===!0?e?!0:(t||(t=!0,console.warn("Excalidraw: render throttling is disabled on React versions < 18.")),!1):!1})(),mye="#ff6b6b",pye="#ff0000",gR=1,mR=2,Uye=(e,t)=>{if(!t.snapLines.length)return;const n=t.theme===xe.LIGHT||t.zenModeEnabled?mye:pye,i=(t.zenModeEnabled?gR*1.5:gR)/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY);for(const r of t.snapLines)r.type==="pointer"?(e.lineWidth=i,e.strokeStyle=n,yye(r,e,t)):r.type==="gap"?(e.lineWidth=i,e.strokeStyle=n,Eye(r.points[0],r.points[1],r.direction,t,e)):r.type==="points"&&(e.lineWidth=i,e.strokeStyle=n,bye(r,e,t));e.restore()},bye=(e,t,n)=>{if(!n.zenModeEnabled){const i=e.points[0],r=e.points[e.points.length-1];jr(i,r,t)}for(const i of e.points)nX(i,n,t)},yye=(e,t,n)=>{nX(e.points[0],n,t),n.zenModeEnabled||jr(e.points[0],e.points[1],t)},nX=([e,t],n,i)=>{i.save();const r=(n.zenModeEnabled?mR*1.5:mR)/n.zoom.value;i.beginPath(),i.moveTo(e-r,t-r),i.lineTo(e+r,t+r),i.moveTo(e+r,t-r),i.lineTo(e-r,t+r),i.stroke(),i.restore()},jr=(e,t,n)=>{n.beginPath(),n.lineTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.stroke()},Eye=(e,t,n,i,r)=>{const s=8/i.zoom.value,o=s/2,a=s/4;if(n==="horizontal"){const l=[(e[0]+t[0])/2,e[1]];i.zenModeEnabled||jr(C(e[0],e[1]-s),C(e[0],e[1]+s),r),jr(C(l[0]-a,l[1]-o),C(l[0]-a,l[1]+o),r),jr(C(l[0]+a,l[1]-o),C(l[0]+a,l[1]+o),r),i.zenModeEnabled||(jr(C(t[0],t[1]-s),C(t[0],t[1]+s),r),jr(e,t,r))}else{const l=[e[0],(e[1]+t[1])/2];i.zenModeEnabled||jr(C(e[0]-s,e[1]),C(e[0]+s,e[1]),r),jr(C(l[0]-o,l[1]-a),C(l[0]+o,l[1]-a),r),jr(C(l[0]-o,l[1]+a),C(l[0]+o,l[1]+a),r),i.zenModeEnabled||(jr(C(t[0]-s,t[1]),C(t[0]+s,t[1]),r),jr(e,t,r))}},vye=(e,t)=>{qi(t.selectedLinearElement,"selectedLinearElement is null");const{segmentMidPointHoveredCoords:n}=t.selectedLinearElement;qi(n,"midPointCoords is null"),e.save(),e.translate(t.scrollX,t.scrollY),iX(n,e,t),e.restore()},_ye=(e,t,n)=>{var a,l;const{elementId:i,hoverPointIndex:r}=t.selectedLinearElement;if((l=(a=t.editingLinearElement)==null?void 0:a.selectedPointsIndices)!=null&&l.includes(r))return;const s=ue.getElement(i,n);if(!s)return;const o=ue.getPointAtIndexGlobalCoordinates(s,r,n);e.save(),e.translate(t.scrollX,t.scrollY),iX(o,e,t),e.restore()},iX=(e,t,n)=>{t.fillStyle="rgba(105, 101, 219, 0.4)",a5(t,e[0],e[1],ue.POINT_HANDLE_SIZE/n.zoom.value,!1)},Jm=(e,t,n,i,r,s,o,a,l=!1,c=0)=>{e.save(),e.translate(s,o),e.rotate(a),l&&e.fillRect(t-s,n-o,i,r),c&&e.roundRect?(e.beginPath(),e.roundRect(t-s,n-o,i,r,c),e.stroke(),e.closePath()):e.strokeRect(t-s,n-o,i,r),e.restore()},wye=(e,t,n,i,r,s)=>{e.save(),e.translate(i,r),e.rotate(s),e.beginPath(),e.moveTo(0,n/2),e.lineTo(t/2,0),e.lineTo(0,-n/2),e.lineTo(-t/2,0),e.closePath(),e.stroke(),e.restore()},U7=(e,t,n,i,r,s=!1)=>{e.strokeStyle="#5e5ad8",e.setLineDash([]),e.fillStyle="rgba(255, 255, 255, 0.9)",r?e.fillStyle="rgba(134, 131, 226, 0.9)":s&&(e.fillStyle="rgba(177, 151, 252, 0.7)"),a5(e,n[0],n[1],i/t.zoom.value,!s)},Tye=(e,t,n,i,r,s)=>{e.beginPath(),e.ellipse(i,r,t/2,n/2,s,0,Math.PI*2),e.stroke()},Sye=(e,t,n,i)=>{const[r,s,o,a]=De(t,n),l=o-r,c=a-s;e.strokeStyle="rgba(0,0,0,.05)";const u=i.value<1?i.value:1;e.lineWidth=A9/u;const d=e.lineWidth/2+M9,f=$s(Math.min(t.width,t.height),t);switch(t.type){case"rectangle":case"text":case"image":case"iframe":case"embeddable":case"frame":case"magicframe":Jm(e,r-d,s-d,l+d*2,c+d*2,r+l/2,s+c/2,t.angle,void 0,f);break;case"diamond":const h=Math.hypot(l,c),m=d*h/c,p=d*h/l;wye(e,l+m*2,c+p*2,r+l/2,s+c/2,t.angle);break;case"ellipse":Tye(e,l+d*2,c+d*2,r+l/2,s+c/2,t.angle);break}},Iye=(e,t,n,i)=>{const[r,s,o]=t,a=Gm(o,o.width,o.height,i);e.strokeStyle="rgba(0,0,0,0)",e.fillStyle="rgba(0,0,0,.05)",(s==="both"?[0,-1]:s==="start"?[0]:[-1]).forEach(c=>{const[u,d]=ue.getPointAtIndexGlobalCoordinates(r,c,n);a5(e,u,d,a)})},rX=(e,t,n)=>{const{angle:i,x1:r,y1:s,x2:o,y2:a,selectionColors:l,cx:c,cy:u,dashed:d,activeEmbeddable:f}=n,h=o-r,m=a-s,b=(n.padding??Yu*2)/t.zoom.value,E=8/t.zoom.value,y=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(f?4:1)/t.zoom.value;const v=l.length;for(let _=0;_<v;++_)e.strokeStyle=l[_],d&&e.setLineDash([E,y+(E+y)*(v-1)]),e.lineDashOffset=(E+y)*_,Jm(e,r-b,s-b,h+b*2,m+b*2,c,u,i);e.restore()},xye=(e,t,n,i)=>{const r=Array.isArray(n)?Iye:Sye;e.save(),e.translate(t.scrollX,t.scrollY),r(e,n,i,t.zoom),e.restore()},Cye=(e,t,n,i)=>{const[r,s,o,a]=De(n,i),l=o-r,c=a-s;e.strokeStyle="rgb(0,118,255)",e.lineWidth=tn.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),Jm(e,r,s,l,c,r+l/2,s+c/2,n.angle,!1,tn.radius/t.zoom.value),e.restore()},Aye=(e,t,n)=>{const i=n.filter(a=>a.groupIds.length===0),r=n.filter(a=>a.groupIds.length>0),s=a=>{const[l,c,u,d]=wt(a);return{angle:0,x1:l,x2:u,y1:c,y2:d,selectionColors:["rgb(0,118,255)"],dashed:!1,cx:l+(u-l)/2,cy:c+(d-c)/2,activeEmbeddable:!1}},o=a=>{const l=$t(n,a);return s(l)};Object.entries(IF(r,t)).filter(([a,l])=>l).map(([a,l])=>a).map(a=>o(a)).concat(i.map(a=>s([a]))).forEach(a=>rX(e,t,a))},b7=(e,t,n,i)=>{var a;if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;const r=ue.getPointsGlobalCoordinates(n,i),{POINT_HANDLE_SIZE:s}=ue,o=t.editingLinearElement?s:s/2;if(r.forEach((l,c)=>{var d,f;if(ge(n)&&c!==0&&c!==r.length-1)return;const u=!!((f=(d=t.editingLinearElement)==null?void 0:d.selectedPointsIndices)!=null&&f.includes(c));U7(e,t,l,o,u)}),ge(n)){const l=((a=n.fixedSegments)==null?void 0:a.map(c=>c.index))||[];r.slice(0,-1).forEach((c,u)=>{ue.isSegmentTooShort(n,r[u+1],r[u],u,t.zoom)||U7(e,t,C((c[0]+r[u+1][0])/2,(c[1]+r[u+1][1])/2),s/2,!1,!l.includes(u+1))})}else ue.getEditorMidPoints(n,i,t).filter((c,u,d)=>c!==null&&!(ge(n)&&(u===0||u===d.length-1))).forEach(c=>{(t.editingLinearElement||r.length===2)&&U7(e,t,c,s/2,!1,!0)});e.restore()},pR=(e,t,n,i,r)=>{Object.keys(i).forEach(s=>{const o=i[s];if(o!==void 0){const[a,l,c,u]=o;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),s==="rotation"?a5(e,a+c/2,l+u/2,c/2):e.roundRect?(e.beginPath(),e.roundRect(a,l,c,u,2/n.zoom.value),e.fill(),e.stroke()):Jm(e,a,l,c,u,a+c/2,l+u/2,r,!0),e.restore()}})},Mye=(e,t,n,i,r)=>{const[s,o,,,a,l]=De(i,r),c=3,u=20,d=c/n.zoom.value,f=d/2,h=a-s+d,m=l-o+d,p=Math.min(u/n.zoom.value,h),b=Math.min(u/n.zoom.value,m);e.save(),e.fillStyle=t.selectionColor,e.strokeStyle=t.selectionColor,e.lineWidth=d,[[[-h,-m],[0,f],[p,f],[f,0],[f,b]],[[h-f,-m],[f,f],[-p+f,f],[0,0],[0,b]],[[-h,m],[0,-f],[p,-f],[f,0],[f,-b]],[[h-f,m],[f,-f],[-p+f,-f],[0,0],[0,-b]]].forEach(y=>{const[[v,_],[I,R],[w,T],[A,S],[k,N]]=y;e.save(),e.translate(a,l),e.rotate(i.angle),e.beginPath(),e.moveTo(v+I,_+R),e.lineTo(v+w,_+T),e.stroke(),e.beginPath(),e.moveTo(v+A,_+S),e.lineTo(v+k,_+N),e.stroke(),e.restore()}),e.restore()},Rye=(e,t,n,i)=>{t.save();const r=Yu*2/n.zoom.value,s=e.width+r*2,o=e.height+r*2,a=e.x+s/2,l=e.y+o/2,c=-(s/2+r),u=-(o/2+r);t.translate(a+n.scrollX,l+n.scrollY),t.rotate(e.angle),t.lineWidth=1/n.zoom.value,t.strokeStyle=i,t.strokeRect(c,u,s,o),t.restore()},sX=({canvas:e,elementsMap:t,visibleElements:n,selectedElements:i,allElementsMap:r,scale:s,appState:o,renderConfig:a,device:l})=>{var p,b,E;if(e===null)return{atLeastOneVisibleElement:!1,elementsMap:t};const[c,u]=l5(e,s),d=c5({canvas:e,scale:s,normalizedWidth:c,normalizedHeight:u});d.save(),d.scale(o.zoom.value,o.zoom.value);let f;if(n.forEach(y=>{var v;((v=o.editingLinearElement)==null?void 0:v.elementId)===y.id&&y&&(f=y)}),f&&b7(d,o,f,t),o.selectionElement&&!o.isCropping)try{Whe(o.selectionElement,d,o,a.selectionColor)}catch(y){console.error(y)}if(o.editingTextElement&&de(o.editingTextElement)){const y=r.get(o.editingTextElement.id);y&&!y.autoResize&&Rye(y,d,o,a.selectionColor)}o.isBindingEnabled&&o.suggestedBindings.filter(y=>y!=null).forEach(y=>{xye(d,o,y,t)}),o.frameToHighlight&&Cye(d,o,o.frameToHighlight,t),o.elementsToHighlight&&Aye(d,o,o.elementsToHighlight);const h=i.some(y=>Ie(y));if(i.length===1&&((p=o.editingLinearElement)==null?void 0:p.elementId)===i[0].id&&b7(d,o,i[0],t),ge(i[0])&&o.selectedLinearElement&&o.selectedLinearElement.segmentMidPointHoveredCoords?vye(d,o):o.selectedLinearElement&&o.selectedLinearElement.hoverPointIndex>=0&&!(ge(i[0])&&o.selectedLinearElement.hoverPointIndex>0&&o.selectedLinearElement.hoverPointIndex<i[0].points.length-1)&&_ye(d,o,t),!o.multiElement&&!o.editingLinearElement){const y=AH(i,o),v=i.length===1&&ke(i[0]);v&&((b=o.selectedLinearElement)==null?void 0:b.elementId)===i[0].id&&!i[0].locked&&b7(d,o,i[0],t);const _=a.selectionColor||li.black;if(y){const I=Se(i),R=[];for(const T of t.values()){const A=[],S=a.remoteSelectedElementIds.get(T.id);if(v&&ge(T)&&(T.startBinding||T.endBinding)||(I.has(T.id)&&!TF(o,T)&&A.push(_),S&&A.push(...S.map(k=>L5(k,o.collaborators.get(k))))),A.length){const[k,N,D,G,V,H]=De(T,t,!0);R.push({angle:T.angle,x1:k,y1:N,x2:D,y2:G,selectionColors:A,dashed:!!S,cx:V,cy:H,activeEmbeddable:((E=o.activeEmbeddable)==null?void 0:E.element)===T&&o.activeEmbeddable.state==="active",padding:T.id===o.croppingElementId||st(T)?0:void 0})}}const w=T=>{const A=$t(t,T),[S,k,N,D]=wt(A);R.push({angle:0,x1:S,x2:N,y1:k,y2:D,selectionColors:[li.black],dashed:!0,cx:S+(N-S)/2,cy:k+(D-k)/2,activeEmbeddable:!1})};for(const T of Ou(o))w(T);o.editingGroupId&&w(o.editingGroupId),R.forEach(T=>rX(d,o,T))}if(d.save(),d.translate(o.scrollX,o.scrollY),i.length===1){d.fillStyle=li.white;const I=CH(i[0],o.zoom,t,"mouse",Jg(l));if(!o.viewModeEnabled&&y&&!de(o.editingTextElement)&&!o.croppingElementId&&pR(d,a,o,I,i[0].angle),o.croppingElementId&&!o.isCropping){const R=t.get(o.croppingElementId);R&&st(R)&&Mye(d,a,o,R,t)}}else if(i.length>1&&!o.isRotating){const I=Yu*2/o.zoom.value;d.fillStyle=li.white;const[R,w,T,A]=wt(i),S=d.getLineDash();d.setLineDash([2/o.zoom.value]);const k=d.lineWidth;d.lineWidth=1/o.zoom.value,d.strokeStyle=_,Jm(d,R-I,w-I,T-R+I*2,A-w+I*2,(R+T)/2,(w+A)/2,0),d.lineWidth=k,d.setLineDash(S);const N=c_([R,w,T,A,(R+T)/2,(w+A)/2],0,o.zoom,"mouse",h?{...Jg(l),rotation:!0}:Jg(l));i.some(D=>!D.locked)&&pR(d,a,o,N,0)}d.restore()}o.searchMatches.forEach(({id:y,focus:v,matchedLines:_})=>{const I=t.get(y);if(I&&de(I)){const[R,w,,,T,A]=De(I,t,!0);d.save(),o.theme===xe.LIGHT?v?d.fillStyle="rgba(255, 124, 0, 0.4)":d.fillStyle="rgba(255, 226, 0, 0.4)":v?d.fillStyle="rgba(229, 82, 0, 0.4)":d.fillStyle="rgba(99, 52, 0, 0.4)",d.translate(o.scrollX,o.scrollY),d.translate(T,A),d.rotate(I.angle),_.forEach(S=>{d.fillRect(R+S.offsetX-T,w+S.offsetY-A,S.width,S.height)}),d.restore()}}),Uye(d,o),d.restore(),Qpe({context:d,renderConfig:a,appState:o,normalizedWidth:c,normalizedHeight:u});let m;return a.renderScrollbars&&(m=Ebe(n,c,u,o),d.save(),d.fillStyle=ybe,d.strokeStyle="rgba(255,255,255,0.8)",[m.horizontal,m.vertical].forEach(y=>{y&&a$(d,y.x,y.y,y.width,y.height,$l/2)}),d.restore()),{scrollBars:m,atLeastOneVisibleElement:n.length>0,elementsMap:t}},oX=Qh(e=>{var n;const t=sX(e);(n=e.callback)==null||n.call(e,t)},{trailing:!0}),kye=(e,t)=>{if(t){oX(e);return}const n=sX(e);return e.callback(n),n},Lye=e=>{const t=M.useRef(!1);return M.useEffect(()=>{var l;if(!t.current){t.current=!0;return}const n=new Map,i=new Map,r=new Map,s=new Map,o=new Map;e.appState.collaborators.forEach((c,u)=>{if(c.selectedElementIds)for(const d of Object.keys(c.selectedElementIds))r.has(d)||r.set(d,[]),r.get(d).push(u);!c.pointer||c.pointer.renderCursor===!1||(c.username&&s.set(u,c.username),c.userState&&o.set(u,c.userState),i.set(u,Os({sceneX:c.pointer.x,sceneY:c.pointer.y},e.appState)),n.set(u,c.button))});const a=((l=e.containerRef)==null?void 0:l.current)&&getComputedStyle(e.containerRef.current).getPropertyValue("--color-selection")||"#6965db";kye({canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:i,remotePointerButton:n,remoteSelectedElementIds:r,remotePointerUsernames:s,remotePointerUserStates:o,selectionColor:a,renderScrollbars:!1},device:e.device,callback:e.renderInteractiveSceneCallback},iw())}),g("canvas",{className:"excalidraw__canvas interactive",style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled?Tt.GRAB:Tt.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:L("labels.drawingCanvas")})},UR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,editingGroupId:e.editingGroupId,editingLinearElement:e.editingLinearElement,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,isBindingEnabled:e.isBindingEnabled,suggestedBindings:e.suggestedBindings,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches}),Dye=(e,t)=>e.selectionNonce!==t.selectionNonce||e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements?!1:vi(UR(e.appState),UR(t.appState)),Nye=se.memo(Lye,Dye),Oye=e=>{const t=M.useRef(null),n=M.useRef(!1);return M.useEffect(()=>{const i=t.current;if(!i)return;const r=e.canvas;n.current||(n.current=!0,i.replaceChildren(r),r.classList.add("excalidraw__canvas","static"));const s=`${e.appState.width}px`,o=`${e.appState.height}px`;r.style.width!==s&&(r.style.width=s),r.style.height!==o&&(r.style.height=o);const a=e.appState.width*e.scale,l=e.appState.height*e.scale;r.width!==a&&(r.width=a),r.height!==l&&(r.height=l),Vz({canvas:r,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},iw())}),g("div",{className:"excalidraw__canvas-wrapper",ref:t})},bR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,pendingImageElementId:e.pendingImageElementId,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId}),Pye=(e,t)=>e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:vi(bR(e.appState),bR(t.appState))&&vi(e.renderConfig,t.renderConfig),Fye=se.memo(Oye,Pye);class yR{constructor(t){F(this,"scene");F(this,"getRenderableElements",(()=>{const t=({elementsMap:i,zoom:r,offsetLeft:s,offsetTop:o,scrollX:a,scrollY:l,height:c,width:u})=>{const d=[];for(const f of i.values())Nb(f,u,c,{zoom:r,offsetLeft:s,offsetTop:o,scrollX:a,scrollY:l},i)&&d.push(f);return d},n=({elements:i,editingTextElement:r,newElementId:s,pendingImageElementId:o})=>{const a=ms(new Map);for(const l of i)st(l)&&o===l.id||s!==l.id&&(!r||r.type!=="text"||l.id!==r.id)&&a.set(l.id,l);return a};return Mee(({zoom:i,offsetLeft:r,offsetTop:s,scrollX:o,scrollY:a,height:l,width:c,editingTextElement:u,newElementId:d,pendingImageElementId:f,sceneNonce:h})=>{const m=this.scene.getNonDeletedElements(),p=n({elements:m,editingTextElement:u,newElementId:d,pendingImageElementId:f}),b=t({elementsMap:p,zoom:i,offsetLeft:r,offsetTop:s,scrollX:o,scrollY:a,height:l,width:c});return{elementsMap:p,visibleElements:b}})})());this.scene=t}destroy(){oX.cancel(),Hz.cancel(),this.getRenderableElements.clear()}}const Bye=({trails:e})=>{const t=M.useRef(null);return M.useEffect(()=>{if(t.current)for(const n of e)n.start(t.current);return()=>{for(const n of e)n.stop()}},e),g("div",{className:"SVGLayer",children:g("svg",{ref:t})})},zye=5,Hye=(e,t,n)=>{const[i,r]=De(e,n),{x:s,y:o}=Os({sceneX:i+e.width,sceneY:r},t),a=s-t.offsetLeft+10,l=o-t.offsetTop;return{x:a,y:l}},ER=({children:e,element:t,elementsMap:n})=>{const i=tp();if(i.contextMenu||i.newElement||i.resizingElement||i.isRotating||i.openMenu||i.viewModeEnabled)return null;const{x:r,y:s}=Hye(t,i,n);return g("div",{className:"excalidraw-canvas-buttons",style:{top:`${s}px`,left:`${r}px`,padding:zye},children:e})},Vye="small",y7=e=>P("label",{className:me("ToolIcon ToolIcon__MagicButton",`ToolIcon_size_${Vye}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[g("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),g("div",{className:"ToolIcon__icon",children:e.icon})]}),$ye=({height:e,width:t,userToFollow:n,onDisconnect:i})=>g("div",{className:"follow-mode",style:{width:t,height:e},children:P("div",{className:"follow-mode__badge",children:[P("div",{className:"follow-mode__badge__label",children:["Following"," ",g("span",{className:"follow-mode__badge__username",title:n.username,children:n.username})]}),g("button",{type:"button",onClick:i,className:"follow-mode__disconnect-btn",children:xd})]})});class Gye{constructor(){F(this,"targets",new WeakMap);F(this,"rafIds",new WeakMap)}register(t,n){this.targets.set(t,{callback:n,stopped:!0})}start(t){const n=this.targets.get(t);n&&(this.rafIds.has(t)||(this.targets.set(t,{...n,stopped:!1}),this.scheduleFrame(t)))}stop(t){const n=this.targets.get(t);n&&!n.stopped&&this.targets.set(t,{...n,stopped:!0}),this.cancelFrame(t)}constructFrame(t){return n=>{const i=this.targets.get(t);if(!i)return;const r=this.onFrame(i,n);!i.stopped&&!r?this.scheduleFrame(t):this.cancelFrame(t)}}scheduleFrame(t){const n=requestAnimationFrame(this.constructFrame(t));this.rafIds.set(t,n)}cancelFrame(t){if(this.rafIds.has(t)){const n=this.rafIds.get(t);cancelAnimationFrame(n)}this.rafIds.delete(t)}onFrame(t,n){return t.callback(n)??!1}}function Xye(e,t,n,i){Object.defineProperty(e,t,{get:n,set:i,enumerable:!0,configurable:!0})}var jye={};Xye(jye,"LaserPointer",()=>Wb);function Un([e,t,n],[i,r,s]){return[e+i,t+r,n+s]}function bg([e,t,n],[i,r,s]){return[e-i,t-r,n-s]}function Mn([e,t,n],i){return[e*i,t*i,n*i]}function nf([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function xi([e,t,n],i){return[Math.cos(i)*e-Math.sin(i)*t,Math.sin(i)*e+Math.cos(i)*t,n]}function Yye(e,t,n){return Un(e,Mn(bg(t,e),n))}function vR(e,t,n){return Math.atan2(n[1]-e[1],n[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function _R(e){return Math.atan2(Math.sin(e),Math.cos(e))}function wR([e,t]){return Math.sqrt(e**2+t**2)}function th([e,t],[n,i]){return Math.sqrt((n-e)**2+(i-t)**2)}function Wye(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=th(e[n-1],e[n]);return t+=th(e[e.length-2],e[e.length-1]),t}const Kye=(e,t,n)=>Math.max(t,Math.min(n,e));function Zye(e,t,n){const i=th(t,n);if(i===0)return th(e,t);const r=Kye(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/i**2,0,1),s=[t[0]+r*(n[0]-t[0]),t[1]+r*(n[1]-t[1]),e[2]];return th(s,e)}function Yb(e,t){if(t===0||e.length<=2)return e;const n=e[0],i=e[e.length-1],[r,s]=e.reduce(([o,a],l,c)=>{const u=Zye(l,n,i);return u>o?[u,c]:[o,a]},[0,-1]);if(r>=t){const o=e[s];return[...Yb([n,...e.slice(1,s),o],t).slice(0,-1),o,...Yb([o,...e.slice(s,-1),i],t).slice(1)]}else return[n,i]}const Al=class Al{constructor(t){this.originalPoints=[],this.stablePoints=[],this.tailPoints=[],this.isFresh=!0,this.options=Object.assign({},Al.defaults,t)}get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){const n=this.originalPoints[this.originalPoints.length-1];if(!(n&&n[0]===t[0]&&n[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=Yye(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),Wye(this.tailPoints)>Al.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase=="tail")throw new Error("Not implemented yet");this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(t,n,i,r,s){return(t??this.options.size)*this.options.sizeMapping({pressure:n,runningLength:s,currentIndex:i,totalLength:r})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase==="input"&&(n=Yb(n,this.options.simplify));const i=n.length;if(i===0)return[];if(i===1){const w=n[0],T=this.getSize(t,w[2],0,i,0);if(T<.5)return[];const A=[];for(let S=0;S<=Math.PI*2;S+=Math.PI/16)A.push(Un(w,Mn(xi([1,0,0],S),T)));return A.push(Un(w,Mn([1,0,0],this.getSize(t,w[2],0,i,0)))),A}if(i===2){const w=n[0],T=n[1],A=this.getSize(t,w[2],0,i,0),S=this.getSize(t,T[2],0,i,0);if(A<.5||S<.5)return[];const k=[],N=vR(w,[w[0],w[1]-100,w[2]],T);for(let D=N;D<=Math.PI+N;D+=Math.PI/16)k.push(Un(w,Mn(xi([1,0,0],D),A)));for(let D=Math.PI+N;D<=Math.PI*2+N;D+=Math.PI/16)k.push(Un(T,Mn(xi([1,0,0],D),S)));return k.push(k[0]),k}const r=[],s=[];let o=0,a=0,l=0,c=0;for(let w=1;w<i-1;w++){const T=n[w-1],A=n[w],S=n[w+1];let k=A[2];const N=th(T,A);c+=N,o=a+(N-a)*.2;const D=this.getSize(t,k,w,i,c);if(D===0){l=w+1;continue}const G=nf(bg(T,A)),V=nf(bg(S,A)),H=xi(G,Math.PI/2),$=xi(G,-Math.PI/2),j=xi(V,Math.PI/2),X=xi(V,-Math.PI/2),Y=Un(A,Mn(H,D)),le=Un(A,Mn($,D)),pe=Un(A,Mn(j,D)),ae=Un(A,Mn(X,D)),ze=Un(H,X),Xe=Un($,j),qe=Un(A,Mn(wR(ze)===0?G:nf(ze),D)),Ze=Un(A,Mn(wR(Xe)===0?V:nf(Xe),D)),on=_R(vR(A,T,S)),_n=Al.constants.cornerDetectionMaxAngle/180*Math.PI*Al.constants.cornerDetectionVariance(o);if(Math.abs(on)<_n){const Ye=Math.abs(_R(Math.PI-on));if(Ye===0)continue;if(on<0){s.push(le,Ze);for(let Qe=0;Qe<=Ye;Qe+=Ye/4)r.push(Un(A,xi(Mn(H,D),Qe)));for(let Qe=Ye;Qe>=0;Qe-=Ye/4)s.push(Un(A,xi(Mn(H,D),Qe)));s.push(Ze,pe)}else{r.push(Y,qe);for(let Qe=0;Qe<=Ye;Qe+=Ye/4)s.push(Un(A,xi(Mn(H,-D),-Qe)));for(let Qe=Ye;Qe>=0;Qe-=Ye/4)r.push(Un(A,xi(Mn(H,-D),-Qe)));r.push(qe,ae)}}else r.push(qe),s.push(Ze);a=o}if(l>=i-2)if(this.options.keepHead){const w=n[i-1],T=[];for(let A=0;A<=Math.PI*2;A+=Math.PI/16)T.push(Un(w,Mn(xi([1,0,0],A),this.options.size)));return T.push(Un(w,Mn([1,0,0],this.options.size))),T}else return[];const u=n[l],d=n[l+1],f=n[i-2],h=n[i-1],m=nf(bg(d,u)),p=nf(bg(f,h)),b=xi(m,-Math.PI/2),E=xi(p,Math.PI/2),y=this.getSize(t,u[2],0,i,0),v=[],_=this.options.keepHead?this.options.size:this.getSize(t,f[2],i-2,i,c),I=[];if(y>1){for(let w=0;w<=Math.PI;w+=Math.PI/16)v.unshift(Un(u,xi(Mn(b,y),-w)));v.unshift(Un(u,Mn(b,-y)))}else v.push(u);for(let w=0;w<=Math.PI*3;w+=Math.PI/16)I.push(Un(h,xi(Mn(E,-_),-w)));const R=[...v,...r,...I.reverse(),...s.reverse()];return v.length>0&&R.push(v[0]),this.options.simplify>0&&this.options.simplifyPhase==="output"?Yb(R,this.options.simplify):R}};Al.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:"output",keepHead:!1,sizeMapping:()=>1},Al.constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:t=>t>35?.5:1,maxTailLength:50};let Wb=Al;class s4{constructor(t,n,i){F(this,"currentTrail");F(this,"pastTrails",[]);F(this,"container");F(this,"trailElement");this.animationFrameHandler=t,this.app=n,this.options=i,this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.trailElement=document.createElementNS(lt,"path")}get hasCurrentTrail(){return!!this.currentTrail}hasLastPoint(t,n){if(this.currentTrail){const i=this.currentTrail.originalPoints.length;return this.currentTrail.originalPoints[i-1][0]===t&&this.currentTrail.originalPoints[i-1][1]===n}return!1}start(t){t&&(this.container=t),this.trailElement.parentNode!==this.container&&this.container&&this.container.appendChild(this.trailElement),this.animationFrameHandler.start(this)}stop(){var t;this.animationFrameHandler.stop(this),this.trailElement.parentNode===this.container&&((t=this.container)==null||t.removeChild(this.trailElement))}startPath(t,n){this.currentTrail=new Wb(this.options),this.currentTrail.addPoint([t,n,performance.now()]),this.update()}addPointToPath(t,n){this.currentTrail&&(this.currentTrail.addPoint([t,n,performance.now()]),this.update())}endPath(){this.currentTrail&&(this.currentTrail.close(),this.currentTrail.options.keepHead=!1,this.pastTrails.push(this.currentTrail),this.currentTrail=void 0,this.update())}update(){this.start()}onFrame(){const t=[];for(const i of this.pastTrails)t.push(this.drawTrail(i,this.app.state));if(this.currentTrail){const i=this.drawTrail(this.currentTrail,this.app.state);t.push(i)}this.pastTrails=this.pastTrails.filter(i=>i.getStrokeOutline().length!==0),t.length===0&&this.stop();const n=t.join(" ").trim();this.trailElement.setAttribute("d",n),this.trailElement.setAttribute("fill",(this.options.fill??(()=>"black"))(this))}drawTrail(t,n){const i=t.getStrokeOutline(t.options.size/n.zoom.value).map(([r,s])=>{const o=Os({sceneX:r,sceneY:s},n);return[o.x,o.y]});return Ree(i,!0)}}class qye{constructor(t,n){F(this,"localTrail");F(this,"collabTrails",new Map);F(this,"container");this.animationFrameHandler=t,this.app=n,this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.localTrail=new s4(t,n,{...this.getTrailOptions(),fill:()=>mQ})}getTrailOptions(){return{simplify:0,streamline:.4,sizeMapping:t=>{const r=Math.max(0,1-(performance.now()-t.pressure)/1e3),s=(50-Math.min(50,t.totalLength-t.currentIndex))/50;return Math.min(Du(s),Du(r))}}}startPath(t,n){this.localTrail.startPath(t,n)}addPointToPath(t,n){this.localTrail.addPointToPath(t,n)}endPath(){this.localTrail.endPath()}start(t){this.container=t,this.animationFrameHandler.start(this),this.localTrail.start(t)}stop(){this.animationFrameHandler.stop(this),this.localTrail.stop()}onFrame(){this.updateCollabTrails()}updateCollabTrails(){if(!(!this.container||this.app.state.collaborators.size===0)){for(const[t,n]of this.app.state.collaborators.entries()){let i;this.collabTrails.has(t)?i=this.collabTrails.get(t):(i=new s4(this.animationFrameHandler,this.app,{...this.getTrailOptions(),fill:()=>{var r;return((r=n.pointer)==null?void 0:r.laserColor)||L5(t,n)}}),i.start(this.container),this.collabTrails.set(t,i)),n.pointer&&n.pointer.tool==="laser"&&(n.button==="down"&&!i.hasCurrentTrail&&i.startPath(n.pointer.x,n.pointer.y),n.button==="down"&&i.hasCurrentTrail&&!i.hasLastPoint(n.pointer.x,n.pointer.y)&&i.addPointToPath(n.pointer.x,n.pointer.y),n.button==="up"&&i.hasCurrentTrail&&(i.addPointToPath(n.pointer.x,n.pointer.y),i.endPath()))}for(const t of this.collabTrails.keys())this.app.state.collaborators.has(t)||(this.collabTrails.get(t).stop(),this.collabTrails.delete(t))}}}const Qye=(e,t,n,i,r,s)=>{const{zoom:o}=i,a=180*n/Math.PI;let l=e*(o.value-1)/2,c=t*(o.value-1)/2;return e>r&&o.value!==1&&(l=r*(o.value-1)/2),t>s&&o.value!==1&&(c=s*(o.value-1)/2),`translate(${l}px, ${c}px) scale(${o.value}) rotate(${a}deg)`},Jye=({id:e,onChange:t,onSubmit:n,getViewportCoords:i,element:r,canvas:s,excalidrawContainer:o,app:a,autoSelect:l=!0})=>{const c=(V,H)=>{if(!H.style.fontFamily||!H.style.fontSize)return!1;const $=H.style.fontFamily.replace(/"/g,"");return Fm({fontFamily:V.fontFamily})!==$||`${V.fontSize}px`!==H.style.fontSize},u=()=>{var Y;const V=a.state,H=(Y=eo.getScene(r))==null?void 0:Y.getElement(e);if(!H)return;const{textAlign:$,verticalAlign:j}=H,X=a.scene.getNonDeletedElementsMap();if(H&&de(H)){let le=H.x,pe=H.y;const ae=ui(H,a.scene.getNonDeletedElementsMap());let ze=H.width,Xe=H.height,qe=H.width,Ze=H.height;if(ae&&H.containerId){if(Be(ae)){const Vr=ue.getBoundTextElementPosition(ae,H,X);le=Vr.x,pe=Vr.y}const ao=c(H,d);let lo;if(ao?lo=Db(ae.id,ae.height):(lo=Ih[ae.id],lo||(lo=Db(ae.id,ae.height))),qe=Ka(ae,H),Ze=b5(ae,H),!Be(ae)&&Xe>Ze){const Vr=sd(Xe,ae.type);ee(ae,{height:Vr});return}else if(!Be(ae)&&ae.height>lo.height&&Xe<Ze){const Vr=sd(Xe,ae.type);ee(ae,{height:Vr})}else{const{y:Vr}=U5(ae,H,X);pe=Vr}}const[on,_n]=i(le,pe),Ye=d.selectionStart,Qe=d.selectionEnd,zt=d.value.length;if(Ye===Qe&&Qe!==zt){const ao=zt-Qe;d.selectionStart=d.value.length-ao,d.selectionEnd=d.value.length-ao}ae?ze+=.5:(qe=(V.width-8-on)/V.zoom.value,ze=Math.min(ze,qe)),Xe*=1.05;const Es=xt(H),Qo=(V.height-_n)/V.zoom.value;Object.assign(d.style,{font:Es,lineHeight:H.lineHeight,width:`${ze}px`,height:`${Xe}px`,left:`${on}px`,top:`${_n}px`,transform:Qye(ze,Xe,x1e(H,ae),V,qe,Qo),textAlign:$,verticalAlign:j,color:H.strokeColor,opacity:H.opacity/100,filter:"var(--theme-filter)",maxHeight:`${Qo}px`}),d.scrollTop=0,ee(H,{x:le,y:pe})}},d=document.createElement("textarea");d.dir="auto",d.tabIndex=0,d.dataset.type="wysiwyg",d.wrap="off",d.classList.add("excalidraw-wysiwyg");let f="pre",h="normal";(Xt(r)||!r.autoResize)&&(f="pre-wrap",h="break-word"),Object.assign(d.style,{position:"absolute",display:"inline-block",minHeight:"1em",backfaceVisibility:"hidden",margin:0,padding:0,border:0,outline:0,resize:"none",background:"transparent",overflow:"hidden",zIndex:"var(--zIndex-wysiwyg)",wordBreak:h,whiteSpace:f,overflowWrap:"break-word",boxSizing:"content-box"}),d.value=r.originalText,u(),t&&(d.onpaste=async V=>{const H=await eH(V,!0);if(!H.text)return;const $=bh(H.text);if(!$)return;const j=ui(r,a.scene.getNonDeletedElementsMap()),X=xt({fontSize:a.state.currentItemFontSize,fontFamily:a.state.currentItemFontFamily});if(j){const Y=Oe(j,a.scene.getNonDeletedElementsMap()),le=Id(`${d.value}${$}`,X,Ka(j,Y)),pe=u9(le,X);d.style.width=`${pe}px`}},d.oninput=()=>{const V=bh(d.value);if(d.value!==V){const H=d.selectionStart;d.value=V,d.selectionStart=H,d.selectionEnd=H}t(d.value)}),d.onkeydown=V=>{if(!V.shiftKey&&uM.keyTest(V))V.preventDefault(),a.actionManager.executeAction(uM),u();else if(!V.shiftKey&&dM.keyTest(V))V.preventDefault(),a.actionManager.executeAction(dM),u();else if(!V.shiftKey&&fM.keyTest(V))V.preventDefault(),a.actionManager.executeAction(fM),u();else if(aM.keyTest(V))a.actionManager.executeAction(aM);else if(lM.keyTest(V))a.actionManager.executeAction(lM);else if(V.key===z.ESCAPE)V.preventDefault(),I=!0,R();else if(V.key===z.ENTER&&V[z.CTRL_OR_CMD]){if(V.preventDefault(),V.isComposing||V.keyCode===229)return;I=!0,R()}else if(V.key===z.TAB||V[z.CTRL_OR_CMD]&&(V.code===tt.BRACKET_LEFT||V.code===tt.BRACKET_RIGHT)){if(V.preventDefault(),V.isComposing)return;V.shiftKey||V.code===tt.BRACKET_LEFT?y():E(),d.dispatchEvent(new Event("input"))}};const m=4,p=" ".repeat(m),b=new RegExp(`^ {1,${m}}`),E=()=>{const{selectionStart:V,selectionEnd:H}=d,$=v();let j=d.value;$.forEach(X=>{const Y=j.slice(0,X),le=j.slice(X);j=`${Y}${p}${le}`}),d.value=j,d.selectionStart=V+m,d.selectionEnd=H+m*$.length},y=()=>{const{selectionStart:V,selectionEnd:H}=d,$=v(),j=[];let X=d.value;$.forEach(Y=>{const le=X.slice(Y,Y+m).match(b);if(le){const pe=X.slice(0,Y),ae=X.slice(Y+le[0].length);X=`${pe}${ae}`,j.push(Y)}}),d.value=X,j.length&&(V>j[j.length-1]?d.selectionStart=Math.max(V-m,j[j.length-1]):d.selectionStart=V,d.selectionEnd=Math.max(d.selectionStart,H-m*j.length))},v=()=>{let{selectionStart:V,selectionEnd:H,value:$}=d;const j=$.slice(0,V).match(/[^\n]*$/)[0].length;return V=V-j,$.slice(V,H).split(`
`).reduce((Y,le,pe,ae)=>Y.concat(pe?Y[pe-1]+ae[pe-1].length+1:V),[]).reverse()},_=V=>{V.target instanceof HTMLCanvasElement&&(V.preventDefault(),V.stopPropagation())};let I=!1;const R=()=>{var $,j;if(D)return;D=!0,w();const V=($=eo.getScene(r))==null?void 0:$.getElement(r.id);if(!V)return;const H=ui(V,a.scene.getNonDeletedElementsMap());if(H){if(d.value.trim()){const X=Wa(H);!X||X!==r.id?ee(H,{boundElements:(H.boundElements||[]).concat({type:"text",id:r.id})}):Be(H)&&y5(H)}else ee(H,{boundElements:(j=H.boundElements)==null?void 0:j.filter(X=>!de(X))});Qi(V,H,a.scene.getNonDeletedElementsMap())}n({viaKeyboard:I,nextOriginalText:d.value})},w=()=>{d.onblur=null,d.oninput=null,d.onkeydown=null,G&&G.disconnect(),window.removeEventListener("resize",u),window.removeEventListener("wheel",_,!0),window.removeEventListener("pointerdown",S),window.removeEventListener("pointerup",T),window.removeEventListener("blur",R),window.removeEventListener("beforeunload",R),k(),N(),d.remove()},T=V=>{window.removeEventListener("pointerup",T);const H=V==null?void 0:V.target,$=H instanceof HTMLElement&&H.classList.contains("properties-trigger");setTimeout(()=>{d.onblur=R,$||d.focus()})},A=()=>{d.onblur=null,window.addEventListener("pointerup",T),window.addEventListener("blur",R)},S=V=>{const H=V==null?void 0:V.target;if(V.button===El.WHEEL){H instanceof HTMLTextAreaElement&&(V.preventDefault(),a.handleCanvasPanUsingWheelOrSpaceDrag(V)),A();return}const $=H instanceof HTMLElement&&H.classList.contains("properties-trigger");(V.target instanceof HTMLElement||V.target instanceof SVGElement)&&V.target.closest(`.${hh.SHAPE_ACTIONS_MENU}, .${hh.ZOOM_ACTIONS}`)&&!ou(V.target)||$?A():V.target instanceof HTMLCanvasElement&&requestAnimationFrame(()=>{R()})},k=a.scene.onUpdate(()=>{var H;u(),!!((H=document.activeElement)!=null&&H.closest(".properties-content"))||d.focus()}),N=a.onScrollChangeEmitter.on(()=>{u()});let D=!1;l&&d.select(),T();let G=null;s&&"ResizeObserver"in window?(G=new window.ResizeObserver(()=>{u()}),G.observe(s)):window.addEventListener("resize",u),d.onpointerdown=V=>V.stopPropagation(),requestAnimationFrame(()=>{window.addEventListener("pointerdown",S,{capture:!0})}),window.addEventListener("beforeunload",R),o==null||o.querySelector(".excalidraw-textEditorContainer").appendChild(d)},e8e=oe({name:"autoResize",label:"labels.autoResize",icon:null,trackEvent:{category:"element"},predicate:(e,t,n,i)=>{const r=Fe(e,t);return r.length===1&&de(r[0])&&!r[0].autoResize},perform:(e,t,n,i)=>{const r=Fe(e,t);return{appState:t,elements:e.map(s=>{if(s.id===r[0].id&&de(s)){const o=zi(s.originalText,xt(s),s.lineHeight);return Ce(s,{autoResize:!0,width:o.width,height:o.height,text:s.originalText})}return s}),captureUpdate:Z.IMMEDIATELY}}}),t8e=e=>{const t=["flowchart","graph","sequenceDiagram","classDiagram","stateDiagram","stateDiagram-v2","erDiagram","journey","gantt","pie","quadrantChart","requirementDiagram","gitGraph","C4Context","mindmap","timeline","zenuml","sankey","xychart","block"];return new RegExp(`^(?:%%{.*?}%%[\\s\\n]*)?\\b(?:${t.map(i=>`\\s*${i}(-beta)?`).join("|")})\\b`).test(e.trim())},aX=({canvas:e,rc:t,newElement:n,elementsMap:i,allElementsMap:r,scale:s,appState:o,renderConfig:a})=>{if(e){const[l,c]=l5(e,s),u=c5({canvas:e,scale:s,normalizedWidth:l,normalizedHeight:c});u.save(),u.scale(o.zoom.value,o.zoom.value),n&&n.type!=="selection"?iu(n,i,r,t,u,a,o):u.clearRect(0,0,l,c)}},n8e=Qh(e=>{aX(e)},{trailing:!0}),i8e=(e,t)=>{if(t){n8e(e);return}aX(e)},r8e=e=>{const t=M.useRef(null);return M.useEffect(()=>{t.current&&i8e({canvas:t.current,scale:e.scale,newElement:e.appState.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},iw())}),g("canvas",{className:"excalidraw__canvas",style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:t})},lX=se.createContext(null),cX=se.createContext(null),uX={viewport:{isMobile:!1,isLandscape:!1},editor:{isMobile:!1,canFitSidebar:!1},isTouchScreen:!1},rw=se.createContext(uX);rw.displayName="DeviceContext";const sw=se.createContext({container:null,id:null});sw.displayName="ExcalidrawContainerContext";const ow=se.createContext([]);ow.displayName="ExcalidrawElementsContext";const aw=se.createContext({...gs(),width:0,height:0,offsetLeft:0,offsetTop:0});aw.displayName="ExcalidrawAppStateContext";const lw=se.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")});lw.displayName="ExcalidrawSetAppStateContext";const cw=se.createContext(null);cw.displayName="ExcalidrawActionManagerContext";const oo=()=>M.useContext(lX),ep=()=>M.useContext(cX),Qn=()=>M.useContext(rw),qo=()=>M.useContext(sw),P5=()=>M.useContext(ow),tp=()=>M.useContext(aw),zn=()=>M.useContext(lw),vr=()=>M.useContext(cw);let Z1=!1,E7=0,Zc=!1,q1=!1,v7=!1,_7={horizontal:null,vertical:null},bl=0,Q1=!1;const w7=new Map;let mU=!1,TR=0,SR=!1,qc=null;const ht={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null};class uw extends se.Component{constructor(n){super(n);F(this,"canvas");F(this,"interactiveCanvas",null);F(this,"rc");F(this,"unmounted",!1);F(this,"actionManager");F(this,"device",uX);F(this,"excalidrawContainerRef",se.createRef());F(this,"scene");F(this,"fonts");F(this,"renderer");F(this,"visibleElements");F(this,"resizeObserver");F(this,"nearestScrollableContainer");F(this,"library");F(this,"libraryItemsFromStorage");F(this,"id");F(this,"store");F(this,"history");F(this,"excalidrawContainerValue");F(this,"files",{});F(this,"imageCache",new Map);F(this,"iFrameRefs",new Map);F(this,"embedsValidationStatus",new Map);F(this,"initializedEmbeds",new Set);F(this,"elementsPendingErasure",new Set);F(this,"flowChartCreator",new mbe);F(this,"flowChartNavigator",new gbe);F(this,"hitLinkElement");F(this,"lastPointerDownEvent",null);F(this,"lastPointerUpEvent",null);F(this,"lastPointerMoveEvent",null);F(this,"lastPointerMoveCoords",null);F(this,"lastViewportPosition",{x:0,y:0});F(this,"animationFrameHandler",new Gye);F(this,"laserTrails",new qye(this.animationFrameHandler,this));F(this,"eraserTrail",new s4(this.animationFrameHandler,this,{streamline:.2,size:5,keepHead:!0,sizeMapping:n=>{const s=Math.max(0,1-(performance.now()-n.pressure)/200),o=(10-Math.min(10,n.totalLength-n.currentIndex))/10;return Math.min(Du(o),Du(s))},fill:()=>this.state.theme===xe.LIGHT?"rgba(0, 0, 0, 0.2)":"rgba(255, 255, 255, 0.2)"}));F(this,"onChangeEmitter",new yo);F(this,"onPointerDownEmitter",new yo);F(this,"onPointerUpEmitter",new yo);F(this,"onUserFollowEmitter",new yo);F(this,"onScrollChangeEmitter",new yo);F(this,"missingPointerEventCleanupEmitter",new yo);F(this,"onRemoveEventListenersEmitter",new yo);F(this,"getEffectiveGridSize",()=>em(this)?this.state.gridSize:null);F(this,"updateEmbedValidationStatus",(n,i)=>{this.embedsValidationStatus.set(n.id,i),Gt.delete(n)});F(this,"updateEmbeddables",()=>{const n=new Set;let i=!1;this.scene.getNonDeletedElements().filter(r=>{if(lr(r)){if(n.add(r.id),!this.embedsValidationStatus.has(r.id)){i=!0;const s=qU(r.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(r,s)}}else Il(r)&&n.add(r.id);return!1}),i&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((r,s)=>{n.has(s)||this.iFrameRefs.delete(s)})});F(this,"getFrameNameDOMId",n=>`${this.id}-frame-name-${n.id}`);F(this,"frameNameBoundsCache",{get:n=>{let i=this.frameNameBoundsCache._cache.get(n.id);if(!i||i.zoom!==this.state.zoom.value||i.versionNonce!==n.versionNonce){const r=document.getElementById(this.getFrameNameDOMId(n));if(r){const s=r.getBoundingClientRect(),o=Pt({clientX:s.x,clientY:s.y},this.state),a=Pt({clientX:s.right,clientY:s.bottom},this.state);return i={x:o.x,y:o.y,width:a.x-o.x,height:a.y-o.y,angle:0,zoom:this.state.zoom.value,versionNonce:n.versionNonce},this.frameNameBoundsCache._cache.set(n.id,i),i}return null}return i},_cache:new Map});F(this,"resetEditingFrame",n=>{var i;n&&ee(n,{name:((i=n.name)==null?void 0:i.trim())||null}),this.setState({editingFrame:null})});F(this,"renderFrameNames",()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;const n=this.state.theme===xe.DARK;return this.scene.getNonDeletedFramesLikes().map(i=>{if(!Nb(i,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return this.state.editingFrame===i.id&&this.resetEditingFrame(i),null;const{x:r,y:s}=Os({sceneX:i.x,sceneY:i.y},this.state),o=6;let a;const l=oH(i);if(i.id===this.state.editingFrame){const c=l;a=g("input",{autoFocus:!0,value:c,onChange:u=>{ee(i,{name:u.target.value})},onFocus:u=>u.target.select(),onBlur:()=>this.resetEditingFrame(i),onKeyDown:u=>{(u.key===z.ESCAPE||u.key===z.ENTER)&&this.resetEditingFrame(i)},style:{background:this.state.viewBackgroundColor,filter:n?Kv:"none",zIndex:2,border:"none",display:"block",padding:`${o}px`,borderRadius:4,boxShadow:"inset 0 0 0 1px var(--color-primary)",fontFamily:"Assistant",fontSize:"14px",transform:`translate(-${o}px, ${o}px)`,color:"var(--color-gray-80)",overflow:"hidden",maxWidth:`${document.body.clientWidth-r-o}px`},size:c.length+1||1,dir:"auto",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off"})}else a=l;return g("div",{id:this.getFrameNameDOMId(i),style:{position:"absolute",bottom:`${this.state.height+tn.nameOffsetY-s+this.state.offsetTop}px`,left:`${r-this.state.offsetLeft}px`,zIndex:2,fontSize:tn.nameFontSize,color:n?tn.nameColorDarkTheme:tn.nameColorLightTheme,lineHeight:tn.nameLineHeight,width:"max-content",maxWidth:`${i.width}px`,overflow:i.id===this.state.editingFrame?"visible":"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:Tt.MOVE,pointerEvents:this.state.viewModeEnabled?tu.disabled:tu.enabled},onPointerDown:c=>this.handleCanvasPointerDown(c),onWheel:c=>this.handleWheel(c),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:i.id})},children:a},i.id)})});F(this,"focusContainer",()=>{var n;(n=this.excalidrawContainerRef.current)==null||n.focus()});F(this,"getSceneElementsIncludingDeleted",()=>this.scene.getElementsIncludingDeleted());F(this,"getSceneElements",()=>this.scene.getNonDeletedElements());F(this,"onInsertElements",n=>{this.addElementsFromPasteOrLibrary({elements:n,position:"center",files:null})});F(this,"onExportImage",async(n,i,r)=>{ut("export",n,"ui");const s=await k5(n,i,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:r.exportingFrame}).catch(rF).catch(o=>{console.error(o),this.setState({errorMessage:o.message})});this.state.exportEmbedScene&&s&&$9(s)&&this.setState({fileHandle:s})});F(this,"magicGenerations",new Map);F(this,"updateMagicGeneration",({frameElement:n,data:i})=>{i.status==="pending"?ee(n,{customData:{generationData:void 0}},!1):ee(n,{customData:{generationData:i}},!1),this.magicGenerations.set(n.id,i),this.triggerRender()});F(this,"plugins",{});F(this,"onMagicframeToolSelect",()=>{const n=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(n.length===0)this.setActiveTool({type:Gn.magicframe}),ut("ai","tool-select (empty-selection)","d2c");else{const i=n.length===1&&WU(n[0])&&n[0];if(!i&&n.some(s=>Ie(s)||s.frameId)){this.setActiveTool({type:Gn.magicframe});return}ut("ai","tool-select (existing selection)","d2c");let r;if(i)r=i;else{const[s,o,a,l]=wt(n),c=50;r=aE({...tn,x:s-c,y:o-c,width:a-s+c*2,height:l-o+c*2,opacity:100,locked:!1}),this.scene.insertElement(r);for(const u of n)ee(u,{frameId:r.id});this.setState({selectedElementIds:{[r.id]:!0}})}this.onMagicFrameGenerate(r,"upstream")}});F(this,"openEyeDropper",({type:n})=>{Ns.set(C5,{swapPreviewOnAlt:!0,colorPickerType:n==="stroke"?"elementStroke":"elementBackground",onSelect:(i,r)=>{const s=n==="background"&&r.altKey||n==="stroke"&&!r.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!=="selection"?s?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:i},captureUpdate:Z.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:i},captureUpdate:Z.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(a=>this.state.selectedElementIds[a.id]?Ce(a,{[s?"strokeColor":"backgroundColor"]:i}):a),captureUpdate:Z.IMMEDIATELY})},keepOpenOnAlt:!1})});F(this,"dismissLinearEditor",()=>{setTimeout(()=>{this.setState({editingLinearElement:null})})});F(this,"syncActionResult",en(n=>{var s,o,a,l,c,u;if(this.unmounted||n===!1)return;n.captureUpdate===Z.NEVER?this.store.shouldUpdateSnapshot():n.captureUpdate===Z.IMMEDIATELY&&this.store.shouldCaptureIncrement();let i=!1,r=null;if(n.elements&&(this.scene.replaceAllElements(n.elements),i=!0),n.files&&(this.addMissingFiles(n.files,n.replaceFiles),this.addNewImagesToImageCache()),n.appState||r||this.state.contextMenu){let d=((s=n==null?void 0:n.appState)==null?void 0:s.viewModeEnabled)||!1,f=((o=n==null?void 0:n.appState)==null?void 0:o.zenModeEnabled)||!1;const h=((a=n==null?void 0:n.appState)==null?void 0:a.theme)||this.props.theme||xe.LIGHT,m=((l=n==null?void 0:n.appState)==null?void 0:l.name)??this.state.name,p=((c=n==null?void 0:n.appState)==null?void 0:c.errorMessage)??this.state.errorMessage;typeof this.props.viewModeEnabled<"u"&&(d=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<"u"&&(f=this.props.zenModeEnabled),r=((u=n.appState)==null?void 0:u.editingTextElement)||null,n.elements&&r&&n.elements.forEach(b=>{(r==null?void 0:r.id)===b.id&&r!==b&&ME(b)&&de(b)&&(r=b)}),r!=null&&r.isDeleted&&(r=null),this.setState(b=>{const E=n.appState||{};return{...b,...E,contextMenu:null,editingTextElement:r,viewModeEnabled:d,zenModeEnabled:f,theme:h,name:m,errorMessage:p}}),i=!0}!i&&n.captureUpdate!==Z.EVENTUALLY&&this.scene.triggerUpdate()}));F(this,"onBlur",en(()=>{Zc=!1,this.setState({isBindingEnabled:!0})}));F(this,"onUnload",()=>{this.onBlur()});F(this,"disableEvent",n=>{n.preventDefault()});F(this,"resetHistory",()=>{this.history.clear()});F(this,"resetStore",()=>{this.store.clear()});F(this,"resetScene",en(n=>{this.scene.replaceAllElements([]),this.setState(i=>({...gs(),isLoading:n!=null&&n.resetLoadingState?!1:i.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()}));F(this,"initializeScene",async()=>{var r;"launchQueue"in window&&"LaunchParams"in window&&window.launchQueue.setConsumer(async s=>{if(!s.files.length)return;const o=s.files[0],a=await o.getFile();this.loadFileToCanvas(new File([a],a.name||"",{type:a.type}),o)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let n=null;try{typeof this.props.initialData=="function"?n=await this.props.initialData()||null:n=await this.props.initialData||null,n!=null&&n.libraryItems&&this.library.updateLibrary({libraryItems:n.libraryItems,merge:!0}).catch(s=>{console.error(s)})}catch(s){console.error(s),n={appState:{errorMessage:s.message||"Encountered an error during importing or restoring scene data"}}}const i=rd(n,null,null,{repairBindings:!0});i.appState={...i.appState,theme:this.props.theme||i.appState.theme,openSidebar:((r=i.appState)==null?void 0:r.openSidebar)||this.state.openSidebar,activeTool:i.appState.activeTool.type==="image"?{...i.appState.activeTool,type:"selection"}:i.appState.activeTool,isLoading:!1,toast:this.state.toast},n!=null&&n.scrollToContent&&(i.appState={...i.appState,...im(i.elements,{...i.appState,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.resetStore(),this.resetHistory(),this.syncActionResult({...i,captureUpdate:Z.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(s=>{this.fonts.onLoaded(s)}),Zf(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})});F(this,"isMobileBreakpoint",(n,i)=>n<CQ||i<MQ&&n<AQ);F(this,"refreshViewportBreakpoints",()=>{if(!this.excalidrawContainerRef.current)return;const{clientWidth:i,clientHeight:r}=document.body,s=this.device.viewport,o=jU(s,{isLandscape:i>r,isMobile:this.isMobileBreakpoint(i,r)});return s!==o?(this.device={...this.device,viewport:o},!0):!1});F(this,"refreshEditorBreakpoints",()=>{const n=this.excalidrawContainerRef.current;if(!n)return;const{width:i,height:r}=n.getBoundingClientRect(),s=this.props.UIOptions.dockedSidebarBreakpoint!=null?this.props.UIOptions.dockedSidebarBreakpoint:RQ,o=this.device.editor,a=jU(o,{isMobile:this.isMobileBreakpoint(i,r),canFitSidebar:i>s});return o!==a?(this.device={...this.device,editor:a},!0):!1});F(this,"onResize",en(()=>{this.scene.getElementsIncludingDeleted().forEach(n=>Gt.delete(n)),this.refreshViewportBreakpoints(),this.updateDOMRect(),O3||this.refreshEditorBreakpoints(),this.setState({})}));F(this,"onFullscreenChange",()=>{var n;!document.fullscreenElement&&((n=this.state.activeEmbeddable)==null?void 0:n.state)==="active"&&this.setState({activeEmbeddable:null})});F(this,"renderInteractiveSceneCallback",({atLeastOneVisibleElement:n,scrollBars:i,elementsMap:r})=>{i&&(_7=i);const s=this.state.editingTextElement?!1:!n&&r.size>0;this.state.scrolledOutside!==s&&this.setState({scrolledOutside:s}),this.scheduleImageRefresh()});F(this,"onScroll",Ga(()=>{const{offsetTop:n,offsetLeft:i}=this.getCanvasOffsets();this.setState(r=>r.offsetLeft===i&&r.offsetTop===n?null:{offsetTop:n,offsetLeft:i})},IQ));F(this,"onCut",en(n=>{var r;!((r=this.excalidrawContainerRef.current)!=null&&r.contains(document.activeElement))||ou(n.target)||(this.actionManager.executeAction(bM,"keyboard",n),n.preventDefault(),n.stopPropagation())}));F(this,"onCopy",en(n=>{var r;!((r=this.excalidrawContainerRef.current)!=null&&r.contains(document.activeElement))||ou(n.target)||(this.actionManager.executeAction(f2,"keyboard",n),n.preventDefault(),n.stopPropagation())}));F(this,"onTouchStart",n=>{if(DO&&n.preventDefault(),!Z1){Z1=!0,clearTimeout(E7),E7=window.setTimeout(uw.resetTapTwice,_Q);return}if(Z1&&n.touches.length===1){const i=n.touches[0];this.handleCanvasDoubleClick({clientX:i.clientX,clientY:i.clientY}),Z1=!1,clearTimeout(E7)}n.touches.length===2&&this.setState({selectedElementIds:gt({},this.state),activeEmbeddable:null})});F(this,"onTouchEnd",n=>{this.resetContextMenuTimer(),n.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:gt(this.state.previousSelectedElementIds,this.state)}):ht.pointers.clear()});F(this,"pasteFromClipboard",en(async n=>{var d,f;const i=!!mU,r=document.activeElement,s=(d=this.excalidrawContainerRef.current)==null?void 0:d.contains(r);if(n&&!s)return;const o=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(n&&(!(o instanceof HTMLCanvasElement)||ou(r)))return;const{x:a,y:l}=Pt({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state);let c=(f=n==null?void 0:n.clipboardData)==null?void 0:f.files[0];const u=await eH(n,i);if(!c&&!i){if(u.mixedContent)return this.addElementsFromMixedContentPaste(u.mixedContent,{isPlainPaste:i,sceneX:a,sceneY:l});if(u.text){const h=u.text.trim();h.startsWith("<svg")&&h.endsWith("</svg>")&&(c=KC(h))}}if(Fu(c)&&!u.spreadsheet){if(!this.isToolSupported("image")){this.setState({errorMessage:L("errors.imageToolNotSupported")});return}const h=this.createImageElement({sceneX:a,sceneY:l});this.insertImageElement(h,c),this.initializeImageDimensions(h),this.setState({selectedElementIds:gt({[h.id]:!0},this.state)});return}if(this.props.onPaste)try{if(await this.props.onPaste(u,n)===!1)return}catch(h){console.error(h)}if(u.errorMessage)this.setState({errorMessage:u.errorMessage});else if(u.spreadsheet&&!i)this.setState({pasteDialog:{data:u.spreadsheet,shown:!0}});else if(u.elements){const h=u.programmaticAPI?n4(u.elements):u.elements;this.addElementsFromPasteOrLibrary({elements:h,files:u.files||null,position:"cursor",retainSeed:i})}else if(u.text){if(u.text&&t8e(u.text)){const p=await be(()=>import("./index-BNUs3Dpc.js").then(b=>b.bs),__vite__mapDeps([]));try{const{elements:b,files:E={}}=await p.parseMermaidToExcalidraw(u.text),y=n4(b,{regenerateIds:!0});this.addElementsFromPasteOrLibrary({elements:y,files:E,position:"cursor"});return}catch(b){console.warn(`parsing pasted text as mermaid definition failed: ${b.message}`)}}const h=cF(u.text).split(/\n+/).map(p=>p.trim()).filter(Boolean),m=h.map(p=>bce(p)).filter(p=>{var b;return qU(p,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(p)||((b=Pf(p))==null?void 0:b.type)==="video")});if(!mU&&m.length>0&&m.length===h.length){const p=[];for(const b of m){const E=p[p.length-1],y=this.insertEmbeddableElement({sceneX:E?E.x+E.width+20:a,sceneY:l,link:Or(b)});y&&p.push(y)}p.length&&this.setState({selectedElementIds:Object.fromEntries(p.map(b=>[b.id,!0]))});return}this.addTextFromPaste(u.text,i)}this.setActiveTool({type:"selection"}),n==null||n.preventDefault()}));F(this,"addElementsFromPasteOrLibrary",n=>{var T,A;const i=id(n.elements,null,void 0),[r,s,o,a]=wt(i),l=Li(r,o)/2,c=Li(s,a)/2,u=typeof n.position=="object"?n.position.clientX:n.position==="cursor"?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,d=typeof n.position=="object"?n.position.clientY:n.position==="cursor"?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop,{x:f,y:h}=Pt({clientX:u,clientY:d},this.state),m=f-l,p=h-c,[b,E]=Rn(m,p,this.getEffectiveGridSize()),y=sB(i.map(S=>Ce(S,{x:S.x+b-r,y:S.y+E-s})),{randomizeSeed:!n.retainSeed}),v=this.scene.getElementsIncludingDeleted();let _=[...v,...y];_=((A=(T=this.props).onDuplicate)==null?void 0:A.call(T,_,v))||_,Vo(_,Se(y));const R=this.getTopLayerFrameAtSceneCoords({x:f,y:h});if(R){const S=$he(y,R);Qg(_,S,R,this.state)}this.scene.replaceAllElements(_),y.forEach(S=>{if(de(S)&&Xt(S)){const k=ui(S,this.scene.getElementsMapIncludingDeleted());Qi(S,k,this.scene.getElementsMapIncludingDeleted())}}),uQ&&Vs.loadElementsFonts(y).then(S=>{this.fonts.onLoaded(S)}),n.files&&this.addMissingFiles(n.files),this.store.shouldCaptureIncrement();const w=g_(y);this.setState({...this.state,openSidebar:this.state.openSidebar&&this.device.editor.canFitSidebar&&Ns.get($_)?this.state.openSidebar:null,...ji({editingGroupId:null,selectedElementIds:w.reduce((S,k)=>(Xt(k)||(S[k.id]=!0),S),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{n.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:"selection"}),n.fitToContent&&this.scrollToContent(y,{fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()})});F(this,"setAppState",(n,i)=>{this.setState(n,i)});F(this,"removePointer",n=>{bl&&this.resetContextMenuTimer(),ht.pointers.delete(n.pointerId)});F(this,"toggleLock",(n="ui")=>{this.state.activeTool.locked||ut("toolbar","toggleLock",`${n} (${this.device.editor.isMobile?"mobile":"desktop"})`),this.setState(i=>({activeTool:{...i.activeTool,...Sn(this.state,i.activeTool.locked?{type:"selection"}:i.activeTool),locked:!i.activeTool.locked}}))});F(this,"updateFrameRendering",n=>{this.setState(i=>{const r=typeof n=="function"?n(i.frameRendering):n;return{frameRendering:{enabled:(r==null?void 0:r.enabled)??i.frameRendering.enabled,clip:(r==null?void 0:r.clip)??i.frameRendering.clip,name:(r==null?void 0:r.name)??i.frameRendering.name,outline:(r==null?void 0:r.outline)??i.frameRendering.outline}}})});F(this,"togglePenMode",n=>{this.setState(i=>({penMode:n??!i.penMode,penDetected:!0}))});F(this,"onHandToolToggle",()=>{this.actionManager.executeAction(Ppe)});F(this,"zoomCanvas",n=>{this.setState({...vu({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:Aa(n)},this.state)})});F(this,"cancelInProgressAnimation",null);F(this,"scrollToContent",(n=this.scene.getNonDeletedElements(),i)=>{var l;if(typeof n=="string"){let c;if(Zf(n)?c=Vfe(n):c=n,c){const u=this.scene.getElementsFromId(c);u!=null&&u.length?this.scrollToContent(u,{fitToContent:(i==null?void 0:i.fitToContent)??!0,animate:(i==null?void 0:i.animate)??!0}):Zf(n)&&this.setState({toast:{message:L("elementLink.notFound"),duration:3e3,closable:!0}})}return}(l=this.cancelInProgressAnimation)==null||l.call(this);const r=Array.isArray(n)?n:[n];let s=this.state.zoom,o=this.state.scrollX,a=this.state.scrollY;if(i!=null&&i.fitToContent||i!=null&&i.fitToViewport){const{appState:c}=M5({canvasOffsets:i.canvasOffsets,targetElements:r,appState:this.state,fitToViewport:!!(i!=null&&i.fitToViewport),viewportZoomFactor:i==null?void 0:i.viewportZoomFactor,minZoom:i==null?void 0:i.minZoom,maxZoom:i==null?void 0:i.maxZoom});s=c.zoom,o=c.scrollX,a=c.scrollY}else{const c=im(r,this.state);o=c.scrollX,a=c.scrollY}if(i!=null&&i.animate){const c=this.state.scrollX,u=this.state.scrollY,d=this.state.zoom.value,f=yee({fromValues:{scrollX:c,scrollY:u,zoom:d},toValues:{scrollX:o,scrollY:a,zoom:s.value},interpolateValue:(h,m,p,b)=>{if(b==="zoom")return h*Math.pow(m/h,Du(p))},onStep:({scrollX:h,scrollY:m,zoom:p})=>{this.setState({scrollX:h,scrollY:m,zoom:{value:p}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:(i==null?void 0:i.duration)??500});this.cancelInProgressAnimation=()=>{f(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:o,scrollY:a,zoom:s})});F(this,"maybeUnfollowRemoteUser",()=>{this.state.userToFollow&&this.setState({userToFollow:null})});F(this,"translateCanvas",n=>{var i;(i=this.cancelInProgressAnimation)==null||i.call(this),this.maybeUnfollowRemoteUser(),this.setState(n)});F(this,"setToast",n=>{this.setState({toast:n})});F(this,"restoreFileFromShare",async()=>{try{const n=await caches.open("web-share-target"),i=await n.match("shared-file");if(i){const r=await i.blob(),s=new File([r],r.name||"",{type:r.type});this.loadFileToCanvas(s,null),await n.delete("shared-file"),window.history.replaceState(null,Ra,window.location.pathname)}}catch(n){this.setState({errorMessage:n.message})}});F(this,"addFiles",en(n=>{const{addedFiles:i}=this.addMissingFiles(n);this.clearImageShapeCache(i),this.scene.triggerUpdate(),this.addNewImagesToImageCache()}));F(this,"addMissingFiles",(n,i=!1)=>{const r=i?{}:{...this.files},s={},o=Array.isArray(n)?n:Object.values(n);for(const a of o)if(!r[a.id]&&(s[a.id]=a,r[a.id]=a,a.mimeType===ye.svg))try{const l=Rfe(qC(Lfe(a.dataURL)),ye.svg);a.dataURL!==l&&(a.version=(a.version??1)+1,a.dataURL=l)}catch(l){console.error(l)}return this.files=r,{addedFiles:s}});F(this,"updateScene",en(n=>{const i=Za(n.elements??[]);if(n.captureUpdate&&n.captureUpdate!==Z.EVENTUALLY){const r=this.store.snapshot.appState,s=this.store.snapshot.elements,o=n.appState?Object.assign({},r,n.appState):r,a=n.elements?this.store.filterUncomittedElements(this.scene.getElementsMapIncludingDeleted(),Se(i)):s;n.captureUpdate===Z.IMMEDIATELY?this.store.captureIncrement(a,o):n.captureUpdate===Z.NEVER&&this.store.updateSnapshot(a,o)}n.appState&&this.setState(n.appState),n.elements&&this.scene.replaceAllElements(i),n.collaborators&&this.setState({collaborators:n.collaborators})}));F(this,"triggerRender",n=>{n===!0?this.scene.triggerUpdate():this.setState({})});F(this,"toggleSidebar",({name:n,tab:i,force:r})=>{var a,l;let s;r===void 0?s=((a=this.state.openSidebar)==null?void 0:a.name)===n&&((l=this.state.openSidebar)==null?void 0:l.tab)===i?null:n:s=r?n:null;const o=s?{name:s}:null;return o&&i&&(o.tab=i),this.setState({openSidebar:o}),!!s});F(this,"updateCurrentCursorPosition",en(n=>{this.lastViewportPosition.x=n.clientX,this.lastViewportPosition.y=n.clientY}));F(this,"getEditorUIOffsets",()=>{var o,a,l,c,u,d,f,h,m,p;const n=((c=(l=(a=(o=this.excalidrawContainerRef)==null?void 0:o.current)==null?void 0:a.querySelector(".App-toolbar"))==null?void 0:l.getBoundingClientRect())==null?void 0:c.bottom)??0,i=(f=(d=(u=this.excalidrawContainerRef)==null?void 0:u.current)==null?void 0:d.querySelector(".sidebar"))==null?void 0:f.getBoundingClientRect(),r=(p=(m=(h=this.excalidrawContainerRef)==null?void 0:h.current)==null?void 0:m.querySelector(".App-menu__left"))==null?void 0:p.getBoundingClientRect(),s=16;return L0().rtl?{top:n+s,right:Math.max(this.state.width-((r==null?void 0:r.left)??this.state.width),0)+s,bottom:s,left:Math.max((i==null?void 0:i.right)??0,0)+s}:{top:n+s,right:Math.max(this.state.width-((i==null?void 0:i.left)??this.state.width)+s,0),bottom:s,left:Math.max((r==null?void 0:r.right)??0,0)+s}});F(this,"onKeyDown",en(n=>{var o,a;if("Proxy"in window&&(!n.shiftKey&&/^[A-Z]$/.test(n.key)||n.shiftKey&&/^[a-z]$/.test(n.key))&&(n=new Proxy(n,{get(l,c){const u=l[c];return typeof u=="function"?u.bind(l):c==="key"?n.shiftKey?l.key.toUpperCase():l.key.toLowerCase():u}})),!K3(n.target)){if((n.key===z.ESCAPE||n.key===z.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}const l=Fe(this.scene.getNonDeletedElementsMap(),this.state);if(l.length===1&&st(l[0])&&n.key===z.ENTER){this.startImageCropping(l[0]);return}if(n.key===z.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}const c=ug(n.key);if(n[z.CTRL_OR_CMD]&&c&&!n.shiftKey){n.preventDefault();const u=Fe(this.scene.getNonDeletedElementsMap(),this.state);u.length===1&&X6(u[0])&&this.flowChartCreator.createNodes(u[0],this.scene.getNonDeletedElementsMap(),this.state,$M(n.key)),(o=this.flowChartCreator.pendingNodes)!=null&&o.length&&!a2(this.flowChartCreator.pendingNodes,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(this.flowChartCreator.pendingNodes,{animate:!0,duration:300,fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()});return}if(n.altKey){const u=Fe(this.scene.getNonDeletedElementsMap(),this.state);if(u.length===1&&c){n.preventDefault();const d=this.flowChartNavigator.exploreByDirection(u[0],this.scene.getNonDeletedElementsMap(),$M(n.key));if(d){this.setState(h=>({selectedElementIds:gt({[d]:!0},h)}));const f=this.scene.getNonDeletedElementsMap().get(d);f&&!a2([f],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(f,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})}return}}}if(n[z.CTRL_OR_CMD]&&n.key===z.P&&!n.shiftKey&&!n.altKey){this.setToast({message:L("commandPalette.shortcutHint",{shortcut:Bi("commandPalette")})}),n.preventDefault();return}if(n[z.CTRL_OR_CMD]&&n.key.toLowerCase()===z.V&&(mU=n.shiftKey,clearTimeout(TR),TR=window.setTimeout(()=>{mU=!1},100)),n[z.CTRL_OR_CMD]&&ou(n.target)&&(n.code===tt.MINUS||n.code===tt.EQUAL)){n.preventDefault();return}if(ou(n.target)&&n.key!==z.ESCAPE||ug(n.key)&&K3(n.target))return;if(n.key===z.QUESTION_MARK){this.setState({openDialog:{name:"help"}});return}else if(n.key.toLowerCase()===z.E&&n.shiftKey&&n[z.CTRL_OR_CMD]){n.preventDefault(),this.setState({openDialog:{name:"imageExport"}});return}if(n.key===z.PAGE_UP||n.key===z.PAGE_DOWN){let l=(n.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;n.key===z.PAGE_DOWN&&(l=-l),n.shiftKey?this.translateCanvas(c=>({scrollX:c.scrollX+l})):this.translateCanvas(c=>({scrollY:c.scrollY+l}))}if(((a=this.state.openDialog)==null?void 0:a.name)==="elementLinkSelector"||this.actionManager.handleKeyDown(n)||this.state.viewModeEnabled)return;if(n[z.CTRL_OR_CMD]&&this.state.isBindingEnabled&&this.setState({isBindingEnabled:!1}),ug(n.key)){let l=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});const c=l.find(ge),u=new Set;l.filter(ge).filter(m=>{const p=m.startBinding&&!l.some(E=>{var y;return E.id===((y=m.startBinding)==null?void 0:y.elementId)}),b=m.endBinding&&!l.some(E=>{var y;return E.id===((y=m.endBinding)==null?void 0:y.elementId)});return p||b}).forEach(m=>u.add(m.id)),l=l.filter(m=>!u.has(m.id));const d=this.getEffectiveGridSize()&&(n.shiftKey?OI:this.getEffectiveGridSize())||(n.shiftKey?hQ:OI);let f=0,h=0;n.key===z.ARROW_LEFT?f=-d:n.key===z.ARROW_RIGHT?f=d:n.key===z.ARROW_UP?h=-d:n.key===z.ARROW_DOWN&&(h=d),l.forEach(m=>{ee(m,{x:m.x+f,y:m.y+h},!1),pr(m,this.scene.getNonDeletedElementsMap(),{simultaneouslyUpdated:l})}),this.setState({suggestedBindings:T8(l.filter(m=>m.id!==(c==null?void 0:c.id)||d!==0),this.scene.getNonDeletedElementsMap(),this.state.zoom)}),this.scene.triggerUpdate(),n.preventDefault()}else if(n.key===z.ENTER){const l=this.scene.getSelectedElements(this.state);if(l.length===1){const c=l[0];if(n[z.CTRL_OR_CMD])ke(c)&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==l[0].id)&&(this.store.shouldCaptureIncrement(),ge(c)||this.setState({editingLinearElement:new ue(c)}));else if(de(c)||R1e(c)){let u;de(c)||(u=c);const d=j8(c,this.state,this.scene.getNonDeletedElementsMap()),f=d.x,h=d.y;this.startTextEditing({sceneX:f,sceneY:h,container:u}),n.preventDefault();return}else Ie(c)&&this.setState({editingFrame:c.id})}}else if(!n.ctrlKey&&!n.altKey&&!n.metaKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){const l=Rle(n.key);l?(this.state.activeTool.type!==l&&ut("toolbar",l,`keyboard (${this.device.editor.isMobile?"mobile":"desktop"})`),l==="arrow"&&this.state.activeTool.type==="arrow"&&this.setState(c=>({currentItemArrowType:c.currentItemArrowType===ti.sharp?ti.round:c.currentItemArrowType===ti.round?ti.elbow:ti.sharp})),this.setActiveTool({type:l}),n.stopPropagation()):n.key===z.Q&&(this.toggleLock("keyboard"),n.stopPropagation())}if(n.key===z.SPACE&&ht.pointers.size===0&&(Zc=!0,It(this.interactiveCanvas,Tt.GRAB),n.preventDefault()),(n.key===z.G||n.key===z.S)&&!n.altKey&&!n[z.CTRL_OR_CMD]){const l=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!l.length)return;n.key===z.G&&(Th(this.state.activeTool.type)||l.some(c=>Th(c.type)))&&(this.setState({openPopup:"elementBackground"}),n.stopPropagation()),n.key===z.S&&(this.setState({openPopup:"elementStroke"}),n.stopPropagation())}if(!n[z.CTRL_OR_CMD]&&n.shiftKey&&n.key.toLowerCase()===z.F){const l=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!l.length)return;(this.state.activeTool.type==="text"||l.find(c=>de(c)||Oe(c,this.scene.getNonDeletedElementsMap())))&&(n.preventDefault(),this.setState({openPopup:"fontFamily"}))}if(n.key===z.K&&!n.altKey&&!n[z.CTRL_OR_CMD]){this.state.activeTool.type==="laser"?this.setActiveTool({type:"selection"}):this.setActiveTool({type:"laser"});return}n[z.CTRL_OR_CMD]&&(n.key===z.BACKSPACE||n.key===z.DELETE)&&Ns.set(N5,"clearCanvas");const i=n.key.toLocaleLowerCase(),r=i===z.S&&n.shiftKey,s=n.key===z.I||i===z.G&&n.shiftKey;(r||s)&&this.openEyeDropper({type:r?"stroke":"background"})}));F(this,"onKeyUp",en(n=>{var i,r,s,o;if(n.key===z.SPACE&&(this.state.viewModeEnabled||((i=this.state.openDialog)==null?void 0:i.name)==="elementLinkSelector"?It(this.interactiveCanvas,Tt.GRAB):this.state.activeTool.type==="selection"?Is(this.interactiveCanvas):(go(this.interactiveCanvas,this.state),this.setState({selectedElementIds:gt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),Zc=!1),!n[z.CTRL_OR_CMD]&&!this.state.isBindingEnabled&&this.setState({isBindingEnabled:!0}),ug(n.key)&&(Ub(this.scene.getSelectedElements(this.state).filter(ke),this.scene.getNonDeletedElementsMap(),this.scene.getNonDeletedElements(),this.scene,bu(this.state),((r=this.state.selectedLinearElement)==null?void 0:r.selectedPointsIndices)??[],this.state.zoom),this.setState({suggestedBindings:[]})),n.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:Z.IMMEDIATELY})),!n[z.CTRL_OR_CMD]&&this.flowChartCreator.isCreatingChart){(s=this.flowChartCreator.pendingNodes)!=null&&s.length&&this.scene.insertElements(this.flowChartCreator.pendingNodes);const a=(o=this.flowChartCreator.pendingNodes)==null?void 0:o[0];a&&(this.setState(l=>({selectedElementIds:gt({[a.id]:!0},l)})),a2([a],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())||this.scrollToContent(a,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})),this.flowChartCreator.clear(),this.syncActionResult({captureUpdate:Z.IMMEDIATELY})}}));F(this,"isToolSupported",n=>{var i;return((i=this.props.UIOptions.tools)==null?void 0:i[n])!==!1});F(this,"setActiveTool",n=>{if(!this.isToolSupported(n.type)){console.warn(`"${n.type}" tool is disabled via "UIOptions.canvasActions.tools.${n.type}"`);return}const i=Sn(this.state,n);i.type==="hand"?It(this.interactiveCanvas,Tt.GRAB):Zc||go(this.interactiveCanvas,{...this.state,activeTool:i}),Uee(document.activeElement)&&this.focusContainer(),a9(i.type)||this.setState({suggestedBindings:[]}),i.type==="image"&&this.onImageAction({insertOnCanvasDirectly:(n.type==="image"&&n.insertOnCanvasDirectly)??!1}),this.setState(r=>{const s={snapLines:r.snapLines.length?[]:r.snapLines,originSnapOffset:null,activeEmbeddable:null};return i.type==="freedraw"&&this.store.shouldCaptureIncrement(),i.type!=="selection"?{...r,activeTool:i,selectedElementIds:gt({},r),selectedGroupIds:gt({},r),editingGroupId:null,multiElement:null,...s}:{...r,activeTool:i,...s}})});F(this,"setOpenDialog",n=>{this.setState({openDialog:n})});F(this,"setCursor",n=>{It(this.interactiveCanvas,n)});F(this,"resetCursor",()=>{Is(this.interactiveCanvas)});F(this,"isTouchScreenMultiTouchGesture",()=>ht.pointers.size>=2);F(this,"getName",()=>this.state.name||this.props.name||`${L("labels.untitled")}-${cx()}`);F(this,"onGestureStart",en(n=>{n.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:gt({},this.state),activeEmbeddable:null}),ht.initialScale=this.state.zoom.value}));F(this,"onGestureChange",en(n=>{if(n.preventDefault(),this.isTouchScreenMultiTouchGesture())return;const i=ht.initialScale;i&&this.setState(r=>({...vu({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Aa(i*n.scale)},r)}))}));F(this,"onGestureEnd",en(n=>{n.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:gt(this.state.previousSelectedElementIds,this.state)}),ht.initialScale=null}));F(this,"startTextEditing",({sceneX:n,sceneY:i,insertAtParentCenter:r=!0,container:s,autoEdit:o=!0})=>{let a=!1,l=r&&this.getTextWysiwygSnappedToCenterPosition(n,i,this.state,s);s&&l&&(Oe(s,this.scene.getNonDeletedElementsMap())||(a=!0));let c=null;const u=this.scene.getSelectedElements(this.state);u.length===1?de(u[0])?c=u[0]:s?c=Oe(u[0],this.scene.getNonDeletedElementsMap()):c=this.getTextElementAtPosition(n,i):c=this.getTextElementAtPosition(n,i);const d=(c==null?void 0:c.fontFamily)||this.state.currentItemFontFamily,f=(c==null?void 0:c.lineHeight)||qu(d),h=this.state.currentItemFontSize;if(!c&&a&&s&&!Be(s)){const E=EF(xt({fontSize:h,fontFamily:d}),f),y=vF(h,f),v=Math.max(s.height,y),_=Math.max(s.width,E);ee(s,{height:v,width:_}),n=s.x+_/2,i=s.y+v/2,l&&(l=this.getTextWysiwygSnappedToCenterPosition(n,i,this.state,s))}const m=this.getTopLayerFrameAtSceneCoords({x:n,y:i}),p=c||Br({x:l?l.elementCenterX:n,y:l?l.elementCenterY:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:"",fontSize:h,fontFamily:d,textAlign:l?"center":this.state.currentItemTextAlign,verticalAlign:l?Ar.MIDDLE:K2,containerId:a?s==null?void 0:s.id:void 0,groupIds:(s==null?void 0:s.groupIds)??[],lineHeight:f,angle:(s==null?void 0:s.angle)??0,frameId:m?m.id:null});if(!c&&a&&s&&ee(s,{boundElements:(s.boundElements||[]).concat({type:"text",id:p.id})}),this.setState({editingTextElement:p}),!c)if(s&&a){const b=this.scene.getElementIndex(s.id);this.scene.insertElementAtIndex(p,b+1)}else this.scene.insertElement(p);o||c||s?this.handleTextWysiwyg(p,{isExistingElement:!!c}):this.setState({newElement:p,multiElement:null})});F(this,"startImageCropping",n=>{this.store.shouldCaptureIncrement(),this.setState({croppingElementId:n.id})});F(this,"finishImageCropping",()=>{this.state.croppingElementId&&(this.store.shouldCaptureIncrement(),this.setState({croppingElementId:null}))});F(this,"handleCanvasDoubleClick",n=>{if(this.state.multiElement||this.state.activeTool.type!=="selection")return;const i=this.scene.getSelectedElements(this.state);let{x:r,y:s}=Pt(n,this.state);if(i.length===1&&ke(i[0])){if(n[z.CTRL_OR_CMD]&&(!this.state.editingLinearElement||this.state.editingLinearElement.elementId!==i[0].id)&&!ge(i[0])){this.store.shouldCaptureIncrement(),this.setState({editingLinearElement:new ue(i[0])});return}else if(this.state.selectedLinearElement&&ge(i[0])){const a=ue.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:r,y:s},this.state,this.scene.getNonDeletedElementsMap()),l=a?ue.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,a,this.scene.getNonDeletedElementsMap()):-1;if(l&&l>-1){this.store.shouldCaptureIncrement(),ue.deleteFixedSegment(i[0],l);const c=ue.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:r,y:s},this.state,this.scene.getNonDeletedElementsMap()),u=c?ue.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,c,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,pointerDownState:{...this.state.selectedLinearElement.pointerDownState,segmentMidpoint:{index:u,value:a,added:!1}},segmentMidPointHoveredCoords:c}});return}}}if(i.length===1&&st(i[0])){this.startImageCropping(i[0]);return}if(Is(this.interactiveCanvas),Ou(this.state).length>0){const a=this.getElementAtPosition(r,s),l=a&&gte(a,this.state.selectedGroupIds);if(l){this.store.shouldCaptureIncrement(),this.setState(c=>({...c,...ji({editingGroupId:l,selectedElementIds:{[a.id]:!0}},this.scene.getNonDeletedElements(),c,this)}));return}}if(Is(this.interactiveCanvas),!n[z.CTRL_OR_CMD]&&!this.state.viewModeEnabled){const a=this.getElementAtPosition(r,s);if(ts(a)){this.setState({activeEmbeddable:{element:a,state:"active"}});return}const l=this.getTextBindableContainerAtPosition(r,s);if(l&&(Us(l)||!Fs(l.backgroundColor)||df({x:r,y:s,element:l,shape:ha(l,this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold()}))){const c=j8(l,this.state,this.scene.getNonDeletedElementsMap());r=c.x,s=c.y}this.startTextEditing({sceneX:r,sceneY:s,insertAtParentCenter:!n.altKey,container:l})}});F(this,"getElementLinkAtPosition",(n,i)=>{const r=this.scene.getNonDeletedElements();let s=-1;for(let o=r.length-1;o>=0;o--){const a=r[o];if(i&&a.id===i.id&&(s=o),a.link&&o>=s&&H8(a,this.scene.getNonDeletedElementsMap(),this.state,C(n.x,n.y),this.device.editor.isMobile))return a}});F(this,"redirectToLink",(n,i)=>{const r=pt(C(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),C(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||r>eu)return;const s=Pt(this.lastPointerDownEvent,this.state),o=this.scene.getNonDeletedElementsMap(),a=H8(this.hitLinkElement,o,this.state,C(s.x,s.y),this.device.editor.isMobile),l=Pt(this.lastPointerUpEvent,this.state),c=H8(this.hitLinkElement,o,this.state,C(l.x,l.y),this.device.editor.isMobile);if(a&&c){TM();let u=this.hitLinkElement.link;if(u){u=Or(u);let d;if(this.props.onLinkOpen&&(d=aF(te.EXCALIDRAW_LINK,n.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:u},d)),!(d!=null&&d.defaultPrevented)){const f=AF(u)?"_self":"_blank",h=window.open(void 0,f);h&&(h.opener=null,h.location=u)}}}});F(this,"getTopLayerFrameAtSceneCoords",n=>{const i=this.scene.getNonDeletedElementsMap(),r=this.scene.getNonDeletedFramesLikes().filter(s=>oA(n,s,i));return r.length?r[r.length-1]:null});F(this,"handleCanvasPointerMove",n=>{var h,m,p,b,E,y;this.savePointer(n.clientX,n.clientY,this.state.cursorButton),this.lastPointerMoveEvent=n.nativeEvent,ht.pointers.has(n.pointerId)&&ht.pointers.set(n.pointerId,{x:n.clientX,y:n.clientY});const i=ht.initialScale;if(ht.pointers.size===2&&ht.lastCenter&&i&&ht.initialDistance){const v=zM(ht.pointers),_=v.x-ht.lastCenter.x,I=v.y-ht.lastCenter.y;ht.lastCenter=v;const R=HM(Array.from(ht.pointers.values())),w=this.state.activeTool.type==="freedraw"&&this.state.penMode?1:R/ht.initialDistance,T=w?Aa(i*w):this.state.zoom.value;this.setState(A=>{const S=vu({viewportX:v.x,viewportY:v.y,nextZoom:T},A);this.translateCanvas({zoom:S.zoom,scrollX:S.scrollX+2*(_/T),scrollY:S.scrollY+2*(I/T),shouldCacheIgnoreZoom:!0})}),this.resetShouldCacheIgnoreZoomDebounced()}else ht.lastCenter=ht.initialDistance=ht.initialScale=null;if(Zc||q1||v7||mh(this.state))return;const s=XM(_7,n.clientX-this.state.offsetLeft,n.clientY-this.state.offsetTop).isOverEither;!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(s?Is(this.interactiveCanvas):go(this.interactiveCanvas,this.state));const o=Pt(n,this.state),{x:a,y:l}=o;if(!this.state.newElement&&w1e(this.state.activeTool.type)){const{originOffset:v,snapLines:_}=_1e(this.scene.getNonDeletedElements(),this,{x:a,y:l},n,this.scene.getNonDeletedElementsMap());this.setState(I=>{const R=z1(I.snapLines,_),w=I.originSnapOffset?z1(I.originSnapOffset,v):v;return I.snapLines===R&&I.originSnapOffset===w?null:{snapLines:R,originSnapOffset:w}})}else!this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(v=>v.snapLines.length?{snapLines:[]}:null);if(this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging){const v=ue.handlePointerMove(n,a,l,this,this.scene.getNonDeletedElementsMap());v&&v!==this.state.editingLinearElement&&Xn.flushSync(()=>{this.setState({editingLinearElement:v})}),(v==null?void 0:v.lastUncommittedPoint)!=null?this.maybeSuggestBindingAtCursor(o,v.elbowed):Xn.flushSync(()=>{this.setState({suggestedBindings:[]})})}if(dF(this.state.activeTool.type)){const{newElement:v}=this.state;So(v,!1)?this.maybeSuggestBindingsForLinearElementAtCoords(v,[o],this.state.startBoundElement):this.maybeSuggestBindingAtCursor(o,!1)}if(this.state.multiElement){const{multiElement:v}=this.state,{x:_,y:I}=v,{points:R,lastCommittedPoint:w}=v,T=R[R.length-1];if(go(this.interactiveCanvas,this.state),T===w)pt(C(a-_,l-I),T)>=VU?ee(v,{points:[...R,C(a-_,l-I)]},!1):It(this.interactiveCanvas,Tt.POINTER);else if(R.length>2&&w&&pt(C(a-_,l-I),w)<VU)It(this.interactiveCanvas,Tt.POINTER),ee(v,{points:R.slice(0,-1)},!1);else{const[A,S]=Rn(a,l,n[z.CTRL_OR_CMD]||ge(v)?null:this.getEffectiveGridSize()),[k,N]=(v==null?void 0:v.lastCommittedPoint)??[0,0];let D=A-_-k,G=S-I-N;jg(n)&&({width:D,height:G}=CE(k+_,N+I,A,S)),ja(R,this.state.zoom.value)&&It(this.interactiveCanvas,Tt.POINTER),ee(v,{points:[...R.slice(0,-1),C(k+D,N+G)]},!1,{isDragging:!0}),this.triggerRender(!1)}return}if(!!n.buttons||this.state.activeTool.type!=="selection"&&this.state.activeTool.type!=="text"&&this.state.activeTool.type!=="eraser")return;const u=this.scene.getNonDeletedElements(),d=this.scene.getSelectedElements(this.state);if(d.length===1&&!s&&!this.state.editingLinearElement){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,a,l),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&((h=this.state.openDialog)==null?void 0:h.name)!=="elementLinkSelector"&&!(d.length===1&&ge(d[0]))){const v=MA(u,this.state,a,l,this.state.zoom,n.pointerType,this.scene.getNonDeletedElementsMap(),this.device);if(v&&v.transformHandleType){It(this.interactiveCanvas,kA(v));return}}}else if(d.length>1&&!s&&((m=this.state.openDialog)==null?void 0:m.name)!=="elementLinkSelector"){const v=RA(wt(d),a,l,this.state.zoom,n.pointerType,this.device);if(v){It(this.interactiveCanvas,kA({transformHandleType:v}));return}}const f=this.getElementAtPosition(o.x,o.y);this.hitLinkElement=this.getElementLinkAtPosition(o,f),!bo(this.state)&&(this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?(It(this.interactiveCanvas,Tt.POINTER),mUe(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap())):(TM(),f&&(f.link||lr(f))&&this.state.selectedElementIds[f.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:"info"}):this.state.activeTool.type==="text"?It(this.interactiveCanvas,de(f)?Tt.TEXT:Tt.CROSSHAIR):this.state.viewModeEnabled?It(this.interactiveCanvas,Tt.GRAB):((p=this.state.openDialog)==null?void 0:p.name)==="elementLinkSelector"?It(this.interactiveCanvas,Tt.AUTO):s?It(this.interactiveCanvas,Tt.AUTO):this.state.selectedLinearElement?this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,a,l):n[z.CTRL_OR_CMD]?It(this.interactiveCanvas,Tt.AUTO):(f||this.isHittingCommonBoundingBoxOfSelectedElements(o,d))&&!(f!=null&&f.locked)&&(f&&ts(f)&&this.isIframeLikeElementCenter(f,n,a,l)?(It(this.interactiveCanvas,Tt.POINTER),this.setState({activeEmbeddable:{element:f,state:"hover"}})):(!f||!ge(f))&&(It(this.interactiveCanvas,Tt.MOVE),((b=this.state.activeEmbeddable)==null?void 0:b.state)==="hover"&&this.setState({activeEmbeddable:null})))),((E=this.state.openDialog)==null?void 0:E.name)==="elementLinkSelector"&&f?this.setState(v=>({hoveredElementIds:z1(v.hoveredElementIds,ji({editingGroupId:v.editingGroupId,selectedElementIds:{[f.id]:!0}},this.scene.getNonDeletedElements(),v,this).selectedElementIds)})):((y=this.state.openDialog)==null?void 0:y.name)==="elementLinkSelector"&&!f&&this.setState(v=>({hoveredElementIds:z1(v.hoveredElementIds,{})})))});F(this,"handleEraser",(n,i,r)=>{this.eraserTrail.addPointToPath(r.x,r.y);let s=!1;const o=new Set,a=this.scene.getNonDeletedElements(),l=h=>{var m;for(const p of h){if(p.locked)return;if(n.altKey?this.elementsPendingErasure.delete(p.id)&&(s=!0):this.elementsPendingErasure.has(p.id)||(s=!0,this.elementsPendingErasure.add(p.id)),s&&((m=p.groupIds)!=null&&m.length)){const b=p.groupIds.at(-1);if(!o.has(b)){o.add(b);const E=$t(a,b);for(const y of E)n.altKey?this.elementsPendingErasure.delete(y.id):this.elementsPendingErasure.add(y.id)}}}},c=pt(C(i.lastCoords.x,i.lastCoords.y),C(r.x,r.y)),u=this.getElementHitThreshold(),d={...i.lastCoords};let f=0;for(;f<=c;){const h=this.getElementsAtPosition(d.x,d.y);if(l(h),f===c)break;f=Math.min(f+u,c);const m=f/c,p=(1-m)*d.x+m*r.x,b=(1-m)*d.y+m*r.y;d.x=p,d.y=b}if(i.lastCoords.x=r.x,i.lastCoords.y=r.y,s){for(const h of this.scene.getNonDeletedElements())Xt(h)&&(this.elementsPendingErasure.has(h.id)||this.elementsPendingErasure.has(h.containerId))&&(n.altKey?(this.elementsPendingErasure.delete(h.id),this.elementsPendingErasure.delete(h.containerId)):(this.elementsPendingErasure.add(h.id),this.elementsPendingErasure.add(h.containerId)));this.elementsPendingErasure=new Set(this.elementsPendingErasure),this.triggerRender()}});F(this,"handleTouchMove",n=>{Q1=!0});F(this,"handleCanvasPointerDown",n=>{var d,f,h;const i=n.target;if(i.setPointerCapture&&i.setPointerCapture(n.pointerId),this.maybeCleanupAfterMissingPointerUp(n.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(m=>({searchMatches:m.searchMatches.map(p=>({...p,focus:!1}))})),Ns.set(OG,null)),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.updateGestureOnPointerDown(n),n.pointerType==="touch"&&this.state.newElement&&this.state.newElement.type==="freedraw"){const m=this.state.newElement;this.updateScene({...m.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(p=>p.id!==m.id)}:{},appState:{newElement:null,editingTextElement:null,startBoundElement:null,suggestedBindings:[],selectedElementIds:gt(Object.keys(this.state.selectedElementIds).filter(p=>p!==m.id).reduce((p,b)=>(p[b]=this.state.selectedElementIds[b],p),{}),this.state)},captureUpdate:((d=this.state.openDialog)==null?void 0:d.name)==="elementLinkSelector"?Z.EVENTUALLY:Z.NEVER});return}const r=document.getSelection();if(r!=null&&r.anchorNode&&r.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(n),!this.state.penDetected&&n.pointerType==="pen"&&this.setState(m=>({penMode:!0,penDetected:!0})),!this.device.isTouchScreen&&["pen","touch"].includes(n.pointerType)&&(this.device=jU(this.device,{isTouchScreen:!0})),q1||(this.lastPointerDownEvent=n,this.handleCanvasPanUsingWheelOrSpaceDrag(n)))return;if(this.setState({lastPointerDownWith:n.pointerType,cursorButton:"down"}),this.savePointer(n.clientX,n.clientY,"down"),n.button===El.ERASER&&this.state.activeTool.type!==Gn.eraser){this.setState({activeTool:Sn(this.state,{type:Gn.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(n);const m=()=>{p(),b==null||b(),bo(this.state)&&this.setState({activeTool:Sn(this.state,{...this.state.activeTool.lastActiveTool||{type:Gn.selection},lastActiveToolBeforeEraser:null})})},p=Jt(window,te.POINTER_UP,m,{once:!0});let b;requestAnimationFrame(()=>{b=this.missingPointerEventCleanupEmitter.once(m)})});return}if(n.button!==El.MAIN&&n.button!==El.TOUCH&&n.button!==El.ERASER||ht.pointers.size>1)return;const s=this.initialPointerDownState(n);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleDraggingScrollBar(n,s)||(this.clearSelectionIfNotUsingSelection(),this.updateBindingEnabledOnPointerMove(n),this.handleSelectionOnPointerDown(n,s))||!(!this.state.penMode||n.pointerType!=="touch"||this.state.activeTool.type==="selection"||this.state.activeTool.type==="text"||this.state.activeTool.type==="image"))return;if(this.state.activeTool.type==="text")this.handleTextOnPointerDown(n,s);else if(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")this.handleLinearElementOnPointerDown(n,this.state.activeTool.type,s);else if(this.state.activeTool.type==="image"){It(this.interactiveCanvas,Tt.CROSSHAIR);const m=this.state.pendingImageElementId&&this.scene.getElement(this.state.pendingImageElementId);if(!m)return;this.setState({newElement:m,pendingImageElementId:null,multiElement:null});const{x:p,y:b}=Pt(n,this.state),E=this.getTopLayerFrameAtSceneCoords({x:p,y:b});ee(m,{x:p,y:b,frameId:E?E.id:null})}else this.state.activeTool.type==="freedraw"?this.handleFreeDrawElementOnPointerDown(n,this.state.activeTool.type,s):this.state.activeTool.type==="custom"?go(this.interactiveCanvas,this.state):this.state.activeTool.type===Gn.frame||this.state.activeTool.type===Gn.magicframe?this.createFrameElementOnPointerDown(s,this.state.activeTool.type):this.state.activeTool.type==="laser"?this.laserTrails.startPath(s.lastCoords.x,s.lastCoords.y):this.state.activeTool.type!=="eraser"&&this.state.activeTool.type!=="hand"&&this.createGenericElementOnPointerDown(this.state.activeTool.type,s);(h=(f=this.props)==null?void 0:f.onPointerDown)==null||h.call(f,this.state.activeTool,s),this.onPointerDownEmitter.trigger(this.state.activeTool,s,n),this.state.activeTool.type==="eraser"&&this.eraserTrail.startPath(s.lastCoords.x,s.lastCoords.y);const a=this.onPointerMoveFromPointerDownHandler(s),l=this.onPointerUpFromPointerDownHandler(s),c=this.onKeyDownFromPointerDownHandler(s),u=this.onKeyUpFromPointerDownHandler(s);this.missingPointerEventCleanupEmitter.once(m=>l(m||n.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type==="laser")&&(window.addEventListener(te.POINTER_MOVE,a),window.addEventListener(te.POINTER_UP,l),window.addEventListener(te.KEYDOWN,c),window.addEventListener(te.KEYUP,u),s.eventListeners.onMove=a,s.eventListeners.onUp=l,s.eventListeners.onKeyUp=u,s.eventListeners.onKeyDown=c)});F(this,"handleCanvasPointerUp",n=>{var s;this.removePointer(n),this.lastPointerUpEvent=n;const i=Pt({clientX:n.clientX,clientY:n.clientY},this.state),r=n.timeStamp-(((s=this.lastPointerDownEvent)==null?void 0:s.timeStamp)??0);if(this.device.editor.isMobile&&r<300){const o=this.getElementAtPosition(i.x,i.y);if(ts(o)&&this.isIframeLikeElementCenter(o,n,i.x,i.y)){this.handleEmbeddableCenterClick(o);return}}if(this.device.isTouchScreen){const o=this.getElementAtPosition(i.x,i.y);this.hitLinkElement=this.getElementLinkAtPosition(i,o)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?r<300&&ts(this.hitLinkElement)&&!Pz(this.hitLinkElement,this.scene.getNonDeletedElementsMap(),this.state,C(i.x,i.y))?this.handleEmbeddableCenterClick(this.hitLinkElement):this.redirectToLink(n,this.device.isTouchScreen):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})});F(this,"maybeOpenContextMenuAfterPointerDownOnTouchDevices",n=>{n.pointerType==="touch"&&(Q1=!1,bl?Q1=!0:bl=window.setTimeout(()=>{bl=0,Q1||this.handleCanvasContextMenu(n)},wQ))});F(this,"resetContextMenuTimer",()=>{clearTimeout(bl),bl=0,Q1=!1});F(this,"maybeCleanupAfterMissingPointerUp",n=>{qc==null||qc(),this.missingPointerEventCleanupEmitter.trigger(n).clear()});F(this,"handleCanvasPanUsingWheelOrSpaceDrag",n=>{if(!(ht.pointers.size<=1&&(n.button===El.WHEEL||n.button===El.MAIN&&Zc||mh(this.state)||this.state.viewModeEnabled)))return!1;q1=!0,this.focusContainer(),this.state.editingTextElement||n.preventDefault();let i=!1;const r=typeof window===void 0?!1:/Linux/.test(window.navigator.platform);It(this.interactiveCanvas,Tt.GRABBING);let{clientX:s,clientY:o}=n;const a=p7(c=>{const u=s-c.clientX,d=o-c.clientY;if(s=c.clientX,o=c.clientY,r&&!i&&(Math.abs(u)>1||Math.abs(d)>1)){i=!0;const f=m=>{document.body.removeEventListener(te.PASTE,f),m.stopPropagation()},h=()=>{setTimeout(()=>{document.body.removeEventListener(te.PASTE,f),window.removeEventListener(te.POINTER_UP,h)},100)};document.body.addEventListener(te.PASTE,f),window.addEventListener(te.POINTER_UP,h)}this.translateCanvas({scrollX:this.state.scrollX-u/this.state.zoom.value,scrollY:this.state.scrollY-d/this.state.zoom.value})}),l=en(qc=()=>{qc=null,q1=!1,Zc||(this.state.viewModeEnabled?It(this.interactiveCanvas,Tt.GRAB):go(this.interactiveCanvas,this.state)),this.setState({cursorButton:"up"}),this.savePointer(n.clientX,n.clientY,"up"),window.removeEventListener(te.POINTER_MOVE,a),window.removeEventListener(te.POINTER_UP,l),window.removeEventListener(te.BLUR,l),a.flush()});return window.addEventListener(te.BLUR,l),window.addEventListener(te.POINTER_MOVE,a,{passive:!0}),window.addEventListener(te.POINTER_UP,l),!0});F(this,"clearSelectionIfNotUsingSelection",()=>{this.state.activeTool.type!=="selection"&&this.setState({selectedElementIds:gt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})});F(this,"handleSelectionOnPointerDown",(n,i)=>{var r;if(this.state.activeTool.type==="selection"){const s=this.scene.getNonDeletedElements(),o=this.scene.getNonDeletedElementsMap(),a=this.scene.getSelectedElements(this.state);if(a.length===1&&!this.state.editingLinearElement&&!ge(a[0])&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){const l=MA(s,this.state,i.origin.x,i.origin.y,this.state.zoom,n.pointerType,this.scene.getNonDeletedElementsMap(),this.device);l!=null&&(l.transformHandleType==="rotation"?(this.setState({resizingElement:l.element}),i.resize.handleType=l.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:l.element}),i.resize.handleType=l.transformHandleType))}else a.length>1&&(i.resize.handleType=RA(wt(a),i.origin.x,i.origin.y,this.state.zoom,n.pointerType,this.device));if(i.resize.handleType)i.resize.isResizing=!0,i.resize.offset=Ps($1e(i.resize.handleType,a,o,i.origin.x,i.origin.y)),a.length===1&&ke(a[0])&&a[0].points.length===2&&(i.resize.arrowDirection=G1e(i.resize.handleType,a[0]));else{if(this.state.selectedLinearElement){const u=this.state.editingLinearElement||this.state.selectedLinearElement,d=ue.handlePointerDown(n,this,this.store,i.origin,u,this.scene);if(d.hitElement&&(i.hit.element=d.hitElement),d.linearElementEditor&&(this.setState({selectedLinearElement:d.linearElementEditor}),this.state.editingLinearElement&&this.setState({editingLinearElement:d.linearElementEditor})),d.didAddPoint)return!0}if(i.hit.element=i.hit.element??this.getElementAtPosition(i.origin.x,i.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(i.origin,i.hit.element),this.hitLinkElement)return!0;if(this.state.croppingElementId&&((r=i.hit.element)==null?void 0:r.id)!==this.state.croppingElementId&&this.finishImageCropping(),i.hit.element&&this.getElementLinkAtPosition({x:i.origin.x,y:i.origin.y},i.hit.element))return!1;i.hit.allHitElements=this.getElementsAtPosition(i.origin.x,i.origin.y);const l=i.hit.element,c=i.hit.allHitElements.some(u=>this.isASelectedElement(u));if((l===null||!c)&&!n.shiftKey&&!i.hit.hasHitCommonBoundingBoxOfSelectedElements&&this.clearSelection(l),this.state.editingLinearElement)this.setState({selectedElementIds:gt({[this.state.editingLinearElement.elementId]:!0},this.state)});else if(l!=null){if(n[z.CTRL_OR_CMD])return this.state.selectedElementIds[l.id]||(i.hit.wasAddedToSelection=!0),this.setState(u=>({...hte(u,l),previousSelectedElementIds:this.state.selectedElementIds})),!1;this.state.selectedElementIds[l.id]||(this.state.editingGroupId&&!F0(l,this.state.editingGroupId)&&this.setState({selectedElementIds:gt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!c&&!i.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(u=>{var h;let d={...u.selectedElementIds,[l.id]:!0};const f=[];if(Object.keys(u.selectedElementIds).forEach(m=>{const p=this.scene.getElement(m);p&&f.push(p)}),Ie(l))Ho(f,l.id).forEach(m=>{delete d[m.id]});else if(l.frameId)d[l.frameId]&&delete d[l.id];else{const m=l.groupIds,p=new Set(m.flatMap(b=>$t(this.scene.getNonDeletedElements(),b)).filter(b=>Ie(b)).map(b=>b.id));p.size>0&&f.forEach(b=>{b.frameId&&p.has(b.frameId)&&(delete d[b.id],b.groupIds.flatMap(E=>$t(this.scene.getNonDeletedElements(),E)).forEach(E=>{delete d[E.id]}))})}return((h=u.openDialog)==null?void 0:h.name)==="elementLinkSelector"&&(l.groupIds.some(m=>u.selectedGroupIds[m])||(d={[l.id]:!0})),{...ji({editingGroupId:u.editingGroupId,selectedElementIds:d},this.scene.getNonDeletedElements(),u,this),showHyperlinkPopup:l.link||lr(l)?"info":!1}}),i.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1});F(this,"handleTextOnPointerDown",(n,i)=>{if(this.state.editingTextElement)return;let r=i.origin.x,s=i.origin.y;const o=this.getElementAtPosition(r,s,{includeBoundTextElement:!0});let a=this.getTextBindableContainerAtPosition(r,s);Us(o)&&(a=o,r=o.x+o.width/2,s=o.y+o.height/2),this.startTextEditing({sceneX:r,sceneY:s,insertAtParentCenter:!n.altKey,container:a,autoEdit:!1}),Is(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:Sn(this.state,{type:"selection"})})});F(this,"handleFreeDrawElementOnPointerDown",(n,i,r)=>{const[s,o]=Rn(r.origin.x,r.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:s,y:o}),l=n.pressure===.5,c=ule({type:i,x:s,y:o,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:l,locked:!1,frameId:a?a.id:null,points:[C(0,0)],pressures:l?[]:[n.pressure]});this.scene.insertElement(c),this.setState(d=>{const f={...d.selectedElementIds};return delete f[c.id],{selectedElementIds:gt(f,d)}});const u=zs(r.origin,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),this.state.zoom);this.setState({newElement:c,startBoundElement:u,suggestedBindings:[]})});F(this,"insertIframeElement",({sceneX:n,sceneY:i,width:r,height:s})=>{var c;const[o,a]=Rn(n,i,(c=this.lastPointerDownEvent)!=null&&c[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l=ale({type:"iframe",x:o,y:a,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("iframe"),opacity:this.state.currentItemOpacity,locked:!1,width:r,height:s});return this.scene.insertElement(l),l});F(this,"insertEmbeddableElement",({sceneX:n,sceneY:i,link:r})=>{var c;const[s,o]=Rn(n,i,(c=this.lastPointerDownEvent)!=null&&c[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=Pf(r);if(!a)return;a.error instanceof URIError&&this.setToast({message:L("toast.unrecognizedLinkFormat"),closable:!0});const l=$x({type:"embeddable",x:s,y:o,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("embeddable"),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:r});return this.scene.insertElement(l),l});F(this,"createImageElement",({sceneX:n,sceneY:i,addToFrameUnderCursor:r=!0})=>{var c;const[s,o]=Rn(n,i,(c=this.lastPointerDownEvent)!=null&&c[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=r?this.getTopLayerFrameAtSceneCoords({x:s,y:o}):null;return iB({type:"image",x:s,y:o,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:a?a.id:null})});F(this,"handleLinearElementOnPointerDown",(n,i,r)=>{if(this.state.multiElement){const{multiElement:s}=this.state;if(s.type==="line"&&ja(s.points,this.state.zoom.value)){ee(s,{lastCommittedPoint:s.points[s.points.length-1]}),this.actionManager.executeAction(Ts);return}if(ge(s)&&s.points.length>1){ee(s,{lastCommittedPoint:s.points[s.points.length-1]}),this.actionManager.executeAction(Ts);return}const{x:o,y:a,lastCommittedPoint:l}=s;if(s.points.length>1&&l&&pt(C(r.origin.x-o,r.origin.y-a),l)<VU){this.actionManager.executeAction(Ts);return}this.setState(c=>({selectedElementIds:gt({...c.selectedElementIds,[s.id]:!0},c)})),ee(s,{lastCommittedPoint:s.points[s.points.length-1]}),It(this.interactiveCanvas,Tt.POINTER)}else{const[s,o]=Rn(r.origin.x,r.origin.y,n[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=this.getTopLayerFrameAtSceneCoords({x:s,y:o}),{currentItemStartArrowhead:l,currentItemEndArrowhead:c}=this.state,[u,d]=i==="arrow"?[l,c]:[null,null],f=i==="arrow"?I9({type:i,x:s,y:o,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===ti.round?{type:On.PROPORTIONAL_RADIUS}:null,startArrowhead:u,endArrowhead:d,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===ti.elbow,fixedSegments:this.state.currentItemArrowType===ti.elbow?[]:null}):Pu({type:i,x:s,y:o,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness==="round"?{type:On.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null});this.setState(m=>{const p={...m.selectedElementIds};return delete p[f.id],{selectedElementIds:gt(p,m)}}),ee(f,{points:[...f.points,C(0,0)]});const h=zs(r.origin,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),this.state.zoom,ge(f),ge(f));this.scene.insertElement(f),this.setState({newElement:f,startBoundElement:h,suggestedBindings:[]})}});F(this,"createGenericElementOnPointerDown",(n,i)=>{var c;const[r,s]=Rn(i.origin.x,i.origin.y,(c=this.lastPointerDownEvent)!=null&&c[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.getTopLayerFrameAtSceneCoords({x:r,y:s}),a={x:r,y:s,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(n),locked:!1,frameId:o?o.id:null};let l;n==="embeddable"?l=$x({type:"embeddable",...a}):l=Xa({type:n,...a}),l.type==="selection"?this.setState({selectionElement:l}):(this.scene.insertElement(l),this.setState({multiElement:null,newElement:l}))});F(this,"createFrameElementOnPointerDown",(n,i)=>{var l;const[r,s]=Rn(n.origin.x,n.origin.y,(l=this.lastPointerDownEvent)!=null&&l[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o={x:r,y:s,opacity:this.state.currentItemOpacity,locked:!1,...tn},a=i===Gn.magicframe?aE(o):S9(o);this.scene.insertElement(a),this.setState({multiElement:null,newElement:a})});F(this,"restoreReadyToEraseElements",()=>{this.elementsPendingErasure=new Set,this.triggerRender()});F(this,"eraseElements",()=>{let n=!1;const i=this.scene.getElementsIncludingDeleted().map(r=>this.elementsPendingErasure.has(r.id)||r.frameId&&this.elementsPendingErasure.has(r.frameId)||Xt(r)&&this.elementsPendingErasure.has(r.containerId)?(n=!0,Ce(r,{isDeleted:!0})):r);this.elementsPendingErasure=new Set,n&&(this.store.shouldCaptureIncrement(),this.scene.replaceAllElements(i))});F(this,"initializeImage",async({imageFile:n,imageElement:i,showCursorImagePreview:r=!1})=>{var u,d,f,h;if(!Fu(n))throw new Error(L("errors.unsupportedFileType"));const s=n.type;if(It(this.interactiveCanvas,"wait"),s===ye.svg)try{n=KC(qC(await n.text()),n.name)}catch(m){throw console.warn(m),new Error(L("errors.svgImageInsertError"))}const o=await(((d=(u=this.props).generateIdForFile)==null?void 0:d.call(u,n))||Mfe(n));if(!o)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),new Error(L("errors.imageInsertError"));const a=this.files[o];if(!(a!=null&&a.dataURL)){try{n=await EE(n,{maxWidthOrHeight:kQ})}catch(m){console.error("Error trying to resizing image file on insertion",m)}if(n.size>zI)throw new Error(L("errors.fileTooBig",{maxSize:`${Math.trunc(zI/1024/1024)}MB`}))}if(r){const m=(f=this.files[o])==null?void 0:f.dataURL,p=m&&kfe(m);this.setImagePreviewCursor(p||n)}const l=((h=this.files[o])==null?void 0:h.dataURL)||await yE(n),c=ee(i,{fileId:o},!1);return new Promise(async(m,p)=>{var b;try{this.addMissingFiles([{mimeType:s,id:o,dataURL:l,created:Date.now(),lastRetrieved:Date.now()}]);const E=this.imageCache.get(o);E||(this.addNewImagesToImageCache(),await this.updateImageCache([c])),(E==null?void 0:E.image)instanceof Promise&&await E.image,this.state.pendingImageElementId!==c.id&&((b=this.state.newElement)==null?void 0:b.id)!==c.id&&this.initializeImageDimensions(c,!0),m(c)}catch(E){console.error(E),p(new Error(L("errors.imageInsertError")))}finally{r||Is(this.interactiveCanvas)}})});F(this,"insertImageElement",async(n,i,r)=>{if(!this.isToolSupported("image")){this.setState({errorMessage:L("errors.imageToolNotSupported")});return}this.scene.insertElement(n);try{return await this.initializeImage({imageFile:i,imageElement:n,showCursorImagePreview:r})}catch(s){return ee(n,{isDeleted:!0}),this.actionManager.executeAction(Ts),this.setState({errorMessage:s.message||L("errors.imageInsertError")}),null}});F(this,"setImagePreviewCursor",async n=>{let r;try{r=await EE(n,{maxWidthOrHeight:96})}catch(o){throw o.cause==="UNSUPPORTED"?new Error(L("errors.unsupportedFileType")):o}let s=await yE(r);if(n.type===ye.svg){const o=await kz(s);let a=Math.min(o.height,96),l=a*(o.width/o.height);l>96&&(l=96,a=l*(o.height/o.width));const c=document.createElement("canvas");c.height=a,c.width=l,c.getContext("2d").drawImage(o,0,0,l,a),s=c.toDataURL(ye.svg)}this.state.pendingImageElementId&&It(this.interactiveCanvas,`url(${s}) 4 4, auto`)});F(this,"onImageAction",async({insertOnCanvasDirectly:n})=>{try{const i=this.state.width/2+this.state.offsetLeft,r=this.state.height/2+this.state.offsetTop,{x:s,y:o}=Pt({clientX:i,clientY:r},this.state),a=await R9({description:"Image",extensions:Object.keys(gh)}),l=this.createImageElement({sceneX:s,sceneY:o,addToFrameUnderCursor:!1});n?(this.insertImageElement(l,a),this.initializeImageDimensions(l),this.setState({selectedElementIds:gt({[l.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ts)})):this.setState({pendingImageElementId:l.id},()=>{this.insertImageElement(l,a,!0)})}catch(i){i.name!=="AbortError"?console.error(i):console.warn(i),this.setState({pendingImageElementId:null,newElement:null,activeTool:Sn(this.state,{type:"selection"})},()=>{this.actionManager.executeAction(Ts)})}});F(this,"initializeImageDimensions",(n,i=!1)=>{var s;const r=xn(n)&&((s=this.imageCache.get(n.fileId))==null?void 0:s.image);if(!r||r instanceof Promise){if(n.width<eu/this.state.zoom.value&&n.height<eu/this.state.zoom.value){const o=100/this.state.zoom.value;ee(n,{x:n.x-o/2,y:n.y-o/2,width:o,height:o})}return}if(i||n.width<eu/this.state.zoom.value&&n.height<eu/this.state.zoom.value){const o=Math.max(this.state.height-120,160),a=Math.min(o,Math.floor(this.state.height*.5)/this.state.zoom.value),l=Math.min(r.naturalHeight,a),c=l*(r.naturalWidth/r.naturalHeight),u=n.x+n.width/2-c/2,d=n.y+n.height/2-l/2;ee(n,{x:u,y:d,width:c,height:l,crop:null})}});F(this,"updateImageCache",async(n,i=this.files)=>{const{updatedFiles:r,erroredFiles:s}=await Lz({imageCache:this.imageCache,fileIds:n.map(o=>o.fileId),files:i});if(r.size||s.size)for(const o of n)r.has(o.fileId)&&Gt.delete(o);return s.size&&this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(o=>xn(o)&&s.has(o.fileId)?Ce(o,{status:"error"}):o)),{updatedFiles:r,erroredFiles:s}});F(this,"addNewImagesToImageCache",async(n=Dz(this.scene.getNonDeletedElements()),i=this.files)=>{const r=n.filter(s=>!s.isDeleted&&!this.imageCache.has(s.fileId));if(r.length){const{updatedFiles:s}=await this.updateImageCache(r,i);s.size&&this.scene.triggerUpdate()}});F(this,"scheduleImageRefresh",Ao(()=>{this.addNewImagesToImageCache()},vQ));F(this,"updateBindingEnabledOnPointerMove",n=>{const i=Fle(n);this.state.isBindingEnabled!==i&&this.setState({isBindingEnabled:i})});F(this,"maybeSuggestBindingAtCursor",(n,i)=>{const r=zs(n,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),this.state.zoom,!1,i);this.setState({suggestedBindings:r!=null?[r]:[]})});F(this,"maybeSuggestBindingsForLinearElementAtCoords",(n,i,r)=>{if(!i.length)return;const s=i.reduce((o,a)=>{const l=zs(a,this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),this.state.zoom,ge(n),ge(n));return l!=null&&!_B(n,r==null?void 0:r.id,l)&&o.push(l),o},[]);this.setState({suggestedBindings:s})});F(this,"handleInteractiveCanvasRef",n=>{var i,r;n!==null?(this.interactiveCanvas=n,this.interactiveCanvas.addEventListener(te.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(te.TOUCH_END,this.onTouchEnd)):((i=this.interactiveCanvas)==null||i.removeEventListener(te.TOUCH_START,this.onTouchStart),(r=this.interactiveCanvas)==null||r.removeEventListener(te.TOUCH_END,this.onTouchEnd))});F(this,"handleAppOnDrop",async n=>{var l,c,u,d;const{file:i,fileHandle:r}=await Nfe(n),{x:s,y:o}=Pt(n,this.state);try{if(Fu(i)&&this.isToolSupported("image")){if((i==null?void 0:i.type)===ye.png||(i==null?void 0:i.type)===ye.svg)try{const h=await G9(i,this.state,this.scene.getElementsIncludingDeleted(),r);this.syncActionResult({...h,appState:{...h.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:Z.IMMEDIATELY});return}catch(h){if(h.name!=="EncodingError")throw new Error(L("alerts.couldNotLoadInvalidFile"))}const f=this.createImageElement({sceneX:s,sceneY:o});this.insertImageElement(f,i),this.initializeImageDimensions(f),this.setState({selectedElementIds:gt({[f.id]:!0},this.state)});return}}catch(f){return this.setState({isLoading:!1,errorMessage:f.message})}const a=n.dataTransfer.getData(ye.excalidrawlib);if(a&&typeof a=="string"){try{const f=Cz(a);this.addElementsFromPasteOrLibrary({elements:k$(f),position:n,files:null})}catch(f){this.setState({errorMessage:f.message})}return}if(i&&await this.loadFileToCanvas(i,r),(c=(l=n.dataTransfer)==null?void 0:l.types)!=null&&c.includes("text/plain")){const f=(u=n.dataTransfer)==null?void 0:u.getData("text");if(f&&qU(f,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(f)||((d=Pf(f))==null?void 0:d.type)==="video")){const h=this.insertEmbeddableElement({sceneX:s,sceneY:o,link:Or(f)});h&&this.setState({selectedElementIds:{[h.id]:!0}})}}});F(this,"loadFileToCanvas",async(n,i)=>{n=await X9(n);try{const r=this.scene.getElementsIncludingDeleted();let s;try{s=await xz(n,this.state,r,i)}catch(o){const a=o instanceof Uu;if(a&&o.code==="IMAGE_NOT_CONTAINS_SCENE_DATA"&&!this.isToolSupported("image")){this.setState({isLoading:!1,errorMessage:L("errors.imageToolNotSupported")});return}const l=L(a?"alerts.cannotRestoreFromImage":"alerts.couldNotLoadInvalidFile");this.setState({isLoading:!1,errorMessage:l})}if(!s)return;s.type===ye.excalidraw?(Za(r.concat(s.data.elements)),this.store.updateSnapshot(Se(r),this.state),this.setState({isLoading:!0}),this.syncActionResult({...s.data,appState:{...s.data.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:Z.IMMEDIATELY})):s.type===ye.excalidrawlib&&await this.library.updateLibrary({libraryItems:n,merge:!0,openLibraryMenu:!0}).catch(o=>{console.error(o),this.setState({errorMessage:L("errors.importLibraryError")})})}catch(r){this.setState({isLoading:!1,errorMessage:r.message})}});F(this,"handleCanvasContextMenu",n=>{if(n.preventDefault(),("pointerType"in n.nativeEvent&&n.nativeEvent.pointerType==="touch"||"pointerType"in n.nativeEvent&&n.nativeEvent.pointerType==="pen"&&n.button!==El.SECONDARY)&&this.state.activeTool.type!=="selection")return;const{x:i,y:r}=Pt(n,this.state),s=this.getElementAtPosition(i,r,{preferSelected:!0,includeLockedElements:!0}),o=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:i,y:r},o),l=s||a?"element":"canvas",c=this.excalidrawContainerRef.current,{top:u,left:d}=c.getBoundingClientRect(),f=n.clientX-d,h=n.clientY-u;ut("contextMenu","openContextMenu",l),this.setState({...s&&!this.state.selectedElementIds[s.id]?{...this.state,...ji({editingGroupId:this.state.editingGroupId,selectedElementIds:{[s.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:ke(s)?new ue(s):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:h,left:f,items:this.getContextMenuItems(l)}})})});F(this,"maybeDragNewGenericElement",(n,i,r=!0)=>{var m,p,b;const s=this.state.selectionElement,o=n.lastCoords;if(s&&this.state.activeTool.type!=="eraser"){DA({newElement:s,elementType:this.state.activeTool.type,originX:n.origin.x,originY:n.origin.y,x:o.x,y:o.y,width:Li(n.origin.x,o.x),height:Li(n.origin.y,o.y),shouldMaintainAspectRatio:G1(i),shouldResizeFromCenter:w8(i),zoom:this.state.zoom.value,informMutation:r});return}const a=this.state.newElement;if(!a)return;let[l,c]=Rn(o.x,o.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize());const u=xn(a)&&((m=this.imageCache.get(a.fileId))==null?void 0:m.image),d=u&&!(u instanceof Promise)?u.width/u.height:null;this.maybeCacheReferenceSnapPoints(i,[a]);const{snapOffset:f,snapLines:h}=v1e(a,this,i,{x:n.originInGrid.x+(((p=this.state.originSnapOffset)==null?void 0:p.x)??0),y:n.originInGrid.y+(((b=this.state.originSnapOffset)==null?void 0:b.y)??0)},{x:l-n.originInGrid.x,y:c-n.originInGrid.y},this.scene.getNonDeletedElementsMap());l+=f.x,c+=f.y,this.setState({snapLines:h}),DA({newElement:a,elementType:this.state.activeTool.type,originX:n.originInGrid.x,originY:n.originInGrid.y,x:l,y:c,width:Li(n.originInGrid.x,l),height:Li(n.originInGrid.y,c),shouldMaintainAspectRatio:st(a)?!G1(i):G1(i),shouldResizeFromCenter:w8(i),zoom:this.state.zoom.value,widthAspectRatio:d,originOffset:this.state.originSnapOffset,informMutation:r}),this.setState({newElement:a}),(this.state.activeTool.type===Gn.frame||this.state.activeTool.type===Gn.magicframe)&&this.setState({elementsToHighlight:s2(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})});F(this,"maybeHandleCrop",(n,i)=>{var c;if(!this.state.croppingElementId)return!1;const r=n.resize.handleType,s=n.lastCoords,[o,a]=Rn(s.x-n.resize.offset.x,s.y-n.resize.offset.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(r&&l&&st(l)){const u=n.originalElements.get(l.id),d=xn(l)&&((c=this.imageCache.get(l.fileId))==null?void 0:c.image);if(u&&st(u)&&d&&!(d instanceof Promise)){const[f,h]=Rn(s.x,s.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),m={x:f-n.originInGrid.x,y:h-n.originInGrid.y};this.maybeCacheReferenceSnapPoints(i,[l]);const{snapOffset:p,snapLines:b}=wA([l],[u],this,i,m,r);ee(l,yce(l,r,d.naturalWidth,d.naturalHeight,o+p.x,a+p.y,i.shiftKey?u.width/u.height:void 0)),pr(l,this.scene.getNonDeletedElementsMap(),{newSize:{width:l.width,height:l.height}}),this.setState({isCropping:r&&r!=="rotation",snapLines:b})}return!0}return!1});F(this,"maybeHandleResize",(n,i)=>{const r=this.scene.getSelectedElements(this.state),s=r.filter(d=>Ie(d)),o=n.resize.handleType;if(s.length>0&&o==="rotation"||r.length===1&&ge(r[0])||this.state.croppingElementId)return!1;this.setState({isResizing:o&&o!=="rotation",isRotating:o==="rotation",activeEmbeddable:null});const a=n.lastCoords;let[l,c]=Rn(a.x-n.resize.offset.x,a.y-n.resize.offset.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize());const u=new Map;if(s.forEach(d=>{Ho(this.scene.getNonDeletedElements(),d.id).forEach(h=>{u.set(d.id+h.id,{x:h.x-d.x,y:h.y-d.y})})}),!this.state.selectedElementsAreBeingDragged){const[d,f]=Rn(a.x,a.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),h={x:d-n.originInGrid.x,y:f-n.originInGrid.y},m=[...n.originalElements.values()];this.maybeCacheReferenceSnapPoints(i,r);const{snapOffset:p,snapLines:b}=wA(r,Fe(m,this.state),this,i,h,o);l+=p.x,c+=p.y,this.setState({snapLines:b})}if(B1e(n.originalElements,o,r,this.scene.getElementsMapIncludingDeleted(),this.scene,jg(i),w8(i),r.some(d=>st(d))?!G1(i):G1(i),l,c,n.resize.center.x,n.resize.center.y)){const d=T8(r,this.scene.getNonDeletedElementsMap(),this.state.zoom),f=new Set;return s.forEach(h=>{s2(this.scene.getNonDeletedElements(),h,this.state,this.scene.getNonDeletedElementsMap()).forEach(m=>f.add(m))}),this.setState({elementsToHighlight:[...f],suggestedBindings:d}),!0}return!1});F(this,"getContextMenuItems",n=>{const i=[];return i.push(EM,yM),n==="canvas"?this.state.viewModeEnabled?[...i,_M,VE,hR,$E]:[UM,Vn,EM,yM,vM,Vn,pge,yUe,Vn,_M,oUe,VE,hR,$E]:(i.push(vM),this.state.viewModeEnabled?[f2,...i]:[Vn,bM,f2,UM,Vn,dye,fye,hye,Vn,ebe,Vn,...i,Vn,Xpe,jpe,Vn,Wpe,e8e,aUe,lUe,dUe,Kpe,Vn,Jpe,Vn,fge,hge,gge,mge,Vn,iUe,rUe,Vn,J2e,Vn,h$,N$,Vn,Ege,bUe,Vn,BH])});F(this,"handleWheel",en(n=>{if(!(n.target instanceof HTMLCanvasElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLIFrameElement)){n[z.CTRL_OR_CMD]&&n.preventDefault();return}if(n.preventDefault(),q1)return;const{deltaX:i,deltaY:r}=n;if(n.metaKey||n.ctrlKey){const s=Math.sign(r),o=P6*100,a=Math.abs(r);let l=r;a>o&&(l=o*s);let c=this.state.zoom.value-l/100;c+=Math.log10(Math.max(1,this.state.zoom.value))*-s*Math.min(1,a/20),this.translateCanvas(u=>({...vu({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Aa(c)},u),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(n.shiftKey){this.translateCanvas(({zoom:s,scrollX:o})=>({scrollX:o-(r||i)/s.value}));return}this.translateCanvas(({zoom:s,scrollX:o,scrollY:a})=>({scrollX:o-i/s.value,scrollY:a-r/s.value}))}));F(this,"savePointer",(n,i,r)=>{var l,c;if(!n||!i)return;const{x:s,y:o}=Pt({clientX:n,clientY:i},this.state),a={x:s,y:o,tool:this.state.activeTool.type==="laser"?"laser":"pointer"};(c=(l=this.props).onPointerUpdate)==null||c.call(l,{pointer:a,button:r,pointersMap:ht.pointers})});F(this,"resetShouldCacheIgnoreZoomDebounced",Ga(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300));F(this,"updateDOMRect",n=>{var i;if((i=this.excalidrawContainerRef)!=null&&i.current){const r=this.excalidrawContainerRef.current,{width:s,height:o,left:a,top:l}=r.getBoundingClientRect(),{width:c,height:u,offsetTop:d,offsetLeft:f}=this.state;if(s===c&&o===u&&a===f&&l===d){n&&n();return}this.setState({width:s,height:o,offsetLeft:a,offsetTop:l},()=>{n&&n()})}});F(this,"refresh",()=>{this.setState({...this.getCanvasOffsets()})});const i=gs(),{excalidrawAPI:r,viewModeEnabled:s=!1,zenModeEnabled:o=!1,gridModeEnabled:a=!1,objectsSnapModeEnabled:l=!1,theme:c=i.theme,name:u=`${L("labels.untitled")}-${cx()}`}=n;if(this.state={...i,theme:c,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:s,zenModeEnabled:o,objectsSnapModeEnabled:l,gridModeEnabled:a??i.gridModeEnabled,name:u,width:window.innerWidth,height:window.innerHeight},this.id=i9(),this.library=new E2e(this),this.actionManager=new ibe(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new eo,this.canvas=document.createElement("canvas"),this.rc=Pc.canvas(this.canvas),this.renderer=new yR(this.scene),this.visibleElements=[],this.store=new cce,this.history=new _u,r){const d={updateScene:this.updateScene,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:f=>{this.actionManager.registerAction(f)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:f=>this.onChangeEmitter.on(f),onPointerDown:f=>this.onPointerDownEmitter.on(f),onPointerUp:f=>this.onPointerUpEmitter.on(f),onScrollChange:f=>this.onScrollChangeEmitter.on(f),onUserFollow:f=>this.onUserFollowEmitter.on(f)};typeof r=="function"?r(d):console.error("excalidrawAPI should be a function!")}this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new Vs(this.scene),this.history=new _u,this.actionManager.registerAll(eE),this.actionManager.registerAction(tbe(this.history,this.store)),this.actionManager.registerAction(nbe(this.history,this.store))}onWindowMessage(n){if(n.origin!=="https://player.vimeo.com"&&n.origin!=="https://www.youtube.com")return;let i=null;try{i=JSON.parse(n.data)}catch{}if(i)switch(n.origin){case"https://player.vimeo.com":if(i.method==="paused"){let r=null;const s=document.body.querySelectorAll("iframe.excalidraw__embeddable");if(!s)break;for(const o of s)o.contentWindow===n.source&&(r=o.contentWindow);r==null||r.postMessage(JSON.stringify({method:i.value?"play":"pause",value:!0}),"*")}break;case"https://www.youtube.com":if(i.event==="infoDelivery"&&i.info&&i.id&&typeof i.info.playerState=="number"){const r=i.id,s=i.info.playerState;Object.values(Vp).includes(s)&&w7.set(r,s)}break}}cacheEmbeddableRef(n,i){i&&this.iFrameRefs.set(n.id,i)}getHTMLIFrameElement(n){return this.iFrameRefs.get(n.id)}handleEmbeddableCenterClick(n){var r,s,o,a;if(((r=this.state.activeEmbeddable)==null?void 0:r.element)===n&&((s=this.state.activeEmbeddable)==null?void 0:s.state)==="active"||(setTimeout(()=>{this.setState({activeEmbeddable:{element:n,state:"active"},selectedElementIds:{[n.id]:!0},newElement:null,selectionElement:null})},100),Il(n)))return;const i=this.getHTMLIFrameElement(n);if(i!=null&&i.contentWindow){if(i.src.includes("youtube")){const l=w7.get(n.id);switch(l||(w7.set(n.id,Vp.UNSTARTED),i.contentWindow.postMessage(JSON.stringify({event:"listening",id:n.id}),"*")),l){case Vp.PLAYING:case Vp.BUFFERING:(o=i.contentWindow)==null||o.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*");break;default:(a=i.contentWindow)==null||a.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*")}}i.src.includes("player.vimeo.com")&&i.contentWindow.postMessage(JSON.stringify({method:"paused"}),"*")}}isIframeLikeElementCenter(n,i,r,s){var o,a;return n&&!i.altKey&&!i.shiftKey&&!i.metaKey&&!i.ctrlKey&&(((o=this.state.activeEmbeddable)==null?void 0:o.element)!==n||((a=this.state.activeEmbeddable)==null?void 0:a.state)==="hover"||!this.state.activeEmbeddable)&&r>=n.x+n.width/3&&r<=n.x+2*n.width/3&&s>=n.y+n.height/3&&s<=n.y+2*n.height/3}renderEmbeddables(){const n=this.state.zoom.value,i=this.state.width,r=this.state.height,s=this.scene.getNonDeletedElements().filter(o=>lr(o)&&this.embedsValidationStatus.get(o.id)===!0||Il(o));return g(he,{children:s.map(o=>{var p,b,E,y,v,_,I,R,w;const{x:a,y:l}=Os({sceneX:o.x,sceneY:o.y},this.state),c=Nb(o,i,r,this.state,this.scene.getNonDeletedElementsMap()),u=this.initializedEmbeds.has(o.id);if(c&&!u&&this.initializedEmbeds.add(o.id),!(c||u))return null;let f;if(Il(o)){f=null;const T=(((p=o.customData)==null?void 0:p.generationData)??this.magicGenerations.get(o.id))||{status:"error",message:"No generation data",code:"ERR_NO_GENERATION_DATA"};if(T.status==="done"){const A=T.html;f={intrinsicSize:{w:o.width,h:o.height},type:"document",srcdoc:()=>A}}else if(T.status==="pending")f={intrinsicSize:{w:o.width,h:o.height},type:"document",srcdoc:()=>Wg(`
                    <style>
                      html, body {
                        width: 100%;
                        height: 100%;
                        color: ${this.state.theme===xe.DARK?"white":"black"};
                      }
                      body {
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        flex-direction: column;
                        gap: 1rem;
                      }

                      .Spinner {
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        margin-left: auto;
                        margin-right: auto;
                      }

                      .Spinner svg {
                        animation: rotate 1.6s linear infinite;
                        transform-origin: center center;
                        width: 40px;
                        height: 40px;
                      }

                      .Spinner circle {
                        stroke: currentColor;
                        animation: dash 1.6s linear 0s infinite;
                        stroke-linecap: round;
                      }

                      @keyframes rotate {
                        100% {
                          transform: rotate(360deg);
                        }
                      }

                      @keyframes dash {
                        0% {
                          stroke-dasharray: 1, 300;
                          stroke-dashoffset: 0;
                        }
                        50% {
                          stroke-dasharray: 150, 300;
                          stroke-dashoffset: -200;
                        }
                        100% {
                          stroke-dasharray: 1, 300;
                          stroke-dashoffset: -280;
                        }
                      }
                    </style>
                    <div class="Spinner">
                      <svg
                        viewBox="0 0 100 100"
                      >
                        <circle
                          cx="50"
                          cy="50"
                          r="46"
                          stroke-width="8"
                          fill="none"
                          stroke-miter-limit="10"
                        />
                      </svg>
                    </div>
                    <div>Generating...</div>
                  `)};else{let A;T.code==="ERR_GENERATION_INTERRUPTED"?A="Generation was interrupted...":A=T.message||"Generation failed",f={intrinsicSize:{w:o.width,h:o.height},type:"document",srcdoc:()=>Wg(`
                    <style>
                    html, body {
                      height: 100%;
                    }
                      body {
                        display: flex;
                        flex-direction: column;
                        align-items: center;
                        justify-content: center;
                        color: ${$e.red[3]};
                      }
                      h1, h3 {
                        margin-top: 0;
                        margin-bottom: 0.5rem;
                      }
                    </style>
                    <h1>Error!</h1>
                    <h3>${A}</h3>
                  `)}}}else f=Pf(h9(o.link||""));const h=((b=this.state.activeEmbeddable)==null?void 0:b.element)===o&&((E=this.state.activeEmbeddable)==null?void 0:E.state)==="active",m=((y=this.state.activeEmbeddable)==null?void 0:y.element)===o&&((v=this.state.activeEmbeddable)==null?void 0:v.state)==="hover";return g("div",{className:me("excalidraw__embeddable-container",{"is-hovered":m}),style:{transform:c?`translate(${a-this.state.offsetLeft}px, ${l-this.state.offsetTop}px) scale(${n})`:"none",display:c?"block":"none",opacity:dH(o,Ur(o,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,((_=this.state.openDialog)==null?void 0:_.name)==="elementLinkSelector"?$O:1),"--embeddable-radius":`${$s(Math.min(o.width,o.height),o)}px`},children:P("div",{className:"excalidraw__embeddable-container__inner",style:{width:c?`${o.width}px`:0,height:c?`${o.height}px`:0,transform:c?`rotate(${o.angle}rad)`:"none",pointerEvents:h?tu.enabled:tu.disabled},children:[m&&g("div",{className:"excalidraw__embeddable-hint",children:L("buttons.embeddableInteractionButton")}),g("div",{className:"excalidraw__embeddable__outer",style:{padding:`${o.strokeWidth}px`},children:(lr(o)?(R=(I=this.props).renderEmbeddable)==null?void 0:R.call(I,o,this.state):null)??g("iframe",{ref:T=>this.cacheEmbeddableRef(o,T),className:"excalidraw__embeddable",srcDoc:(f==null?void 0:f.type)==="document"?f.srcdoc(this.state.theme):void 0,src:(f==null?void 0:f.type)!=="document"?(f==null?void 0:f.link)??"":void 0,scrolling:"no",referrerPolicy:"no-referrer-when-downgrade",title:"Excalidraw Embedded Content",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sandbox:`${(w=f==null?void 0:f.sandbox)!=null&&w.allowSameOrigin?"allow-same-origin":""} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},o.id)})})}toggleOverscrollBehavior(n){document.documentElement.style.overscrollBehaviorX=n.type==="pointerenter"?"none":"auto"}render(){var d,f,h,m,p,b,E,y;const n=this.scene.getSelectedElements(this.state),{renderTopRightUI:i,renderCustomStats:r}=this.props,s=this.scene.getSceneNonce(),{elementsMap:o,visibleElements:a}=this.renderer.getRenderableElements({sceneNonce:s,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingTextElement:this.state.editingTextElement,newElementId:(d=this.state.newElement)==null?void 0:d.id,pendingImageElementId:this.state.pendingImageElementId});this.visibleElements=a;const l=this.scene.getNonDeletedElementsMap(),c="setPointerCapture"in HTMLElement.prototype?!1:this.state.selectionElement||this.state.newElement||this.state.selectedElementsAreBeingDragged||this.state.resizingElement||this.state.activeTool.type==="laser"&&this.state.cursorButton==="down",u=n[0];return g("div",{className:me("excalidraw excalidraw-container",{"excalidraw--view-mode":this.state.viewModeEnabled||((f=this.state.openDialog)==null?void 0:f.name)==="elementLinkSelector","excalidraw--mobile":this.device.editor.isMobile}),style:{"--ui-pointerEvents":c?tu.disabled:tu.enabled,"--right-sidebar-width":"302px"},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:g(lX.Provider,{value:this,children:g(cX.Provider,{value:this.props,children:g(sw.Provider,{value:this.excalidrawContainerValue,children:g(rw.Provider,{value:this.device,children:g(lw.Provider,{value:this.setAppState,children:g(aw.Provider,{value:this.state,children:P(ow.Provider,{value:this.scene.getNonDeletedElements(),children:[P(cw.Provider,{value:this.actionManager,children:[g(lye,{canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:L0().code,renderTopRightUI:i,renderCustomStats:r,showExitZenModeBtn:typeof((h=this.props)==null?void 0:h.zenModeEnabled)>"u"&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type==="selection"&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,generateLinkForSelection:this.props.generateLinkForSelection,children:this.props.children}),g("div",{className:"excalidraw-textEditorContainer"}),g("div",{className:"excalidraw-contextMenuContainer"}),g("div",{className:"excalidraw-eye-dropper-container"}),g(Bye,{trails:[this.laserTrails,this.eraserTrail]}),n.length===1&&((m=this.state.openDialog)==null?void 0:m.name)!=="elementLinkSelector"&&this.state.showHyperlinkPopup&&g(gUe,{element:u,elementsMap:l,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},u.id),this.props.aiEnabled!==!1&&n.length===1&&WU(u)&&g(ER,{element:u,elementsMap:o,children:g(y7,{title:L("labels.convertToCode"),icon:YF,checked:!1,onChange:()=>this.onMagicFrameGenerate(u,"button")})}),n.length===1&&Il(u)&&((b=(p=u.customData)==null?void 0:p.generationData)==null?void 0:b.status)==="done"&&P(ER,{element:u,elementsMap:o,children:[g(y7,{title:L("labels.copySource"),icon:$m,checked:!1,onChange:()=>this.onIframeSrcCopy(u)}),g(y7,{title:"Enter fullscreen",icon:Jne,checked:!1,onChange:()=>{const v=this.getHTMLIFrameElement(u);if(v)try{v.requestFullscreen(),this.setState({activeEmbeddable:{element:u,state:"active"},selectedElementIds:{[u.id]:!0},newElement:null,selectionElement:null})}catch(_){console.warn(_),this.setState({errorMessage:"Couldn't enter fullscreen"})}}})]}),this.state.toast!==null&&g(uye,{message:this.state.toast.message,onClose:()=>this.setToast(null),duration:this.state.toast.duration,closable:this.state.toast.closable}),this.state.contextMenu&&g(sbe,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:v=>{this.setState({contextMenu:null},()=>{this.focusContainer(),v==null||v()})}}),g(Fye,{canvas:this.canvas,rc:this.rc,elementsMap:o,allElementsMap:l,visibleElements:a,sceneNonce:s,selectionNonce:(E=this.state.selectionElement)==null?void 0:E.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:em(this),canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:this.flowChartCreator.pendingNodes}}),this.state.newElement&&g(r8e,{appState:this.state,scale:window.devicePixelRatio,rc:this.rc,elementsMap:o,allElementsMap:l,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!1,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:null}}),g(Nye,{containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:o,visibleElements:a,allElementsMap:l,selectedElements:n,sceneNonce:s,selectionNonce:(y=this.state.selectionElement)==null?void 0:y.versionNonce,scale:window.devicePixelRatio,appState:this.state,device:this.device,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&g($ye,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames()]}),this.renderEmbeddables()]})})})})})})})})}setPlugins(n){Object.assign(this.plugins,n)}async onMagicFrameGenerate(n,i){var a;const r=(a=this.plugins.diagramToCode)==null?void 0:a.generate;if(!r){this.setState({errorMessage:"No diagram to code plugin found"});return}const s=n_(this.scene.getNonDeletedElements(),n).filter(l=>!WU(l));if(!s.length){i==="button"?(this.setState({errorMessage:"Cannot generate from an empty frame"}),ut("ai","generate (no-children)","d2c")):this.setActiveTool({type:"magicframe"});return}const o=this.insertIframeElement({sceneX:n.x+n.width+30,sceneY:n.y,width:n.width,height:n.height});if(o){this.updateMagicGeneration({frameElement:o,data:{status:"pending"}}),this.setState({selectedElementIds:{[o.id]:!0}}),ut("ai","generate (start)","d2c");try{const{html:l}=await r({frame:n,children:s});if(ut("ai","generate (success)","d2c"),!l.trim()){this.updateMagicGeneration({frameElement:o,data:{status:"error",code:"ERR_OAI",message:"Nothing genereated :("}});return}const c=l.includes("<!DOCTYPE html>")&&l.includes("</html>")?l.slice(l.indexOf("<!DOCTYPE html>"),l.indexOf("</html>")+7):l;this.updateMagicGeneration({frameElement:o,data:{status:"done",html:c}})}catch(l){ut("ai","generate (failed)","d2c"),this.updateMagicGeneration({frameElement:o,data:{status:"error",code:"ERR_OAI",message:l.message||"Unknown error during generation"}})}}}onIframeSrcCopy(n){var i,r;((r=(i=n.customData)==null?void 0:i.generationData)==null?void 0:r.status)==="done"&&(Bc(n.customData.generationData.html),this.setToast({message:"copied to clipboard",closable:!1,duration:1500}))}clearImageShapeCache(n){const i=n??this.files;this.scene.getNonDeletedElements().forEach(r=>{xn(r)&&i[r.fileId]&&(this.imageCache.delete(r.fileId),Gt.delete(r))})}async componentDidMount(){var i;this.unmounted=!1,this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,this.store.onStoreIncrementEmitter.on(r=>{this.history.record(r.elementsChange,r.appStateChange)}),this.scene.onUpdate(this.triggerRender),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),this.refreshViewportBreakpoints(),this.refreshEditorBreakpoints(),O3&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorBreakpoints(),this.updateDOMRect()}),(i=this.resizeObserver)==null||i.observe(this.excalidrawContainerRef.current)),new URLSearchParams(window.location.search.slice(1)).has("web-share-target")?this.restoreFileFromShare():this.updateDOMRect(this.initializeScene),dQ()&&!Vee()&&this.setState({errorMessage:g(gye,{})})}componentWillUnmount(){var n,i;(n=window.launchQueue)==null||n.setConsumer(()=>{}),this.renderer.destroy(),this.scene.destroy(),this.scene=new eo,this.fonts=new Vs(this.scene),this.renderer=new yR(this.scene),this.files={},this.imageCache.clear(),(i=this.resizeObserver)==null||i.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),this.store.onStoreIncrementEmitter.clear(),Gt.destroy(),Ms.destroy(),clearTimeout(bl),Fn.clearCache(),ji.clearCache(),bl=0,document.documentElement.style.overscrollBehaviorX=""}removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(Jt(document,te.KEYDOWN,this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(Jt(this.excalidrawContainerRef.current,te.WHEEL,this.handleWheel,{passive:!1}),Jt(window,te.MESSAGE,this.onWindowMessage,!1),Jt(document,te.POINTER_UP,this.removePointer,{passive:!1}),Jt(document,te.COPY,this.onCopy,{passive:!1}),Jt(document,te.KEYUP,this.onKeyUp,{passive:!0}),Jt(document,te.POINTER_MOVE,this.updateCurrentCursorPosition,{passive:!1}),Jt(document.fonts,"loadingdone",n=>{const i=n.fontfaces;this.fonts.onLoaded(i)},{passive:!1}),Jt(document,te.GESTURE_START,this.onGestureStart,!1),Jt(document,te.GESTURE_CHANGE,this.onGestureChange,!1),Jt(document,te.GESTURE_END,this.onGestureEnd,!1),Jt(window,te.FOCUS,()=>{this.maybeCleanupAfterMissingPointerUp(null),this.triggerRender(!0)},{passive:!1})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(Jt(document,te.FULLSCREENCHANGE,this.onFullscreenChange,{passive:!1}),Jt(document,te.PASTE,this.pasteFromClipboard,{passive:!1}),Jt(document,te.CUT,this.onCut,{passive:!1}),Jt(window,te.RESIZE,this.onResize,!1),Jt(window,te.UNLOAD,this.onUnload,!1),Jt(window,te.BLUR,this.onBlur,!1),Jt(this.excalidrawContainerRef.current,te.WHEEL,this.handleWheel,{passive:!1}),Jt(this.excalidrawContainerRef.current,te.DRAG_OVER,this.disableEvent,!1),Jt(this.excalidrawContainerRef.current,te.DROP,this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(Jt(Tee(this.excalidrawContainerRef.current),te.SCROLL,this.onScroll,{passive:!1})))}componentDidUpdate(n,i){var c,u,d,f,h,m,p,b,E,y;this.updateEmbeddables();const r=this.scene.getElementsIncludingDeleted(),s=this.scene.getElementsMapIncludingDeleted(),o=this.scene.getNonDeletedElementsMap();!this.state.showWelcomeScreen&&!r.length&&this.setState({showWelcomeScreen:!0}),n.UIOptions.dockedSidebarBreakpoint!==this.props.UIOptions.dockedSidebarBreakpoint&&this.refreshEditorBreakpoints(),i.userToFollow&&!this.state.collaborators.has(i.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),(i.zoom.value!==this.state.zoom.value||i.scrollX!==this.state.scrollX||i.scrollY!==this.state.scrollY)&&((u=(c=this.props)==null?void 0:c.onScrollChange)==null||u.call(c,this.state.scrollX,this.state.scrollY,this.state.zoom),this.onScrollChangeEmitter.trigger(this.state.scrollX,this.state.scrollY,this.state.zoom)),i.userToFollow!==this.state.userToFollow&&(i.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:i.userToFollow,action:"UNFOLLOW"}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:"FOLLOW"})),Object.keys(this.state.selectedElementIds).length&&bo(this.state)&&this.setState({activeTool:Sn(this.state,{type:"selection"})}),this.state.activeTool.type==="eraser"&&i.theme!==this.state.theme&&kF(this.interactiveCanvas,this.state.theme),i.activeTool.type==="selection"&&this.state.activeTool.type!=="selection"&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),n.langCode!==this.props.langCode&&this.updateLanguage(),bo(i)&&!bo(this.state)&&this.eraserTrail.endPath(),n.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),i.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),(((d=i.openDialog)==null?void 0:d.name)==="elementLinkSelector"||((f=this.state.openDialog)==null?void 0:f.name)==="elementLinkSelector")&&((h=i.openDialog)==null?void 0:h.name)!==((m=this.state.openDialog)==null?void 0:m.name)&&(this.deselectElements(),this.setState({hoveredElementIds:{}})),n.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),n.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),(p=this.excalidrawContainerRef.current)==null||p.classList.toggle("theme--dark",this.state.theme===xe.DARK),this.state.editingLinearElement&&!this.state.selectedElementIds[this.state.editingLinearElement.elementId]&&setTimeout(()=>{this.state.editingLinearElement&&this.actionManager.executeAction(Ts)}),(b=this.state.editingTextElement)!=null&&b.isDeleted&&this.setState({editingTextElement:null}),this.state.selectedLinearElement&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&this.setState({selectedLinearElement:null});const{multiElement:l}=i;i.activeTool!==this.state.activeTool&&l!=null&&bu(this.state)&&So(l,!1)&&dE(l,this.state,Ps(ue.getPointAtIndexGlobalCoordinates(l,-1,o)),this.scene.getNonDeletedElementsMap(),this.scene.getNonDeletedElements()),this.store.commit(s,this.state),this.state.isLoading||((y=(E=this.props).onChange)==null||y.call(E,r,this.state,this.files),this.onChangeEmitter.trigger(r,this.state,this.files))}static resetTapTwice(){Z1=!1}async addElementsFromMixedContentPaste(n,{isPlainPaste:i,sceneX:r,sceneY:s}){if(!i&&n.some(o=>o.type==="imageUrl")&&this.isToolSupported("image")){const o=n.filter(f=>f.type==="imageUrl").map(f=>f.value),a=await Promise.all(o.map(async f=>{try{return{file:await Dfe(f)}}catch(h){let m=h.message;return h.cause==="FETCH_ERROR"?m=L("errors.failedToFetchImage"):h.cause==="UNSUPPORTED"&&(m=L("errors.unsupportedFileType")),{errorMessage:m}}}));let l=s,c=!1;const u={};for(const f of a)if(f.file){const h=this.createImageElement({sceneX:r,sceneY:l}),m=await this.insertImageElement(h,f.file);m&&(c||(c=!0,l-=m.height/2),ee(m,{y:l},!1),l=h.y+h.height+25,u[h.id]=!0)}this.setState({selectedElementIds:gt(u,this.state)});const d=a.find(f=>!!f.errorMessage);d&&d.errorMessage&&this.setState({errorMessage:d.errorMessage})}else{const o=n.filter(a=>a.type==="text");o.length&&this.addTextFromPaste(o.map(a=>a.value).join(`

`),i)}}addTextFromPaste(n,i=!1){const{x:r,y:s}=Pt({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),o={x:r,y:s,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:n,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:Dm,verticalAlign:K2,locked:!1},a=xt({fontSize:o.fontSize,fontFamily:o.fontFamily}),l=qu(o.fontFamily),[c,,u]=yH(this.state),d=Math.max(Math.min((u-c)*.5,800),200),f=10;let h=s;const m=i?[n]:n.split(`
`),p=m.reduce((b,E,y)=>{var _;const v=bh(E).trim();if(v.length){const I=this.getTopLayerFrameAtSceneCoords({x:r,y:h});let R=zi(v,a,l);const w=R.width>d,T=w?Id(v,a,d):v;R=w?zi(T,a,l):R;const A=r-R.width/2,S=h-R.height/2,k=Br({...o,x:A,y:S,text:T,originalText:v,lineHeight:l,autoResize:!w,frameId:I?I.id:null});b.push(k),h+=k.height+f}else((_=m[y-1])==null?void 0:_.trim())&&(h+=Hm(o.fontSize,l)+f);return b},[]);p.length!==0&&(this.scene.insertElements(p),this.setState({selectedElementIds:gt(Object.fromEntries(p.map(b=>[b.id,!0])),this.state)}),!i&&p.length>1&&SR===!1&&!this.device.editor.isMobile&&(this.setToast({message:L("toast.pasteAsSingleElement",{shortcut:Q("CtrlOrCmd+Shift+V")}),duration:5e3}),SR=!0),this.store.shouldCaptureIncrement())}handleTextWysiwyg(n,{isExistingElement:i=!1}){const r=this.scene.getElementsMapIncludingDeleted(),s=(o,a)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(l=>l.id===n.id&&de(l)?Ce(l,{originalText:o,isDeleted:a??l.isDeleted,...nB(l,ui(l,r),r,o)}):l)])};Jye({id:n.id,canvas:this.canvas,getViewportCoords:(o,a)=>{const{x:l,y:c}=Os({sceneX:o,sceneY:a},this.state);return[l-this.state.offsetLeft,c-this.state.offsetTop]},onChange:en(o=>{s(o,!1),ME(n)&&pr(n,this.scene.getNonDeletedElementsMap())}),onSubmit:en(({viaKeyboard:o,nextOriginalText:a})=>{const l=!a.trim();if(s(a,l),!l&&o){const c=n.containerId?n.containerId:n.id;Xn.flushSync(()=>{this.setState(u=>({selectedElementIds:gt({...u.selectedElementIds,[c]:!0},u)}))})}l&&IB(this.scene.getNonDeletedElements(),[n]),(!l||i)&&this.store.shouldCaptureIncrement(),Xn.flushSync(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&go(this.interactiveCanvas,this.state),this.focusContainer()}),element:n,excalidrawContainer:this.excalidrawContainerRef.current,app:this,autoSelect:!this.device.isTouchScreen}),this.deselectElements(),s(n.originalText,!1)}deselectElements(){this.setState({selectedElementIds:gt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(n,i){const r=this.getElementAtPosition(n,i,{includeBoundTextElement:!0});return r&&de(r)&&!r.isDeleted?r:null}getElementAtPosition(n,i,r){const s=this.getElementsAtPosition(n,i,r==null?void 0:r.includeBoundTextElement,r==null?void 0:r.includeLockedElements);if(s.length>1){if(r!=null&&r.preferSelected){for(let a=s.length-1;a>-1;a--)if(this.state.selectedElementIds[s[a].id])return s[a]}const o=s[s.length-1];return df({x:n,y:i,element:o,shape:ha(o,this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold()/2,frameNameBound:Ie(o)?this.frameNameBoundsCache.get(o):null})?o:s[s.length-2]}return s.length===1?s[0]:null}getElementsAtPosition(n,i,r=!1,s=!1){const o=[],a=this.scene.getNonDeletedElementsMap();return(r&&s?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(c=>(s||!c.locked)&&(r||!(de(c)&&c.containerId)))).filter(c=>this.hitElement(n,i,c)).filter(c=>{const u=Ur(c,a);return u&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?oA({x:n,y:i},u,a):!0}).filter(c=>Il(c)?(o.push(c),!1):!0).concat(o)}getElementHitThreshold(){return UQ/this.state.zoom.value}hitElement(n,i,r,s=!0){if(s&&this.state.selectedElementIds[r.id]&&AH([r],this.state)){const a=dle(r,this.scene.getNonDeletedElementsMap(),st(r)?0:this.getElementHitThreshold());if(pb(C(n,i),a))return!0}return fB(n,i,gB(r,this.scene.getNonDeletedElementsMap()))?!0:df({x:n,y:i,element:r,shape:ha(r,this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold(),frameNameBound:Ie(r)?this.frameNameBoundsCache.get(r):null})}getTextBindableContainerAtPosition(n,i){const r=this.scene.getNonDeletedElements(),s=this.scene.getSelectedElements(this.state);if(s.length===1)return Nu(s[0],!1)?s[0]:null;let o=null;for(let a=r.length-1;a>=0;--a){if(r[a].isDeleted)continue;const[l,c,u,d]=De(r[a],this.scene.getNonDeletedElementsMap());if(Be(r[a])&&df({x:n,y:i,element:r[a],shape:ha(r[a],this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold()})){o=r[a];break}else if(l<n&&n<u&&c<i&&i<d){o=r[a];break}}return Nu(o,!1)?o:null}handleHoverSelectedLinearElement(n,i,r){const s=this.scene.getNonDeletedElementsMap(),o=ue.getElement(n.elementId,s);if(o)if(this.state.selectedLinearElement){let a=-1,l=null;df({x:i,y:r,element:o,shape:ha(o,this.scene.getNonDeletedElementsMap())})?(a=ue.getPointIndexUnderCursor(o,s,this.state.zoom,i,r),l=ue.getSegmentMidpointHitCoords(n,{x:i,y:r},this.state,this.scene.getNonDeletedElementsMap()),(ge(o)?a===0||a===o.points.length-1:a>=0)||l?It(this.interactiveCanvas,Tt.POINTER):this.hitElement(i,r,o)&&It(this.interactiveCanvas,Tt.MOVE)):this.hitElement(i,r,o)&&(!ge(o)||!(o.startBinding||o.endBinding))&&It(this.interactiveCanvas,Tt.MOVE),this.state.selectedLinearElement.hoverPointIndex!==a&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:a}}),ue.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,l)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:l}})}else It(this.interactiveCanvas,Tt.AUTO)}updateGestureOnPointerDown(n){ht.pointers.set(n.pointerId,{x:n.clientX,y:n.clientY}),ht.pointers.size===2&&(ht.lastCenter=zM(ht.pointers),ht.initialScale=this.state.zoom.value,ht.initialDistance=HM(Array.from(ht.pointers.values())))}initialPointerDownState(n){const i=Pt(n,this.state),r=this.scene.getSelectedElements(this.state),[s,o,a,l]=wt(r),c=r.findIndex(ge)===0;return{origin:i,withCmdOrCtrl:n[z.CTRL_OR_CMD],originInGrid:Ps(Rn(i.x,i.y,n[z.CTRL_OR_CMD]||c?null:this.getEffectiveGridSize())),scrollbars:XM(_7,n.clientX-this.state.offsetLeft,n.clientY-this.state.offsetTop),lastCoords:{...i},originalElements:this.scene.getNonDeletedElements().reduce((u,d)=>(u.set(d.id,Cd(d)),u),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:"origin",center:{x:(a+s)/2,y:(l+o)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(i,r)},drag:{hasOccurred:!1,offset:null},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(n,i){if(!(i.scrollbars.isOverEither&&!this.state.multiElement))return!1;v7=!0,i.lastCoords.x=n.clientX,i.lastCoords.y=n.clientY;const r=p7(o=>{o.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(o,i)}),s=en(()=>{qc=null,v7=!1,go(this.interactiveCanvas,this.state),this.setState({cursorButton:"up"}),this.savePointer(n.clientX,n.clientY,"up"),window.removeEventListener(te.POINTER_MOVE,r),window.removeEventListener(te.POINTER_UP,s),r.flush()});return qc=s,window.addEventListener(te.POINTER_MOVE,r),window.addEventListener(te.POINTER_UP,s),!0}isASelectedElement(n){return n!=null&&this.state.selectedElementIds[n.id]}isHittingCommonBoundingBoxOfSelectedElements(n,i){if(i.length<2)return!1;const r=this.getElementHitThreshold(),[s,o,a,l]=wt(i);return n.x>s-r&&n.x<a+r&&n.y>o-r&&n.y<l+r}getCurrentItemRoundness(n){return this.state.currentItemRoundness==="round"?{type:e1(n)?On.ADAPTIVE_RADIUS:On.PROPORTIONAL_RADIUS}:null}maybeCacheReferenceSnapPoints(n,i,r=!1){vc({event:n,app:this,selectedElements:i})&&(r||!Ms.getReferenceSnapPoints())&&Ms.setReferenceSnapPoints(U1e(this.scene.getNonDeletedElements(),i,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(n,i,r=!1){vc({event:n,app:this,selectedElements:i})&&(r||!Ms.getVisibleGaps())&&Ms.setVisibleGaps(p1e(this.scene.getNonDeletedElements(),i,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(n){return en(i=>{this.maybeHandleResize(n,i)||this.maybeDragNewGenericElement(n,i)})}onKeyUpFromPointerDownHandler(n){return en(i=>{i.key===z.ALT&&i.preventDefault(),!this.maybeHandleResize(n,i)&&this.maybeDragNewGenericElement(n,i)})}onPointerMoveFromPointerDownHandler(n){return p7(i=>{var f,h,m,p,b,E;if(((f=this.state.openDialog)==null?void 0:f.name)==="elementLinkSelector")return;const r=Pt(i,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.elbowed&&this.state.selectedLinearElement.pointerDownState.segmentMidpoint.index){const[y,v]=Rn(r.x,r.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize());let _=this.state.selectedLinearElement.pointerDownState.segmentMidpoint.index;if(_<0){const R=ue.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:y,y:v},this.state,this.scene.getNonDeletedElementsMap());_=R?ue.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,R,this.scene.getNonDeletedElementsMap()):-1}const I=ue.moveFixedSegment(this.state.selectedLinearElement,_,y,v,this.scene.getNonDeletedElementsMap());Xn.flushSync(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:I.segmentMidPointHoveredCoords,pointerDownState:I.pointerDownState}})});return}const s=this.lastPointerMoveCoords??n.origin;if(this.lastPointerMoveCoords=r,n.drag.offset===null&&(n.drag.offset=Ps(q1e(this.scene.getSelectedElements(this.state),n.origin.x,n.origin.y))),!(i.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(i,n))return;if(bo(this.state)){this.handleEraser(i,n,r);return}this.state.activeTool.type==="laser"&&this.laserTrails.addPointToPath(r.x,r.y);const[a,l]=Rn(r.x,r.y,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize());if(!n.drag.hasOccurred&&(this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line")&&pt(C(r.x,r.y),C(n.origin.x,n.origin.y))<eu)return;if(n.resize.isResizing&&(n.lastCoords.x=r.x,n.lastCoords.y=r.y,this.maybeHandleCrop(n,i)||this.maybeHandleResize(n,i)))return!0;const c=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){const y=this.state.editingLinearElement||this.state.selectedLinearElement;if(ue.shouldAddMidpoint(this.state.selectedLinearElement,r,this.state,c)){const _=ue.addMidpoint(this.state.selectedLinearElement,r,this,!i[z.CTRL_OR_CMD],c);if(!_)return;Xn.flushSync(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,pointerDownState:_.pointerDownState,selectedPointsIndices:_.selectedPointsIndices}}),this.state.editingLinearElement&&this.setState({editingLinearElement:{...this.state.editingLinearElement,pointerDownState:_.pointerDownState,selectedPointsIndices:_.selectedPointsIndices}})});return}else if(y.pointerDownState.segmentMidpoint.value!==null&&!y.pointerDownState.segmentMidpoint.added)return;if(ue.handlePointDragging(i,this,r.x,r.y,(_,I)=>{this.maybeSuggestBindingsForLinearElementAtCoords(_,I)},y,this.scene)){n.lastCoords.x=r.x,n.lastCoords.y=r.y,n.drag.hasOccurred=!0,this.state.editingLinearElement&&!this.state.editingLinearElement.isDragging&&this.setState({editingLinearElement:{...this.state.editingLinearElement,isDragging:!0}}),this.state.selectedLinearElement.isDragging||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0}});return}}const u=n.hit.allHitElements.some(y=>this.isASelectedElement(y)),d=this.state.editingLinearElement&&i.shiftKey&&this.state.editingLinearElement.elementId===((h=n.hit.element)==null?void 0:h.id);if((u||n.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!d){const y=this.scene.getSelectedElements(this.state);if(y.every(R=>R.locked))return;const v=y.find(R=>Ie(R)),_=this.getTopLayerFrameAtSceneCoords(r),I=_&&!v?_:null;if(this.state.frameToHighlight!==I&&Xn.flushSync(()=>{this.setState({frameToHighlight:I})}),n.drag.hasOccurred=!0,y.length>0&&!n.withCmdOrCtrl&&!this.state.editingTextElement&&((m=this.state.activeEmbeddable)==null?void 0:m.state)!=="active"){const R={x:r.x-n.origin.x,y:r.y-n.origin.y},w=[...n.originalElements.values()],T=i.shiftKey;if(T){const k=Math.abs(R.x),N=Math.abs(R.y),D=T&&k<N,G=T&&k>N;D&&(R.x=0),G&&(R.y=0)}if(this.state.croppingElementId){const k=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(k&&st(k)&&k.crop!==null&&n.hit.element===k){const N=k.crop,D=xn(k)&&((p=this.imageCache.get(k.fileId))==null?void 0:p.image);if(D&&!(D instanceof Promise)){const G=fn(Ui(r.x-s.x,r.y-s.y),Math.max(this.state.zoom.value,2)),[V,H,$,j,X,Y]=De(k,c),le=_e(q(C(V,H),C(X,Y),k.angle)),pe=_e(q(C($,H),C(X,Y),k.angle)),ae=_e(q(C(V,j),C(X,Y),k.angle)),ze=Fi(ob(pe,le)),Xe=Fi(ob(ae,le)),qe=Ui(sx(G,ze),sx(G,Xe)),Ze={...N,x:He(N.x-qe[0]*Math.sign(k.scale[0]),0,D.naturalWidth-N.width),y:He(N.y-qe[1]*Math.sign(k.scale[1]),0,D.naturalHeight-N.height)};ee(k,{crop:Ze});return}}}this.maybeCacheVisibleGaps(i,y),this.maybeCacheReferenceSnapPoints(i,y);const{snapOffset:A,snapLines:S}=b1e(w,R,this,i,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:S}),this.state.editingFrame||K1e(n,y,R,this.scene,A,i[z.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),this.setState({selectedElementsAreBeingDragged:!0,selectionElement:null}),(y.length!==1||!ge(y[0]))&&this.setState({suggestedBindings:T8(y,this.scene.getNonDeletedElementsMap(),this.state.zoom)}),i.altKey&&!n.hit.hasBeenDuplicated){n.hit.hasBeenDuplicated=!0;const k=[],N=[],D=new Map,G=new Map,V=n.hit.element,H=new Set(this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).map(Y=>Y.id)),$=this.scene.getElementsIncludingDeleted();for(const Y of $){const le=H.has(Y.id)||Y.id===(V==null?void 0:V.id)&&n.hit.wasAddedToSelection;if(Math.abs(Y.x)>1e7||Math.abs(Y.x)>1e7||Math.abs(Y.width)>1e7||Math.abs(Y.height)>1e7){console.error("Alt+dragging element in scene with invalid dimensions",Y.x,Y.y,Y.width,Y.height,le);return}if(le){const pe=rB(this.state.editingGroupId,D,Y);if(Math.abs(pe.x)>1e7||Math.abs(pe.x)>1e7||Math.abs(pe.width)>1e7||Math.abs(pe.height)>1e7){console.error("Alt+dragging duplicated element with invalid dimensions",pe.x,pe.y,pe.width,pe.height);return}const ae=n.originalElements.get(Y.id);if(Math.abs(ae.x)>1e7||Math.abs(ae.x)>1e7||Math.abs(ae.width)>1e7||Math.abs(ae.height)>1e7){console.error("Alt+dragging duplicated element with invalid dimensions",ae.x,ae.y,ae.width,ae.height);return}ee(pe,{x:ae.x,y:ae.y}),n.originalElements.set(pe.id,pe),k.push(pe),N.push(Y),G.set(Y.id,pe.id)}else k.push(Y)}let j=[...k,...N];j=((E=(b=this.props).onDuplicate)==null?void 0:E.call(b,j,$))||j,Vo(j,Se(N)),_H(k,N,G),SB(j,N,G,"duplicatesServeAsOld"),nH(j,N,G),this.scene.replaceAllElements(j),this.maybeCacheVisibleGaps(i,y,!0),this.maybeCacheReferenceSnapPoints(i,y,!0)}return}}if(this.state.selectionElement)n.lastCoords.x=r.x,n.lastCoords.y=r.y,this.maybeDragNewGenericElement(n,i);else{const y=this.state.newElement;if(!y)return;if(y.type==="freedraw"){const v=y.points,_=r.x-y.x,I=r.y-y.y,R=v.length>0&&v[v.length-1];if(!(R&&R[0]===_&&R[1]===I)){const T=y.simulatePressure?y.pressures:[...y.pressures,i.pressure];ee(y,{points:[...v,C(_,I)],pressures:T},!1),this.setState({newElement:y})}}else if(ke(y)){n.drag.hasOccurred=!0;const v=y.points;let _=a-y.x,I=l-y.y;jg(i)&&v.length===2&&({width:_,height:I}=CE(y.x,y.y,r.x,r.y)),v.length===1?ee(y,{points:[...v,C(_,I)]},!1):(v.length===2||v.length>1&&ge(y))&&ee(y,{points:[...v.slice(0,-1),C(_,I)]},!1,{isDragging:!0}),this.setState({newElement:y}),So(y,!1)&&this.maybeSuggestBindingsForLinearElementAtCoords(y,[r],this.state.startBoundElement)}else n.lastCoords.x=r.x,n.lastCoords.y=r.y,this.maybeDragNewGenericElement(n,i,!1)}if(this.state.activeTool.type==="selection"){n.boxSelection.hasOccurred=!0;const y=this.scene.getNonDeletedElements();if(this.state.editingLinearElement)ue.handleBoxSelection(i,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let v=!0;!i.shiftKey&&Fn(y,this.state)&&(n.withCmdOrCtrl&&n.hit.element?this.setState(I=>ji({...I,selectedElementIds:{[n.hit.element.id]:!0}},this.scene.getNonDeletedElements(),I,this)):v=!1);const _=this.state.selectionElement?m_(y,this.state.selectionElement,this.scene.getNonDeletedElementsMap(),!1):[];this.setState(I=>{const R={...v&&I.selectedElementIds,..._.reduce((w,T)=>(w[T.id]=!0,w),{})};return n.hit.element&&(_.length?delete R[n.hit.element.id]:R[n.hit.element.id]=!0),I=v?I:{...I,selectedGroupIds:{},editingGroupId:null},{...ji({editingGroupId:I.editingGroupId,selectedElementIds:R},this.scene.getNonDeletedElements(),I,this),selectedLinearElement:_.length===1&&ke(_[0])?new ue(_[0]):null,showHyperlinkPopup:_.length===1&&(_[0].link||lr(_[0]))?"info":!1}})}}})}handlePointerMoveOverScrollbars(n,i){if(i.scrollbars.isOverHorizontal){const r=n.clientX,s=r-i.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-s/this.state.zoom.value}),i.lastCoords.x=r,!0}if(i.scrollbars.isOverVertical){const r=n.clientY,s=r-i.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-s/this.state.zoom.value}),i.lastCoords.y=r,!0}return!1}onPointerUpFromPointerDownHandler(n){return en(i=>{var b,E,y,v,_,I,R,w,T,A,S,k;this.removePointer(i),n.eventListeners.onMove&&n.eventListeners.onMove.flush();const{newElement:r,resizingElement:s,croppingElementId:o,multiElement:a,activeTool:l,isResizing:c,isRotating:u,isCropping:d}=this.state;this.setState(N=>({isResizing:!1,isRotating:!1,isCropping:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:"up",snapLines:z1(N.snapLines,[]),originSnapOffset:null})),this.lastPointerMoveCoords=null,Ms.setReferenceSnapPoints(null),Ms.setVisibleGaps(null),this.savePointer(i.clientX,i.clientY,"up"),this.setState({selectedElementsAreBeingDragged:!1});const f=this.scene.getNonDeletedElementsMap();if(n.drag.hasOccurred&&((E=(b=n.hit)==null?void 0:b.element)!=null&&E.id)){const N=f.get(n.hit.element.id);qs(N)&&((y=N.boundElements)==null||y.filter(D=>D.type==="arrow").map(D=>f.get(D.id)).filter(D=>ge(D)).forEach(D=>{D&&ee(D,{},!0)}))}if(this.state.editingLinearElement)if(!n.boxSelection.hasOccurred&&((_=(v=n.hit)==null?void 0:v.element)==null?void 0:_.id)!==this.state.editingLinearElement.elementId)this.actionManager.executeAction(Ts);else{const N=ue.handlePointerUp(i,this.state.editingLinearElement,this.state,this.scene);N!==this.state.editingLinearElement&&this.setState({editingLinearElement:N,suggestedBindings:[]})}else if(this.state.selectedLinearElement){if(this.state.selectedLinearElement.elbowed){const N=ue.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());N&&ee(N,{},!0)}if(((R=(I=n.hit)==null?void 0:I.element)==null?void 0:R.id)!==this.state.selectedLinearElement.elementId)this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null});else{const N=ue.handlePointerUp(i,this.state.selectedLinearElement,this.state,this.scene),{startBindingElement:D,endBindingElement:G}=N,V=this.scene.getElement(N.elementId);So(V)&&q6(V,D,G,f,this.scene),N!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...N,selectedPointsIndices:null},suggestedBindings:[]})}}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener(te.POINTER_MOVE,n.eventListeners.onMove),window.removeEventListener(te.POINTER_UP,n.eventListeners.onUp),window.removeEventListener(te.KEYDOWN,n.eventListeners.onKeyDown),window.removeEventListener(te.KEYUP,n.eventListeners.onKeyUp),this.state.pendingImageElementId&&this.setState({pendingImageElementId:null}),(T=(w=this.props)==null?void 0:w.onPointerUp)==null||T.call(w,l,n),this.onPointerUpEmitter.trigger(this.state.activeTool,n,i),(r==null?void 0:r.type)==="freedraw"){const N=Pt(i,this.state),D=r.points;let G=N.x-r.x,V=N.y-r.y;G===D[0][0]&&V===D[0][1]&&(V+=1e-4,G+=1e-4);const H=r.simulatePressure?[]:[...r.pressures,i.pressure];ee(r,{points:[...D,C(G,V)],pressures:H,lastCommittedPoint:C(G,V)}),this.actionManager.executeAction(Ts);return}if(st(r)){const N=r;try{this.initializeImageDimensions(N),this.setState({selectedElementIds:gt({[N.id]:!0},this.state)},()=>{this.actionManager.executeAction(Ts)})}catch(D){console.error(D),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().filter(G=>G.id!==N.id)),this.actionManager.executeAction(Ts)}return}if(ke(r)){r.points.length>1&&this.store.shouldCaptureIncrement();const N=Pt(i,this.state);!n.drag.hasOccurred&&r&&!a?(ee(r,{points:[...r.points,C(N.x-r.x,N.y-r.y)]}),this.setState({multiElement:r,newElement:r})):n.drag.hasOccurred&&!a&&(bu(this.state)&&So(r,!1)&&dE(r,this.state,N,this.scene.getNonDeletedElementsMap(),this.scene.getNonDeletedElements()),this.setState({suggestedBindings:[],startBoundElement:null}),l.locked?this.setState(D=>({newElement:null})):(Is(this.interactiveCanvas),this.setState(D=>({newElement:null,activeTool:Sn(this.state,{type:"selection"}),selectedElementIds:gt({...D.selectedElementIds,[r.id]:!0},D),selectedLinearElement:new ue(r)}))),this.scene.triggerUpdate());return}if(de(r)){const N=l9(xt({fontSize:r.fontSize,fontFamily:r.fontFamily}),r.lineHeight);r.width<N&&ee(r,{autoResize:!0}),this.resetCursor(),this.handleTextWysiwyg(r,{isExistingElement:!0})}if(l.type!=="selection"&&r&&od(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(N=>N.id!==r.id),appState:{newElement:null},captureUpdate:Z.NEVER});return}if(Ie(r)){const N=Hhe(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(Qg(this.scene.getElementsMapIncludingDeleted(),N,r,this.state))}if(r&&(ee(r,IH(r)),this.scene.triggerUpdate()),n.drag.hasOccurred){const N=Pt(i,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){const D=this.scene.getElement(this.state.selectedLinearElement.elementId);if(D!=null&&D.frameId){const G=Ur(D,f);G&&D&&(Ec(D,G,this.scene.getNonDeletedElementsMap())||(ee(D,{groupIds:[]}),f5([D],this.scene.getNonDeletedElementsMap()),this.scene.triggerUpdate()))}}else{const D=this.getTopLayerFrameAtSceneCoords(N),G=this.scene.getSelectedElements(this.state);let V=this.scene.getElementsMapIncludingDeleted();const H=$=>{if($.length>0){for(const j of $){const X=j.groupIds.indexOf(this.state.editingGroupId);ee(j,{groupIds:j.groupIds.slice(0,X)},!1)}V.forEach(j=>{j.groupIds.length&&$t(V,j.groupIds[j.groupIds.length-1]).length<2&&ee(j,{groupIds:[]},!1)}),this.setState({editingGroupId:null})}};if(D&&!this.state.selectedElementIds[D.id]){const $=G.filter(j=>j.frameId!==D.id&&kb(j,V,this.state));this.state.editingGroupId&&H($),V=Qg(V,$,D,this.state)}else if(!D&&this.state.editingGroupId){const $=G.filter(j=>j.frameId&&!kb(j,V,this.state));H($)}V=wh(V,this.state,this),this.scene.replaceAllElements(V)}}if(s&&this.store.shouldCaptureIncrement(),s&&od(s)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(N=>N.id!==s.id),captureUpdate:Z.NEVER}),n.resize.isResizing){let N=wh(this.scene.getElementsIncludingDeleted(),this.state,this);const D=this.scene.getSelectedElements(this.state).filter(G=>Ie(G));for(const G of D)N=sH(N,s2(this.scene.getElementsIncludingDeleted(),G,this.state,f),G,this);this.scene.replaceAllElements(N)}const h=n.hit.element;((A=this.state.selectedLinearElement)==null?void 0:A.elementId)!==(h==null?void 0:h.id)&&ke(h)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new ue(h)}),(!o||o&&(!h&&!d||h&&h.id!==o))&&this.finishImageCropping();const m=this.lastPointerDownEvent,p=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(bo(this.state)&&m&&p){if(this.eraserTrail.endPath(),pt(C(m.clientX,m.clientY),C(p.clientX,p.clientY))===0){const D=Pt({clientX:p.clientX,clientY:p.clientY},this.state);this.getElementsAtPosition(D.x,D.y).forEach(V=>this.elementsPendingErasure.add(V.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(h&&!n.drag.hasOccurred&&!n.hit.wasAddedToSelection&&(!this.state.editingLinearElement||!n.boxSelection.hasOccurred)&&(i.shiftKey&&!this.state.editingLinearElement?this.state.selectedElementIds[h.id]?TF(this.state,h)?this.setState(N=>{const D={...N.selectedElementIds};for(const G of h.groupIds.flatMap(V=>$t(this.scene.getNonDeletedElements(),V)))delete D[G.id];return{selectedGroupIds:{...N.selectedElementIds,...h.groupIds.map(G=>({[G]:!1})).reduce((G,V)=>({...G,...V}),{})},selectedElementIds:gt(D,N)}}):(S=this.state.selectedLinearElement)!=null&&S.isDragging||this.setState(N=>{const D={...N.selectedElementIds};delete D[h.id];const G=Fe(this.scene.getNonDeletedElements(),{selectedElementIds:D});return{...ji({editingGroupId:N.editingGroupId,selectedElementIds:D},this.scene.getNonDeletedElements(),N,this),selectedLinearElement:G.length===1&&ke(G[0])?new ue(G[0]):N.selectedLinearElement}}):h.frameId&&this.state.selectedElementIds[h.frameId]?this.setState(N=>{var G;const D={...N.selectedElementIds,[h.id]:!0};return delete D[h.frameId],(((G=this.scene.getElement(h.frameId))==null?void 0:G.groupIds)??[]).flatMap(V=>$t(this.scene.getNonDeletedElements(),V)).forEach(V=>{delete D[V.id]}),{...ji({editingGroupId:N.editingGroupId,selectedElementIds:D},this.scene.getNonDeletedElements(),N,this),showHyperlinkPopup:h.link||lr(h)?"info":!1}}):this.setState(N=>({selectedElementIds:gt({...N.selectedElementIds,[h.id]:!0},N)})):this.setState(N=>{var D;return{...ji({editingGroupId:N.editingGroupId,selectedElementIds:{[h.id]:!0}},this.scene.getNonDeletedElements(),N,this),selectedLinearElement:ke(h)&&((D=N.selectedLinearElement)==null?void 0:D.elementId)!==h.id?new ue(h):N.selectedLinearElement}})),!(h&&ge(h))&&!n.drag.hasOccurred&&!this.state.isResizing&&(h&&xle({x:n.origin.x,y:n.origin.y,element:h,shape:ha(h,this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold(),frameNameBound:Ie(h)?this.frameNameBoundsCache.get(h):null},f)||!h&&n.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.editingLinearElement?this.setState({editingLinearElement:null}):this.setState({selectedElementIds:gt({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),It(this.interactiveCanvas,Tt.AUTO);return}if(!l.locked&&l.type!=="freedraw"&&r&&this.setState(N=>({selectedElementIds:gt({...N.selectedElementIds,[r.id]:!0},N),showHyperlinkPopup:lr(r)&&!r.link?"editor":N.showHyperlinkPopup})),(l.type!=="selection"||Fn(this.scene.getNonDeletedElements(),this.state)||!vi(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.shouldCaptureIncrement(),n.drag.hasOccurred||c||u||d){const N=this.scene.getSelectedElements(this.state).filter(ke);Ub(N,this.scene.getNonDeletedElementsMap(),this.scene.getNonDeletedElements(),this.scene,bu(this.state),((k=this.state.selectedLinearElement)==null?void 0:k.selectedPointsIndices)??[],this.state.zoom)}if(l.type==="laser"){this.laserTrails.endPath();return}!l.locked&&l.type!=="freedraw"?(Is(this.interactiveCanvas),this.setState({newElement:null,suggestedBindings:[],activeTool:Sn(this.state,{type:"selection"})})):this.setState({newElement:null,suggestedBindings:[]}),h&&this.lastPointerUpEvent&&this.lastPointerDownEvent&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<300&&ht.pointers.size<=1&&ts(h)&&this.isIframeLikeElementCenter(h,this.lastPointerUpEvent,n.origin.x,n.origin.y)&&this.handleEmbeddableCenterClick(h)})}clearSelection(n){this.setState(i=>({selectedElementIds:gt({},i),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:i.editingGroupId&&n!=null&&F0(n,i.editingGroupId)?i.editingGroupId:null})),this.setState({selectedElementIds:gt({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds})}getTextWysiwygSnappedToCenterPosition(n,i,r,s){if(s){let o=s.x+s.width/2,a=s.y+s.height/2;const l=j8(s,r,this.scene.getNonDeletedElementsMap());if(l&&(o=l.x,a=l.y),Math.hypot(n-o,i-a)<gQ){const{x:d,y:f}=Os({sceneX:o,sceneY:a},r);return{viewportX:d,viewportY:f,elementCenterX:o,elementCenterY:a}}}}getCanvasOffsets(){var n;if((n=this.excalidrawContainerRef)!=null&&n.current){const i=this.excalidrawContainerRef.current,{left:r,top:s}=i.getBoundingClientRect();return{offsetLeft:r,offsetTop:s}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){const n=H6.find(i=>i.code===this.props.langCode)||Sd;await BP(n),this.setAppState({})}}const s8e=e=>{const{closeOnClickOutside:t=!0}=e,n=jV({className:"excalidraw-modal-container"}),i=M.useRef(document.body.classList.contains("excalidraw-animations-disabled"));if(!n)return null;const r=s=>{s.key===z.ESCAPE&&(s.nativeEvent.stopImmediatePropagation(),s.stopPropagation(),e.onCloseRequest())};return Xn.createPortal(P("div",{className:me("Modal",e.className,{"animations-disabled":i.current}),role:"dialog","aria-modal":"true",onKeyDown:r,"aria-labelledby":e.labelledBy,"data-prevent-outside-click":!0,children:[g("div",{className:"Modal__background",onClick:t?e.onCloseRequest:void 0}),g("div",{className:"Modal__content",style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n)};function o8e(e){if(e&&typeof e=="number")return e;switch(e){case"small":return 550;case"wide":return 1024;case"regular":default:return 800}}const Hr=e=>{const[t,n]=VP(),[i]=M.useState(document.activeElement),{id:r}=qo(),s=Qn().viewport.isMobile;M.useEffect(()=>{if(!t)return;const c=q3(t);setTimeout(()=>{c.length>0&&e.autofocus!==!1&&(c[1]||c[0]).focus()});const u=d=>{if(d.key===z.TAB){const f=q3(t),{activeElement:h}=document,m=f.findIndex(p=>p===h);m===0&&d.shiftKey?(f[f.length-1].focus(),d.preventDefault()):m===f.length-1&&!d.shiftKey&&(f[0].focus(),d.preventDefault())}};return t.addEventListener("keydown",u),()=>t.removeEventListener("keydown",u)},[t,e.autofocus]);const o=zn(),a=z6(F_),l=()=>{o({openMenu:null}),a(!1),i.focus(),e.onCloseRequest()};return g(s8e,{className:me("Dialog",e.className,{"Dialog--fullscreen":s}),labelledBy:"dialog-title",maxWidth:o8e(e.size),onCloseRequest:l,closeOnClickOutside:e.closeOnClickOutside,children:P(Ys,{ref:n,children:[e.title&&g("h2",{id:`${r}-dialog-title`,className:"Dialog__title",children:g("span",{className:"Dialog__titleContent",children:e.title})}),s&&g("button",{className:"Dialog__close",onClick:l,title:L("buttons.close"),"aria-label":L("buttons.close"),type:"button",children:xd}),g("div",{className:"Dialog__content",children:e.children})]})})},dw=({children:e,onClose:t})=>{const[n,i]=M.useState(!!e),{container:r}=qo(),s=se.useCallback(()=>{i(!1),t&&t(),r==null||r.focus()},[t,r]);return g(he,{children:n&&g(Hr,{size:"small",onCloseRequest:s,title:L("errorDialog.title"),children:g("div",{style:{whiteSpace:"pre-wrap"},children:e})})})},Rt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Dt=globalThis,Rd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,zu="9.0.1";function F5(){return B5(Dt),Dt}function B5(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||zu,t[zu]=t[zu]||{}}function z5(e,t,n=Dt){const i=n.__SENTRY__=n.__SENTRY__||{},r=i[zu]=i[zu]||{};return r[e]||(r[e]=t())}const a8e="Sentry Logger ",Kb=["debug","info","warn","error","log","assert","trace"],Zb={};function l1(e){if(!("console"in Dt))return e();const t=Dt.console,n={},i=Object.keys(Zb);i.forEach(r=>{const s=Zb[r];n[r]=t[r],t[r]=s});try{return e()}finally{i.forEach(r=>{t[r]=n[r]})}}function l8e(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Rd?Kb.forEach(n=>{t[n]=(...i)=>{e&&l1(()=>{Dt.console[n](`${a8e}[${n}]:`,...i)})}}):Kb.forEach(n=>{t[n]=()=>{}}),t}const Pe=z5("logger",l8e),dX=50,ud="?",IR=/\(error: (.*)\)/,xR=/captureMessage|captureException/;function fX(...e){const t=e.sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0,r=0)=>{const s=[],o=n.split(`
`);for(let a=i;a<o.length;a++){const l=o[a];if(l.length>1024)continue;const c=IR.test(l)?l.replace(IR,"$1"):l;if(!c.match(/\S*Error: /)){for(const u of t){const d=u(c);if(d){s.push(d);break}}if(s.length>=dX+r)break}}return u8e(s.slice(r))}}function c8e(e){return Array.isArray(e)?fX(...e):e}function u8e(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(pU(t).function||"")&&t.pop(),t.reverse(),xR.test(pU(t).function||"")&&(t.pop(),xR.test(pU(t).function||"")&&t.pop()),t.slice(0,dX).map(n=>({...n,filename:n.filename||pU(t).filename,function:n.function||ud}))}function pU(e){return e[e.length-1]||{}}const T7="<anonymous>";function Ic(e){try{return!e||typeof e!="function"?T7:e.name||T7}catch{return T7}}function CR(e){const t=e.exception;if(t){const n=[];try{return t.values.forEach(i=>{i.stacktrace.frames&&n.push(...i.stacktrace.frames)}),n}catch{return}}}const g2={},AR={};function kd(e,t){g2[e]=g2[e]||[],g2[e].push(t)}function Ld(e,t){if(!AR[e]){AR[e]=!0;try{t()}catch(n){Rd&&Pe.error(`Error while instrumenting ${e}`,n)}}}function Ks(e,t){const n=e&&g2[e];if(n)for(const i of n)try{i(t)}catch(r){Rd&&Pe.error(`Error while triggering instrumentation handler.
Type: ${e}
Name: ${Ic(i)}
Error:`,r)}}let S7=null;function d8e(e){const t="error";kd(t,e),Ld(t,f8e)}function f8e(){S7=Dt.onerror,Dt.onerror=function(e,t,n,i,r){return Ks("error",{column:i,error:r,line:n,msg:e,url:t}),S7?S7.apply(this,arguments):!1},Dt.onerror.__SENTRY_INSTRUMENTED__=!0}let I7=null;function h8e(e){const t="unhandledrejection";kd(t,e),Ld(t,g8e)}function g8e(){I7=Dt.onunhandledrejection,Dt.onunhandledrejection=function(e){return Ks("unhandledrejection",e),I7?I7.apply(this,arguments):!0},Dt.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const hX=Object.prototype.toString;function fw(e){switch(hX.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return dd(e,Error)}}function c1(e,t){return hX.call(e)===`[object ${t}]`}function gX(e){return c1(e,"ErrorEvent")}function MR(e){return c1(e,"DOMError")}function m8e(e){return c1(e,"DOMException")}function Da(e){return c1(e,"String")}function hw(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function gw(e){return e===null||hw(e)||typeof e!="object"&&typeof e!="function"}function kh(e){return c1(e,"Object")}function H5(e){return typeof Event<"u"&&dd(e,Event)}function p8e(e){return typeof Element<"u"&&dd(e,Element)}function U8e(e){return c1(e,"RegExp")}function V5(e){return!!(e!=null&&e.then&&typeof e.then=="function")}function b8e(e){return kh(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function dd(e,t){try{return e instanceof t}catch{return!1}}function mX(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}const mw=Dt,y8e=80;function pX(e,t={}){if(!e)return"<unknown>";try{let n=e;const i=5,r=[];let s=0,o=0;const a=" > ",l=a.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||y8e;for(;n&&s++<i&&(c=E8e(n,u),!(c==="html"||s>1&&o+r.length*l+c.length>=d));)r.push(c),o+=c.length,n=n.parentNode;return r.reverse().join(a)}catch{return"<unknown>"}}function E8e(e,t){const n=e,i=[];if(!(n!=null&&n.tagName))return"";if(mw.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}i.push(n.tagName.toLowerCase());const r=t!=null&&t.length?t.filter(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(r!=null&&r.length)r.forEach(o=>{i.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&i.push(`#${n.id}`);const o=n.className;if(o&&Da(o)){const a=o.split(/\s+/);for(const l of a)i.push(`.${l}`)}}const s=["aria-label","type","name","title","alt"];for(const o of s){const a=n.getAttribute(o);a&&i.push(`[${o}="${a}"]`)}return i.join("")}function pw(){try{return mw.document.location.href}catch{return""}}function v8e(e){if(!mw.HTMLElement)return null;let t=e;const n=5;for(let i=0;i<n;i++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function nh(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function qb(e,t){if(!Array.isArray(e))return"";const n=[];for(let i=0;i<e.length;i++){const r=e[i];try{mX(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function _8e(e,t,n=!1){return Da(e)?U8e(t)?t.test(e):Da(t)?n?e===t:e.includes(t):!1:!1}function $5(e,t=[],n=!1){return t.some(i=>_8e(e,i,n))}function Mr(e,t,n){if(!(t in e))return;const i=e[t],r=n(i);typeof r=="function"&&UX(r,i);try{e[t]=r}catch{Rd&&Pe.log(`Failed to replace method "${t}" in object`,e)}}function fd(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Rd&&Pe.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function UX(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,fd(e,"__sentry_original__",t)}catch{}}function Uw(e){return e.__sentry_original__}function bX(e){if(fw(e))return{message:e.message,name:e.name,stack:e.stack,...kR(e)};if(H5(e)){const t={type:e.type,target:RR(e.target),currentTarget:RR(e.currentTarget),...kR(e)};return typeof CustomEvent<"u"&&dd(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function RR(e){try{return p8e(e)?pX(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function kR(e){if(typeof e=="object"&&e!==null){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function w8e(e,t=40){const n=Object.keys(bX(e));n.sort();const i=n[0];if(!i)return"[object has no keys]";if(i.length>=t)return nh(i,t);for(let r=n.length;r>0;r--){const s=n.slice(0,r).join(", ");if(!(s.length>t))return r===n.length?s:nh(s,t)}return""}function Rr(e){return o4(e,new Map)}function o4(e,t){if(T8e(e)){const n=t.get(e);if(n!==void 0)return n;const i={};t.set(e,i);for(const r of Object.getOwnPropertyNames(e))typeof e[r]<"u"&&(i[r]=o4(e[r],t));return i}if(Array.isArray(e)){const n=t.get(e);if(n!==void 0)return n;const i=[];return t.set(e,i),e.forEach(r=>{i.push(o4(r,t))}),i}return e}function T8e(e){if(!kh(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}const yX=1e3;function np(){return Date.now()/yX}function S8e(){const{performance:e}=Dt;if(!(e!=null&&e.now))return np;const t=Date.now()-e.now(),n=e.timeOrigin==null?t:e.timeOrigin;return()=>(n+e.now())/yX}const Na=S8e();function us(){const e=Dt,t=e.crypto||e.msCrypto;let n=()=>Math.random()*16;try{if(t!=null&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t!=null&&t.getRandomValues&&(n=()=>{const i=new Uint8Array(1);return t.getRandomValues(i),i[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,i=>(i^(n()&15)>>i/4).toString(16))}function EX(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}function xl(e){const{message:t,event_id:n}=e;if(t)return t;const i=EX(e);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||n||"<unknown>":n||"<unknown>"}function a4(e,t,n){const i=e.exception=e.exception||{},r=i.values=i.values||[],s=r[0]=r[0]||{};s.value||(s.value=t||""),s.type||(s.type="Error")}function hd(e,t){const n=EX(e);if(!n)return;const i={type:"generic",handled:!0},r=n.mechanism;if(n.mechanism={...i,...r,...t},t&&"data"in t){const s={...r==null?void 0:r.data,...t.data};n.mechanism.data=s}}function LR(e){if(I8e(e))return!0;try{fd(e,"__sentry_captured__",!0)}catch{}return!1}function I8e(e){try{return e.__sentry_captured__}catch{}}var da;(function(e){e[e.PENDING=0]="PENDING";const n=1;e[e.RESOLVED=n]="RESOLVED";const i=2;e[e.REJECTED=i]="REJECTED"})(da||(da={}));function gd(e){return new xc(t=>{t(e)})}function Qb(e){return new xc((t,n)=>{n(e)})}class xc{constructor(t){this._state=da.PENDING,this._handlers=[],this._runExecutor(t)}then(t,n){return new xc((i,r)=>{this._handlers.push([!1,s=>{if(!t)i(s);else try{i(t(s))}catch(o){r(o)}},s=>{if(!n)r(s);else try{i(n(s))}catch(o){r(o)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new xc((n,i)=>{let r,s;return this.then(o=>{s=!1,r=o,t&&t()},o=>{s=!0,r=o,t&&t()}).then(()=>{if(s){i(r);return}n(r)})})}_executeHandlers(){if(this._state===da.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===da.RESOLVED&&n[1](this._value),this._state===da.REJECTED&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(s,o)=>{if(this._state===da.PENDING){if(V5(o)){o.then(i,r);return}this._state=s,this._value=o,this._executeHandlers()}},i=s=>{n(da.RESOLVED,s)},r=s=>{n(da.REJECTED,s)};try{t(i,r)}catch(s){r(s)}}}function x8e(e){const t=Na(),n={sid:us(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>A8e(n)};return e&&Lh(n,e),n}function Lh(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Na(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:us()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function C8e(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),Lh(e,n)}function A8e(e){return Rr({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}function DR(){return us()}function vX(){return us().substring(16)}function ip(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;const i={...e};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=ip(i[r],t[r],n-1));return i}const l4="_sentrySpan";function NR(e,t){t?fd(e,l4,t):delete e[l4]}function OR(e){return e[l4]}const M8e=100;class Go{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:DR(),sampleRand:Math.random()}}clone(){const t=new Go;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,NR(t,OR(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lh(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t,i=n instanceof Go?n.getScopeData():kh(n)?t:void 0,{tags:r,extra:s,user:o,contexts:a,level:l,fingerprint:c=[],propagationContext:u}=i||{};return this._tags={...this._tags,...r},this._extra={...this._extra,...s},this._contexts={...this._contexts,...a},o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,NR(this,void 0),this._attachments=[],this.setPropagationContext({traceId:DR(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){var s;const i=typeof n=="number"?n:M8e;if(i<=0)return this;const r={timestamp:np(),...t};return this._breadcrumbs.push(r),this._breadcrumbs.length>i&&(this._breadcrumbs=this._breadcrumbs.slice(-i),(s=this._client)==null||s.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:OR(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=ip(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const i=(n==null?void 0:n.event_id)||us();if(!this._client)return Pe.warn("No client configured on scope - will not capture exception!"),i;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:i},this),i}captureMessage(t,n,i){const r=(i==null?void 0:i.event_id)||us();if(!this._client)return Pe.warn("No client configured on scope - will not capture message!"),r;const s=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:s,...i,event_id:r},this),r}captureEvent(t,n){const i=(n==null?void 0:n.event_id)||us();return this._client?(this._client.captureEvent(t,{...n,event_id:i},this),i):(Pe.warn("No client configured on scope - will not capture event!"),i)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function R8e(){return z5("defaultCurrentScope",()=>new Go)}function k8e(){return z5("defaultIsolationScope",()=>new Go)}class L8e{constructor(t,n){let i;t?i=t:i=new Go;let r;n?r=n:r=new Go,this._stack=[{scope:i}],this._isolationScope=r}withScope(t){const n=this._pushScope();let i;try{i=t(n)}catch(r){throw this._popScope(),r}return V5(i)?i.then(r=>(this._popScope(),r),r=>{throw this._popScope(),r}):(this._popScope(),i)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Dh(){const e=F5(),t=B5(e);return t.stack=t.stack||new L8e(R8e(),k8e())}function D8e(e){return Dh().withScope(e)}function N8e(e,t){const n=Dh();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function PR(e){return Dh().withScope(()=>e(Dh().getIsolationScope()))}function O8e(){return{withIsolationScope:PR,withScope:D8e,withSetScope:N8e,withSetIsolationScope:(e,t)=>PR(t),getCurrentScope:()=>Dh().getScope(),getIsolationScope:()=>Dh().getIsolationScope()}}function bw(e){const t=B5(e);return t.acs?t.acs:O8e()}function ul(){const e=F5();return bw(e).getCurrentScope()}function rp(){const e=F5();return bw(e).getIsolationScope()}function P8e(){return z5("globalScope",()=>new Go)}function yw(...e){const t=F5(),n=bw(t);if(e.length===2){const[i,r]=e;return i?n.withSetScope(i,r):n.withScope(r)}return n.withScope(e[0])}function Hi(){return ul().getClient()}function F8e(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:i,propagationSpanId:r}=t;return Rr({trace_id:n,span_id:r||vX(),parent_span_id:i})}const B8e="sentry.source",z8e="sentry.sample_rate",H8e="sentry.op",V8e="sentry.origin",_X="sentry.profile_id",wX="sentry.exclusive_time",$8e=0,G8e=1,X8e="_sentryScope",j8e="_sentryIsolationScope";function TX(e){return{scope:e[X8e],isolationScope:e[j8e]}}function Y8e(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}const W8e="sentry-",K8e=/^sentry-/;function Z8e(e){const t=q8e(e);if(!t)return;const n=Object.entries(t).reduce((i,[r,s])=>{if(r.match(K8e)){const o=r.slice(W8e.length);i[o]=s}return i},{});if(Object.keys(n).length>0)return n}function q8e(e){if(!(!e||!Da(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{const i=FR(n);return Object.entries(i).forEach(([r,s])=>{t[r]=s}),t},{}):FR(e)}function FR(e){return e.split(",").map(t=>t.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((t,[n,i])=>(n&&i&&(t[n]=i),t),{})}const Q8e=1;let BR=!1;function J8e(e){const{spanId:t,traceId:n,isRemote:i}=e.spanContext(),r=i?t:Ew(e).parent_span_id,s=TX(e).scope,o=i?(s==null?void 0:s.getPropagationContext().propagationSpanId)||vX():t;return Rr({parent_span_id:r,span_id:o,trace_id:n})}function zR(e){return typeof e=="number"?HR(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?HR(e.getTime()):Na()}function HR(e){return e>9999999999?e/1e3:e}function Ew(e){if(t7e(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(e7e(e)){const{attributes:i,startTime:r,name:s,endTime:o,parentSpanId:a,status:l}=e;return Rr({span_id:t,trace_id:n,data:i,description:s,parent_span_id:a,start_timestamp:zR(r),timestamp:zR(o)||void 0,status:i7e(l),op:i[H8e],origin:i[V8e]})}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function e7e(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function t7e(e){return typeof e.getSpanJSON=="function"}function n7e(e){const{traceFlags:t}=e.spanContext();return t===Q8e}function i7e(e){if(!(!e||e.code===$8e))return e.code===G8e?"ok":e.message||"unknown_error"}const r7e="_sentryRootSpan";function SX(e){return e[r7e]||e}function VR(){BR||(l1(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),BR=!0)}function s7e(e){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||((n=Hi())==null?void 0:n.getOptions());return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}const vw="production",o7e="_frozenDsc";function IX(e,t){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},r=Rr({environment:n.environment||vw,release:n.release,public_key:i,trace_id:e});return t.emit("createDsc",r),r}function a7e(e,t){const n=t.getPropagationContext();return n.dsc||IX(n.traceId,e)}function l7e(e){var m;const t=Hi();if(!t)return{};const n=SX(e),i=Ew(n),r=i.data,s=n.spanContext().traceState,o=(s==null?void 0:s.get("sentry.sample_rate"))??r[z8e];function a(p){return(typeof o=="number"||typeof o=="string")&&(p.sample_rate=`${o}`),p}const l=n[o7e];if(l)return a(l);const c=s==null?void 0:s.get("sentry.dsc"),u=c&&Z8e(c);if(u)return a(u);const d=IX(e.spanContext().traceId,t),f=r[B8e],h=i.description;return f!=="url"&&h&&(d.transaction=h),s7e()&&(d.sampled=String(n7e(n)),d.sample_rand=(s==null?void 0:s.get("sentry.sample_rand"))??((m=TX(n).scope)==null?void 0:m.getPropagationContext().sampleRand.toString())),a(d),t.emit("createDsc",d,n),d}const c7e=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function u7e(e){return e==="http"||e==="https"}function _w(e,t=!1){const{host:n,path:i,pass:r,port:s,projectId:o,protocol:a,publicKey:l}=e;return`${a}://${l}${t&&r?`:${r}`:""}@${n}${s?`:${s}`:""}/${i&&`${i}/`}${o}`}function d7e(e){const t=c7e.exec(e);if(!t){l1(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,i,r="",s="",o="",a=""]=t.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return xX({host:s,pass:r,path:l,projectId:c,port:o,protocol:n,publicKey:i})}function xX(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function f7e(e){if(!Rd)return!0;const{port:t,projectId:n,protocol:i}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(Pe.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?u7e(i)?t&&isNaN(parseInt(t,10))?(Pe.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(Pe.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),!1):(Pe.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function h7e(e){const t=typeof e=="string"?d7e(e):xX(e);if(!(!t||!f7e(t)))return t}function fa(e,t=100,n=1/0){try{return c4("",e,t,n)}catch(i){return{ERROR:`**non-serializable** (${i})`}}}function CX(e,t=3,n=100*1024){const i=fa(e,t);return U7e(i)>n?CX(e,t-1,n):i}function c4(e,t,n=1/0,i=1/0,r=b7e()){const[s,o]=r;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=g7e(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const l=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(s(t))return"[Circular ~]";const c=t;if(c&&typeof c.toJSON=="function")try{const h=c.toJSON();return c4("",h,l-1,i,r)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const f=bX(t);for(const h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(d>=i){u[h]="[MaxProperties ~]";break}const m=f[h];u[h]=c4(h,m,l-1,i,r),d++}return o(t),u}function g7e(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(mX(t))return"[VueViewModel]";if(b8e(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${Ic(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=m7e(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function m7e(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}function p7e(e){return~-encodeURI(e).split(/%..|./).length}function U7e(e){return p7e(JSON.stringify(e))}function b7e(){const e=new WeakSet;function t(i){return e.has(i)?!0:(e.add(i),!1)}function n(i){e.delete(i)}return[t,n]}function G5(e,t=[]){return[e,t]}function y7e(e,t){const[n,i]=e;return[n,[...i,t]]}function $R(e,t){const n=e[1];for(const i of n){const r=i[0].type;if(t(i,r))return!0}return!1}function u4(e){const t=B5(Dt);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function E7e(e){const[t,n]=e;let i=JSON.stringify(t);function r(s){typeof i=="string"?i=typeof s=="string"?i+s:[u4(i),s]:i.push(typeof s=="string"?u4(s):s)}for(const s of n){const[o,a]=s;if(r(`
${JSON.stringify(o)}
`),typeof a=="string"||a instanceof Uint8Array)r(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(fa(a))}r(l)}}return typeof i=="string"?i:v7e(i)}function v7e(e){const t=e.reduce((r,s)=>r+s.length,0),n=new Uint8Array(t);let i=0;for(const r of e)n.set(r,i),i+=r.length;return n}function _7e(e){const t=typeof e.data=="string"?u4(e.data):e.data;return[Rr({type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),t]}const w7e={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security"};function GR(e){return w7e[e]}function AX(e){if(!(e!=null&&e.sdk))return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function T7e(e,t,n,i){var s;const r=(s=e.sdkProcessingMetadata)==null?void 0:s.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&i&&{dsn:_w(i)},...r&&{trace:Rr({...r})}}}function S7e(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]]),e}function I7e(e,t,n,i){const r=AX(n),s={sent_at:new Date().toISOString(),...r&&{sdk:r},...!!i&&t&&{dsn:_w(t)}},o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return G5(s,[o])}function x7e(e,t,n,i){const r=AX(n),s=e.type&&e.type!=="replay_event"?e.type:"event";S7e(e,n==null?void 0:n.sdk);const o=T7e(e,r,i,t);return delete e.sdkProcessingMetadata,G5(o,[[{type:s},e]])}function d4(e,t,n,i=0){return new xc((r,s)=>{const o=e[i];if(t===null||typeof o!="function")r(t);else{const a=o({...t},n);Rt&&o.id&&a===null&&Pe.log(`Event processor "${o.id}" dropped event`),V5(a)?a.then(l=>d4(e,l,n,i+1).then(r)).then(null,s):d4(e,a,n,i+1).then(r).then(null,s)}})}let UU,XR,bU;function C7e(e){const t=Dt._sentryDebugIds;if(!t)return{};const n=Object.keys(t);return bU&&n.length===XR||(XR=n.length,bU=n.reduce((i,r)=>{UU||(UU={});const s=UU[r];if(s)i[s[0]]=s[1];else{const o=e(r);for(let a=o.length-1;a>=0;a--){const l=o[a],c=l==null?void 0:l.filename,u=t[r];if(c&&u){i[c]=u,UU[r]=[c,u];break}}}return i},{})),bU}function A7e(e,t){const{fingerprint:n,span:i,breadcrumbs:r,sdkProcessingMetadata:s}=t;M7e(e,t),i&&L7e(e,i),D7e(e,n),R7e(e,r),k7e(e,s)}function jR(e,t){const{extra:n,tags:i,user:r,contexts:s,level:o,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:f,transactionName:h,span:m}=t;yU(e,"extra",n),yU(e,"tags",i),yU(e,"user",r),yU(e,"contexts",s),e.sdkProcessingMetadata=ip(e.sdkProcessingMetadata,a,2),o&&(e.level=o),h&&(e.transactionName=h),m&&(e.span=m),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...f}}function yU(e,t,n){e[t]=ip(e[t],n,1)}function M7e(e,t){const{extra:n,tags:i,user:r,contexts:s,level:o,transactionName:a}=t,l=Rr(n);Object.keys(l).length&&(e.extra={...l,...e.extra});const c=Rr(i);Object.keys(c).length&&(e.tags={...c,...e.tags});const u=Rr(r);Object.keys(u).length&&(e.user={...u,...e.user});const d=Rr(s);Object.keys(d).length&&(e.contexts={...d,...e.contexts}),o&&(e.level=o),a&&e.type!=="transaction"&&(e.transaction=a)}function R7e(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function k7e(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function L7e(e,t){e.contexts={trace:J8e(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:l7e(t),...e.sdkProcessingMetadata};const n=SX(t),i=Ew(n).description;i&&!e.transaction&&e.type==="transaction"&&(e.transaction=i)}function D7e(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function N7e(e,t,n,i,r,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,l={...t,event_id:t.event_id||n.event_id||us(),timestamp:t.timestamp||np()},c=n.integrations||e.integrations.map(b=>b.name);O7e(l,e),B7e(l,c),r&&r.emit("applyFrameMetadata",t),t.type===void 0&&P7e(l,e.stackParser);const u=H7e(i,n.captureContext);n.mechanism&&hd(l,n.mechanism);const d=r?r.getEventProcessors():[],f=P8e().getScopeData();if(s){const b=s.getScopeData();jR(f,b)}if(u){const b=u.getScopeData();jR(f,b)}const h=[...n.attachments||[],...f.attachments];h.length&&(n.attachments=h),A7e(l,f);const m=[...d,...f.eventProcessors];return d4(m,l,n).then(b=>(b&&F7e(b),typeof o=="number"&&o>0?z7e(b,o,a):b))}function O7e(e,t){var l,c;const{environment:n,release:i,dist:r,maxValueLength:s=250}=t;e.environment=e.environment||n||vw,!e.release&&i&&(e.release=i),!e.dist&&r&&(e.dist=r),e.message&&(e.message=nh(e.message,s));const o=(c=(l=e.exception)==null?void 0:l.values)==null?void 0:c[0];o!=null&&o.value&&(o.value=nh(o.value,s));const a=e.request;a!=null&&a.url&&(a.url=nh(a.url,s))}function P7e(e,t){var i,r;const n=C7e(t);(r=(i=e.exception)==null?void 0:i.values)==null||r.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.filename&&(l.debug_id=n[l.filename])})})}function F7e(e){var i,r;const t={};if((r=(i=e.exception)==null?void 0:i.values)==null||r.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.debug_id&&(l.abs_path?t[l.abs_path]=l.debug_id:l.filename&&(t[l.filename]=l.debug_id),delete l.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([s,o])=>{n.push({type:"sourcemap",code_file:s,debug_id:o})})}function B7e(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function z7e(e,t,n){var r,s;if(!e)return null;const i={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:fa(o.data,t,n)}}))},...e.user&&{user:fa(e.user,t,n)},...e.contexts&&{contexts:fa(e.contexts,t,n)},...e.extra&&{extra:fa(e.extra,t,n)}};return(r=e.contexts)!=null&&r.trace&&i.contexts&&(i.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(i.contexts.trace.data=fa(e.contexts.trace.data,t,n))),e.spans&&(i.spans=e.spans.map(o=>({...o,...o.data&&{data:fa(o.data,t,n)}}))),(s=e.contexts)!=null&&s.flags&&i.contexts&&(i.contexts.flags=fa(e.contexts.flags,3,n)),i}function H7e(e,t){if(!t)return e;const n=e?e.clone():new Go;return n.update(t),n}function V7e(e){if(e)return $7e(e)?{captureContext:e}:X7e(e)?{captureContext:e}:e}function $7e(e){return e instanceof Go||typeof e=="function"}const G7e=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function X7e(e){return Object.keys(e).some(t=>G7e.includes(t))}function ww(e,t){return ul().captureException(e,V7e(t))}function YR(e,t){const n=typeof t=="string"?t:void 0,i=typeof t!="string"?{captureContext:t}:void 0;return ul().captureMessage(e,n,i)}function MX(e,t){return ul().captureEvent(e,t)}function WR(e){const t=rp(),n=ul(),{userAgent:i}=Dt.navigator||{},r=x8e({user:n.getUser()||t.getUser(),...i&&{userAgent:i},...e}),s=t.getSession();return(s==null?void 0:s.status)==="ok"&&Lh(s,{status:"exited"}),RX(),t.setSession(r),r}function RX(){const e=rp(),n=ul().getSession()||e.getSession();n&&C8e(n),kX(),e.setSession()}function kX(){const e=rp(),t=Hi(),n=e.getSession();n&&t&&t.captureSession(n)}function KR(e=!1){if(e){RX();return}kX()}const j7e="7";function Y7e(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function W7e(e){return`${Y7e(e)}${e.projectId}/envelope/`}function K7e(e,t){const n={sentry_version:j7e};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function Z7e(e,t,n){return t||`${W7e(e)}?${K7e(e,n)}`}const ZR=[];function q7e(e){const t={};return e.forEach(n=>{const{name:i}=n,r=t[i];r&&!r.isDefaultInstance&&n.isDefaultInstance||(t[i]=n)}),Object.values(t)}function Q7e(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(r=>{r.isDefaultInstance=!0});let i;if(Array.isArray(n))i=[...t,...n];else if(typeof n=="function"){const r=n(t);i=Array.isArray(r)?r:[r]}else i=t;return q7e(i)}function J7e(e,t){const n={};return t.forEach(i=>{i&&LX(e,i,n)}),n}function qR(e,t){for(const n of t)n!=null&&n.afterAllSetup&&n.afterAllSetup(e)}function LX(e,t,n){if(n[t.name]){Rt&&Pe.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,ZR.indexOf(t.name)===-1&&typeof t.setupOnce=="function"&&(t.setupOnce(),ZR.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const i=t.preprocessEvent.bind(t);e.on("preprocessEvent",(r,s)=>i(r,s,e))}if(typeof t.processEvent=="function"){const i=t.processEvent.bind(t),r=Object.assign((s,o)=>i(s,o,e),{id:t.name});e.addEventProcessor(r)}Rt&&Pe.log(`Integration installed: ${t.name}`)}function e3e(e,t,n){const i=[{type:"client_report"},{timestamp:np(),discarded_events:e}];return G5(t?{dsn:t}:{},[i])}class Ls extends Error{constructor(t,n="warn"){super(t),this.message=t,this.logLevel=n}}function DX(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n!=null&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function t3e(e){var l;const{trace_id:t,parent_span_id:n,span_id:i,status:r,origin:s,data:o,op:a}=((l=e.contexts)==null?void 0:l.trace)??{};return Rr({data:o??{},description:e.transaction,op:a,parent_span_id:n,span_id:i??"",start_timestamp:e.start_timestamp??0,status:r,timestamp:e.timestamp,trace_id:t??"",origin:s,profile_id:o==null?void 0:o[_X],exclusive_time:o==null?void 0:o[wX],measurements:e.measurements,is_segment:!0})}function n3e(e){const t={type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[_X]:e.profile_id},...e.exclusive_time&&{[wX]:e.exclusive_time}}}},measurements:e.measurements};return Rr(t)}const QR="Not capturing exception because it's already been captured.",JR="Discarded session because of missing or non-string release";class i3e{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=h7e(t.dsn):Rt&&Pe.warn("No DSN provided, client will not send events."),this._dsn){const n=Z7e(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:n})}}captureException(t,n,i){const r=us();if(LR(t))return Rt&&Pe.log(QR),r;const s={event_id:r,...n};return this._process(this.eventFromException(t,s).then(o=>this._captureEvent(o,s,i))),s.event_id}captureMessage(t,n,i,r){const s={event_id:us(),...i},o=hw(t)?t:String(t),a=gw(t)?this.eventFromMessage(o,n,s):this.eventFromException(t,s);return this._process(a.then(l=>this._captureEvent(l,s,r))),s.event_id}captureEvent(t,n,i){const r=us();if(n!=null&&n.originalException&&LR(n.originalException))return Rt&&Pe.log(QR),r;const s={event_id:r,...n},o=t.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope;return this._process(this._captureEvent(t,s,a||i,l)),s.event_id}captureSession(t){this.sendSession(t),Lh(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(t).then(i=>n.flush(t).then(r=>i&&r))):gd(!0)}close(t){return this.flush(t).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const n=this._integrations[t.name];LX(this,t,this._integrations),n||qR(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let i=x7e(t,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])i=y7e(i,_7e(s));const r=this.sendEnvelope(i);r&&r.then(s=>this.emit("afterSendEvent",t,s),null)}sendSession(t){const{release:n,environment:i=vw}=this._options;if("aggregates"in t){const s=t.attrs||{};if(!s.release&&!n){Rt&&Pe.warn(JR);return}s.release=s.release||n,s.environment=s.environment||i,t.attrs=s}else{if(!t.release&&!n){Rt&&Pe.warn(JR);return}t.release=t.release||n,t.environment=t.environment||i}this.emit("beforeSendSession",t);const r=I7e(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(t,n,i=1){if(this._options.sendClientReports){const r=`${t}:${n}`;Rt&&Pe.log(`Recording outcome: "${r}"${i>1?` (${i} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+i}}on(t,n){const i=this._hooks[t]=this._hooks[t]||[];return i.push(n),()=>{const r=i.indexOf(n);r>-1&&i.splice(r,1)}}emit(t,...n){const i=this._hooks[t];i&&i.forEach(r=>r(...n))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,n=>(Rt&&Pe.error("Error while sending envelope:",n),n)):(Rt&&Pe.error("Transport disabled"),gd({}))}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=J7e(this,t),qR(this,t)}_updateSessionFromEvent(t,n){var l;let i=n.level==="fatal",r=!1;const s=(l=n.exception)==null?void 0:l.values;if(s){r=!0;for(const c of s){const u=c.mechanism;if((u==null?void 0:u.handled)===!1){i=!0;break}}}const o=t.status==="ok";(o&&t.errors===0||o&&i)&&(Lh(t,{...i&&{status:"crashed"},errors:t.errors||Number(r||i)}),this.captureSession(t))}_isClientDoneProcessing(t){return new xc(n=>{let i=0;const r=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),n(!0)):(i+=r,t&&i>=t&&(clearInterval(s),n(!1)))},r)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,i,r){const s=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&(o!=null&&o.length)&&(n.integrations=o),this.emit("preprocessEvent",t,n),t.type||r.setLastEventId(t.event_id||n.event_id),N7e(s,t,n,i,this,r).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:F8e(i),...a.contexts};const l=a7e(this,i);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(t,n={},i=ul(),r=rp()){return Rt&&f4(t)&&Pe.log(`Captured error event \`${DX(t)[0]||"<unknown>"}\``),this._processEvent(t,n,i,r).then(s=>s.event_id,s=>{Rt&&(s instanceof Ls&&s.logLevel==="log"?Pe.log(s.message):Pe.warn(s))})}_processEvent(t,n,i,r){const s=this.getOptions(),{sampleRate:o}=s,a=NX(t),l=f4(t),c=t.type||"error",u=`before send for type \`${c}\``,d=typeof o>"u"?void 0:Y8e(o);if(l&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error"),Qb(new Ls(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const f=c==="replay_event"?"replay":c;return this._prepareEvent(t,n,i,r).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",f),new Ls("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return h;const p=s3e(this,s,h,n);return r3e(p,u)}).then(h=>{var b;if(h===null){if(this.recordDroppedEvent("before_send",f),a){const y=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",y)}throw new Ls(`${u} returned \`null\`, will not send event.`,"log")}const m=i.getSession()||r.getSession();if(l&&m&&this._updateSessionFromEvent(m,h),a){const E=((b=h.sdkProcessingMetadata)==null?void 0:b.spanCountBeforeProcessing)||0,y=h.spans?h.spans.length:0,v=E-y;v>0&&this.recordDroppedEvent("before_send","span",v)}const p=h.transaction_info;if(a&&p&&h.transaction!==t.transaction){const E="custom";h.transaction_info={...p,source:E}}return this.sendEvent(h,n),h}).then(null,h=>{throw h instanceof Ls?h:(this.captureException(h,{data:{__sentry__:!0},originalException:h}),new Ls(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
Reason: ${h}`))})}_process(t){this._numProcessing++,t.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,i])=>{const[r,s]=n.split(":");return{reason:r,category:s,quantity:i}})}_flushOutcomes(){Rt&&Pe.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){Rt&&Pe.log("No outcomes to send");return}if(!this._dsn){Rt&&Pe.log("No dsn provided, will not send outcomes");return}Rt&&Pe.log("Sending outcomes:",t);const n=e3e(t,this._options.tunnel&&_w(this._dsn));this.sendEnvelope(n)}}function r3e(e,t){const n=`${t} must return \`null\` or a valid event.`;if(V5(e))return e.then(i=>{if(!kh(i)&&i!==null)throw new Ls(n);return i},i=>{throw new Ls(`${t} rejected with ${i}`)});if(!kh(e)&&e!==null)throw new Ls(n);return e}function s3e(e,t,n,i){const{beforeSend:r,beforeSendTransaction:s,beforeSendSpan:o}=t;let a=n;if(f4(a)&&r)return r(a,i);if(NX(a)){if(o){const l=o(t3e(a));if(l?a=ip(n,n3e(l)):VR(),a.spans){const c=[];for(const u of a.spans){const d=o(u);d?c.push(d):(VR(),c.push(u))}a.spans=c}}if(s){if(a.spans){const l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(a,i)}}return a}function f4(e){return e.type===void 0}function NX(e){return e.type==="transaction"}function o3e(e,t){t.debug===!0&&(Rt?Pe.enable():l1(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),ul().update(t.initialScope);const i=new e(t);return a3e(i),i.init(),i}function a3e(e){ul().setClient(e)}function l3e(e){const t=[];function n(){return e===void 0||t.length<e}function i(o){return t.splice(t.indexOf(o),1)[0]||Promise.resolve(void 0)}function r(o){if(!n())return Qb(new Ls("Not adding Promise because buffer limit was reached."));const a=o();return t.indexOf(a)===-1&&t.push(a),a.then(()=>i(a)).then(null,()=>i(a).then(null,()=>{})),a}function s(o){return new xc((a,l)=>{let c=t.length;if(!c)return a(!0);const u=setTimeout(()=>{o&&o>0&&a(!1)},o);t.forEach(d=>{gd(d).then(()=>{--c||(clearTimeout(u),a(!0))},l)})})}return{$:t,add:r,drain:s}}const c3e=60*1e3;function u3e(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const i=Date.parse(`${e}`);return isNaN(i)?c3e:i-t}function d3e(e,t){return e[t]||e.all||0}function f3e(e,t,n=Date.now()){return d3e(e,t)>n}function h3e(e,{statusCode:t,headers:n},i=Date.now()){const r={...e},s=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(s)for(const a of s.trim().split(",")){const[l,c,,,u]=a.split(":",5),d=parseInt(l,10),f=(isNaN(d)?60:d)*1e3;if(!c)r.all=i+f;else for(const h of c.split(";"))h==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(r[h]=i+f):r[h]=i+f}else o?r.all=i+u3e(o,i):t===429&&(r.all=i+60*1e3);return r}const g3e=64;function m3e(e,t,n=l3e(e.bufferSize||g3e)){let i={};const r=o=>n.drain(o);function s(o){const a=[];if($R(o,(d,f)=>{const h=GR(f);f3e(i,h)?e.recordDroppedEvent("ratelimit_backoff",h):a.push(d)}),a.length===0)return gd({});const l=G5(o[0],a),c=d=>{$R(l,(f,h)=>{e.recordDroppedEvent(d,GR(h))})},u=()=>t({body:E7e(l)}).then(d=>(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&Rt&&Pe.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),i=h3e(i,d),d),d=>{throw c("network_error"),d});return n.add(u).then(d=>d,d=>{if(d instanceof Ls)return Rt&&Pe.error("Skipped sending event because buffer is full."),c("queue_overflow"),gd({});throw d})}return{send:s,flush:r}}function p3e(e){var t;((t=e.user)==null?void 0:t.ip_address)===void 0&&(e.user={...e.user,ip_address:"{{auto}}"})}function U3e(e){var t;"aggregates"in e?((t=e.attrs)==null?void 0:t.ip_address)===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function b3e(e,t,n=[t],i="npm"){const r=e._metadata||{};r.sdk||(r.sdk={name:`sentry.javascript.${t}`,packages:n.map(s=>({name:`${i}:@sentry/${s}`,version:zu})),version:zu}),e._metadata=r}const y3e=100;function md(e,t){const n=Hi(),i=rp();if(!n)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:s=y3e}=n.getOptions();if(s<=0)return;const a={timestamp:np(),...e},l=r?l1(()=>r(a,t)):a;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),i.addBreadcrumb(l,s))}let ek;const E3e="FunctionToString",tk=new WeakMap,v3e=()=>({name:E3e,setupOnce(){ek=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Uw(this),n=tk.has(Hi())&&t!==void 0?t:this;return ek.apply(n,e)}}catch{}},setup(e){tk.set(e,!0)}}),_3e=v3e,w3e=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/],T3e="InboundFilters",S3e=(e={})=>({name:T3e,processEvent(t,n,i){const r=i.getOptions(),s=x3e(e,r);return C3e(t,s)?null:t}}),I3e=S3e;function x3e(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:w3e],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]],ignoreInternal:e.ignoreInternal!==void 0?e.ignoreInternal:!0}}function C3e(e,t){return t.ignoreInternal&&L3e(e)?(Rt&&Pe.warn(`Event dropped due to being internal Sentry Error.
Event: ${xl(e)}`),!0):A3e(e,t.ignoreErrors)?(Rt&&Pe.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
Event: ${xl(e)}`),!0):N3e(e)?(Rt&&Pe.warn(`Event dropped due to not having an error message, error type or stacktrace.
Event: ${xl(e)}`),!0):M3e(e,t.ignoreTransactions)?(Rt&&Pe.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
Event: ${xl(e)}`),!0):R3e(e,t.denyUrls)?(Rt&&Pe.warn(`Event dropped due to being matched by \`denyUrls\` option.
Event: ${xl(e)}.
Url: ${Jb(e)}`),!0):k3e(e,t.allowUrls)?!1:(Rt&&Pe.warn(`Event dropped due to not being matched by \`allowUrls\` option.
Event: ${xl(e)}.
Url: ${Jb(e)}`),!0)}function A3e(e,t){return e.type||!t||!t.length?!1:DX(e).some(n=>$5(n,t))}function M3e(e,t){if(e.type!=="transaction"||!t||!t.length)return!1;const n=e.transaction;return n?$5(n,t):!1}function R3e(e,t){if(!(t!=null&&t.length))return!1;const n=Jb(e);return n?$5(n,t):!1}function k3e(e,t){if(!(t!=null&&t.length))return!0;const n=Jb(e);return n?$5(n,t):!0}function L3e(e){try{return e.exception.values[0].type==="SentryError"}catch{}return!1}function D3e(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Jb(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?D3e(t):null}catch{return Rt&&Pe.error(`Cannot extract url for event ${xl(e)}`),null}}function N3e(e){var t,n;return e.type||!((n=(t=e.exception)==null?void 0:t.values)!=null&&n.length)?!1:!e.message&&!e.exception.values.some(i=>i.stacktrace||i.type&&i.type!=="Error"||i.value)}function O3e(e,t,n=250,i,r,s,o){var l;if(!((l=s.exception)!=null&&l.values)||!o||!dd(o.originalException,Error))return;const a=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;a&&(s.exception.values=P3e(h4(e,t,r,o.originalException,i,s.exception.values,a,0),n))}function h4(e,t,n,i,r,s,o,a){if(s.length>=n+1)return s;let l=[...s];if(dd(i[r],Error)){nk(o,a);const c=e(t,i[r]),u=l.length;ik(c,r,u,a),l=h4(e,t,n,i[r],r,[c,...l],c,u)}return Array.isArray(i.errors)&&i.errors.forEach((c,u)=>{if(dd(c,Error)){nk(o,a);const d=e(t,c),f=l.length;ik(d,`errors[${u}]`,f,a),l=h4(e,t,n,c,r,[d,...l],d,f)}}),l}function nk(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function ik(e,t,n,i){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:i}}function P3e(e,t){return e.map(n=>(n.value&&(n.value=nh(n.value,t)),n))}function OX(e){const t="console";kd(t,e),Ld(t,F3e)}function F3e(){"console"in Dt&&Kb.forEach(function(e){e in Dt.console&&Mr(Dt.console,e,function(t){return Zb[e]=t,function(...n){Ks("console",{args:n,level:e});const r=Zb[e];r==null||r.apply(Dt.console,n)}})})}function PX(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const B3e="CaptureConsole",z3e=(e={})=>{const t=e.levels||Kb,n=e.handled??!0;return{name:B3e,setup(i){"console"in Dt&&OX(({args:r,level:s})=>{Hi()!==i||!t.includes(s)||V3e(r,s,n)})}}},H3e=z3e;function V3e(e,t,n){const i={level:PX(t),extra:{arguments:e}};yw(r=>{if(r.addEventProcessor(a=>(a.logger="console",hd(a,{handled:n,type:"console"}),a)),t==="assert"){if(!e[0]){const a=`Assertion failed: ${qb(e.slice(1)," ")||"console.assert"}`;r.setExtra("arguments",e.slice(1)),YR(a,i)}return}const s=e.find(a=>a instanceof Error);if(s){ww(s,i);return}const o=qb(e," ");YR(o,i)})}const $3e="Dedupe",G3e=()=>{let e;return{name:$3e,processEvent(t){if(t.type)return t;try{if(j3e(t,e))return Rt&&Pe.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}},X3e=G3e;function j3e(e,t){return t?!!(Y3e(e,t)||W3e(e,t)):!1}function Y3e(e,t){const n=e.message,i=t.message;return!(!n&&!i||n&&!i||!n&&i||n!==i||!BX(e,t)||!FX(e,t))}function W3e(e,t){const n=rk(t),i=rk(e);return!(!n||!i||n.type!==i.type||n.value!==i.value||!BX(e,t)||!FX(e,t))}function FX(e,t){let n=CR(e),i=CR(t);if(!n&&!i)return!0;if(n&&!i||!n&&i||(n=n,i=i,i.length!==n.length))return!1;for(let r=0;r<i.length;r++){const s=i[r],o=n[r];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function BX(e,t){let n=e.fingerprint,i=t.fingerprint;if(!n&&!i)return!0;if(n&&!i||!n&&i)return!1;n=n,i=i;try{return n.join("")===i.join("")}catch{return!1}}function rk(e){var t;return((t=e.exception)==null?void 0:t.values)&&e.exception.values[0]}function x7(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",i=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:i,relative:t[5]+n+i}}function zX(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const e6=Dt;function K3e(){return"history"in e6}function HX(){if(!("fetch"in e6))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function g4(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Z3e(){var n;if(typeof EdgeRuntime=="string")return!0;if(!HX())return!1;if(g4(e6.fetch))return!0;let e=!1;const t=e6.document;if(t&&typeof t.createElement=="function")try{const i=t.createElement("iframe");i.hidden=!0,t.head.appendChild(i),(n=i.contentWindow)!=null&&n.fetch&&(e=g4(i.contentWindow.fetch)),t.head.removeChild(i)}catch(i){Rd&&Pe.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return e}function q3e(e,t){const n="fetch";kd(n,e),Ld(n,()=>Q3e(void 0,t))}function Q3e(e,t=!1){t&&!Z3e()||Mr(Dt,"fetch",function(n){return function(...i){const r=new Error,{method:s,url:o}=J3e(i),a={args:i,fetchData:{method:s,url:o},startTimestamp:Na()*1e3,virtualError:r};return Ks("fetch",{...a}),n.apply(Dt,i).then(async l=>(Ks("fetch",{...a,endTimestamp:Na()*1e3,response:l}),l),l=>{throw Ks("fetch",{...a,endTimestamp:Na()*1e3,error:l}),fw(l)&&l.stack===void 0&&(l.stack=r.stack,fd(l,"framesToPop",1)),l})}})}function m4(e,t){return!!e&&typeof e=="object"&&!!e[t]}function sk(e){return typeof e=="string"?e:e?m4(e,"url")?e.url:e.toString?e.toString():"":""}function J3e(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,i]=e;return{url:sk(n),method:m4(i,"method")?String(i.method).toUpperCase():"GET"}}const t=e[0];return{url:sk(t),method:m4(t,"method")?String(t.method).toUpperCase():"GET"}}function eEe(){return"npm"}const Cn=Dt;let p4=0;function VX(){return p4>0}function tEe(){p4++,setTimeout(()=>{p4--})}function Nh(e,t={}){function n(r){return typeof r=="function"}if(!n(e))return e;try{const r=e.__sentry_wrapped__;if(r)return typeof r=="function"?r:e;if(Uw(e))return e}catch{return e}const i=function(...r){try{const s=r.map(o=>Nh(o,t));return e.apply(this,s)}catch(s){throw tEe(),yw(o=>{o.addEventProcessor(a=>(t.mechanism&&(a4(a,void 0),hd(a,t.mechanism)),a.extra={...a.extra,arguments:r},a)),ww(s)}),s}};try{for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=e[r])}catch{}UX(i,e),fd(e,"__sentry_wrapped__",i);try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get(){return e.name}})}catch{}return i}function Tw(e,t){const n=Sw(e,t),i={type:oEe(t),value:aEe(t)};return n.length&&(i.stacktrace={frames:n}),i.type===void 0&&i.value===""&&(i.value="Unrecoverable error caught"),i}function nEe(e,t,n,i){const r=Hi(),s=r==null?void 0:r.getOptions().normalizeDepth,o=fEe(t),a={__serialized__:CX(t,s)};if(o)return{exception:{values:[Tw(e,o)]},extra:a};const l={exception:{values:[{type:H5(t)?t.constructor.name:i?"UnhandledRejection":"Error",value:uEe(t,{isUnhandledRejection:i})}]},extra:a};if(n){const c=Sw(e,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function C7(e,t){return{exception:{values:[Tw(e,t)]}}}function Sw(e,t){const n=t.stacktrace||t.stack||"",i=rEe(t),r=sEe(t);try{return e(n,i,r)}catch{}return[]}const iEe=/Minified React error #\d+;/i;function rEe(e){return e&&iEe.test(e.message)?1:0}function sEe(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function $X(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function oEe(e){const t=e==null?void 0:e.name;return!t&&$X(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function aEe(e){const t=e==null?void 0:e.message;return $X(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function lEe(e,t,n,i){const r=(n==null?void 0:n.syntheticException)||void 0,s=Iw(e,t,r,i);return hd(s),s.level="error",n!=null&&n.event_id&&(s.event_id=n.event_id),gd(s)}function cEe(e,t,n="info",i,r){const s=(i==null?void 0:i.syntheticException)||void 0,o=U4(e,t,s,r);return o.level=n,i!=null&&i.event_id&&(o.event_id=i.event_id),gd(o)}function Iw(e,t,n,i,r){let s;if(gX(t)&&t.error)return C7(e,t.error);if(MR(t)||m8e(t)){const o=t;if("stack"in t)s=C7(e,t);else{const a=o.name||(MR(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;s=U4(e,l,n,i),a4(s,l)}return"code"in o&&(s.tags={...s.tags,"DOMException.code":`${o.code}`}),s}return fw(t)?C7(e,t):kh(t)||H5(t)?(s=nEe(e,t,n,r),hd(s,{synthetic:!0}),s):(s=U4(e,t,n,i),a4(s,`${t}`),hd(s,{synthetic:!0}),s)}function U4(e,t,n,i){const r={};if(i&&n){const s=Sw(e,n);s.length&&(r.exception={values:[{value:t,stacktrace:{frames:s}}]}),hd(r,{synthetic:!0})}if(hw(t)){const{__sentry_template_string__:s,__sentry_template_values__:o}=t;return r.logentry={message:s,params:o},r}return r.message=t,r}function uEe(e,{isUnhandledRejection:t}){const n=w8e(e),i=t?"promise rejection":"exception";return gX(e)?`Event \`ErrorEvent\` captured as ${i} with message \`${e.message}\``:H5(e)?`Event \`${dEe(e)}\` (type=${e.type}) captured as ${i}`:`Object captured as ${i} with keys: ${n}`}function dEe(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function fEe(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class hEe extends i3e{constructor(t){const n={parentSpanIsAlwaysRootSpan:!0,...t},i=Cn.SENTRY_SDK_SOURCE||eEe();b3e(n,"browser",["browser"],i),super(n),n.sendClientReports&&Cn.document&&Cn.document.addEventListener("visibilitychange",()=>{Cn.document.visibilityState==="hidden"&&this._flushOutcomes()}),this._options.sendDefaultPii&&(this.on("postprocessEvent",p3e),this.on("beforeSendSession",U3e))}eventFromException(t,n){return lEe(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",i){return cEe(this._options.stackParser,t,n,i,this._options.attachStacktrace)}_prepareEvent(t,n,i,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,i,r)}}const gEe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,mr=Dt,mEe=1e3;let ok,b4,y4;function pEe(e){const t="dom";kd(t,e),Ld(t,UEe)}function UEe(){if(!mr.document)return;const e=Ks.bind(null,"dom"),t=ak(e,!0);mr.document.addEventListener("click",t,!1),mr.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{var s,o;const r=(s=mr[n])==null?void 0:s.prototype;(o=r==null?void 0:r.hasOwnProperty)!=null&&o.call(r,"addEventListener")&&(Mr(r,"addEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},f=d[l]=d[l]||{refCount:0};if(!f.handler){const h=ak(e);f.handler=h,a.call(this,l,h,u)}f.refCount++}catch{}return a.call(this,l,c,u)}}),Mr(r,"removeEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__||{},f=d[l];f&&(f.refCount--,f.refCount<=0&&(a.call(this,l,f.handler,u),f.handler=void 0,delete d[l]),Object.keys(d).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,c,u)}}))})}function bEe(e){if(e.type!==b4)return!1;try{if(!e.target||e.target._sentryId!==y4)return!1}catch{}return!0}function yEe(e,t){return e!=="keypress"?!1:t!=null&&t.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function ak(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const i=EEe(n);if(yEe(n.type,i))return;fd(n,"_sentryCaptured",!0),i&&!i._sentryId&&fd(i,"_sentryId",us());const r=n.type==="keypress"?"input":n.type;bEe(n)||(e({event:n,name:r,global:t}),b4=n.type,y4=i?i._sentryId:void 0),clearTimeout(ok),ok=mr.setTimeout(()=>{y4=void 0,b4=void 0},mEe)}}function EEe(e){try{return e.target}catch{return null}}let EU;function GX(e){const t="history";kd(t,e),Ld(t,vEe)}function vEe(){if(mr.addEventListener("popstate",()=>{const t=mr.location.href,n=EU;if(EU=t,n===t)return;Ks("history",{from:n,to:t})}),!K3e())return;function e(t){return function(...n){const i=n.length>2?n[2]:void 0;if(i){const r=EU,s=String(i);if(EU=s,r===s)return;Ks("history",{from:r,to:s})}return t.apply(this,n)}}Mr(mr.history,"pushState",e),Mr(mr.history,"replaceState",e)}const m2={};function _Ee(e){const t=m2[e];if(t)return t;let n=mr[e];if(g4(n))return m2[e]=n.bind(mr);const i=mr.document;if(i&&typeof i.createElement=="function")try{const r=i.createElement("iframe");r.hidden=!0,i.head.appendChild(r);const s=r.contentWindow;s!=null&&s[e]&&(n=s[e]),i.head.removeChild(r)}catch(r){gEe&&Pe.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,r)}return n&&(m2[e]=n.bind(mr))}function lk(e){m2[e]=void 0}const yg="__sentry_xhr_v3__";function wEe(e){const t="xhr";kd(t,e),Ld(t,TEe)}function TEe(){if(!mr.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,i){const r=new Error,s=Na()*1e3,o=Da(i[0])?i[0].toUpperCase():void 0,a=SEe(i[1]);if(!o||!a)return t.apply(n,i);n[yg]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[yg];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const u={endTimestamp:Na()*1e3,startTimestamp:s,xhr:n,virtualError:r};Ks("xhr",u)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,d){return l(),c.apply(u,d)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,d){const[f,h]=d,m=u[yg];return m&&Da(f)&&Da(h)&&(m.request_headers[f.toLowerCase()]=h),c.apply(u,d)}}),t.apply(n,i)}}),e.send=new Proxy(e.send,{apply(t,n,i){const r=n[yg];if(!r)return t.apply(n,i);i[0]!==void 0&&(r.body=i[0]);const s={startTimestamp:Na()*1e3,xhr:n};return Ks("xhr",s),t.apply(n,i)}})}function SEe(e){if(Da(e))return e;try{return e.toString()}catch{}}function IEe(e,t=_Ee("fetch")){let n=0,i=0;function r(s){const o=s.body.length;n+=o,i++;const a={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&i<15,...e.fetchOptions};if(!t)return lk("fetch"),Qb("No fetch implementation available");try{return t(e.url,a).then(l=>(n-=o,i--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return lk("fetch"),n-=o,i--,Qb(l)}}return m3e(e,r)}const xEe=30,CEe=50;function E4(e,t,n,i){const r={filename:e,function:t==="<anonymous>"?ud:t,in_app:!0};return n!==void 0&&(r.lineno=n),i!==void 0&&(r.colno=i),r}const AEe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,MEe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,REe=/\((\S*)(?::(\d+))(?::(\d+))\)/,kEe=e=>{const t=AEe.exec(e);if(t){const[,i,r,s]=t;return E4(i,ud,+r,+s)}const n=MEe.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=REe.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[r,s]=XX(n[1]||ud,n[2]);return E4(s,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},LEe=[xEe,kEe],DEe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,NEe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,OEe=e=>{const t=DEe.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const s=NEe.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}let i=t[3],r=t[1]||ud;return[r,i]=XX(r,i),E4(i,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},PEe=[CEe,OEe],FEe=[LEe,PEe],BEe=fX(...FEe),XX=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:ud,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},um=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,vU=1024,zEe="Breadcrumbs",HEe=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:zEe,setup(n){t.console&&OX(XEe(n)),t.dom&&pEe(GEe(n,t.dom)),t.xhr&&wEe(jEe(n)),t.fetch&&q3e(YEe(n)),t.history&&GX(WEe(n)),t.sentry&&n.on("beforeSendEvent",$Ee(n))}}},VEe=HEe;function $Ee(e){return function(n){Hi()===e&&md({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:xl(n)},{event:n})}}function GEe(e,t){return function(i){if(Hi()!==e)return;let r,s,o=typeof t=="object"?t.serializeAttribute:void 0,a=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;a&&a>vU&&(um&&Pe.warn(`\`dom.maxStringLength\` cannot exceed ${vU}, but a value of ${a} was configured. Sentry will use ${vU} instead.`),a=vU),typeof o=="string"&&(o=[o]);try{const c=i.event,u=KEe(c)?c.target:c;r=pX(u,{keyAttrs:o,maxStringLength:a}),s=v8e(u)}catch{r="<unknown>"}if(r.length===0)return;const l={category:`ui.${i.name}`,message:r};s&&(l.data={"ui.component_name":s}),md(l,{event:i.event,name:i.name,global:i.global})}}function XEe(e){return function(n){if(Hi()!==e)return;const i={category:"console",data:{arguments:n.args,logger:"console"},level:PX(n.level),message:qb(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)i.message=`Assertion failed: ${qb(n.args.slice(1)," ")||"console.assert"}`,i.data.arguments=n.args.slice(1);else return;md(i,{input:n.args,level:n.level})}}function jEe(e){return function(n){if(Hi()!==e)return;const{startTimestamp:i,endTimestamp:r}=n,s=n.xhr[yg];if(!i||!r||!s)return;const{method:o,url:a,status_code:l,body:c}=s,u={method:o,url:a,status_code:l},d={xhr:n.xhr,input:c,startTimestamp:i,endTimestamp:r},f=zX(l);md({category:"xhr",data:u,type:"http",level:f},d)}}function YEe(e){return function(n){if(Hi()!==e)return;const{startTimestamp:i,endTimestamp:r}=n;if(!r||n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST")return;const s={method:n.fetchData.method,url:n.fetchData.url};if(n.error){const o={data:n.error,input:n.args,startTimestamp:i,endTimestamp:r};md({category:"fetch",data:s,level:"error",type:"http"},o)}else{const o=n.response;s.request_body_size=n.fetchData.request_body_size,s.response_body_size=n.fetchData.response_body_size,s.status_code=o==null?void 0:o.status;const a={input:n.args,response:o,startTimestamp:i,endTimestamp:r},l=zX(s.status_code);md({category:"fetch",data:s,type:"http",level:l},a)}}}function WEe(e){return function(n){if(Hi()!==e)return;let i=n.from,r=n.to;const s=x7(Cn.location.href);let o=i?x7(i):void 0;const a=x7(r);o!=null&&o.path||(o=s),s.protocol===a.protocol&&s.host===a.host&&(r=a.relative),s.protocol===o.protocol&&s.host===o.host&&(i=o.relative),md({category:"navigation",data:{from:i,to:r}})}}function KEe(e){return!!e&&!!e.target}const ZEe=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],qEe="BrowserApiErrors",QEe=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:qEe,setupOnce(){t.setTimeout&&Mr(Cn,"setTimeout",ck),t.setInterval&&Mr(Cn,"setInterval",ck),t.requestAnimationFrame&&Mr(Cn,"requestAnimationFrame",e4e),t.XMLHttpRequest&&"XMLHttpRequest"in Cn&&Mr(XMLHttpRequest.prototype,"send",t4e);const n=t.eventTarget;n&&(Array.isArray(n)?n:ZEe).forEach(n4e)}}},JEe=QEe;function ck(e){return function(...t){const n=t[0];return t[0]=Nh(n,{mechanism:{data:{function:Ic(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function e4e(e){return function(t){return e.apply(this,[Nh(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Ic(e)},handled:!1,type:"instrument"}})])}}function t4e(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&Mr(n,r,function(s){const o={mechanism:{data:{function:r,handler:Ic(s)},handled:!1,type:"instrument"}},a=Uw(s);return a&&(o.mechanism.data.handler=Ic(a)),Nh(s,o)})}),e.apply(this,t)}}function n4e(e){var i,r;const n=(i=Cn[e])==null?void 0:i.prototype;(r=n==null?void 0:n.hasOwnProperty)!=null&&r.call(n,"addEventListener")&&(Mr(n,"addEventListener",function(s){return function(o,a,l){try{i4e(a)&&(a.handleEvent=Nh(a.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Ic(a),target:e},handled:!1,type:"instrument"}}))}catch{}return s.apply(this,[o,Nh(a,{mechanism:{data:{function:"addEventListener",handler:Ic(a),target:e},handled:!1,type:"instrument"}}),l])}}),Mr(n,"removeEventListener",function(s){return function(o,a,l){try{const c=a.__sentry_wrapped__;c&&s.call(this,o,c,l)}catch{}return s.call(this,o,a,l)}}))}function i4e(e){return typeof e.handleEvent=="function"}const r4e=()=>({name:"BrowserSession",setupOnce(){if(typeof Cn.document>"u"){um&&Pe.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}WR({ignoreDuration:!0}),KR(),GX(({from:e,to:t})=>{e!==void 0&&e!==t&&(WR({ignoreDuration:!0}),KR())})}}),s4e="GlobalHandlers",o4e=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:s4e,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(l4e(n),uk("onerror")),t.onunhandledrejection&&(c4e(n),uk("onunhandledrejection"))}}},a4e=o4e;function l4e(e){d8e(t=>{const{stackParser:n,attachStacktrace:i}=jX();if(Hi()!==e||VX())return;const{msg:r,url:s,line:o,column:a,error:l}=t,c=f4e(Iw(n,l||r,void 0,i,!1),s,o,a);c.level="error",MX(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function c4e(e){h8e(t=>{const{stackParser:n,attachStacktrace:i}=jX();if(Hi()!==e||VX())return;const r=u4e(t),s=gw(r)?d4e(r):Iw(n,r,void 0,i,!0);s.level="error",MX(s,{originalException:r,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function u4e(e){if(gw(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function d4e(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function f4e(e,t,n,i){const r=e.exception=e.exception||{},s=r.values=r.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],c=i,u=n,d=Da(t)&&t.length>0?t:pw();return l.length===0&&l.push({colno:c,filename:d,function:ud,in_app:!0,lineno:u}),e}function uk(e){um&&Pe.log(`Global Handler attached: ${e}`)}function jX(){const e=Hi();return(e==null?void 0:e.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const h4e=()=>({name:"HttpContext",preprocessEvent(e){var o,a;if(!Cn.navigator&&!Cn.location&&!Cn.document)return;const t=((o=e.request)==null?void 0:o.url)||pw(),{referrer:n}=Cn.document||{},{userAgent:i}=Cn.navigator||{},r={...(a=e.request)==null?void 0:a.headers,...n&&{Referer:n},...i&&{"User-Agent":i}},s={...e.request,...t&&{url:t},headers:r};e.request=s}}),g4e="cause",m4e=5,p4e="LinkedErrors",U4e=(e={})=>{const t=e.limit||m4e,n=e.key||g4e;return{name:p4e,preprocessEvent(i,r,s){const o=s.getOptions();O3e(Tw,o.stackParser,o.maxValueLength,n,t,i,r)}}},b4e=U4e;function y4e(e){return[I3e(),_3e(),JEe(),VEe(),a4e(),b4e(),X3e(),h4e(),r4e()]}function E4e(e={}){var n;return{...{defaultIntegrations:y4e(),release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(n=Cn.SENTRY_RELEASE)==null?void 0:n.id,sendClientReports:!0},...v4e(e)}}function v4e(e){const t={};for(const n of Object.getOwnPropertyNames(e)){const i=n;e[i]!==void 0&&(t[i]=e[i])}return t}function _4e(){var l;const e=typeof Cn.window<"u"&&Cn;if(!e)return!1;const t=e.chrome?"chrome":"browser",n=e[t],i=(l=n==null?void 0:n.runtime)==null?void 0:l.id,r=pw()||"",s=["chrome-extension:","moz-extension:","ms-browser-extension:","safari-web-extension:"],o=!!i&&Cn===Cn.top&&s.some(c=>r.startsWith(`${c}//`)),a=typeof e.nw<"u";return!!i&&!o&&!a}function w4e(e={}){const t=E4e(e);if(!t.skipBrowserExtensionCheck&&_4e()){um&&l1(()=>{console.error("[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")});return}um&&!HX()&&Pe.warn("No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.");const n={...t,stackParser:c8e(t.stackParser||BEe),integrations:Q7e(t),transport:t.transport||IEe};return o3e(hEe,n)}class T4e extends se.Component{constructor(){super(...arguments);F(this,"state",{hasError:!1,sentryEventId:"",localStorage:""})}render(){return this.state.hasError?this.errorSplash():this.props.children}componentDidCatch(n,i){const r={};for(const[s,o]of Object.entries({...localStorage}))try{r[s]=JSON.parse(o)}catch{r[s]=o}yw(s=>{s.setExtras(i);const o=ww(n);this.setState(a=>({hasError:!0,sentryEventId:o,localStorage:JSON.stringify(r)}))})}selectTextArea(n){n.target!==document.activeElement&&(n.preventDefault(),n.target.select())}async createGithubIssue(){let n="";try{const i=(await be(()=>import("./bug-issue-template-BID_ABWq.js"),__vite__mapDeps([]))).default;n=encodeURIComponent(i(this.state.sentryEventId))}catch(i){console.error(i)}window.open(`https://github.com/excalidraw/excalidraw/issues/new?body=${n}`,"_blank","noopener noreferrer")}errorSplash(){return g("div",{className:"ErrorSplash excalidraw",children:P("div",{className:"ErrorSplash-messageContainer",children:[g("div",{className:"ErrorSplash-paragraph bigger align-center",children:g(gr,{i18nKey:"errorSplash.headingMain",button:n=>g("button",{onClick:()=>window.location.reload(),children:n})})}),P("div",{className:"ErrorSplash-paragraph align-center",children:[g(gr,{i18nKey:"errorSplash.clearCanvasMessage",button:n=>g("button",{onClick:()=>{try{localStorage.clear(),window.location.reload()}catch(i){console.error(i)}},children:n})}),g("br",{}),P("div",{className:"smaller",children:[g("span",{role:"img","aria-label":"warning",children:"⚠️"}),L("errorSplash.clearCanvasCaveat"),g("span",{role:"img","aria-hidden":"true",children:"⚠️"})]})]}),P("div",{children:[g("div",{className:"ErrorSplash-paragraph",children:L("errorSplash.trackedToSentry",{eventId:this.state.sentryEventId})}),g("div",{className:"ErrorSplash-paragraph",children:g(gr,{i18nKey:"errorSplash.openIssueMessage",button:n=>g("button",{onClick:()=>this.createGithubIssue(),children:n})})}),g("div",{className:"ErrorSplash-paragraph",children:P("div",{className:"ErrorSplash-details",children:[g("label",{children:L("errorSplash.sceneContent")}),g("textarea",{rows:5,onPointerDown:this.selectTextArea,readOnly:!0,value:this.state.localStorage})]})})]})]})})}}const S4e=300,I4e=5e3,x4e=300,C4e=500,dk=2e4,A4e=50,M4e=33,R4e=24*60*60*1e3,xw=3*1024*1024,k4e=31536e3,p2={SERVER_VOLATILE:"server-volatile-broadcast",SERVER:"server-broadcast",USER_FOLLOW_CHANGE:"user-follow",USER_FOLLOW_ROOM_CHANGE:"user-follow-room-change"};var Yi=(e=>(e.INVALID_RESPONSE="INVALID_RESPONSE",e.INIT="SCENE_INIT",e.UPDATE="SCENE_UPDATE",e.MOUSE_LOCATION="MOUSE_LOCATION",e.IDLE_STATUS="IDLE_STATUS",e.USER_VISIBLE_SCENE_BOUNDS="USER_VISIBLE_SCENE_BOUNDS",e))(Yi||{});const YX={shareLinkFiles:"/files/shareLinks",collabFiles:"/files/rooms"},L4e=10,vn={LOCAL_STORAGE_ELEMENTS:"excalidraw",LOCAL_STORAGE_APP_STATE:"excalidraw-state",LOCAL_STORAGE_COLLAB:"excalidraw-collab",LOCAL_STORAGE_THEME:"kj-diagramming-theme",LOCAL_STORAGE_DEBUG:"excalidraw-debug",VERSION_DATA_STATE:"version-dataState",VERSION_FILES:"version-files",IDB_LIBRARY:"excalidraw-library",__LEGACY_LOCAL_STORAGE_LIBRARY:"excalidraw-library"},D4e={AUTH_STATE_COOKIE:"excplus-auth"},pd=document.cookie.includes(D4e.AUTH_STATE_COOKIE);class WX{constructor({getFiles:t,saveFiles:n}){F(this,"fetchingFiles",new Map);F(this,"erroredFiles_fetch",new Map);F(this,"savingFiles",new Map);F(this,"savedFiles",new Map);F(this,"erroredFiles_save",new Map);F(this,"_getFiles");F(this,"_saveFiles");F(this,"isFileTracked",t=>this.savedFiles.has(t)||this.savingFiles.has(t)||this.fetchingFiles.has(t)||this.erroredFiles_fetch.has(t)||this.erroredFiles_save.has(t));F(this,"isFileSavedOrBeingSaved",t=>{const n=this.getFileVersion(t);return this.savedFiles.get(t.id)===n||this.savingFiles.get(t.id)===n});F(this,"getFileVersion",t=>t.version??1);F(this,"saveFiles",async({elements:t,files:n})=>{const i=new Map;for(const r of t){const s=xn(r)&&n[r.fileId];s&&!this.isFileSavedOrBeingSaved(s)&&(i.set(r.fileId,n[r.fileId]),this.savingFiles.set(r.fileId,this.getFileVersion(s)))}try{const{savedFiles:r,erroredFiles:s}=await this._saveFiles({addedFiles:i});for(const[o,a]of r)this.savedFiles.set(o,this.getFileVersion(a));for(const[o,a]of s)this.erroredFiles_save.set(o,this.getFileVersion(a));return{savedFiles:r,erroredFiles:s}}finally{for(const[r]of i)this.savingFiles.delete(r)}});F(this,"getFiles",async t=>{if(!t.length)return{loadedFiles:[],erroredFiles:new Map};for(const n of t)this.fetchingFiles.set(n,!0);try{const{loadedFiles:n,erroredFiles:i}=await this._getFiles(t);for(const r of n)this.savedFiles.set(r.id,this.getFileVersion(r));for(const[r]of i)this.erroredFiles_fetch.set(r,!0);return{loadedFiles:n,erroredFiles:i}}finally{for(const n of t)this.fetchingFiles.delete(n)}});F(this,"shouldPreventUnload",t=>t.some(n=>xn(n)&&!n.isDeleted&&this.savingFiles.has(n.fileId)));F(this,"shouldUpdateImageElementStatus",t=>xn(t)&&this.savedFiles.has(t.fileId)&&t.status==="pending");this._getFiles=t,this._saveFiles=n}reset(){this.fetchingFiles.clear(),this.savingFiles.clear(),this.savedFiles.clear(),this.erroredFiles_fetch.clear(),this.erroredFiles_save.clear()}}const Cw=async({files:e,maxBytes:t,encryptionKey:n})=>{const i=[];for(const[r,s]of e){const o=new TextEncoder().encode(s.dataURL),a=await yz(o,{encryptionKey:n,metadata:{id:r,mimeType:s.mimeType,created:Date.now(),lastRetrieved:Date.now()}});if(o.byteLength>t)throw new Error(L("errors.fileTooBig",{maxSize:`${Math.trunc(t/1024/1024)}MB`}));i.push({id:r,buffer:a})}return i},Eg=e=>{e.erroredFiles.size&&e.excalidrawAPI.updateScene({elements:e.excalidrawAPI.getSceneElementsIncludingDeleted().map(t=>xn(t)&&e.erroredFiles.has(t.fileId)?Ce(t,{status:"error"}):t),captureUpdate:Z.NEVER})};var fk={};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const KX=function(e){const t=[];let n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=r&63|128):(r&64512)===55296&&i+1<e.length&&(e.charCodeAt(i+1)&64512)===56320?(r=65536+((r&1023)<<10)+(e.charCodeAt(++i)&1023),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=r&63|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=r&63|128)}return t},N4e=function(e){const t=[];let n=0,i=0;for(;n<e.length;){const r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=e[n++];t[i++]=String.fromCharCode((r&31)<<6|s&63)}else if(r>239&&r<365){const s=e[n++],o=e[n++],a=e[n++],l=((r&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;t[i++]=String.fromCharCode(55296+(l>>10)),t[i++]=String.fromCharCode(56320+(l&1023))}else{const s=e[n++],o=e[n++];t[i++]=String.fromCharCode((r&15)<<12|(s&63)<<6|o&63)}}return t.join("")},ZX={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<e.length;r+=3){const s=e[r],o=r+1<e.length,a=o?e[r+1]:0,l=r+2<e.length,c=l?e[r+2]:0,u=s>>2,d=(s&3)<<4|a>>4;let f=(a&15)<<2|c>>6,h=c&63;l||(h=64,o||(f=64)),i.push(n[u],n[d],n[f],n[h])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(KX(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):N4e(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<e.length;){const s=n[e.charAt(r++)],a=r<e.length?n[e.charAt(r)]:0;++r;const c=r<e.length?n[e.charAt(r)]:64;++r;const d=r<e.length?n[e.charAt(r)]:64;if(++r,s==null||a==null||c==null||d==null)throw new O4e;const f=s<<2|a>>4;if(i.push(f),c!==64){const h=a<<4&240|c>>2;if(i.push(h),d!==64){const m=c<<6&192|d;i.push(m)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class O4e extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const P4e=function(e){const t=KX(e);return ZX.encodeByteArray(t,!0)},t6=function(e){return P4e(e).replace(/\./g,"")},F4e=function(e){try{return ZX.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function B4e(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const z4e=()=>B4e().__FIREBASE_DEFAULTS__,H4e=()=>{if(typeof process>"u"||typeof fk>"u")return;const e=fk.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},V4e=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&F4e(e[1]);return t&&JSON.parse(t)},Aw=()=>{try{return z4e()||H4e()||V4e()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},$4e=e=>{var t,n;return(n=(t=Aw())===null||t===void 0?void 0:t.emulatorHosts)===null||n===void 0?void 0:n[e]},qX=e=>{const t=$4e(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const i=parseInt(t.substring(n+1),10);return t[0]==="["?[t.substring(1,n-1),i]:[t.substring(0,n),i]},QX=()=>{var e;return(e=Aw())===null||e===void 0?void 0:e.config};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class G4e{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,i)=>{n?this.reject(n):this.resolve(i),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,i))}}}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function JX(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},i=t||"demo-project",r=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${i}`,aud:i,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e);return[t6(JSON.stringify(n)),t6(JSON.stringify(o)),""].join(".")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function X4e(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function j4e(){var e;const t=(e=Aw())===null||e===void 0?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function Y4e(){return!j4e()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function W4e(){try{return typeof indexedDB=="object"}catch{return!1}}function K4e(){return new Promise((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var s;t(((s=r.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){t(n)}})}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Z4e="FirebaseError";class Dd extends Error{constructor(t,n,i){super(n),this.code=t,this.customData=i,this.name=Z4e,Object.setPrototypeOf(this,Dd.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ej.prototype.create)}}class ej{constructor(t,n,i){this.service=t,this.serviceName=n,this.errors=i}create(t,...n){const i=n[0]||{},r=`${this.service}/${t}`,s=this.errors[t],o=s?q4e(s,i):"Error",a=`${this.serviceName}: ${o} (${r}).`;return new Dd(r,a,i)}}function q4e(e,t){return e.replace(Q4e,(n,i)=>{const r=t[i];return r!=null?String(r):`<${i}?>`})}const Q4e=/\{\$([^}]+)}/g;function v4(e,t){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);for(const r of n){if(!i.includes(r))return!1;const s=e[r],o=t[r];if(hk(s)&&hk(o)){if(!v4(s,o))return!1}else if(s!==o)return!1}for(const r of i)if(!n.includes(r))return!1;return!0}function hk(e){return e!==null&&typeof e=="object"}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function io(e){return e&&e._delegate?e._delegate:e}class Oh{constructor(t,n,i){this.name=t,this.instanceFactory=n,this.type=i,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const ru="[DEFAULT]";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class J4e{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const i=new G4e;if(this.instancesDeferred.set(n,i),this.isInitialized(n)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:n});r&&i.resolve(r)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(t){var n;const i=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),r=(n=t==null?void 0:t.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(i)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:i})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(tve(t))try{this.getOrInitializeService({instanceIdentifier:ru})}catch{}for(const[n,i]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:r});i.resolve(s)}catch{}}}}clearInstance(t=ru){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...t.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=ru){return this.instances.has(t)}getOptions(t=ru){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,i=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:i,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);i===a&&o.resolve(r)}return r}onInit(t,n){var i;const r=this.normalizeInstanceIdentifier(n),s=(i=this.onInitCallbacks.get(r))!==null&&i!==void 0?i:new Set;s.add(t),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&t(o,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const i=this.onInitCallbacks.get(n);if(i)for(const r of i)try{r(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let i=this.instances.get(t);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:eve(t),options:n}),this.instances.set(t,i),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(i,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,i)}catch{}return i||null}normalizeInstanceIdentifier(t=ru){return this.component?this.component.multipleInstances?t:ru:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function eve(e){return e===ru?void 0:e}function tve(e){return e.instantiationMode==="EAGER"}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nve{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new J4e(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ct;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(ct||(ct={}));const ive={debug:ct.DEBUG,verbose:ct.VERBOSE,info:ct.INFO,warn:ct.WARN,error:ct.ERROR,silent:ct.SILENT},rve=ct.INFO,sve={[ct.DEBUG]:"log",[ct.VERBOSE]:"log",[ct.INFO]:"info",[ct.WARN]:"warn",[ct.ERROR]:"error"},ove=(e,t,...n)=>{if(t<e.logLevel)return;const i=new Date().toISOString(),r=sve[t];if(r)console[r](`[${i}]  ${e.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class tj{constructor(t){this.name=t,this._logLevel=rve,this._logHandler=ove,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in ct))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?ive[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,ct.DEBUG,...t),this._logHandler(this,ct.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,ct.VERBOSE,...t),this._logHandler(this,ct.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,ct.INFO,...t),this._logHandler(this,ct.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,ct.WARN,...t),this._logHandler(this,ct.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,ct.ERROR,...t),this._logHandler(this,ct.ERROR,...t)}}const ave=(e,t)=>t.some(n=>e instanceof n);let gk,mk;function lve(){return gk||(gk=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function cve(){return mk||(mk=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const nj=new WeakMap,_4=new WeakMap,ij=new WeakMap,A7=new WeakMap,Mw=new WeakMap;function uve(e){const t=new Promise((n,i)=>{const r=()=>{e.removeEventListener("success",s),e.removeEventListener("error",o)},s=()=>{n(oc(e.result)),r()},o=()=>{i(e.error),r()};e.addEventListener("success",s),e.addEventListener("error",o)});return t.then(n=>{n instanceof IDBCursor&&nj.set(n,e)}).catch(()=>{}),Mw.set(t,e),t}function dve(e){if(_4.has(e))return;const t=new Promise((n,i)=>{const r=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",o),e.removeEventListener("abort",o)},s=()=>{n(),r()},o=()=>{i(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",s),e.addEventListener("error",o),e.addEventListener("abort",o)});_4.set(e,t)}let w4={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return _4.get(e);if(t==="objectStoreNames")return e.objectStoreNames||ij.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return oc(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function fve(e){w4=e(w4)}function hve(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const i=e.call(M7(this),t,...n);return ij.set(i,t.sort?t.sort():[t]),oc(i)}:cve().includes(e)?function(...t){return e.apply(M7(this),t),oc(nj.get(this))}:function(...t){return oc(e.apply(M7(this),t))}}function gve(e){return typeof e=="function"?hve(e):(e instanceof IDBTransaction&&dve(e),ave(e,lve())?new Proxy(e,w4):e)}function oc(e){if(e instanceof IDBRequest)return uve(e);if(A7.has(e))return A7.get(e);const t=gve(e);return t!==e&&(A7.set(e,t),Mw.set(t,e)),t}const M7=e=>Mw.get(e);function mve(e,t,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(e,t),a=oc(o);return i&&o.addEventListener("upgradeneeded",l=>{i(oc(o.result),l.oldVersion,l.newVersion,oc(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),r&&l.addEventListener("versionchange",c=>r(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const pve=["get","getKey","getAll","getAllKeys","count"],Uve=["put","add","delete","clear"],R7=new Map;function pk(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(R7.get(t))return R7.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,r=Uve.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||pve.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,r?"readwrite":"readonly");let c=l.store;return i&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),r&&l.done]))[0]};return R7.set(t,s),s}fve(e=>({...e,get:(t,n,i)=>pk(t,n)||e.get(t,n,i),has:(t,n)=>!!pk(t,n)||e.has(t,n)}));/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class bve{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(yve(n)){const i=n.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(n=>n).join(" ")}}function yve(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const T4="@firebase/app",Uk="0.11.1";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const nl=new tj("@firebase/app"),Eve="@firebase/app-compat",vve="@firebase/analytics-compat",_ve="@firebase/analytics",wve="@firebase/app-check-compat",Tve="@firebase/app-check",Sve="@firebase/auth",Ive="@firebase/auth-compat",xve="@firebase/database",Cve="@firebase/data-connect",Ave="@firebase/database-compat",Mve="@firebase/functions",Rve="@firebase/functions-compat",kve="@firebase/installations",Lve="@firebase/installations-compat",Dve="@firebase/messaging",Nve="@firebase/messaging-compat",Ove="@firebase/performance",Pve="@firebase/performance-compat",Fve="@firebase/remote-config",Bve="@firebase/remote-config-compat",zve="@firebase/storage",Hve="@firebase/storage-compat",Vve="@firebase/firestore",$ve="@firebase/vertexai",Gve="@firebase/firestore-compat",Xve="firebase",jve="11.3.1";/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const S4="[DEFAULT]",Yve={[T4]:"fire-core",[Eve]:"fire-core-compat",[_ve]:"fire-analytics",[vve]:"fire-analytics-compat",[Tve]:"fire-app-check",[wve]:"fire-app-check-compat",[Sve]:"fire-auth",[Ive]:"fire-auth-compat",[xve]:"fire-rtdb",[Cve]:"fire-data-connect",[Ave]:"fire-rtdb-compat",[Mve]:"fire-fn",[Rve]:"fire-fn-compat",[kve]:"fire-iid",[Lve]:"fire-iid-compat",[Dve]:"fire-fcm",[Nve]:"fire-fcm-compat",[Ove]:"fire-perf",[Pve]:"fire-perf-compat",[Fve]:"fire-rc",[Bve]:"fire-rc-compat",[zve]:"fire-gcs",[Hve]:"fire-gcs-compat",[Vve]:"fire-fst",[Gve]:"fire-fst-compat",[$ve]:"fire-vertex","fire-js":"fire-js",[Xve]:"fire-js-all"};/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const n6=new Map,Wve=new Map,I4=new Map;function bk(e,t){try{e.container.addComponent(t)}catch(n){nl.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function dm(e){const t=e.name;if(I4.has(t))return nl.debug(`There were multiple attempts to register component ${t}.`),!1;I4.set(t,e);for(const n of n6.values())bk(n,e);for(const n of Wve.values())bk(n,e);return!0}function rj(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function sj(e){return e==null?!1:e.settings!==void 0}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Kve={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ac=new ej("app","Firebase",Kve);/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Zve{constructor(t,n,i){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new Oh("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw ac.create("app-deleted",{appName:this._name})}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const oj=jve;function aj(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const i=Object.assign({name:S4,automaticDataCollectionEnabled:!1},t),r=i.name;if(typeof r!="string"||!r)throw ac.create("bad-app-name",{appName:String(r)});if(n||(n=QX()),!n)throw ac.create("no-options");const s=n6.get(r);if(s){if(v4(n,s.options)&&v4(i,s.config))return s;throw ac.create("duplicate-app",{appName:r})}const o=new nve(r);for(const l of I4.values())o.addComponent(l);const a=new Zve(n,i,o);return n6.set(r,a),a}function lj(e=S4){const t=n6.get(e);if(!t&&e===S4&&QX())return aj();if(!t)throw ac.create("no-app",{appName:e});return t}function lc(e,t,n){var i;let r=(i=Yve[e])!==null&&i!==void 0?i:e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const a=[`Unable to register library "${r}" with version "${t}":`];s&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${t}" contains illegal characters (whitespace or "/")`),nl.warn(a.join(" "));return}dm(new Oh(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const qve="firebase-heartbeat-database",Qve=1,fm="firebase-heartbeat-store";let k7=null;function cj(){return k7||(k7=mve(qve,Qve,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(fm)}catch(n){console.warn(n)}}}}).catch(e=>{throw ac.create("idb-open",{originalErrorMessage:e.message})})),k7}async function Jve(e){try{const n=(await cj()).transaction(fm),i=await n.objectStore(fm).get(uj(e));return await n.done,i}catch(t){if(t instanceof Dd)nl.warn(t.message);else{const n=ac.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});nl.warn(n.message)}}}async function yk(e,t){try{const i=(await cj()).transaction(fm,"readwrite");await i.objectStore(fm).put(t,uj(e)),await i.done}catch(n){if(n instanceof Dd)nl.warn(n.message);else{const i=ac.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});nl.warn(i.message)}}}function uj(e){return`${e.name}!${e.options.appId}`}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const e9e=1024,t9e=30;class n9e{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new r9e(n),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){var t,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Ek();if(((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:r}),this._heartbeatsCache.heartbeats.length>t9e){const o=s9e(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(i){nl.warn(i)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Ek(),{heartbeatsToSend:i,unsentEntries:r}=i9e(this._heartbeatsCache.heartbeats),s=t6(JSON.stringify({version:2,heartbeats:i}));return this._heartbeatsCache.lastSentHeartbeatDate=n,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return nl.warn(n),""}}}function Ek(){return new Date().toISOString().substring(0,10)}function i9e(e,t=e9e){const n=[];let i=e.slice();for(const r of e){const s=n.find(o=>o.agent===r.agent);if(s){if(s.dates.push(r.date),vk(n)>t){s.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),vk(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}class r9e{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return W4e()?K4e().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await Jve(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){var n;if(await this._canUseIndexedDBPromise){const r=await this.read();return yk(this.app,{lastSentHeartbeatDate:(n=t.lastSentHeartbeatDate)!==null&&n!==void 0?n:r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){var n;if(await this._canUseIndexedDBPromise){const r=await this.read();return yk(this.app,{lastSentHeartbeatDate:(n=t.lastSentHeartbeatDate)!==null&&n!==void 0?n:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function vk(e){return t6(JSON.stringify({version:2,heartbeats:e})).length}function s9e(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let i=1;i<e.length;i++)e[i].date<n&&(n=e[i].date,t=i);return t}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function o9e(e){dm(new Oh("platform-logger",t=>new bve(t),"PRIVATE")),dm(new Oh("heartbeat",t=>new n9e(t),"PRIVATE")),lc(T4,Uk,e),lc(T4,Uk,"esm2017"),lc("fire-js","")}o9e("");var a9e="firebase",l9e="11.3.1";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */lc(a9e,l9e,"app");var _k=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/var cc,dj;(function(){var e;/** @license

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/function t(w,T){function A(){}A.prototype=T.prototype,w.D=T.prototype,w.prototype=new A,w.prototype.constructor=w,w.C=function(S,k,N){for(var D=Array(arguments.length-2),G=2;G<arguments.length;G++)D[G-2]=arguments[G];return T.prototype[k].apply(S,D)}}function n(){this.blockSize=-1}function i(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}t(i,n),i.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function r(w,T,A){A||(A=0);var S=Array(16);if(typeof T=="string")for(var k=0;16>k;++k)S[k]=T.charCodeAt(A++)|T.charCodeAt(A++)<<8|T.charCodeAt(A++)<<16|T.charCodeAt(A++)<<24;else for(k=0;16>k;++k)S[k]=T[A++]|T[A++]<<8|T[A++]<<16|T[A++]<<24;T=w.g[0],A=w.g[1],k=w.g[2];var N=w.g[3],D=T+(N^A&(k^N))+S[0]+3614090360&4294967295;T=A+(D<<7&4294967295|D>>>25),D=N+(k^T&(A^k))+S[1]+3905402710&4294967295,N=T+(D<<12&4294967295|D>>>20),D=k+(A^N&(T^A))+S[2]+606105819&4294967295,k=N+(D<<17&4294967295|D>>>15),D=A+(T^k&(N^T))+S[3]+3250441966&4294967295,A=k+(D<<22&4294967295|D>>>10),D=T+(N^A&(k^N))+S[4]+4118548399&4294967295,T=A+(D<<7&4294967295|D>>>25),D=N+(k^T&(A^k))+S[5]+1200080426&4294967295,N=T+(D<<12&4294967295|D>>>20),D=k+(A^N&(T^A))+S[6]+2821735955&4294967295,k=N+(D<<17&4294967295|D>>>15),D=A+(T^k&(N^T))+S[7]+4249261313&4294967295,A=k+(D<<22&4294967295|D>>>10),D=T+(N^A&(k^N))+S[8]+1770035416&4294967295,T=A+(D<<7&4294967295|D>>>25),D=N+(k^T&(A^k))+S[9]+2336552879&4294967295,N=T+(D<<12&4294967295|D>>>20),D=k+(A^N&(T^A))+S[10]+4294925233&4294967295,k=N+(D<<17&4294967295|D>>>15),D=A+(T^k&(N^T))+S[11]+2304563134&4294967295,A=k+(D<<22&4294967295|D>>>10),D=T+(N^A&(k^N))+S[12]+1804603682&4294967295,T=A+(D<<7&4294967295|D>>>25),D=N+(k^T&(A^k))+S[13]+4254626195&4294967295,N=T+(D<<12&4294967295|D>>>20),D=k+(A^N&(T^A))+S[14]+2792965006&4294967295,k=N+(D<<17&4294967295|D>>>15),D=A+(T^k&(N^T))+S[15]+1236535329&4294967295,A=k+(D<<22&4294967295|D>>>10),D=T+(k^N&(A^k))+S[1]+4129170786&4294967295,T=A+(D<<5&4294967295|D>>>27),D=N+(A^k&(T^A))+S[6]+3225465664&4294967295,N=T+(D<<9&4294967295|D>>>23),D=k+(T^A&(N^T))+S[11]+643717713&4294967295,k=N+(D<<14&4294967295|D>>>18),D=A+(N^T&(k^N))+S[0]+3921069994&4294967295,A=k+(D<<20&4294967295|D>>>12),D=T+(k^N&(A^k))+S[5]+3593408605&4294967295,T=A+(D<<5&4294967295|D>>>27),D=N+(A^k&(T^A))+S[10]+38016083&4294967295,N=T+(D<<9&4294967295|D>>>23),D=k+(T^A&(N^T))+S[15]+3634488961&4294967295,k=N+(D<<14&4294967295|D>>>18),D=A+(N^T&(k^N))+S[4]+3889429448&4294967295,A=k+(D<<20&4294967295|D>>>12),D=T+(k^N&(A^k))+S[9]+568446438&4294967295,T=A+(D<<5&4294967295|D>>>27),D=N+(A^k&(T^A))+S[14]+3275163606&4294967295,N=T+(D<<9&4294967295|D>>>23),D=k+(T^A&(N^T))+S[3]+4107603335&4294967295,k=N+(D<<14&4294967295|D>>>18),D=A+(N^T&(k^N))+S[8]+1163531501&4294967295,A=k+(D<<20&4294967295|D>>>12),D=T+(k^N&(A^k))+S[13]+2850285829&4294967295,T=A+(D<<5&4294967295|D>>>27),D=N+(A^k&(T^A))+S[2]+4243563512&4294967295,N=T+(D<<9&4294967295|D>>>23),D=k+(T^A&(N^T))+S[7]+1735328473&4294967295,k=N+(D<<14&4294967295|D>>>18),D=A+(N^T&(k^N))+S[12]+2368359562&4294967295,A=k+(D<<20&4294967295|D>>>12),D=T+(A^k^N)+S[5]+4294588738&4294967295,T=A+(D<<4&4294967295|D>>>28),D=N+(T^A^k)+S[8]+2272392833&4294967295,N=T+(D<<11&4294967295|D>>>21),D=k+(N^T^A)+S[11]+1839030562&4294967295,k=N+(D<<16&4294967295|D>>>16),D=A+(k^N^T)+S[14]+4259657740&4294967295,A=k+(D<<23&4294967295|D>>>9),D=T+(A^k^N)+S[1]+2763975236&4294967295,T=A+(D<<4&4294967295|D>>>28),D=N+(T^A^k)+S[4]+1272893353&4294967295,N=T+(D<<11&4294967295|D>>>21),D=k+(N^T^A)+S[7]+4139469664&4294967295,k=N+(D<<16&4294967295|D>>>16),D=A+(k^N^T)+S[10]+3200236656&4294967295,A=k+(D<<23&4294967295|D>>>9),D=T+(A^k^N)+S[13]+681279174&4294967295,T=A+(D<<4&4294967295|D>>>28),D=N+(T^A^k)+S[0]+3936430074&4294967295,N=T+(D<<11&4294967295|D>>>21),D=k+(N^T^A)+S[3]+3572445317&4294967295,k=N+(D<<16&4294967295|D>>>16),D=A+(k^N^T)+S[6]+76029189&4294967295,A=k+(D<<23&4294967295|D>>>9),D=T+(A^k^N)+S[9]+3654602809&4294967295,T=A+(D<<4&4294967295|D>>>28),D=N+(T^A^k)+S[12]+3873151461&4294967295,N=T+(D<<11&4294967295|D>>>21),D=k+(N^T^A)+S[15]+530742520&4294967295,k=N+(D<<16&4294967295|D>>>16),D=A+(k^N^T)+S[2]+3299628645&4294967295,A=k+(D<<23&4294967295|D>>>9),D=T+(k^(A|~N))+S[0]+4096336452&4294967295,T=A+(D<<6&4294967295|D>>>26),D=N+(A^(T|~k))+S[7]+1126891415&4294967295,N=T+(D<<10&4294967295|D>>>22),D=k+(T^(N|~A))+S[14]+2878612391&4294967295,k=N+(D<<15&4294967295|D>>>17),D=A+(N^(k|~T))+S[5]+4237533241&4294967295,A=k+(D<<21&4294967295|D>>>11),D=T+(k^(A|~N))+S[12]+1700485571&4294967295,T=A+(D<<6&4294967295|D>>>26),D=N+(A^(T|~k))+S[3]+2399980690&4294967295,N=T+(D<<10&4294967295|D>>>22),D=k+(T^(N|~A))+S[10]+4293915773&4294967295,k=N+(D<<15&4294967295|D>>>17),D=A+(N^(k|~T))+S[1]+2240044497&4294967295,A=k+(D<<21&4294967295|D>>>11),D=T+(k^(A|~N))+S[8]+1873313359&4294967295,T=A+(D<<6&4294967295|D>>>26),D=N+(A^(T|~k))+S[15]+4264355552&4294967295,N=T+(D<<10&4294967295|D>>>22),D=k+(T^(N|~A))+S[6]+2734768916&4294967295,k=N+(D<<15&4294967295|D>>>17),D=A+(N^(k|~T))+S[13]+1309151649&4294967295,A=k+(D<<21&4294967295|D>>>11),D=T+(k^(A|~N))+S[4]+4149444226&4294967295,T=A+(D<<6&4294967295|D>>>26),D=N+(A^(T|~k))+S[11]+3174756917&4294967295,N=T+(D<<10&4294967295|D>>>22),D=k+(T^(N|~A))+S[2]+718787259&4294967295,k=N+(D<<15&4294967295|D>>>17),D=A+(N^(k|~T))+S[9]+3951481745&4294967295,w.g[0]=w.g[0]+T&4294967295,w.g[1]=w.g[1]+(k+(D<<21&4294967295|D>>>11))&4294967295,w.g[2]=w.g[2]+k&4294967295,w.g[3]=w.g[3]+N&4294967295}i.prototype.u=function(w,T){T===void 0&&(T=w.length);for(var A=T-this.blockSize,S=this.B,k=this.h,N=0;N<T;){if(k==0)for(;N<=A;)r(this,w,N),N+=this.blockSize;if(typeof w=="string"){for(;N<T;)if(S[k++]=w.charCodeAt(N++),k==this.blockSize){r(this,S),k=0;break}}else for(;N<T;)if(S[k++]=w[N++],k==this.blockSize){r(this,S),k=0;break}}this.h=k,this.o+=T},i.prototype.v=function(){var w=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);w[0]=128;for(var T=1;T<w.length-8;++T)w[T]=0;var A=8*this.o;for(T=w.length-8;T<w.length;++T)w[T]=A&255,A/=256;for(this.u(w),w=Array(16),T=A=0;4>T;++T)for(var S=0;32>S;S+=8)w[A++]=this.g[T]>>>S&255;return w};function s(w,T){var A=a;return Object.prototype.hasOwnProperty.call(A,w)?A[w]:A[w]=T(w)}function o(w,T){this.h=T;for(var A=[],S=!0,k=w.length-1;0<=k;k--){var N=w[k]|0;S&&N==T||(A[k]=N,S=!1)}this.g=A}var a={};function l(w){return-128<=w&&128>w?s(w,function(T){return new o([T|0],0>T?-1:0)}):new o([w|0],0>w?-1:0)}function c(w){if(isNaN(w)||!isFinite(w))return d;if(0>w)return b(c(-w));for(var T=[],A=1,S=0;w>=A;S++)T[S]=w/A|0,A*=4294967296;return new o(T,0)}function u(w,T){if(w.length==0)throw Error("number format error: empty string");if(T=T||10,2>T||36<T)throw Error("radix out of range: "+T);if(w.charAt(0)=="-")return b(u(w.substring(1),T));if(0<=w.indexOf("-"))throw Error('number format error: interior "-" character');for(var A=c(Math.pow(T,8)),S=d,k=0;k<w.length;k+=8){var N=Math.min(8,w.length-k),D=parseInt(w.substring(k,k+N),T);8>N?(N=c(Math.pow(T,N)),S=S.j(N).add(c(D))):(S=S.j(A),S=S.add(c(D)))}return S}var d=l(0),f=l(1),h=l(16777216);e=o.prototype,e.m=function(){if(p(this))return-b(this).m();for(var w=0,T=1,A=0;A<this.g.length;A++){var S=this.i(A);w+=(0<=S?S:4294967296+S)*T,T*=4294967296}return w},e.toString=function(w){if(w=w||10,2>w||36<w)throw Error("radix out of range: "+w);if(m(this))return"0";if(p(this))return"-"+b(this).toString(w);for(var T=c(Math.pow(w,6)),A=this,S="";;){var k=_(A,T).g;A=E(A,k.j(T));var N=((0<A.g.length?A.g[0]:A.h)>>>0).toString(w);if(A=k,m(A))return N+S;for(;6>N.length;)N="0"+N;S=N+S}},e.i=function(w){return 0>w?0:w<this.g.length?this.g[w]:this.h};function m(w){if(w.h!=0)return!1;for(var T=0;T<w.g.length;T++)if(w.g[T]!=0)return!1;return!0}function p(w){return w.h==-1}e.l=function(w){return w=E(this,w),p(w)?-1:m(w)?0:1};function b(w){for(var T=w.g.length,A=[],S=0;S<T;S++)A[S]=~w.g[S];return new o(A,~w.h).add(f)}e.abs=function(){return p(this)?b(this):this},e.add=function(w){for(var T=Math.max(this.g.length,w.g.length),A=[],S=0,k=0;k<=T;k++){var N=S+(this.i(k)&65535)+(w.i(k)&65535),D=(N>>>16)+(this.i(k)>>>16)+(w.i(k)>>>16);S=D>>>16,N&=65535,D&=65535,A[k]=D<<16|N}return new o(A,A[A.length-1]&-2147483648?-1:0)};function E(w,T){return w.add(b(T))}e.j=function(w){if(m(this)||m(w))return d;if(p(this))return p(w)?b(this).j(b(w)):b(b(this).j(w));if(p(w))return b(this.j(b(w)));if(0>this.l(h)&&0>w.l(h))return c(this.m()*w.m());for(var T=this.g.length+w.g.length,A=[],S=0;S<2*T;S++)A[S]=0;for(S=0;S<this.g.length;S++)for(var k=0;k<w.g.length;k++){var N=this.i(S)>>>16,D=this.i(S)&65535,G=w.i(k)>>>16,V=w.i(k)&65535;A[2*S+2*k]+=D*V,y(A,2*S+2*k),A[2*S+2*k+1]+=N*V,y(A,2*S+2*k+1),A[2*S+2*k+1]+=D*G,y(A,2*S+2*k+1),A[2*S+2*k+2]+=N*G,y(A,2*S+2*k+2)}for(S=0;S<T;S++)A[S]=A[2*S+1]<<16|A[2*S];for(S=T;S<2*T;S++)A[S]=0;return new o(A,0)};function y(w,T){for(;(w[T]&65535)!=w[T];)w[T+1]+=w[T]>>>16,w[T]&=65535,T++}function v(w,T){this.g=w,this.h=T}function _(w,T){if(m(T))throw Error("division by zero");if(m(w))return new v(d,d);if(p(w))return T=_(b(w),T),new v(b(T.g),b(T.h));if(p(T))return T=_(w,b(T)),new v(b(T.g),T.h);if(30<w.g.length){if(p(w)||p(T))throw Error("slowDivide_ only works with positive integers.");for(var A=f,S=T;0>=S.l(w);)A=I(A),S=I(S);var k=R(A,1),N=R(S,1);for(S=R(S,2),A=R(A,2);!m(S);){var D=N.add(S);0>=D.l(w)&&(k=k.add(A),N=D),S=R(S,1),A=R(A,1)}return T=E(w,k.j(T)),new v(k,T)}for(k=d;0<=w.l(T);){for(A=Math.max(1,Math.floor(w.m()/T.m())),S=Math.ceil(Math.log(A)/Math.LN2),S=48>=S?1:Math.pow(2,S-48),N=c(A),D=N.j(T);p(D)||0<D.l(w);)A-=S,N=c(A),D=N.j(T);m(N)&&(N=f),k=k.add(N),w=E(w,D)}return new v(k,w)}e.A=function(w){return _(this,w).h},e.and=function(w){for(var T=Math.max(this.g.length,w.g.length),A=[],S=0;S<T;S++)A[S]=this.i(S)&w.i(S);return new o(A,this.h&w.h)},e.or=function(w){for(var T=Math.max(this.g.length,w.g.length),A=[],S=0;S<T;S++)A[S]=this.i(S)|w.i(S);return new o(A,this.h|w.h)},e.xor=function(w){for(var T=Math.max(this.g.length,w.g.length),A=[],S=0;S<T;S++)A[S]=this.i(S)^w.i(S);return new o(A,this.h^w.h)};function I(w){for(var T=w.g.length+1,A=[],S=0;S<T;S++)A[S]=w.i(S)<<1|w.i(S-1)>>>31;return new o(A,w.h)}function R(w,T){var A=T>>5;T%=32;for(var S=w.g.length-A,k=[],N=0;N<S;N++)k[N]=0<T?w.i(N+A)>>>T|w.i(N+A+1)<<32-T:w.i(N+A);return new o(k,w.h)}i.prototype.digest=i.prototype.v,i.prototype.reset=i.prototype.s,i.prototype.update=i.prototype.u,dj=i,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.A,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=u,cc=o}).apply(typeof _k<"u"?_k:typeof self<"u"?self:typeof window<"u"?window:{});var _U=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/var fj,vg,hj,U2,x4,gj,mj,pj;(function(){var e,t=typeof Object.defineProperties=="function"?Object.defineProperty:function(U,x,O){return U==Array.prototype||U==Object.prototype||(U[x]=O.value),U};function n(U){U=[typeof globalThis=="object"&&globalThis,U,typeof window=="object"&&window,typeof self=="object"&&self,typeof _U=="object"&&_U];for(var x=0;x<U.length;++x){var O=U[x];if(O&&O.Math==Math)return O}throw Error("Cannot find global object")}var i=n(this);function r(U,x){if(x)e:{var O=i;U=U.split(".");for(var B=0;B<U.length-1;B++){var K=U[B];if(!(K in O))break e;O=O[K]}U=U[U.length-1],B=O[U],x=x(B),x!=B&&x!=null&&t(O,U,{configurable:!0,writable:!0,value:x})}}function s(U,x){U instanceof String&&(U+="");var O=0,B=!1,K={next:function(){if(!B&&O<U.length){var J=O++;return{value:x(J,U[J]),done:!1}}return B=!0,{done:!0,value:void 0}}};return K[Symbol.iterator]=function(){return K},K}r("Array.prototype.values",function(U){return U||function(){return s(this,function(x,O){return O})}});/** @license

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/var o=o||{},a=this||self;function l(U){var x=typeof U;return x=x!="object"?x:U?Array.isArray(U)?"array":x:"null",x=="array"||x=="object"&&typeof U.length=="number"}function c(U){var x=typeof U;return x=="object"&&U!=null||x=="function"}function u(U,x,O){return U.call.apply(U.bind,arguments)}function d(U,x,O){if(!U)throw Error();if(2<arguments.length){var B=Array.prototype.slice.call(arguments,2);return function(){var K=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(K,B),U.apply(x,K)}}return function(){return U.apply(x,arguments)}}function f(U,x,O){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?u:d,f.apply(null,arguments)}function h(U,x){var O=Array.prototype.slice.call(arguments,1);return function(){var B=O.slice();return B.push.apply(B,arguments),U.apply(this,B)}}function m(U,x){function O(){}O.prototype=x.prototype,U.aa=x.prototype,U.prototype=new O,U.prototype.constructor=U,U.Qb=function(B,K,J){for(var fe=Array(arguments.length-2),Ot=2;Ot<arguments.length;Ot++)fe[Ot-2]=arguments[Ot];return x.prototype[K].apply(B,fe)}}function p(U){const x=U.length;if(0<x){const O=Array(x);for(let B=0;B<x;B++)O[B]=U[B];return O}return[]}function b(U,x){for(let O=1;O<arguments.length;O++){const B=arguments[O];if(l(B)){const K=U.length||0,J=B.length||0;U.length=K+J;for(let fe=0;fe<J;fe++)U[K+fe]=B[fe]}else U.push(B)}}class E{constructor(x,O){this.i=x,this.j=O,this.h=0,this.g=null}get(){let x;return 0<this.h?(this.h--,x=this.g,this.g=x.next,x.next=null):x=this.i(),x}}function y(U){return/^[\s\xa0]*$/.test(U)}function v(){var U=a.navigator;return U&&(U=U.userAgent)?U:""}function _(U){return _[" "](U),U}_[" "]=function(){};var I=v().indexOf("Gecko")!=-1&&!(v().toLowerCase().indexOf("webkit")!=-1&&v().indexOf("Edge")==-1)&&!(v().indexOf("Trident")!=-1||v().indexOf("MSIE")!=-1)&&v().indexOf("Edge")==-1;function R(U,x,O){for(const B in U)x.call(O,U[B],B,U)}function w(U,x){for(const O in U)x.call(void 0,U[O],O,U)}function T(U){const x={};for(const O in U)x[O]=U[O];return x}const A="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function S(U,x){let O,B;for(let K=1;K<arguments.length;K++){B=arguments[K];for(O in B)U[O]=B[O];for(let J=0;J<A.length;J++)O=A[J],Object.prototype.hasOwnProperty.call(B,O)&&(U[O]=B[O])}}function k(U){var x=1;U=U.split(":");const O=[];for(;0<x&&U.length;)O.push(U.shift()),x--;return U.length&&O.push(U.join(":")),O}function N(U){a.setTimeout(()=>{throw U},0)}function D(){var U=X;let x=null;return U.g&&(x=U.g,U.g=U.g.next,U.g||(U.h=null),x.next=null),x}class G{constructor(){this.h=this.g=null}add(x,O){const B=V.get();B.set(x,O),this.h?this.h.next=B:this.g=B,this.h=B}}var V=new E(()=>new H,U=>U.reset());class H{constructor(){this.next=this.g=this.h=null}set(x,O){this.h=x,this.g=O,this.next=null}reset(){this.next=this.g=this.h=null}}let $,j=!1,X=new G,Y=()=>{const U=a.Promise.resolve(void 0);$=()=>{U.then(le)}};var le=()=>{for(var U;U=D();){try{U.h.call(U.g)}catch(O){N(O)}var x=V;x.j(U),100>x.h&&(x.h++,U.next=x.g,x.g=U)}j=!1};function pe(){this.s=this.s,this.C=this.C}pe.prototype.s=!1,pe.prototype.ma=function(){this.s||(this.s=!0,this.N())},pe.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function ae(U,x){this.type=U,this.g=this.target=x,this.defaultPrevented=!1}ae.prototype.h=function(){this.defaultPrevented=!0};var ze=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var U=!1,x=Object.defineProperty({},"passive",{get:function(){U=!0}});try{const O=()=>{};a.addEventListener("test",O,x),a.removeEventListener("test",O,x)}catch{}return U}();function Xe(U,x){if(ae.call(this,U?U.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,U){var O=this.type=U.type,B=U.changedTouches&&U.changedTouches.length?U.changedTouches[0]:null;if(this.target=U.target||U.srcElement,this.g=x,x=U.relatedTarget){if(I){e:{try{_(x.nodeName);var K=!0;break e}catch{}K=!1}K||(x=null)}}else O=="mouseover"?x=U.fromElement:O=="mouseout"&&(x=U.toElement);this.relatedTarget=x,B?(this.clientX=B.clientX!==void 0?B.clientX:B.pageX,this.clientY=B.clientY!==void 0?B.clientY:B.pageY,this.screenX=B.screenX||0,this.screenY=B.screenY||0):(this.clientX=U.clientX!==void 0?U.clientX:U.pageX,this.clientY=U.clientY!==void 0?U.clientY:U.pageY,this.screenX=U.screenX||0,this.screenY=U.screenY||0),this.button=U.button,this.key=U.key||"",this.ctrlKey=U.ctrlKey,this.altKey=U.altKey,this.shiftKey=U.shiftKey,this.metaKey=U.metaKey,this.pointerId=U.pointerId||0,this.pointerType=typeof U.pointerType=="string"?U.pointerType:qe[U.pointerType]||"",this.state=U.state,this.i=U,U.defaultPrevented&&Xe.aa.h.call(this)}}m(Xe,ae);var qe={2:"touch",3:"pen",4:"mouse"};Xe.prototype.h=function(){Xe.aa.h.call(this);var U=this.i;U.preventDefault?U.preventDefault():U.returnValue=!1};var Ze="closure_listenable_"+(1e6*Math.random()|0),on=0;function _n(U,x,O,B,K){this.listener=U,this.proxy=null,this.src=x,this.type=O,this.capture=!!B,this.ha=K,this.key=++on,this.da=this.fa=!1}function Ye(U){U.da=!0,U.listener=null,U.proxy=null,U.src=null,U.ha=null}function Qe(U){this.src=U,this.g={},this.h=0}Qe.prototype.add=function(U,x,O,B,K){var J=U.toString();U=this.g[J],U||(U=this.g[J]=[],this.h++);var fe=Es(U,x,B,K);return-1<fe?(x=U[fe],O||(x.fa=!1)):(x=new _n(x,this.src,J,!!B,K),x.fa=O,U.push(x)),x};function zt(U,x){var O=x.type;if(O in U.g){var B=U.g[O],K=Array.prototype.indexOf.call(B,x,void 0),J;(J=0<=K)&&Array.prototype.splice.call(B,K,1),J&&(Ye(x),U.g[O].length==0&&(delete U.g[O],U.h--))}}function Es(U,x,O,B){for(var K=0;K<U.length;++K){var J=U[K];if(!J.da&&J.listener==x&&J.capture==!!O&&J.ha==B)return K}return-1}var Qo="closure_lm_"+(1e6*Math.random()|0),ao={};function lo(U,x,O,B,K){if(Array.isArray(x)){for(var J=0;J<x.length;J++)lo(U,x[J],O,B,K);return null}return O=bT(O),U&&U[Ze]?U.K(x,O,c(B)?!!B.capture:!1,K):Vr(U,x,O,!1,B,K)}function Vr(U,x,O,B,K,J){if(!x)throw Error("Invalid event type");var fe=c(K)?!!K.capture:!!K,Ot=ay(U);if(Ot||(U[Qo]=Ot=new Qe(U)),O=Ot.add(x,O,B,fe,J),O.proxy)return O;if(B=sy(),O.proxy=B,B.src=U,B.listener=O,U.addEventListener)ze||(K=fe),K===void 0&&(K=!1),U.addEventListener(x.toString(),B,K);else if(U.attachEvent)U.attachEvent(UT(x.toString()),B);else if(U.addListener&&U.removeListener)U.addListener(B);else throw Error("addEventListener and attachEvent are unavailable.");return O}function sy(){function U(O){return x.call(U.src,U.listener,O)}const x=dW;return U}function Vc(U,x,O,B,K){if(Array.isArray(x))for(var J=0;J<x.length;J++)Vc(U,x[J],O,B,K);else B=c(B)?!!B.capture:!!B,O=bT(O),U&&U[Ze]?(U=U.i,x=String(x).toString(),x in U.g&&(J=U.g[x],O=Es(J,O,B,K),-1<O&&(Ye(J[O]),Array.prototype.splice.call(J,O,1),J.length==0&&(delete U.g[x],U.h--)))):U&&(U=ay(U))&&(x=U.g[x.toString()],U=-1,x&&(U=Es(x,O,B,K)),(O=-1<U?x[U]:null)&&oy(O))}function oy(U){if(typeof U!="number"&&U&&!U.da){var x=U.src;if(x&&x[Ze])zt(x.i,U);else{var O=U.type,B=U.proxy;x.removeEventListener?x.removeEventListener(O,B,U.capture):x.detachEvent?x.detachEvent(UT(O),B):x.addListener&&x.removeListener&&x.removeListener(B),(O=ay(x))?(zt(O,U),O.h==0&&(O.src=null,x[Qo]=null)):Ye(U)}}}function UT(U){return U in ao?ao[U]:ao[U]="on"+U}function dW(U,x){if(U.da)U=!0;else{x=new Xe(x,this);var O=U.listener,B=U.ha||U.src;U.fa&&oy(U),U=O.call(B,x)}return U}function ay(U){return U=U[Qo],U instanceof Qe?U:null}var ly="__closure_events_fn_"+(1e9*Math.random()>>>0);function bT(U){return typeof U=="function"?U:(U[ly]||(U[ly]=function(x){return U.handleEvent(x)}),U[ly])}function Ti(){pe.call(this),this.i=new Qe(this),this.M=this,this.F=null}m(Ti,pe),Ti.prototype[Ze]=!0,Ti.prototype.removeEventListener=function(U,x,O,B){Vc(this,U,x,O,B)};function Vi(U,x){var O,B=U.F;if(B)for(O=[];B;B=B.F)O.push(B);if(U=U.M,B=x.type||x,typeof x=="string")x=new ae(x,U);else if(x instanceof ae)x.target=x.target||U;else{var K=x;x=new ae(B,U),S(x,K)}if(K=!0,O)for(var J=O.length-1;0<=J;J--){var fe=x.g=O[J];K=up(fe,B,!0,x)&&K}if(fe=x.g=U,K=up(fe,B,!0,x)&&K,K=up(fe,B,!1,x)&&K,O)for(J=0;J<O.length;J++)fe=x.g=O[J],K=up(fe,B,!1,x)&&K}Ti.prototype.N=function(){if(Ti.aa.N.call(this),this.i){var U=this.i,x;for(x in U.g){for(var O=U.g[x],B=0;B<O.length;B++)Ye(O[B]);delete U.g[x],U.h--}}this.F=null},Ti.prototype.K=function(U,x,O,B){return this.i.add(String(U),x,!1,O,B)},Ti.prototype.L=function(U,x,O,B){return this.i.add(String(U),x,!0,O,B)};function up(U,x,O,B){if(x=U.i.g[String(x)],!x)return!0;x=x.concat();for(var K=!0,J=0;J<x.length;++J){var fe=x[J];if(fe&&!fe.da&&fe.capture==O){var Ot=fe.listener,hi=fe.ha||fe.src;fe.fa&&zt(U.i,fe),K=Ot.call(hi,B)!==!1&&K}}return K&&!B.defaultPrevented}function yT(U,x,O){if(typeof U=="function")O&&(U=f(U,O));else if(U&&typeof U.handleEvent=="function")U=f(U.handleEvent,U);else throw Error("Invalid listener argument");return 2147483647<Number(x)?-1:a.setTimeout(U,x||0)}function ET(U){U.g=yT(()=>{U.g=null,U.i&&(U.i=!1,ET(U))},U.l);const x=U.h;U.h=null,U.m.apply(null,x)}class fW extends pe{constructor(x,O){super(),this.m=x,this.l=O,this.h=null,this.i=!1,this.g=null}j(x){this.h=arguments,this.g?this.i=!0:ET(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function g1(U){pe.call(this),this.h=U,this.g={}}m(g1,pe);var vT=[];function _T(U){R(U.g,function(x,O){this.g.hasOwnProperty(O)&&oy(x)},U),U.g={}}g1.prototype.N=function(){g1.aa.N.call(this),_T(this)},g1.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var cy=a.JSON.stringify,hW=a.JSON.parse,gW=class{stringify(U){return a.JSON.stringify(U,void 0)}parse(U){return a.JSON.parse(U,void 0)}};function uy(){}uy.prototype.h=null;function wT(U){return U.h||(U.h=U.i())}function TT(){}var m1={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function dy(){ae.call(this,"d")}m(dy,ae);function fy(){ae.call(this,"c")}m(fy,ae);var $c={},ST=null;function dp(){return ST=ST||new Ti}$c.La="serverreachability";function IT(U){ae.call(this,$c.La,U)}m(IT,ae);function p1(U){const x=dp();Vi(x,new IT(x))}$c.STAT_EVENT="statevent";function xT(U,x){ae.call(this,$c.STAT_EVENT,U),this.stat=x}m(xT,ae);function $i(U){const x=dp();Vi(x,new xT(x,U))}$c.Ma="timingevent";function CT(U,x){ae.call(this,$c.Ma,U),this.size=x}m(CT,ae);function U1(U,x){if(typeof U!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){U()},x)}function b1(){this.g=!0}b1.prototype.xa=function(){this.g=!1};function mW(U,x,O,B,K,J){U.info(function(){if(U.g)if(J)for(var fe="",Ot=J.split("&"),hi=0;hi<Ot.length;hi++){var bt=Ot[hi].split("=");if(1<bt.length){var Si=bt[0];bt=bt[1];var Ii=Si.split("_");fe=2<=Ii.length&&Ii[1]=="type"?fe+(Si+"="+bt+"&"):fe+(Si+"=redacted&")}}else fe=null;else fe=J;return"XMLHTTP REQ ("+B+") [attempt "+K+"]: "+x+`
`+O+`
`+fe})}function pW(U,x,O,B,K,J,fe){U.info(function(){return"XMLHTTP RESP ("+B+") [ attempt "+K+"]: "+x+`
`+O+`
`+J+" "+fe})}function Bd(U,x,O,B){U.info(function(){return"XMLHTTP TEXT ("+x+"): "+bW(U,O)+(B?" "+B:"")})}function UW(U,x){U.info(function(){return"TIMEOUT: "+x})}b1.prototype.info=function(){};function bW(U,x){if(!U.g)return x;if(!x)return null;try{var O=JSON.parse(x);if(O){for(U=0;U<O.length;U++)if(Array.isArray(O[U])){var B=O[U];if(!(2>B.length)){var K=B[1];if(Array.isArray(K)&&!(1>K.length)){var J=K[0];if(J!="noop"&&J!="stop"&&J!="close")for(var fe=1;fe<K.length;fe++)K[fe]=""}}}}return cy(O)}catch{return x}}var fp={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},AT={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},hy;function hp(){}m(hp,uy),hp.prototype.g=function(){return new XMLHttpRequest},hp.prototype.i=function(){return{}},hy=new hp;function dl(U,x,O,B){this.j=U,this.i=x,this.l=O,this.R=B||1,this.U=new g1(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new MT}function MT(){this.i=null,this.g="",this.h=!1}var RT={},gy={};function my(U,x,O){U.L=1,U.v=Up(Jo(x)),U.m=O,U.P=!0,kT(U,null)}function kT(U,x){U.F=Date.now(),gp(U),U.A=Jo(U.v);var O=U.A,B=U.R;Array.isArray(B)||(B=[String(B)]),jT(O.i,"t",B),U.C=0,O=U.j.J,U.h=new MT,U.g=uS(U.j,O?x:null,!U.m),0<U.O&&(U.M=new fW(f(U.Y,U,U.g),U.O)),x=U.U,O=U.g,B=U.ca;var K="readystatechange";Array.isArray(K)||(K&&(vT[0]=K.toString()),K=vT);for(var J=0;J<K.length;J++){var fe=lo(O,K[J],B||x.handleEvent,!1,x.h||x);if(!fe)break;x.g[fe.key]=fe}x=U.H?T(U.H):{},U.m?(U.u||(U.u="POST"),x["Content-Type"]="application/x-www-form-urlencoded",U.g.ea(U.A,U.u,U.m,x)):(U.u="GET",U.g.ea(U.A,U.u,null,x)),p1(),mW(U.i,U.u,U.A,U.l,U.R,U.m)}dl.prototype.ca=function(U){U=U.target;const x=this.M;x&&ea(U)==3?x.j():this.Y(U)},dl.prototype.Y=function(U){try{if(U==this.g)e:{const Ii=ea(this.g);var x=this.g.Ba();const Vd=this.g.Z();if(!(3>Ii)&&(Ii!=3||this.g&&(this.h.h||this.g.oa()||JT(this.g)))){this.J||Ii!=4||x==7||(x==8||0>=Vd?p1(3):p1(2)),py(this);var O=this.g.Z();this.X=O;t:if(LT(this)){var B=JT(this.g);U="";var K=B.length,J=ea(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Gc(this),y1(this);var fe="";break t}this.h.i=new a.TextDecoder}for(x=0;x<K;x++)this.h.h=!0,U+=this.h.i.decode(B[x],{stream:!(J&&x==K-1)});B.length=0,this.h.g+=U,this.C=0,fe=this.h.g}else fe=this.g.oa();if(this.o=O==200,pW(this.i,this.u,this.A,this.l,this.R,Ii,O),this.o){if(this.T&&!this.K){t:{if(this.g){var Ot,hi=this.g;if((Ot=hi.g?hi.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!y(Ot)){var bt=Ot;break t}}bt=null}if(O=bt)Bd(this.i,this.l,O,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Uy(this,O);else{this.o=!1,this.s=3,$i(12),Gc(this),y1(this);break e}}if(this.P){O=!0;let vs;for(;!this.J&&this.C<fe.length;)if(vs=yW(this,fe),vs==gy){Ii==4&&(this.s=4,$i(14),O=!1),Bd(this.i,this.l,null,"[Incomplete Response]");break}else if(vs==RT){this.s=4,$i(15),Bd(this.i,this.l,fe,"[Invalid Chunk]"),O=!1;break}else Bd(this.i,this.l,vs,null),Uy(this,vs);if(LT(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Ii!=4||fe.length!=0||this.h.h||(this.s=1,$i(16),O=!1),this.o=this.o&&O,!O)Bd(this.i,this.l,fe,"[Invalid Chunked Response]"),Gc(this),y1(this);else if(0<fe.length&&!this.W){this.W=!0;var Si=this.j;Si.g==this&&Si.ba&&!Si.M&&(Si.j.info("Great, no buffering proxy detected. Bytes received: "+fe.length),wy(Si),Si.M=!0,$i(11))}}else Bd(this.i,this.l,fe,null),Uy(this,fe);Ii==4&&Gc(this),this.o&&!this.J&&(Ii==4?oS(this.j,this):(this.o=!1,gp(this)))}else OW(this.g),O==400&&0<fe.indexOf("Unknown SID")?(this.s=3,$i(12)):(this.s=0,$i(13)),Gc(this),y1(this)}}}catch{}finally{}};function LT(U){return U.g?U.u=="GET"&&U.L!=2&&U.j.Ca:!1}function yW(U,x){var O=U.C,B=x.indexOf(`
`,O);return B==-1?gy:(O=Number(x.substring(O,B)),isNaN(O)?RT:(B+=1,B+O>x.length?gy:(x=x.slice(B,B+O),U.C=B+O,x)))}dl.prototype.cancel=function(){this.J=!0,Gc(this)};function gp(U){U.S=Date.now()+U.I,DT(U,U.I)}function DT(U,x){if(U.B!=null)throw Error("WatchDog timer not null");U.B=U1(f(U.ba,U),x)}function py(U){U.B&&(a.clearTimeout(U.B),U.B=null)}dl.prototype.ba=function(){this.B=null;const U=Date.now();0<=U-this.S?(UW(this.i,this.A),this.L!=2&&(p1(),$i(17)),Gc(this),this.s=2,y1(this)):DT(this,this.S-U)};function y1(U){U.j.G==0||U.J||oS(U.j,U)}function Gc(U){py(U);var x=U.M;x&&typeof x.ma=="function"&&x.ma(),U.M=null,_T(U.U),U.g&&(x=U.g,U.g=null,x.abort(),x.ma())}function Uy(U,x){try{var O=U.j;if(O.G!=0&&(O.g==U||by(O.h,U))){if(!U.K&&by(O.h,U)&&O.G==3){try{var B=O.Da.g.parse(x)}catch{B=null}if(Array.isArray(B)&&B.length==3){var K=B;if(K[0]==0){e:if(!O.u){if(O.g)if(O.g.F+3e3<U.F)wp(O),vp(O);else break e;_y(O),$i(18)}}else O.za=K[1],0<O.za-O.T&&37500>K[2]&&O.F&&O.v==0&&!O.C&&(O.C=U1(f(O.Za,O),6e3));if(1>=PT(O.h)&&O.ca){try{O.ca()}catch{}O.ca=void 0}}else jc(O,11)}else if((U.K||O.g==U)&&wp(O),!y(x))for(K=O.Da.g.parse(x),x=0;x<K.length;x++){let bt=K[x];if(O.T=bt[0],bt=bt[1],O.G==2)if(bt[0]=="c"){O.K=bt[1],O.ia=bt[2];const Si=bt[3];Si!=null&&(O.la=Si,O.j.info("VER="+O.la));const Ii=bt[4];Ii!=null&&(O.Aa=Ii,O.j.info("SVER="+O.Aa));const Vd=bt[5];Vd!=null&&typeof Vd=="number"&&0<Vd&&(B=1.5*Vd,O.L=B,O.j.info("backChannelRequestTimeoutMs_="+B)),B=O;const vs=U.g;if(vs){const Sp=vs.g?vs.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Sp){var J=B.h;J.g||Sp.indexOf("spdy")==-1&&Sp.indexOf("quic")==-1&&Sp.indexOf("h2")==-1||(J.j=J.l,J.g=new Set,J.h&&(yy(J,J.h),J.h=null))}if(B.D){const Ty=vs.g?vs.g.getResponseHeader("X-HTTP-Session-Id"):null;Ty&&(B.ya=Ty,Yt(B.I,B.D,Ty))}}O.G=3,O.l&&O.l.ua(),O.ba&&(O.R=Date.now()-U.F,O.j.info("Handshake RTT: "+O.R+"ms")),B=O;var fe=U;if(B.qa=cS(B,B.J?B.ia:null,B.W),fe.K){FT(B.h,fe);var Ot=fe,hi=B.L;hi&&(Ot.I=hi),Ot.B&&(py(Ot),gp(Ot)),B.g=fe}else rS(B);0<O.i.length&&_p(O)}else bt[0]!="stop"&&bt[0]!="close"||jc(O,7);else O.G==3&&(bt[0]=="stop"||bt[0]=="close"?bt[0]=="stop"?jc(O,7):vy(O):bt[0]!="noop"&&O.l&&O.l.ta(bt),O.v=0)}}p1(4)}catch{}}var EW=class{constructor(U,x){this.g=U,this.map=x}};function NT(U){this.l=U||10,a.PerformanceNavigationTiming?(U=a.performance.getEntriesByType("navigation"),U=0<U.length&&(U[0].nextHopProtocol=="hq"||U[0].nextHopProtocol=="h2")):U=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=U?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function OT(U){return U.h?!0:U.g?U.g.size>=U.j:!1}function PT(U){return U.h?1:U.g?U.g.size:0}function by(U,x){return U.h?U.h==x:U.g?U.g.has(x):!1}function yy(U,x){U.g?U.g.add(x):U.h=x}function FT(U,x){U.h&&U.h==x?U.h=null:U.g&&U.g.has(x)&&U.g.delete(x)}NT.prototype.cancel=function(){if(this.i=BT(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const U of this.g.values())U.cancel();this.g.clear()}};function BT(U){if(U.h!=null)return U.i.concat(U.h.D);if(U.g!=null&&U.g.size!==0){let x=U.i;for(const O of U.g.values())x=x.concat(O.D);return x}return p(U.i)}function vW(U){if(U.V&&typeof U.V=="function")return U.V();if(typeof Map<"u"&&U instanceof Map||typeof Set<"u"&&U instanceof Set)return Array.from(U.values());if(typeof U=="string")return U.split("");if(l(U)){for(var x=[],O=U.length,B=0;B<O;B++)x.push(U[B]);return x}x=[],O=0;for(B in U)x[O++]=U[B];return x}function _W(U){if(U.na&&typeof U.na=="function")return U.na();if(!U.V||typeof U.V!="function"){if(typeof Map<"u"&&U instanceof Map)return Array.from(U.keys());if(!(typeof Set<"u"&&U instanceof Set)){if(l(U)||typeof U=="string"){var x=[];U=U.length;for(var O=0;O<U;O++)x.push(O);return x}x=[],O=0;for(const B in U)x[O++]=B;return x}}}function zT(U,x){if(U.forEach&&typeof U.forEach=="function")U.forEach(x,void 0);else if(l(U)||typeof U=="string")Array.prototype.forEach.call(U,x,void 0);else for(var O=_W(U),B=vW(U),K=B.length,J=0;J<K;J++)x.call(void 0,B[J],O&&O[J],U)}var HT=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function wW(U,x){if(U){U=U.split("&");for(var O=0;O<U.length;O++){var B=U[O].indexOf("="),K=null;if(0<=B){var J=U[O].substring(0,B);K=U[O].substring(B+1)}else J=U[O];x(J,K?decodeURIComponent(K.replace(/\+/g," ")):"")}}}function Xc(U){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,U instanceof Xc){this.h=U.h,mp(this,U.j),this.o=U.o,this.g=U.g,pp(this,U.s),this.l=U.l;var x=U.i,O=new _1;O.i=x.i,x.g&&(O.g=new Map(x.g),O.h=x.h),VT(this,O),this.m=U.m}else U&&(x=String(U).match(HT))?(this.h=!1,mp(this,x[1]||"",!0),this.o=E1(x[2]||""),this.g=E1(x[3]||"",!0),pp(this,x[4]),this.l=E1(x[5]||"",!0),VT(this,x[6]||"",!0),this.m=E1(x[7]||"")):(this.h=!1,this.i=new _1(null,this.h))}Xc.prototype.toString=function(){var U=[],x=this.j;x&&U.push(v1(x,$T,!0),":");var O=this.g;return(O||x=="file")&&(U.push("//"),(x=this.o)&&U.push(v1(x,$T,!0),"@"),U.push(encodeURIComponent(String(O)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),O=this.s,O!=null&&U.push(":",String(O))),(O=this.l)&&(this.g&&O.charAt(0)!="/"&&U.push("/"),U.push(v1(O,O.charAt(0)=="/"?IW:SW,!0))),(O=this.i.toString())&&U.push("?",O),(O=this.m)&&U.push("#",v1(O,CW)),U.join("")};function Jo(U){return new Xc(U)}function mp(U,x,O){U.j=O?E1(x,!0):x,U.j&&(U.j=U.j.replace(/:$/,""))}function pp(U,x){if(x){if(x=Number(x),isNaN(x)||0>x)throw Error("Bad port number "+x);U.s=x}else U.s=null}function VT(U,x,O){x instanceof _1?(U.i=x,AW(U.i,U.h)):(O||(x=v1(x,xW)),U.i=new _1(x,U.h))}function Yt(U,x,O){U.i.set(x,O)}function Up(U){return Yt(U,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),U}function E1(U,x){return U?x?decodeURI(U.replace(/%25/g,"%2525")):decodeURIComponent(U):""}function v1(U,x,O){return typeof U=="string"?(U=encodeURI(U).replace(x,TW),O&&(U=U.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),U):null}function TW(U){return U=U.charCodeAt(0),"%"+(U>>4&15).toString(16)+(U&15).toString(16)}var $T=/[#\/\?@]/g,SW=/[#\?:]/g,IW=/[#\?]/g,xW=/[#\?@]/g,CW=/#/g;function _1(U,x){this.h=this.g=null,this.i=U||null,this.j=!!x}function fl(U){U.g||(U.g=new Map,U.h=0,U.i&&wW(U.i,function(x,O){U.add(decodeURIComponent(x.replace(/\+/g," ")),O)}))}e=_1.prototype,e.add=function(U,x){fl(this),this.i=null,U=zd(this,U);var O=this.g.get(U);return O||this.g.set(U,O=[]),O.push(x),this.h+=1,this};function GT(U,x){fl(U),x=zd(U,x),U.g.has(x)&&(U.i=null,U.h-=U.g.get(x).length,U.g.delete(x))}function XT(U,x){return fl(U),x=zd(U,x),U.g.has(x)}e.forEach=function(U,x){fl(this),this.g.forEach(function(O,B){O.forEach(function(K){U.call(x,K,B,this)},this)},this)},e.na=function(){fl(this);const U=Array.from(this.g.values()),x=Array.from(this.g.keys()),O=[];for(let B=0;B<x.length;B++){const K=U[B];for(let J=0;J<K.length;J++)O.push(x[B])}return O},e.V=function(U){fl(this);let x=[];if(typeof U=="string")XT(this,U)&&(x=x.concat(this.g.get(zd(this,U))));else{U=Array.from(this.g.values());for(let O=0;O<U.length;O++)x=x.concat(U[O])}return x},e.set=function(U,x){return fl(this),this.i=null,U=zd(this,U),XT(this,U)&&(this.h-=this.g.get(U).length),this.g.set(U,[x]),this.h+=1,this},e.get=function(U,x){return U?(U=this.V(U),0<U.length?String(U[0]):x):x};function jT(U,x,O){GT(U,x),0<O.length&&(U.i=null,U.g.set(zd(U,x),p(O)),U.h+=O.length)}e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const U=[],x=Array.from(this.g.keys());for(var O=0;O<x.length;O++){var B=x[O];const J=encodeURIComponent(String(B)),fe=this.V(B);for(B=0;B<fe.length;B++){var K=J;fe[B]!==""&&(K+="="+encodeURIComponent(String(fe[B]))),U.push(K)}}return this.i=U.join("&")};function zd(U,x){return x=String(x),U.j&&(x=x.toLowerCase()),x}function AW(U,x){x&&!U.j&&(fl(U),U.i=null,U.g.forEach(function(O,B){var K=B.toLowerCase();B!=K&&(GT(this,B),jT(this,K,O))},U)),U.j=x}function MW(U,x){const O=new b1;if(a.Image){const B=new Image;B.onload=h(hl,O,"TestLoadImage: loaded",!0,x,B),B.onerror=h(hl,O,"TestLoadImage: error",!1,x,B),B.onabort=h(hl,O,"TestLoadImage: abort",!1,x,B),B.ontimeout=h(hl,O,"TestLoadImage: timeout",!1,x,B),a.setTimeout(function(){B.ontimeout&&B.ontimeout()},1e4),B.src=U}else x(!1)}function RW(U,x){const O=new b1,B=new AbortController,K=setTimeout(()=>{B.abort(),hl(O,"TestPingServer: timeout",!1,x)},1e4);fetch(U,{signal:B.signal}).then(J=>{clearTimeout(K),J.ok?hl(O,"TestPingServer: ok",!0,x):hl(O,"TestPingServer: server error",!1,x)}).catch(()=>{clearTimeout(K),hl(O,"TestPingServer: error",!1,x)})}function hl(U,x,O,B,K){try{K&&(K.onload=null,K.onerror=null,K.onabort=null,K.ontimeout=null),B(O)}catch{}}function kW(){this.g=new gW}function LW(U,x,O){const B=O||"";try{zT(U,function(K,J){let fe=K;c(K)&&(fe=cy(K)),x.push(B+J+"="+encodeURIComponent(fe))})}catch(K){throw x.push(B+"type="+encodeURIComponent("_badmap")),K}}function bp(U){this.l=U.Ub||null,this.j=U.eb||!1}m(bp,uy),bp.prototype.g=function(){return new yp(this.l,this.j)},bp.prototype.i=function(U){return function(){return U}}({});function yp(U,x){Ti.call(this),this.D=U,this.o=x,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}m(yp,Ti),e=yp.prototype,e.open=function(U,x){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=U,this.A=x,this.readyState=1,T1(this)},e.send=function(U){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const x={headers:this.u,method:this.B,credentials:this.m,cache:void 0};U&&(x.body=U),(this.D||a).fetch(new Request(this.A,x)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,w1(this)),this.readyState=0},e.Sa=function(U){if(this.g&&(this.l=U,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=U.headers,this.readyState=2,T1(this)),this.g&&(this.readyState=3,T1(this),this.g)))if(this.responseType==="arraybuffer")U.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in U){if(this.j=U.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;YT(this)}else U.text().then(this.Ra.bind(this),this.ga.bind(this))};function YT(U){U.j.read().then(U.Pa.bind(U)).catch(U.ga.bind(U))}e.Pa=function(U){if(this.g){if(this.o&&U.value)this.response.push(U.value);else if(!this.o){var x=U.value?U.value:new Uint8Array(0);(x=this.v.decode(x,{stream:!U.done}))&&(this.response=this.responseText+=x)}U.done?w1(this):T1(this),this.readyState==3&&YT(this)}},e.Ra=function(U){this.g&&(this.response=this.responseText=U,w1(this))},e.Qa=function(U){this.g&&(this.response=U,w1(this))},e.ga=function(){this.g&&w1(this)};function w1(U){U.readyState=4,U.l=null,U.j=null,U.v=null,T1(U)}e.setRequestHeader=function(U,x){this.u.append(U,x)},e.getResponseHeader=function(U){return this.h&&this.h.get(U.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const U=[],x=this.h.entries();for(var O=x.next();!O.done;)O=O.value,U.push(O[0]+": "+O[1]),O=x.next();return U.join(`\r
`)};function T1(U){U.onreadystatechange&&U.onreadystatechange.call(U)}Object.defineProperty(yp.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(U){this.m=U?"include":"same-origin"}});function WT(U){let x="";return R(U,function(O,B){x+=B,x+=":",x+=O,x+=`\r
`}),x}function Ey(U,x,O){e:{for(B in O){var B=!1;break e}B=!0}B||(O=WT(O),typeof U=="string"?O!=null&&encodeURIComponent(String(O)):Yt(U,x,O))}function pn(U){Ti.call(this),this.headers=new Map,this.o=U||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}m(pn,Ti);var DW=/^https?$/i,NW=["POST","PUT"];e=pn.prototype,e.Ha=function(U){this.J=U},e.ea=function(U,x,O,B){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+U);x=x?x.toUpperCase():"GET",this.D=U,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():hy.g(),this.v=this.o?wT(this.o):wT(hy),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(x,String(U),!0),this.B=!1}catch(J){KT(this,J);return}if(U=O||"",O=new Map(this.headers),B)if(Object.getPrototypeOf(B)===Object.prototype)for(var K in B)O.set(K,B[K]);else if(typeof B.keys=="function"&&typeof B.get=="function")for(const J of B.keys())O.set(J,B.get(J));else throw Error("Unknown input type for opt_headers: "+String(B));B=Array.from(O.keys()).find(J=>J.toLowerCase()=="content-type"),K=a.FormData&&U instanceof a.FormData,!(0<=Array.prototype.indexOf.call(NW,x,void 0))||B||K||O.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[J,fe]of O)this.g.setRequestHeader(J,fe);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{QT(this),this.u=!0,this.g.send(U),this.u=!1}catch(J){KT(this,J)}};function KT(U,x){U.h=!1,U.g&&(U.j=!0,U.g.abort(),U.j=!1),U.l=x,U.m=5,ZT(U),Ep(U)}function ZT(U){U.A||(U.A=!0,Vi(U,"complete"),Vi(U,"error"))}e.abort=function(U){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=U||7,Vi(this,"complete"),Vi(this,"abort"),Ep(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Ep(this,!0)),pn.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?qT(this):this.bb())},e.bb=function(){qT(this)};function qT(U){if(U.h&&typeof o<"u"&&(!U.v[1]||ea(U)!=4||U.Z()!=2)){if(U.u&&ea(U)==4)yT(U.Ea,0,U);else if(Vi(U,"readystatechange"),ea(U)==4){U.h=!1;try{const fe=U.Z();e:switch(fe){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var x=!0;break e;default:x=!1}var O;if(!(O=x)){var B;if(B=fe===0){var K=String(U.D).match(HT)[1]||null;!K&&a.self&&a.self.location&&(K=a.self.location.protocol.slice(0,-1)),B=!DW.test(K?K.toLowerCase():"")}O=B}if(O)Vi(U,"complete"),Vi(U,"success");else{U.m=6;try{var J=2<ea(U)?U.g.statusText:""}catch{J=""}U.l=J+" ["+U.Z()+"]",ZT(U)}}finally{Ep(U)}}}}function Ep(U,x){if(U.g){QT(U);const O=U.g,B=U.v[0]?()=>{}:null;U.g=null,U.v=null,x||Vi(U,"ready");try{O.onreadystatechange=B}catch{}}}function QT(U){U.I&&(a.clearTimeout(U.I),U.I=null)}e.isActive=function(){return!!this.g};function ea(U){return U.g?U.g.readyState:0}e.Z=function(){try{return 2<ea(this)?this.g.status:-1}catch{return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},e.Oa=function(U){if(this.g){var x=this.g.responseText;return U&&x.indexOf(U)==0&&(x=x.substring(U.length)),hW(x)}};function JT(U){try{if(!U.g)return null;if("response"in U.g)return U.g.response;switch(U.H){case"":case"text":return U.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in U.g)return U.g.mozResponseArrayBuffer}return null}catch{return null}}function OW(U){const x={};U=(U.g&&2<=ea(U)&&U.g.getAllResponseHeaders()||"").split(`\r
`);for(let B=0;B<U.length;B++){if(y(U[B]))continue;var O=k(U[B]);const K=O[0];if(O=O[1],typeof O!="string")continue;O=O.trim();const J=x[K]||[];x[K]=J,J.push(O)}w(x,function(B){return B.join(", ")})}e.Ba=function(){return this.m},e.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function S1(U,x,O){return O&&O.internalChannelParams&&O.internalChannelParams[U]||x}function eS(U){this.Aa=0,this.i=[],this.j=new b1,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=S1("failFast",!1,U),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=S1("baseRetryDelayMs",5e3,U),this.cb=S1("retryDelaySeedMs",1e4,U),this.Wa=S1("forwardChannelMaxRetries",2,U),this.wa=S1("forwardChannelRequestTimeoutMs",2e4,U),this.pa=U&&U.xmlHttpFactory||void 0,this.Xa=U&&U.Tb||void 0,this.Ca=U&&U.useFetchStreams||!1,this.L=void 0,this.J=U&&U.supportsCrossDomainXhr||!1,this.K="",this.h=new NT(U&&U.concurrentRequestLimit),this.Da=new kW,this.P=U&&U.fastHandshake||!1,this.O=U&&U.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=U&&U.Rb||!1,U&&U.xa&&this.j.xa(),U&&U.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&U&&U.detectBufferingProxy||!1,this.ja=void 0,U&&U.longPollingTimeout&&0<U.longPollingTimeout&&(this.ja=U.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}e=eS.prototype,e.la=8,e.G=1,e.connect=function(U,x,O,B){$i(0),this.W=U,this.H=x||{},O&&B!==void 0&&(this.H.OSID=O,this.H.OAID=B),this.F=this.X,this.I=cS(this,null,this.W),_p(this)};function vy(U){if(tS(U),U.G==3){var x=U.U++,O=Jo(U.I);if(Yt(O,"SID",U.K),Yt(O,"RID",x),Yt(O,"TYPE","terminate"),I1(U,O),x=new dl(U,U.j,x),x.L=2,x.v=Up(Jo(O)),O=!1,a.navigator&&a.navigator.sendBeacon)try{O=a.navigator.sendBeacon(x.v.toString(),"")}catch{}!O&&a.Image&&(new Image().src=x.v,O=!0),O||(x.g=uS(x.j,null),x.g.ea(x.v)),x.F=Date.now(),gp(x)}lS(U)}function vp(U){U.g&&(wy(U),U.g.cancel(),U.g=null)}function tS(U){vp(U),U.u&&(a.clearTimeout(U.u),U.u=null),wp(U),U.h.cancel(),U.s&&(typeof U.s=="number"&&a.clearTimeout(U.s),U.s=null)}function _p(U){if(!OT(U.h)&&!U.s){U.s=!0;var x=U.Ga;$||Y(),j||($(),j=!0),X.add(x,U),U.B=0}}function PW(U,x){return PT(U.h)>=U.h.j-(U.s?1:0)?!1:U.s?(U.i=x.D.concat(U.i),!0):U.G==1||U.G==2||U.B>=(U.Va?0:U.Wa)?!1:(U.s=U1(f(U.Ga,U,x),aS(U,U.B)),U.B++,!0)}e.Ga=function(U){if(this.s)if(this.s=null,this.G==1){if(!U){this.U=Math.floor(1e5*Math.random()),U=this.U++;const K=new dl(this,this.j,U);let J=this.o;if(this.S&&(J?(J=T(J),S(J,this.S)):J=this.S),this.m!==null||this.O||(K.H=J,J=null),this.P)e:{for(var x=0,O=0;O<this.i.length;O++){t:{var B=this.i[O];if("__data__"in B.map&&(B=B.map.__data__,typeof B=="string")){B=B.length;break t}B=void 0}if(B===void 0)break;if(x+=B,4096<x){x=O;break e}if(x===4096||O===this.i.length-1){x=O+1;break e}}x=1e3}else x=1e3;x=iS(this,K,x),O=Jo(this.I),Yt(O,"RID",U),Yt(O,"CVER",22),this.D&&Yt(O,"X-HTTP-Session-Id",this.D),I1(this,O),J&&(this.O?x="headers="+encodeURIComponent(String(WT(J)))+"&"+x:this.m&&Ey(O,this.m,J)),yy(this.h,K),this.Ua&&Yt(O,"TYPE","init"),this.P?(Yt(O,"$req",x),Yt(O,"SID","null"),K.T=!0,my(K,O,null)):my(K,O,x),this.G=2}}else this.G==3&&(U?nS(this,U):this.i.length==0||OT(this.h)||nS(this))};function nS(U,x){var O;x?O=x.l:O=U.U++;const B=Jo(U.I);Yt(B,"SID",U.K),Yt(B,"RID",O),Yt(B,"AID",U.T),I1(U,B),U.m&&U.o&&Ey(B,U.m,U.o),O=new dl(U,U.j,O,U.B+1),U.m===null&&(O.H=U.o),x&&(U.i=x.D.concat(U.i)),x=iS(U,O,1e3),O.I=Math.round(.5*U.wa)+Math.round(.5*U.wa*Math.random()),yy(U.h,O),my(O,B,x)}function I1(U,x){U.H&&R(U.H,function(O,B){Yt(x,B,O)}),U.l&&zT({},function(O,B){Yt(x,B,O)})}function iS(U,x,O){O=Math.min(U.i.length,O);var B=U.l?f(U.l.Na,U.l,U):null;e:{var K=U.i;let J=-1;for(;;){const fe=["count="+O];J==-1?0<O?(J=K[0].g,fe.push("ofs="+J)):J=0:fe.push("ofs="+J);let Ot=!0;for(let hi=0;hi<O;hi++){let bt=K[hi].g;const Si=K[hi].map;if(bt-=J,0>bt)J=Math.max(0,K[hi].g-100),Ot=!1;else try{LW(Si,fe,"req"+bt+"_")}catch{B&&B(Si)}}if(Ot){B=fe.join("&");break e}}}return U=U.i.splice(0,O),x.D=U,B}function rS(U){if(!U.g&&!U.u){U.Y=1;var x=U.Fa;$||Y(),j||($(),j=!0),X.add(x,U),U.v=0}}function _y(U){return U.g||U.u||3<=U.v?!1:(U.Y++,U.u=U1(f(U.Fa,U),aS(U,U.v)),U.v++,!0)}e.Fa=function(){if(this.u=null,sS(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var U=2*this.R;this.j.info("BP detection timer enabled: "+U),this.A=U1(f(this.ab,this),U)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,$i(10),vp(this),sS(this))};function wy(U){U.A!=null&&(a.clearTimeout(U.A),U.A=null)}function sS(U){U.g=new dl(U,U.j,"rpc",U.Y),U.m===null&&(U.g.H=U.o),U.g.O=0;var x=Jo(U.qa);Yt(x,"RID","rpc"),Yt(x,"SID",U.K),Yt(x,"AID",U.T),Yt(x,"CI",U.F?"0":"1"),!U.F&&U.ja&&Yt(x,"TO",U.ja),Yt(x,"TYPE","xmlhttp"),I1(U,x),U.m&&U.o&&Ey(x,U.m,U.o),U.L&&(U.g.I=U.L);var O=U.g;U=U.ia,O.L=1,O.v=Up(Jo(x)),O.m=null,O.P=!0,kT(O,U)}e.Za=function(){this.C!=null&&(this.C=null,vp(this),_y(this),$i(19))};function wp(U){U.C!=null&&(a.clearTimeout(U.C),U.C=null)}function oS(U,x){var O=null;if(U.g==x){wp(U),wy(U),U.g=null;var B=2}else if(by(U.h,x))O=x.D,FT(U.h,x),B=1;else return;if(U.G!=0){if(x.o)if(B==1){O=x.m?x.m.length:0,x=Date.now()-x.F;var K=U.B;B=dp(),Vi(B,new CT(B,O)),_p(U)}else rS(U);else if(K=x.s,K==3||K==0&&0<x.X||!(B==1&&PW(U,x)||B==2&&_y(U)))switch(O&&0<O.length&&(x=U.h,x.i=x.i.concat(O)),K){case 1:jc(U,5);break;case 4:jc(U,10);break;case 3:jc(U,6);break;default:jc(U,2)}}}function aS(U,x){let O=U.Ta+Math.floor(Math.random()*U.cb);return U.isActive()||(O*=2),O*x}function jc(U,x){if(U.j.info("Error code "+x),x==2){var O=f(U.fb,U),B=U.Xa;const K=!B;B=new Xc(B||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||mp(B,"https"),Up(B),K?MW(B.toString(),O):RW(B.toString(),O)}else $i(2);U.G=0,U.l&&U.l.sa(x),lS(U),tS(U)}e.fb=function(U){U?(this.j.info("Successfully pinged google.com"),$i(2)):(this.j.info("Failed to ping google.com"),$i(1))};function lS(U){if(U.G=0,U.ka=[],U.l){const x=BT(U.h);(x.length!=0||U.i.length!=0)&&(b(U.ka,x),b(U.ka,U.i),U.h.i.length=0,p(U.i),U.i.length=0),U.l.ra()}}function cS(U,x,O){var B=O instanceof Xc?Jo(O):new Xc(O);if(B.g!="")x&&(B.g=x+"."+B.g),pp(B,B.s);else{var K=a.location;B=K.protocol,x=x?x+"."+K.hostname:K.hostname,K=+K.port;var J=new Xc(null);B&&mp(J,B),x&&(J.g=x),K&&pp(J,K),O&&(J.l=O),B=J}return O=U.D,x=U.ya,O&&x&&Yt(B,O,x),Yt(B,"VER",U.la),I1(U,B),B}function uS(U,x,O){if(x&&!U.J)throw Error("Can't create secondary domain capable XhrIo object.");return x=U.Ca&&!U.pa?new pn(new bp({eb:O})):new pn(U.pa),x.Ha(U.J),x}e.isActive=function(){return!!this.l&&this.l.isActive(this)};function dS(){}e=dS.prototype,e.ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){};function Tp(){}Tp.prototype.g=function(U,x){return new _r(U,x)};function _r(U,x){Ti.call(this),this.g=new eS(x),this.l=U,this.h=x&&x.messageUrlParams||null,U=x&&x.messageHeaders||null,x&&x.clientProtocolHeaderRequired&&(U?U["X-Client-Protocol"]="webchannel":U={"X-Client-Protocol":"webchannel"}),this.g.o=U,U=x&&x.initMessageHeaders||null,x&&x.messageContentType&&(U?U["X-WebChannel-Content-Type"]=x.messageContentType:U={"X-WebChannel-Content-Type":x.messageContentType}),x&&x.va&&(U?U["X-WebChannel-Client-Profile"]=x.va:U={"X-WebChannel-Client-Profile":x.va}),this.g.S=U,(U=x&&x.Sb)&&!y(U)&&(this.g.m=U),this.v=x&&x.supportsCrossDomainXhr||!1,this.u=x&&x.sendRawJson||!1,(x=x&&x.httpSessionIdParam)&&!y(x)&&(this.g.D=x,U=this.h,U!==null&&x in U&&(U=this.h,x in U&&delete U[x])),this.j=new Hd(this)}m(_r,Ti),_r.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},_r.prototype.close=function(){vy(this.g)},_r.prototype.o=function(U){var x=this.g;if(typeof U=="string"){var O={};O.__data__=U,U=O}else this.u&&(O={},O.__data__=cy(U),U=O);x.i.push(new EW(x.Ya++,U)),x.G==3&&_p(x)},_r.prototype.N=function(){this.g.l=null,delete this.j,vy(this.g),delete this.g,_r.aa.N.call(this)};function fS(U){dy.call(this),U.__headers__&&(this.headers=U.__headers__,this.statusCode=U.__status__,delete U.__headers__,delete U.__status__);var x=U.__sm__;if(x){e:{for(const O in x){U=O;break e}U=void 0}(this.i=U)&&(U=this.i,x=x!==null&&U in x?x[U]:void 0),this.data=x}else this.data=U}m(fS,dy);function hS(){fy.call(this),this.status=1}m(hS,fy);function Hd(U){this.g=U}m(Hd,dS),Hd.prototype.ua=function(){Vi(this.g,"a")},Hd.prototype.ta=function(U){Vi(this.g,new fS(U))},Hd.prototype.sa=function(U){Vi(this.g,new hS)},Hd.prototype.ra=function(){Vi(this.g,"b")},Tp.prototype.createWebChannel=Tp.prototype.g,_r.prototype.send=_r.prototype.o,_r.prototype.open=_r.prototype.m,_r.prototype.close=_r.prototype.close,pj=function(){return new Tp},mj=function(){return dp()},gj=$c,x4={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},fp.NO_ERROR=0,fp.TIMEOUT=8,fp.HTTP_ERROR=6,U2=fp,AT.COMPLETE="complete",hj=AT,TT.EventType=m1,m1.OPEN="a",m1.CLOSE="b",m1.ERROR="c",m1.MESSAGE="d",Ti.prototype.listen=Ti.prototype.K,vg=TT,pn.prototype.listenOnce=pn.prototype.L,pn.prototype.getLastError=pn.prototype.Ka,pn.prototype.getLastErrorCode=pn.prototype.Ba,pn.prototype.getStatus=pn.prototype.Z,pn.prototype.getResponseJson=pn.prototype.Oa,pn.prototype.getResponseText=pn.prototype.oa,pn.prototype.send=pn.prototype.ea,pn.prototype.setWithCredentials=pn.prototype.Ha,fj=pn}).apply(typeof _U<"u"?_U:typeof self<"u"?self:typeof window<"u"?window:{});const wk="@firebase/firestore",Tk="4.7.8";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ki{constructor(t){this.uid=t}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}ki.UNAUTHENTICATED=new ki(null),ki.GOOGLE_CREDENTIALS=new ki("google-credentials-uid"),ki.FIRST_PARTY=new ki("first-party-uid"),ki.MOCK_USER=new ki("mock-user");/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let u1="11.3.1";/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ud=new tj("@firebase/firestore");function ff(){return Ud.logLevel}function Ee(e,...t){if(Ud.logLevel<=ct.DEBUG){const n=t.map(Rw);Ud.debug(`Firestore (${u1}): ${e}`,...n)}}function il(e,...t){if(Ud.logLevel<=ct.ERROR){const n=t.map(Rw);Ud.error(`Firestore (${u1}): ${e}`,...n)}}function Ph(e,...t){if(Ud.logLevel<=ct.WARN){const n=t.map(Rw);Ud.warn(`Firestore (${u1}): ${e}`,...n)}}function Rw(e){if(typeof e=="string")return e;try{/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/return function(n){return JSON.stringify(n)}(e)}catch{return e}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Ae(e="Unexpected state"){const t=`FIRESTORE (${u1}) INTERNAL ASSERTION FAILED: `+e;throw il(t),new Error(t)}function Bt(e,t){e||Ae()}function nt(e,t){return e}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const re={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Te extends Dd{constructor(t,n){super(t,n),this.code=t,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class uc{constructor(){this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Uj{constructor(t,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class c9e{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,n){t.enqueueRetryable(()=>n(ki.UNAUTHENTICATED))}shutdown(){}}class u9e{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,n){this.changeListener=n,t.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class d9e{constructor(t){this.t=t,this.currentUser=ki.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,n){Bt(this.o===void 0);let i=this.i;const r=l=>this.i!==i?(i=this.i,n(l)):Promise.resolve();let s=new uc;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new uc,t.enqueueRetryable(()=>r(this.currentUser))};const o=()=>{const l=s;t.enqueueRetryable(async()=>{await l.promise,await r(this.currentUser)})},a=l=>{Ee("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(Ee("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new uc)}},0),o()}getToken(){const t=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(i=>this.i!==t?(Ee("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):i?(Bt(typeof i.accessToken=="string"),new Uj(i.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const t=this.auth&&this.auth.getUid();return Bt(t===null||typeof t=="string"),new ki(t)}}class f9e{constructor(t,n,i){this.l=t,this.h=n,this.P=i,this.type="FirstParty",this.user=ki.FIRST_PARTY,this.T=new Map}I(){return this.P?this.P():null}get headers(){this.T.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.T.set("Authorization",t),this.h&&this.T.set("X-Goog-Iam-Authorization-Token",this.h),this.T}}class h9e{constructor(t,n,i){this.l=t,this.h=n,this.P=i}getToken(){return Promise.resolve(new f9e(this.l,this.h,this.P))}start(t,n){t.enqueueRetryable(()=>n(ki.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Sk{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class g9e{constructor(t,n){this.A=n,this.forceRefresh=!1,this.appCheck=null,this.R=null,this.V=null,sj(t)&&t.settings.appCheckToken&&(this.V=t.settings.appCheckToken)}start(t,n){Bt(this.o===void 0);const i=s=>{s.error!=null&&Ee("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,Ee("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{t.enqueueRetryable(()=>i(s))};const r=s=>{Ee("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>r(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?r(s):Ee("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.V)return Promise.resolve(new Sk(this.V));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(n=>n?(Bt(typeof n.token=="string"),this.R=n.token,new Sk(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function m9e(e){const t=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let i=0;i<e;i++)n[i]=Math.floor(256*Math.random());return n}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class bj{static newId(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=62*Math.floor(4.129032258064516);let i="";for(;i.length<20;){const r=m9e(40);for(let s=0;s<r.length;++s)i.length<20&&r[s]<n&&(i+=t.charAt(r[s]%62))}return i}}function dt(e,t){return e<t?-1:e>t?1:0}function Fh(e,t,n){return e.length===t.length&&e.every((i,r)=>n(i,t[r]))}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ik=-62135596800,xk=1e6;class di{static now(){return di.fromMillis(Date.now())}static fromDate(t){return di.fromMillis(t.getTime())}static fromMillis(t){const n=Math.floor(t/1e3),i=Math.floor((t-1e3*n)*xk);return new di(n,i)}constructor(t,n){if(this.seconds=t,this.nanoseconds=n,n<0)throw new Te(re.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new Te(re.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<Ik)throw new Te(re.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Te(re.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/xk}_compareTo(t){return this.seconds===t.seconds?dt(this.nanoseconds,t.nanoseconds):dt(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds-Ik;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Le{static fromTimestamp(t){return new Le(t)}static min(){return new Le(new di(0,0))}static max(){return new Le(new di(253402300799,999999999))}constructor(t){this.timestamp=t}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ck="__name__";class vo{constructor(t,n,i){n===void 0?n=0:n>t.length&&Ae(),i===void 0?i=t.length-n:i>t.length-n&&Ae(),this.segments=t,this.offset=n,this.len=i}get length(){return this.len}isEqual(t){return vo.comparator(this,t)===0}child(t){const n=this.segments.slice(this.offset,this.limit());return t instanceof vo?t.forEach(i=>{n.push(i)}):n.push(t),this.construct(n)}limit(){return this.offset+this.length}popFirst(t){return t=t===void 0?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return this.length===0}isPrefixOf(t){if(t.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==t.get(n))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==t.get(n))return!1;return!0}forEach(t){for(let n=this.offset,i=this.limit();n<i;n++)t(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,n){const i=Math.min(t.length,n.length);for(let r=0;r<i;r++){const s=vo.compareSegments(t.get(r),n.get(r));if(s!==0)return s}return Math.sign(t.length-n.length)}static compareSegments(t,n){const i=vo.isNumericId(t),r=vo.isNumericId(n);return i&&!r?-1:!i&&r?1:i&&r?vo.extractNumericId(t).compare(vo.extractNumericId(n)):t<n?-1:t>n?1:0}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return cc.fromString(t.substring(4,t.length-2))}}class rn extends vo{construct(t,n,i){return new rn(t,n,i)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const n=[];for(const i of t){if(i.indexOf("//")>=0)throw new Te(re.INVALID_ARGUMENT,`Invalid segment (${i}). Paths must not contain // in them.`);n.push(...i.split("/").filter(r=>r.length>0))}return new rn(n)}static emptyPath(){return new rn([])}}const p9e=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Ni extends vo{construct(t,n,i){return new Ni(t,n,i)}static isValidIdentifier(t){return p9e.test(t)}canonicalString(){return this.toArray().map(t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Ni.isValidIdentifier(t)||(t="`"+t+"`"),t)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Ck}static keyField(){return new Ni([Ck])}static fromServerFormat(t){const n=[];let i="",r=0;const s=()=>{if(i.length===0)throw new Te(re.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(i),i=""};let o=!1;for(;r<t.length;){const a=t[r];if(a==="\\"){if(r+1===t.length)throw new Te(re.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const l=t[r+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new Te(re.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);i+=l,r+=2}else a==="`"?(o=!o,r++):a!=="."||o?(i+=a,r++):(s(),r++)}if(s(),o)throw new Te(re.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Ni(n)}static emptyPath(){return new Ni([])}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Me{constructor(t){this.path=t}static fromPath(t){return new Me(rn.fromString(t))}static fromName(t){return new Me(rn.fromString(t).popFirst(5))}static empty(){return new Me(rn.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return t!==null&&rn.comparator(this.path,t.path)===0}toString(){return this.path.toString()}static comparator(t,n){return rn.comparator(t.path,n.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Me(new rn(t.slice()))}}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const hm=-1;function U9e(e,t){const n=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1,r=Le.fromTimestamp(i===1e9?new di(n+1,0):new di(n,i));return new Cc(r,Me.empty(),t)}function b9e(e){return new Cc(e.readTime,e.key,hm)}class Cc{constructor(t,n,i){this.readTime=t,this.documentKey=n,this.largestBatchId=i}static min(){return new Cc(Le.min(),Me.empty(),hm)}static max(){return new Cc(Le.max(),Me.empty(),hm)}}function y9e(e,t){let n=e.readTime.compareTo(t.readTime);return n!==0?n:(n=Me.comparator(e.documentKey,t.documentKey),n!==0?n:dt(e.largestBatchId,t.largestBatchId))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const E9e="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class v9e{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(t=>t())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function X5(e){if(e.code!==re.FAILED_PRECONDITION||e.message!==E9e)throw e;Ee("LocalStore","Unexpectedly lost primary lease")}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ie{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(t){return this.next(void 0,t)}next(t,n){return this.callbackAttached&&Ae(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new ie((i,r)=>{this.nextCallback=s=>{this.wrapSuccess(t,s).next(i,r)},this.catchCallback=s=>{this.wrapFailure(n,s).next(i,r)}})}toPromise(){return new Promise((t,n)=>{this.next(t,n)})}wrapUserFunction(t){try{const n=t();return n instanceof ie?n:ie.resolve(n)}catch(n){return ie.reject(n)}}wrapSuccess(t,n){return t?this.wrapUserFunction(()=>t(n)):ie.resolve(n)}wrapFailure(t,n){return t?this.wrapUserFunction(()=>t(n)):ie.reject(n)}static resolve(t){return new ie((n,i)=>{n(t)})}static reject(t){return new ie((n,i)=>{i(t)})}static waitFor(t){return new ie((n,i)=>{let r=0,s=0,o=!1;t.forEach(a=>{++r,a.next(()=>{++s,o&&s===r&&n()},l=>i(l))}),o=!0,s===r&&n()})}static or(t){let n=ie.resolve(!1);for(const i of t)n=n.next(r=>r?ie.resolve(r):i());return n}static forEach(t,n){const i=[];return t.forEach((r,s)=>{i.push(n.call(this,r,s))}),this.waitFor(i)}static mapArray(t,n){return new ie((i,r)=>{const s=t.length,o=new Array(s);let a=0;for(let l=0;l<s;l++){const c=l;n(t[c]).next(u=>{o[c]=u,++a,a===s&&i(o)},u=>r(u))}})}static doWhile(t,n){return new ie((i,r)=>{const s=()=>{t()===!0?n().next(()=>{s()},r):i()};s()})}}function _9e(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function d1(e){return e.name==="IndexedDbTransactionError"}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class j5{constructor(t,n){this.previousValue=t,n&&(n.sequenceNumberHandler=i=>this.oe(i),this._e=i=>n.writeSequenceNumber(i))}oe(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this._e&&this._e(t),t}}j5.ae=-1;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const w9e=-1;function sp(e){return e==null}function i6(e){return e===0&&1/e==-1/0}function T9e(e){return typeof e=="number"&&Number.isInteger(e)&&!i6(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const yj="";function S9e(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=Ak(t)),t=I9e(e.get(n),t);return Ak(t)}function I9e(e,t){let n=t;const i=e.length;for(let r=0;r<i;r++){const s=e.charAt(r);switch(s){case"\0":n+="";break;case yj:n+="";break;default:n+=s}}return n}function Ak(e){return e+yj+""}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Mk(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Nd(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Ej(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class An{constructor(t,n){this.comparator=t,this.root=n||bi.EMPTY}insert(t,n){return new An(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,bi.BLACK,null,null))}remove(t){return new An(this.comparator,this.root.remove(t,this.comparator).copy(null,null,bi.BLACK,null,null))}get(t){let n=this.root;for(;!n.isEmpty();){const i=this.comparator(t,n.key);if(i===0)return n.value;i<0?n=n.left:i>0&&(n=n.right)}return null}indexOf(t){let n=0,i=this.root;for(;!i.isEmpty();){const r=this.comparator(t,i.key);if(r===0)return n+i.left.size;r<0?i=i.left:(n+=i.left.size+1,i=i.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((n,i)=>(t(n,i),!1))}toString(){const t=[];return this.inorderTraversal((n,i)=>(t.push(`${n}:${i}`),!1)),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new wU(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new wU(this.root,t,this.comparator,!1)}getReverseIterator(){return new wU(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new wU(this.root,t,this.comparator,!0)}}class wU{constructor(t,n,i,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=n?i(t.key,n):1,n&&r&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(s===0){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const n={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class bi{constructor(t,n,i,r,s){this.key=t,this.value=n,this.color=i??bi.RED,this.left=r??bi.EMPTY,this.right=s??bi.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,n,i,r,s){return new bi(t??this.key,n??this.value,i??this.color,r??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,n,i){let r=this;const s=i(t,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(t,n,i),null):s===0?r.copy(null,n,null,null,null):r.copy(null,null,null,null,r.right.insert(t,n,i)),r.fixUp()}removeMin(){if(this.left.isEmpty())return bi.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,n){let i,r=this;if(n(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,n),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),n(t,r.key)===0){if(r.right.isEmpty())return bi.EMPTY;i=r.right.min(),r=r.copy(i.key,i.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,n))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,bi.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,bi.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,n)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw Ae();const t=this.left.check();if(t!==this.right.check())throw Ae();return t+(this.isRed()?0:1)}}bi.EMPTY=null,bi.RED=!0,bi.BLACK=!1;bi.EMPTY=new class{constructor(){this.size=0}get key(){throw Ae()}get value(){throw Ae()}get color(){throw Ae()}get left(){throw Ae()}get right(){throw Ae()}copy(t,n,i,r,s){return this}insert(t,n,i){return new bi(t,n)}remove(t,n){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Zn{constructor(t){this.comparator=t,this.data=new An(this.comparator)}has(t){return this.data.get(t)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((n,i)=>(t(n),!1))}forEachInRange(t,n){const i=this.data.getIteratorFrom(t[0]);for(;i.hasNext();){const r=i.getNext();if(this.comparator(r.key,t[1])>=0)return;n(r.key)}}forEachWhile(t,n){let i;for(i=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();i.hasNext();)if(!t(i.getNext().key))return}firstAfterOrEqual(t){const n=this.data.getIteratorFrom(t);return n.hasNext()?n.getNext().key:null}getIterator(){return new Rk(this.data.getIterator())}getIteratorFrom(t){return new Rk(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let n=this;return n.size<t.size&&(n=t,t=this),t.forEach(i=>{n=n.add(i)}),n}isEqual(t){if(!(t instanceof Zn)||this.size!==t.size)return!1;const n=this.data.getIterator(),i=t.data.getIterator();for(;n.hasNext();){const r=n.getNext().key,s=i.getNext().key;if(this.comparator(r,s)!==0)return!1}return!0}toArray(){const t=[];return this.forEach(n=>{t.push(n)}),t}toString(){const t=[];return this.forEach(n=>t.push(n)),"SortedSet("+t.toString()+")"}copy(t){const n=new Zn(this.comparator);return n.data=t,n}}class Rk{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class os{constructor(t){this.fields=t,t.sort(Ni.comparator)}static empty(){return new os([])}unionWith(t){let n=new Zn(Ni.comparator);for(const i of this.fields)n=n.add(i);for(const i of t)n=n.add(i);return new os(n.toArray())}covers(t){for(const n of this.fields)if(n.isPrefixOf(t))return!0;return!1}isEqual(t){return Fh(this.fields,t.fields,(n,i)=>n.isEqual(i))}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class vj extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class wi{constructor(t){this.binaryString=t}static fromBase64String(t){const n=function(r){try{return atob(r)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new vj("Invalid base64 string: "+s):s}}(t);return new wi(n)}static fromUint8Array(t){const n=function(r){let s="";for(let o=0;o<r.length;++o)s+=String.fromCharCode(r[o]);return s}(t);return new wi(n)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(n){return btoa(n)}(this.binaryString)}toUint8Array(){return function(n){const i=new Uint8Array(n.length);for(let r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return dt(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}wi.EMPTY_BYTE_STRING=new wi("");const x9e=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ac(e){if(Bt(!!e),typeof e=="string"){let t=0;const n=x9e.exec(e);if(Bt(!!n),n[1]){let r=n[1];r=(r+"000000000").substr(0,9),t=Number(r)}const i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:In(e.seconds),nanos:In(e.nanos)}}function In(e){return typeof e=="number"?e:typeof e=="string"?Number(e):0}function Mc(e){return typeof e=="string"?wi.fromBase64String(e):wi.fromUint8Array(e)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const _j="server_timestamp",wj="__type__",Tj="__previous_value__",Sj="__local_write_time__";function kw(e){var t,n;return((n=(((t=e==null?void 0:e.mapValue)===null||t===void 0?void 0:t.fields)||{})[wj])===null||n===void 0?void 0:n.stringValue)===_j}function Y5(e){const t=e.mapValue.fields[Tj];return kw(t)?Y5(t):t}function gm(e){const t=Ac(e.mapValue.fields[Sj].timestampValue);return new di(t.seconds,t.nanos)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class C9e{constructor(t,n,i,r,s,o,a,l,c){this.databaseId=t,this.appId=n,this.persistenceKey=i,this.host=r,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=l,this.useFetchStreams=c}}const r6="(default)";class mm{constructor(t,n){this.projectId=t,this.database=n||r6}static empty(){return new mm("","")}get isDefaultDatabase(){return this.database===r6}isEqual(t){return t instanceof mm&&t.projectId===this.projectId&&t.database===this.database}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ij="__type__",A9e="__max__",TU={mapValue:{}},xj="__vector__",s6="value";function Rc(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?kw(e)?4:R9e(e)?9007199254740991:M9e(e)?10:11:Ae()}function Xo(e,t){if(e===t)return!0;const n=Rc(e);if(n!==Rc(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return gm(e).isEqual(gm(t));case 3:return function(r,s){if(typeof r.timestampValue=="string"&&typeof s.timestampValue=="string"&&r.timestampValue.length===s.timestampValue.length)return r.timestampValue===s.timestampValue;const o=Ac(r.timestampValue),a=Ac(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(r,s){return Mc(r.bytesValue).isEqual(Mc(s.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(r,s){return In(r.geoPointValue.latitude)===In(s.geoPointValue.latitude)&&In(r.geoPointValue.longitude)===In(s.geoPointValue.longitude)}(e,t);case 2:return function(r,s){if("integerValue"in r&&"integerValue"in s)return In(r.integerValue)===In(s.integerValue);if("doubleValue"in r&&"doubleValue"in s){const o=In(r.doubleValue),a=In(s.doubleValue);return o===a?i6(o)===i6(a):isNaN(o)&&isNaN(a)}return!1}(e,t);case 9:return Fh(e.arrayValue.values||[],t.arrayValue.values||[],Xo);case 10:case 11:return function(r,s){const o=r.mapValue.fields||{},a=s.mapValue.fields||{};if(Mk(o)!==Mk(a))return!1;for(const l in o)if(o.hasOwnProperty(l)&&(a[l]===void 0||!Xo(o[l],a[l])))return!1;return!0}(e,t);default:return Ae()}}function pm(e,t){return(e.values||[]).find(n=>Xo(n,t))!==void 0}function Bh(e,t){if(e===t)return 0;const n=Rc(e),i=Rc(t);if(n!==i)return dt(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return dt(e.booleanValue,t.booleanValue);case 2:return function(s,o){const a=In(s.integerValue||s.doubleValue),l=In(o.integerValue||o.doubleValue);return a<l?-1:a>l?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(e,t);case 3:return kk(e.timestampValue,t.timestampValue);case 4:return kk(gm(e),gm(t));case 5:return dt(e.stringValue,t.stringValue);case 6:return function(s,o){const a=Mc(s),l=Mc(o);return a.compareTo(l)}(e.bytesValue,t.bytesValue);case 7:return function(s,o){const a=s.split("/"),l=o.split("/");for(let c=0;c<a.length&&c<l.length;c++){const u=dt(a[c],l[c]);if(u!==0)return u}return dt(a.length,l.length)}(e.referenceValue,t.referenceValue);case 8:return function(s,o){const a=dt(In(s.latitude),In(o.latitude));return a!==0?a:dt(In(s.longitude),In(o.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return Lk(e.arrayValue,t.arrayValue);case 10:return function(s,o){var a,l,c,u;const d=s.fields||{},f=o.fields||{},h=(a=d[s6])===null||a===void 0?void 0:a.arrayValue,m=(l=f[s6])===null||l===void 0?void 0:l.arrayValue,p=dt(((c=h==null?void 0:h.values)===null||c===void 0?void 0:c.length)||0,((u=m==null?void 0:m.values)===null||u===void 0?void 0:u.length)||0);return p!==0?p:Lk(h,m)}(e.mapValue,t.mapValue);case 11:return function(s,o){if(s===TU.mapValue&&o===TU.mapValue)return 0;if(s===TU.mapValue)return 1;if(o===TU.mapValue)return-1;const a=s.fields||{},l=Object.keys(a),c=o.fields||{},u=Object.keys(c);l.sort(),u.sort();for(let d=0;d<l.length&&d<u.length;++d){const f=dt(l[d],u[d]);if(f!==0)return f;const h=Bh(a[l[d]],c[u[d]]);if(h!==0)return h}return dt(l.length,u.length)}(e.mapValue,t.mapValue);default:throw Ae()}}function kk(e,t){if(typeof e=="string"&&typeof t=="string"&&e.length===t.length)return dt(e,t);const n=Ac(e),i=Ac(t),r=dt(n.seconds,i.seconds);return r!==0?r:dt(n.nanos,i.nanos)}function Lk(e,t){const n=e.values||[],i=t.values||[];for(let r=0;r<n.length&&r<i.length;++r){const s=Bh(n[r],i[r]);if(s)return s}return dt(n.length,i.length)}function zh(e){return C4(e)}function C4(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(n){const i=Ac(n);return`time(${i.seconds},${i.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(n){return Mc(n).toBase64()}(e.bytesValue):"referenceValue"in e?function(n){return Me.fromName(n).toString()}(e.referenceValue):"geoPointValue"in e?function(n){return`geo(${n.latitude},${n.longitude})`}(e.geoPointValue):"arrayValue"in e?function(n){let i="[",r=!0;for(const s of n.values||[])r?r=!1:i+=",",i+=C4(s);return i+"]"}(e.arrayValue):"mapValue"in e?function(n){const i=Object.keys(n.fields||{}).sort();let r="{",s=!0;for(const o of i)s?s=!1:r+=",",r+=`${o}:${C4(n.fields[o])}`;return r+"}"}(e.mapValue):Ae()}function b2(e){switch(Rc(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Y5(e);return t?16+b2(t):16;case 5:return 2*e.stringValue.length;case 6:return Mc(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(i){return(i.values||[]).reduce((r,s)=>r+b2(s),0)}(e.arrayValue);case 10:case 11:return function(i){let r=0;return Nd(i.fields,(s,o)=>{r+=s.length+b2(o)}),r}(e.mapValue);default:throw Ae()}}function A4(e){return!!e&&"integerValue"in e}function Lw(e){return!!e&&"arrayValue"in e}function Dk(e){return!!e&&"nullValue"in e}function Nk(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function L7(e){return!!e&&"mapValue"in e}function M9e(e){var t,n;return((n=(((t=e==null?void 0:e.mapValue)===null||t===void 0?void 0:t.fields)||{})[Ij])===null||n===void 0?void 0:n.stringValue)===xj}function a0(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&typeof e.timestampValue=="object")return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return Nd(e.mapValue.fields,(n,i)=>t.mapValue.fields[n]=a0(i)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=a0(e.arrayValue.values[n]);return t}return Object.assign({},e)}function R9e(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===A9e}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class fr{constructor(t){this.value=t}static empty(){return new fr({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let n=this.value;for(let i=0;i<t.length-1;++i)if(n=(n.mapValue.fields||{})[t.get(i)],!L7(n))return null;return n=(n.mapValue.fields||{})[t.lastSegment()],n||null}}set(t,n){this.getFieldsMap(t.popLast())[t.lastSegment()]=a0(n)}setAll(t){let n=Ni.emptyPath(),i={},r=[];t.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const l=this.getFieldsMap(n);this.applyChanges(l,i,r),i={},r=[],n=a.popLast()}o?i[a.lastSegment()]=a0(o):r.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,i,r)}delete(t){const n=this.field(t.popLast());L7(n)&&n.mapValue.fields&&delete n.mapValue.fields[t.lastSegment()]}isEqual(t){return Xo(this.value,t.value)}getFieldsMap(t){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let i=0;i<t.length;++i){let r=n.mapValue.fields[t.get(i)];L7(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},n.mapValue.fields[t.get(i)]=r),n=r}return n.mapValue.fields}applyChanges(t,n,i){Nd(n,(r,s)=>t[r]=s);for(const r of i)delete t[r]}clone(){return new fr(a0(this.value))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class si{constructor(t,n,i,r,s,o,a){this.key=t,this.documentType=n,this.version=i,this.readTime=r,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(t){return new si(t,0,Le.min(),Le.min(),Le.min(),fr.empty(),0)}static newFoundDocument(t,n,i,r){return new si(t,1,n,Le.min(),i,r,0)}static newNoDocument(t,n){return new si(t,2,n,Le.min(),Le.min(),fr.empty(),0)}static newUnknownDocument(t,n){return new si(t,3,n,Le.min(),Le.min(),fr.empty(),2)}convertToFoundDocument(t,n){return!this.createTime.isEqual(Le.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=t),this.version=t,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=fr.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=fr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Le.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof si&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new si(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class o6{constructor(t,n){this.position=t,this.inclusive=n}}function Ok(e,t,n){let i=0;for(let r=0;r<e.position.length;r++){const s=t[r],o=e.position[r];if(s.field.isKeyField()?i=Me.comparator(Me.fromName(o.referenceValue),n.key):i=Bh(o,n.data.field(s.field)),s.dir==="desc"&&(i*=-1),i!==0)break}return i}function Pk(e,t){if(e===null)return t===null;if(t===null||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Xo(e.position[n],t.position[n]))return!1;return!0}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class a6{constructor(t,n="asc"){this.field=t,this.dir=n}}function k9e(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Cj{}class Kn extends Cj{constructor(t,n,i){super(),this.field=t,this.op=n,this.value=i}static create(t,n,i){return t.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(t,n,i):new D9e(t,n,i):n==="array-contains"?new P9e(t,i):n==="in"?new F9e(t,i):n==="not-in"?new B9e(t,i):n==="array-contains-any"?new z9e(t,i):new Kn(t,n,i)}static createKeyFieldInFilter(t,n,i){return n==="in"?new N9e(t,i):new O9e(t,i)}matches(t){const n=t.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(Bh(n,this.value)):n!==null&&Rc(this.value)===Rc(n)&&this.matchesComparison(Bh(n,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return t===0;case"!=":return t!==0;case">":return t>0;case">=":return t>=0;default:return Ae()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class jo extends Cj{constructor(t,n){super(),this.filters=t,this.op=n,this.ce=null}static create(t,n){return new jo(t,n)}matches(t){return Aj(this)?this.filters.find(n=>!n.matches(t))===void 0:this.filters.find(n=>n.matches(t))!==void 0}getFlattenedFilters(){return this.ce!==null||(this.ce=this.filters.reduce((t,n)=>t.concat(n.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}}function Aj(e){return e.op==="and"}function Mj(e){return L9e(e)&&Aj(e)}function L9e(e){for(const t of e.filters)if(t instanceof jo)return!1;return!0}function M4(e){if(e instanceof Kn)return e.field.canonicalString()+e.op.toString()+zh(e.value);if(Mj(e))return e.filters.map(t=>M4(t)).join(",");{const t=e.filters.map(n=>M4(n)).join(",");return`${e.op}(${t})`}}function Rj(e,t){return e instanceof Kn?function(i,r){return r instanceof Kn&&i.op===r.op&&i.field.isEqual(r.field)&&Xo(i.value,r.value)}(e,t):e instanceof jo?function(i,r){return r instanceof jo&&i.op===r.op&&i.filters.length===r.filters.length?i.filters.reduce((s,o,a)=>s&&Rj(o,r.filters[a]),!0):!1}(e,t):void Ae()}function kj(e){return e instanceof Kn?function(n){return`${n.field.canonicalString()} ${n.op} ${zh(n.value)}`}(e):e instanceof jo?function(n){return n.op.toString()+" {"+n.getFilters().map(kj).join(" ,")+"}"}(e):"Filter"}class D9e extends Kn{constructor(t,n,i){super(t,n,i),this.key=Me.fromName(i.referenceValue)}matches(t){const n=Me.comparator(t.key,this.key);return this.matchesComparison(n)}}class N9e extends Kn{constructor(t,n){super(t,"in",n),this.keys=Lj("in",n)}matches(t){return this.keys.some(n=>n.isEqual(t.key))}}class O9e extends Kn{constructor(t,n){super(t,"not-in",n),this.keys=Lj("not-in",n)}matches(t){return!this.keys.some(n=>n.isEqual(t.key))}}function Lj(e,t){var n;return(((n=t.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(i=>Me.fromName(i.referenceValue))}class P9e extends Kn{constructor(t,n){super(t,"array-contains",n)}matches(t){const n=t.data.field(this.field);return Lw(n)&&pm(n.arrayValue,this.value)}}class F9e extends Kn{constructor(t,n){super(t,"in",n)}matches(t){const n=t.data.field(this.field);return n!==null&&pm(this.value.arrayValue,n)}}class B9e extends Kn{constructor(t,n){super(t,"not-in",n)}matches(t){if(pm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=t.data.field(this.field);return n!==null&&!pm(this.value.arrayValue,n)}}class z9e extends Kn{constructor(t,n){super(t,"array-contains-any",n)}matches(t){const n=t.data.field(this.field);return!(!Lw(n)||!n.arrayValue.values)&&n.arrayValue.values.some(i=>pm(this.value.arrayValue,i))}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class H9e{constructor(t,n=null,i=[],r=[],s=null,o=null,a=null){this.path=t,this.collectionGroup=n,this.orderBy=i,this.filters=r,this.limit=s,this.startAt=o,this.endAt=a,this.le=null}}function Fk(e,t=null,n=[],i=[],r=null,s=null,o=null){return new H9e(e,t,n,i,r,s,o)}function Dw(e){const t=nt(e);if(t.le===null){let n=t.path.canonicalString();t.collectionGroup!==null&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map(i=>M4(i)).join(","),n+="|ob:",n+=t.orderBy.map(i=>function(s){return s.field.canonicalString()+s.dir}(i)).join(","),sp(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(i=>zh(i)).join(",")),t.endAt&&(n+="|ub:",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(i=>zh(i)).join(",")),t.le=n}return t.le}function Nw(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!k9e(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Rj(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Pk(e.startAt,t.startAt)&&Pk(e.endAt,t.endAt)}function R4(e){return Me.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class W5{constructor(t,n=null,i=[],r=[],s=null,o="F",a=null,l=null){this.path=t,this.collectionGroup=n,this.explicitOrderBy=i,this.filters=r,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=l,this.he=null,this.Pe=null,this.Te=null,this.startAt,this.endAt}}function V9e(e,t,n,i,r,s,o,a){return new W5(e,t,n,i,r,s,o,a)}function Ow(e){return new W5(e)}function Bk(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function $9e(e){return e.collectionGroup!==null}function l0(e){const t=nt(e);if(t.he===null){t.he=[];const n=new Set;for(const s of t.explicitOrderBy)t.he.push(s),n.add(s.field.canonicalString());const i=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new Zn(Ni.comparator);return o.filters.forEach(l=>{l.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(t).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||t.he.push(new a6(s,i))}),n.has(Ni.keyField().canonicalString())||t.he.push(new a6(Ni.keyField(),i))}return t.he}function Oo(e){const t=nt(e);return t.Pe||(t.Pe=G9e(t,l0(e))),t.Pe}function G9e(e,t){if(e.limitType==="F")return Fk(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(r=>{const s=r.dir==="desc"?"asc":"desc";return new a6(r.field,s)});const n=e.endAt?new o6(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new o6(e.startAt.position,e.startAt.inclusive):null;return Fk(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}function k4(e,t,n){return new W5(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function K5(e,t){return Nw(Oo(e),Oo(t))&&e.limitType===t.limitType}function Dj(e){return`${Dw(Oo(e))}|lt:${e.limitType}`}function hf(e){return`Query(target=${function(n){let i=n.path.canonicalString();return n.collectionGroup!==null&&(i+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(i+=`, filters: [${n.filters.map(r=>kj(r)).join(", ")}]`),sp(n.limit)||(i+=", limit: "+n.limit),n.orderBy.length>0&&(i+=`, orderBy: [${n.orderBy.map(r=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(r)).join(", ")}]`),n.startAt&&(i+=", startAt: ",i+=n.startAt.inclusive?"b:":"a:",i+=n.startAt.position.map(r=>zh(r)).join(",")),n.endAt&&(i+=", endAt: ",i+=n.endAt.inclusive?"a:":"b:",i+=n.endAt.position.map(r=>zh(r)).join(",")),`Target(${i})`}(Oo(e))}; limitType=${e.limitType})`}function Z5(e,t){return t.isFoundDocument()&&function(i,r){const s=r.key.path;return i.collectionGroup!==null?r.key.hasCollectionId(i.collectionGroup)&&i.path.isPrefixOf(s):Me.isDocumentKey(i.path)?i.path.isEqual(s):i.path.isImmediateParentOf(s)}(e,t)&&function(i,r){for(const s of l0(i))if(!s.field.isKeyField()&&r.data.field(s.field)===null)return!1;return!0}(e,t)&&function(i,r){for(const s of i.filters)if(!s.matches(r))return!1;return!0}(e,t)&&function(i,r){return!(i.startAt&&!function(o,a,l){const c=Ok(o,a,l);return o.inclusive?c<=0:c<0}(i.startAt,l0(i),r)||i.endAt&&!function(o,a,l){const c=Ok(o,a,l);return o.inclusive?c>=0:c>0}(i.endAt,l0(i),r))}(e,t)}function X9e(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function Nj(e){return(t,n)=>{let i=!1;for(const r of l0(e)){const s=j9e(r,t,n);if(s!==0)return s;i=i||r.field.isKeyField()}return 0}}function j9e(e,t,n){const i=e.field.isKeyField()?Me.comparator(t.key,n.key):function(s,o,a){const l=o.data.field(s),c=a.data.field(s);return l!==null&&c!==null?Bh(l,c):Ae()}(e.field,t,n);switch(e.dir){case"asc":return i;case"desc":return-1*i;default:return Ae()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Od{constructor(t,n){this.mapKeyFn=t,this.equalsFn=n,this.inner={},this.innerSize=0}get(t){const n=this.mapKeyFn(t),i=this.inner[n];if(i!==void 0){for(const[r,s]of i)if(this.equalsFn(r,t))return s}}has(t){return this.get(t)!==void 0}set(t,n){const i=this.mapKeyFn(t),r=this.inner[i];if(r===void 0)return this.inner[i]=[[t,n]],void this.innerSize++;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],t))return void(r[s]=[t,n]);r.push([t,n]),this.innerSize++}delete(t){const n=this.mapKeyFn(t),i=this.inner[n];if(i===void 0)return!1;for(let r=0;r<i.length;r++)if(this.equalsFn(i[r][0],t))return i.length===1?delete this.inner[n]:i.splice(r,1),this.innerSize--,!0;return!1}forEach(t){Nd(this.inner,(n,i)=>{for(const[r,s]of i)t(r,s)})}isEmpty(){return Ej(this.inner)}size(){return this.innerSize}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Y9e=new An(Me.comparator);function kc(){return Y9e}const Oj=new An(Me.comparator);function _g(...e){let t=Oj;for(const n of e)t=t.insert(n.key,n);return t}function W9e(e){let t=Oj;return e.forEach((n,i)=>t=t.insert(n,i.overlayedDocument)),t}function Su(){return c0()}function Pj(){return c0()}function c0(){return new Od(e=>e.toString(),(e,t)=>e.isEqual(t))}const K9e=new Zn(Me.comparator);function Ut(...e){let t=K9e;for(const n of e)t=t.add(n);return t}const Z9e=new Zn(dt);function q9e(){return Z9e}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Pw(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:i6(t)?"-0":t}}function Fj(e){return{integerValue:""+e}}function Q9e(e,t){return T9e(t)?Fj(t):Pw(e,t)}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class q5{constructor(){this._=void 0}}function J9e(e,t,n){return e instanceof l6?function(r,s){const o={fields:{[wj]:{stringValue:_j},[Sj]:{timestampValue:{seconds:r.seconds,nanos:r.nanoseconds}}}};return s&&kw(s)&&(s=Y5(s)),s&&(o.fields[Tj]=s),{mapValue:o}}(n,t):e instanceof Um?Bj(e,t):e instanceof bm?zj(e,t):function(r,s){const o=t_e(r,s),a=zk(o)+zk(r.Ie);return A4(o)&&A4(r.Ie)?Fj(a):Pw(r.serializer,a)}(e,t)}function e_e(e,t,n){return e instanceof Um?Bj(e,t):e instanceof bm?zj(e,t):n}function t_e(e,t){return e instanceof c6?function(i){return A4(i)||function(s){return!!s&&"doubleValue"in s}(i)}(t)?t:{integerValue:0}:null}class l6 extends q5{}class Um extends q5{constructor(t){super(),this.elements=t}}function Bj(e,t){const n=Hj(t);for(const i of e.elements)n.some(r=>Xo(r,i))||n.push(i);return{arrayValue:{values:n}}}class bm extends q5{constructor(t){super(),this.elements=t}}function zj(e,t){let n=Hj(t);for(const i of e.elements)n=n.filter(r=>!Xo(r,i));return{arrayValue:{values:n}}}class c6 extends q5{constructor(t,n){super(),this.serializer=t,this.Ie=n}}function zk(e){return In(e.integerValue||e.doubleValue)}function Hj(e){return Lw(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}function n_e(e,t){return e.field.isEqual(t.field)&&function(i,r){return i instanceof Um&&r instanceof Um||i instanceof bm&&r instanceof bm?Fh(i.elements,r.elements,Xo):i instanceof c6&&r instanceof c6?Xo(i.Ie,r.Ie):i instanceof l6&&r instanceof l6}(e.transform,t.transform)}class ns{constructor(t,n){this.updateTime=t,this.exists=n}static none(){return new ns}static exists(t){return new ns(void 0,t)}static updateTime(t){return new ns(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function y2(e,t){return e.updateTime!==void 0?t.isFoundDocument()&&t.version.isEqual(e.updateTime):e.exists===void 0||e.exists===t.isFoundDocument()}class Q5{}function Vj(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new Fw(e.key,ns.none()):new op(e.key,e.data,ns.none());{const n=e.data,i=fr.empty();let r=new Zn(Ni.comparator);for(let s of t.fields)if(!r.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?i.delete(s):i.set(s,o),r=r.add(s)}return new Pd(e.key,i,new os(r.toArray()),ns.none())}}function i_e(e,t,n){e instanceof op?function(r,s,o){const a=r.value.clone(),l=Vk(r.fieldTransforms,s,o.transformResults);a.setAll(l),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(e,t,n):e instanceof Pd?function(r,s,o){if(!y2(r.precondition,s))return void s.convertToUnknownDocument(o.version);const a=Vk(r.fieldTransforms,s,o.transformResults),l=s.data;l.setAll($j(r)),l.setAll(a),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(e,t,n):function(r,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,t,n)}function u0(e,t,n,i){return e instanceof op?function(s,o,a,l){if(!y2(s.precondition,o))return a;const c=s.value.clone(),u=$k(s.fieldTransforms,l,o);return c.setAll(u),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(e,t,n,i):e instanceof Pd?function(s,o,a,l){if(!y2(s.precondition,o))return a;const c=$k(s.fieldTransforms,l,o),u=o.data;return u.setAll($j(s)),u.setAll(c),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(d=>d.field))}(e,t,n,i):function(s,o,a){return y2(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(e,t,n)}function Hk(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(i,r){return i===void 0&&r===void 0||!(!i||!r)&&Fh(i,r,(s,o)=>n_e(s,o))}(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class op extends Q5{constructor(t,n,i,r=[]){super(),this.key=t,this.value=n,this.precondition=i,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class Pd extends Q5{constructor(t,n,i,r,s=[]){super(),this.key=t,this.data=n,this.fieldMask=i,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function $j(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const i=e.data.field(n);t.set(n,i)}}),t}function Vk(e,t,n){const i=new Map;Bt(e.length===n.length);for(let r=0;r<n.length;r++){const s=e[r],o=s.transform,a=t.data.field(s.field);i.set(s.field,e_e(o,a,n[r]))}return i}function $k(e,t,n){const i=new Map;for(const r of e){const s=r.transform,o=n.data.field(r.field);i.set(r.field,J9e(s,o,t))}return i}class Fw extends Q5{constructor(t,n){super(),this.key=t,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Gj extends Q5{constructor(t,n){super(),this.key=t,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class r_e{constructor(t,n,i,r){this.batchId=t,this.localWriteTime=n,this.baseMutations=i,this.mutations=r}applyToRemoteDocument(t,n){const i=n.mutationResults;for(let r=0;r<this.mutations.length;r++){const s=this.mutations[r];s.key.isEqual(t.key)&&i_e(s,t,i[r])}}applyToLocalView(t,n){for(const i of this.baseMutations)i.key.isEqual(t.key)&&(n=u0(i,t,n,this.localWriteTime));for(const i of this.mutations)i.key.isEqual(t.key)&&(n=u0(i,t,n,this.localWriteTime));return n}applyToLocalDocumentSet(t,n){const i=Pj();return this.mutations.forEach(r=>{const s=t.get(r.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(r.key)?null:a;const l=Vj(o,a);l!==null&&i.set(r.key,l),o.isValidDocument()||o.convertToNoDocument(Le.min())}),i}keys(){return this.mutations.reduce((t,n)=>t.add(n.key),Ut())}isEqual(t){return this.batchId===t.batchId&&Fh(this.mutations,t.mutations,(n,i)=>Hk(n,i))&&Fh(this.baseMutations,t.baseMutations,(n,i)=>Hk(n,i))}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class s_e{constructor(t,n){this.largestBatchId=t,this.mutation=n}getKey(){return this.mutation.key}isEqual(t){return t!==null&&this.mutation===t.mutation}toString(){return`Overlay{
      largestBatchId: ${this.largestBatchId},
      mutation: ${this.mutation.toString()}
    }`}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class o_e{constructor(t,n){this.count=t,this.unchangedNames=n}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var kn,at;function a_e(e){switch(e){case re.OK:return Ae();case re.CANCELLED:case re.UNKNOWN:case re.DEADLINE_EXCEEDED:case re.RESOURCE_EXHAUSTED:case re.INTERNAL:case re.UNAVAILABLE:case re.UNAUTHENTICATED:return!1;case re.INVALID_ARGUMENT:case re.NOT_FOUND:case re.ALREADY_EXISTS:case re.PERMISSION_DENIED:case re.FAILED_PRECONDITION:case re.ABORTED:case re.OUT_OF_RANGE:case re.UNIMPLEMENTED:case re.DATA_LOSS:return!0;default:return Ae()}}function Xj(e){if(e===void 0)return il("GRPC error has no .code"),re.UNKNOWN;switch(e){case kn.OK:return re.OK;case kn.CANCELLED:return re.CANCELLED;case kn.UNKNOWN:return re.UNKNOWN;case kn.DEADLINE_EXCEEDED:return re.DEADLINE_EXCEEDED;case kn.RESOURCE_EXHAUSTED:return re.RESOURCE_EXHAUSTED;case kn.INTERNAL:return re.INTERNAL;case kn.UNAVAILABLE:return re.UNAVAILABLE;case kn.UNAUTHENTICATED:return re.UNAUTHENTICATED;case kn.INVALID_ARGUMENT:return re.INVALID_ARGUMENT;case kn.NOT_FOUND:return re.NOT_FOUND;case kn.ALREADY_EXISTS:return re.ALREADY_EXISTS;case kn.PERMISSION_DENIED:return re.PERMISSION_DENIED;case kn.FAILED_PRECONDITION:return re.FAILED_PRECONDITION;case kn.ABORTED:return re.ABORTED;case kn.OUT_OF_RANGE:return re.OUT_OF_RANGE;case kn.UNIMPLEMENTED:return re.UNIMPLEMENTED;case kn.DATA_LOSS:return re.DATA_LOSS;default:return Ae()}}(at=kn||(kn={}))[at.OK=0]="OK",at[at.CANCELLED=1]="CANCELLED",at[at.UNKNOWN=2]="UNKNOWN",at[at.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",at[at.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",at[at.NOT_FOUND=5]="NOT_FOUND",at[at.ALREADY_EXISTS=6]="ALREADY_EXISTS",at[at.PERMISSION_DENIED=7]="PERMISSION_DENIED",at[at.UNAUTHENTICATED=16]="UNAUTHENTICATED",at[at.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",at[at.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",at[at.ABORTED=10]="ABORTED",at[at.OUT_OF_RANGE=11]="OUT_OF_RANGE",at[at.UNIMPLEMENTED=12]="UNIMPLEMENTED",at[at.INTERNAL=13]="INTERNAL",at[at.UNAVAILABLE=14]="UNAVAILABLE",at[at.DATA_LOSS=15]="DATA_LOSS";/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function l_e(){return new TextEncoder}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const c_e=new cc([4294967295,4294967295],0);function Gk(e){const t=l_e().encode(e),n=new dj;return n.update(t),new Uint8Array(n.digest())}function Xk(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),i=t.getUint32(4,!0),r=t.getUint32(8,!0),s=t.getUint32(12,!0);return[new cc([n,i],0),new cc([r,s],0)]}class Bw{constructor(t,n,i){if(this.bitmap=t,this.padding=n,this.hashCount=i,n<0||n>=8)throw new wg(`Invalid padding: ${n}`);if(i<0)throw new wg(`Invalid hash count: ${i}`);if(t.length>0&&this.hashCount===0)throw new wg(`Invalid hash count: ${i}`);if(t.length===0&&n!==0)throw new wg(`Invalid padding when bitmap length is 0: ${n}`);this.Ee=8*t.length-n,this.de=cc.fromNumber(this.Ee)}Ae(t,n,i){let r=t.add(n.multiply(cc.fromNumber(i)));return r.compare(c_e)===1&&(r=new cc([r.getBits(0),r.getBits(1)],0)),r.modulo(this.de).toNumber()}Re(t){return!!(this.bitmap[Math.floor(t/8)]&1<<t%8)}mightContain(t){if(this.Ee===0)return!1;const n=Gk(t),[i,r]=Xk(n);for(let s=0;s<this.hashCount;s++){const o=this.Ae(i,r,s);if(!this.Re(o))return!1}return!0}static create(t,n,i){const r=t%8==0?0:8-t%8,s=new Uint8Array(Math.ceil(t/8)),o=new Bw(s,r,n);return i.forEach(a=>o.insert(a)),o}insert(t){if(this.Ee===0)return;const n=Gk(t),[i,r]=Xk(n);for(let s=0;s<this.hashCount;s++){const o=this.Ae(i,r,s);this.Ve(o)}}Ve(t){const n=Math.floor(t/8),i=t%8;this.bitmap[n]|=1<<i}}class wg extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class J5{constructor(t,n,i,r,s){this.snapshotVersion=t,this.targetChanges=n,this.targetMismatches=i,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(t,n,i){const r=new Map;return r.set(t,ap.createSynthesizedTargetChangeForCurrentChange(t,n,i)),new J5(Le.min(),r,new An(dt),kc(),Ut())}}class ap{constructor(t,n,i,r,s){this.resumeToken=t,this.current=n,this.addedDocuments=i,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(t,n,i){return new ap(i,n,Ut(),Ut(),Ut())}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class E2{constructor(t,n,i,r){this.me=t,this.removedTargetIds=n,this.key=i,this.fe=r}}class jj{constructor(t,n){this.targetId=t,this.ge=n}}class Yj{constructor(t,n,i=wi.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=n,this.resumeToken=i,this.cause=r}}class jk{constructor(){this.pe=0,this.ye=Yk(),this.we=wi.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}get current(){return this.Se}get resumeToken(){return this.we}get De(){return this.pe!==0}get ve(){return this.be}Ce(t){t.approximateByteSize()>0&&(this.be=!0,this.we=t)}Fe(){let t=Ut(),n=Ut(),i=Ut();return this.ye.forEach((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:n=n.add(r);break;case 1:i=i.add(r);break;default:Ae()}}),new ap(this.we,this.Se,t,n,i)}Me(){this.be=!1,this.ye=Yk()}xe(t,n){this.be=!0,this.ye=this.ye.insert(t,n)}Oe(t){this.be=!0,this.ye=this.ye.remove(t)}Ne(){this.pe+=1}Be(){this.pe-=1,Bt(this.pe>=0)}Le(){this.be=!0,this.Se=!0}}class u_e{constructor(t){this.ke=t,this.qe=new Map,this.Qe=kc(),this.$e=SU(),this.Ke=SU(),this.Ue=new An(dt)}We(t){for(const n of t.me)t.fe&&t.fe.isFoundDocument()?this.Ge(n,t.fe):this.ze(n,t.key,t.fe);for(const n of t.removedTargetIds)this.ze(n,t.key,t.fe)}je(t){this.forEachTarget(t,n=>{const i=this.He(n);switch(t.state){case 0:this.Je(n)&&i.Ce(t.resumeToken);break;case 1:i.Be(),i.De||i.Me(),i.Ce(t.resumeToken);break;case 2:i.Be(),i.De||this.removeTarget(n);break;case 3:this.Je(n)&&(i.Le(),i.Ce(t.resumeToken));break;case 4:this.Je(n)&&(this.Ye(n),i.Ce(t.resumeToken));break;default:Ae()}})}forEachTarget(t,n){t.targetIds.length>0?t.targetIds.forEach(n):this.qe.forEach((i,r)=>{this.Je(r)&&n(r)})}Ze(t){const n=t.targetId,i=t.ge.count,r=this.Xe(n);if(r){const s=r.target;if(R4(s))if(i===0){const o=new Me(s.path);this.ze(n,o,si.newNoDocument(o,Le.min()))}else Bt(i===1);else{const o=this.et(n);if(o!==i){const a=this.tt(t),l=a?this.nt(a,t,o):1;if(l!==0){this.Ye(n);const c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ue=this.Ue.insert(n,c)}}}}}tt(t){const n=t.ge.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:i="",padding:r=0},hashCount:s=0}=n;let o,a;try{o=Mc(i).toUint8Array()}catch(l){if(l instanceof vj)return Ph("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{a=new Bw(o,r,s)}catch(l){return Ph(l instanceof wg?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return a.Ee===0?null:a}nt(t,n,i){return n.ge.count===i-this.st(t,n.targetId)?0:2}st(t,n){const i=this.ke.getRemoteKeysForTarget(n);let r=0;return i.forEach(s=>{const o=this.ke.it(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;t.mightContain(a)||(this.ze(n,s,null),r++)}),r}ot(t){const n=new Map;this.qe.forEach((s,o)=>{const a=this.Xe(o);if(a){if(s.current&&R4(a.target)){const l=new Me(a.target.path);this._t(l).has(o)||this.ut(o,l)||this.ze(o,l,si.newNoDocument(l,t))}s.ve&&(n.set(o,s.Fe()),s.Me())}});let i=Ut();this.Ke.forEach((s,o)=>{let a=!0;o.forEachWhile(l=>{const c=this.Xe(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(i=i.add(s))}),this.Qe.forEach((s,o)=>o.setReadTime(t));const r=new J5(t,n,this.Ue,this.Qe,i);return this.Qe=kc(),this.$e=SU(),this.Ke=SU(),this.Ue=new An(dt),r}Ge(t,n){if(!this.Je(t))return;const i=this.ut(t,n.key)?2:0;this.He(t).xe(n.key,i),this.Qe=this.Qe.insert(n.key,n),this.$e=this.$e.insert(n.key,this._t(n.key).add(t)),this.Ke=this.Ke.insert(n.key,this.ct(n.key).add(t))}ze(t,n,i){if(!this.Je(t))return;const r=this.He(t);this.ut(t,n)?r.xe(n,1):r.Oe(n),this.Ke=this.Ke.insert(n,this.ct(n).delete(t)),this.Ke=this.Ke.insert(n,this.ct(n).add(t)),i&&(this.Qe=this.Qe.insert(n,i))}removeTarget(t){this.qe.delete(t)}et(t){const n=this.He(t).Fe();return this.ke.getRemoteKeysForTarget(t).size+n.addedDocuments.size-n.removedDocuments.size}Ne(t){this.He(t).Ne()}He(t){let n=this.qe.get(t);return n||(n=new jk,this.qe.set(t,n)),n}ct(t){let n=this.Ke.get(t);return n||(n=new Zn(dt),this.Ke=this.Ke.insert(t,n)),n}_t(t){let n=this.$e.get(t);return n||(n=new Zn(dt),this.$e=this.$e.insert(t,n)),n}Je(t){const n=this.Xe(t)!==null;return n||Ee("WatchChangeAggregator","Detected inactive target",t),n}Xe(t){const n=this.qe.get(t);return n&&n.De?null:this.ke.lt(t)}Ye(t){this.qe.set(t,new jk),this.ke.getRemoteKeysForTarget(t).forEach(n=>{this.ze(t,n,null)})}ut(t,n){return this.ke.getRemoteKeysForTarget(t).has(n)}}function SU(){return new An(Me.comparator)}function Yk(){return new An(Me.comparator)}const d_e={asc:"ASCENDING",desc:"DESCENDING"},f_e={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},h_e={and:"AND",or:"OR"};class g_e{constructor(t,n){this.databaseId=t,this.useProto3Json=n}}function L4(e,t){return e.useProto3Json||sp(t)?t:{value:t}}function u6(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Wj(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function m_e(e,t){return u6(e,t.toTimestamp())}function Oa(e){return Bt(!!e),Le.fromTimestamp(function(n){const i=Ac(n);return new di(i.seconds,i.nanos)}(e))}function zw(e,t){return D4(e,t).canonicalString()}function D4(e,t){const n=function(r){return new rn(["projects",r.projectId,"databases",r.database])}(e).child("documents");return t===void 0?n:n.child(t)}function Kj(e){const t=rn.fromString(e);return Bt(eY(t)),t}function d6(e,t){return zw(e.databaseId,t.path)}function d0(e,t){const n=Kj(t);if(n.get(1)!==e.databaseId.projectId)throw new Te(re.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Te(re.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new Me(qj(n))}function Zj(e,t){return zw(e.databaseId,t)}function p_e(e){const t=Kj(e);return t.length===4?rn.emptyPath():qj(t)}function Wk(e){return new rn(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function qj(e){return Bt(e.length>4&&e.get(4)==="documents"),e.popFirst(5)}function Kk(e,t,n){return{name:d6(e,t),fields:n.value.mapValue.fields}}function U_e(e,t){return"found"in t?function(i,r){Bt(!!r.found),r.found.name,r.found.updateTime;const s=d0(i,r.found.name),o=Oa(r.found.updateTime),a=r.found.createTime?Oa(r.found.createTime):Le.min(),l=new fr({mapValue:{fields:r.found.fields}});return si.newFoundDocument(s,o,a,l)}(e,t):"missing"in t?function(i,r){Bt(!!r.missing),Bt(!!r.readTime);const s=d0(i,r.missing),o=Oa(r.readTime);return si.newNoDocument(s,o)}(e,t):Ae()}function b_e(e,t){let n;if("targetChange"in t){t.targetChange;const i=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:Ae()}(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],s=function(c,u){return c.useProto3Json?(Bt(u===void 0||typeof u=="string"),wi.fromBase64String(u||"")):(Bt(u===void 0||u instanceof Buffer||u instanceof Uint8Array),wi.fromUint8Array(u||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(c){const u=c.code===void 0?re.UNKNOWN:Xj(c.code);return new Te(u,c.message||"")}(o);n=new Yj(i,r,s,a||null)}else if("documentChange"in t){t.documentChange;const i=t.documentChange;i.document,i.document.name,i.document.updateTime;const r=d0(e,i.document.name),s=Oa(i.document.updateTime),o=i.document.createTime?Oa(i.document.createTime):Le.min(),a=new fr({mapValue:{fields:i.document.fields}}),l=si.newFoundDocument(r,s,o,a),c=i.targetIds||[],u=i.removedTargetIds||[];n=new E2(c,u,l.key,l)}else if("documentDelete"in t){t.documentDelete;const i=t.documentDelete;i.document;const r=d0(e,i.document),s=i.readTime?Oa(i.readTime):Le.min(),o=si.newNoDocument(r,s),a=i.removedTargetIds||[];n=new E2([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const i=t.documentRemove;i.document;const r=d0(e,i.document),s=i.removedTargetIds||[];n=new E2([],s,r,null)}else{if(!("filter"in t))return Ae();{t.filter;const i=t.filter;i.targetId;const{count:r=0,unchangedNames:s}=i,o=new o_e(r,s),a=i.targetId;n=new jj(a,o)}}return n}function y_e(e,t){let n;if(t instanceof op)n={update:Kk(e,t.key,t.value)};else if(t instanceof Fw)n={delete:d6(e,t.key)};else if(t instanceof Pd)n={update:Kk(e,t.key,t.data),updateMask:x_e(t.fieldMask)};else{if(!(t instanceof Gj))return Ae();n={verify:d6(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(i=>function(s,o){const a=o.transform;if(a instanceof l6)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Um)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof bm)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof c6)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw Ae()}(0,i))),t.precondition.isNone||(n.currentDocument=function(r,s){return s.updateTime!==void 0?{updateTime:m_e(r,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:Ae()}(e,t.precondition)),n}function E_e(e,t){return{documents:[Zj(e,t.path)]}}function v_e(e,t){const n={structuredQuery:{}},i=t.path;let r;t.collectionGroup!==null?(r=i,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(r=i.popLast(),n.structuredQuery.from=[{collectionId:i.lastSegment()}]),n.parent=Zj(e,r);const s=function(c){if(c.length!==0)return Jj(jo.create(c,"and"))}(t.filters);s&&(n.structuredQuery.where=s);const o=function(c){if(c.length!==0)return c.map(u=>function(f){return{field:gf(f.field),direction:T_e(f.dir)}}(u))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=L4(e,t.limit);return a!==null&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(t.endAt)),{ht:n,parent:r}}function __e(e){let t=p_e(e.parent);const n=e.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){Bt(i===1);const u=n.from[0];u.allDescendants?r=u.collectionId:t=t.child(u.collectionId)}let s=[];n.where&&(s=function(d){const f=Qj(d);return f instanceof jo&&Mj(f)?f.getFilters():[f]}(n.where));let o=[];n.orderBy&&(o=function(d){return d.map(f=>function(m){return new a6(mf(m.field),function(b){switch(b){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(m.direction))}(f))}(n.orderBy));let a=null;n.limit&&(a=function(d){let f;return f=typeof d=="object"?d.value:d,sp(f)?null:f}(n.limit));let l=null;n.startAt&&(l=function(d){const f=!!d.before,h=d.values||[];return new o6(h,f)}(n.startAt));let c=null;return n.endAt&&(c=function(d){const f=!d.before,h=d.values||[];return new o6(h,f)}(n.endAt)),V9e(t,r,o,s,a,"F",l,c)}function w_e(e,t){const n=function(r){switch(r){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Ae()}}(t.purpose);return n==null?null:{"goog-listen-tags":n}}function Qj(e){return e.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const i=mf(n.unaryFilter.field);return Kn.create(i,"==",{doubleValue:NaN});case"IS_NULL":const r=mf(n.unaryFilter.field);return Kn.create(r,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=mf(n.unaryFilter.field);return Kn.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=mf(n.unaryFilter.field);return Kn.create(o,"!=",{nullValue:"NULL_VALUE"});default:return Ae()}}(e):e.fieldFilter!==void 0?function(n){return Kn.create(mf(n.fieldFilter.field),function(r){switch(r){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Ae()}}(n.fieldFilter.op),n.fieldFilter.value)}(e):e.compositeFilter!==void 0?function(n){return jo.create(n.compositeFilter.filters.map(i=>Qj(i)),function(r){switch(r){case"AND":return"and";case"OR":return"or";default:return Ae()}}(n.compositeFilter.op))}(e):Ae()}function T_e(e){return d_e[e]}function S_e(e){return f_e[e]}function I_e(e){return h_e[e]}function gf(e){return{fieldPath:e.canonicalString()}}function mf(e){return Ni.fromServerFormat(e.fieldPath)}function Jj(e){return e instanceof Kn?function(n){if(n.op==="=="){if(Nk(n.value))return{unaryFilter:{field:gf(n.field),op:"IS_NAN"}};if(Dk(n.value))return{unaryFilter:{field:gf(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Nk(n.value))return{unaryFilter:{field:gf(n.field),op:"IS_NOT_NAN"}};if(Dk(n.value))return{unaryFilter:{field:gf(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:gf(n.field),op:S_e(n.op),value:n.value}}}(e):e instanceof jo?function(n){const i=n.getFilters().map(r=>Jj(r));return i.length===1?i[0]:{compositeFilter:{op:I_e(n.op),filters:i}}}(e):Ae()}function x_e(e){const t=[];return e.fields.forEach(n=>t.push(n.canonicalString())),{fieldPaths:t}}function eY(e){return e.length>=4&&e.get(0)==="projects"&&e.get(2)==="databases"}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Xl{constructor(t,n,i,r,s=Le.min(),o=Le.min(),a=wi.EMPTY_BYTE_STRING,l=null){this.target=t,this.targetId=n,this.purpose=i,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=l}withSequenceNumber(t){return new Xl(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,n){return new Xl(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new Xl(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new Xl(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class C_e{constructor(t){this.Tt=t}}function A_e(e){const t=__e({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType==="LAST"?k4(t,t.limit,"L"):t}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class M_e{constructor(){this.Tn=new R_e}addToCollectionParentIndex(t,n){return this.Tn.add(n),ie.resolve()}getCollectionParents(t,n){return ie.resolve(this.Tn.getEntries(n))}addFieldIndex(t,n){return ie.resolve()}deleteFieldIndex(t,n){return ie.resolve()}deleteAllFieldIndexes(t){return ie.resolve()}createTargetIndexes(t,n){return ie.resolve()}getDocumentsMatchingTarget(t,n){return ie.resolve(null)}getIndexType(t,n){return ie.resolve(0)}getFieldIndexes(t,n){return ie.resolve([])}getNextCollectionGroupToUpdate(t){return ie.resolve(null)}getMinOffset(t,n){return ie.resolve(Cc.min())}getMinOffsetFromCollectionGroup(t,n){return ie.resolve(Cc.min())}updateCollectionGroup(t,n,i){return ie.resolve()}updateIndexEntries(t,n){return ie.resolve()}}class R_e{constructor(){this.index={}}add(t){const n=t.lastSegment(),i=t.popLast(),r=this.index[n]||new Zn(rn.comparator),s=!r.has(i);return this.index[n]=r.add(i),s}has(t){const n=t.lastSegment(),i=t.popLast(),r=this.index[n];return r&&r.has(i)}getEntries(t){return(this.index[t]||new Zn(rn.comparator)).toArray()}}/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Zk={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},tY=41943040;class cr{static withCacheSize(t){return new cr(t,cr.DEFAULT_COLLECTION_PERCENTILE,cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(t,n,i){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=i}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */cr.DEFAULT_COLLECTION_PERCENTILE=10,cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,cr.DEFAULT=new cr(tY,cr.DEFAULT_COLLECTION_PERCENTILE,cr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),cr.DISABLED=new cr(-1,0,0);/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Hh{constructor(t){this.$n=t}next(){return this.$n+=2,this.$n}static Kn(){return new Hh(0)}static Un(){return new Hh(-1)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const qk="LruGarbageCollector",k_e=1048576;function Qk([e,t],[n,i]){const r=dt(e,n);return r===0?dt(t,i):r}class L_e{constructor(t){this.Hn=t,this.buffer=new Zn(Qk),this.Jn=0}Yn(){return++this.Jn}Zn(t){const n=[t,this.Yn()];if(this.buffer.size<this.Hn)this.buffer=this.buffer.add(n);else{const i=this.buffer.last();Qk(n,i)<0&&(this.buffer=this.buffer.delete(i).add(n))}}get maxValue(){return this.buffer.last()[0]}}class D_e{constructor(t,n,i){this.garbageCollector=t,this.asyncQueue=n,this.localStore=i,this.Xn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.er(6e4)}stop(){this.Xn&&(this.Xn.cancel(),this.Xn=null)}get started(){return this.Xn!==null}er(t){Ee(qk,`Garbage collection scheduled in ${t}ms`),this.Xn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",t,async()=>{this.Xn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){d1(n)?Ee(qk,"Ignoring IndexedDB error during garbage collection: ",n):await X5(n)}await this.er(3e5)})}}class N_e{constructor(t,n){this.tr=t,this.params=n}calculateTargetCount(t,n){return this.tr.nr(t).next(i=>Math.floor(n/100*i))}nthSequenceNumber(t,n){if(n===0)return ie.resolve(j5.ae);const i=new L_e(n);return this.tr.forEachTarget(t,r=>i.Zn(r.sequenceNumber)).next(()=>this.tr.rr(t,r=>i.Zn(r))).next(()=>i.maxValue)}removeTargets(t,n,i){return this.tr.removeTargets(t,n,i)}removeOrphanedDocuments(t,n){return this.tr.removeOrphanedDocuments(t,n)}collect(t,n){return this.params.cacheSizeCollectionThreshold===-1?(Ee("LruGarbageCollector","Garbage collection skipped; disabled"),ie.resolve(Zk)):this.getCacheSize(t).next(i=>i<this.params.cacheSizeCollectionThreshold?(Ee("LruGarbageCollector",`Garbage collection skipped; Cache size ${i} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Zk):this.ir(t,n))}getCacheSize(t){return this.tr.getCacheSize(t)}ir(t,n){let i,r,s,o,a,l,c;const u=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next(d=>(d>this.params.maximumSequenceNumbersToCollect?(Ee("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),r=this.params.maximumSequenceNumbersToCollect):r=d,o=Date.now(),this.nthSequenceNumber(t,r))).next(d=>(i=d,a=Date.now(),this.removeTargets(t,i,n))).next(d=>(s=d,l=Date.now(),this.removeOrphanedDocuments(t,i))).next(d=>(c=Date.now(),ff()<=ct.DEBUG&&Ee("LruGarbageCollector",`LRU Garbage Collection
	Counted targets in ${o-u}ms
	Determined least recently used ${r} in `+(a-o)+`ms
	Removed ${s} targets in `+(l-a)+`ms
	Removed ${d} documents in `+(c-l)+`ms
Total Duration: ${c-u}ms`),ie.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:s,documentsRemoved:d})))}}function O_e(e,t){return new N_e(e,t)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class P_e{constructor(){this.changes=new Od(t=>t.toString(),(t,n)=>t.isEqual(n)),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,n){this.assertNotApplied(),this.changes.set(t,si.newInvalidDocument(t).setReadTime(n))}getEntry(t,n){this.assertNotApplied();const i=this.changes.get(n);return i!==void 0?ie.resolve(i):this.getFromCache(t,n)}getEntries(t,n){return this.getAllFromCache(t,n)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class F_e{constructor(t,n){this.overlayedDocument=t,this.mutatedFields=n}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class B_e{constructor(t,n,i,r){this.remoteDocumentCache=t,this.mutationQueue=n,this.documentOverlayCache=i,this.indexManager=r}getDocument(t,n){let i=null;return this.documentOverlayCache.getOverlay(t,n).next(r=>(i=r,this.remoteDocumentCache.getEntry(t,n))).next(r=>(i!==null&&u0(i.mutation,r,os.empty(),di.now()),r))}getDocuments(t,n){return this.remoteDocumentCache.getEntries(t,n).next(i=>this.getLocalViewOfDocuments(t,i,Ut()).next(()=>i))}getLocalViewOfDocuments(t,n,i=Ut()){const r=Su();return this.populateOverlays(t,r,n).next(()=>this.computeViews(t,n,r,i).next(s=>{let o=_g();return s.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(t,n){const i=Su();return this.populateOverlays(t,i,n).next(()=>this.computeViews(t,n,i,Ut()))}populateOverlays(t,n,i){const r=[];return i.forEach(s=>{n.has(s)||r.push(s)}),this.documentOverlayCache.getOverlays(t,r).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(t,n,i,r){let s=kc();const o=c0(),a=function(){return c0()}();return n.forEach((l,c)=>{const u=i.get(c.key);r.has(c.key)&&(u===void 0||u.mutation instanceof Pd)?s=s.insert(c.key,c):u!==void 0?(o.set(c.key,u.mutation.getFieldMask()),u0(u.mutation,c,u.mutation.getFieldMask(),di.now())):o.set(c.key,os.empty())}),this.recalculateAndSaveOverlays(t,s).next(l=>(l.forEach((c,u)=>o.set(c,u)),n.forEach((c,u)=>{var d;return a.set(c,new F_e(u,(d=o.get(c))!==null&&d!==void 0?d:null))}),a))}recalculateAndSaveOverlays(t,n){const i=c0();let r=new An((o,a)=>o-a),s=Ut();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,n).next(o=>{for(const a of o)a.keys().forEach(l=>{const c=n.get(l);if(c===null)return;let u=i.get(l)||os.empty();u=a.applyToLocalView(c,u),i.set(l,u);const d=(r.get(a.batchId)||Ut()).add(l);r=r.insert(a.batchId,d)})}).next(()=>{const o=[],a=r.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),c=l.key,u=l.value,d=Pj();u.forEach(f=>{if(!s.has(f)){const h=Vj(n.get(f),i.get(f));h!==null&&d.set(f,h),s=s.add(f)}}),o.push(this.documentOverlayCache.saveOverlays(t,c,d))}return ie.waitFor(o)}).next(()=>i)}recalculateAndSaveOverlaysForDocumentKeys(t,n){return this.remoteDocumentCache.getEntries(t,n).next(i=>this.recalculateAndSaveOverlays(t,i))}getDocumentsMatchingQuery(t,n,i,r){return function(o){return Me.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(t,n.path):$9e(n)?this.getDocumentsMatchingCollectionGroupQuery(t,n,i,r):this.getDocumentsMatchingCollectionQuery(t,n,i,r)}getNextDocuments(t,n,i,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,n,i,r).next(s=>{const o=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,n,i.largestBatchId,r-s.size):ie.resolve(Su());let a=hm,l=s;return o.next(c=>ie.forEach(c,(u,d)=>(a<d.largestBatchId&&(a=d.largestBatchId),s.get(u)?ie.resolve():this.remoteDocumentCache.getEntry(t,u).next(f=>{l=l.insert(u,f)}))).next(()=>this.populateOverlays(t,c,s)).next(()=>this.computeViews(t,l,c,Ut())).next(u=>({batchId:a,changes:W9e(u)})))})}getDocumentsMatchingDocumentQuery(t,n){return this.getDocument(t,new Me(n)).next(i=>{let r=_g();return i.isFoundDocument()&&(r=r.insert(i.key,i)),r})}getDocumentsMatchingCollectionGroupQuery(t,n,i,r){const s=n.collectionGroup;let o=_g();return this.indexManager.getCollectionParents(t,s).next(a=>ie.forEach(a,l=>{const c=function(d,f){return new W5(f,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)}(n,l.child(s));return this.getDocumentsMatchingCollectionQuery(t,c,i,r).next(u=>{u.forEach((d,f)=>{o=o.insert(d,f)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(t,n,i,r){let s;return this.documentOverlayCache.getOverlaysForCollection(t,n.path,i.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(t,n,i,s,r))).next(o=>{s.forEach((l,c)=>{const u=c.getKey();o.get(u)===null&&(o=o.insert(u,si.newInvalidDocument(u)))});let a=_g();return o.forEach((l,c)=>{const u=s.get(l);u!==void 0&&u0(u.mutation,c,os.empty(),di.now()),Z5(n,c)&&(a=a.insert(l,c))}),a})}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class z_e{constructor(t){this.serializer=t,this.dr=new Map,this.Ar=new Map}getBundleMetadata(t,n){return ie.resolve(this.dr.get(n))}saveBundleMetadata(t,n){return this.dr.set(n.id,function(r){return{id:r.id,version:r.version,createTime:Oa(r.createTime)}}(n)),ie.resolve()}getNamedQuery(t,n){return ie.resolve(this.Ar.get(n))}saveNamedQuery(t,n){return this.Ar.set(n.name,function(r){return{name:r.name,query:A_e(r.bundledQuery),readTime:Oa(r.readTime)}}(n)),ie.resolve()}}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class H_e{constructor(){this.overlays=new An(Me.comparator),this.Rr=new Map}getOverlay(t,n){return ie.resolve(this.overlays.get(n))}getOverlays(t,n){const i=Su();return ie.forEach(n,r=>this.getOverlay(t,r).next(s=>{s!==null&&i.set(r,s)})).next(()=>i)}saveOverlays(t,n,i){return i.forEach((r,s)=>{this.Et(t,n,s)}),ie.resolve()}removeOverlaysForBatchId(t,n,i){const r=this.Rr.get(i);return r!==void 0&&(r.forEach(s=>this.overlays=this.overlays.remove(s)),this.Rr.delete(i)),ie.resolve()}getOverlaysForCollection(t,n,i){const r=Su(),s=n.length+1,o=new Me(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,c=l.getKey();if(!n.isPrefixOf(c.path))break;c.path.length===s&&l.largestBatchId>i&&r.set(l.getKey(),l)}return ie.resolve(r)}getOverlaysForCollectionGroup(t,n,i,r){let s=new An((c,u)=>c-u);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===n&&c.largestBatchId>i){let u=s.get(c.largestBatchId);u===null&&(u=Su(),s=s.insert(c.largestBatchId,u)),u.set(c.getKey(),c)}}const a=Su(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((c,u)=>a.set(c,u)),!(a.size()>=r)););return ie.resolve(a)}Et(t,n,i){const r=this.overlays.get(i.key);if(r!==null){const o=this.Rr.get(r.largestBatchId).delete(i.key);this.Rr.set(r.largestBatchId,o)}this.overlays=this.overlays.insert(i.key,new s_e(n,i));let s=this.Rr.get(n);s===void 0&&(s=Ut(),this.Rr.set(n,s)),this.Rr.set(n,s.add(i.key))}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class V_e{constructor(){this.sessionToken=wi.EMPTY_BYTE_STRING}getSessionToken(t){return ie.resolve(this.sessionToken)}setSessionToken(t,n){return this.sessionToken=n,ie.resolve()}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Hw{constructor(){this.Vr=new Zn(ni.mr),this.gr=new Zn(ni.pr)}isEmpty(){return this.Vr.isEmpty()}addReference(t,n){const i=new ni(t,n);this.Vr=this.Vr.add(i),this.gr=this.gr.add(i)}yr(t,n){t.forEach(i=>this.addReference(i,n))}removeReference(t,n){this.wr(new ni(t,n))}Sr(t,n){t.forEach(i=>this.removeReference(i,n))}br(t){const n=new Me(new rn([])),i=new ni(n,t),r=new ni(n,t+1),s=[];return this.gr.forEachInRange([i,r],o=>{this.wr(o),s.push(o.key)}),s}Dr(){this.Vr.forEach(t=>this.wr(t))}wr(t){this.Vr=this.Vr.delete(t),this.gr=this.gr.delete(t)}vr(t){const n=new Me(new rn([])),i=new ni(n,t),r=new ni(n,t+1);let s=Ut();return this.gr.forEachInRange([i,r],o=>{s=s.add(o.key)}),s}containsKey(t){const n=new ni(t,0),i=this.Vr.firstAfterOrEqual(n);return i!==null&&t.isEqual(i.key)}}class ni{constructor(t,n){this.key=t,this.Cr=n}static mr(t,n){return Me.comparator(t.key,n.key)||dt(t.Cr,n.Cr)}static pr(t,n){return dt(t.Cr,n.Cr)||Me.comparator(t.key,n.key)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $_e{constructor(t,n){this.indexManager=t,this.referenceDelegate=n,this.mutationQueue=[],this.Fr=1,this.Mr=new Zn(ni.mr)}checkEmpty(t){return ie.resolve(this.mutationQueue.length===0)}addMutationBatch(t,n,i,r){const s=this.Fr;this.Fr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new r_e(s,n,i,r);this.mutationQueue.push(o);for(const a of r)this.Mr=this.Mr.add(new ni(a.key,s)),this.indexManager.addToCollectionParentIndex(t,a.key.path.popLast());return ie.resolve(o)}lookupMutationBatch(t,n){return ie.resolve(this.Or(n))}getNextMutationBatchAfterBatchId(t,n){const i=n+1,r=this.Nr(i),s=r<0?0:r;return ie.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return ie.resolve(this.mutationQueue.length===0?w9e:this.Fr-1)}getAllMutationBatches(t){return ie.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,n){const i=new ni(n,0),r=new ni(n,Number.POSITIVE_INFINITY),s=[];return this.Mr.forEachInRange([i,r],o=>{const a=this.Or(o.Cr);s.push(a)}),ie.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,n){let i=new Zn(dt);return n.forEach(r=>{const s=new ni(r,0),o=new ni(r,Number.POSITIVE_INFINITY);this.Mr.forEachInRange([s,o],a=>{i=i.add(a.Cr)})}),ie.resolve(this.Br(i))}getAllMutationBatchesAffectingQuery(t,n){const i=n.path,r=i.length+1;let s=i;Me.isDocumentKey(s)||(s=s.child(""));const o=new ni(new Me(s),0);let a=new Zn(dt);return this.Mr.forEachWhile(l=>{const c=l.key.path;return!!i.isPrefixOf(c)&&(c.length===r&&(a=a.add(l.Cr)),!0)},o),ie.resolve(this.Br(a))}Br(t){const n=[];return t.forEach(i=>{const r=this.Or(i);r!==null&&n.push(r)}),n}removeMutationBatch(t,n){Bt(this.Lr(n.batchId,"removed")===0),this.mutationQueue.shift();let i=this.Mr;return ie.forEach(n.mutations,r=>{const s=new ni(r.key,n.batchId);return i=i.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)}).next(()=>{this.Mr=i})}qn(t){}containsKey(t,n){const i=new ni(n,0),r=this.Mr.firstAfterOrEqual(i);return ie.resolve(n.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,ie.resolve()}Lr(t,n){return this.Nr(t)}Nr(t){return this.mutationQueue.length===0?0:t-this.mutationQueue[0].batchId}Or(t){const n=this.Nr(t);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class G_e{constructor(t){this.kr=t,this.docs=function(){return new An(Me.comparator)}(),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,n){const i=n.key,r=this.docs.get(i),s=r?r.size:0,o=this.kr(n);return this.docs=this.docs.insert(i,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(t,i.path.popLast())}removeEntry(t){const n=this.docs.get(t);n&&(this.docs=this.docs.remove(t),this.size-=n.size)}getEntry(t,n){const i=this.docs.get(n);return ie.resolve(i?i.document.mutableCopy():si.newInvalidDocument(n))}getEntries(t,n){let i=kc();return n.forEach(r=>{const s=this.docs.get(r);i=i.insert(r,s?s.document.mutableCopy():si.newInvalidDocument(r))}),ie.resolve(i)}getDocumentsMatchingQuery(t,n,i,r){let s=kc();const o=n.path,a=new Me(o.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:c,value:{document:u}}=l.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||y9e(b9e(u),i)<=0||(r.has(u.key)||Z5(n,u))&&(s=s.insert(u.key,u.mutableCopy()))}return ie.resolve(s)}getAllFromCollectionGroup(t,n,i,r){Ae()}qr(t,n){return ie.forEach(this.docs,i=>n(i))}newChangeBuffer(t){return new X_e(this)}getSize(t){return ie.resolve(this.size)}}class X_e extends P_e{constructor(t){super(),this.Ir=t}applyChanges(t){const n=[];return this.changes.forEach((i,r)=>{r.isValidDocument()?n.push(this.Ir.addEntry(t,r)):this.Ir.removeEntry(i)}),ie.waitFor(n)}getFromCache(t,n){return this.Ir.getEntry(t,n)}getAllFromCache(t,n){return this.Ir.getEntries(t,n)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class j_e{constructor(t){this.persistence=t,this.Qr=new Od(n=>Dw(n),Nw),this.lastRemoteSnapshotVersion=Le.min(),this.highestTargetId=0,this.$r=0,this.Kr=new Hw,this.targetCount=0,this.Ur=Hh.Kn()}forEachTarget(t,n){return this.Qr.forEach((i,r)=>n(r)),ie.resolve()}getLastRemoteSnapshotVersion(t){return ie.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return ie.resolve(this.$r)}allocateTargetId(t){return this.highestTargetId=this.Ur.next(),ie.resolve(this.highestTargetId)}setTargetsMetadata(t,n,i){return i&&(this.lastRemoteSnapshotVersion=i),n>this.$r&&(this.$r=n),ie.resolve()}zn(t){this.Qr.set(t.target,t);const n=t.targetId;n>this.highestTargetId&&(this.Ur=new Hh(n),this.highestTargetId=n),t.sequenceNumber>this.$r&&(this.$r=t.sequenceNumber)}addTargetData(t,n){return this.zn(n),this.targetCount+=1,ie.resolve()}updateTargetData(t,n){return this.zn(n),ie.resolve()}removeTargetData(t,n){return this.Qr.delete(n.target),this.Kr.br(n.targetId),this.targetCount-=1,ie.resolve()}removeTargets(t,n,i){let r=0;const s=[];return this.Qr.forEach((o,a)=>{a.sequenceNumber<=n&&i.get(a.targetId)===null&&(this.Qr.delete(o),s.push(this.removeMatchingKeysForTargetId(t,a.targetId)),r++)}),ie.waitFor(s).next(()=>r)}getTargetCount(t){return ie.resolve(this.targetCount)}getTargetData(t,n){const i=this.Qr.get(n)||null;return ie.resolve(i)}addMatchingKeys(t,n,i){return this.Kr.yr(n,i),ie.resolve()}removeMatchingKeys(t,n,i){this.Kr.Sr(n,i);const r=this.persistence.referenceDelegate,s=[];return r&&n.forEach(o=>{s.push(r.markPotentiallyOrphaned(t,o))}),ie.waitFor(s)}removeMatchingKeysForTargetId(t,n){return this.Kr.br(n),ie.resolve()}getMatchingKeysForTargetId(t,n){const i=this.Kr.vr(n);return ie.resolve(i)}containsKey(t,n){return ie.resolve(this.Kr.containsKey(n))}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nY{constructor(t,n){this.Wr={},this.overlays={},this.Gr=new j5(0),this.zr=!1,this.zr=!0,this.jr=new V_e,this.referenceDelegate=t(this),this.Hr=new j_e(this),this.indexManager=new M_e,this.remoteDocumentCache=function(r){return new G_e(r)}(i=>this.referenceDelegate.Jr(i)),this.serializer=new C_e(n),this.Yr=new z_e(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.zr=!1,Promise.resolve()}get started(){return this.zr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let n=this.overlays[t.toKey()];return n||(n=new H_e,this.overlays[t.toKey()]=n),n}getMutationQueue(t,n){let i=this.Wr[t.toKey()];return i||(i=new $_e(n,this.referenceDelegate),this.Wr[t.toKey()]=i),i}getGlobalsCache(){return this.jr}getTargetCache(){return this.Hr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Yr}runTransaction(t,n,i){Ee("MemoryPersistence","Starting transaction:",t);const r=new Y_e(this.Gr.next());return this.referenceDelegate.Zr(),i(r).next(s=>this.referenceDelegate.Xr(r).next(()=>s)).toPromise().then(s=>(r.raiseOnCommittedEvent(),s))}ei(t,n){return ie.or(Object.values(this.Wr).map(i=>()=>i.containsKey(t,n)))}}class Y_e extends v9e{constructor(t){super(),this.currentSequenceNumber=t}}class Vw{constructor(t){this.persistence=t,this.ti=new Hw,this.ni=null}static ri(t){return new Vw(t)}get ii(){if(this.ni)return this.ni;throw Ae()}addReference(t,n,i){return this.ti.addReference(i,n),this.ii.delete(i.toString()),ie.resolve()}removeReference(t,n,i){return this.ti.removeReference(i,n),this.ii.add(i.toString()),ie.resolve()}markPotentiallyOrphaned(t,n){return this.ii.add(n.toString()),ie.resolve()}removeTarget(t,n){this.ti.br(n.targetId).forEach(r=>this.ii.add(r.toString()));const i=this.persistence.getTargetCache();return i.getMatchingKeysForTargetId(t,n.targetId).next(r=>{r.forEach(s=>this.ii.add(s.toString()))}).next(()=>i.removeTargetData(t,n))}Zr(){this.ni=new Set}Xr(t){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ie.forEach(this.ii,i=>{const r=Me.fromPath(i);return this.si(t,r).next(s=>{s||n.removeEntry(r,Le.min())})}).next(()=>(this.ni=null,n.apply(t)))}updateLimboDocument(t,n){return this.si(t,n).next(i=>{i?this.ii.delete(n.toString()):this.ii.add(n.toString())})}Jr(t){return 0}si(t,n){return ie.or([()=>ie.resolve(this.ti.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(t,n),()=>this.persistence.ei(t,n)])}}class f6{constructor(t,n){this.persistence=t,this.oi=new Od(i=>S9e(i.path),(i,r)=>i.isEqual(r)),this.garbageCollector=O_e(this,n)}static ri(t,n){return new f6(t,n)}Zr(){}Xr(t){return ie.resolve()}forEachTarget(t,n){return this.persistence.getTargetCache().forEachTarget(t,n)}nr(t){const n=this.sr(t);return this.persistence.getTargetCache().getTargetCount(t).next(i=>n.next(r=>i+r))}sr(t){let n=0;return this.rr(t,i=>{n++}).next(()=>n)}rr(t,n){return ie.forEach(this.oi,(i,r)=>this.ar(t,i,r).next(s=>s?ie.resolve():n(r)))}removeTargets(t,n,i){return this.persistence.getTargetCache().removeTargets(t,n,i)}removeOrphanedDocuments(t,n){let i=0;const r=this.persistence.getRemoteDocumentCache(),s=r.newChangeBuffer();return r.qr(t,o=>this.ar(t,o,n).next(a=>{a||(i++,s.removeEntry(o,Le.min()))})).next(()=>s.apply(t)).next(()=>i)}markPotentiallyOrphaned(t,n){return this.oi.set(n,t.currentSequenceNumber),ie.resolve()}removeTarget(t,n){const i=n.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,i)}addReference(t,n,i){return this.oi.set(i,t.currentSequenceNumber),ie.resolve()}removeReference(t,n,i){return this.oi.set(i,t.currentSequenceNumber),ie.resolve()}updateLimboDocument(t,n){return this.oi.set(n,t.currentSequenceNumber),ie.resolve()}Jr(t){let n=t.key.toString().length;return t.isFoundDocument()&&(n+=b2(t.data.value)),n}ar(t,n,i){return ie.or([()=>this.persistence.ei(t,n),()=>this.persistence.getTargetCache().containsKey(t,n),()=>{const r=this.oi.get(n);return ie.resolve(r!==void 0&&r>i)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $w{constructor(t,n,i,r){this.targetId=t,this.fromCache=n,this.Hi=i,this.Ji=r}static Yi(t,n){let i=Ut(),r=Ut();for(const s of n.docChanges)switch(s.type){case 0:i=i.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}return new $w(t,n.fromCache,i,r)}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class W_e{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class K_e{constructor(){this.Zi=!1,this.Xi=!1,this.es=100,this.ts=function(){return Y4e()?8:_9e(X4e())>0?6:4}()}initialize(t,n){this.ns=t,this.indexManager=n,this.Zi=!0}getDocumentsMatchingQuery(t,n,i,r){const s={result:null};return this.rs(t,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.ss(t,n,r,i).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new W_e;return this._s(t,n,o).next(a=>{if(s.result=a,this.Xi)return this.us(t,n,o,a.size)})}).next(()=>s.result)}us(t,n,i,r){return i.documentReadCount<this.es?(ff()<=ct.DEBUG&&Ee("QueryEngine","SDK will not create cache indexes for query:",hf(n),"since it only creates cache indexes for collection contains","more than or equal to",this.es,"documents"),ie.resolve()):(ff()<=ct.DEBUG&&Ee("QueryEngine","Query:",hf(n),"scans",i.documentReadCount,"local documents and returns",r,"documents as results."),i.documentReadCount>this.ts*r?(ff()<=ct.DEBUG&&Ee("QueryEngine","The SDK decides to create cache indexes for query:",hf(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,Oo(n))):ie.resolve())}rs(t,n){if(Bk(n))return ie.resolve(null);let i=Oo(n);return this.indexManager.getIndexType(t,i).next(r=>r===0?null:(n.limit!==null&&r===1&&(n=k4(n,null,"F"),i=Oo(n)),this.indexManager.getDocumentsMatchingTarget(t,i).next(s=>{const o=Ut(...s);return this.ns.getDocuments(t,o).next(a=>this.indexManager.getMinOffset(t,i).next(l=>{const c=this.cs(n,a);return this.ls(n,c,o,l.readTime)?this.rs(t,k4(n,null,"F")):this.hs(t,c,n,l)}))})))}ss(t,n,i,r){return Bk(n)||r.isEqual(Le.min())?ie.resolve(null):this.ns.getDocuments(t,i).next(s=>{const o=this.cs(n,s);return this.ls(n,o,i,r)?ie.resolve(null):(ff()<=ct.DEBUG&&Ee("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),hf(n)),this.hs(t,o,n,U9e(r,hm)).next(a=>a))})}cs(t,n){let i=new Zn(Nj(t));return n.forEach((r,s)=>{Z5(t,s)&&(i=i.add(s))}),i}ls(t,n,i,r){if(t.limit===null)return!1;if(i.size!==n.size)return!0;const s=t.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}_s(t,n,i){return ff()<=ct.DEBUG&&Ee("QueryEngine","Using full collection scan to execute query:",hf(n)),this.ns.getDocumentsMatchingQuery(t,n,Cc.min(),i)}hs(t,n,i,r){return this.ns.getDocumentsMatchingQuery(t,i,r).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Gw="LocalStore",Z_e=3e8;class q_e{constructor(t,n,i,r){this.persistence=t,this.Ps=n,this.serializer=r,this.Ts=new An(dt),this.Is=new Od(s=>Dw(s),Nw),this.Es=new Map,this.ds=t.getRemoteDocumentCache(),this.Hr=t.getTargetCache(),this.Yr=t.getBundleCache(),this.As(i)}As(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new B_e(this.ds,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ds.setIndexManager(this.indexManager),this.Ps.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>t.collect(n,this.Ts))}}function Q_e(e,t,n,i){return new q_e(e,t,n,i)}async function iY(e,t){const n=nt(e);return await n.persistence.runTransaction("Handle user change","readonly",i=>{let r;return n.mutationQueue.getAllMutationBatches(i).next(s=>(r=s,n.As(t),n.mutationQueue.getAllMutationBatches(i))).next(s=>{const o=[],a=[];let l=Ut();for(const c of r){o.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}for(const c of s){a.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}return n.localDocuments.getDocuments(i,l).next(c=>({Rs:c,removedBatchIds:o,addedBatchIds:a}))})})}function rY(e){const t=nt(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",n=>t.Hr.getLastRemoteSnapshotVersion(n))}function J_e(e,t){const n=nt(e),i=t.snapshotVersion;let r=n.Ts;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.ds.newChangeBuffer({trackRemovals:!0});r=n.Ts;const a=[];t.targetChanges.forEach((u,d)=>{const f=r.get(d);if(!f)return;a.push(n.Hr.removeMatchingKeys(s,u.removedDocuments,d).next(()=>n.Hr.addMatchingKeys(s,u.addedDocuments,d)));let h=f.withSequenceNumber(s.currentSequenceNumber);t.targetMismatches.get(d)!==null?h=h.withResumeToken(wi.EMPTY_BYTE_STRING,Le.min()).withLastLimboFreeSnapshotVersion(Le.min()):u.resumeToken.approximateByteSize()>0&&(h=h.withResumeToken(u.resumeToken,i)),r=r.insert(d,h),function(p,b,E){return p.resumeToken.approximateByteSize()===0||b.snapshotVersion.toMicroseconds()-p.snapshotVersion.toMicroseconds()>=Z_e?!0:E.addedDocuments.size+E.modifiedDocuments.size+E.removedDocuments.size>0}(f,h,u)&&a.push(n.Hr.updateTargetData(s,h))});let l=kc(),c=Ut();if(t.documentUpdates.forEach(u=>{t.resolvedLimboDocuments.has(u)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,u))}),a.push(ewe(s,o,t.documentUpdates).next(u=>{l=u.Vs,c=u.fs})),!i.isEqual(Le.min())){const u=n.Hr.getLastRemoteSnapshotVersion(s).next(d=>n.Hr.setTargetsMetadata(s,s.currentSequenceNumber,i));a.push(u)}return ie.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,l,c)).next(()=>l)}).then(s=>(n.Ts=r,s))}function ewe(e,t,n){let i=Ut(),r=Ut();return n.forEach(s=>i=i.add(s)),t.getEntries(e,i).next(s=>{let o=kc();return n.forEach((a,l)=>{const c=s.get(a);l.isFoundDocument()!==c.isFoundDocument()&&(r=r.add(a)),l.isNoDocument()&&l.version.isEqual(Le.min())?(t.removeEntry(a,l.readTime),o=o.insert(a,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(t.addEntry(l),o=o.insert(a,l)):Ee(Gw,"Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",l.version)}),{Vs:o,fs:r}})}function twe(e,t){const n=nt(e);return n.persistence.runTransaction("Allocate target","readwrite",i=>{let r;return n.Hr.getTargetData(i,t).next(s=>s?(r=s,ie.resolve(r)):n.Hr.allocateTargetId(i).next(o=>(r=new Xl(t,o,"TargetPurposeListen",i.currentSequenceNumber),n.Hr.addTargetData(i,r).next(()=>r))))}).then(i=>{const r=n.Ts.get(i.targetId);return(r===null||i.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.Ts=n.Ts.insert(i.targetId,i),n.Is.set(t,i.targetId)),i})}async function N4(e,t,n){const i=nt(e),r=i.Ts.get(t),s=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",s,o=>i.persistence.referenceDelegate.removeTarget(o,r))}catch(o){if(!d1(o))throw o;Ee(Gw,`Failed to update sequence numbers for target ${t}: ${o}`)}i.Ts=i.Ts.remove(t),i.Is.delete(r.target)}function Jk(e,t,n){const i=nt(e);let r=Le.min(),s=Ut();return i.persistence.runTransaction("Execute query","readwrite",o=>function(l,c,u){const d=nt(l),f=d.Is.get(u);return f!==void 0?ie.resolve(d.Ts.get(f)):d.Hr.getTargetData(c,u)}(i,o,Oo(t)).next(a=>{if(a)return r=a.lastLimboFreeSnapshotVersion,i.Hr.getMatchingKeysForTargetId(o,a.targetId).next(l=>{s=l})}).next(()=>i.Ps.getDocumentsMatchingQuery(o,t,n?r:Le.min(),n?s:Ut())).next(a=>(nwe(i,X9e(t),a),{documents:a,gs:s})))}function nwe(e,t,n){let i=e.Es.get(t)||Le.min();n.forEach((r,s)=>{s.readTime.compareTo(i)>0&&(i=s.readTime)}),e.Es.set(t,i)}class eL{constructor(){this.activeTargetIds=q9e()}Ds(t){this.activeTargetIds=this.activeTargetIds.add(t)}vs(t){this.activeTargetIds=this.activeTargetIds.delete(t)}bs(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class iwe{constructor(){this.ho=new eL,this.Po={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,n,i){}addLocalQueryTarget(t,n=!0){return n&&this.ho.Ds(t),this.Po[t]||"not-current"}updateQueryState(t,n,i){this.Po[t]=n}removeLocalQueryTarget(t){this.ho.vs(t)}isLocalQueryTarget(t){return this.ho.activeTargetIds.has(t)}clearQueryState(t){delete this.Po[t]}getAllActiveQueryTargets(){return this.ho.activeTargetIds}isActiveQueryTarget(t){return this.ho.activeTargetIds.has(t)}start(){return this.ho=new eL,Promise.resolve()}handleUserChange(t,n,i){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class rwe{To(t){}shutdown(){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const tL="ConnectivityMonitor";class nL{constructor(){this.Io=()=>this.Eo(),this.Ao=()=>this.Ro(),this.Vo=[],this.mo()}To(t){this.Vo.push(t)}shutdown(){window.removeEventListener("online",this.Io),window.removeEventListener("offline",this.Ao)}mo(){window.addEventListener("online",this.Io),window.addEventListener("offline",this.Ao)}Eo(){Ee(tL,"Network connectivity changed: AVAILABLE");for(const t of this.Vo)t(0)}Ro(){Ee(tL,"Network connectivity changed: UNAVAILABLE");for(const t of this.Vo)t(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */let IU=null;function O4(){return IU===null?IU=function(){return 268435456+Math.round(2147483648*Math.random())}():IU++,"0x"+IU.toString(16)}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const D7="RestConnection",swe={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class owe{get fo(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const n=t.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.po=n+"://"+t.host,this.yo=`projects/${i}/databases/${r}`,this.wo=this.databaseId.database===r6?`project_id=${i}`:`project_id=${i}&database_id=${r}`}So(t,n,i,r,s){const o=O4(),a=this.bo(t,n.toUriEncodedString());Ee(D7,`Sending RPC '${t}' ${o}:`,a,i);const l={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};return this.Do(l,r,s),this.vo(t,a,l,i).then(c=>(Ee(D7,`Received RPC '${t}' ${o}: `,c),c),c=>{throw Ph(D7,`RPC '${t}' ${o} failed with error: `,c,"url: ",a,"request:",i),c})}Co(t,n,i,r,s,o){return this.So(t,n,i,r,s)}Do(t,n,i){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+u1}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((r,s)=>t[s]=r),i&&i.headers.forEach((r,s)=>t[s]=r)}bo(t,n){const i=swe[t];return`${this.po}/v1/${n}:${i}`}terminate(){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class awe{constructor(t){this.Fo=t.Fo,this.Mo=t.Mo}xo(t){this.Oo=t}No(t){this.Bo=t}Lo(t){this.ko=t}onMessage(t){this.qo=t}close(){this.Mo()}send(t){this.Fo(t)}Qo(){this.Oo()}$o(){this.Bo()}Ko(t){this.ko(t)}Uo(t){this.qo(t)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ci="WebChannelConnection";class lwe extends owe{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}vo(t,n,i,r){const s=O4();return new Promise((o,a)=>{const l=new fj;l.setWithCredentials(!0),l.listenOnce(hj.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case U2.NO_ERROR:const u=l.getResponseJson();Ee(Ci,`XHR for RPC '${t}' ${s} received:`,JSON.stringify(u)),o(u);break;case U2.TIMEOUT:Ee(Ci,`RPC '${t}' ${s} timed out`),a(new Te(re.DEADLINE_EXCEEDED,"Request time out"));break;case U2.HTTP_ERROR:const d=l.getStatus();if(Ee(Ci,`RPC '${t}' ${s} failed with status:`,d,"response text:",l.getResponseText()),d>0){let f=l.getResponseJson();Array.isArray(f)&&(f=f[0]);const h=f==null?void 0:f.error;if(h&&h.status&&h.message){const m=function(b){const E=b.toLowerCase().replace(/_/g,"-");return Object.values(re).indexOf(E)>=0?E:re.UNKNOWN}(h.status);a(new Te(m,h.message))}else a(new Te(re.UNKNOWN,"Server responded with status "+l.getStatus()))}else a(new Te(re.UNAVAILABLE,"Connection failed."));break;default:Ae()}}finally{Ee(Ci,`RPC '${t}' ${s} completed.`)}});const c=JSON.stringify(r);Ee(Ci,`RPC '${t}' ${s} sending request:`,r),l.send(n,"POST",c,i,15)})}Wo(t,n,i){const r=O4(),s=[this.po,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=pj(),a=mj(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Do(l.initMessageHeaders,n,i),l.encodeInitMessageHeaders=!0;const u=s.join("");Ee(Ci,`Creating RPC '${t}' stream ${r}: ${u}`,l);const d=o.createWebChannel(u,l);let f=!1,h=!1;const m=new awe({Fo:b=>{h?Ee(Ci,`Not sending because RPC '${t}' stream ${r} is closed:`,b):(f||(Ee(Ci,`Opening RPC '${t}' stream ${r} transport.`),d.open(),f=!0),Ee(Ci,`RPC '${t}' stream ${r} sending:`,b),d.send(b))},Mo:()=>d.close()}),p=(b,E,y)=>{b.listen(E,v=>{try{y(v)}catch(_){setTimeout(()=>{throw _},0)}})};return p(d,vg.EventType.OPEN,()=>{h||(Ee(Ci,`RPC '${t}' stream ${r} transport opened.`),m.Qo())}),p(d,vg.EventType.CLOSE,()=>{h||(h=!0,Ee(Ci,`RPC '${t}' stream ${r} transport closed`),m.Ko())}),p(d,vg.EventType.ERROR,b=>{h||(h=!0,Ph(Ci,`RPC '${t}' stream ${r} transport errored:`,b),m.Ko(new Te(re.UNAVAILABLE,"The operation could not be completed")))}),p(d,vg.EventType.MESSAGE,b=>{var E;if(!h){const y=b.data[0];Bt(!!y);const v=y,_=(v==null?void 0:v.error)||((E=v[0])===null||E===void 0?void 0:E.error);if(_){Ee(Ci,`RPC '${t}' stream ${r} received error:`,_);const I=_.status;let R=function(A){const S=kn[A];if(S!==void 0)return Xj(S)}(I),w=_.message;R===void 0&&(R=re.INTERNAL,w="Unknown error status: "+I+" with message "+_.message),h=!0,m.Ko(new Te(R,w)),d.close()}else Ee(Ci,`RPC '${t}' stream ${r} received:`,y),m.Uo(y)}}),p(a,gj.STAT_EVENT,b=>{b.stat===x4.PROXY?Ee(Ci,`RPC '${t}' stream ${r} detected buffering proxy`):b.stat===x4.NOPROXY&&Ee(Ci,`RPC '${t}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{m.$o()},0),m}}function N7(){return typeof document<"u"?document:null}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function ey(e){return new g_e(e,!0)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Xw{constructor(t,n,i=1e3,r=1.5,s=6e4){this.Ti=t,this.timerId=n,this.Go=i,this.zo=r,this.jo=s,this.Ho=0,this.Jo=null,this.Yo=Date.now(),this.reset()}reset(){this.Ho=0}Zo(){this.Ho=this.jo}Xo(t){this.cancel();const n=Math.floor(this.Ho+this.e_()),i=Math.max(0,Date.now()-this.Yo),r=Math.max(0,n-i);r>0&&Ee("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Ho} ms, delay with jitter: ${n} ms, last attempt: ${i} ms ago)`),this.Jo=this.Ti.enqueueAfterDelay(this.timerId,r,()=>(this.Yo=Date.now(),t())),this.Ho*=this.zo,this.Ho<this.Go&&(this.Ho=this.Go),this.Ho>this.jo&&(this.Ho=this.jo)}t_(){this.Jo!==null&&(this.Jo.skipDelay(),this.Jo=null)}cancel(){this.Jo!==null&&(this.Jo.cancel(),this.Jo=null)}e_(){return(Math.random()-.5)*this.Ho}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const iL="PersistentStream";class cwe{constructor(t,n,i,r,s,o,a,l){this.Ti=t,this.n_=i,this.r_=r,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.i_=0,this.s_=null,this.o_=null,this.stream=null,this.__=0,this.a_=new Xw(t,n)}u_(){return this.state===1||this.state===5||this.c_()}c_(){return this.state===2||this.state===3}start(){this.__=0,this.state!==4?this.auth():this.l_()}async stop(){this.u_()&&await this.close(0)}h_(){this.state=0,this.a_.reset()}P_(){this.c_()&&this.s_===null&&(this.s_=this.Ti.enqueueAfterDelay(this.n_,6e4,()=>this.T_()))}I_(t){this.E_(),this.stream.send(t)}async T_(){if(this.c_())return this.close(0)}E_(){this.s_&&(this.s_.cancel(),this.s_=null)}d_(){this.o_&&(this.o_.cancel(),this.o_=null)}async close(t,n){this.E_(),this.d_(),this.a_.cancel(),this.i_++,t!==4?this.a_.reset():n&&n.code===re.RESOURCE_EXHAUSTED?(il(n.toString()),il("Using maximum backoff delay to prevent overloading the backend."),this.a_.Zo()):n&&n.code===re.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.A_(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Lo(n)}A_(){}auth(){this.state=1;const t=this.R_(this.i_),n=this.i_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([i,r])=>{this.i_===n&&this.V_(i,r)},i=>{t(()=>{const r=new Te(re.UNKNOWN,"Fetching auth token failed: "+i.message);return this.m_(r)})})}V_(t,n){const i=this.R_(this.i_);this.stream=this.f_(t,n),this.stream.xo(()=>{i(()=>this.listener.xo())}),this.stream.No(()=>{i(()=>(this.state=2,this.o_=this.Ti.enqueueAfterDelay(this.r_,1e4,()=>(this.c_()&&(this.state=3),Promise.resolve())),this.listener.No()))}),this.stream.Lo(r=>{i(()=>this.m_(r))}),this.stream.onMessage(r=>{i(()=>++this.__==1?this.g_(r):this.onNext(r))})}l_(){this.state=5,this.a_.Xo(async()=>{this.state=0,this.start()})}m_(t){return Ee(iL,`close with error: ${t}`),this.stream=null,this.close(4,t)}R_(t){return n=>{this.Ti.enqueueAndForget(()=>this.i_===t?n():(Ee(iL,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class uwe extends cwe{constructor(t,n,i,r,s,o){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,i,r,o),this.serializer=s}f_(t,n){return this.connection.Wo("Listen",t,n)}g_(t){return this.onNext(t)}onNext(t){this.a_.reset();const n=b_e(this.serializer,t),i=function(s){if(!("targetChange"in s))return Le.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?Le.min():o.readTime?Oa(o.readTime):Le.min()}(t);return this.listener.p_(n,i)}y_(t){const n={};n.database=Wk(this.serializer),n.addTarget=function(s,o){let a;const l=o.target;if(a=R4(l)?{documents:E_e(s,l)}:{query:v_e(s,l).ht},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=Wj(s,o.resumeToken);const c=L4(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(Le.min())>0){a.readTime=u6(s,o.snapshotVersion.toTimestamp());const c=L4(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,t);const i=w_e(this.serializer,t);i&&(n.labels=i),this.I_(n)}w_(t){const n={};n.database=Wk(this.serializer),n.removeTarget=t,this.I_(n)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class dwe{}class fwe extends dwe{constructor(t,n,i,r){super(),this.authCredentials=t,this.appCheckCredentials=n,this.connection=i,this.serializer=r,this.F_=!1}M_(){if(this.F_)throw new Te(re.FAILED_PRECONDITION,"The client has already been terminated.")}So(t,n,i,r){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.So(t,D4(n,i),r,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===re.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new Te(re.UNKNOWN,s.toString())})}Co(t,n,i,r,s){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Co(t,D4(n,i),r,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===re.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new Te(re.UNKNOWN,o.toString())})}terminate(){this.F_=!0,this.connection.terminate()}}class hwe{constructor(t,n){this.asyncQueue=t,this.onlineStateHandler=n,this.state="Unknown",this.x_=0,this.O_=null,this.N_=!0}B_(){this.x_===0&&(this.L_("Unknown"),this.O_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.O_=null,this.k_("Backend didn't respond within 10 seconds."),this.L_("Offline"),Promise.resolve())))}q_(t){this.state==="Online"?this.L_("Unknown"):(this.x_++,this.x_>=1&&(this.Q_(),this.k_(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.L_("Offline")))}set(t){this.Q_(),this.x_=0,t==="Online"&&(this.N_=!1),this.L_(t)}L_(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}k_(t){const n=`Could not reach Cloud Firestore backend. ${t}
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.N_?(il(n),this.N_=!1):Ee("OnlineStateTracker",n)}Q_(){this.O_!==null&&(this.O_.cancel(),this.O_=null)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Vh="RemoteStore";class gwe{constructor(t,n,i,r,s){this.localStore=t,this.datastore=n,this.asyncQueue=i,this.remoteSyncer={},this.K_=[],this.U_=new Map,this.W_=new Set,this.G_=[],this.z_=s,this.z_.To(o=>{i.enqueueAndForget(async()=>{cp(this)&&(Ee(Vh,"Restarting streams for network reachability change."),await async function(l){const c=nt(l);c.W_.add(4),await lp(c),c.j_.set("Unknown"),c.W_.delete(4),await ty(c)}(this))})}),this.j_=new hwe(i,r)}}async function ty(e){if(cp(e))for(const t of e.G_)await t(!0)}async function lp(e){for(const t of e.G_)await t(!1)}function sY(e,t){const n=nt(e);n.U_.has(t.targetId)||(n.U_.set(t.targetId,t),Kw(n)?Ww(n):f1(n).c_()&&Yw(n,t))}function jw(e,t){const n=nt(e),i=f1(n);n.U_.delete(t),i.c_()&&oY(n,t),n.U_.size===0&&(i.c_()?i.P_():cp(n)&&n.j_.set("Unknown"))}function Yw(e,t){if(e.H_.Ne(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Le.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}f1(e).y_(t)}function oY(e,t){e.H_.Ne(t),f1(e).w_(t)}function Ww(e){e.H_=new u_e({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),lt:t=>e.U_.get(t)||null,it:()=>e.datastore.serializer.databaseId}),f1(e).start(),e.j_.B_()}function Kw(e){return cp(e)&&!f1(e).u_()&&e.U_.size>0}function cp(e){return nt(e).W_.size===0}function aY(e){e.H_=void 0}async function mwe(e){e.j_.set("Online")}async function pwe(e){e.U_.forEach((t,n)=>{Yw(e,t)})}async function Uwe(e,t){aY(e),Kw(e)?(e.j_.q_(t),Ww(e)):e.j_.set("Unknown")}async function bwe(e,t,n){if(e.j_.set("Online"),t instanceof Yj&&t.state===2&&t.cause)try{await async function(r,s){const o=s.cause;for(const a of s.targetIds)r.U_.has(a)&&(await r.remoteSyncer.rejectListen(a,o),r.U_.delete(a),r.H_.removeTarget(a))}(e,t)}catch(i){Ee(Vh,"Failed to remove targets %s: %s ",t.targetIds.join(","),i),await rL(e,i)}else if(t instanceof E2?e.H_.We(t):t instanceof jj?e.H_.Ze(t):e.H_.je(t),!n.isEqual(Le.min()))try{const i=await rY(e.localStore);n.compareTo(i)>=0&&await function(s,o){const a=s.H_.ot(o);return a.targetChanges.forEach((l,c)=>{if(l.resumeToken.approximateByteSize()>0){const u=s.U_.get(c);u&&s.U_.set(c,u.withResumeToken(l.resumeToken,o))}}),a.targetMismatches.forEach((l,c)=>{const u=s.U_.get(l);if(!u)return;s.U_.set(l,u.withResumeToken(wi.EMPTY_BYTE_STRING,u.snapshotVersion)),oY(s,l);const d=new Xl(u.target,l,c,u.sequenceNumber);Yw(s,d)}),s.remoteSyncer.applyRemoteEvent(a)}(e,n)}catch(i){Ee(Vh,"Failed to raise snapshot:",i),await rL(e,i)}}async function rL(e,t,n){if(!d1(t))throw t;e.W_.add(1),await lp(e),e.j_.set("Offline"),n||(n=()=>rY(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Ee(Vh,"Retrying IndexedDB access"),await n(),e.W_.delete(1),await ty(e)})}async function sL(e,t){const n=nt(e);n.asyncQueue.verifyOperationInProgress(),Ee(Vh,"RemoteStore received new credentials");const i=cp(n);n.W_.add(3),await lp(n),i&&n.j_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.W_.delete(3),await ty(n)}async function ywe(e,t){const n=nt(e);t?(n.W_.delete(2),await ty(n)):t||(n.W_.add(2),await lp(n),n.j_.set("Unknown"))}function f1(e){return e.J_||(e.J_=function(n,i,r){const s=nt(n);return s.M_(),new uwe(i,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,r)}(e.datastore,e.asyncQueue,{xo:mwe.bind(null,e),No:pwe.bind(null,e),Lo:Uwe.bind(null,e),p_:bwe.bind(null,e)}),e.G_.push(async t=>{t?(e.J_.h_(),Kw(e)?Ww(e):e.j_.set("Unknown")):(await e.J_.stop(),aY(e))})),e.J_}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Zw{constructor(t,n,i,r,s){this.asyncQueue=t,this.timerId=n,this.targetTimeMs=i,this.op=r,this.removalCallback=s,this.deferred=new uc,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(t,n,i,r,s){const o=Date.now()+i,a=new Zw(t,n,o,r,s);return a.start(i),a}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new Te(re.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function lY(e,t){if(il("AsyncQueue",`${t}: ${e}`),d1(e))return new Te(re.UNAVAILABLE,`${t}: ${e}`);throw e}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ih{static emptySet(t){return new ih(t.comparator)}constructor(t){this.comparator=t?(n,i)=>t(n,i)||Me.comparator(n.key,i.key):(n,i)=>Me.comparator(n.key,i.key),this.keyedMap=_g(),this.sortedSet=new An(this.comparator)}has(t){return this.keyedMap.get(t)!=null}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const n=this.keyedMap.get(t);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal((n,i)=>(t(n),!1))}add(t){const n=this.delete(t.key);return n.copy(n.keyedMap.insert(t.key,t),n.sortedSet.insert(t,null))}delete(t){const n=this.get(t);return n?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(n)):this}isEqual(t){if(!(t instanceof ih)||this.size!==t.size)return!1;const n=this.sortedSet.getIterator(),i=t.sortedSet.getIterator();for(;n.hasNext();){const r=n.getNext().key,s=i.getNext().key;if(!r.isEqual(s))return!1}return!0}toString(){const t=[];return this.forEach(n=>{t.push(n.toString())}),t.length===0?"DocumentSet ()":`DocumentSet (
  `+t.join(`  
`)+`
)`}copy(t,n){const i=new ih;return i.comparator=this.comparator,i.keyedMap=t,i.sortedSet=n,i}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class oL{constructor(){this.Z_=new An(Me.comparator)}track(t){const n=t.doc.key,i=this.Z_.get(n);i?t.type!==0&&i.type===3?this.Z_=this.Z_.insert(n,t):t.type===3&&i.type!==1?this.Z_=this.Z_.insert(n,{type:i.type,doc:t.doc}):t.type===2&&i.type===2?this.Z_=this.Z_.insert(n,{type:2,doc:t.doc}):t.type===2&&i.type===0?this.Z_=this.Z_.insert(n,{type:0,doc:t.doc}):t.type===1&&i.type===0?this.Z_=this.Z_.remove(n):t.type===1&&i.type===2?this.Z_=this.Z_.insert(n,{type:1,doc:i.doc}):t.type===0&&i.type===1?this.Z_=this.Z_.insert(n,{type:2,doc:t.doc}):Ae():this.Z_=this.Z_.insert(n,t)}X_(){const t=[];return this.Z_.inorderTraversal((n,i)=>{t.push(i)}),t}}class $h{constructor(t,n,i,r,s,o,a,l,c){this.query=t,this.docs=n,this.oldDocs=i,this.docChanges=r,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(t,n,i,r,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new $h(t,n,ih.emptySet(n),o,i,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&K5(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const n=this.docChanges,i=t.docChanges;if(n.length!==i.length)return!1;for(let r=0;r<n.length;r++)if(n[r].type!==i[r].type||!n[r].doc.isEqual(i[r].doc))return!1;return!0}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ewe{constructor(){this.ea=void 0,this.ta=[]}na(){return this.ta.some(t=>t.ra())}}class vwe{constructor(){this.queries=aL(),this.onlineState="Unknown",this.ia=new Set}terminate(){(function(n,i){const r=nt(n),s=r.queries;r.queries=aL(),s.forEach((o,a)=>{for(const l of a.ta)l.onError(i)})})(this,new Te(re.ABORTED,"Firestore shutting down"))}}function aL(){return new Od(e=>Dj(e),K5)}async function _we(e,t){const n=nt(e);let i=3;const r=t.query;let s=n.queries.get(r);s?!s.na()&&t.ra()&&(i=2):(s=new Ewe,i=t.ra()?0:1);try{switch(i){case 0:s.ea=await n.onListen(r,!0);break;case 1:s.ea=await n.onListen(r,!1);break;case 2:await n.onFirstRemoteStoreListen(r)}}catch(o){const a=lY(o,`Initialization of query '${hf(t.query)}' failed`);return void t.onError(a)}n.queries.set(r,s),s.ta.push(t),t.sa(n.onlineState),s.ea&&t.oa(s.ea)&&qw(n)}async function wwe(e,t){const n=nt(e),i=t.query;let r=3;const s=n.queries.get(i);if(s){const o=s.ta.indexOf(t);o>=0&&(s.ta.splice(o,1),s.ta.length===0?r=t.ra()?0:1:!s.na()&&t.ra()&&(r=2))}switch(r){case 0:return n.queries.delete(i),n.onUnlisten(i,!0);case 1:return n.queries.delete(i),n.onUnlisten(i,!1);case 2:return n.onLastRemoteStoreUnlisten(i);default:return}}function Twe(e,t){const n=nt(e);let i=!1;for(const r of t){const s=r.query,o=n.queries.get(s);if(o){for(const a of o.ta)a.oa(r)&&(i=!0);o.ea=r}}i&&qw(n)}function Swe(e,t,n){const i=nt(e),r=i.queries.get(t);if(r)for(const s of r.ta)s.onError(n);i.queries.delete(t)}function qw(e){e.ia.forEach(t=>{t.next()})}var P4,lL;(lL=P4||(P4={}))._a="default",lL.Cache="cache";class Iwe{constructor(t,n,i){this.query=t,this.aa=n,this.ua=!1,this.ca=null,this.onlineState="Unknown",this.options=i||{}}oa(t){if(!this.options.includeMetadataChanges){const i=[];for(const r of t.docChanges)r.type!==3&&i.push(r);t=new $h(t.query,t.docs,t.oldDocs,i,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let n=!1;return this.ua?this.la(t)&&(this.aa.next(t),n=!0):this.ha(t,this.onlineState)&&(this.Pa(t),n=!0),this.ca=t,n}onError(t){this.aa.error(t)}sa(t){this.onlineState=t;let n=!1;return this.ca&&!this.ua&&this.ha(this.ca,t)&&(this.Pa(this.ca),n=!0),n}ha(t,n){if(!t.fromCache||!this.ra())return!0;const i=n!=="Offline";return(!this.options.Ta||!i)&&(!t.docs.isEmpty()||t.hasCachedResults||n==="Offline")}la(t){if(t.docChanges.length>0)return!0;const n=this.ca&&this.ca.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}Pa(t){t=$h.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.ua=!0,this.aa.next(t)}ra(){return this.options.source!==P4.Cache}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class cY{constructor(t){this.key=t}}class uY{constructor(t){this.key=t}}class xwe{constructor(t,n){this.query=t,this.fa=n,this.ga=null,this.hasCachedResults=!1,this.current=!1,this.pa=Ut(),this.mutatedKeys=Ut(),this.ya=Nj(t),this.wa=new ih(this.ya)}get Sa(){return this.fa}ba(t,n){const i=n?n.Da:new oL,r=n?n.wa:this.wa;let s=n?n.mutatedKeys:this.mutatedKeys,o=r,a=!1;const l=this.query.limitType==="F"&&r.size===this.query.limit?r.last():null,c=this.query.limitType==="L"&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal((u,d)=>{const f=r.get(u),h=Z5(this.query,d)?d:null,m=!!f&&this.mutatedKeys.has(f.key),p=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let b=!1;f&&h?f.data.isEqual(h.data)?m!==p&&(i.track({type:3,doc:h}),b=!0):this.va(f,h)||(i.track({type:2,doc:h}),b=!0,(l&&this.ya(h,l)>0||c&&this.ya(h,c)<0)&&(a=!0)):!f&&h?(i.track({type:0,doc:h}),b=!0):f&&!h&&(i.track({type:1,doc:f}),b=!0,(l||c)&&(a=!0)),b&&(h?(o=o.add(h),s=p?s.add(u):s.delete(u)):(o=o.delete(u),s=s.delete(u)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const u=this.query.limitType==="F"?o.last():o.first();o=o.delete(u.key),s=s.delete(u.key),i.track({type:1,doc:u})}return{wa:o,Da:i,ls:a,mutatedKeys:s}}va(t,n){return t.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(t,n,i,r){const s=this.wa;this.wa=t.wa,this.mutatedKeys=t.mutatedKeys;const o=t.Da.X_();o.sort((u,d)=>function(h,m){const p=b=>{switch(b){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ae()}};return p(h)-p(m)}(u.type,d.type)||this.ya(u.doc,d.doc)),this.Ca(i),r=r!=null&&r;const a=n&&!r?this.Fa():[],l=this.pa.size===0&&this.current&&!r?1:0,c=l!==this.ga;return this.ga=l,o.length!==0||c?{snapshot:new $h(this.query,t.wa,s,o,t.mutatedKeys,l===0,c,!1,!!i&&i.resumeToken.approximateByteSize()>0),Ma:a}:{Ma:a}}sa(t){return this.current&&t==="Offline"?(this.current=!1,this.applyChanges({wa:this.wa,Da:new oL,mutatedKeys:this.mutatedKeys,ls:!1},!1)):{Ma:[]}}xa(t){return!this.fa.has(t)&&!!this.wa.has(t)&&!this.wa.get(t).hasLocalMutations}Ca(t){t&&(t.addedDocuments.forEach(n=>this.fa=this.fa.add(n)),t.modifiedDocuments.forEach(n=>{}),t.removedDocuments.forEach(n=>this.fa=this.fa.delete(n)),this.current=t.current)}Fa(){if(!this.current)return[];const t=this.pa;this.pa=Ut(),this.wa.forEach(i=>{this.xa(i.key)&&(this.pa=this.pa.add(i.key))});const n=[];return t.forEach(i=>{this.pa.has(i)||n.push(new uY(i))}),this.pa.forEach(i=>{t.has(i)||n.push(new cY(i))}),n}Oa(t){this.fa=t.gs,this.pa=Ut();const n=this.ba(t.documents);return this.applyChanges(n,!0)}Na(){return $h.fromInitialDocuments(this.query,this.wa,this.mutatedKeys,this.ga===0,this.hasCachedResults)}}const Qw="SyncEngine";class Cwe{constructor(t,n,i){this.query=t,this.targetId=n,this.view=i}}class Awe{constructor(t){this.key=t,this.Ba=!1}}class Mwe{constructor(t,n,i,r,s,o){this.localStore=t,this.remoteStore=n,this.eventManager=i,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.La={},this.ka=new Od(a=>Dj(a),K5),this.qa=new Map,this.Qa=new Set,this.$a=new An(Me.comparator),this.Ka=new Map,this.Ua=new Hw,this.Wa={},this.Ga=new Map,this.za=Hh.Un(),this.onlineState="Unknown",this.ja=void 0}get isPrimaryClient(){return this.ja===!0}}async function Rwe(e,t,n=!0){const i=mY(e);let r;const s=i.ka.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.Na()):r=await dY(i,t,n,!0),r}async function kwe(e,t){const n=mY(e);await dY(n,t,!0,!1)}async function dY(e,t,n,i){const r=await twe(e.localStore,Oo(t)),s=r.targetId,o=e.sharedClientState.addLocalQueryTarget(s,n);let a;return i&&(a=await Lwe(e,t,s,o==="current",r.resumeToken)),e.isPrimaryClient&&n&&sY(e.remoteStore,r),a}async function Lwe(e,t,n,i,r){e.Ha=(d,f,h)=>async function(p,b,E,y){let v=b.view.ba(E);v.ls&&(v=await Jk(p.localStore,b.query,!1).then(({documents:w})=>b.view.ba(w,v)));const _=y&&y.targetChanges.get(b.targetId),I=y&&y.targetMismatches.get(b.targetId)!=null,R=b.view.applyChanges(v,p.isPrimaryClient,_,I);return uL(p,b.targetId,R.Ma),R.snapshot}(e,d,f,h);const s=await Jk(e.localStore,t,!0),o=new xwe(t,s.gs),a=o.ba(s.documents),l=ap.createSynthesizedTargetChangeForCurrentChange(n,i&&e.onlineState!=="Offline",r),c=o.applyChanges(a,e.isPrimaryClient,l);uL(e,n,c.Ma);const u=new Cwe(t,n,o);return e.ka.set(t,u),e.qa.has(n)?e.qa.get(n).push(t):e.qa.set(n,[t]),c.snapshot}async function Dwe(e,t,n){const i=nt(e),r=i.ka.get(t),s=i.qa.get(r.targetId);if(s.length>1)return i.qa.set(r.targetId,s.filter(o=>!K5(o,t))),void i.ka.delete(t);i.isPrimaryClient?(i.sharedClientState.removeLocalQueryTarget(r.targetId),i.sharedClientState.isActiveQueryTarget(r.targetId)||await N4(i.localStore,r.targetId,!1).then(()=>{i.sharedClientState.clearQueryState(r.targetId),n&&jw(i.remoteStore,r.targetId),F4(i,r.targetId)}).catch(X5)):(F4(i,r.targetId),await N4(i.localStore,r.targetId,!0))}async function Nwe(e,t){const n=nt(e),i=n.ka.get(t),r=n.qa.get(i.targetId);n.isPrimaryClient&&r.length===1&&(n.sharedClientState.removeLocalQueryTarget(i.targetId),jw(n.remoteStore,i.targetId))}async function fY(e,t){const n=nt(e);try{const i=await J_e(n.localStore,t);t.targetChanges.forEach((r,s)=>{const o=n.Ka.get(s);o&&(Bt(r.addedDocuments.size+r.modifiedDocuments.size+r.removedDocuments.size<=1),r.addedDocuments.size>0?o.Ba=!0:r.modifiedDocuments.size>0?Bt(o.Ba):r.removedDocuments.size>0&&(Bt(o.Ba),o.Ba=!1))}),await gY(n,i,t)}catch(i){await X5(i)}}function cL(e,t,n){const i=nt(e);if(i.isPrimaryClient&&n===0||!i.isPrimaryClient&&n===1){const r=[];i.ka.forEach((s,o)=>{const a=o.view.sa(t);a.snapshot&&r.push(a.snapshot)}),function(o,a){const l=nt(o);l.onlineState=a;let c=!1;l.queries.forEach((u,d)=>{for(const f of d.ta)f.sa(a)&&(c=!0)}),c&&qw(l)}(i.eventManager,t),r.length&&i.La.p_(r),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}async function Owe(e,t,n){const i=nt(e);i.sharedClientState.updateQueryState(t,"rejected",n);const r=i.Ka.get(t),s=r&&r.key;if(s){let o=new An(Me.comparator);o=o.insert(s,si.newNoDocument(s,Le.min()));const a=Ut().add(s),l=new J5(Le.min(),new Map,new An(dt),o,a);await fY(i,l),i.$a=i.$a.remove(s),i.Ka.delete(t),Jw(i)}else await N4(i.localStore,t,!1).then(()=>F4(i,t,n)).catch(X5)}function F4(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const i of e.qa.get(t))e.ka.delete(i),n&&e.La.Ja(i,n);e.qa.delete(t),e.isPrimaryClient&&e.Ua.br(t).forEach(i=>{e.Ua.containsKey(i)||hY(e,i)})}function hY(e,t){e.Qa.delete(t.path.canonicalString());const n=e.$a.get(t);n!==null&&(jw(e.remoteStore,n),e.$a=e.$a.remove(t),e.Ka.delete(n),Jw(e))}function uL(e,t,n){for(const i of n)i instanceof cY?(e.Ua.addReference(i.key,t),Pwe(e,i)):i instanceof uY?(Ee(Qw,"Document no longer in limbo: "+i.key),e.Ua.removeReference(i.key,t),e.Ua.containsKey(i.key)||hY(e,i.key)):Ae()}function Pwe(e,t){const n=t.key,i=n.path.canonicalString();e.$a.get(n)||e.Qa.has(i)||(Ee(Qw,"New document in limbo: "+n),e.Qa.add(i),Jw(e))}function Jw(e){for(;e.Qa.size>0&&e.$a.size<e.maxConcurrentLimboResolutions;){const t=e.Qa.values().next().value;e.Qa.delete(t);const n=new Me(rn.fromString(t)),i=e.za.next();e.Ka.set(i,new Awe(n)),e.$a=e.$a.insert(n,i),sY(e.remoteStore,new Xl(Oo(Ow(n.path)),i,"TargetPurposeLimboResolution",j5.ae))}}async function gY(e,t,n){const i=nt(e),r=[],s=[],o=[];i.ka.isEmpty()||(i.ka.forEach((a,l)=>{o.push(i.Ha(l,t,n).then(c=>{var u;if((c||n)&&i.isPrimaryClient){const d=c?!c.fromCache:(u=n==null?void 0:n.targetChanges.get(l.targetId))===null||u===void 0?void 0:u.current;i.sharedClientState.updateQueryState(l.targetId,d?"current":"not-current")}if(c){r.push(c);const d=$w.Yi(l.targetId,c);s.push(d)}}))}),await Promise.all(o),i.La.p_(r),await async function(l,c){const u=nt(l);try{await u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>ie.forEach(c,f=>ie.forEach(f.Hi,h=>u.persistence.referenceDelegate.addReference(d,f.targetId,h)).next(()=>ie.forEach(f.Ji,h=>u.persistence.referenceDelegate.removeReference(d,f.targetId,h)))))}catch(d){if(!d1(d))throw d;Ee(Gw,"Failed to update sequence numbers: "+d)}for(const d of c){const f=d.targetId;if(!d.fromCache){const h=u.Ts.get(f),m=h.snapshotVersion,p=h.withLastLimboFreeSnapshotVersion(m);u.Ts=u.Ts.insert(f,p)}}}(i.localStore,s))}async function Fwe(e,t){const n=nt(e);if(!n.currentUser.isEqual(t)){Ee(Qw,"User change. New user:",t.toKey());const i=await iY(n.localStore,t);n.currentUser=t,function(s,o){s.Ga.forEach(a=>{a.forEach(l=>{l.reject(new Te(re.CANCELLED,o))})}),s.Ga.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,i.removedBatchIds,i.addedBatchIds),await gY(n,i.Rs)}}function Bwe(e,t){const n=nt(e),i=n.Ka.get(t);if(i&&i.Ba)return Ut().add(i.key);{let r=Ut();const s=n.qa.get(t);if(!s)return r;for(const o of s){const a=n.ka.get(o);r=r.unionWith(a.view.Sa)}return r}}function mY(e){const t=nt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=fY.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Bwe.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Owe.bind(null,t),t.La.p_=Twe.bind(null,t.eventManager),t.La.Ja=Swe.bind(null,t.eventManager),t}class h6{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=ey(t.databaseInfo.databaseId),this.sharedClientState=this.Za(t),this.persistence=this.Xa(t),await this.persistence.start(),this.localStore=this.eu(t),this.gcScheduler=this.tu(t,this.localStore),this.indexBackfillerScheduler=this.nu(t,this.localStore)}tu(t,n){return null}nu(t,n){return null}eu(t){return Q_e(this.persistence,new K_e,t.initialUser,this.serializer)}Xa(t){return new nY(Vw.ri,this.serializer)}Za(t){return new iwe}async terminate(){var t,n;(t=this.gcScheduler)===null||t===void 0||t.stop(),(n=this.indexBackfillerScheduler)===null||n===void 0||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}h6.provider={build:()=>new h6};class zwe extends h6{constructor(t){super(),this.cacheSizeBytes=t}tu(t,n){Bt(this.persistence.referenceDelegate instanceof f6);const i=this.persistence.referenceDelegate.garbageCollector;return new D_e(i,t.asyncQueue,n)}Xa(t){const n=this.cacheSizeBytes!==void 0?cr.withCacheSize(this.cacheSizeBytes):cr.DEFAULT;return new nY(i=>f6.ri(i,n),this.serializer)}}class B4{async initialize(t,n){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>cL(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=Fwe.bind(null,this.syncEngine),await ywe(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return function(){return new vwe}()}createDatastore(t){const n=ey(t.databaseInfo.databaseId),i=function(s){return new lwe(s)}(t.databaseInfo);return function(s,o,a,l){return new fwe(s,o,a,l)}(t.authCredentials,t.appCheckCredentials,i,n)}createRemoteStore(t){return function(i,r,s,o,a){return new gwe(i,r,s,o,a)}(this.localStore,this.datastore,t.asyncQueue,n=>cL(this.syncEngine,n,0),function(){return nL.D()?new nL:new rwe}())}createSyncEngine(t,n){return function(r,s,o,a,l,c,u){const d=new Mwe(r,s,o,a,l,c);return u&&(d.ja=!0),d}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,n)}async terminate(){var t,n;await async function(r){const s=nt(r);Ee(Vh,"RemoteStore shutting down."),s.W_.add(5),await lp(s),s.z_.shutdown(),s.j_.set("Unknown")}(this.remoteStore),(t=this.datastore)===null||t===void 0||t.terminate(),(n=this.eventManager)===null||n===void 0||n.terminate()}}B4.provider={build:()=>new B4};/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Hwe{constructor(t){this.observer=t,this.muted=!1}next(t){this.muted||this.observer.next&&this.iu(this.observer.next,t)}error(t){this.muted||(this.observer.error?this.iu(this.observer.error,t):il("Uncaught Error in snapshot listener:",t.toString()))}su(){this.muted=!0}iu(t,n){setTimeout(()=>{this.muted||t(n)},0)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Vwe{constructor(t){this.datastore=t,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}async lookup(t){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new Te(re.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;const n=await async function(r,s){const o=nt(r),a={documents:s.map(d=>d6(o.serializer,d))},l=await o.Co("BatchGetDocuments",o.serializer.databaseId,rn.emptyPath(),a,s.length),c=new Map;l.forEach(d=>{const f=U_e(o.serializer,d);c.set(f.key.toString(),f)});const u=[];return s.forEach(d=>{const f=c.get(d.toString());Bt(!!f),u.push(f)}),u}(this.datastore,t);return n.forEach(i=>this.recordVersion(i)),n}set(t,n){this.write(n.toMutation(t,this.precondition(t))),this.writtenDocs.add(t.toString())}update(t,n){try{this.write(n.toMutation(t,this.preconditionForUpdate(t)))}catch(i){this.lastTransactionError=i}this.writtenDocs.add(t.toString())}delete(t){this.write(new Fw(t,this.precondition(t))),this.writtenDocs.add(t.toString())}async commit(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;const t=this.readVersions;this.mutations.forEach(n=>{t.delete(n.key.toString())}),t.forEach((n,i)=>{const r=Me.fromPath(i);this.mutations.push(new Gj(r,this.precondition(r)))}),await async function(i,r){const s=nt(i),o={writes:r.map(a=>y_e(s.serializer,a))};await s.So("Commit",s.serializer.databaseId,rn.emptyPath(),o)}(this.datastore,this.mutations),this.committed=!0}recordVersion(t){let n;if(t.isFoundDocument())n=t.version;else{if(!t.isNoDocument())throw Ae();n=Le.min()}const i=this.readVersions.get(t.key.toString());if(i){if(!n.isEqual(i))throw new Te(re.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(t.key.toString(),n)}precondition(t){const n=this.readVersions.get(t.toString());return!this.writtenDocs.has(t.toString())&&n?n.isEqual(Le.min())?ns.exists(!1):ns.updateTime(n):ns.none()}preconditionForUpdate(t){const n=this.readVersions.get(t.toString());if(!this.writtenDocs.has(t.toString())&&n){if(n.isEqual(Le.min()))throw new Te(re.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return ns.updateTime(n)}return ns.exists(!0)}write(t){this.ensureCommitNotCalled(),this.mutations.push(t)}ensureCommitNotCalled(){}}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class $we{constructor(t,n,i,r,s){this.asyncQueue=t,this.datastore=n,this.options=i,this.updateFunction=r,this.deferred=s,this.Tu=i.maxAttempts,this.a_=new Xw(this.asyncQueue,"transaction_retry")}Iu(){this.Tu-=1,this.Eu()}Eu(){this.a_.Xo(async()=>{const t=new Vwe(this.datastore),n=this.du(t);n&&n.then(i=>{this.asyncQueue.enqueueAndForget(()=>t.commit().then(()=>{this.deferred.resolve(i)}).catch(r=>{this.Au(r)}))}).catch(i=>{this.Au(i)})})}du(t){try{const n=this.updateFunction(t);return!sp(n)&&n.catch&&n.then?n:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(n){return this.deferred.reject(n),null}}Au(t){this.Tu>0&&this.Ru(t)?(this.Tu-=1,this.asyncQueue.enqueueAndForget(()=>(this.Eu(),Promise.resolve()))):this.deferred.reject(t)}Ru(t){if(t.name==="FirebaseError"){const n=t.code;return n==="aborted"||n==="failed-precondition"||n==="already-exists"||!a_e(n)}return!1}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Lc="FirestoreClient";class Gwe{constructor(t,n,i,r,s){this.authCredentials=t,this.appCheckCredentials=n,this.asyncQueue=i,this.databaseInfo=r,this.user=ki.UNAUTHENTICATED,this.clientId=bj.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(i,async o=>{Ee(Lc,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(i,o=>(Ee(Lc,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}terminate(){this.asyncQueue.enterRestrictedMode();const t=new uc;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(n){const i=lY(n,"Failed to shutdown persistence");t.reject(i)}}),t.promise}}async function O7(e,t){e.asyncQueue.verifyOperationInProgress(),Ee(Lc,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener(async r=>{i.isEqual(r)||(await iY(t.localStore,r),i=r)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function dL(e,t){e.asyncQueue.verifyOperationInProgress();const n=await Xwe(e);Ee(Lc,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(i=>sL(t.remoteStore,i)),e.setAppCheckTokenChangeListener((i,r)=>sL(t.remoteStore,r)),e._onlineComponents=t}async function Xwe(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Ee(Lc,"Using user provided OfflineComponentProvider");try{await O7(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(r){return r.name==="FirebaseError"?r.code===re.FAILED_PRECONDITION||r.code===re.UNIMPLEMENTED:!(typeof DOMException<"u"&&r instanceof DOMException)||r.code===22||r.code===20||r.code===11}(n))throw n;Ph("Error using user provided cache. Falling back to memory cache: "+n),await O7(e,new h6)}}else Ee(Lc,"Using default OfflineComponentProvider"),await O7(e,new zwe(void 0));return e._offlineComponents}async function pY(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Ee(Lc,"Using user provided OnlineComponentProvider"),await dL(e,e._uninitializedComponentsProvider._online)):(Ee(Lc,"Using default OnlineComponentProvider"),await dL(e,new B4))),e._onlineComponents}function jwe(e){return pY(e).then(t=>t.datastore)}async function Ywe(e){const t=await pY(e),n=t.eventManager;return n.onListen=Rwe.bind(null,t.syncEngine),n.onUnlisten=Dwe.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=kwe.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=Nwe.bind(null,t.syncEngine),n}function Wwe(e,t,n={}){const i=new uc;return e.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,c){const u=new Hwe({next:f=>{u.su(),o.enqueueAndForget(()=>wwe(s,d));const h=f.docs.has(a);!h&&f.fromCache?c.reject(new Te(re.UNAVAILABLE,"Failed to get document because the client is offline.")):h&&f.fromCache&&l&&l.source==="server"?c.reject(new Te(re.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(f)},error:f=>c.reject(f)}),d=new Iwe(Ow(a.path),u,{includeMetadataChanges:!0,Ta:!0});return _we(s,d)}(await Ywe(e),e.asyncQueue,t,n,i)),i.promise}/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function UY(e){const t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const fL=new Map;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function Kwe(e,t,n){if(!n)throw new Te(re.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Zwe(e,t,n,i){if(t===!0&&i===!0)throw new Te(re.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function hL(e){if(!Me.isDocumentKey(e))throw new Te(re.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function eT(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return""+e;if(typeof e=="object"){if(e instanceof Array)return"an array";{const t=function(i){return i.constructor?i.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return typeof e=="function"?"a function":Ae()}function g6(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Te(re.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=eT(e);throw new Te(re.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const bY="firestore.googleapis.com",gL=!0;class mL{constructor(t){var n,i;if(t.host===void 0){if(t.ssl!==void 0)throw new Te(re.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=bY,this.ssl=gL}else this.host=t.host,this.ssl=(n=t.ssl)!==null&&n!==void 0?n:gL;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t.cacheSizeBytes===void 0)this.cacheSizeBytes=tY;else{if(t.cacheSizeBytes!==-1&&t.cacheSizeBytes<k_e)throw new Te(re.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}Zwe("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:t.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=UY((i=t.experimentalLongPollingOptions)!==null&&i!==void 0?i:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new Te(re.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new Te(re.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new Te(re.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(i,r){return i.timeoutSeconds===r.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class tT{constructor(t,n,i,r){this._authCredentials=t,this._appCheckCredentials=n,this._databaseId=i,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new mL({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Te(re.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(t){if(this._settingsFrozen)throw new Te(re.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new mL(t),t.credentials!==void 0&&(this._authCredentials=function(i){if(!i)return new c9e;switch(i.type){case"firstParty":return new h9e(i.sessionIndex||"0",i.iamToken||null,i.authTokenFactory||null);case"provider":return i.client;default:throw new Te(re.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const i=fL.get(n);i&&(Ee("ComponentProvider","Removing Datastore"),fL.delete(n),i.terminate())}(this),Promise.resolve()}}function qwe(e,t,n,i={}){var r;const s=(e=g6(e,tT))._getSettings(),o=`${t}:${n}`;if(s.host!==bY&&s.host!==o&&Ph("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),i.mockUserToken){let a,l;if(typeof i.mockUserToken=="string")a=i.mockUserToken,l=ki.MOCK_USER;else{a=JX(i.mockUserToken,(r=e._app)===null||r===void 0?void 0:r.options.projectId);const c=i.mockUserToken.sub||i.mockUserToken.user_id;if(!c)throw new Te(re.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new ki(c)}e._authCredentials=new u9e(new Uj(a,l))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class nT{constructor(t,n,i){this.converter=n,this._query=i,this.type="query",this.firestore=t}withConverter(t){return new nT(this.firestore,t,this._query)}}class ds{constructor(t,n,i){this.converter=n,this._key=i,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new ym(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ds(this.firestore,t,this._key)}}class ym extends nT{constructor(t,n,i){super(t,n,Ow(i)),this._path=i,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ds(this.firestore,null,new Me(t))}withConverter(t){return new ym(this.firestore,t,this._path)}}function yY(e,t,...n){if(e=io(e),arguments.length===1&&(t=bj.newId()),Kwe("doc","path",t),e instanceof tT){const i=rn.fromString(t,...n);return hL(i),new ds(e,null,new Me(i))}{if(!(e instanceof ds||e instanceof ym))throw new Te(re.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=e._path.child(rn.fromString(t,...n));return hL(i),new ds(e.firestore,e instanceof ym?e.converter:null,new Me(i))}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const pL="AsyncQueue";class UL{constructor(t=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new Xw(this,"async_queue_retry"),this.Su=()=>{const i=N7();i&&Ee(pL,"Visibility state changed to "+i.visibilityState),this.a_.t_()},this.bu=t;const n=N7();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this.Su)}get isShuttingDown(){return this.mu}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.Du(),this.vu(t)}enterRestrictedMode(t){if(!this.mu){this.mu=!0,this.yu=t||!1;const n=N7();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.Su)}}enqueue(t){if(this.Du(),this.mu)return new Promise(()=>{});const n=new uc;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(t().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.Vu.push(t),this.Cu()))}async Cu(){if(this.Vu.length!==0){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(t){if(!d1(t))throw t;Ee(pL,"Operation failed with retryable error: "+t)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(t){const n=this.bu.then(()=>(this.pu=!0,t().catch(i=>{this.gu=i,this.pu=!1;const r=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
`+o.stack),a}(i);throw il("INTERNAL UNHANDLED ERROR: ",r),i}).then(i=>(this.pu=!1,i))));return this.bu=n,n}enqueueAfterDelay(t,n,i){this.Du(),this.wu.indexOf(t)>-1&&(n=0);const r=Zw.createAndSchedule(this,t,n,i,s=>this.Fu(s));return this.fu.push(r),r}Du(){this.gu&&Ae()}verifyOperationInProgress(){}async Mu(){let t;do t=this.bu,await t;while(t!==this.bu)}xu(t){for(const n of this.fu)if(n.timerId===t)return!0;return!1}Ou(t){return this.Mu().then(()=>{this.fu.sort((n,i)=>n.targetTimeMs-i.targetTimeMs);for(const n of this.fu)if(n.skipDelay(),t!=="all"&&n.timerId===t)break;return this.Mu()})}Nu(t){this.wu.push(t)}Fu(t){const n=this.fu.indexOf(t);this.fu.splice(n,1)}}class iT extends tT{constructor(t,n,i,r){super(t,n,i,r),this.type="firestore",this._queue=new UL,this._persistenceKey=(r==null?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new UL(t),this._firestoreClient=void 0,await t}}}function Qwe(e,t){const n=typeof e=="object"?e:lj(),i=typeof e=="string"?e:r6,r=rj(n,"firestore").getImmediate({identifier:i});if(!r._initialized){const s=qX("firestore");s&&qwe(r,...s)}return r}function EY(e){if(e._terminated)throw new Te(re.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||Jwe(e),e._firestoreClient}function Jwe(e){var t,n,i;const r=e._freezeSettings(),s=function(a,l,c,u){return new C9e(a,l,c,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,UY(u.experimentalLongPollingOptions),u.useFetchStreams)}(e._databaseId,((t=e._app)===null||t===void 0?void 0:t.options.appId)||"",e._persistenceKey,r);e._componentsProvider||!((n=r.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((i=r.localCache)===null||i===void 0)&&i._onlineComponentProvider)&&(e._componentsProvider={_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider}),e._firestoreClient=new Gwe(e._authCredentials,e._appCheckCredentials,e._queue,s,e._componentsProvider&&function(a){const l=a==null?void 0:a._online.build();return{_offline:a==null?void 0:a._offline.build(l),_online:l}}(e._componentsProvider))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class rl{constructor(t){this._byteString=t}static fromBase64String(t){try{return new rl(wi.fromBase64String(t))}catch(n){throw new Te(re.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(t){return new rl(wi.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class ny{constructor(...t){for(let n=0;n<t.length;++n)if(t[n].length===0)throw new Te(re.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Ni(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class rT{constructor(t){this._methodName=t}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class sT{constructor(t,n){if(!isFinite(t)||t<-90||t>90)throw new Te(re.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new Te(re.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return dt(this._lat,t._lat)||dt(this._long,t._long)}}/**
 * @license
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class oT{constructor(t){this._values=(t||[]).map(n=>n)}toArray(){return this._values.map(t=>t)}isEqual(t){return function(i,r){if(i.length!==r.length)return!1;for(let s=0;s<i.length;++s)if(i[s]!==r[s])return!1;return!0}(this._values,t._values)}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const eTe=/^__.*__$/;class tTe{constructor(t,n,i){this.data=t,this.fieldMask=n,this.fieldTransforms=i}toMutation(t,n){return this.fieldMask!==null?new Pd(t,this.data,this.fieldMask,n,this.fieldTransforms):new op(t,this.data,n,this.fieldTransforms)}}class vY{constructor(t,n,i){this.data=t,this.fieldMask=n,this.fieldTransforms=i}toMutation(t,n){return new Pd(t,this.data,this.fieldMask,n,this.fieldTransforms)}}function _Y(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ae()}}class aT{constructor(t,n,i,r,s,o){this.settings=t,this.databaseId=n,this.serializer=i,this.ignoreUndefinedProperties=r,s===void 0&&this.Bu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Lu(){return this.settings.Lu}ku(t){return new aT(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}qu(t){var n;const i=(n=this.path)===null||n===void 0?void 0:n.child(t),r=this.ku({path:i,Qu:!1});return r.$u(t),r}Ku(t){var n;const i=(n=this.path)===null||n===void 0?void 0:n.child(t),r=this.ku({path:i,Qu:!1});return r.Bu(),r}Uu(t){return this.ku({path:void 0,Qu:!0})}Wu(t){return m6(t,this.settings.methodName,this.settings.Gu||!1,this.path,this.settings.zu)}contains(t){return this.fieldMask.find(n=>t.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>t.isPrefixOf(n.field))!==void 0}Bu(){if(this.path)for(let t=0;t<this.path.length;t++)this.$u(this.path.get(t))}$u(t){if(t.length===0)throw this.Wu("Document fields must not be empty");if(_Y(this.Lu)&&eTe.test(t))throw this.Wu('Document fields cannot begin and end with "__"')}}class nTe{constructor(t,n,i){this.databaseId=t,this.ignoreUndefinedProperties=n,this.serializer=i||ey(t)}ju(t,n,i,r=!1){return new aT({Lu:t,methodName:n,zu:i,path:Ni.emptyPath(),Qu:!1,Gu:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function iTe(e){const t=e._freezeSettings(),n=ey(e._databaseId);return new nTe(e._databaseId,!!t.ignoreUndefinedProperties,n)}function rTe(e,t,n,i,r,s={}){const o=e.ju(s.merge||s.mergeFields?2:0,t,n,r);lT("Data must be an object, but it was:",o,i);const a=wY(i,o);let l,c;if(s.merge)l=new os(o.fieldMask),c=o.fieldTransforms;else if(s.mergeFields){const u=[];for(const d of s.mergeFields){const f=z4(t,d,n);if(!o.contains(f))throw new Te(re.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);SY(u,f)||u.push(f)}l=new os(u),c=o.fieldTransforms.filter(d=>l.covers(d.field))}else l=null,c=o.fieldTransforms;return new tTe(new fr(a),l,c)}class iy extends rT{_toFieldTransform(t){if(t.Lu!==2)throw t.Lu===1?t.Wu(`${this._methodName}() can only appear at the top level of your update data`):t.Wu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return t.fieldMask.push(t.path),null}isEqual(t){return t instanceof iy}}function sTe(e,t,n,i){const r=e.ju(1,t,n);lT("Data must be an object, but it was:",r,i);const s=[],o=fr.empty();Nd(i,(l,c)=>{const u=cT(t,l,n);c=io(c);const d=r.Ku(u);if(c instanceof iy)s.push(u);else{const f=ry(c,d);f!=null&&(s.push(u),o.set(u,f))}});const a=new os(s);return new vY(o,a,r.fieldTransforms)}function oTe(e,t,n,i,r,s){const o=e.ju(1,t,n),a=[z4(t,i,n)],l=[r];if(s.length%2!=0)throw new Te(re.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<s.length;f+=2)a.push(z4(t,s[f])),l.push(s[f+1]);const c=[],u=fr.empty();for(let f=a.length-1;f>=0;--f)if(!SY(c,a[f])){const h=a[f];let m=l[f];m=io(m);const p=o.Ku(h);if(m instanceof iy)c.push(h);else{const b=ry(m,p);b!=null&&(c.push(h),u.set(h,b))}}const d=new os(c);return new vY(u,d,o.fieldTransforms)}function ry(e,t){if(TY(e=io(e)))return lT("Unsupported field value:",t,e),wY(e,t);if(e instanceof rT)return function(i,r){if(!_Y(r.Lu))throw r.Wu(`${i._methodName}() can only be used with update() and set()`);if(!r.path)throw r.Wu(`${i._methodName}() is not currently supported inside arrays`);const s=i._toFieldTransform(r);s&&r.fieldTransforms.push(s)}(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.Qu&&t.Lu!==4)throw t.Wu("Nested arrays are not supported");return function(i,r){const s=[];let o=0;for(const a of i){let l=ry(a,r.Uu(o));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),o++}return{arrayValue:{values:s}}}(e,t)}return function(i,r){if((i=io(i))===null)return{nullValue:"NULL_VALUE"};if(typeof i=="number")return Q9e(r.serializer,i);if(typeof i=="boolean")return{booleanValue:i};if(typeof i=="string")return{stringValue:i};if(i instanceof Date){const s=di.fromDate(i);return{timestampValue:u6(r.serializer,s)}}if(i instanceof di){const s=new di(i.seconds,1e3*Math.floor(i.nanoseconds/1e3));return{timestampValue:u6(r.serializer,s)}}if(i instanceof sT)return{geoPointValue:{latitude:i.latitude,longitude:i.longitude}};if(i instanceof rl)return{bytesValue:Wj(r.serializer,i._byteString)};if(i instanceof ds){const s=r.databaseId,o=i.firestore._databaseId;if(!o.isEqual(s))throw r.Wu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:zw(i.firestore._databaseId||r.databaseId,i._key.path)}}if(i instanceof oT)return function(o,a){return{mapValue:{fields:{[Ij]:{stringValue:xj},[s6]:{arrayValue:{values:o.toArray().map(c=>{if(typeof c!="number")throw a.Wu("VectorValues must only contain numeric values.");return Pw(a.serializer,c)})}}}}}}(i,r);throw r.Wu(`Unsupported field value: ${eT(i)}`)}(e,t)}function wY(e,t){const n={};return Ej(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Nd(e,(i,r)=>{const s=ry(r,t.qu(i));s!=null&&(n[i]=s)}),{mapValue:{fields:n}}}function TY(e){return!(typeof e!="object"||e===null||e instanceof Array||e instanceof Date||e instanceof di||e instanceof sT||e instanceof rl||e instanceof ds||e instanceof rT||e instanceof oT)}function lT(e,t,n){if(!TY(n)||!function(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}(n)){const i=eT(n);throw i==="an object"?t.Wu(e+" a custom object"):t.Wu(e+" "+i)}}function z4(e,t,n){if((t=io(t))instanceof ny)return t._internalPath;if(typeof t=="string")return cT(e,t);throw m6("Field path arguments must be of type string or ",e,!1,void 0,n)}const aTe=new RegExp("[~\\*/\\[\\]]");function cT(e,t,n){if(t.search(aTe)>=0)throw m6(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new ny(...t.split("."))._internalPath}catch{throw m6(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function m6(e,t,n,i,r){const s=i&&!i.isEmpty(),o=r!==void 0;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${i}`),o&&(l+=` in document ${r}`),l+=")"),new Te(re.INVALID_ARGUMENT,a+e+l)}function SY(e,t){return e.some(n=>n.isEqual(t))}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class p6{constructor(t,n,i,r,s){this._firestore=t,this._userDataWriter=n,this._key=i,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new ds(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const t=new lTe(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const n=this._document.data.field(IY("DocumentSnapshot.get",t));if(n!==null)return this._userDataWriter.convertValue(n)}}}class lTe extends p6{data(){return super.data()}}function IY(e,t){return typeof t=="string"?cT(e,t):t instanceof ny?t._internalPath:t._delegate._internalPath}class xY{convertValue(t,n="none"){switch(Rc(t)){case 0:return null;case 1:return t.booleanValue;case 2:return In(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,n);case 5:return t.stringValue;case 6:return this.convertBytes(Mc(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,n);case 11:return this.convertObject(t.mapValue,n);case 10:return this.convertVectorValue(t.mapValue);default:throw Ae()}}convertObject(t,n){return this.convertObjectMap(t.fields,n)}convertObjectMap(t,n="none"){const i={};return Nd(t,(r,s)=>{i[r]=this.convertValue(s,n)}),i}convertVectorValue(t){var n,i,r;const s=(r=(i=(n=t.fields)===null||n===void 0?void 0:n[s6].arrayValue)===null||i===void 0?void 0:i.values)===null||r===void 0?void 0:r.map(o=>In(o.doubleValue));return new oT(s)}convertGeoPoint(t){return new sT(In(t.latitude),In(t.longitude))}convertArray(t,n){return(t.values||[]).map(i=>this.convertValue(i,n))}convertServerTimestamp(t,n){switch(n){case"previous":const i=Y5(t);return i==null?null:this.convertValue(i,n);case"estimate":return this.convertTimestamp(gm(t));default:return null}}convertTimestamp(t){const n=Ac(t);return new di(n.seconds,n.nanos)}convertDocumentKey(t,n){const i=rn.fromString(t);Bt(eY(i));const r=new mm(i.get(1),i.get(3)),s=new Me(i.popFirst(5));return r.isEqual(n)||il(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function cTe(e,t,n){let i;return i=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}class uTe extends xY{constructor(t){super(),this.firestore=t}convertBytes(t){return new rl(t)}convertReference(t){const n=this.convertDocumentKey(t,this.firestore._databaseId);return new ds(this.firestore,null,n)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class CY{constructor(t,n){this.hasPendingWrites=t,this.fromCache=n}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class uT extends p6{constructor(t,n,i,r,s,o){super(t,n,i,r,o),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const n=new dTe(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,n={}){if(this._document){const i=this._document.data.field(IY("DocumentSnapshot.get",t));if(i!==null)return this._userDataWriter.convertValue(i,n.serverTimestamps)}}}class dTe extends uT{data(t={}){return super.data(t)}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function fTe(e){e=g6(e,ds);const t=g6(e.firestore,iT);return Wwe(EY(t),e._key).then(n=>hTe(t,e,n))}class AY extends xY{constructor(t){super(),this.firestore=t}convertBytes(t){return new rl(t)}convertReference(t){const n=this.convertDocumentKey(t,this.firestore._databaseId);return new ds(this.firestore,null,n)}}function hTe(e,t,n){const i=n.docs.get(t._key),r=new AY(e);return new uT(e,r,t._key,i,new CY(n.hasPendingWrites,n.fromCache),t.converter)}/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const gTe={maxAttempts:5};function Tg(e,t){if((e=io(e)).firestore!==t)throw new Te(re.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class mTe{constructor(t,n){this._firestore=t,this._transaction=n,this._dataReader=iTe(t)}get(t){const n=Tg(t,this._firestore),i=new uTe(this._firestore);return this._transaction.lookup([n._key]).then(r=>{if(!r||r.length!==1)return Ae();const s=r[0];if(s.isFoundDocument())return new p6(this._firestore,i,s.key,s,n.converter);if(s.isNoDocument())return new p6(this._firestore,i,n._key,null,n.converter);throw Ae()})}set(t,n,i){const r=Tg(t,this._firestore),s=cTe(r.converter,n,i),o=rTe(this._dataReader,"Transaction.set",r._key,s,r.converter!==null,i);return this._transaction.set(r._key,o),this}update(t,n,i,...r){const s=Tg(t,this._firestore);let o;return o=typeof(n=io(n))=="string"||n instanceof ny?oTe(this._dataReader,"Transaction.update",s._key,n,i,r):sTe(this._dataReader,"Transaction.update",s._key,n),this._transaction.update(s._key,o),this}delete(t){const n=Tg(t,this._firestore);return this._transaction.delete(n._key),this}}/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class pTe extends mTe{constructor(t,n){super(t,n),this._firestore=t}get(t){const n=Tg(t,this._firestore),i=new AY(this._firestore);return super.get(t).then(r=>new uT(this._firestore,i,n._key,r._document,new CY(!1,!1),n.converter))}}function UTe(e,t,n){e=g6(e,iT);const i=Object.assign(Object.assign({},gTe),n);return function(s){if(s.maxAttempts<1)throw new Te(re.INVALID_ARGUMENT,"Max attempts must be at least 1")}(i),function(s,o,a){const l=new uc;return s.asyncQueue.enqueueAndForget(async()=>{const c=await jwe(s);new $we(s.asyncQueue,c,a,o,l).Iu()}),l.promise}(EY(e),r=>t(new pTe(e,r)),i)}(function(t,n=!0){(function(r){u1=r})(oj),dm(new Oh("firestore",(i,{instanceIdentifier:r,options:s})=>{const o=i.getProvider("app").getImmediate(),a=new iT(new d9e(i.getProvider("auth-internal")),new g9e(o,i.getProvider("app-check-internal")),function(c,u){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new Te(re.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new mm(c.options.projectId,u)}(o,r),o);return s=Object.assign({useFetchStreams:n},s),a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),lc(wk,Tk,t),lc(wk,Tk,"esm2017")})();/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const MY="firebasestorage.googleapis.com",RY="storageBucket",bTe=2*60*1e3,yTe=10*60*1e3;/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Hn extends Dd{constructor(t,n,i=0){super(P7(t),`Firebase Storage: ${n} (${P7(t)})`),this.status_=i,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,Hn.prototype)}get status(){return this.status_}set status(t){this.status_=t}_codeEquals(t){return P7(t)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(t){this.customData.serverResponse=t,this.customData.serverResponse?this.message=`${this._baseMessage}
${this.customData.serverResponse}`:this.message=this._baseMessage}}var Bn;(function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CANNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Bn||(Bn={}));function P7(e){return"storage/"+e}function dT(){const e="An unknown error occurred, please check the error payload for server response.";return new Hn(Bn.UNKNOWN,e)}function ETe(e){return new Hn(Bn.QUOTA_EXCEEDED,"Quota for bucket '"+e+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function vTe(){const e="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new Hn(Bn.UNAUTHENTICATED,e)}function _Te(){return new Hn(Bn.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function wTe(e){return new Hn(Bn.UNAUTHORIZED,"User does not have permission to access '"+e+"'.")}function TTe(){return new Hn(Bn.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function STe(){return new Hn(Bn.CANCELED,"User canceled the upload/download.")}function ITe(e){return new Hn(Bn.INVALID_URL,"Invalid URL '"+e+"'.")}function xTe(e){return new Hn(Bn.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+e+"'.")}function CTe(){return new Hn(Bn.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+RY+"' property when initializing the app?")}function ATe(){return new Hn(Bn.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function MTe(e){return new Hn(Bn.UNSUPPORTED_ENVIRONMENT,`${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function H4(e){return new Hn(Bn.INVALID_ARGUMENT,e)}function kY(){return new Hn(Bn.APP_DELETED,"The Firebase app was deleted.")}function RTe(e){return new Hn(Bn.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function f0(e,t){return new Hn(Bn.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function J1(e){throw new Hn(Bn.INTERNAL_ERROR,"Internal error: "+e)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class kr{constructor(t,n){this.bucket=t,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(t,n){let i;try{i=kr.makeFromUrl(t,n)}catch{return new kr(t,"")}if(i.path==="")return i;throw xTe(t)}static makeFromUrl(t,n){let i=null;const r="([A-Za-z0-9.\\-_]+)";function s(_){_.path.charAt(_.path.length-1)==="/"&&(_.path_=_.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+r+o,"i"),l={bucket:1,path:3};function c(_){_.path_=decodeURIComponent(_.path)}const u="v[A-Za-z0-9_]+",d=n.replace(/[.]/g,"\\."),f="(/([^?#]*).*)?$",h=new RegExp(`^https?://${d}/${u}/b/${r}/o${f}`,"i"),m={bucket:1,path:3},p=n===MY?"(?:storage.googleapis.com|storage.cloud.google.com)":n,b="([^?#]*)",E=new RegExp(`^https?://${p}/${r}/${b}`,"i"),v=[{regex:a,indices:l,postModify:s},{regex:h,indices:m,postModify:c},{regex:E,indices:{bucket:1,path:2},postModify:c}];for(let _=0;_<v.length;_++){const I=v[_],R=I.regex.exec(t);if(R){const w=R[I.indices.bucket];let T=R[I.indices.path];T||(T=""),i=new kr(w,T),I.postModify(i);break}}if(i==null)throw ITe(t);return i}}class kTe{constructor(t){this.promise_=Promise.reject(t)}getPromise(){return this.promise_}cancel(t=!1){}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function LTe(e,t,n){let i=1,r=null,s=null,o=!1,a=0;function l(){return a===2}let c=!1;function u(...b){c||(c=!0,t.apply(null,b))}function d(b){r=setTimeout(()=>{r=null,e(h,l())},b)}function f(){s&&clearTimeout(s)}function h(b,...E){if(c){f();return}if(b){f(),u.call(null,b,...E);return}if(l()||o){f(),u.call(null,b,...E);return}i<64&&(i*=2);let v;a===1?(a=2,v=0):v=(i+Math.random())*1e3,d(v)}let m=!1;function p(b){m||(m=!0,f(),!c&&(r!==null?(b||(a=2),clearTimeout(r),d(0)):b||(a=1)))}return d(0),s=setTimeout(()=>{o=!0,p(!0)},n),p}function DTe(e){e(!1)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function NTe(e){return e!==void 0}function OTe(e){return typeof e=="object"&&!Array.isArray(e)}function LY(e){return typeof e=="string"||e instanceof String}function bL(e){return fT()&&e instanceof Blob}function fT(){return typeof Blob<"u"}function yL(e,t,n,i){if(i<t)throw H4(`Invalid value for '${e}'. Expected ${t} or greater.`);if(i>n)throw H4(`Invalid value for '${e}'. Expected ${n} or less.`)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function PTe(e,t,n){let i=t;return n==null&&(i=`https://${t}`),`${n}://${i}/v0${e}`}function FTe(e){const t=encodeURIComponent;let n="?";for(const i in e)if(e.hasOwnProperty(i)){const r=t(i)+"="+t(e[i]);n=n+r+"&"}return n=n.slice(0,-1),n}var Hu;(function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"})(Hu||(Hu={}));/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function BTe(e,t){const n=e>=500&&e<600,r=[408,429].indexOf(e)!==-1,s=t.indexOf(e)!==-1;return n||r||s}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zTe{constructor(t,n,i,r,s,o,a,l,c,u,d,f=!0){this.url_=t,this.method_=n,this.headers_=i,this.body_=r,this.successCodes_=s,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=l,this.timeout_=c,this.progressCallback_=u,this.connectionFactory_=d,this.retry=f,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((h,m)=>{this.resolve_=h,this.reject_=m,this.start_()})}start_(){const t=(i,r)=>{if(r){i(!1,new xU(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const o=a=>{const l=a.loaded,c=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,c)};this.progressCallback_!==null&&s.addUploadProgressListener(o),s.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(o),this.pendingConnection_=null;const a=s.getErrorCode()===Hu.NO_ERROR,l=s.getStatus();if(!a||BTe(l,this.additionalRetryCodes_)&&this.retry){const u=s.getErrorCode()===Hu.ABORT;i(!1,new xU(!1,null,u));return}const c=this.successCodes_.indexOf(l)!==-1;i(!0,new xU(c,s))})},n=(i,r)=>{const s=this.resolve_,o=this.reject_,a=r.connection;if(r.wasSuccessCode)try{const l=this.callback_(a,a.getResponse());NTe(l)?s(l):s()}catch(l){o(l)}else if(a!==null){const l=dT();l.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,l)):o(l)}else if(r.canceled){const l=this.appDelete_?kY():STe();o(l)}else{const l=TTe();o(l)}};this.canceled_?n(!1,new xU(!1,null,!0)):this.backoffId_=LTe(t,n,this.timeout_)}getPromise(){return this.promise_}cancel(t){this.canceled_=!0,this.appDelete_=t||!1,this.backoffId_!==null&&DTe(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class xU{constructor(t,n,i){this.wasSuccessCode=t,this.connection=n,this.canceled=!!i}}function HTe(e,t){t!==null&&t.length>0&&(e.Authorization="Firebase "+t)}function VTe(e,t){e["X-Firebase-Storage-Version"]="webjs/"+(t??"AppManager")}function $Te(e,t){t&&(e["X-Firebase-GMPID"]=t)}function GTe(e,t){t!==null&&(e["X-Firebase-AppCheck"]=t)}function XTe(e,t,n,i,r,s,o=!0){const a=FTe(e.urlParams),l=e.url+a,c=Object.assign({},e.headers);return $Te(c,t),HTe(c,n),VTe(c,s),GTe(c,i),new zTe(l,e.method,c,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,r,o)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function jTe(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function YTe(...e){const t=jTe();if(t!==void 0){const n=new t;for(let i=0;i<e.length;i++)n.append(e[i]);return n.getBlob()}else{if(fT())return new Blob(e);throw new Hn(Bn.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function WTe(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function KTe(e){if(typeof atob>"u")throw MTe("base-64");return atob(e)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Mo={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class F7{constructor(t,n){this.data=t,this.contentType=n||null}}function ZTe(e,t){switch(e){case Mo.RAW:return new F7(DY(t));case Mo.BASE64:case Mo.BASE64URL:return new F7(NY(e,t));case Mo.DATA_URL:return new F7(QTe(t),JTe(t))}throw dT()}function DY(e){const t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i<=127)t.push(i);else if(i<=2047)t.push(192|i>>6,128|i&63);else if((i&64512)===55296)if(!(n<e.length-1&&(e.charCodeAt(n+1)&64512)===56320))t.push(239,191,189);else{const s=i,o=e.charCodeAt(++n);i=65536|(s&1023)<<10|o&1023,t.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63)}else(i&64512)===56320?t.push(239,191,189):t.push(224|i>>12,128|i>>6&63,128|i&63)}return new Uint8Array(t)}function qTe(e){let t;try{t=decodeURIComponent(e)}catch{throw f0(Mo.DATA_URL,"Malformed data URL.")}return DY(t)}function NY(e,t){switch(e){case Mo.BASE64:{const r=t.indexOf("-")!==-1,s=t.indexOf("_")!==-1;if(r||s)throw f0(e,"Invalid character '"+(r?"-":"_")+"' found: is it base64url encoded?");break}case Mo.BASE64URL:{const r=t.indexOf("+")!==-1,s=t.indexOf("/")!==-1;if(r||s)throw f0(e,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=KTe(t)}catch(r){throw r.message.includes("polyfill")?r:f0(e,"Invalid character found")}const i=new Uint8Array(n.length);for(let r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}class OY{constructor(t){this.base64=!1,this.contentType=null;const n=t.match(/^data:([^,]+)?,/);if(n===null)throw f0(Mo.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const i=n[1]||null;i!=null&&(this.base64=eSe(i,";base64"),this.contentType=this.base64?i.substring(0,i.length-7):i),this.rest=t.substring(t.indexOf(",")+1)}}function QTe(e){const t=new OY(e);return t.base64?NY(Mo.BASE64,t.rest):qTe(t.rest)}function JTe(e){return new OY(e).contentType}function eSe(e,t){return e.length>=t.length?e.substring(e.length-t.length)===t:!1}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Ol{constructor(t,n){let i=0,r="";bL(t)?(this.data_=t,i=t.size,r=t.type):t instanceof ArrayBuffer?(n?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),i=this.data_.length):t instanceof Uint8Array&&(n?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),i=t.length),this.size_=i,this.type_=r}size(){return this.size_}type(){return this.type_}slice(t,n){if(bL(this.data_)){const i=this.data_,r=WTe(i,t,n);return r===null?null:new Ol(r)}else{const i=new Uint8Array(this.data_.buffer,t,n-t);return new Ol(i,!0)}}static getBlob(...t){if(fT()){const n=t.map(i=>i instanceof Ol?i.data_:i);return new Ol(YTe.apply(null,n))}else{const n=t.map(o=>LY(o)?ZTe(Mo.RAW,o).data:o.data_);let i=0;n.forEach(o=>{i+=o.byteLength});const r=new Uint8Array(i);let s=0;return n.forEach(o=>{for(let a=0;a<o.length;a++)r[s++]=o[a]}),new Ol(r,!0)}}uploadData(){return this.data_}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function tSe(e){let t;try{t=JSON.parse(e)}catch{return null}return OTe(t)?t:null}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function nSe(e){if(e.length===0)return null;const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function iSe(e,t){const n=t.split("/").filter(i=>i.length>0).join("/");return e.length===0?n:e+"/"+n}function PY(e){const t=e.lastIndexOf("/",e.length-2);return t===-1?e:e.slice(t+1)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function rSe(e,t){return t}class Gi{constructor(t,n,i,r){this.server=t,this.local=n||t,this.writable=!!i,this.xform=r||rSe}}let CU=null;function sSe(e){return!LY(e)||e.length<2?e:PY(e)}function oSe(){if(CU)return CU;const e=[];e.push(new Gi("bucket")),e.push(new Gi("generation")),e.push(new Gi("metageneration")),e.push(new Gi("name","fullPath",!0));function t(s,o){return sSe(o)}const n=new Gi("name");n.xform=t,e.push(n);function i(s,o){return o!==void 0?Number(o):o}const r=new Gi("size");return r.xform=i,e.push(r),e.push(new Gi("timeCreated")),e.push(new Gi("updated")),e.push(new Gi("md5Hash",null,!0)),e.push(new Gi("cacheControl",null,!0)),e.push(new Gi("contentDisposition",null,!0)),e.push(new Gi("contentEncoding",null,!0)),e.push(new Gi("contentLanguage",null,!0)),e.push(new Gi("contentType",null,!0)),e.push(new Gi("metadata","customMetadata",!0)),CU=e,CU}function aSe(e,t){function n(){const i=e.bucket,r=e.fullPath,s=new kr(i,r);return t._makeStorageReference(s)}Object.defineProperty(e,"ref",{get:n})}function lSe(e,t,n){const i={};i.type="file";const r=n.length;for(let s=0;s<r;s++){const o=n[s];i[o.local]=o.xform(i,t[o.server])}return aSe(i,e),i}function cSe(e,t,n){const i=tSe(t);return i===null?null:lSe(e,i,n)}function uSe(e,t){const n={},i=t.length;for(let r=0;r<i;r++){const s=t[r];s.writable&&(n[s.server]=e[s.local])}return JSON.stringify(n)}class dSe{constructor(t,n,i,r){this.url=t,this.method=n,this.handler=i,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function fSe(e){if(!e)throw dT()}function hSe(e,t){function n(i,r){const s=cSe(e,r,t);return fSe(s!==null),s}return n}function gSe(e){function t(n,i){let r;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?r=_Te():r=vTe():n.getStatus()===402?r=ETe(e.bucket):n.getStatus()===403?r=wTe(e.path):r=i,r.status=n.getStatus(),r.serverResponse=i.serverResponse,r}return t}function mSe(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}function pSe(e,t,n){const i=Object.assign({},n);return i.fullPath=e.path,i.size=t.size(),i.contentType||(i.contentType=mSe(null,t)),i}function USe(e,t,n,i,r){const s=t.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};function a(){let v="";for(let _=0;_<2;_++)v=v+Math.random().toString().slice(2);return v}const l=a();o["Content-Type"]="multipart/related; boundary="+l;const c=pSe(t,i,r),u=uSe(c,n),d="--"+l+`\r
Content-Type: application/json; charset=utf-8\r
\r
`+u+`\r
--`+l+`\r
Content-Type: `+c.contentType+`\r
\r
`,f=`\r
--`+l+"--",h=Ol.getBlob(d,i,f);if(h===null)throw ATe();const m={name:c.fullPath},p=PTe(s,e.host,e._protocol),b="POST",E=e.maxUploadRetryTime,y=new dSe(p,b,hSe(e,n),E);return y.urlParams=m,y.headers=o,y.body=h.uploadData(),y.errorHandler=gSe(t),y}class bSe{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Hu.NO_ERROR,this.sendPromise_=new Promise(t=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Hu.ABORT,t()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Hu.NETWORK_ERROR,t()}),this.xhr_.addEventListener("load",()=>{t()})})}send(t,n,i,r){if(this.sent_)throw J1("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(n,t,!0),r!==void 0)for(const s in r)r.hasOwnProperty(s)&&this.xhr_.setRequestHeader(s,r[s].toString());return i!==void 0?this.xhr_.send(i):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw J1("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw J1("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw J1("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw J1("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(t){return this.xhr_.getResponseHeader(t)}addUploadProgressListener(t){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",t)}removeUploadProgressListener(t){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",t)}}class ySe extends bSe{initXhr(){this.xhr_.responseType="text"}}function ESe(){return new ySe}/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class bd{constructor(t,n){this._service=t,n instanceof kr?this._location=n:this._location=kr.makeFromUrl(n,t.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(t,n){return new bd(t,n)}get root(){const t=new kr(this._location.bucket,"");return this._newRef(this._service,t)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return PY(this._location.path)}get storage(){return this._service}get parent(){const t=nSe(this._location.path);if(t===null)return null;const n=new kr(this._location.bucket,t);return new bd(this._service,n)}_throwIfRoot(t){if(this._location.path==="")throw RTe(t)}}function vSe(e,t,n){e._throwIfRoot("uploadBytes");const i=USe(e.storage,e._location,oSe(),new Ol(t,!0),n);return e.storage.makeRequestWithTokens(i,ESe).then(r=>({metadata:r,ref:e}))}function _Se(e,t){const n=iSe(e._location.path,t),i=new kr(e._location.bucket,n);return new bd(e.storage,i)}/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function wSe(e){return/^[A-Za-z]+:\/\//.test(e)}function TSe(e,t){return new bd(e,t)}function FY(e,t){if(e instanceof hT){const n=e;if(n._bucket==null)throw CTe();const i=new bd(n,n._bucket);return t!=null?FY(i,t):i}else return t!==void 0?_Se(e,t):e}function SSe(e,t){if(t&&wSe(t)){if(e instanceof hT)return TSe(e,t);throw H4("To use ref(service, url), the first argument must be a Storage instance.")}else return FY(e,t)}function EL(e,t){const n=t==null?void 0:t[RY];return n==null?null:kr.makeFromBucketSpec(n,e)}function ISe(e,t,n,i={}){e.host=`${t}:${n}`,e._protocol="http";const{mockUserToken:r}=i;r&&(e._overrideAuthToken=typeof r=="string"?r:JX(r,e.app.options.projectId))}class hT{constructor(t,n,i,r,s){this.app=t,this._authProvider=n,this._appCheckProvider=i,this._url=r,this._firebaseVersion=s,this._bucket=null,this._host=MY,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=bTe,this._maxUploadRetryTime=yTe,this._requests=new Set,r!=null?this._bucket=kr.makeFromBucketSpec(r,this._host):this._bucket=EL(this._host,this.app.options)}get host(){return this._host}set host(t){this._host=t,this._url!=null?this._bucket=kr.makeFromBucketSpec(this._url,t):this._bucket=EL(t,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(t){yL("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(t){yL("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const t=this._authProvider.getImmediate({optional:!0});if(t){const n=await t.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(sj(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=this._appCheckProvider.getImmediate({optional:!0});return t?(await t.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(t=>t.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(t){return new bd(this,t)}_makeRequest(t,n,i,r,s=!0){if(this._deleted)return new kTe(kY());{const o=XTe(t,this._appId,i,r,n,this._firebaseVersion,s);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(t,n){const[i,r]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(t,n,i,r).getPromise()}}const vL="@firebase/storage",_L="0.13.6";/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const BY="storage";function zY(e,t,n){return e=io(e),vSe(e,t,n)}function HY(e,t){return e=io(e),SSe(e,t)}function xSe(e=lj(),t){e=io(e);const i=rj(e,BY).getImmediate({identifier:t}),r=qX("storage");return r&&CSe(i,...r),i}function CSe(e,t,n,i={}){ISe(e,t,n,i)}function ASe(e,{instanceIdentifier:t}){const n=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),r=e.getProvider("app-check-internal");return new hT(n,i,r,t,oj)}function MSe(){dm(new Oh(BY,ASe,"PUBLIC").setMultipleInstances(!0)),lc(vL,_L,""),lc(vL,_L,"esm2017")}MSe();let U6;try{U6=JSON.parse('{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}')}catch{console.warn('Error JSON parsing firebase config. Supplied value: {"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}'),U6={}}let B7=null,z7=null,H7=null;const VY=()=>(B7||(B7=aj(U6)),B7),$Y=()=>(z7||(z7=Qwe(VY())),z7),RSe=()=>(H7||(H7=xSe(VY())),H7),GY=async()=>RSe(),kSe=async(e,t)=>{const n=JSON.stringify(t),i=new TextEncoder().encode(n),{encryptedBuffer:r,iv:s}=await s5(e,i);return{ciphertext:r,iv:s}},V4=async(e,t)=>{const n=e.ciphertext.toUint8Array(),i=e.iv.toUint8Array(),r=await q0(i,n,t),s=new TextDecoder("utf-8").decode(new Uint8Array(r));return JSON.parse(s)},fu=class fu{};F(fu,"cache",new WeakMap),F(fu,"get",t=>fu.cache.get(t)),F(fu,"set",(t,n)=>{fu.cache.set(t,Nl(n))});let Em=fu;const XY=(e,t)=>{if(e.socket&&e.roomId&&e.roomKey){const n=Nl(t);return Em.get(e.socket)===n}return!0},gT=async({prefix:e,files:t})=>{const n=await GY(),i=[],r=[];return await Promise.all(t.map(async({id:s,buffer:o})=>{try{const a=HY(n,`${e}/${s}`);await zY(a,o,{cacheControl:`public, max-age=${k4e}`}),r.push(s)}catch{i.push(s)}})),{savedFiles:r,erroredFiles:i}},wL=async(e,t)=>{const n=Nl(e),{ciphertext:i,iv:r}=await kSe(t,e);return{sceneVersion:n,ciphertext:rl.fromUint8Array(new Uint8Array(i)),iv:rl.fromUint8Array(r)}},LSe=async(e,t,n)=>{const{roomId:i,roomKey:r,socket:s}=e;if(!i||!r||!s||XY(e,t))return null;const o=$Y(),a=yY(o,"scenes",i),l=await UTe(o,async u=>{const d=await u.get(a);if(!d.exists()){const b=await wL(t,r);return u.set(a,b),b}const f=d.data(),h=jl(id(await V4(f,r),null)),m=jl(ew(t,h,n)),p=await wL(m,r);return u.update(a,p),p}),c=jl(id(await V4(l,r),null));return Em.set(s,c),c},DSe=async(e,t,n)=>{const i=$Y(),r=yY(i,"scenes",e),s=await fTe(r);if(!s.exists())return null;const o=s.data(),a=jl(id(await V4(o,t),null));return n&&Em.set(n,a),a},jY=async(e,t,n)=>{const i=[],r=new Map;return await Promise.all([...new Set(n)].map(async s=>{try{const o=`https://firebasestorage.googleapis.com/v0/b/${U6.storageBucket}/o/${encodeURIComponent(e.replace(/^\//,""))}%2F${s}`,a=await fetch(`${o}?alt=media`);if(a.status<400){const l=await a.arrayBuffer(),{data:c,metadata:u}=await Ez(new Uint8Array(l),{decryptionKey:t}),d=new TextDecoder().decode(c);i.push({mimeType:u.mimeType||ye.binary,id:s,dataURL:d,created:(u==null?void 0:u.created)||Date.now(),lastRetrieved:(u==null?void 0:u.created)||Date.now()})}else r.set(s,!0)}catch(o){r.set(s,!0),console.error(o)}})),{loadedFiles:i,erroredFiles:r}},YY=e=>e.isDeleted?e.updated>Date.now()-R4e:!od(e),jl=e=>e.filter(t=>YY(t)),NSe="https://json.excalidraw.com/api/v2/",OSe="https://json.excalidraw.com/api/v2/post/",PSe=async()=>{const e=new Uint8Array(L4e);return window.crypto.getRandomValues(e),oF(e)},WY=/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/,TL=e=>{const t=new URL(e).hash;return WY.test(t)},FSe=e=>{const n=new URL(e).hash.match(WY);return n&&n[2].length!==22?(window.alert(L("alerts.invalidEncryptionKey")),null):n?{roomId:n[1],roomKey:n[2]}:null},BSe=async()=>{const e=await PSe(),t=await O9();if(!t)throw new Error("Couldn't generate room key");return{roomId:e,roomKey:t}},zSe=e=>`${window.location.origin}${window.location.pathname}#room=${e.roomId},${e.roomKey}`,HSe=async({buffer:e,decryptionKey:t})=>{let n;try{const s=e.slice(0,i2),o=e.slice(i2,e.byteLength);n=await q0(new Uint8Array(s),o,t)}catch{const o=new Uint8Array(i2);n=await q0(o,e,t)}const i=new window.TextDecoder("utf-8").decode(new Uint8Array(n)),r=JSON.parse(i);return{elements:r.elements||null,appState:r.appState||null}},VSe=async(e,t)=>{try{const n=await fetch(`${NSe}${e}`);if(!n.ok)return window.alert(L("alerts.importBackendFailed")),{};const i=await n.arrayBuffer();try{const{data:r}=await Ez(new Uint8Array(i),{decryptionKey:t}),s=JSON.parse(new TextDecoder().decode(r));return{elements:s.elements||null,appState:s.appState||null}}catch(r){return console.warn("error when decoding shareLink data using the new format:",r),HSe({buffer:i,decryptionKey:t})}}catch(n){return window.alert(L("alerts.importBackendFailed")),console.error(n),{}}},SL=async(e,t,n)=>{let i;return e!=null&&t!=null?i=rd(await VSe(e,t),n==null?void 0:n.appState,n==null?void 0:n.elements,{repairBindings:!0,refreshDimensions:!1}):i=rd(n||null,null,null,{repairBindings:!0}),{elements:i.elements,appState:i.appState,files:i.files}},$Se=async(e,t,n)=>{const i=await O9("string"),r=await yz(new TextEncoder().encode(i1(e,t,n,"database")),{encryptionKey:i});try{const s=new Map;for(const c of e)xn(c)&&n[c.fileId]&&s.set(c.fileId,n[c.fileId]);const o=await Cw({files:s,encryptionKey:i,maxBytes:xw}),l=await(await fetch(OSe,{method:"POST",body:r.buffer})).json();if(l.id){const c=new URL(window.location.href);c.hash=`json=${l.id},${i}`;const u=c.toString();return await gT({prefix:`/files/shareLinks/${l.id}`,files:o}),{url:u,errorMessage:null}}else if(l.error_class==="RequestTooLargeError")return{url:null,errorMessage:L("alerts.couldNotCreateShareableLinkTooBig")};return{url:null,errorMessage:L("alerts.couldNotCreateShareableLink")}}catch(s){return console.error(s),{url:null,errorMessage:L("alerts.couldNotCreateShareableLink")}}},GSe=e=>{try{localStorage.setItem(vn.LOCAL_STORAGE_COLLAB,JSON.stringify({username:e}))}catch(t){console.error(t)}},KY=()=>{try{const e=localStorage.getItem(vn.LOCAL_STORAGE_COLLAB);if(e)return JSON.parse(e).username}catch(e){console.error(e)}return null},ZY=()=>{let e=null,t=null;try{e=localStorage.getItem(vn.LOCAL_STORAGE_ELEMENTS),t=localStorage.getItem(vn.LOCAL_STORAGE_APP_STATE)}catch(r){console.error(r)}let n=[];if(e)try{n=DH(JSON.parse(e))}catch(r){console.error(r)}let i=null;if(t)try{i={...gs(),...GO(JSON.parse(t))}}catch(r){console.error(r)}return{elements:n,appState:i}},qY=()=>{try{const e=localStorage.getItem(vn.LOCAL_STORAGE_ELEMENTS);return(e==null?void 0:e.length)||0}catch(e){return console.error(e),0}},XSe=()=>{try{const e=localStorage.getItem(vn.LOCAL_STORAGE_APP_STATE),t=localStorage.getItem(vn.LOCAL_STORAGE_COLLAB),n=(e==null?void 0:e.length)||0,i=(t==null?void 0:t.length)||0;return n+i+qY()}catch(e){return console.error(e),0}};class jSe{constructor(t){F(this,"collab");F(this,"socket",null);F(this,"socketInitialized",!1);F(this,"roomId",null);F(this,"roomKey",null);F(this,"broadcastedElementVersions",new Map);F(this,"queueFileUpload",Ao(async()=>{try{await this.collab.fileManager.saveFiles({elements:this.collab.excalidrawAPI.getSceneElementsIncludingDeleted(),files:this.collab.excalidrawAPI.getFiles()})}catch(i){i.name!=="AbortError"&&this.collab.excalidrawAPI.updateScene({appState:{errorMessage:i.message}})}let t=!1;const n=this.collab.excalidrawAPI.getSceneElementsIncludingDeleted().map(i=>this.collab.fileManager.shouldUpdateImageElementStatus(i)?(t=!0,Ce(i,{status:"saved"})):i);t&&this.collab.excalidrawAPI.updateScene({elements:n,captureUpdate:Z.NEVER})},x4e));F(this,"broadcastScene",async(t,n,i)=>{if(t===Yi.INIT&&!i)throw new Error("syncAll must be true when sending SCENE.INIT");const r=n.reduce((o,a)=>((i||!this.broadcastedElementVersions.has(a.id)||a.version>this.broadcastedElementVersions.get(a.id))&&YY(a)&&o.push(a),o),[]),s={type:t,payload:{elements:r}};for(const o of r)this.broadcastedElementVersions.set(o.id,o.version);this.queueFileUpload(),await this._broadcastSocketData(s)});F(this,"broadcastIdleChange",t=>{var n;if((n=this.socket)!=null&&n.id){const i={type:Yi.IDLE_STATUS,payload:{socketId:this.socket.id,userState:t,username:this.collab.state.username}};return this._broadcastSocketData(i,!0)}});F(this,"broadcastMouseLocation",t=>{var n;if((n=this.socket)!=null&&n.id){const i={type:Yi.MOUSE_LOCATION,payload:{socketId:this.socket.id,pointer:t.pointer,button:t.button||"up",selectedElementIds:this.collab.excalidrawAPI.getAppState().selectedElementIds,username:this.collab.state.username}};return this._broadcastSocketData(i,!0)}});F(this,"broadcastVisibleSceneBounds",(t,n)=>{var i;if((i=this.socket)!=null&&i.id){const r={type:Yi.USER_VISIBLE_SCENE_BOUNDS,payload:{socketId:this.socket.id,username:this.collab.state.username,sceneBounds:t.sceneBounds}};return this._broadcastSocketData(r,!0,n)}});F(this,"broadcastUserFollowed",t=>{var n;(n=this.socket)!=null&&n.id&&this.socket.emit(p2.USER_FOLLOW_CHANGE,t)});this.collab=t}open(t,n,i){return this.socket=t,this.roomId=n,this.roomKey=i,this.socket.on("init-room",()=>{this.socket&&(this.socket.emit("join-room",this.roomId),ut("share","room joined"))}),this.socket.on("new-user",async r=>{this.broadcastScene(Yi.INIT,this.collab.getSceneElementsIncludingDeleted(),!0)}),this.socket.on("room-user-change",r=>{this.collab.setCollaborators(r)}),t}close(){this.socket&&(this.queueFileUpload.flush(),this.socket.close(),this.socket=null,this.roomId=null,this.roomKey=null,this.socketInitialized=!1,this.broadcastedElementVersions=new Map)}isOpen(){return!!(this.socketInitialized&&this.socket&&this.roomId&&this.roomKey)}async _broadcastSocketData(t,n=!1,i){var r;if(this.isOpen()){const s=JSON.stringify(t),o=new TextEncoder().encode(s),{encryptedBuffer:a,iv:l}=await s5(this.roomKey,o);(r=this.socket)==null||r.emit(n?p2.SERVER_VOLATILE:p2.SERVER,i??this.roomId,a,l)}}}const b6={[vn.VERSION_DATA_STATE]:-1,[vn.VERSION_FILES]:-1},IL=e=>JSON.parse(localStorage.getItem(e)||"-1")>b6[e],QY=e=>{const t=Date.now();try{localStorage.setItem(e,JSON.stringify(t)),b6[e]=t}catch(n){console.error("error while updating browser state verison",n)}},YSe=()=>{try{for(const e of Object.keys(b6))localStorage.setItem(e,JSON.stringify(-1)),b6[e]=-1}catch(e){console.error("error while resetting browser state verison",e)}};function WSe(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise(function(n){var i=function(){return indexedDB.databases().finally(n)};t=setInterval(i,100),i()}).finally(function(){return clearInterval(t)})}function Fd(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function mT(e,t){const n=WSe().then(()=>{const i=indexedDB.open(e);return i.onupgradeneeded=()=>i.result.createObjectStore(t),Fd(i)});return(i,r)=>n.then(s=>r(s.transaction(t,i).objectStore(t)))}let V7;function h1(){return V7||(V7=mT("keyval-store","keyval")),V7}function KSe(e,t=h1()){return t("readonly",n=>Fd(n.get(e)))}function JY(e,t,n=h1()){return n("readwrite",i=>(i.put(t,e),Fd(i.transaction)))}function ZSe(e,t=h1()){return t("readwrite",n=>(e.forEach(i=>n.put(i[1],i[0])),Fd(n.transaction)))}function qSe(e,t=h1()){return t("readonly",n=>Promise.all(e.map(i=>Fd(n.get(i)))))}function QSe(e,t=h1()){return t("readwrite",n=>(n.delete(e),Fd(n.transaction)))}function JSe(e,t){return e("readonly",n=>(n.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Fd(n.transaction)))}function eIe(e=h1()){const t=[];return JSe(e,n=>t.push([n.key,n.value])).then(()=>t)}class tIe{constructor(){F(this,"locks",new Map);F(this,"lock",t=>{this.locks.set(t,!0)});F(this,"unlock",t=>(this.locks.delete(t),!this.isLocked()))}isLocked(t){return t?this.locks.has(t):!!this.locks.size}}const h0=mT("files-db","files-store");class nIe extends WX{constructor(){super(...arguments);F(this,"clearObsoleteFiles",async n=>{await eIe(h0).then(i=>{for(const[r,s]of i)(!s.lastRetrieved||Date.now()-s.lastRetrieved>24*3600*1e3)&&!n.currentFileIds.includes(r)&&QSe(r,h0)})})}}const iIe=(e,t)=>{var n;try{const i=GO(t);((n=i.openSidebar)==null?void 0:n.name)===ls.name&&i.openSidebar.tab===ku&&(i.openSidebar=null),localStorage.setItem(vn.LOCAL_STORAGE_ELEMENTS,JSON.stringify(DH(e))),localStorage.setItem(vn.LOCAL_STORAGE_APP_STATE,JSON.stringify(i)),QY(vn.VERSION_DATA_STATE)}catch(i){console.error(i)}},gi=class gi{};F(gi,"_save",Ga(async(t,n,i,r)=>{iIe(t,n),await gi.fileStorage.saveFiles({elements:t,files:i}),r()},S4e)),F(gi,"save",(t,n,i,r)=>{gi.isSavePaused()||gi._save(t,n,i,r)}),F(gi,"flushSave",()=>{gi._save.flush()}),F(gi,"locker",new tIe),F(gi,"pauseSave",t=>{gi.locker.lock(t)}),F(gi,"resumeSave",t=>{gi.locker.unlock(t)}),F(gi,"isSavePaused",()=>document.hidden||gi.locker.isLocked()),F(gi,"fileStorage",new nIe({getFiles(t){return qSe(t,h0).then(async n=>{const i=[],r=new Map,s=[];n.forEach((o,a)=>{const l=t[a];if(o){const c={...o,lastRetrieved:Date.now()};s.push([l,c]),i.push(c)}else r.set(l,!0)});try{ZSe(s,h0)}catch(o){console.warn(o)}return{loadedFiles:i,erroredFiles:r}})},async saveFiles({addedFiles:t}){const n=new Map,i=new Map;return QY(vn.VERSION_FILES),await Promise.all([...t].map(async([r,s])=>{try{await JY(r,s,h0),n.set(r,s)}catch(o){console.error(o),i.set(r,s)}})),{savedFiles:n,erroredFiles:i}}}));let pi=gi;const xs=class xs{static async load(){return await KSe(xs.key,xs.store)||null}static save(t){return JY(xs.key,t,xs.store)}};F(xs,"idb_name",vn.IDB_LIBRARY),F(xs,"key","libraryData"),F(xs,"store",mT(`${xs.idb_name}-db`,`${xs.idb_name}-store`));let y6=xs;class rIe{static load(){const t=localStorage.getItem(vn.__LEGACY_LOCAL_STORAGE_LIBRARY);if(t!=null){const n=JSON.parse(t);if(n)return{libraryItems:n}}return null}static clear(){localStorage.removeItem(vn.__LEGACY_LOCAL_STORAGE_LIBRARY)}}const wl=Nm(),sIe=(e,t)=>{const[n,i]=ph(e);return M.useLayoutEffect(()=>{i(typeof t=="function"?t():t)},[]),[n,i]},$4=qt({message:null,nonce:0}),eW=({collabError:e})=>{const[t,n]=M.useState(!1),i=M.useRef(0);return M.useEffect(()=>(n(!0),i.current=window.setTimeout(()=>{n(!1)},1e3),()=>{window.clearTimeout(i.current)}),[e.message,e.nonce]),e.message?g(el,{label:e.message,long:!0,children:g("div",{className:me("collab-errors-button",{"collab-errors-button-shake":t}),children:nne})}):null};eW.displayName="CollabError";const tW=qt(null),G4=qt(!1),nW=qt(!1),iW=qt(null);class oIe extends M.PureComponent{constructor(n){super(n);F(this,"portal");F(this,"fileManager");F(this,"excalidrawAPI");F(this,"activeIntervalId");F(this,"idleTimeoutId");F(this,"socketInitializationTimer");F(this,"lastBroadcastedOrReceivedSceneVersion",-1);F(this,"collaborators",new Map);F(this,"onUmmount",null);F(this,"onOfflineStatusToggle",()=>{wl.set(nW,!window.navigator.onLine)});F(this,"isCollaborating",()=>wl.get(G4));F(this,"setIsCollaborating",n=>{wl.set(G4,n)});F(this,"onUnload",()=>{this.destroySocketClient({isUnload:!0})});F(this,"beforeUnload",en(n=>{const i=jl(this.getSceneElementsIncludingDeleted());this.isCollaborating()&&(this.fileManager.shouldPreventUnload(i)||!XY(this.portal,i))&&(this.saveCollabRoomToFirebase(i),o9(n))}));F(this,"saveCollabRoomToFirebase",async n=>{try{const i=await LSe(this.portal,n,this.excalidrawAPI.getAppState());this.resetErrorIndicator(),this.isCollaborating()&&i&&this.handleRemoteSceneUpdate(this._reconcileElements(i))}catch(i){const r=/is longer than.*?bytes/.test(i.message)?L("errors.collabSaveFailed_sizeExceeded"):L("errors.collabSaveFailed");(!this.state.dialogNotifiedErrors[r]||!this.isCollaborating())&&(this.setErrorDialog(r),this.setState({dialogNotifiedErrors:{...this.state.dialogNotifiedErrors,[r]:!0}})),this.isCollaborating()&&this.setErrorIndicator(r),console.error(i)}});F(this,"stopCollaboration",(n=!0)=>{if(this.queueBroadcastAllElements.cancel(),this.queueSaveToFirebase.cancel(),this.loadImageFiles.cancel(),this.resetErrorIndicator(!0),this.saveCollabRoomToFirebase(jl(this.excalidrawAPI.getSceneElementsIncludingDeleted())),this.portal.socket&&this.fallbackInitializationHandler&&this.portal.socket.off("connect_error",this.fallbackInitializationHandler),!n)pi.fileStorage.reset(),this.destroySocketClient();else if(window.confirm(L("alerts.collabStopOverridePrompt"))){YSe(),window.history.pushState({},Ra,window.location.origin),this.destroySocketClient(),pi.fileStorage.reset();const i=this.excalidrawAPI.getSceneElementsIncludingDeleted().map(r=>st(r)&&r.status==="saved"?Ce(r,{status:"pending"}):r);this.excalidrawAPI.updateScene({elements:i,captureUpdate:Z.NEVER})}});F(this,"destroySocketClient",n=>{this.lastBroadcastedOrReceivedSceneVersion=-1,this.portal.close(),this.fileManager.reset(),n!=null&&n.isUnload||(this.setIsCollaborating(!1),this.setActiveRoomLink(null),this.collaborators=new Map,this.excalidrawAPI.updateScene({collaborators:this.collaborators}),pi.resumeSave("collaboration"))});F(this,"fetchImageFilesFromFirebase",async n=>{const i=n.elements.filter(r=>xn(r)&&!this.fileManager.isFileTracked(r.fileId)&&!r.isDeleted&&(n.forceFetchFiles?r.status!=="pending"||Date.now()-r.updated>1e4:r.status==="saved")).map(r=>r.fileId);return await this.fileManager.getFiles(i)});F(this,"decryptPayload",async(n,i,r)=>{try{const s=await q0(n,i,r),o=new TextDecoder("utf-8").decode(new Uint8Array(s));return JSON.parse(o)}catch(s){return window.alert(L("alerts.decryptFailed")),console.error(s),{type:Yi.INVALID_RESPONSE}}});F(this,"fallbackInitializationHandler",null);F(this,"startCollaboration",async n=>{if(this.state.username||be(()=>import("./random-username.esm-__vdrxyo.js"),__vite__mapDeps([])).then(({getRandomUsername:l})=>{const c=l();this.setUsername(c)}),this.portal.socket)return null;let i,r;n?{roomId:i,roomKey:r}=n:({roomId:i,roomKey:r}=await BSe(),window.history.pushState({},Ra,zSe({roomId:i,roomKey:r})));const s=$6();this.setIsCollaborating(!0),pi.pauseSave("collaboration");const{default:o}=await be(()=>import("./index-ChGp7972.js"),__vite__mapDeps([])),a=()=>{this.initializeRoom({roomLinkData:n,fetchScene:!0}).then(l=>{s.resolve(l)})};this.fallbackInitializationHandler=a;try{this.portal.socket=this.portal.open(o("https://oss-collab.excalidraw.com",{transports:["websocket","polling"]}),i,r),this.portal.socket.once("connect_error",a)}catch(l){return console.error(l),this.setErrorDialog(l.message),null}if(!n){const l=this.excalidrawAPI.getSceneElements().map(c=>st(c)&&c.status==="saved"?Ce(c,{status:"pending"}):c);this.excalidrawAPI.updateScene({elements:l,captureUpdate:Z.NEVER}),this.saveCollabRoomToFirebase(jl(l))}return this.socketInitializationTimer=window.setTimeout(a,I4e),this.portal.socket.on("client-broadcast",async(l,c)=>{var d;if(!this.portal.roomKey)return;const u=await this.decryptPayload(c,l,this.portal.roomKey);switch(u.type){case Yi.INVALID_RESPONSE:return;case Yi.INIT:{if(!this.portal.socketInitialized){this.initializeRoom({fetchScene:!1});const f=u.payload.elements,h=this._reconcileElements(f);this.handleRemoteSceneUpdate(h),s.resolve({elements:h,scrollToContent:!0})}break}case Yi.UPDATE:this.handleRemoteSceneUpdate(this._reconcileElements(u.payload.elements));break;case Yi.MOUSE_LOCATION:{const{pointer:f,button:h,username:m,selectedElementIds:p}=u.payload,b=u.payload.socketId||u.payload.socketID;this.updateCollaborator(b,{pointer:f,button:h,selectedElementIds:p,username:m});break}case Yi.USER_VISIBLE_SCENE_BOUNDS:{const{sceneBounds:f,socketId:h}=u.payload,m=this.excalidrawAPI.getAppState();if(((d=m.userToFollow)==null?void 0:d.socketId)!==h){console.warn(`receiving remote client's (from ${h}) viewport bounds even though we're not subscribed to it!`);return}if(m.userToFollow&&m.followedBy.has(m.userToFollow.socketId))return;this.excalidrawAPI.updateScene({appState:i$({appState:m,bounds:f,fitToViewport:!0,viewportZoomFactor:1}).appState});break}case Yi.IDLE_STATUS:{const{userState:f,socketId:h,username:m}=u.payload;this.updateCollaborator(h,{userState:f,username:m});break}default:pc(u,null)}}),this.portal.socket.on("first-in-room",async()=>{this.portal.socket&&this.portal.socket.off("first-in-room");const l=await this.initializeRoom({fetchScene:!0,roomLinkData:n});s.resolve(l)}),this.portal.socket.on(p2.USER_FOLLOW_ROOM_CHANGE,l=>{this.excalidrawAPI.updateScene({appState:{followedBy:new Set(l)}}),this.relayVisibleSceneBounds({force:!0})}),this.initializeIdleDetector(),this.setActiveRoomLink(window.location.href),s});F(this,"initializeRoom",async({fetchScene:n,roomLinkData:i})=>{if(clearTimeout(this.socketInitializationTimer),this.portal.socket&&this.fallbackInitializationHandler&&this.portal.socket.off("connect_error",this.fallbackInitializationHandler),n&&i&&this.portal.socket){this.excalidrawAPI.resetScene();try{const r=await DSe(i.roomId,i.roomKey,this.portal.socket);if(r)return this.setLastBroadcastedOrReceivedSceneVersion(Nl(r)),{elements:r,scrollToContent:!0}}catch(r){console.error(r)}finally{this.portal.socketInitialized=!0}}else this.portal.socketInitialized=!0;return null});F(this,"_reconcileElements",n=>{const i=this.getSceneElementsIncludingDeleted(),r=this.excalidrawAPI.getAppState(),s=id(n,null),o=ew(i,s,r);return this.setLastBroadcastedOrReceivedSceneVersion(Nl(o)),o});F(this,"loadImageFiles",Ao(async()=>{const{loadedFiles:n,erroredFiles:i}=await this.fetchImageFilesFromFirebase({elements:this.excalidrawAPI.getSceneElementsIncludingDeleted()});this.excalidrawAPI.addFiles(n),Eg({excalidrawAPI:this.excalidrawAPI,erroredFiles:i,elements:this.excalidrawAPI.getSceneElementsIncludingDeleted()})},C4e));F(this,"handleRemoteSceneUpdate",n=>{this.excalidrawAPI.updateScene({elements:n,captureUpdate:Z.NEVER}),this.loadImageFiles()});F(this,"onPointerMove",()=>{this.idleTimeoutId&&(window.clearTimeout(this.idleTimeoutId),this.idleTimeoutId=null),this.idleTimeoutId=window.setTimeout(this.reportIdle,PI),this.activeIntervalId||(this.activeIntervalId=window.setInterval(this.reportActive,FI))});F(this,"onVisibilityChange",()=>{document.hidden?(this.idleTimeoutId&&(window.clearTimeout(this.idleTimeoutId),this.idleTimeoutId=null),this.activeIntervalId&&(window.clearInterval(this.activeIntervalId),this.activeIntervalId=null),this.onIdleStateChange(mu.AWAY)):(this.idleTimeoutId=window.setTimeout(this.reportIdle,PI),this.activeIntervalId=window.setInterval(this.reportActive,FI),this.onIdleStateChange(mu.ACTIVE))});F(this,"reportIdle",()=>{this.onIdleStateChange(mu.IDLE),this.activeIntervalId&&(window.clearInterval(this.activeIntervalId),this.activeIntervalId=null)});F(this,"reportActive",()=>{this.onIdleStateChange(mu.ACTIVE)});F(this,"initializeIdleDetector",()=>{document.addEventListener(te.POINTER_MOVE,this.onPointerMove),document.addEventListener(te.VISIBILITY_CHANGE,this.onVisibilityChange)});F(this,"updateCollaborator",(n,i)=>{var o;const r=new Map(this.collaborators),s=Object.assign({},r.get(n),i,{isCurrentUser:n===((o=this.portal.socket)==null?void 0:o.id)});r.set(n,s),this.collaborators=r,this.excalidrawAPI.updateScene({collaborators:r})});F(this,"setLastBroadcastedOrReceivedSceneVersion",n=>{this.lastBroadcastedOrReceivedSceneVersion=n});F(this,"getLastBroadcastedOrReceivedSceneVersion",()=>this.lastBroadcastedOrReceivedSceneVersion);F(this,"getSceneElementsIncludingDeleted",()=>this.excalidrawAPI.getSceneElementsIncludingDeleted());F(this,"onPointerUpdate",Ao(n=>{n.pointersMap.size<2&&this.portal.socket&&this.portal.broadcastMouseLocation(n)},M4e));F(this,"relayVisibleSceneBounds",n=>{const i=this.excalidrawAPI.getAppState();this.portal.socket&&(i.followedBy.size>0||n!=null&&n.force)&&this.portal.broadcastVisibleSceneBounds({sceneBounds:yH(i)},`follow@${this.portal.socket.id}`)});F(this,"onIdleStateChange",n=>{this.portal.broadcastIdleChange(n)});F(this,"broadcastElements",n=>{Nl(n)>this.getLastBroadcastedOrReceivedSceneVersion()&&(this.portal.broadcastScene(Yi.UPDATE,n,!1),this.lastBroadcastedOrReceivedSceneVersion=Nl(n),this.queueBroadcastAllElements())});F(this,"syncElements",n=>{this.broadcastElements(n),this.queueSaveToFirebase()});F(this,"queueBroadcastAllElements",Ao(()=>{this.portal.broadcastScene(Yi.UPDATE,this.excalidrawAPI.getSceneElementsIncludingDeleted(),!0);const n=this.getLastBroadcastedOrReceivedSceneVersion(),i=Math.max(n,Nl(this.getSceneElementsIncludingDeleted()));this.setLastBroadcastedOrReceivedSceneVersion(i)},dk));F(this,"queueSaveToFirebase",Ao(()=>{this.portal.socketInitialized&&this.saveCollabRoomToFirebase(jl(this.excalidrawAPI.getSceneElementsIncludingDeleted()))},dk,{leading:!1}));F(this,"setUsername",n=>{this.setState({username:n}),GSe(n)});F(this,"getUsername",()=>this.state.username);F(this,"setActiveRoomLink",n=>{this.setState({activeRoomLink:n}),wl.set(iW,n)});F(this,"getActiveRoomLink",()=>this.state.activeRoomLink);F(this,"setErrorIndicator",n=>{wl.set($4,{message:n,nonce:Date.now()})});F(this,"resetErrorIndicator",(n=!1)=>{wl.set($4,{message:null,nonce:0}),n&&this.setState({dialogNotifiedErrors:{}})});F(this,"setErrorDialog",n=>{this.setState({errorMessage:n})});this.state={errorMessage:null,dialogNotifiedErrors:{},username:KY()||"",activeRoomLink:null},this.portal=new jSe(this),this.fileManager=new WX({getFiles:async i=>{const{roomId:r,roomKey:s}=this.portal;if(!r||!s)throw new Uh;return jY(`files/rooms/${r}`,s,i)},saveFiles:async({addedFiles:i})=>{const{roomId:r,roomKey:s}=this.portal;if(!r||!s)throw new Uh;const{savedFiles:o,erroredFiles:a}=await gT({prefix:`${YX.collabFiles}/${r}`,files:await Cw({files:i,encryptionKey:s,maxBytes:xw})});return{savedFiles:o.reduce((l,c)=>{const u=i.get(c);return u&&l.set(c,u),l},new Map),erroredFiles:a.reduce((l,c)=>{const u=i.get(c);return u&&l.set(c,u),l},new Map)}}}),this.excalidrawAPI=n.excalidrawAPI,this.activeIntervalId=null,this.idleTimeoutId=null}componentDidMount(){window.addEventListener(te.BEFORE_UNLOAD,this.beforeUnload),window.addEventListener("online",this.onOfflineStatusToggle),window.addEventListener("offline",this.onOfflineStatusToggle),window.addEventListener(te.UNLOAD,this.onUnload);const n=this.excalidrawAPI.onUserFollow(o=>{this.portal.socket&&this.portal.broadcastUserFollowed(o)}),i=Qh(this.relayVisibleSceneBounds),r=this.excalidrawAPI.onScrollChange(()=>i());this.onUmmount=()=>{n(),r()},this.onOfflineStatusToggle();const s={isCollaborating:this.isCollaborating,onPointerUpdate:this.onPointerUpdate,startCollaboration:this.startCollaboration,syncElements:this.syncElements,fetchImageFilesFromFirebase:this.fetchImageFilesFromFirebase,stopCollaboration:this.stopCollaboration,setUsername:this.setUsername,getUsername:this.getUsername,getActiveRoomLink:this.getActiveRoomLink,setCollabError:this.setErrorDialog};wl.set(tW,s)}componentWillUnmount(){var n;window.removeEventListener("online",this.onOfflineStatusToggle),window.removeEventListener("offline",this.onOfflineStatusToggle),window.removeEventListener(te.BEFORE_UNLOAD,this.beforeUnload),window.removeEventListener(te.UNLOAD,this.onUnload),window.removeEventListener(te.POINTER_MOVE,this.onPointerMove),window.removeEventListener(te.VISIBILITY_CHANGE,this.onVisibilityChange),this.activeIntervalId&&(window.clearInterval(this.activeIntervalId),this.activeIntervalId=null),this.idleTimeoutId&&(window.clearTimeout(this.idleTimeoutId),this.idleTimeoutId=null),(n=this.onUmmount)==null||n.call(this)}setCollaborators(n){var r;const i=new Map;for(const s of n)i.set(s,Object.assign({},this.collaborators.get(s),{isCurrentUser:s===((r=this.portal.socket)==null?void 0:r.id)}));this.collaborators=i,this.excalidrawAPI.updateScene({collaborators:i})}render(){const{errorMessage:n}=this.state;return g(he,{children:n!=null&&g(dw,{onClose:()=>this.setErrorDialog(null),children:n})})}}const aIe=500,xL=Ga(e=>{e({scene:qY(),total:XSe()})},aIe),lIe=e=>{const[t,n]=M.useState({scene:0,total:0});M.useEffect(()=>{xL(o=>{n(o)})},[e.elements,e.appState]),M.useEffect(()=>()=>xL.cancel(),[]);const i=Z3();let r,s;return i!==PO?(s=i.slice(0,16).replace("T"," "),r=i.slice(21)):s=L("stats.versionNotAvailable"),P(pa.StatsRows,{order:-1,children:[g(pa.StatsRow,{heading:!0,children:L("stats.version")}),P(pa.StatsRow,{style:{textAlign:"center",cursor:"pointer"},onClick:async()=>{try{await Bc(Z3()),e.setToast(L("toast.copyToClipboard"))}catch{}},title:L("stats.versionCopy"),children:[s,g("br",{}),r]}),g(pa.StatsRow,{heading:!0,children:L("stats.storage")}),P(pa.StatsRow,{columns:2,children:[g("div",{children:L("stats.scene")}),g("div",{children:dx(t.scene,1)})]}),P(pa.StatsRow,{columns:2,children:[g("div",{children:L("stats.total")}),g("div",{children:dx(t.total,1)})]})]})};let cIe=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,n)=>(n&=63,n<36?t+=n.toString(36):n<62?t+=(n-26).toString(36).toUpperCase():n>62?t+="-":t+="_",t),"");const X4=async(e,t,n,i)=>{const r=await GY(),s=`${cIe(12)}`,o=await O9(),a=await s5(o,i1(e,t,n,"database")),l=new Blob([a.iv,new Uint8Array(a.encryptedBuffer)],{type:ye.binary}),c=HY(r,`/migrations/scenes/${s}`);await zY(c,l,{customMetadata:{data:JSON.stringify({version:2,name:i}),created:Date.now().toString()}});const u=new Map;for(const d of e)xn(d)&&n[d.fileId]&&u.set(d.fileId,n[d.fileId]);if(u.size){const d=await Cw({files:u,encryptionKey:o,maxBytes:xw});await gT({prefix:`/migrations/files/scenes/${s}`,files:d})}window.open(`https://app.excalidraw.com/import?excalidraw=${s},${o}`)},uIe=({elements:e,appState:t,files:n,name:i,onError:r,onSuccess:s})=>{const{t:o}=mn();return P(ZE,{color:"primary",children:[g("div",{className:"Card-icon",children:g(zG,{style:{"--color-logo-icon":"#fff",width:"2.8rem",height:"2.8rem"}})}),g("h2",{children:"Excalidraw+"}),g("div",{className:"Card-details",children:o("exportDialog.excalidrawplus_description")}),g(Ke,{className:"Card-button",type:"button",title:o("exportDialog.excalidrawplus_button"),"aria-label":o("exportDialog.excalidrawplus_button"),showAriaLabel:!0,onClick:async()=>{try{ut("export","eplus",`ui (${Bm()})`),await X4(e,t,n,i),s()}catch(a){console.error(a),a.name!=="AbortError"&&r(new Error(o("exportDialog.excalidrawplus_exportError")))}}})]})};function dIe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vm(e){"@babel/helpers - typeof";return vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vm(e)}function fIe(e,t){if(vm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(vm(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function hIe(e){var t=fIe(e,"string");return vm(t)=="symbol"?t:t+""}function gIe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,hIe(i.key),i)}}function mIe(e,t,n){return t&&gIe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var rW=[],pIe=rW.forEach,UIe=rW.slice;function bIe(e){return pIe.call(UIe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var CL=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,yIe=function(t,n,i){var r=i||{};r.path=r.path||"/";var s=encodeURIComponent(n),o=t+"="+s;if(r.maxAge>0){var a=r.maxAge-0;if(isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age="+Math.floor(a)}if(r.domain){if(!CL.test(r.domain))throw new TypeError("option domain is invalid");o+="; Domain="+r.domain}if(r.path){if(!CL.test(r.path))throw new TypeError("option path is invalid");o+="; Path="+r.path}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(o+="; HttpOnly"),r.secure&&(o+="; Secure"),r.sameSite){var l=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},AL={create:function(t,n,i,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};i&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+i*60*1e3)),r&&(s.domain=r),document.cookie=yIe(t,encodeURIComponent(n),s)},read:function(t){for(var n=t+"=",i=document.cookie.split(";"),r=0;r<i.length;r++){for(var s=i[r];s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(n)===0)return s.substring(n.length,s.length)}return null},remove:function(t){this.create(t,"",-1)}},EIe={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var i=AL.read(t.lookupCookie);i&&(n=i)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&AL.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},vIe={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var i=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=i.substring(1),s=r.split("&"),o=0;o<s.length;o++){var a=s[o].indexOf("=");if(a>0){var l=s[o].substring(0,a);l===t.lookupQuerystring&&(n=s[o].substring(a+1))}}}return n}},eg=null,ML=function(){if(eg!==null)return eg;try{eg=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{eg=!1}return eg},_Ie={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&ML()){var i=window.localStorage.getItem(t.lookupLocalStorage);i&&(n=i)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&ML()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},tg=null,RL=function(){if(tg!==null)return tg;try{tg=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{tg=!1}return tg},wIe={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&RL()){var i=window.sessionStorage.getItem(t.lookupSessionStorage);i&&(n=i)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&RL()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},TIe={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var i=0;i<navigator.languages.length;i++)n.push(navigator.languages[i]);navigator.userLanguage&&n.push(navigator.userLanguage),navigator.language&&n.push(navigator.language)}return n.length>0?n:void 0}},SIe={name:"htmlTag",lookup:function(t){var n,i=t.htmlTag||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(n=i.getAttribute("lang")),n}},IIe={name:"path",lookup:function(t){var n;if(typeof window<"u"){var i=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(i instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof i[t.lookupFromPathIndex]!="string")return;n=i[t.lookupFromPathIndex].replace("/","")}else n=i[0].replace("/","")}return n}},xIe={name:"subdomain",lookup:function(t){var n;if(typeof window<"u"){var i=window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);i instanceof Array&&(typeof t.lookupFromSubdomainIndex=="number"?n=i[t.lookupFromSubdomainIndex].replace("http://","").replace("https://","").replace(".",""):n=i[0].replace("http://","").replace("https://","").replace(".",""))}return n}};function CIe(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var sW=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};dIe(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return mIe(e,[{key:"init",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=bIe(i,this.options||{},CIe()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(EIe),this.addDetector(vIe),this.addDetector(_Ie),this.addDetector(wIe),this.addDetector(TIe),this.addDetector(SIe),this.addDetector(IIe),this.addDetector(xIe)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var i=this;n||(n=this.options.order);var r=[];return n.forEach(function(s){if(i.detectors[s]){var o=i.detectors[s].lookup(i.options);o&&typeof o=="string"&&(o=[o]),o&&(r=r.concat(o))}}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(n,i){var r=this;i||(i=this.options.caches),i&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||i.forEach(function(s){r.detectors[s]&&r.detectors[s].cacheUserLanguage(n,r.options)}))}}]),e}();sW.type="languageDetector";const pT=new sW;pT.init({languageUtils:{}});const oW=()=>{var i;const e=pT.detect(),t=Array.isArray(e)?e[0]:e;return(t?(i=H6.find(r=>r.code.startsWith(t)))==null?void 0:i.code:null)||Sd.code},aW=qt(oW()),AIe=()=>{const[e,t]=ph(aW);return M.useEffect(()=>{pT.cacheUserLanguage(e)},[e]),[e,t]},MIe=({style:e})=>{const{t,langCode:n}=mn(),i=Jv(aW);return g("select",{className:"dropdown-select dropdown-select__language",onChange:({target:r})=>i(r.value),value:n,"aria-label":t("buttons.selectLanguage"),style:e,children:H6.map(r=>g("option",{value:r.code,children:r.label},r.code))})},RIe=(e,t,n,i)=>{e.save(),e.strokeStyle=i,e.beginPath(),e.moveTo(n[0][0]*t,n[0][1]*t),e.lineTo(n[1][0]*t,n[1][1]*t),e.stroke(),e.restore()},kIe=(e,t,[n,i,r,s],o)=>{e.save(),e.strokeStyle=o,e.beginPath(),e.moveTo(n[0]*t,n[1]*t),e.bezierCurveTo(i[0]*t,i[1]*t,r[0]*t,r[1]*t,s[0]*t,s[1]*t),e.stroke(),e.restore()},LIe=(e,t)=>{e.strokeStyle="#888",e.save(),e.beginPath(),e.moveTo(-10*t,-10*t),e.lineTo(10*t,10*t),e.moveTo(10*t,-10*t),e.lineTo(-10*t,10*t),e.stroke(),e.save()},kL=(e,t,n)=>{e.forEach(i=>{switch(!0){case cee(i.data):RIe(t,n.zoom.value,i.data,i.color);break;case hee(i.data):kIe(t,n.zoom.value,i.data,i.color);break;default:throw new Error(`Unknown element type ${JSON.stringify(i)}`)}})},DIe=(e,t,n,i)=>{var a,l,c,u;const[r,s]=l5(e,n);(t.height!==e.height||t.width!==e.width)&&i();const o=c5({canvas:e,scale:n,normalizedWidth:r,normalizedHeight:s,viewBackgroundColor:"transparent"});if(o.save(),o.translate(t.scrollX*t.zoom.value,t.scrollY*t.zoom.value),LIe(o,t.zoom.value),(a=window.visualDebug)!=null&&a.currentFrame&&((l=window.visualDebug)!=null&&l.data)&&window.visualDebug.data.length>0){const[d]=NIe();kL(window.visualDebug.data[d],o,t)}else(c=window.visualDebug)==null||c.data.forEach(d=>{kL(d,o,t)});window.visualDebug&&(window.visualDebug.data=((u=window.visualDebug)==null?void 0:u.data.map(d=>d.filter(f=>f.permanent)))??[])},NIe=()=>{var n,i,r;const e=((n=window.visualDebug)==null?void 0:n.currentFrame)??0,t=((i=window.visualDebug)==null?void 0:i.data.length)??0;return t>0?[e%t,((r=window.visualDebug)==null?void 0:r.currentFrame)??0]:[0,0]},OIe=Qh((e,t,n,i)=>{DIe(e,t,n,i)},{trailing:!0}),lW=()=>{var e;return Array.isArray((e=window.visualDebug)==null?void 0:e.data)},PIe=({onChange:e})=>{const t=M.useCallback(()=>{var s,o;(!((s=window.visualDebug)!=null&&s.currentFrame)||isNaN(((o=window.visualDebug)==null?void 0:o.currentFrame)??-1))&&(window.visualDebug.currentFrame=0),window.visualDebug.currentFrame+=1,e()},[e]),n=M.useCallback(()=>{var s,o,a;(!((s=window.visualDebug)!=null&&s.currentFrame)||isNaN(((o=window.visualDebug)==null?void 0:o.currentFrame)??-1)||((a=window.visualDebug)==null?void 0:a.currentFrame)<1)&&(window.visualDebug.currentFrame=1),window.visualDebug.currentFrame-=1,e()},[e]),i=M.useCallback(()=>{window.visualDebug.currentFrame=void 0,e()},[e]),r=M.useCallback(()=>{window.visualDebug&&(window.visualDebug.currentFrame=void 0,window.visualDebug.data=[]),e()},[e]);return P(he,{children:[g("button",{className:"ToolIcon_type_button","data-testid":"debug-forward","aria-label":"Move forward",type:"button",onClick:r,children:g("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":"false",children:bc})}),g("button",{className:"ToolIcon_type_button","data-testid":"debug-forward","aria-label":"Move forward",type:"button",onClick:n,children:g("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":"false",children:g(sE,{flip:!0})})}),g("button",{className:"ToolIcon_type_button","data-testid":"debug-forward","aria-label":"Move forward",type:"button",onClick:i,children:g("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":"false",children:xd})}),g("button",{className:"ToolIcon_type_button","data-testid":"debug-backward","aria-label":"Move backward",type:"button",onClick:t,children:g("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":"false",children:g(sE,{})})})]})},FIe=({appState:e,scale:t,ref:n})=>{const{width:i,height:r}=e,s=M.useRef(null);return M.useImperativeHandle(n,()=>s.current,[s]),g("canvas",{style:{width:i,height:r,position:"absolute",zIndex:2,pointerEvents:"none"},width:i*t,height:r*t,ref:s,children:"Debug Canvas"})},BIe=se.memo(e=>P(vt,{children:[g(vt.DefaultItems.LoadScene,{}),g(vt.DefaultItems.SaveToActiveFile,{}),g(vt.DefaultItems.Export,{}),g(vt.DefaultItems.SaveAsImage,{}),e.isCollabEnabled&&g(vt.DefaultItems.LiveCollaborationTrigger,{isCollaborating:e.isCollaborating,onSelect:()=>e.onCollabDialogOpen()}),g(vt.DefaultItems.CommandPalette,{className:"highlighted"}),g(vt.DefaultItems.SearchMenu,{}),g(vt.DefaultItems.Help,{}),g(vt.DefaultItems.ClearCanvas,{}),g(vt.Separator,{}),g(vt.ItemLink,{icon:tE,href:"https://plus.excalidraw.com/plus?utm_source=excalidraw&utm_medium=app&utm_content=hamburger",className:"",children:"kj-diagramming cloud"}),g(vt.DefaultItems.Socials,{}),g(vt.ItemLink,{icon:ZF,href:`https://app.excalidraw.com${pd?"":"/sign-up"}?utm_source=signin&utm_medium=app&utm_content=hamburger`,className:"highlighted",children:pd?"Sign in":"Sign up"}),!1,g(vt.Separator,{}),g(vt.DefaultItems.ToggleTheme,{allowSystemTheme:!0,theme:e.theme,onSelect:e.setTheme}),g(vt.ItemCustom,{children:g(MIe,{style:{width:"100%"}})}),g(vt.DefaultItems.ChangeCanvasBackground,{})]})),zIe=se.memo(e=>{const{t}=mn();let n;return pd?n=t("welcomeScreen.app.center_heading_plus").split(/(kj-diagramming)/).map((i,r)=>i==="kj-diagramming"?g("a",{style:{pointerEvents:tu.inheritFromUI},href:"https://app.excalidraw.com?utm_source=excalidraw&utm_medium=app&utm_content=welcomeScreenSignedInUser",children:"kj-diagramming"},r):i):n=t("welcomeScreen.app.center_heading"),P(sr,{children:[g(sr.Hints.MenuHint,{children:t("welcomeScreen.app.menuHint")}),g(sr.Hints.ToolbarHint,{}),g(sr.Hints.HelpHint,{}),P(sr.Center,{children:[g(sr.Center.Heading,{children:n}),P(sr.Center.Menu,{children:[g(sr.Center.MenuItemLoadScene,{}),g(sr.Center.MenuItemHelp,{}),e.isCollabEnabled&&g(sr.Center.MenuItemLiveCollaborationTrigger,{onSelect:()=>e.onCollabDialogOpen()}),!pd&&g(sr.Center.MenuItemLink,{href:"https://plus.excalidraw.com/plus?utm_source=excalidraw&utm_medium=app&utm_content=welcomeScreenGuest",shortcut:null,icon:ZF,children:"Sign up"})]})]})]})}),HIe=()=>{const{t:e}=mn();return g("a",{className:"encrypted-icon tooltip",href:"https://plus.excalidraw.com/blog/end-to-end-encryption",target:"_blank",rel:"noopener noreferrer","aria-label":e("encrypted.link"),children:g(el,{label:e("encrypted.tooltip"),long:!0,children:lne})})},VIe=()=>pd?g("a",{href:"https://app.excalidraw.com?utm_source=excalidraw&utm_medium=app&utm_content=signedInUserRedirectButton#excalidraw-redirect",target:"_blank",rel:"noreferrer",className:"plus-button",children:"Go to kj-diagramming cloud"}):null,$Ie=se.memo(({onChange:e})=>g(BG,{children:P("div",{style:{display:"flex",gap:".5rem",alignItems:"center"},children:[lW()&&g(PIe,{onChange:e}),pd?g(VIe,{}):g(HIe,{})]})})),GIe=({link:e,onCloseRequest:t,setErrorMessage:n})=>{const{t:i}=mn(),[,r]=M.useState(!1),s=M.useRef(0),o=M.useRef(null),a=async()=>{var u;try{await Bc(e)}catch{n(i("errors.copyToSystemClipboardFailed"))}r(!0),s.current&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{r(!1)},3e3),(u=o.current)==null||u.select()},{onCopy:l,copyStatus:c}=B_();return g(Hr,{onCloseRequest:t,title:!1,size:"small",children:P("div",{className:"ShareableLinkDialog",children:[g("h3",{children:"Shareable link"}),P("div",{className:"ShareableLinkDialog__linkRow",children:[g(Ah,{ref:o,label:"Link",readonly:!0,fullWidth:!0,value:e,selectOnRender:!0}),g(Ws,{size:"large",label:i("buttons.copyLink"),icon:$m,status:c,onClick:()=>{l(),a()}})]}),P("div",{className:"ShareableLinkDialog__description",children:["🔒 ",i("alerts.uploadedSecurly")]})]})})},cW=qt({isOpen:!1}),XIe=()=>{const e=window.navigator,t=/Apple/.test(e.vendor),n=e.appVersion.indexOf("Win")!==-1;return t?ine:n?sne:y9},jIe=({collabAPI:e,activeRoomLink:t,handleClose:n})=>{const{t:i}=mn(),[,r]=M.useState(!1),s=M.useRef(0),o=M.useRef(null),a="share"in navigator,{onCopy:l,copyStatus:c}=B_(),u=async()=>{var f;try{await Bc(t)}catch{e.setCollabError(i("errors.copyToSystemClipboardFailed"))}r(!0),s.current&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{r(!1)},3e3),(f=o.current)==null||f.select()},d=async()=>{try{await navigator.share({title:i("roomDialog.shareTitle"),text:i("roomDialog.shareTitle"),url:t})}catch{}};return P(he,{children:[g("h3",{className:"ShareDialog__active__header",children:i("labels.liveCollaboration").replace(/\./g,"")}),g(Ah,{defaultValue:e.getUsername(),placeholder:"Your name",label:"Your name",onChange:e.setUsername,onKeyDown:f=>f.key===z.ENTER&&n()}),P("div",{className:"ShareDialog__active__linkRow",children:[g(Ah,{ref:o,label:"Link",readonly:!0,fullWidth:!0,value:t}),a&&g(Ws,{size:"large",variant:"icon",label:"Share",icon:XIe(),className:"ShareDialog__active__share",onClick:d}),g(Ws,{size:"large",label:i("buttons.copyLink"),icon:$m,status:c,onClick:()=>{u(),l()}})]}),P("div",{className:"ShareDialog__active__description",children:[P("p",{children:[P("span",{role:"img","aria-hidden":"true",className:"ShareDialog__active__description__emoji",children:["🔒"," "]}),i("roomDialog.desc_privacy")]}),g("p",{children:i("roomDialog.desc_exitSession")})]}),g("div",{className:"ShareDialog__active__actions",children:g(Ws,{size:"large",variant:"outlined",color:"danger",label:i("roomDialog.button_stopSession"),icon:Wne,onClick:()=>{ut("share","room closed"),e.stopCollaboration(),e.isCollaborating()||n()}})})]})},YIe=e=>{const{t}=mn(),{collabAPI:n}=e,i=n?P(he,{children:[g("div",{className:"ShareDialog__picker__header",children:t("labels.liveCollaboration").replace(/\./g,"")}),P("div",{className:"ShareDialog__picker__description",children:[g("div",{style:{marginBottom:"1em"},children:t("roomDialog.desc_intro")}),t("roomDialog.desc_privacy")]}),g("div",{className:"ShareDialog__picker__button",children:g(Ws,{size:"large",label:t("roomDialog.button_startSession"),icon:Yne,onClick:()=>{ut("share","room creation",`ui (${Bm()})`),n.startCollaboration(null)}})}),e.type==="share"&&g("div",{className:"ShareDialog__separator",children:g("span",{children:t("shareDialog.or")})})]}):null;return P(he,{children:[i,e.type==="share"&&P(he,{children:[g("div",{className:"ShareDialog__picker__header",children:t("exportDialog.link_title")}),g("div",{className:"ShareDialog__picker__description",children:t("exportDialog.link_details")}),g("div",{className:"ShareDialog__picker__button",children:g(Ws,{size:"large",label:t("exportDialog.link_button"),icon:fb,onClick:async()=>{await e.onExportToBackend(),e.handleClose()}})})]})]})},WIe=e=>{const t=k0(iW);return g(Hr,{size:"small",onCloseRequest:e.handleClose,title:!1,children:g("div",{className:"ShareDialog",children:e.collabAPI&&t?g(jIe,{collabAPI:e.collabAPI,activeRoomLink:t,handleClose:e.handleClose}):g(YIe,{...e})})})},KIe=e=>{const[t,n]=ph(cW),{openDialog:i}=fi();return M.useEffect(()=>{i&&n({isOpen:!1})},[i,n]),t.isOpen?g(WIe,{handleClose:()=>n({isOpen:!1}),collabAPI:e.collabAPI,onExportToBackend:e.onExportToBackend,type:t.type}):null},LL=()=>{var e;return(e=window.matchMedia)==null?void 0:e.call(window,"(prefers-color-scheme: dark)")},ZIe=()=>{const[e,t]=M.useState(()=>localStorage.getItem(vn.LOCAL_STORAGE_THEME)||xe.LIGHT),[n,i]=M.useState(xe.LIGHT);return M.useEffect(()=>{const r=LL(),s=a=>{i(a.matches?xe.DARK:xe.LIGHT)};e==="system"&&(r==null||r.addEventListener("change",s));const o=a=>{!a[z.CTRL_OR_CMD]&&a.altKey&&a.shiftKey&&a.code===tt.D&&(a.preventDefault(),a.stopImmediatePropagation(),t(n===xe.DARK?xe.LIGHT:xe.DARK))};return document.addEventListener(te.KEYDOWN,o,{capture:!0}),()=>{r==null||r.removeEventListener("change",s),document.removeEventListener(te.KEYDOWN,o,{capture:!0})}},[e,n,t]),M.useLayoutEffect(()=>{var r;localStorage.setItem(vn.LOCAL_STORAGE_THEME,e),i(e==="system"?(r=LL())!=null&&r.matches?xe.DARK:xe.LIGHT:e)},[e]),{editorTheme:n,appTheme:e,setAppTheme:t}},qIe=({excalidrawAPI:e})=>P(he,{children:[g(Y5e,{generate:async({frame:t,children:n})=>{const i=e.getAppState(),r=await Rhe({elements:n,appState:{...i,exportBackground:!0,viewBackgroundColor:i.viewBackgroundColor},exportingFrame:t,files:e.getFiles(),mimeType:ye.jpg}),s=await yE(r),o=wH(n),a=await fetch("https://oss-ai.excalidraw.com/v1/ai/diagram-to-code/generate",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({texts:o,image:s,theme:i.theme})});if(!a.ok){const l=await a.text(),c=Lee(l);if(!c)throw new Error(l);if(c.statusCode===429)return{html:`<html>
                <body style="margin: 0; text-align: center">
                <div style="display: flex; align-items: center; justify-content: center; flex-direction: column; height: 100vh; padding: 0 60px">
                  <div style="color:red">Too many requests today,</br>please try again tomorrow!</div>
                  </br>
                  </br>
                  <div>You can also try <a href="https://plus.excalidraw.com/plus?utm_source=excalidraw&utm_medium=app&utm_content=d2c" target="_blank" rel="noreferrer noopener">kj-diagramming cloud</a> to get more requests.</div>
                </div>
                </body>
                </html>`};throw new Error(c.message||l)}try{const{html:l}=await a.json();if(!l)throw new Error("Generation failed (invalid response)");return{html:l}}catch{throw new Error("Generation failed (invalid response)")}}}),g(eX,{onTextSubmit:async t=>{try{const n=await fetch("https://oss-ai.excalidraw.com/v1/ai/text-to-diagram/generate",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({prompt:t})}),i=n.headers.has("X-Ratelimit-Limit")?parseInt(n.headers.get("X-Ratelimit-Limit")||"0",10):void 0,r=n.headers.has("X-Ratelimit-Remaining")?parseInt(n.headers.get("X-Ratelimit-Remaining")||"0",10):void 0,s=await n.json();if(!n.ok){if(n.status===429)return{rateLimit:i,rateLimitRemaining:r,error:new Error("Too many requests today, please try again tomorrow!")};throw new Error(s.message||"Generation failed...")}const o=s.generatedResponse;if(!o)throw new Error("Generation failed...");return{generatedResponse:o,rateLimit:i,rateLimitRemaining:r}}catch{throw new Error("Request failed")}}})]}),QIe="REQUEST_SCENE",AU="https://app.excalidraw.com",JIe=async({rawElementsString:e,rawAppStateString:t})=>{if(!e||!t)throw new Bs("Elements or appstate is missing.");try{const n=JSON.parse(e);if(!n.length)throw new Bs("Scene is empty, nothing to export.");const i=JSON.parse(t),r=n.reduce((o,a)=>("fileId"in a&&a.fileId&&o.push(a.fileId),o),[]),s=await pi.fileStorage.getFiles(r);return{type:"SCENE_DATA",elements:n,appState:i,files:s}}catch(n){throw n instanceof Bs?n:new Bs("Failed to parse scene data.")}},exe=async({token:e,publicKey:t})=>{try{const[n,i,r]=e.split(".");if(!n||!i||!r)throw new Bs("Invalid JWT format");const s=BC(i),o=BC(r),a=`${n}.${i}`,l=Uint8Array.from(o,p=>p.charCodeAt(0)),c=t.replace(/-----\w+ PUBLIC KEY-----/g,""),u=Uint8Array.from(atob(c),p=>p.charCodeAt(0)),d=await crypto.subtle.importKey("spki",u,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"]);if(!await crypto.subtle.verify("RSASSA-PKCS1-v1_5",d,l,new TextEncoder().encode(a)))throw new Error("Invalid JWT");const h=JSON.parse(s),m=Math.floor(Date.now()/1e3);if(h.exp&&h.exp<m)throw new Error("JWT has expired")}catch(n){throw console.error("Failed to verify JWT:",n),new Error(n instanceof Error?n.message:"Invalid JWT")}},txe=()=>{const e=M.useRef(!1);return M.useLayoutEffect(()=>{const t=async n=>{if(n.origin!==AU)throw new Bs("Invalid origin");if(n.data.type===QIe){if(!n.data.jwt)throw new Bs("JWT is missing");try{try{await exe({token:n.data.jwt,publicKey:`MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApQ0jM9Qz8TdFLzcuAZZX
/WvuKSOJxiw6AR/ZcE3eFQWM/mbFdhQgyK8eHGkKQifKzH1xUZjCxyXcxW6ZO02t
kPOPxhz+nxUrIoWCD/V4NGmUA1lxwHuO21HN1gzKrN3xHg5EGjyouR9vibT9VDGF
gq6+4Ic/kJX+AD2MM7Yre2+FsOdysrmuW2Fu3ahuC1uQE7pOe1j0k7auNP0y1q53
PrB8Ts2LUpepWC1l7zIXFm4ViDULuyWXTEpUcHSsEH8vpd1tckjypxCwkipfZsXx
iPszy0o0Dx2iArPfWMXlFAI9mvyFCyFC3+nSvfyAUb2C4uZgCwAuyFh/ydPF4DEE
PQIDAQAB`})}catch(r){throw console.error(`Failed to verify JWT: ${r.message}`),new Bs("Failed to verify JWT")}const i=await JIe({rawAppStateString:localStorage.getItem(vn.LOCAL_STORAGE_APP_STATE),rawElementsString:localStorage.getItem(vn.LOCAL_STORAGE_ELEMENTS)});n.source.postMessage(i,{targetOrigin:AU})}catch(i){const r={type:"ERROR",message:i instanceof Bs?i.message:"Failed to export scene data"};n.source.postMessage(r,{targetOrigin:AU})}}};if(window.addEventListener("message",t),!e.current){e.current=!0;const n={type:"READY"};window.parent.postMessage(n,AU)}return()=>{window.removeEventListener("message",t)}},[]),null};CO();window.EXCALIDRAW_THROTTLE_RENDER=!0;let pf=null;window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),pf=e});let uW=!1;if(window.self!==window.top)try{const e=new URL(document.referrer),t=new URL(window.location.href);e.origin===t.origin&&(uW=!0)}catch{}const DL={title:L("overwriteConfirm.modal.shareableLink.title"),description:g(gr,{i18nKey:"overwriteConfirm.modal.shareableLink.description",bold:e=>g("strong",{children:e}),br:()=>g("br",{})}),actionLabel:L("overwriteConfirm.modal.shareableLink.button"),color:"danger"},j4=async e=>{var c,u;const n=new URLSearchParams(window.location.search).get("id"),i=window.location.hash.match(/^#json=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/),r=window.location.hash.match(/^#url=(.*)$/),s=ZY();let o=await SL(null,null,s),a=FSe(window.location.href);const l=!!(n||i||a);if(l)if(!o.elements.length||a||await JE(DL))i&&(o=await SL(i[1],i[2],s)),o.scrollToContent=!0,a||window.history.replaceState({},Ra,window.location.origin);else{if(document.hidden)return new Promise((d,f)=>{window.addEventListener("focus",()=>j4(e).then(d).catch(f),{once:!0})});a=null,window.history.replaceState({},Ra,window.location.origin)}else if(r){window.history.replaceState({},Ra,window.location.origin);const d=r[1];try{const f=await fetch(window.decodeURIComponent(d)),h=await G9(await f.blob(),null,null);if(!o.elements.length||await JE(DL))return{scene:h,isExternalScene:l}}catch{return{scene:{appState:{errorMessage:L("alerts.invalidSceneUrl")}},isExternalScene:l}}}if(a&&e.collabAPI){const{excalidrawAPI:d}=e,f=await e.collabAPI.startCollaboration(a);return{scene:{...f,appState:{...wz({...f==null?void 0:f.appState,theme:((c=s==null?void 0:s.appState)==null?void 0:c.theme)||((u=f==null?void 0:f.appState)==null?void 0:u.theme)},d.getAppState()),isLoading:!1},elements:ew((f==null?void 0:f.elements)||[],d.getSceneElementsIncludingDeleted(),d.getAppState())},isExternalScene:!0,id:a.roomId,key:a.roomKey}}else if(o)return l&&i?{scene:o,isExternalScene:l,id:i[1],key:i[2]}:{scene:o,isExternalScene:!1};return{scene:null,isExternalScene:!1}},nxe=()=>{const[e,t]=M.useState(""),n=Aee(),{editorTheme:i,appTheme:r,setAppTheme:s}=ZIe(),[o,a]=AIe(),l=M.useRef({promise:null});l.current.promise||(l.current.promise=$6());const c=M.useRef(null);M.useEffect(()=>{ut("load","frame",Bm()),setTimeout(()=>{ut("load","version",Z3())},SQ)},[]);const[u,d]=VP(),[,f]=ph(cW),[h]=ph(tW),[m]=sIe(G4,()=>TL(window.location.href)),p=k0($4);_2e({excalidrawAPI:u,adapter:y6,migrationAdapter:rIe});const[,b]=M.useState(!1);M.useEffect(()=>{},[u]),M.useEffect(()=>{if(!u||!n&&!h)return;const S=(H,$=!1)=>{var j;if(H.scene)if(h!=null&&h.isCollaborating())H.scene.elements&&h.fetchImageFilesFromFirebase({elements:H.scene.elements,forceFetchFiles:!0}).then(({loadedFiles:X,erroredFiles:Y})=>{u.addFiles(X),Eg({excalidrawAPI:u,erroredFiles:Y,elements:u.getSceneElementsIncludingDeleted()})});else{const X=((j=H.scene.elements)==null?void 0:j.reduce((Y,le)=>xn(le)?Y.concat(le.fileId):Y,[]))||[];H.isExternalScene?jY(`${YX.shareLinkFiles}/${H.id}`,H.key,X).then(({loadedFiles:Y,erroredFiles:le})=>{u.addFiles(Y),Eg({excalidrawAPI:u,erroredFiles:le,elements:u.getSceneElementsIncludingDeleted()})}):$&&(X.length&&pi.fileStorage.getFiles(X).then(({loadedFiles:Y,erroredFiles:le})=>{Y.length&&u.addFiles(Y),Eg({excalidrawAPI:u,erroredFiles:le,elements:u.getSceneElementsIncludingDeleted()})}),pi.fileStorage.clearObsoleteFiles({currentFileIds:X}))}};j4({collabAPI:h,excalidrawAPI:u}).then(async H=>{S(H,!0),l.current.promise.resolve(H.scene)});const k=async H=>{H.preventDefault(),jE()||(h!=null&&h.isCollaborating()&&!TL(window.location.href)&&h.stopCollaboration(!1),u.updateScene({appState:{isLoading:!0}}),j4({collabAPI:h,excalidrawAPI:u}).then(j=>{S(j),j.scene&&u.updateScene({...j.scene,...rd(j.scene,null,null,{repairBindings:!0}),captureUpdate:Z.IMMEDIATELY})}))},N=setTimeout(()=>document.title=Ra,TQ),D=Ga(()=>{if(!document.hidden&&(h&&!h.isCollaborating()||n)){if(IL(vn.VERSION_DATA_STATE)){const H=ZY(),$=KY();a(oW()),u.updateScene({...H,captureUpdate:Z.NEVER}),y6.load().then(j=>{j&&u.updateLibrary({libraryItems:j.libraryItems})}),h==null||h.setUsername($||"")}if(IL(vn.VERSION_FILES)){const H=u.getSceneElementsIncludingDeleted(),$=u.getFiles(),j=(H==null?void 0:H.reduce((X,Y)=>xn(Y)&&!$[Y.fileId]?X.concat(Y.fileId):X,[]))||[];j.length&&pi.fileStorage.getFiles(j).then(({loadedFiles:X,erroredFiles:Y})=>{X.length&&u.addFiles(X),Eg({excalidrawAPI:u,erroredFiles:Y,elements:u.getSceneElementsIncludingDeleted()})})}}},A4e),G=()=>{pi.flushSave()},V=H=>{(H.type===te.BLUR||document.hidden)&&pi.flushSave(),(H.type===te.VISIBILITY_CHANGE||H.type===te.FOCUS)&&D()};return window.addEventListener(te.HASHCHANGE,k,!1),window.addEventListener(te.UNLOAD,G,!1),window.addEventListener(te.BLUR,V,!1),document.addEventListener(te.VISIBILITY_CHANGE,V,!1),window.addEventListener(te.FOCUS,V,!1),()=>{window.removeEventListener(te.HASHCHANGE,k,!1),window.removeEventListener(te.UNLOAD,G,!1),window.removeEventListener(te.BLUR,V,!1),window.removeEventListener(te.FOCUS,V,!1),document.removeEventListener(te.VISIBILITY_CHANGE,V,!1),clearTimeout(N)}},[n,h,u,a]),M.useEffect(()=>{const S=k=>{pi.flushSave(),u&&pi.fileStorage.shouldPreventUnload(u.getSceneElements())&&o9(k)};return window.addEventListener(te.BEFORE_UNLOAD,S),()=>{window.removeEventListener(te.BEFORE_UNLOAD,S)}},[u]);const E=(S,k,N)=>{h!=null&&h.isCollaborating()&&h.syncElements(S),pi.isSavePaused()||pi.save(S,k,N,()=>{if(u){let D=!1;const G=u.getSceneElementsIncludingDeleted().map(V=>{if(pi.fileStorage.shouldUpdateImageElementStatus(V)){const H=Ce(V,{status:"saved"});return H!==V&&(D=!0),H}return V});D&&u.updateScene({elements:G,captureUpdate:Z.NEVER})}}),c.current&&u&&OIe(c.current,k,window.devicePixelRatio,()=>b(D=>!D))},[y,v]=M.useState(null),_=async(S,k,N)=>{if(S.length===0)throw new Error(L("alerts.cannotExportEmptyCanvas"));try{const{url:D,errorMessage:G}=await $Se(S,{...k,viewBackgroundColor:k.exportBackground?k.viewBackgroundColor:gs().viewBackgroundColor},N);if(G)throw new Error(G);D&&v(D)}catch(D){if(D.name!=="AbortError"){const{width:G,height:V}=k;throw console.error(D,{width:G,height:V,devicePixelRatio:window.devicePixelRatio}),new Error(D.message)}}},I=(S,k)=>g(lIe,{setToast:N=>u.setToast({message:N}),appState:k,elements:S}),R=k0(nW),w=M.useCallback(()=>f({isOpen:!0,type:"collaborationOnly"}),[f]);if(uW)return g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",height:"100%"},children:g("h1",{children:"I'm not a pretzel!"})});const T={label:"kj-diagramming cloud",category:mt.links,predicate:!0,icon:g("div",{style:{width:14},children:tE}),keywords:["plus","cloud","server"],perform:()=>{window.open("https://plus.excalidraw.com/plus?utm_source=excalidraw&utm_medium=app&utm_content=command_palette","_blank")}},A={label:"Sign up",category:mt.links,predicate:!0,icon:g("div",{style:{width:14},children:tE}),keywords:["diagramming","plus","cloud","server","signin","login","signup"],perform:()=>{window.open("https://app.excalidraw.com?utm_source=excalidraw&utm_medium=app&utm_content=command_palette","_blank")}};return g("div",{style:{height:"100%"},className:me("excalidraw-app",{"is-collaborating":m}),children:P(XG,{excalidrawAPI:d,onChange:E,initialData:l.current.promise,isCollaborating:m,onPointerUpdate:h==null?void 0:h.onPointerUpdate,UIOptions:{canvasActions:{toggleTheme:!0,export:{onExportToBackend:_,renderCustomUI:u?(S,k,N)=>g(uIe,{elements:S,appState:k,files:N,name:u.getName(),onError:D=>{u==null||u.updateScene({appState:{errorMessage:D.message}})},onSuccess:()=>{u.updateScene({appState:{openDialog:null}})}}):void 0}}},langCode:o,renderCustomStats:I,detectScroll:!1,handleKeyboardGlobally:!0,autoFocus:!0,theme:i,renderTopRightUI:S=>S||!h||n?null:P("div",{className:"top-right-ui",children:[p.message&&g(eW,{collabError:p}),g($G,{isCollaborating:m,onSelect:()=>f({isOpen:!0,type:"share"})})]}),onLinkOpen:(S,k)=>{S.link&&Zf(S.link)&&(k.preventDefault(),u==null||u.scrollToContent(S.link,{animate:!0}))},children:[g(BIe,{onCollabDialogOpen:w,isCollaborating:m,isCollabEnabled:!n,theme:r,setTheme:S=>s(S),refresh:()=>b(S=>!S)}),g(zIe,{onCollabDialogOpen:w,isCollabEnabled:!n}),P(Tu,{children:[g(Tu.Actions.ExportToImage,{}),g(Tu.Actions.SaveToDisk,{}),u&&g(Tu.Action,{title:L("overwriteConfirm.action.excalidrawPlus.title"),actionLabel:L("overwriteConfirm.action.excalidrawPlus.button"),onClick:()=>{X4(u.getSceneElements(),u.getAppState(),u.getFiles(),u.getName())},children:L("overwriteConfirm.action.excalidrawPlus.description")})]}),g($Ie,{onChange:()=>u==null?void 0:u.refresh()}),u&&g(qIe,{excalidrawAPI:u}),g(GG,{}),m&&R&&g("div",{className:"collab-offline-warning",children:L("alerts.collabOfflineWarning")}),y&&g(GIe,{link:y,onCloseRequest:()=>v(null),setErrorMessage:t}),u&&!n&&g(oIe,{excalidrawAPI:u}),g(KIe,{collabAPI:h,onExportToBackend:async()=>{if(u)try{await _(u.getSceneElements(),u.getAppState(),u.getFiles())}catch(S){t(S.message)}}}),e&&g(dw,{onClose:()=>t(""),children:e}),g(FM,{customCommandPaletteItems:[{label:L("labels.liveCollaboration"),category:mt.app,keywords:["team","multiplayer","share","public","session","invite"],icon:E9,perform:()=>{f({isOpen:!0,type:"collaborationOnly"})}},{label:L("roomDialog.button_stopSession"),category:mt.app,predicate:()=>!!(h!=null&&h.isCollaborating()),keywords:["stop","session","end","leave","close","exit","collaboration"],perform:()=>{h&&(h.stopCollaboration(),h.isCollaborating()||f({isOpen:!1}))}},{label:L("labels.share"),category:mt.app,predicate:!0,icon:y9,keywords:["link","shareable","readonly","export","publish","snapshot","url","collaborate","invite"],perform:async()=>{f({isOpen:!0,type:"share"})}},{label:"GitHub",icon:U9,category:mt.links,predicate:!0,keywords:["issues","bugs","requests","report","features","social","community"],perform:()=>{window.open("https://github.com/excalidraw/excalidraw","_blank","noopener noreferrer")}},{label:L("labels.followUs"),icon:PF,category:mt.links,predicate:!0,keywords:["twitter","contact","social","community"],perform:()=>{window.open("https://x.com/excalidraw","_blank","noopener noreferrer")}},{label:L("labels.discordChat"),category:mt.links,predicate:!0,icon:OF,keywords:["chat","talk","contact","bugs","requests","report","feedback","suggestions","social","community"],perform:()=>{window.open("https://discord.gg/UexuTaE","_blank","noopener noreferrer")}},{label:"YouTube",icon:qF,category:mt.links,predicate:!0,keywords:["features","tutorials","howto","help","community"],perform:()=>{window.open("https://youtube.com/@excalidraw","_blank","noopener noreferrer")}},...pd?[{...A,label:"Sign in / Go to kj-diagramming cloud"}]:[T,A],{label:L("overwriteConfirm.action.excalidrawPlus.button"),category:mt.export,icon:rne,predicate:!0,keywords:["plus","export","save","backup"],perform:()=>{u&&X4(u.getSceneElements(),u.getAppState(),u.getFiles(),u.getName())}},{...FM.defaultItems.toggleTheme,perform:()=>{s(i===xe.DARK?xe.LIGHT:xe.DARK)}},{label:L("labels.installPWA"),category:mt.app,predicate:()=>!!pf,perform:()=>{pf&&(pf.prompt(),pf.userChoice.then(()=>{pf=null}))}}]}),lW()&&u&&g(FIe,{appState:u.getAppState(),scale:window.devicePixelRatio,ref:c})]})})},ixe=()=>window.location.pathname==="/excalidraw-plus-export"?g(txe,{}):g(T4e,{children:g(eJ,{store:wl,children:g(nxe,{})})});function rxe(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:s,onRegisterError:o}=e;let a,l;const c=async(d=!0)=>{await l};async function u(){if("serviceWorker"in navigator){if(a=await be(()=>import("./workbox-window.prod.es5-B9K5rw8f.js"),__vite__mapDeps([])).then(({Workbox:d})=>new d("/sw.js",{scope:"/",type:"classic"})).catch(d=>{o==null||o(d)}),!a)return;a.addEventListener("activated",d=>{(d.isUpdate||d.isExternal)&&window.location.reload()}),a.addEventListener("installed",d=>{d.isUpdate||i==null||i()}),a.register({immediate:t}).then(d=>{s?s("/sw.js",d):r==null||r(d)}).catch(d=>{o==null||o(d)})}}return l=u(),c}function sxe(){const e=Error.prepareStackTrace;try{let t=[];return Error.prepareStackTrace=(n,i)=>{const r=i.slice(1);return t=r,r},new Error().stack,t}finally{Error.prepareStackTrace=e}}var oxe={};w4e({dsn:void 0,environment:void 0,release:oxe.VITE_APP_GIT_SHA,ignoreErrors:["undefined is not an object (evaluating 'window.__pad.performLoop')","InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.",/(Failed to fetch|(fetch|loading) dynamically imported module)/i,/QuotaExceededError: (The quota has been exceeded|.*setItem.*Storage)/i,"Internal error opening backing store for indexedDB.open"],integrations:[H3e({levels:["error"]})],beforeSend(e){var t;return(t=e.request)!=null&&t.url&&(e.request.url=e.request.url.replace(/#.*$/,"")),e.exception||(e.exception={values:[{type:"ConsoleError",value:e.message??"Unknown error",stacktrace:{frames:sxe().slice(1).filter(n=>{var i;return n.getFileName()&&!((i=n.getFileName())!=null&&i.includes("@sentry_browser.js"))}).map(n=>{var i;return{filename:n.getFileName()??void 0,function:n.getFunctionName()??void 0,in_app:!(((i=n.getFileName())==null?void 0:i.includes("node_modules"))??!1),lineno:n.getLineNumber()??void 0,colno:n.getColumnNumber()??void 0}})},mechanism:{type:"instrument",handled:!0,data:{function:"console.error",handler:"Sentry.beforeSend"}}}]}),e}});var axe={};window.__EXCALIDRAW_SHA__=axe.VITE_APP_GIT_SHA;const lxe=document.getElementById("root"),cxe=Pq.createRoot(lxe);rxe();cxe.render(g(M.StrictMode,{children:g(ixe,{})}));export{be as _,dxe as a,va as c,sl as g};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = ["assets/subset-worker.chunk-I0N5k6B_.js","assets/subset-shared.chunk-D4cgYcOB.js"]
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
