polotno-node 2.15.7 → 2.15.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,444 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();const B6="modulepreload",z6=function(t,e){return new URL(t,e).href},jb={},Kx=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){let f=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const o=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),u=s?.nonce||s?.getAttribute("nonce");i=f(r.map(d=>{if(d=z6(d,n),d in jb)return;jb[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(n)for(let v=o.length-1;v>=0;v--){const b=o[v];if(b.href===d&&(!h||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${p}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":B6,h||(y.as="script"),y.crossOrigin="",y.href=d,u&&y.setAttribute("nonce",u),document.head.appendChild(y),h)return new Promise((v,b)=>{y.addEventListener("load",v),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&a(s.reason);return e().catch(a)})};var Tg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ec(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function j6(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var h1={exports:{}},Ht={};var Ub;function U6(){if(Ub)return Ht;Ub=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.iterator;function p(D){return D===null||typeof D!="object"?null:(D=h&&D[h]||D["@@iterator"],typeof D=="function"?D:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function x(D,W,V){this.props=D,this.context=W,this.refs=b,this.updater=V||y}x.prototype.isReactComponent={},x.prototype.setState=function(D,W){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,W,"setState")},x.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function k(){}k.prototype=x.prototype;function S(D,W,V){this.props=D,this.context=W,this.refs=b,this.updater=V||y}var P=S.prototype=new k;P.constructor=S,v(P,x.prototype),P.isPureReactComponent=!0;var _=Array.isArray,E=Object.prototype.hasOwnProperty,A={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function I(D,W,V){var ee,te={},Q=null,ne=null;if(W!=null)for(ee in W.ref!==void 0&&(ne=W.ref),W.key!==void 0&&(Q=""+W.key),W)E.call(W,ee)&&!T.hasOwnProperty(ee)&&(te[ee]=W[ee]);var ue=arguments.length-2;if(ue===1)te.children=V;else if(1<ue){for(var oe=Array(ue),de=0;de<ue;de++)oe[de]=arguments[de+2];te.children=oe}if(D&&D.defaultProps)for(ee in ue=D.defaultProps,ue)te[ee]===void 0&&(te[ee]=ue[ee]);return{$$typeof:t,type:D,key:Q,ref:ne,props:te,_owner:A.current}}function L(D,W){return{$$typeof:t,type:D.type,key:W,ref:D.ref,props:D.props,_owner:D._owner}}function R(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function N(D){var W={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(V){return W[V]})}var F=/\/+/g;function H(D,W){return typeof D=="object"&&D!==null&&D.key!=null?N(""+D.key):W.toString(36)}function $(D,W,V,ee,te){var Q=typeof D;(Q==="undefined"||Q==="boolean")&&(D=null);var ne=!1;if(D===null)ne=!0;else switch(Q){case"string":case"number":ne=!0;break;case"object":switch(D.$$typeof){case t:case e:ne=!0}}if(ne)return ne=D,te=te(ne),D=ee===""?"."+H(ne,0):ee,_(te)?(V="",D!=null&&(V=D.replace(F,"$&/")+"/"),$(te,W,V,"",function(de){return de})):te!=null&&(R(te)&&(te=L(te,V+(!te.key||ne&&ne.key===te.key?"":(""+te.key).replace(F,"$&/")+"/")+D)),W.push(te)),1;if(ne=0,ee=ee===""?".":ee+":",_(D))for(var ue=0;ue<D.length;ue++){Q=D[ue];var oe=ee+H(Q,ue);ne+=$(Q,W,V,oe,te)}else if(oe=p(D),typeof oe=="function")for(D=oe.call(D),ue=0;!(Q=D.next()).done;)Q=Q.value,oe=ee+H(Q,ue++),ne+=$(Q,W,V,oe,te);else if(Q==="object")throw W=String(D),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.");return ne}function X(D,W,V){if(D==null)return D;var ee=[],te=0;return $(D,ee,"","",function(Q){return W.call(V,Q,te++)}),ee}function Z(D){if(D._status===-1){var W=D._result;W=W(),W.then(function(V){(D._status===0||D._status===-1)&&(D._status=1,D._result=V)},function(V){(D._status===0||D._status===-1)&&(D._status=2,D._result=V)}),D._status===-1&&(D._status=0,D._result=W)}if(D._status===1)return D._result.default;throw D._result}var K={current:null},q={transition:null},J={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:q,ReactCurrentOwner:A};function U(){throw Error("act(...) is not supported in production builds of React.")}return Ht.Children={map:X,forEach:function(D,W,V){X(D,function(){W.apply(this,arguments)},V)},count:function(D){var W=0;return X(D,function(){W++}),W},toArray:function(D){return X(D,function(W){return W})||[]},only:function(D){if(!R(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},Ht.Component=x,Ht.Fragment=r,Ht.Profiler=i,Ht.PureComponent=S,Ht.StrictMode=n,Ht.Suspense=u,Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,Ht.act=U,Ht.cloneElement=function(D,W,V){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var ee=v({},D.props),te=D.key,Q=D.ref,ne=D._owner;if(W!=null){if(W.ref!==void 0&&(Q=W.ref,ne=A.current),W.key!==void 0&&(te=""+W.key),D.type&&D.type.defaultProps)var ue=D.type.defaultProps;for(oe in W)E.call(W,oe)&&!T.hasOwnProperty(oe)&&(ee[oe]=W[oe]===void 0&&ue!==void 0?ue[oe]:W[oe])}var oe=arguments.length-2;if(oe===1)ee.children=V;else if(1<oe){ue=Array(oe);for(var de=0;de<oe;de++)ue[de]=arguments[de+2];ee.children=ue}return{$$typeof:t,type:D.type,key:te,ref:Q,props:ee,_owner:ne}},Ht.createContext=function(D){return D={$$typeof:o,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:a,_context:D},D.Consumer=D},Ht.createElement=I,Ht.createFactory=function(D){var W=I.bind(null,D);return W.type=D,W},Ht.createRef=function(){return{current:null}},Ht.forwardRef=function(D){return{$$typeof:s,render:D}},Ht.isValidElement=R,Ht.lazy=function(D){return{$$typeof:d,_payload:{_status:-1,_result:D},_init:Z}},Ht.memo=function(D,W){return{$$typeof:f,type:D,compare:W===void 0?null:W}},Ht.startTransition=function(D){var W=q.transition;q.transition={};try{D()}finally{q.transition=W}},Ht.unstable_act=U,Ht.useCallback=function(D,W){return K.current.useCallback(D,W)},Ht.useContext=function(D){return K.current.useContext(D)},Ht.useDebugValue=function(){},Ht.useDeferredValue=function(D){return K.current.useDeferredValue(D)},Ht.useEffect=function(D,W){return K.current.useEffect(D,W)},Ht.useId=function(){return K.current.useId()},Ht.useImperativeHandle=function(D,W,V){return K.current.useImperativeHandle(D,W,V)},Ht.useInsertionEffect=function(D,W){return K.current.useInsertionEffect(D,W)},Ht.useLayoutEffect=function(D,W){return K.current.useLayoutEffect(D,W)},Ht.useMemo=function(D,W){return K.current.useMemo(D,W)},Ht.useReducer=function(D,W,V){return K.current.useReducer(D,W,V)},Ht.useRef=function(D){return K.current.useRef(D)},Ht.useState=function(D){return K.current.useState(D)},Ht.useSyncExternalStore=function(D,W,V){return K.current.useSyncExternalStore(D,W,V)},Ht.useTransition=function(){return K.current.useTransition()},Ht.version="18.3.1",Ht}var Hb;function Ap(){return Hb||(Hb=1,h1.exports=U6()),h1.exports}var Hr=Ap();const Y=Ec(Hr);var Gm={},p1={exports:{}},Mi={},m1={exports:{}},g1={};var $b;function H6(){return $b||($b=1,(function(t){function e(q,J){var U=q.length;q.push(J);e:for(;0<U;){var D=U-1>>>1,W=q[D];if(0<i(W,J))q[D]=J,q[U]=W,U=D;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var J=q[0],U=q.pop();if(U!==J){q[0]=U;e:for(var D=0,W=q.length,V=W>>>1;D<V;){var ee=2*(D+1)-1,te=q[ee],Q=ee+1,ne=q[Q];if(0>i(te,U))Q<W&&0>i(ne,te)?(q[D]=ne,q[Q]=U,D=Q):(q[D]=te,q[ee]=U,D=ee);else if(Q<W&&0>i(ne,U))q[D]=ne,q[Q]=U,D=Q;else break e}}return J}function i(q,J){var U=q.sortIndex-J.sortIndex;return U!==0?U:q.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();t.unstable_now=function(){return o.now()-s}}var u=[],f=[],d=1,h=null,p=3,y=!1,v=!1,b=!1,x=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(q){for(var J=r(f);J!==null;){if(J.callback===null)n(f);else if(J.startTime<=q)n(f),J.sortIndex=J.expirationTime,e(u,J);else break;J=r(f)}}function _(q){if(b=!1,P(q),!v)if(r(u)!==null)v=!0,Z(E);else{var J=r(f);J!==null&&K(_,J.startTime-q)}}function E(q,J){v=!1,b&&(b=!1,k(I),I=-1),y=!0;var U=p;try{for(P(J),h=r(u);h!==null&&(!(h.expirationTime>J)||q&&!N());){var D=h.callback;if(typeof D=="function"){h.callback=null,p=h.priorityLevel;var W=D(h.expirationTime<=J);J=t.unstable_now(),typeof W=="function"?h.callback=W:h===r(u)&&n(u),P(J)}else n(u);h=r(u)}if(h!==null)var V=!0;else{var ee=r(f);ee!==null&&K(_,ee.startTime-J),V=!1}return V}finally{h=null,p=U,y=!1}}var A=!1,T=null,I=-1,L=5,R=-1;function N(){return!(t.unstable_now()-R<L)}function F(){if(T!==null){var q=t.unstable_now();R=q;var J=!0;try{J=T(!0,q)}finally{J?H():(A=!1,T=null)}}else A=!1}var H;if(typeof S=="function")H=function(){S(F)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,X=$.port2;$.port1.onmessage=F,H=function(){X.postMessage(null)}}else H=function(){x(F,0)};function Z(q){T=q,A||(A=!0,H())}function K(q,J){I=x(function(){q(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(q){q.callback=null},t.unstable_continueExecution=function(){v||y||(v=!0,Z(E))},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(u)},t.unstable_next=function(q){switch(p){case 1:case 2:case 3:var J=3;break;default:J=p}var U=p;p=J;try{return q()}finally{p=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(q,J){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var U=p;p=q;try{return J()}finally{p=U}},t.unstable_scheduleCallback=function(q,J,U){var D=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?D+U:D):U=D,q){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=U+W,q={id:d++,callback:J,priorityLevel:q,startTime:U,expirationTime:W,sortIndex:-1},U>D?(q.sortIndex=U,e(f,q),r(u)===null&&q===r(f)&&(b?(k(I),I=-1):b=!0,K(_,U-D))):(q.sortIndex=W,e(u,q),v||y||(v=!0,Z(E))),q},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(q){var J=p;return function(){var U=p;p=J;try{return q.apply(this,arguments)}finally{p=U}}}})(g1)),g1}var qb;function f2(){return qb||(qb=1,m1.exports=H6()),m1.exports}var Vb;function $6(){if(Vb)return Mi;Vb=1;var t=Ap(),e=f2();function r(l){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+l,w=1;w<arguments.length;w++)c+="&args[]="+encodeURIComponent(arguments[w]);return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,i={};function a(l,c){o(l,c),o(l+"Capture",c)}function o(l,c){for(i[l]=c,l=0;l<c.length;l++)n.add(c[l])}var s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,f=/^[: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]*$/,d={},h={};function p(l){return u.call(h,l)?!0:u.call(d,l)?!1:f.test(l)?h[l]=!0:(d[l]=!0,!1)}function y(l,c,w,O){if(w!==null&&w.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return O?!1:w!==null?!w.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,c,w,O){if(c===null||typeof c>"u"||y(l,c,w,O))return!0;if(O)return!1;if(w!==null)switch(w.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function b(l,c,w,O,B,j,re){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=O,this.attributeNamespace=B,this.mustUseProperty=w,this.propertyName=l,this.type=c,this.sanitizeURL=j,this.removeEmptyString=re}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){x[l]=new b(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var c=l[0];x[c]=new b(c,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){x[l]=new b(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){x[l]=new b(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){x[l]=new b(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){x[l]=new b(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){x[l]=new b(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){x[l]=new b(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){x[l]=new b(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function S(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var c=l.replace(k,S);x[c]=new b(c,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var c=l.replace(k,S);x[c]=new b(c,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var c=l.replace(k,S);x[c]=new b(c,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){x[l]=new b(l,1,!1,l.toLowerCase(),null,!1,!1)}),x.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){x[l]=new b(l,1,!1,l.toLowerCase(),null,!0,!0)});function P(l,c,w,O){var B=x.hasOwnProperty(c)?x[c]:null;(B!==null?B.type!==0:O||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,w,B,O)&&(w=null),O||B===null?p(c)&&(w===null?l.removeAttribute(c):l.setAttribute(c,""+w)):B.mustUseProperty?l[B.propertyName]=w===null?B.type===3?!1:"":w:(c=B.attributeName,O=B.attributeNamespace,w===null?l.removeAttribute(c):(B=B.type,w=B===3||B===4&&w===!0?"":""+w,O?l.setAttributeNS(O,c,w):l.setAttribute(c,w))))}var _=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),A=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),N=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),q=Symbol.iterator;function J(l){return l===null||typeof l!="object"?null:(l=q&&l[q]||l["@@iterator"],typeof l=="function"?l:null)}var U=Object.assign,D;function W(l){if(D===void 0)try{throw Error()}catch(w){var c=w.stack.trim().match(/\n( *(at )?)/);D=c&&c[1]||""}return`
2
+ `+D+l}var V=!1;function ee(l,c){if(!l||V)return"";V=!0;var w=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(De){var O=De}Reflect.construct(l,[],c)}else{try{c.call()}catch(De){O=De}l.call(c.prototype)}else{try{throw Error()}catch(De){O=De}l()}}catch(De){if(De&&O&&typeof De.stack=="string"){for(var B=De.stack.split(`
3
+ `),j=O.stack.split(`
4
+ `),re=B.length-1,ce=j.length-1;1<=re&&0<=ce&&B[re]!==j[ce];)ce--;for(;1<=re&&0<=ce;re--,ce--)if(B[re]!==j[ce]){if(re!==1||ce!==1)do if(re--,ce--,0>ce||B[re]!==j[ce]){var ye=`
5
+ `+B[re].replace(" at new "," at ");return l.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",l.displayName)),ye}while(1<=re&&0<=ce);break}}}finally{V=!1,Error.prepareStackTrace=w}return(l=l?l.displayName||l.name:"")?W(l):""}function te(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=ee(l.type,!1),l;case 11:return l=ee(l.type.render,!1),l;case 1:return l=ee(l.type,!0),l;default:return""}}function Q(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case T:return"Fragment";case A:return"Portal";case L:return"Profiler";case I:return"StrictMode";case H:return"Suspense";case $:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case N:return(l.displayName||"Context")+".Consumer";case R:return(l._context.displayName||"Context")+".Provider";case F:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case X:return c=l.displayName||null,c!==null?c:Q(l.type)||"Memo";case Z:c=l._payload,l=l._init;try{return Q(l(c))}catch{}}return null}function ne(l){var c=l.type;switch(l.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=c.render,l=l.displayName||l.name||"",c.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(c);case 8:return c===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ue(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function oe(l){var c=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function de(l){var c=oe(l)?"checked":"value",w=Object.getOwnPropertyDescriptor(l.constructor.prototype,c),O=""+l[c];if(!l.hasOwnProperty(c)&&typeof w<"u"&&typeof w.get=="function"&&typeof w.set=="function"){var B=w.get,j=w.set;return Object.defineProperty(l,c,{configurable:!0,get:function(){return B.call(this)},set:function(re){O=""+re,j.call(this,re)}}),Object.defineProperty(l,c,{enumerable:w.enumerable}),{getValue:function(){return O},setValue:function(re){O=""+re},stopTracking:function(){l._valueTracker=null,delete l[c]}}}}function Ee(l){l._valueTracker||(l._valueTracker=de(l))}function Fe(l){if(!l)return!1;var c=l._valueTracker;if(!c)return!0;var w=c.getValue(),O="";return l&&(O=oe(l)?l.checked?"true":"false":l.value),l=O,l!==w?(c.setValue(l),!0):!1}function Le(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function $e(l,c){var w=c.checked;return U({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:w??l._wrapperState.initialChecked})}function Xe(l,c){var w=c.defaultValue==null?"":c.defaultValue,O=c.checked!=null?c.checked:c.defaultChecked;w=ue(c.value!=null?c.value:w),l._wrapperState={initialChecked:O,initialValue:w,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function dt(l,c){c=c.checked,c!=null&&P(l,"checked",c,!1)}function ke(l,c){dt(l,c);var w=ue(c.value),O=c.type;if(w!=null)O==="number"?(w===0&&l.value===""||l.value!=w)&&(l.value=""+w):l.value!==""+w&&(l.value=""+w);else if(O==="submit"||O==="reset"){l.removeAttribute("value");return}c.hasOwnProperty("value")?se(l,c.type,w):c.hasOwnProperty("defaultValue")&&se(l,c.type,ue(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(l.defaultChecked=!!c.defaultChecked)}function ge(l,c,w){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var O=c.type;if(!(O!=="submit"&&O!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+l._wrapperState.initialValue,w||c===l.value||(l.value=c),l.defaultValue=c}w=l.name,w!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,w!==""&&(l.name=w)}function se(l,c,w){(c!=="number"||Le(l.ownerDocument)!==l)&&(w==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+w&&(l.defaultValue=""+w))}var me=Array.isArray;function Te(l,c,w,O){if(l=l.options,c){c={};for(var B=0;B<w.length;B++)c["$"+w[B]]=!0;for(w=0;w<l.length;w++)B=c.hasOwnProperty("$"+l[w].value),l[w].selected!==B&&(l[w].selected=B),B&&O&&(l[w].defaultSelected=!0)}else{for(w=""+ue(w),c=null,B=0;B<l.length;B++){if(l[B].value===w){l[B].selected=!0,O&&(l[B].defaultSelected=!0);return}c!==null||l[B].disabled||(c=l[B])}c!==null&&(c.selected=!0)}}function ae(l,c){if(c.dangerouslySetInnerHTML!=null)throw Error(r(91));return U({},c,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function xe(l,c){var w=c.value;if(w==null){if(w=c.children,c=c.defaultValue,w!=null){if(c!=null)throw Error(r(92));if(me(w)){if(1<w.length)throw Error(r(93));w=w[0]}c=w}c==null&&(c=""),w=c}l._wrapperState={initialValue:ue(w)}}function Oe(l,c){var w=ue(c.value),O=ue(c.defaultValue);w!=null&&(w=""+w,w!==l.value&&(l.value=w),c.defaultValue==null&&l.defaultValue!==w&&(l.defaultValue=w)),O!=null&&(l.defaultValue=""+O)}function Be(l){var c=l.textContent;c===l._wrapperState.initialValue&&c!==""&&c!==null&&(l.value=c)}function ct(l){switch(l){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function be(l,c){return l==null||l==="http://www.w3.org/1999/xhtml"?ct(c):l==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var he,Ve=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,w,O,B){MSApp.execUnsafeLocalFunction(function(){return l(c,w,O,B)})}:l})(function(l,c){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=c;else{for(he=he||document.createElement("div"),he.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=he.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;c.firstChild;)l.appendChild(c.firstChild)}});function le(l,c){if(c){var w=l.firstChild;if(w&&w===l.lastChild&&w.nodeType===3){w.nodeValue=c;return}}l.textContent=c}var Ie={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ye=["Webkit","ms","Moz","O"];Object.keys(Ie).forEach(function(l){Ye.forEach(function(c){c=c+l.charAt(0).toUpperCase()+l.substring(1),Ie[c]=Ie[l]})});function at(l,c,w){return c==null||typeof c=="boolean"||c===""?"":w||typeof c!="number"||c===0||Ie.hasOwnProperty(l)&&Ie[l]?(""+c).trim():c+"px"}function Ze(l,c){l=l.style;for(var w in c)if(c.hasOwnProperty(w)){var O=w.indexOf("--")===0,B=at(w,c[w],O);w==="float"&&(w="cssFloat"),O?l.setProperty(w,B):l[w]=B}}var ht=U({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(l,c){if(c){if(ht[l]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(r(137,l));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(r(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(r(61))}if(c.style!=null&&typeof c.style!="object")throw Error(r(62))}}function Ce(l,c){if(l.indexOf("-")===-1)return typeof c.is=="string";switch(l){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 Pt=null;function Ot(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Et=null,pt=null,Bt=null;function Br(l){if(l=Uu(l)){if(typeof Et!="function")throw Error(r(280));var c=l.stateNode;c&&(c=cn(c),Et(l.stateNode,l.type,c))}}function Yt(l){pt?Bt?Bt.push(l):Bt=[l]:pt=l}function dr(){if(pt){var l=pt,c=Bt;if(Bt=pt=null,Br(l),c)for(l=0;l<c.length;l++)Br(c[l])}}function on(l,c){return l(c)}function Vr(){}var yr=!1;function Hi(l,c,w){if(yr)return l(c,w);yr=!0;try{return on(l,c,w)}finally{yr=!1,(pt!==null||Bt!==null)&&(Vr(),dr())}}function Rn(l,c){var w=l.stateNode;if(w===null)return null;var O=cn(w);if(O===null)return null;w=O[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(O=!O.disabled)||(l=l.type,O=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!O;break e;default:l=!1}if(l)return null;if(w&&typeof w!="function")throw Error(r(231,c,typeof w));return w}var Da=!1;if(s)try{var ai={};Object.defineProperty(ai,"passive",{get:function(){Da=!0}}),window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{Da=!1}function ca(l,c,w,O,B,j,re,ce,ye){var De=Array.prototype.slice.call(arguments,3);try{c.apply(w,De)}catch(He){this.onError(He)}}var Wn=!1,oi=null,$i=!1,si=null,nl={onError:function(l){Wn=!0,oi=l}};function Na(l,c,w,O,B,j,re,ce,ye){Wn=!1,oi=null,ca.apply(nl,arguments)}function Qo(l,c,w,O,B,j,re,ce,ye){if(Na.apply(this,arguments),Wn){if(Wn){var De=oi;Wn=!1,oi=null}else throw Error(r(198));$i||($i=!0,si=De)}}function Gn(l){var c=l,w=l;if(l.alternate)for(;c.return;)c=c.return;else{l=c;do c=l,(c.flags&4098)!==0&&(w=c.return),l=c.return;while(l)}return c.tag===3?w:null}function Zo(l){if(l.tag===13){var c=l.memoizedState;if(c===null&&(l=l.alternate,l!==null&&(c=l.memoizedState)),c!==null)return c.dehydrated}return null}function li(l){if(Gn(l)!==l)throw Error(r(188))}function co(l){var c=l.alternate;if(!c){if(c=Gn(l),c===null)throw Error(r(188));return c!==l?null:l}for(var w=l,O=c;;){var B=w.return;if(B===null)break;var j=B.alternate;if(j===null){if(O=B.return,O!==null){w=O;continue}break}if(B.child===j.child){for(j=B.child;j;){if(j===w)return li(B),l;if(j===O)return li(B),c;j=j.sibling}throw Error(r(188))}if(w.return!==O.return)w=B,O=j;else{for(var re=!1,ce=B.child;ce;){if(ce===w){re=!0,w=B,O=j;break}if(ce===O){re=!0,O=B,w=j;break}ce=ce.sibling}if(!re){for(ce=j.child;ce;){if(ce===w){re=!0,w=j,O=B;break}if(ce===O){re=!0,O=j,w=B;break}ce=ce.sibling}if(!re)throw Error(r(189))}}if(w.alternate!==O)throw Error(r(190))}if(w.tag!==3)throw Error(r(188));return w.stateNode.current===w?l:c}function _i(l){return l=co(l),l!==null?La(l):null}function La(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=La(l);if(c!==null)return c;l=l.sibling}return null}var Fc=e.unstable_scheduleCallback,_u=e.unstable_cancelCallback,M0=e.unstable_shouldYield,D0=e.unstable_requestPaint,zr=e.unstable_now,Dd=e.unstable_getCurrentPriorityLevel,Jo=e.unstable_ImmediatePriority,Bc=e.unstable_UserBlockingPriority,il=e.unstable_NormalPriority,N0=e.unstable_LowPriority,zc=e.unstable_IdlePriority,Fa=null,hn=null;function vr(l){if(hn&&typeof hn.onCommitFiberRoot=="function")try{hn.onCommitFiberRoot(Fa,l,void 0,(l.current.flags&128)===128)}catch{}}var jt=Math.clz32?Math.clz32:Xn,fo=Math.log,kn=Math.LN2;function Xn(l){return l>>>=0,l===0?32:31-(fo(l)/kn|0)|0}var fa=64,Ba=4194304;function sn(l){switch(l&-l){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: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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function es(l,c){var w=l.pendingLanes;if(w===0)return 0;var O=0,B=l.suspendedLanes,j=l.pingedLanes,re=w&268435455;if(re!==0){var ce=re&~B;ce!==0?O=sn(ce):(j&=re,j!==0&&(O=sn(j)))}else re=w&~B,re!==0?O=sn(re):j!==0&&(O=sn(j));if(O===0)return 0;if(c!==0&&c!==O&&(c&B)===0&&(B=O&-O,j=c&-c,B>=j||B===16&&(j&4194240)!==0))return c;if((O&4)!==0&&(O|=w&16),c=l.entangledLanes,c!==0)for(l=l.entanglements,c&=O;0<c;)w=31-jt(c),B=1<<w,O|=l[w],c&=~B;return O}function Vp(l,c){switch(l){case 1:case 2:case 4:return c+250;case 8: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wp(l,c){for(var w=l.suspendedLanes,O=l.pingedLanes,B=l.expirationTimes,j=l.pendingLanes;0<j;){var re=31-jt(j),ce=1<<re,ye=B[re];ye===-1?((ce&w)===0||(ce&O)!==0)&&(B[re]=Vp(ce,c)):ye<=c&&(l.expiredLanes|=ce),j&=~ce}}function al(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Nd(){var l=fa;return fa<<=1,(fa&4194240)===0&&(fa=64),l}function ui(l){for(var c=[],w=0;31>w;w++)c.push(l);return c}function Pu(l,c,w){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-jt(c),l[c]=w}function L0(l,c){var w=l.pendingLanes&~c;l.pendingLanes=c,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=c,l.mutableReadLanes&=c,l.entangledLanes&=c,c=l.entanglements;var O=l.eventTimes;for(l=l.expirationTimes;0<w;){var B=31-jt(w),j=1<<B;c[B]=0,O[B]=-1,l[B]=-1,w&=~j}}function Ld(l,c){var w=l.entangledLanes|=c;for(l=l.entanglements;w;){var O=31-jt(w),B=1<<O;B&c|l[O]&c&&(l[O]|=c),w&=~B}}var Kt=0;function Eu(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var ol,sl,Gp,Xp,jc,Uc=!1,ll=[],Pi=null,ho=null,da=null,Ut=new Map,ul=new Map,ha=[],Yp="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 submit".split(" ");function Kp(l,c){switch(l){case"focusin":case"focusout":Pi=null;break;case"dragenter":case"dragleave":ho=null;break;case"mouseover":case"mouseout":da=null;break;case"pointerover":case"pointerout":Ut.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":ul.delete(c.pointerId)}}function Tu(l,c,w,O,B,j){return l===null||l.nativeEvent!==j?(l={blockedOn:c,domEventName:w,eventSystemFlags:O,nativeEvent:j,targetContainers:[B]},c!==null&&(c=Uu(c),c!==null&&sl(c)),l):(l.eventSystemFlags|=O,c=l.targetContainers,B!==null&&c.indexOf(B)===-1&&c.push(B),l)}function ln(l,c,w,O,B){switch(c){case"focusin":return Pi=Tu(Pi,l,c,w,O,B),!0;case"dragenter":return ho=Tu(ho,l,c,w,O,B),!0;case"mouseover":return da=Tu(da,l,c,w,O,B),!0;case"pointerover":var j=B.pointerId;return Ut.set(j,Tu(Ut.get(j)||null,l,c,w,O,B)),!0;case"gotpointercapture":return j=B.pointerId,ul.set(j,Tu(ul.get(j)||null,l,c,w,O,B)),!0}return!1}function Hc(l){var c=ko(l.target);if(c!==null){var w=Gn(c);if(w!==null){if(c=w.tag,c===13){if(c=Zo(w),c!==null){l.blockedOn=c,jc(l.priority,function(){Gp(w)});return}}else if(c===3&&w.stateNode.current.memoizedState.isDehydrated){l.blockedOn=w.tag===3?w.stateNode.containerInfo:null;return}}}l.blockedOn=null}function $c(l){if(l.blockedOn!==null)return!1;for(var c=l.targetContainers;0<c.length;){var w=Wc(l.domEventName,l.eventSystemFlags,c[0],l.nativeEvent);if(w===null){w=l.nativeEvent;var O=new w.constructor(w.type,w);Pt=O,w.target.dispatchEvent(O),Pt=null}else return c=Uu(w),c!==null&&sl(c),l.blockedOn=w,!1;c.shift()}return!0}function qc(l,c,w){$c(l)&&w.delete(c)}function F0(){Uc=!1,Pi!==null&&$c(Pi)&&(Pi=null),ho!==null&&$c(ho)&&(ho=null),da!==null&&$c(da)&&(da=null),Ut.forEach(qc),ul.forEach(qc)}function po(l,c){l.blockedOn===c&&(l.blockedOn=null,Uc||(Uc=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,F0)))}function Yn(l){function c(B){return po(B,l)}if(0<ll.length){po(ll[0],l);for(var w=1;w<ll.length;w++){var O=ll[w];O.blockedOn===l&&(O.blockedOn=null)}}for(Pi!==null&&po(Pi,l),ho!==null&&po(ho,l),da!==null&&po(da,l),Ut.forEach(c),ul.forEach(c),w=0;w<ha.length;w++)O=ha[w],O.blockedOn===l&&(O.blockedOn=null);for(;0<ha.length&&(w=ha[0],w.blockedOn===null);)Hc(w),w.blockedOn===null&&ha.shift()}var cl=_.ReactCurrentBatchConfig,Vc=!0;function qi(l,c,w,O){var B=Kt,j=cl.transition;cl.transition=null;try{Kt=1,fl(l,c,w,O)}finally{Kt=B,cl.transition=j}}function za(l,c,w,O){var B=Kt,j=cl.transition;cl.transition=null;try{Kt=4,fl(l,c,w,O)}finally{Kt=B,cl.transition=j}}function fl(l,c,w,O){if(Vc){var B=Wc(l,c,w,O);if(B===null)uf(l,c,O,dl,w),Kp(l,O);else if(ln(B,l,c,w,O))O.stopPropagation();else if(Kp(l,O),c&4&&-1<Yp.indexOf(l)){for(;B!==null;){var j=Uu(B);if(j!==null&&ol(j),j=Wc(l,c,w,O),j===null&&uf(l,c,O,dl,w),j===B)break;B=j}B!==null&&O.stopPropagation()}else uf(l,c,O,null,w)}}var dl=null;function Wc(l,c,w,O){if(dl=null,l=Ot(O),l=ko(l),l!==null)if(c=Gn(l),c===null)l=null;else if(w=c.tag,w===13){if(l=Zo(c),l!==null)return l;l=null}else if(w===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;l=null}else c!==l&&(l=null);return dl=l,null}function Qp(l){switch(l){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Dd()){case Jo:return 1;case Bc:return 4;case il:case N0:return 16;case zc:return 536870912;default:return 16}default:return 16}}var pn=null,mo=null,ja=null;function Cu(){if(ja)return ja;var l,c=mo,w=c.length,O,B="value"in pn?pn.value:pn.textContent,j=B.length;for(l=0;l<w&&c[l]===B[l];l++);var re=w-l;for(O=1;O<=re&&c[w-O]===B[j-O];O++);return ja=B.slice(l,1<O?1-O:void 0)}function ts(l){var c=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&c===13&&(l=13)):l=c,l===10&&(l=13),32<=l||l===13?l:0}function Mn(){return!0}function ci(){return!1}function Kr(l){function c(w,O,B,j,re){this._reactName=w,this._targetInst=B,this.type=O,this.nativeEvent=j,this.target=re,this.currentTarget=null;for(var ce in l)l.hasOwnProperty(ce)&&(w=l[ce],this[ce]=w?w(j):j[ce]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Mn:ci,this.isPropagationStopped=ci,this}return U(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var w=this.nativeEvent;w&&(w.preventDefault?w.preventDefault():typeof w.returnValue!="unknown"&&(w.returnValue=!1),this.isDefaultPrevented=Mn)},stopPropagation:function(){var w=this.nativeEvent;w&&(w.stopPropagation?w.stopPropagation():typeof w.cancelBubble!="unknown"&&(w.cancelBubble=!0),this.isPropagationStopped=Mn)},persist:function(){},isPersistent:Mn}),c}var Kn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vi=Kr(Kn),Wi=U({},Kn,{view:0,detail:0}),Zp=Kr(Wi),Ou,Au,mn,Dn=U({},Wi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ns,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==mn&&(mn&&l.type==="mousemove"?(Ou=l.screenX-mn.screenX,Au=l.screenY-mn.screenY):Au=Ou=0,mn=l),Ou)},movementY:function(l){return"movementY"in l?l.movementY:Au}}),br=Kr(Dn),Iu=U({},Dn,{dataTransfer:0}),Gi=Kr(Iu),Jp=U({},Wi,{relatedTarget:0}),Gc=Kr(Jp),Fd=U({},Kn,{animationName:0,elapsedTime:0,pseudoElement:0}),Bd=Kr(Fd),em=U({},Kn,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),Xc=Kr(em),tm=U({},Kn,{data:0}),rs=Kr(tm),zd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},B0={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"},Yc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z0(l){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(l):(l=Yc[l])?!!c[l]:!1}function ns(){return z0}var Kc=U({},Wi,{key:function(l){if(l.key){var c=zd[l.key]||l.key;if(c!=="Unidentified")return c}return l.type==="keypress"?(l=ts(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?B0[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ns,charCode:function(l){return l.type==="keypress"?ts(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?ts(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),rm=Kr(Kc),nm=U({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),is=Kr(nm),im=U({},Wi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ns}),Qc=Kr(im),Zc=U({},Kn,{propertyName:0,elapsedTime:0,pseudoElement:0}),hl=Kr(Zc),jd=U({},Dn,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),Ud=Kr(jd),am=[9,13,27,32],Ru=s&&"CompositionEvent"in window,as=null;s&&"documentMode"in document&&(as=document.documentMode);var pl=s&&"TextEvent"in window&&!as,fi=s&&(!Ru||as&&8<as&&11>=as),go=" ",Jc=!1;function Hd(l,c){switch(l){case"keyup":return am.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xi(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var di=!1;function $d(l,c){switch(l){case"compositionend":return Xi(c);case"keypress":return c.which!==32?null:(Jc=!0,go);case"textInput":return l=c.data,l===go&&Jc?null:l;default:return null}}function om(l,c){if(di)return l==="compositionend"||!Ru&&Hd(l,c)?(l=Cu(),ja=mo=pn=null,di=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return fi&&c.locale!=="ko"?null:c.data;default:return null}}var Ua={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 Ha(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c==="input"?!!Ua[l.type]:c==="textarea"}function Mu(l,c,w,O){Yt(O),c=cf(c,"onChange"),0<c.length&&(w=new Vi("onChange","change",null,w,O),l.push({event:w,listeners:c}))}var ml=null,yo=null;function sm(l){eh(l,0)}function vo(l){var c=Zr(l);if(Fe(c))return l}function Ei(l,c){if(l==="change")return c}var gl=!1;if(s){var bo;if(s){var Ti="oninput"in document;if(!Ti){var ef=document.createElement("div");ef.setAttribute("oninput","return;"),Ti=typeof ef.oninput=="function"}bo=Ti}else bo=!1;gl=bo&&(!document.documentMode||9<document.documentMode)}function os(){ml&&(ml.detachEvent("onpropertychange",qd),yo=ml=null)}function qd(l){if(l.propertyName==="value"&&vo(yo)){var c=[];Mu(c,yo,l,Ot(l)),Hi(sm,c)}}function Vd(l,c,w){l==="focusin"?(os(),ml=c,yo=w,ml.attachEvent("onpropertychange",qd)):l==="focusout"&&os()}function Rr(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return vo(yo)}function tf(l,c){if(l==="click")return vo(c)}function Wd(l,c){if(l==="input"||l==="change")return vo(c)}function Gd(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var Qn=typeof Object.is=="function"?Object.is:Gd;function ss(l,c){if(Qn(l,c))return!0;if(typeof l!="object"||l===null||typeof c!="object"||c===null)return!1;var w=Object.keys(l),O=Object.keys(c);if(w.length!==O.length)return!1;for(O=0;O<w.length;O++){var B=w[O];if(!u.call(c,B)||!Qn(l[B],c[B]))return!1}return!0}function wo(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function _r(l,c){var w=wo(l);l=0;for(var O;w;){if(w.nodeType===3){if(O=l+w.textContent.length,l<=c&&O>=c)return{node:w,offset:c-l};l=O}e:{for(;w;){if(w.nextSibling){w=w.nextSibling;break e}w=w.parentNode}w=void 0}w=wo(w)}}function Wr(l,c){return l&&c?l===c?!0:l&&l.nodeType===3?!1:c&&c.nodeType===3?Wr(l,c.parentNode):"contains"in l?l.contains(c):l.compareDocumentPosition?!!(l.compareDocumentPosition(c)&16):!1:!1}function Qr(){for(var l=window,c=Le();c instanceof l.HTMLIFrameElement;){try{var w=typeof c.contentWindow.location.href=="string"}catch{w=!1}if(w)l=c.contentWindow;else break;c=Le(l.document)}return c}function yl(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c&&(c==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||c==="textarea"||l.contentEditable==="true")}function Du(l){var c=Qr(),w=l.focusedElem,O=l.selectionRange;if(c!==w&&w&&w.ownerDocument&&Wr(w.ownerDocument.documentElement,w)){if(O!==null&&yl(w)){if(c=O.start,l=O.end,l===void 0&&(l=c),"selectionStart"in w)w.selectionStart=c,w.selectionEnd=Math.min(l,w.value.length);else if(l=(c=w.ownerDocument||document)&&c.defaultView||window,l.getSelection){l=l.getSelection();var B=w.textContent.length,j=Math.min(O.start,B);O=O.end===void 0?j:Math.min(O.end,B),!l.extend&&j>O&&(B=O,O=j,j=B),B=_r(w,j);var re=_r(w,O);B&&re&&(l.rangeCount!==1||l.anchorNode!==B.node||l.anchorOffset!==B.offset||l.focusNode!==re.node||l.focusOffset!==re.offset)&&(c=c.createRange(),c.setStart(B.node,B.offset),l.removeAllRanges(),j>O?(l.addRange(c),l.extend(re.node,re.offset)):(c.setEnd(re.node,re.offset),l.addRange(c)))}}for(c=[],l=w;l=l.parentNode;)l.nodeType===1&&c.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<c.length;w++)l=c[w],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var Nu=s&&"documentMode"in document&&11>=document.documentMode,vl=null,un=null,ls=null,Lu=!1;function rf(l,c,w){var O=w.window===w?w.document:w.nodeType===9?w:w.ownerDocument;Lu||vl==null||vl!==Le(O)||(O=vl,"selectionStart"in O&&yl(O)?O={start:O.selectionStart,end:O.selectionEnd}:(O=(O.ownerDocument&&O.ownerDocument.defaultView||window).getSelection(),O={anchorNode:O.anchorNode,anchorOffset:O.anchorOffset,focusNode:O.focusNode,focusOffset:O.focusOffset}),ls&&ss(ls,O)||(ls=O,O=cf(un,"onSelect"),0<O.length&&(c=new Vi("onSelect","select",null,c,w),l.push({event:c,listeners:O}),c.target=vl)))}function hi(l,c){var w={};return w[l.toLowerCase()]=c.toLowerCase(),w["Webkit"+l]="webkit"+c,w["Moz"+l]="moz"+c,w}var gn={animationend:hi("Animation","AnimationEnd"),animationiteration:hi("Animation","AnimationIteration"),animationstart:hi("Animation","AnimationStart"),transitionend:hi("Transition","TransitionEnd")},us={},nf={};s&&(nf=document.createElement("div").style,"AnimationEvent"in window||(delete gn.animationend.animation,delete gn.animationiteration.animation,delete gn.animationstart.animation),"TransitionEvent"in window||delete gn.transitionend.transition);function bl(l){if(us[l])return us[l];if(!gn[l])return l;var c=gn[l],w;for(w in c)if(c.hasOwnProperty(w)&&w in nf)return us[l]=c[w];return l}var Xd=bl("animationend"),Yd=bl("animationiteration"),Kd=bl("animationstart"),Qd=bl("transitionend"),Zd=new Map,Jd="abort auxClick 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 toggle touchMove waiting wheel".split(" ");function $a(l,c){Zd.set(l,c),a(c,[l])}for(var af=0;af<Jd.length;af++){var cs=Jd[af],lm=cs.toLowerCase(),of=cs[0].toUpperCase()+cs.slice(1);$a(lm,"on"+of)}$a(Xd,"onAnimationEnd"),$a(Yd,"onAnimationIteration"),$a(Kd,"onAnimationStart"),$a("dblclick","onDoubleClick"),$a("focusin","onFocus"),$a("focusout","onBlur"),$a(Qd,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xo="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(" "),um=new Set("cancel close invalid load scroll toggle".split(" ").concat(xo));function sf(l,c,w){var O=l.type||"unknown-event";l.currentTarget=w,Qo(O,c,void 0,l),l.currentTarget=null}function eh(l,c){c=(c&4)!==0;for(var w=0;w<l.length;w++){var O=l[w],B=O.event;O=O.listeners;e:{var j=void 0;if(c)for(var re=O.length-1;0<=re;re--){var ce=O[re],ye=ce.instance,De=ce.currentTarget;if(ce=ce.listener,ye!==j&&B.isPropagationStopped())break e;sf(B,ce,De),j=ye}else for(re=0;re<O.length;re++){if(ce=O[re],ye=ce.instance,De=ce.currentTarget,ce=ce.listener,ye!==j&&B.isPropagationStopped())break e;sf(B,ce,De),j=ye}}}if($i)throw l=si,$i=!1,si=null,l}function hr(l,c){var w=c[df];w===void 0&&(w=c[df]=new Set);var O=l+"__bubble";w.has(O)||(th(c,l,2,!1),w.add(O))}function lf(l,c,w){var O=0;c&&(O|=4),th(w,l,O,c)}var Fu="_reactListening"+Math.random().toString(36).slice(2);function fs(l){if(!l[Fu]){l[Fu]=!0,n.forEach(function(w){w!=="selectionchange"&&(um.has(w)||lf(w,!1,l),lf(w,!0,l))});var c=l.nodeType===9?l:l.ownerDocument;c===null||c[Fu]||(c[Fu]=!0,lf("selectionchange",!1,c))}}function th(l,c,w,O){switch(Qp(c)){case 1:var B=qi;break;case 4:B=za;break;default:B=fl}w=B.bind(null,c,w,l),B=void 0,!Da||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(B=!0),O?B!==void 0?l.addEventListener(c,w,{capture:!0,passive:B}):l.addEventListener(c,w,!0):B!==void 0?l.addEventListener(c,w,{passive:B}):l.addEventListener(c,w,!1)}function uf(l,c,w,O,B){var j=O;if((c&1)===0&&(c&2)===0&&O!==null)e:for(;;){if(O===null)return;var re=O.tag;if(re===3||re===4){var ce=O.stateNode.containerInfo;if(ce===B||ce.nodeType===8&&ce.parentNode===B)break;if(re===4)for(re=O.return;re!==null;){var ye=re.tag;if((ye===3||ye===4)&&(ye=re.stateNode.containerInfo,ye===B||ye.nodeType===8&&ye.parentNode===B))return;re=re.return}for(;ce!==null;){if(re=ko(ce),re===null)return;if(ye=re.tag,ye===5||ye===6){O=j=re;continue e}ce=ce.parentNode}}O=O.return}Hi(function(){var De=j,He=Ot(w),We=[];e:{var Ue=Zd.get(l);if(Ue!==void 0){var ft=Vi,yt=l;switch(l){case"keypress":if(ts(w)===0)break e;case"keydown":case"keyup":ft=rm;break;case"focusin":yt="focus",ft=Gc;break;case"focusout":yt="blur",ft=Gc;break;case"beforeblur":case"afterblur":ft=Gc;break;case"click":if(w.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ft=br;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ft=Gi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ft=Qc;break;case Xd:case Yd:case Kd:ft=Bd;break;case Qd:ft=hl;break;case"scroll":ft=Zp;break;case"wheel":ft=Ud;break;case"copy":case"cut":case"paste":ft=Xc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ft=is}var vt=(c&4)!==0,rn=!vt&&l==="scroll",Ae=vt?Ue!==null?Ue+"Capture":null:Ue;vt=[];for(var we=De,Re;we!==null;){Re=we;var Ke=Re.stateNode;if(Re.tag===5&&Ke!==null&&(Re=Ke,Ae!==null&&(Ke=Rn(we,Ae),Ke!=null&&vt.push(wl(we,Ke,Re)))),rn)break;we=we.return}0<vt.length&&(Ue=new ft(Ue,yt,null,w,He),We.push({event:Ue,listeners:vt}))}}if((c&7)===0){e:{if(Ue=l==="mouseover"||l==="pointerover",ft=l==="mouseout"||l==="pointerout",Ue&&w!==Pt&&(yt=w.relatedTarget||w.fromElement)&&(ko(yt)||yt[ma]))break e;if((ft||Ue)&&(Ue=He.window===He?He:(Ue=He.ownerDocument)?Ue.defaultView||Ue.parentWindow:window,ft?(yt=w.relatedTarget||w.toElement,ft=De,yt=yt?ko(yt):null,yt!==null&&(rn=Gn(yt),yt!==rn||yt.tag!==5&&yt.tag!==6)&&(yt=null)):(ft=null,yt=De),ft!==yt)){if(vt=br,Ke="onMouseLeave",Ae="onMouseEnter",we="mouse",(l==="pointerout"||l==="pointerover")&&(vt=is,Ke="onPointerLeave",Ae="onPointerEnter",we="pointer"),rn=ft==null?Ue:Zr(ft),Re=yt==null?Ue:Zr(yt),Ue=new vt(Ke,we+"leave",ft,w,He),Ue.target=rn,Ue.relatedTarget=Re,Ke=null,ko(He)===De&&(vt=new vt(Ae,we+"enter",yt,w,He),vt.target=Re,vt.relatedTarget=rn,Ke=vt),rn=Ke,ft&&yt)t:{for(vt=ft,Ae=yt,we=0,Re=vt;Re;Re=ds(Re))we++;for(Re=0,Ke=Ae;Ke;Ke=ds(Ke))Re++;for(;0<we-Re;)vt=ds(vt),we--;for(;0<Re-we;)Ae=ds(Ae),Re--;for(;we--;){if(vt===Ae||Ae!==null&&vt===Ae.alternate)break t;vt=ds(vt),Ae=ds(Ae)}vt=null}else vt=null;ft!==null&&cm(We,Ue,ft,vt,!1),yt!==null&&rn!==null&&cm(We,rn,yt,vt,!0)}}e:{if(Ue=De?Zr(De):window,ft=Ue.nodeName&&Ue.nodeName.toLowerCase(),ft==="select"||ft==="input"&&Ue.type==="file")var wt=Ei;else if(Ha(Ue))if(gl)wt=Wd;else{wt=Rr;var Tt=Vd}else(ft=Ue.nodeName)&&ft.toLowerCase()==="input"&&(Ue.type==="checkbox"||Ue.type==="radio")&&(wt=tf);if(wt&&(wt=wt(l,De))){Mu(We,wt,w,He);break e}Tt&&Tt(l,Ue,De),l==="focusout"&&(Tt=Ue._wrapperState)&&Tt.controlled&&Ue.type==="number"&&se(Ue,"number",Ue.value)}switch(Tt=De?Zr(De):window,l){case"focusin":(Ha(Tt)||Tt.contentEditable==="true")&&(vl=Tt,un=De,ls=null);break;case"focusout":ls=un=vl=null;break;case"mousedown":Lu=!0;break;case"contextmenu":case"mouseup":case"dragend":Lu=!1,rf(We,w,He);break;case"selectionchange":if(Nu)break;case"keydown":case"keyup":rf(We,w,He)}var Ct;if(Ru)e:{switch(l){case"compositionstart":var Rt="onCompositionStart";break e;case"compositionend":Rt="onCompositionEnd";break e;case"compositionupdate":Rt="onCompositionUpdate";break e}Rt=void 0}else di?Hd(l,w)&&(Rt="onCompositionEnd"):l==="keydown"&&w.keyCode===229&&(Rt="onCompositionStart");Rt&&(fi&&w.locale!=="ko"&&(di||Rt!=="onCompositionStart"?Rt==="onCompositionEnd"&&di&&(Ct=Cu()):(pn=He,mo="value"in pn?pn.value:pn.textContent,di=!0)),Tt=cf(De,Rt),0<Tt.length&&(Rt=new rs(Rt,l,null,w,He),We.push({event:Rt,listeners:Tt}),Ct?Rt.data=Ct:(Ct=Xi(w),Ct!==null&&(Rt.data=Ct)))),(Ct=pl?$d(l,w):om(l,w))&&(De=cf(De,"onBeforeInput"),0<De.length&&(He=new rs("onBeforeInput","beforeinput",null,w,He),We.push({event:He,listeners:De}),He.data=Ct))}eh(We,c)})}function wl(l,c,w){return{instance:l,listener:c,currentTarget:w}}function cf(l,c){for(var w=c+"Capture",O=[];l!==null;){var B=l,j=B.stateNode;B.tag===5&&j!==null&&(B=j,j=Rn(l,w),j!=null&&O.unshift(wl(l,j,B)),j=Rn(l,c),j!=null&&O.push(wl(l,j,B))),l=l.return}return O}function ds(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function cm(l,c,w,O,B){for(var j=c._reactName,re=[];w!==null&&w!==O;){var ce=w,ye=ce.alternate,De=ce.stateNode;if(ye!==null&&ye===O)break;ce.tag===5&&De!==null&&(ce=De,B?(ye=Rn(w,j),ye!=null&&re.unshift(wl(w,ye,ce))):B||(ye=Rn(w,j),ye!=null&&re.push(wl(w,ye,ce)))),w=w.return}re.length!==0&&l.push({event:c,listeners:re})}var j0=/\r\n?/g,fm=/\u0000|\uFFFD/g;function rh(l){return(typeof l=="string"?l:""+l).replace(j0,`
6
+ `).replace(fm,"")}function Bu(l,c,w){if(c=rh(c),rh(l)!==c&&w)throw Error(r(425))}function hs(){}var nh=null,ih=null;function ah(l,c){return l==="textarea"||l==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var pi=typeof setTimeout=="function"?setTimeout:void 0,oh=typeof clearTimeout=="function"?clearTimeout:void 0,zu=typeof Promise=="function"?Promise:void 0,dm=typeof queueMicrotask=="function"?queueMicrotask:typeof zu<"u"?function(l){return zu.resolve(null).then(l).catch(hm)}:pi;function hm(l){setTimeout(function(){throw l})}function ff(l,c){var w=c,O=0;do{var B=w.nextSibling;if(l.removeChild(w),B&&B.nodeType===8)if(w=B.data,w==="/$"){if(O===0){l.removeChild(B),Yn(c);return}O--}else w!=="$"&&w!=="$?"&&w!=="$!"||O++;w=B}while(w);Yn(c)}function pa(l){for(;l!=null;l=l.nextSibling){var c=l.nodeType;if(c===1||c===3)break;if(c===8){if(c=l.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return l}function ps(l){l=l.previousSibling;for(var c=0;l;){if(l.nodeType===8){var w=l.data;if(w==="$"||w==="$!"||w==="$?"){if(c===0)return l;c--}else w==="/$"&&c++}l=l.previousSibling}return null}var So=Math.random().toString(36).slice(2),Ci="__reactFiber$"+So,ju="__reactProps$"+So,ma="__reactContainer$"+So,df="__reactEvents$"+So,pm="__reactListeners$"+So,mm="__reactHandles$"+So;function ko(l){var c=l[Ci];if(c)return c;for(var w=l.parentNode;w;){if(c=w[ma]||w[Ci]){if(w=c.alternate,c.child!==null||w!==null&&w.child!==null)for(l=ps(l);l!==null;){if(w=l[Ci])return w;l=ps(l)}return c}l=w,w=l.parentNode}return null}function Uu(l){return l=l[Ci]||l[ma],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function Zr(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(r(33))}function cn(l){return l[ju]||null}var hf=[],ms=-1;function qa(l){return{current:l}}function pr(l){0>ms||(l.current=hf[ms],hf[ms]=null,ms--)}function cr(l,c){ms++,hf[ms]=l.current,l.current=c}var ga={},yn=qa(ga),_n=qa(!1),_o=ga;function gs(l,c){var w=l.type.contextTypes;if(!w)return ga;var O=l.stateNode;if(O&&O.__reactInternalMemoizedUnmaskedChildContext===c)return O.__reactInternalMemoizedMaskedChildContext;var B={},j;for(j in w)B[j]=c[j];return O&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=B),B}function Pn(l){return l=l.childContextTypes,l!=null}function xl(){pr(_n),pr(yn)}function sh(l,c,w){if(yn.current!==ga)throw Error(r(168));cr(yn,c),cr(_n,w)}function pf(l,c,w){var O=l.stateNode;if(c=c.childContextTypes,typeof O.getChildContext!="function")return w;O=O.getChildContext();for(var B in O)if(!(B in c))throw Error(r(108,ne(l)||"Unknown",B));return U({},w,O)}function ys(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ga,_o=yn.current,cr(yn,l),cr(_n,_n.current),!0}function gm(l,c,w){var O=l.stateNode;if(!O)throw Error(r(169));w?(l=pf(l,c,_o),O.__reactInternalMemoizedMergedChildContext=l,pr(_n),pr(yn),cr(yn,l)):pr(_n),cr(_n,w)}var ya=null,Sl=!1,mf=!1;function Hu(l){ya===null?ya=[l]:ya.push(l)}function Va(l){Sl=!0,Hu(l)}function Po(){if(!mf&&ya!==null){mf=!0;var l=0,c=Kt;try{var w=ya;for(Kt=1;l<w.length;l++){var O=w[l];do O=O(!0);while(O!==null)}ya=null,Sl=!1}catch(B){throw ya!==null&&(ya=ya.slice(l+1)),Fc(Jo,Po),B}finally{Kt=c,mf=!1}}return null}var Nn=[],vs=0,Eo=null,To=0,Ln=[],Fn=0,Co=null,mi=1,Pr="";function bs(l,c){Nn[vs++]=To,Nn[vs++]=Eo,Eo=l,To=c}function ym(l,c,w){Ln[Fn++]=mi,Ln[Fn++]=Pr,Ln[Fn++]=Co,Co=l;var O=mi;l=Pr;var B=32-jt(O)-1;O&=~(1<<B),w+=1;var j=32-jt(c)+B;if(30<j){var re=B-B%5;j=(O&(1<<re)-1).toString(32),O>>=re,B-=re,mi=1<<32-jt(c)+B|w<<B|O,Pr=j+l}else mi=1<<j|w<<B|O,Pr=l}function kl(l){l.return!==null&&(bs(l,1),ym(l,1,0))}function fn(l){for(;l===Eo;)Eo=Nn[--vs],Nn[vs]=null,To=Nn[--vs],Nn[vs]=null;for(;l===Co;)Co=Ln[--Fn],Ln[Fn]=null,Pr=Ln[--Fn],Ln[Fn]=null,mi=Ln[--Fn],Ln[Fn]=null}var gi=null,rt=null,rr=!1,yi=null;function lh(l,c){var w=_a(5,null,null,0);w.elementType="DELETED",w.stateNode=c,w.return=l,c=l.deletions,c===null?(l.deletions=[w],l.flags|=16):c.push(w)}function vm(l,c){switch(l.tag){case 5:var w=l.type;return c=c.nodeType!==1||w.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(l.stateNode=c,gi=l,rt=pa(c.firstChild),!0):!1;case 6:return c=l.pendingProps===""||c.nodeType!==3?null:c,c!==null?(l.stateNode=c,gi=l,rt=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(w=Co!==null?{id:mi,overflow:Pr}:null,l.memoizedState={dehydrated:c,treeContext:w,retryLane:1073741824},w=_a(18,null,null,0),w.stateNode=c,w.return=l,l.child=w,gi=l,rt=null,!0):!1;default:return!1}}function ws(l){return(l.mode&1)!==0&&(l.flags&128)===0}function _l(l){if(rr){var c=rt;if(c){var w=c;if(!vm(l,c)){if(ws(l))throw Error(r(418));c=pa(w.nextSibling);var O=gi;c&&vm(l,c)?lh(O,w):(l.flags=l.flags&-4097|2,rr=!1,gi=l)}}else{if(ws(l))throw Error(r(418));l.flags=l.flags&-4097|2,rr=!1,gi=l}}}function gf(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;gi=l}function $u(l){if(l!==gi)return!1;if(!rr)return gf(l),rr=!0,!1;var c;if((c=l.tag!==3)&&!(c=l.tag!==5)&&(c=l.type,c=c!=="head"&&c!=="body"&&!ah(l.type,l.memoizedProps)),c&&(c=rt)){if(ws(l))throw uh(),Error(r(418));for(;c;)lh(l,c),c=pa(c.nextSibling)}if(gf(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(317));e:{for(l=l.nextSibling,c=0;l;){if(l.nodeType===8){var w=l.data;if(w==="/$"){if(c===0){rt=pa(l.nextSibling);break e}c--}else w!=="$"&&w!=="$!"&&w!=="$?"||c++}l=l.nextSibling}rt=null}}else rt=gi?pa(l.stateNode.nextSibling):null;return!0}function uh(){for(var l=rt;l;)l=pa(l.nextSibling)}function xs(){rt=gi=null,rr=!1}function qu(l){yi===null?yi=[l]:yi.push(l)}var ch=_.ReactCurrentBatchConfig;function jr(l,c,w){if(l=w.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(w._owner){if(w=w._owner,w){if(w.tag!==1)throw Error(r(309));var O=w.stateNode}if(!O)throw Error(r(147,l));var B=O,j=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===j?c.ref:(c=function(re){var ce=B.refs;re===null?delete ce[j]:ce[j]=re},c._stringRef=j,c)}if(typeof l!="string")throw Error(r(284));if(!w._owner)throw Error(r(290,l))}return l}function Zn(l,c){throw l=Object.prototype.toString.call(c),Error(r(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function Yi(l){var c=l._init;return c(l._payload)}function yf(l){function c(Ae,we){if(l){var Re=Ae.deletions;Re===null?(Ae.deletions=[we],Ae.flags|=16):Re.push(we)}}function w(Ae,we){if(!l)return null;for(;we!==null;)c(Ae,we),we=we.sibling;return null}function O(Ae,we){for(Ae=new Map;we!==null;)we.key!==null?Ae.set(we.key,we):Ae.set(we.index,we),we=we.sibling;return Ae}function B(Ae,we){return Ae=ql(Ae,we),Ae.index=0,Ae.sibling=null,Ae}function j(Ae,we,Re){return Ae.index=Re,l?(Re=Ae.alternate,Re!==null?(Re=Re.index,Re<we?(Ae.flags|=2,we):Re):(Ae.flags|=2,we)):(Ae.flags|=1048576,we)}function re(Ae){return l&&Ae.alternate===null&&(Ae.flags|=2),Ae}function ce(Ae,we,Re,Ke){return we===null||we.tag!==6?(we=s1(Re,Ae.mode,Ke),we.return=Ae,we):(we=B(we,Re),we.return=Ae,we)}function ye(Ae,we,Re,Ke){var wt=Re.type;return wt===T?He(Ae,we,Re.props.children,Ke,Re.key):we!==null&&(we.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===Z&&Yi(wt)===we.type)?(Ke=B(we,Re.props),Ke.ref=jr(Ae,we,Re),Ke.return=Ae,Ke):(Ke=zm(Re.type,Re.key,Re.props,null,Ae.mode,Ke),Ke.ref=jr(Ae,we,Re),Ke.return=Ae,Ke)}function De(Ae,we,Re,Ke){return we===null||we.tag!==4||we.stateNode.containerInfo!==Re.containerInfo||we.stateNode.implementation!==Re.implementation?(we=l1(Re,Ae.mode,Ke),we.return=Ae,we):(we=B(we,Re.children||[]),we.return=Ae,we)}function He(Ae,we,Re,Ke,wt){return we===null||we.tag!==7?(we=tc(Re,Ae.mode,Ke,wt),we.return=Ae,we):(we=B(we,Re),we.return=Ae,we)}function We(Ae,we,Re){if(typeof we=="string"&&we!==""||typeof we=="number")return we=s1(""+we,Ae.mode,Re),we.return=Ae,we;if(typeof we=="object"&&we!==null){switch(we.$$typeof){case E:return Re=zm(we.type,we.key,we.props,null,Ae.mode,Re),Re.ref=jr(Ae,null,we),Re.return=Ae,Re;case A:return we=l1(we,Ae.mode,Re),we.return=Ae,we;case Z:var Ke=we._init;return We(Ae,Ke(we._payload),Re)}if(me(we)||J(we))return we=tc(we,Ae.mode,Re,null),we.return=Ae,we;Zn(Ae,we)}return null}function Ue(Ae,we,Re,Ke){var wt=we!==null?we.key:null;if(typeof Re=="string"&&Re!==""||typeof Re=="number")return wt!==null?null:ce(Ae,we,""+Re,Ke);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case E:return Re.key===wt?ye(Ae,we,Re,Ke):null;case A:return Re.key===wt?De(Ae,we,Re,Ke):null;case Z:return wt=Re._init,Ue(Ae,we,wt(Re._payload),Ke)}if(me(Re)||J(Re))return wt!==null?null:He(Ae,we,Re,Ke,null);Zn(Ae,Re)}return null}function ft(Ae,we,Re,Ke,wt){if(typeof Ke=="string"&&Ke!==""||typeof Ke=="number")return Ae=Ae.get(Re)||null,ce(we,Ae,""+Ke,wt);if(typeof Ke=="object"&&Ke!==null){switch(Ke.$$typeof){case E:return Ae=Ae.get(Ke.key===null?Re:Ke.key)||null,ye(we,Ae,Ke,wt);case A:return Ae=Ae.get(Ke.key===null?Re:Ke.key)||null,De(we,Ae,Ke,wt);case Z:var Tt=Ke._init;return ft(Ae,we,Re,Tt(Ke._payload),wt)}if(me(Ke)||J(Ke))return Ae=Ae.get(Re)||null,He(we,Ae,Ke,wt,null);Zn(we,Ke)}return null}function yt(Ae,we,Re,Ke){for(var wt=null,Tt=null,Ct=we,Rt=we=0,In=null;Ct!==null&&Rt<Re.length;Rt++){Ct.index>Rt?(In=Ct,Ct=null):In=Ct.sibling;var er=Ue(Ae,Ct,Re[Rt],Ke);if(er===null){Ct===null&&(Ct=In);break}l&&Ct&&er.alternate===null&&c(Ae,Ct),we=j(er,we,Rt),Tt===null?wt=er:Tt.sibling=er,Tt=er,Ct=In}if(Rt===Re.length)return w(Ae,Ct),rr&&bs(Ae,Rt),wt;if(Ct===null){for(;Rt<Re.length;Rt++)Ct=We(Ae,Re[Rt],Ke),Ct!==null&&(we=j(Ct,we,Rt),Tt===null?wt=Ct:Tt.sibling=Ct,Tt=Ct);return rr&&bs(Ae,Rt),wt}for(Ct=O(Ae,Ct);Rt<Re.length;Rt++)In=ft(Ct,Ae,Rt,Re[Rt],Ke),In!==null&&(l&&In.alternate!==null&&Ct.delete(In.key===null?Rt:In.key),we=j(In,we,Rt),Tt===null?wt=In:Tt.sibling=In,Tt=In);return l&&Ct.forEach(function(Vl){return c(Ae,Vl)}),rr&&bs(Ae,Rt),wt}function vt(Ae,we,Re,Ke){var wt=J(Re);if(typeof wt!="function")throw Error(r(150));if(Re=wt.call(Re),Re==null)throw Error(r(151));for(var Tt=wt=null,Ct=we,Rt=we=0,In=null,er=Re.next();Ct!==null&&!er.done;Rt++,er=Re.next()){Ct.index>Rt?(In=Ct,Ct=null):In=Ct.sibling;var Vl=Ue(Ae,Ct,er.value,Ke);if(Vl===null){Ct===null&&(Ct=In);break}l&&Ct&&Vl.alternate===null&&c(Ae,Ct),we=j(Vl,we,Rt),Tt===null?wt=Vl:Tt.sibling=Vl,Tt=Vl,Ct=In}if(er.done)return w(Ae,Ct),rr&&bs(Ae,Rt),wt;if(Ct===null){for(;!er.done;Rt++,er=Re.next())er=We(Ae,er.value,Ke),er!==null&&(we=j(er,we,Rt),Tt===null?wt=er:Tt.sibling=er,Tt=er);return rr&&bs(Ae,Rt),wt}for(Ct=O(Ae,Ct);!er.done;Rt++,er=Re.next())er=ft(Ct,Ae,Rt,er.value,Ke),er!==null&&(l&&er.alternate!==null&&Ct.delete(er.key===null?Rt:er.key),we=j(er,we,Rt),Tt===null?wt=er:Tt.sibling=er,Tt=er);return l&&Ct.forEach(function(F6){return c(Ae,F6)}),rr&&bs(Ae,Rt),wt}function rn(Ae,we,Re,Ke){if(typeof Re=="object"&&Re!==null&&Re.type===T&&Re.key===null&&(Re=Re.props.children),typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case E:e:{for(var wt=Re.key,Tt=we;Tt!==null;){if(Tt.key===wt){if(wt=Re.type,wt===T){if(Tt.tag===7){w(Ae,Tt.sibling),we=B(Tt,Re.props.children),we.return=Ae,Ae=we;break e}}else if(Tt.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===Z&&Yi(wt)===Tt.type){w(Ae,Tt.sibling),we=B(Tt,Re.props),we.ref=jr(Ae,Tt,Re),we.return=Ae,Ae=we;break e}w(Ae,Tt);break}else c(Ae,Tt);Tt=Tt.sibling}Re.type===T?(we=tc(Re.props.children,Ae.mode,Ke,Re.key),we.return=Ae,Ae=we):(Ke=zm(Re.type,Re.key,Re.props,null,Ae.mode,Ke),Ke.ref=jr(Ae,we,Re),Ke.return=Ae,Ae=Ke)}return re(Ae);case A:e:{for(Tt=Re.key;we!==null;){if(we.key===Tt)if(we.tag===4&&we.stateNode.containerInfo===Re.containerInfo&&we.stateNode.implementation===Re.implementation){w(Ae,we.sibling),we=B(we,Re.children||[]),we.return=Ae,Ae=we;break e}else{w(Ae,we);break}else c(Ae,we);we=we.sibling}we=l1(Re,Ae.mode,Ke),we.return=Ae,Ae=we}return re(Ae);case Z:return Tt=Re._init,rn(Ae,we,Tt(Re._payload),Ke)}if(me(Re))return yt(Ae,we,Re,Ke);if(J(Re))return vt(Ae,we,Re,Ke);Zn(Ae,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,we!==null&&we.tag===6?(w(Ae,we.sibling),we=B(we,Re),we.return=Ae,Ae=we):(w(Ae,we),we=s1(Re,Ae.mode,Ke),we.return=Ae,Ae=we),re(Ae)):w(Ae,we)}return rn}var Ss=yf(!0),Oi=yf(!1),Vu=qa(null),vi=null,Pl=null,vf=null;function bf(){vf=Pl=vi=null}function wf(l){var c=Vu.current;pr(Vu),l._currentValue=c}function xf(l,c,w){for(;l!==null;){var O=l.alternate;if((l.childLanes&c)!==c?(l.childLanes|=c,O!==null&&(O.childLanes|=c)):O!==null&&(O.childLanes&c)!==c&&(O.childLanes|=c),l===w)break;l=l.return}}function Wa(l,c){vi=l,vf=Pl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&c)!==0&&(G=!0),l.firstContext=null)}function Bn(l){var c=l._currentValue;if(vf!==l)if(l={context:l,memoizedValue:c,next:null},Pl===null){if(vi===null)throw Error(r(308));Pl=l,vi.dependencies={lanes:0,firstContext:l}}else Pl=Pl.next=l;return c}var va=null;function El(l){va===null?va=[l]:va.push(l)}function Wu(l,c,w,O){var B=c.interleaved;return B===null?(w.next=w,El(c)):(w.next=B.next,B.next=w),c.interleaved=w,bi(l,O)}function bi(l,c){l.lanes|=c;var w=l.alternate;for(w!==null&&(w.lanes|=c),w=l,l=l.return;l!==null;)l.childLanes|=c,w=l.alternate,w!==null&&(w.childLanes|=c),w=l,l=l.return;return w.tag===3?w.stateNode:null}var ba=!1;function Gu(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sf(l,c){l=l.updateQueue,c.updateQueue===l&&(c.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function wa(l,c){return{eventTime:l,lane:c,tag:0,payload:null,callback:null,next:null}}function xa(l,c,w){var O=l.updateQueue;if(O===null)return null;if(O=O.shared,(Zt&2)!==0){var B=O.pending;return B===null?c.next=c:(c.next=B.next,B.next=c),O.pending=c,bi(l,w)}return B=O.interleaved,B===null?(c.next=c,El(O)):(c.next=B.next,B.next=c),O.interleaved=c,bi(l,w)}function kf(l,c,w){if(c=c.updateQueue,c!==null&&(c=c.shared,(w&4194240)!==0)){var O=c.lanes;O&=l.pendingLanes,w|=O,c.lanes=w,Ld(l,w)}}function Xu(l,c){var w=l.updateQueue,O=l.alternate;if(O!==null&&(O=O.updateQueue,w===O)){var B=null,j=null;if(w=w.firstBaseUpdate,w!==null){do{var re={eventTime:w.eventTime,lane:w.lane,tag:w.tag,payload:w.payload,callback:w.callback,next:null};j===null?B=j=re:j=j.next=re,w=w.next}while(w!==null);j===null?B=j=c:j=j.next=c}else B=j=c;w={baseState:O.baseState,firstBaseUpdate:B,lastBaseUpdate:j,shared:O.shared,effects:O.effects},l.updateQueue=w;return}l=w.lastBaseUpdate,l===null?w.firstBaseUpdate=c:l.next=c,w.lastBaseUpdate=c}function Tl(l,c,w,O){var B=l.updateQueue;ba=!1;var j=B.firstBaseUpdate,re=B.lastBaseUpdate,ce=B.shared.pending;if(ce!==null){B.shared.pending=null;var ye=ce,De=ye.next;ye.next=null,re===null?j=De:re.next=De,re=ye;var He=l.alternate;He!==null&&(He=He.updateQueue,ce=He.lastBaseUpdate,ce!==re&&(ce===null?He.firstBaseUpdate=De:ce.next=De,He.lastBaseUpdate=ye))}if(j!==null){var We=B.baseState;re=0,He=De=ye=null,ce=j;do{var Ue=ce.lane,ft=ce.eventTime;if((O&Ue)===Ue){He!==null&&(He=He.next={eventTime:ft,lane:0,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null});e:{var yt=l,vt=ce;switch(Ue=c,ft=w,vt.tag){case 1:if(yt=vt.payload,typeof yt=="function"){We=yt.call(ft,We,Ue);break e}We=yt;break e;case 3:yt.flags=yt.flags&-65537|128;case 0:if(yt=vt.payload,Ue=typeof yt=="function"?yt.call(ft,We,Ue):yt,Ue==null)break e;We=U({},We,Ue);break e;case 2:ba=!0}}ce.callback!==null&&ce.lane!==0&&(l.flags|=64,Ue=B.effects,Ue===null?B.effects=[ce]:Ue.push(ce))}else ft={eventTime:ft,lane:Ue,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},He===null?(De=He=ft,ye=We):He=He.next=ft,re|=Ue;if(ce=ce.next,ce===null){if(ce=B.shared.pending,ce===null)break;Ue=ce,ce=Ue.next,Ue.next=null,B.lastBaseUpdate=Ue,B.shared.pending=null}}while(!0);if(He===null&&(ye=We),B.baseState=ye,B.firstBaseUpdate=De,B.lastBaseUpdate=He,c=B.shared.interleaved,c!==null){B=c;do re|=B.lane,B=B.next;while(B!==c)}else j===null&&(B.shared.lanes=0);Qu|=re,l.lanes=re,l.memoizedState=We}}function Nr(l,c,w){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var O=l[c],B=O.callback;if(B!==null){if(O.callback=null,O=w,typeof B!="function")throw Error(r(191,B));B.call(O)}}}var Nt={},fr=qa(Nt),Er=qa(Nt),Ur=qa(Nt);function Jr(l){if(l===Nt)throw Error(r(174));return l}function Oo(l,c){switch(cr(Ur,c),cr(Er,l),cr(fr,Nt),l=c.nodeType,l){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:be(null,"");break;default:l=l===8?c.parentNode:c,c=l.namespaceURI||null,l=l.tagName,c=be(c,l)}pr(fr),cr(fr,c)}function Tr(){pr(fr),pr(Er),pr(Ur)}function Cl(l){Jr(Ur.current);var c=Jr(fr.current),w=be(c,l.type);c!==w&&(cr(Er,l),cr(fr,w))}function Ga(l){Er.current===l&&(pr(fr),pr(Er))}var mr=qa(0);function Ol(l){for(var c=l;c!==null;){if(c.tag===13){var w=c.memoizedState;if(w!==null&&(w=w.dehydrated,w===null||w.data==="$?"||w.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var ks=[];function En(){for(var l=0;l<ks.length;l++)ks[l]._workInProgressVersionPrimary=null;ks.length=0}var Al=_.ReactCurrentDispatcher,Yu=_.ReactCurrentBatchConfig,zn=0,sr=null,Lr=null,Gr=null,Ki=!1,Ao=!1,Ai=0,_f=0;function Xr(){throw Error(r(321))}function Ku(l,c){if(c===null)return!1;for(var w=0;w<c.length&&w<l.length;w++)if(!Qn(l[w],c[w]))return!1;return!0}function Il(l,c,w,O,B,j){if(zn=j,sr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Al.current=l===null||l.memoizedState===null?H0:Mo,l=w(O,B),Ao){j=0;do{if(Ao=!1,Ai=0,25<=j)throw Error(r(301));j+=1,Gr=Lr=null,c.updateQueue=null,Al.current=Of,l=w(O,B)}while(Ao)}if(Al.current=Nl,c=Lr!==null&&Lr.next!==null,zn=0,Gr=Lr=sr=null,Ki=!1,c)throw Error(r(300));return l}function Rl(){var l=Ai!==0;return Ai=0,l}function wr(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gr===null?sr.memoizedState=Gr=l:Gr=Gr.next=l,Gr}function en(){if(Lr===null){var l=sr.alternate;l=l!==null?l.memoizedState:null}else l=Lr.next;var c=Gr===null?sr.memoizedState:Gr.next;if(c!==null)Gr=c,Lr=l;else{if(l===null)throw Error(r(310));Lr=l,l={memoizedState:Lr.memoizedState,baseState:Lr.baseState,baseQueue:Lr.baseQueue,queue:Lr.queue,next:null},Gr===null?sr.memoizedState=Gr=l:Gr=Gr.next=l}return Gr}function Tn(l,c){return typeof c=="function"?c(l):c}function Cn(l){var c=en(),w=c.queue;if(w===null)throw Error(r(311));w.lastRenderedReducer=l;var O=Lr,B=O.baseQueue,j=w.pending;if(j!==null){if(B!==null){var re=B.next;B.next=j.next,j.next=re}O.baseQueue=B=j,w.pending=null}if(B!==null){j=B.next,O=O.baseState;var ce=re=null,ye=null,De=j;do{var He=De.lane;if((zn&He)===He)ye!==null&&(ye=ye.next={lane:0,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),O=De.hasEagerState?De.eagerState:l(O,De.action);else{var We={lane:He,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null};ye===null?(ce=ye=We,re=O):ye=ye.next=We,sr.lanes|=He,Qu|=He}De=De.next}while(De!==null&&De!==j);ye===null?re=O:ye.next=ce,Qn(O,c.memoizedState)||(G=!0),c.memoizedState=O,c.baseState=re,c.baseQueue=ye,w.lastRenderedState=O}if(l=w.interleaved,l!==null){B=l;do j=B.lane,sr.lanes|=j,Qu|=j,B=B.next;while(B!==l)}else B===null&&(w.lanes=0);return[c.memoizedState,w.dispatch]}function Pf(l){var c=en(),w=c.queue;if(w===null)throw Error(r(311));w.lastRenderedReducer=l;var O=w.dispatch,B=w.pending,j=c.memoizedState;if(B!==null){w.pending=null;var re=B=B.next;do j=l(j,re.action),re=re.next;while(re!==B);Qn(j,c.memoizedState)||(G=!0),c.memoizedState=j,c.baseQueue===null&&(c.baseState=j),w.lastRenderedState=j}return[j,O]}function Ef(){}function Tf(l,c){var w=sr,O=en(),B=c(),j=!Qn(O.memoizedState,B);if(j&&(O.memoizedState=B,G=!0),O=O.queue,ph(fh.bind(null,w,O,l),[l]),O.getSnapshot!==c||j||Gr!==null&&Gr.memoizedState.tag&1){if(w.flags|=2048,Ml(9,Xa.bind(null,w,O,B,c),void 0,null),An===null)throw Error(r(349));(zn&30)!==0||bm(w,c,B)}return B}function bm(l,c,w){l.flags|=16384,l={getSnapshot:c,value:w},c=sr.updateQueue,c===null?(c={lastEffect:null,stores:null},sr.updateQueue=c,c.stores=[l]):(w=c.stores,w===null?c.stores=[l]:w.push(l))}function Xa(l,c,w,O){c.value=w,c.getSnapshot=O,dh(c)&&Cf(l)}function fh(l,c,w){return w(function(){dh(c)&&Cf(l)})}function dh(l){var c=l.getSnapshot;l=l.value;try{var w=c();return!Qn(l,w)}catch{return!0}}function Cf(l){var c=bi(l,1);c!==null&&Za(c,l,1,-1)}function Io(l){var c=wr();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Tn,lastRenderedState:l},c.queue=l,l=l.dispatch=Pm.bind(null,sr,l),[c.memoizedState,l]}function Ml(l,c,w,O){return l={tag:l,create:c,destroy:w,deps:O,next:null},c=sr.updateQueue,c===null?(c={lastEffect:null,stores:null},sr.updateQueue=c,c.lastEffect=l.next=l):(w=c.lastEffect,w===null?c.lastEffect=l.next=l:(O=w.next,w.next=l,l.next=O,c.lastEffect=l)),l}function hh(){return en().memoizedState}function Dl(l,c,w,O){var B=wr();sr.flags|=l,B.memoizedState=Ml(1|c,w,void 0,O===void 0?null:O)}function _s(l,c,w,O){var B=en();O=O===void 0?null:O;var j=void 0;if(Lr!==null){var re=Lr.memoizedState;if(j=re.destroy,O!==null&&Ku(O,re.deps)){B.memoizedState=Ml(c,w,j,O);return}}sr.flags|=l,B.memoizedState=Ml(1|c,w,j,O)}function wm(l,c){return Dl(8390656,8,l,c)}function ph(l,c){return _s(2048,8,l,c)}function mh(l,c){return _s(4,2,l,c)}function gh(l,c){return _s(4,4,l,c)}function Ro(l,c){if(typeof c=="function")return l=l(),c(l),function(){c(null)};if(c!=null)return l=l(),c.current=l,function(){c.current=null}}function xm(l,c,w){return w=w!=null?w.concat([l]):null,_s(4,4,Ro.bind(null,c,l),w)}function Ya(){}function yh(l,c){var w=en();c=c===void 0?null:c;var O=w.memoizedState;return O!==null&&c!==null&&Ku(c,O[1])?O[0]:(w.memoizedState=[l,c],l)}function xr(l,c){var w=en();c=c===void 0?null:c;var O=w.memoizedState;return O!==null&&c!==null&&Ku(c,O[1])?O[0]:(l=l(),w.memoizedState=[l,c],l)}function Sm(l,c,w){return(zn&21)===0?(l.baseState&&(l.baseState=!1,G=!0),l.memoizedState=w):(Qn(w,c)||(w=Nd(),sr.lanes|=w,Qu|=w,l.baseState=!0),c)}function km(l,c){var w=Kt;Kt=w!==0&&4>w?w:4,l(!0);var O=Yu.transition;Yu.transition={};try{l(!1),c()}finally{Kt=w,Yu.transition=O}}function _m(){return en().memoizedState}function U0(l,c,w){var O=Hl(l);if(w={lane:O,action:w,hasEagerState:!1,eagerState:null,next:null},vh(l))Em(c,w);else if(w=Wu(l,c,w,O),w!==null){var B=xi();Za(w,l,O,B),wi(w,c,O)}}function Pm(l,c,w){var O=Hl(l),B={lane:O,action:w,hasEagerState:!1,eagerState:null,next:null};if(vh(l))Em(c,B);else{var j=l.alternate;if(l.lanes===0&&(j===null||j.lanes===0)&&(j=c.lastRenderedReducer,j!==null))try{var re=c.lastRenderedState,ce=j(re,w);if(B.hasEagerState=!0,B.eagerState=ce,Qn(ce,re)){var ye=c.interleaved;ye===null?(B.next=B,El(c)):(B.next=ye.next,ye.next=B),c.interleaved=B;return}}catch{}w=Wu(l,c,B,O),w!==null&&(B=xi(),Za(w,l,O,B),wi(w,c,O))}}function vh(l){var c=l.alternate;return l===sr||c!==null&&c===sr}function Em(l,c){Ao=Ki=!0;var w=l.pending;w===null?c.next=c:(c.next=w.next,w.next=c),l.pending=c}function wi(l,c,w){if((w&4194240)!==0){var O=c.lanes;O&=l.pendingLanes,w|=O,c.lanes=w,Ld(l,w)}}var Nl={readContext:Bn,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useInsertionEffect:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr,useDeferredValue:Xr,useTransition:Xr,useMutableSource:Xr,useSyncExternalStore:Xr,useId:Xr,unstable_isNewReconciler:!1},H0={readContext:Bn,useCallback:function(l,c){return wr().memoizedState=[l,c===void 0?null:c],l},useContext:Bn,useEffect:wm,useImperativeHandle:function(l,c,w){return w=w!=null?w.concat([l]):null,Dl(4194308,4,Ro.bind(null,c,l),w)},useLayoutEffect:function(l,c){return Dl(4194308,4,l,c)},useInsertionEffect:function(l,c){return Dl(4,2,l,c)},useMemo:function(l,c){var w=wr();return c=c===void 0?null:c,l=l(),w.memoizedState=[l,c],l},useReducer:function(l,c,w){var O=wr();return c=w!==void 0?w(c):c,O.memoizedState=O.baseState=c,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:c},O.queue=l,l=l.dispatch=U0.bind(null,sr,l),[O.memoizedState,l]},useRef:function(l){var c=wr();return l={current:l},c.memoizedState=l},useState:Io,useDebugValue:Ya,useDeferredValue:function(l){return wr().memoizedState=l},useTransition:function(){var l=Io(!1),c=l[0];return l=km.bind(null,l[1]),wr().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,w){var O=sr,B=wr();if(rr){if(w===void 0)throw Error(r(407));w=w()}else{if(w=c(),An===null)throw Error(r(349));(zn&30)!==0||bm(O,c,w)}B.memoizedState=w;var j={value:w,getSnapshot:c};return B.queue=j,wm(fh.bind(null,O,j,l),[l]),O.flags|=2048,Ml(9,Xa.bind(null,O,j,w,c),void 0,null),w},useId:function(){var l=wr(),c=An.identifierPrefix;if(rr){var w=Pr,O=mi;w=(O&~(1<<32-jt(O)-1)).toString(32)+w,c=":"+c+"R"+w,w=Ai++,0<w&&(c+="H"+w.toString(32)),c+=":"}else w=_f++,c=":"+c+"r"+w.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},Mo={readContext:Bn,useCallback:yh,useContext:Bn,useEffect:ph,useImperativeHandle:xm,useInsertionEffect:mh,useLayoutEffect:gh,useMemo:xr,useReducer:Cn,useRef:hh,useState:function(){return Cn(Tn)},useDebugValue:Ya,useDeferredValue:function(l){var c=en();return Sm(c,Lr.memoizedState,l)},useTransition:function(){var l=Cn(Tn)[0],c=en().memoizedState;return[l,c]},useMutableSource:Ef,useSyncExternalStore:Tf,useId:_m,unstable_isNewReconciler:!1},Of={readContext:Bn,useCallback:yh,useContext:Bn,useEffect:ph,useImperativeHandle:xm,useInsertionEffect:mh,useLayoutEffect:gh,useMemo:xr,useReducer:Pf,useRef:hh,useState:function(){return Pf(Tn)},useDebugValue:Ya,useDeferredValue:function(l){var c=en();return Lr===null?c.memoizedState=l:Sm(c,Lr.memoizedState,l)},useTransition:function(){var l=Pf(Tn)[0],c=en().memoizedState;return[l,c]},useMutableSource:Ef,useSyncExternalStore:Tf,useId:_m,unstable_isNewReconciler:!1};function vn(l,c){if(l&&l.defaultProps){c=U({},c),l=l.defaultProps;for(var w in l)c[w]===void 0&&(c[w]=l[w]);return c}return c}function Ll(l,c,w,O){c=l.memoizedState,w=w(O,c),w=w==null?c:U({},c,w),l.memoizedState=w,l.lanes===0&&(l.updateQueue.baseState=w)}var Fl={isMounted:function(l){return(l=l._reactInternals)?Gn(l)===l:!1},enqueueSetState:function(l,c,w){l=l._reactInternals;var O=xi(),B=Hl(l),j=wa(O,B);j.payload=c,w!=null&&(j.callback=w),c=xa(l,j,B),c!==null&&(Za(c,l,B,O),kf(c,l,B))},enqueueReplaceState:function(l,c,w){l=l._reactInternals;var O=xi(),B=Hl(l),j=wa(O,B);j.tag=1,j.payload=c,w!=null&&(j.callback=w),c=xa(l,j,B),c!==null&&(Za(c,l,B,O),kf(c,l,B))},enqueueForceUpdate:function(l,c){l=l._reactInternals;var w=xi(),O=Hl(l),B=wa(w,O);B.tag=2,c!=null&&(B.callback=c),c=xa(l,B,O),c!==null&&(Za(c,l,O,w),kf(c,l,O))}};function Af(l,c,w,O,B,j,re){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(O,j,re):c.prototype&&c.prototype.isPureReactComponent?!ss(w,O)||!ss(B,j):!0}function Tm(l,c,w){var O=!1,B=ga,j=c.contextType;return typeof j=="object"&&j!==null?j=Bn(j):(B=Pn(c)?_o:yn.current,O=c.contextTypes,j=(O=O!=null)?gs(l,B):ga),c=new c(w,j),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Fl,l.stateNode=c,c._reactInternals=l,O&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=B,l.__reactInternalMemoizedMaskedChildContext=j),c}function bh(l,c,w,O){l=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(w,O),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(w,O),c.state!==l&&Fl.enqueueReplaceState(c,c.state,null)}function If(l,c,w,O){var B=l.stateNode;B.props=w,B.state=l.memoizedState,B.refs={},Gu(l);var j=c.contextType;typeof j=="object"&&j!==null?B.context=Bn(j):(j=Pn(c)?_o:yn.current,B.context=gs(l,j)),B.state=l.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(Ll(l,c,j,w),B.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof B.getSnapshotBeforeUpdate=="function"||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(c=B.state,typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount(),c!==B.state&&Fl.enqueueReplaceState(B,B.state,null),Tl(l,w,B,O),B.state=l.memoizedState),typeof B.componentDidMount=="function"&&(l.flags|=4194308)}function Ps(l,c){try{var w="",O=c;do w+=te(O),O=O.return;while(O);var B=w}catch(j){B=`
7
+ Error generating stack: `+j.message+`
8
+ `+j.stack}return{value:l,source:c,stack:B,digest:null}}function Rf(l,c,w){return{value:l,source:null,stack:w??null,digest:c??null}}function Bl(l,c){try{console.error(c.value)}catch(w){setTimeout(function(){throw w})}}var $0=typeof WeakMap=="function"?WeakMap:Map;function Cm(l,c,w){w=wa(-1,w),w.tag=3,w.payload={element:null};var O=c.value;return w.callback=function(){Mm||(Mm=!0,J0=O),Bl(l,c)},w}function m(l,c,w){w=wa(-1,w),w.tag=3;var O=l.type.getDerivedStateFromError;if(typeof O=="function"){var B=c.value;w.payload=function(){return O(B)},w.callback=function(){Bl(l,c)}}var j=l.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(w.callback=function(){Bl(l,c),typeof O!="function"&&(jl===null?jl=new Set([this]):jl.add(this));var re=c.stack;this.componentDidCatch(c.value,{componentStack:re!==null?re:""})}),w}function g(l,c,w){var O=l.pingCache;if(O===null){O=l.pingCache=new $0;var B=new Set;O.set(c,B)}else B=O.get(c),B===void 0&&(B=new Set,O.set(c,B));B.has(w)||(B.add(w),l=E6.bind(null,l,c,w),c.then(l,l))}function C(l){do{var c;if((c=l.tag===13)&&(c=l.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return l;l=l.return}while(l!==null);return null}function M(l,c,w,O,B){return(l.mode&1)===0?(l===c?l.flags|=65536:(l.flags|=128,w.flags|=131072,w.flags&=-52805,w.tag===1&&(w.alternate===null?w.tag=17:(c=wa(-1,1),c.tag=2,xa(w,c,1))),w.lanes|=1),l):(l.flags|=65536,l.lanes=B,l)}var z=_.ReactCurrentOwner,G=!1;function ie(l,c,w,O){c.child=l===null?Oi(c,null,w,O):Ss(c,l.child,w,O)}function Se(l,c,w,O,B){w=w.render;var j=c.ref;return Wa(c,B),O=Il(l,c,w,O,j,B),w=Rl(),l!==null&&!G?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~B,On(l,c,B)):(rr&&w&&kl(c),c.flags|=1,ie(l,c,O,B),c.child)}function Ne(l,c,w,O,B){if(l===null){var j=w.type;return typeof j=="function"&&!o1(j)&&j.defaultProps===void 0&&w.compare===null&&w.defaultProps===void 0?(c.tag=15,c.type=j,Ge(l,c,j,O,B)):(l=zm(w.type,null,O,c,c.mode,B),l.ref=c.ref,l.return=c,c.child=l)}if(j=l.child,(l.lanes&B)===0){var re=j.memoizedProps;if(w=w.compare,w=w!==null?w:ss,w(re,O)&&l.ref===c.ref)return On(l,c,B)}return c.flags|=1,l=ql(j,O),l.ref=c.ref,l.return=c,c.child=l}function Ge(l,c,w,O,B){if(l!==null){var j=l.memoizedProps;if(ss(j,O)&&l.ref===c.ref)if(G=!1,c.pendingProps=O=j,(l.lanes&B)!==0)(l.flags&131072)!==0&&(G=!0);else return c.lanes=l.lanes,On(l,c,B)}return ot(l,c,w,O,B)}function mt(l,c,w){var O=c.pendingProps,B=O.children,j=l!==null?l.memoizedState:null;if(O.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},cr(Df,Qi),Qi|=w;else{if((w&1073741824)===0)return l=j!==null?j.baseLanes|w:w,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:l,cachePool:null,transitions:null},c.updateQueue=null,cr(Df,Qi),Qi|=l,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},O=j!==null?j.baseLanes:w,cr(Df,Qi),Qi|=O}else j!==null?(O=j.baseLanes|w,c.memoizedState=null):O=w,cr(Df,Qi),Qi|=O;return ie(l,c,B,w),c.child}function Mt(l,c){var w=c.ref;(l===null&&w!==null||l!==null&&l.ref!==w)&&(c.flags|=512,c.flags|=2097152)}function ot(l,c,w,O,B){var j=Pn(w)?_o:yn.current;return j=gs(c,j),Wa(c,B),w=Il(l,c,w,O,j,B),O=Rl(),l!==null&&!G?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~B,On(l,c,B)):(rr&&O&&kl(c),c.flags|=1,ie(l,c,w,B),c.child)}function gr(l,c,w,O,B){if(Pn(w)){var j=!0;ys(c)}else j=!1;if(Wa(c,B),c.stateNode===null)qt(l,c),Tm(c,w,O),If(c,w,O,B),O=!0;else if(l===null){var re=c.stateNode,ce=c.memoizedProps;re.props=ce;var ye=re.context,De=w.contextType;typeof De=="object"&&De!==null?De=Bn(De):(De=Pn(w)?_o:yn.current,De=gs(c,De));var He=w.getDerivedStateFromProps,We=typeof He=="function"||typeof re.getSnapshotBeforeUpdate=="function";We||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ce!==O||ye!==De)&&bh(c,re,O,De),ba=!1;var Ue=c.memoizedState;re.state=Ue,Tl(c,O,re,B),ye=c.memoizedState,ce!==O||Ue!==ye||_n.current||ba?(typeof He=="function"&&(Ll(c,w,He,O),ye=c.memoizedState),(ce=ba||Af(c,w,ce,O,Ue,ye,De))?(We||typeof re.UNSAFE_componentWillMount!="function"&&typeof re.componentWillMount!="function"||(typeof re.componentWillMount=="function"&&re.componentWillMount(),typeof re.UNSAFE_componentWillMount=="function"&&re.UNSAFE_componentWillMount()),typeof re.componentDidMount=="function"&&(c.flags|=4194308)):(typeof re.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=O,c.memoizedState=ye),re.props=O,re.state=ye,re.context=De,O=ce):(typeof re.componentDidMount=="function"&&(c.flags|=4194308),O=!1)}else{re=c.stateNode,Sf(l,c),ce=c.memoizedProps,De=c.type===c.elementType?ce:vn(c.type,ce),re.props=De,We=c.pendingProps,Ue=re.context,ye=w.contextType,typeof ye=="object"&&ye!==null?ye=Bn(ye):(ye=Pn(w)?_o:yn.current,ye=gs(c,ye));var ft=w.getDerivedStateFromProps;(He=typeof ft=="function"||typeof re.getSnapshotBeforeUpdate=="function")||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ce!==We||Ue!==ye)&&bh(c,re,O,ye),ba=!1,Ue=c.memoizedState,re.state=Ue,Tl(c,O,re,B);var yt=c.memoizedState;ce!==We||Ue!==yt||_n.current||ba?(typeof ft=="function"&&(Ll(c,w,ft,O),yt=c.memoizedState),(De=ba||Af(c,w,De,O,Ue,yt,ye)||!1)?(He||typeof re.UNSAFE_componentWillUpdate!="function"&&typeof re.componentWillUpdate!="function"||(typeof re.componentWillUpdate=="function"&&re.componentWillUpdate(O,yt,ye),typeof re.UNSAFE_componentWillUpdate=="function"&&re.UNSAFE_componentWillUpdate(O,yt,ye)),typeof re.componentDidUpdate=="function"&&(c.flags|=4),typeof re.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof re.componentDidUpdate!="function"||ce===l.memoizedProps&&Ue===l.memoizedState||(c.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ce===l.memoizedProps&&Ue===l.memoizedState||(c.flags|=1024),c.memoizedProps=O,c.memoizedState=yt),re.props=O,re.state=yt,re.context=ye,O=De):(typeof re.componentDidUpdate!="function"||ce===l.memoizedProps&&Ue===l.memoizedState||(c.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ce===l.memoizedProps&&Ue===l.memoizedState||(c.flags|=1024),O=!1)}return nr(l,c,w,O,j,B)}function nr(l,c,w,O,B,j){Mt(l,c);var re=(c.flags&128)!==0;if(!O&&!re)return B&&gm(c,w,!1),On(l,c,j);O=c.stateNode,z.current=c;var ce=re&&typeof w.getDerivedStateFromError!="function"?null:O.render();return c.flags|=1,l!==null&&re?(c.child=Ss(c,l.child,null,j),c.child=Ss(c,null,ce,j)):ie(l,c,ce,j),c.memoizedState=O.state,B&&gm(c,w,!0),c.child}function jn(l){var c=l.stateNode;c.pendingContext?sh(l,c.pendingContext,c.pendingContext!==c.context):c.context&&sh(l,c.context,!1),Oo(l,c.containerInfo)}function Sa(l,c,w,O,B){return xs(),qu(B),c.flags|=256,ie(l,c,w,O),c.child}var Me={dehydrated:null,treeContext:null,retryLane:0};function _e(l){return{baseLanes:l,cachePool:null,transitions:null}}function ze(l,c,w){var O=c.pendingProps,B=mr.current,j=!1,re=(c.flags&128)!==0,ce;if((ce=re)||(ce=l!==null&&l.memoizedState===null?!1:(B&2)!==0),ce?(j=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(B|=1),cr(mr,B&1),l===null)return _l(c),l=c.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((c.mode&1)===0?c.lanes=1:l.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(re=O.children,l=O.fallback,j?(O=c.mode,j=c.child,re={mode:"hidden",children:re},(O&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=re):j=jm(re,O,0,null),l=tc(l,O,w,null),j.return=c,l.return=c,j.sibling=l,c.child=j,c.child.memoizedState=_e(w),c.memoizedState=Me,l):st(c,re));if(B=l.memoizedState,B!==null&&(ce=B.dehydrated,ce!==null))return Lt(l,c,re,O,ce,B,w);if(j){j=O.fallback,re=c.mode,B=l.child,ce=B.sibling;var ye={mode:"hidden",children:O.children};return(re&1)===0&&c.child!==B?(O=c.child,O.childLanes=0,O.pendingProps=ye,c.deletions=null):(O=ql(B,ye),O.subtreeFlags=B.subtreeFlags&14680064),ce!==null?j=ql(ce,j):(j=tc(j,re,w,null),j.flags|=2),j.return=c,O.return=c,O.sibling=j,c.child=O,O=j,j=c.child,re=l.child.memoizedState,re=re===null?_e(w):{baseLanes:re.baseLanes|w,cachePool:null,transitions:re.transitions},j.memoizedState=re,j.childLanes=l.childLanes&~w,c.memoizedState=Me,O}return j=l.child,l=j.sibling,O=ql(j,{mode:"visible",children:O.children}),(c.mode&1)===0&&(O.lanes=w),O.return=c,O.sibling=null,l!==null&&(w=c.deletions,w===null?(c.deletions=[l],c.flags|=16):w.push(l)),c.child=O,c.memoizedState=null,O}function st(l,c){return c=jm({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function St(l,c,w,O){return O!==null&&qu(O),Ss(c,l.child,null,w),l=st(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function Lt(l,c,w,O,B,j,re){if(w)return c.flags&256?(c.flags&=-257,O=Rf(Error(r(422))),St(l,c,re,O)):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(j=O.fallback,B=c.mode,O=jm({mode:"visible",children:O.children},B,0,null),j=tc(j,B,re,null),j.flags|=2,O.return=c,j.return=c,O.sibling=j,c.child=O,(c.mode&1)!==0&&Ss(c,l.child,null,re),c.child.memoizedState=_e(re),c.memoizedState=Me,j);if((c.mode&1)===0)return St(l,c,re,null);if(B.data==="$!"){if(O=B.nextSibling&&B.nextSibling.dataset,O)var ce=O.dgst;return O=ce,j=Error(r(419)),O=Rf(j,O,void 0),St(l,c,re,O)}if(ce=(re&l.childLanes)!==0,G||ce){if(O=An,O!==null){switch(re&-re){case 4:B=2;break;case 16:B=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:B=32;break;case 536870912:B=268435456;break;default:B=0}B=(B&(O.suspendedLanes|re))!==0?0:B,B!==0&&B!==j.retryLane&&(j.retryLane=B,bi(l,B),Za(O,l,B,-1))}return a1(),O=Rf(Error(r(421))),St(l,c,re,O)}return B.data==="$?"?(c.flags|=128,c.child=l.child,c=T6.bind(null,l),B._reactRetry=c,null):(l=j.treeContext,rt=pa(B.nextSibling),gi=c,rr=!0,yi=null,l!==null&&(Ln[Fn++]=mi,Ln[Fn++]=Pr,Ln[Fn++]=Co,mi=l.id,Pr=l.overflow,Co=c),c=st(c,O.children),c.flags|=4096,c)}function Dt(l,c,w){l.lanes|=c;var O=l.alternate;O!==null&&(O.lanes|=c),xf(l.return,c,w)}function Wt(l,c,w,O,B){var j=l.memoizedState;j===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:O,tail:w,tailMode:B}:(j.isBackwards=c,j.rendering=null,j.renderingStartTime=0,j.last=O,j.tail=w,j.tailMode=B)}function tn(l,c,w){var O=c.pendingProps,B=O.revealOrder,j=O.tail;if(ie(l,c,O.children,w),O=mr.current,(O&2)!==0)O=O&1|2,c.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=c.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&Dt(l,w,c);else if(l.tag===19)Dt(l,w,c);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===c)break e;for(;l.sibling===null;){if(l.return===null||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}O&=1}if(cr(mr,O),(c.mode&1)===0)c.memoizedState=null;else switch(B){case"forwards":for(w=c.child,B=null;w!==null;)l=w.alternate,l!==null&&Ol(l)===null&&(B=w),w=w.sibling;w=B,w===null?(B=c.child,c.child=null):(B=w.sibling,w.sibling=null),Wt(c,!1,B,w,j);break;case"backwards":for(w=null,B=c.child,c.child=null;B!==null;){if(l=B.alternate,l!==null&&Ol(l)===null){c.child=B;break}l=B.sibling,B.sibling=w,w=B,B=l}Wt(c,!0,w,null,j);break;case"together":Wt(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function qt(l,c){(c.mode&1)===0&&l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2)}function On(l,c,w){if(l!==null&&(c.dependencies=l.dependencies),Qu|=c.lanes,(w&c.childLanes)===0)return null;if(l!==null&&c.child!==l.child)throw Error(r(153));if(c.child!==null){for(l=c.child,w=ql(l,l.pendingProps),c.child=w,w.return=c;l.sibling!==null;)l=l.sibling,w=w.sibling=ql(l,l.pendingProps),w.return=c;w.sibling=null}return c.child}function q0(l,c,w){switch(c.tag){case 3:jn(c),xs();break;case 5:Cl(c);break;case 1:Pn(c.type)&&ys(c);break;case 4:Oo(c,c.stateNode.containerInfo);break;case 10:var O=c.type._context,B=c.memoizedProps.value;cr(Vu,O._currentValue),O._currentValue=B;break;case 13:if(O=c.memoizedState,O!==null)return O.dehydrated!==null?(cr(mr,mr.current&1),c.flags|=128,null):(w&c.child.childLanes)!==0?ze(l,c,w):(cr(mr,mr.current&1),l=On(l,c,w),l!==null?l.sibling:null);cr(mr,mr.current&1);break;case 19:if(O=(w&c.childLanes)!==0,(l.flags&128)!==0){if(O)return tn(l,c,w);c.flags|=128}if(B=c.memoizedState,B!==null&&(B.rendering=null,B.tail=null,B.lastEffect=null),cr(mr,mr.current),O)break;return null;case 22:case 23:return c.lanes=0,mt(l,c,w)}return On(l,c,w)}var fb,V0,db,hb;fb=function(l,c){for(var w=c.child;w!==null;){if(w.tag===5||w.tag===6)l.appendChild(w.stateNode);else if(w.tag!==4&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===c)break;for(;w.sibling===null;){if(w.return===null||w.return===c)return;w=w.return}w.sibling.return=w.return,w=w.sibling}},V0=function(){},db=function(l,c,w,O){var B=l.memoizedProps;if(B!==O){l=c.stateNode,Jr(fr.current);var j=null;switch(w){case"input":B=$e(l,B),O=$e(l,O),j=[];break;case"select":B=U({},B,{value:void 0}),O=U({},O,{value:void 0}),j=[];break;case"textarea":B=ae(l,B),O=ae(l,O),j=[];break;default:typeof B.onClick!="function"&&typeof O.onClick=="function"&&(l.onclick=hs)}ve(w,O);var re;w=null;for(De in B)if(!O.hasOwnProperty(De)&&B.hasOwnProperty(De)&&B[De]!=null)if(De==="style"){var ce=B[De];for(re in ce)ce.hasOwnProperty(re)&&(w||(w={}),w[re]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(i.hasOwnProperty(De)?j||(j=[]):(j=j||[]).push(De,null));for(De in O){var ye=O[De];if(ce=B?.[De],O.hasOwnProperty(De)&&ye!==ce&&(ye!=null||ce!=null))if(De==="style")if(ce){for(re in ce)!ce.hasOwnProperty(re)||ye&&ye.hasOwnProperty(re)||(w||(w={}),w[re]="");for(re in ye)ye.hasOwnProperty(re)&&ce[re]!==ye[re]&&(w||(w={}),w[re]=ye[re])}else w||(j||(j=[]),j.push(De,w)),w=ye;else De==="dangerouslySetInnerHTML"?(ye=ye?ye.__html:void 0,ce=ce?ce.__html:void 0,ye!=null&&ce!==ye&&(j=j||[]).push(De,ye)):De==="children"?typeof ye!="string"&&typeof ye!="number"||(j=j||[]).push(De,""+ye):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(ye!=null&&De==="onScroll"&&hr("scroll",l),j||ce===ye||(j=[])):(j=j||[]).push(De,ye))}w&&(j=j||[]).push("style",w);var De=j;(c.updateQueue=De)&&(c.flags|=4)}},hb=function(l,c,w,O){w!==O&&(c.flags|=4)};function wh(l,c){if(!rr)switch(l.tailMode){case"hidden":c=l.tail;for(var w=null;c!==null;)c.alternate!==null&&(w=c),c=c.sibling;w===null?l.tail=null:w.sibling=null;break;case"collapsed":w=l.tail;for(var O=null;w!==null;)w.alternate!==null&&(O=w),w=w.sibling;O===null?c||l.tail===null?l.tail=null:l.tail.sibling=null:O.sibling=null}}function Jn(l){var c=l.alternate!==null&&l.alternate.child===l.child,w=0,O=0;if(c)for(var B=l.child;B!==null;)w|=B.lanes|B.childLanes,O|=B.subtreeFlags&14680064,O|=B.flags&14680064,B.return=l,B=B.sibling;else for(B=l.child;B!==null;)w|=B.lanes|B.childLanes,O|=B.subtreeFlags,O|=B.flags,B.return=l,B=B.sibling;return l.subtreeFlags|=O,l.childLanes=w,c}function g6(l,c,w){var O=c.pendingProps;switch(fn(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jn(c),null;case 1:return Pn(c.type)&&xl(),Jn(c),null;case 3:return O=c.stateNode,Tr(),pr(_n),pr(yn),En(),O.pendingContext&&(O.context=O.pendingContext,O.pendingContext=null),(l===null||l.child===null)&&($u(c)?c.flags|=4:l===null||l.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,yi!==null&&(r1(yi),yi=null))),V0(l,c),Jn(c),null;case 5:Ga(c);var B=Jr(Ur.current);if(w=c.type,l!==null&&c.stateNode!=null)db(l,c,w,O,B),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!O){if(c.stateNode===null)throw Error(r(166));return Jn(c),null}if(l=Jr(fr.current),$u(c)){O=c.stateNode,w=c.type;var j=c.memoizedProps;switch(O[Ci]=c,O[ju]=j,l=(c.mode&1)!==0,w){case"dialog":hr("cancel",O),hr("close",O);break;case"iframe":case"object":case"embed":hr("load",O);break;case"video":case"audio":for(B=0;B<xo.length;B++)hr(xo[B],O);break;case"source":hr("error",O);break;case"img":case"image":case"link":hr("error",O),hr("load",O);break;case"details":hr("toggle",O);break;case"input":Xe(O,j),hr("invalid",O);break;case"select":O._wrapperState={wasMultiple:!!j.multiple},hr("invalid",O);break;case"textarea":xe(O,j),hr("invalid",O)}ve(w,j),B=null;for(var re in j)if(j.hasOwnProperty(re)){var ce=j[re];re==="children"?typeof ce=="string"?O.textContent!==ce&&(j.suppressHydrationWarning!==!0&&Bu(O.textContent,ce,l),B=["children",ce]):typeof ce=="number"&&O.textContent!==""+ce&&(j.suppressHydrationWarning!==!0&&Bu(O.textContent,ce,l),B=["children",""+ce]):i.hasOwnProperty(re)&&ce!=null&&re==="onScroll"&&hr("scroll",O)}switch(w){case"input":Ee(O),ge(O,j,!0);break;case"textarea":Ee(O),Be(O);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(O.onclick=hs)}O=B,c.updateQueue=O,O!==null&&(c.flags|=4)}else{re=B.nodeType===9?B:B.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=ct(w)),l==="http://www.w3.org/1999/xhtml"?w==="script"?(l=re.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof O.is=="string"?l=re.createElement(w,{is:O.is}):(l=re.createElement(w),w==="select"&&(re=l,O.multiple?re.multiple=!0:O.size&&(re.size=O.size))):l=re.createElementNS(l,w),l[Ci]=c,l[ju]=O,fb(l,c,!1,!1),c.stateNode=l;e:{switch(re=Ce(w,O),w){case"dialog":hr("cancel",l),hr("close",l),B=O;break;case"iframe":case"object":case"embed":hr("load",l),B=O;break;case"video":case"audio":for(B=0;B<xo.length;B++)hr(xo[B],l);B=O;break;case"source":hr("error",l),B=O;break;case"img":case"image":case"link":hr("error",l),hr("load",l),B=O;break;case"details":hr("toggle",l),B=O;break;case"input":Xe(l,O),B=$e(l,O),hr("invalid",l);break;case"option":B=O;break;case"select":l._wrapperState={wasMultiple:!!O.multiple},B=U({},O,{value:void 0}),hr("invalid",l);break;case"textarea":xe(l,O),B=ae(l,O),hr("invalid",l);break;default:B=O}ve(w,B),ce=B;for(j in ce)if(ce.hasOwnProperty(j)){var ye=ce[j];j==="style"?Ze(l,ye):j==="dangerouslySetInnerHTML"?(ye=ye?ye.__html:void 0,ye!=null&&Ve(l,ye)):j==="children"?typeof ye=="string"?(w!=="textarea"||ye!=="")&&le(l,ye):typeof ye=="number"&&le(l,""+ye):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(i.hasOwnProperty(j)?ye!=null&&j==="onScroll"&&hr("scroll",l):ye!=null&&P(l,j,ye,re))}switch(w){case"input":Ee(l),ge(l,O,!1);break;case"textarea":Ee(l),Be(l);break;case"option":O.value!=null&&l.setAttribute("value",""+ue(O.value));break;case"select":l.multiple=!!O.multiple,j=O.value,j!=null?Te(l,!!O.multiple,j,!1):O.defaultValue!=null&&Te(l,!!O.multiple,O.defaultValue,!0);break;default:typeof B.onClick=="function"&&(l.onclick=hs)}switch(w){case"button":case"input":case"select":case"textarea":O=!!O.autoFocus;break e;case"img":O=!0;break e;default:O=!1}}O&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Jn(c),null;case 6:if(l&&c.stateNode!=null)hb(l,c,l.memoizedProps,O);else{if(typeof O!="string"&&c.stateNode===null)throw Error(r(166));if(w=Jr(Ur.current),Jr(fr.current),$u(c)){if(O=c.stateNode,w=c.memoizedProps,O[Ci]=c,(j=O.nodeValue!==w)&&(l=gi,l!==null))switch(l.tag){case 3:Bu(O.nodeValue,w,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Bu(O.nodeValue,w,(l.mode&1)!==0)}j&&(c.flags|=4)}else O=(w.nodeType===9?w:w.ownerDocument).createTextNode(O),O[Ci]=c,c.stateNode=O}return Jn(c),null;case 13:if(pr(mr),O=c.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(rr&&rt!==null&&(c.mode&1)!==0&&(c.flags&128)===0)uh(),xs(),c.flags|=98560,j=!1;else if(j=$u(c),O!==null&&O.dehydrated!==null){if(l===null){if(!j)throw Error(r(318));if(j=c.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(r(317));j[Ci]=c}else xs(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Jn(c),j=!1}else yi!==null&&(r1(yi),yi=null),j=!0;if(!j)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=w,c):(O=O!==null,O!==(l!==null&&l.memoizedState!==null)&&O&&(c.child.flags|=8192,(c.mode&1)!==0&&(l===null||(mr.current&1)!==0?bn===0&&(bn=3):a1())),c.updateQueue!==null&&(c.flags|=4),Jn(c),null);case 4:return Tr(),V0(l,c),l===null&&fs(c.stateNode.containerInfo),Jn(c),null;case 10:return wf(c.type._context),Jn(c),null;case 17:return Pn(c.type)&&xl(),Jn(c),null;case 19:if(pr(mr),j=c.memoizedState,j===null)return Jn(c),null;if(O=(c.flags&128)!==0,re=j.rendering,re===null)if(O)wh(j,!1);else{if(bn!==0||l!==null&&(l.flags&128)!==0)for(l=c.child;l!==null;){if(re=Ol(l),re!==null){for(c.flags|=128,wh(j,!1),O=re.updateQueue,O!==null&&(c.updateQueue=O,c.flags|=4),c.subtreeFlags=0,O=w,w=c.child;w!==null;)j=w,l=O,j.flags&=14680066,re=j.alternate,re===null?(j.childLanes=0,j.lanes=l,j.child=null,j.subtreeFlags=0,j.memoizedProps=null,j.memoizedState=null,j.updateQueue=null,j.dependencies=null,j.stateNode=null):(j.childLanes=re.childLanes,j.lanes=re.lanes,j.child=re.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=re.memoizedProps,j.memoizedState=re.memoizedState,j.updateQueue=re.updateQueue,j.type=re.type,l=re.dependencies,j.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),w=w.sibling;return cr(mr,mr.current&1|2),c.child}l=l.sibling}j.tail!==null&&zr()>Nf&&(c.flags|=128,O=!0,wh(j,!1),c.lanes=4194304)}else{if(!O)if(l=Ol(re),l!==null){if(c.flags|=128,O=!0,w=l.updateQueue,w!==null&&(c.updateQueue=w,c.flags|=4),wh(j,!0),j.tail===null&&j.tailMode==="hidden"&&!re.alternate&&!rr)return Jn(c),null}else 2*zr()-j.renderingStartTime>Nf&&w!==1073741824&&(c.flags|=128,O=!0,wh(j,!1),c.lanes=4194304);j.isBackwards?(re.sibling=c.child,c.child=re):(w=j.last,w!==null?w.sibling=re:c.child=re,j.last=re)}return j.tail!==null?(c=j.tail,j.rendering=c,j.tail=c.sibling,j.renderingStartTime=zr(),c.sibling=null,w=mr.current,cr(mr,O?w&1|2:w&1),c):(Jn(c),null);case 22:case 23:return i1(),O=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==O&&(c.flags|=8192),O&&(c.mode&1)!==0?(Qi&1073741824)!==0&&(Jn(c),c.subtreeFlags&6&&(c.flags|=8192)):Jn(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function y6(l,c){switch(fn(c),c.tag){case 1:return Pn(c.type)&&xl(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Tr(),pr(_n),pr(yn),En(),l=c.flags,(l&65536)!==0&&(l&128)===0?(c.flags=l&-65537|128,c):null;case 5:return Ga(c),null;case 13:if(pr(mr),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(r(340));xs()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return pr(mr),null;case 4:return Tr(),null;case 10:return wf(c.type._context),null;case 22:case 23:return i1(),null;case 24:return null;default:return null}}var Om=!1,ei=!1,v6=typeof WeakSet=="function"?WeakSet:Set,gt=null;function Mf(l,c){var w=l.ref;if(w!==null)if(typeof w=="function")try{w(null)}catch(O){Yr(l,c,O)}else w.current=null}function W0(l,c,w){try{w()}catch(O){Yr(l,c,O)}}var pb=!1;function b6(l,c){if(nh=Vc,l=Qr(),yl(l)){if("selectionStart"in l)var w={start:l.selectionStart,end:l.selectionEnd};else e:{w=(w=l.ownerDocument)&&w.defaultView||window;var O=w.getSelection&&w.getSelection();if(O&&O.rangeCount!==0){w=O.anchorNode;var B=O.anchorOffset,j=O.focusNode;O=O.focusOffset;try{w.nodeType,j.nodeType}catch{w=null;break e}var re=0,ce=-1,ye=-1,De=0,He=0,We=l,Ue=null;t:for(;;){for(var ft;We!==w||B!==0&&We.nodeType!==3||(ce=re+B),We!==j||O!==0&&We.nodeType!==3||(ye=re+O),We.nodeType===3&&(re+=We.nodeValue.length),(ft=We.firstChild)!==null;)Ue=We,We=ft;for(;;){if(We===l)break t;if(Ue===w&&++De===B&&(ce=re),Ue===j&&++He===O&&(ye=re),(ft=We.nextSibling)!==null)break;We=Ue,Ue=We.parentNode}We=ft}w=ce===-1||ye===-1?null:{start:ce,end:ye}}else w=null}w=w||{start:0,end:0}}else w=null;for(ih={focusedElem:l,selectionRange:w},Vc=!1,gt=c;gt!==null;)if(c=gt,l=c.child,(c.subtreeFlags&1028)!==0&&l!==null)l.return=c,gt=l;else for(;gt!==null;){c=gt;try{var yt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(yt!==null){var vt=yt.memoizedProps,rn=yt.memoizedState,Ae=c.stateNode,we=Ae.getSnapshotBeforeUpdate(c.elementType===c.type?vt:vn(c.type,vt),rn);Ae.__reactInternalSnapshotBeforeUpdate=we}break;case 3:var Re=c.stateNode.containerInfo;Re.nodeType===1?Re.textContent="":Re.nodeType===9&&Re.documentElement&&Re.removeChild(Re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Ke){Yr(c,c.return,Ke)}if(l=c.sibling,l!==null){l.return=c.return,gt=l;break}gt=c.return}return yt=pb,pb=!1,yt}function xh(l,c,w){var O=c.updateQueue;if(O=O!==null?O.lastEffect:null,O!==null){var B=O=O.next;do{if((B.tag&l)===l){var j=B.destroy;B.destroy=void 0,j!==void 0&&W0(c,w,j)}B=B.next}while(B!==O)}}function Am(l,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var w=c=c.next;do{if((w.tag&l)===l){var O=w.create;w.destroy=O()}w=w.next}while(w!==c)}}function G0(l){var c=l.ref;if(c!==null){var w=l.stateNode;l.tag,l=w,typeof c=="function"?c(l):c.current=l}}function mb(l){var c=l.alternate;c!==null&&(l.alternate=null,mb(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&(delete c[Ci],delete c[ju],delete c[df],delete c[pm],delete c[mm])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function gb(l){return l.tag===5||l.tag===3||l.tag===4}function yb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||gb(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function X0(l,c,w){var O=l.tag;if(O===5||O===6)l=l.stateNode,c?w.nodeType===8?w.parentNode.insertBefore(l,c):w.insertBefore(l,c):(w.nodeType===8?(c=w.parentNode,c.insertBefore(l,w)):(c=w,c.appendChild(l)),w=w._reactRootContainer,w!=null||c.onclick!==null||(c.onclick=hs));else if(O!==4&&(l=l.child,l!==null))for(X0(l,c,w),l=l.sibling;l!==null;)X0(l,c,w),l=l.sibling}function Y0(l,c,w){var O=l.tag;if(O===5||O===6)l=l.stateNode,c?w.insertBefore(l,c):w.appendChild(l);else if(O!==4&&(l=l.child,l!==null))for(Y0(l,c,w),l=l.sibling;l!==null;)Y0(l,c,w),l=l.sibling}var Un=null,Ka=!1;function zl(l,c,w){for(w=w.child;w!==null;)vb(l,c,w),w=w.sibling}function vb(l,c,w){if(hn&&typeof hn.onCommitFiberUnmount=="function")try{hn.onCommitFiberUnmount(Fa,w)}catch{}switch(w.tag){case 5:ei||Mf(w,c);case 6:var O=Un,B=Ka;Un=null,zl(l,c,w),Un=O,Ka=B,Un!==null&&(Ka?(l=Un,w=w.stateNode,l.nodeType===8?l.parentNode.removeChild(w):l.removeChild(w)):Un.removeChild(w.stateNode));break;case 18:Un!==null&&(Ka?(l=Un,w=w.stateNode,l.nodeType===8?ff(l.parentNode,w):l.nodeType===1&&ff(l,w),Yn(l)):ff(Un,w.stateNode));break;case 4:O=Un,B=Ka,Un=w.stateNode.containerInfo,Ka=!0,zl(l,c,w),Un=O,Ka=B;break;case 0:case 11:case 14:case 15:if(!ei&&(O=w.updateQueue,O!==null&&(O=O.lastEffect,O!==null))){B=O=O.next;do{var j=B,re=j.destroy;j=j.tag,re!==void 0&&((j&2)!==0||(j&4)!==0)&&W0(w,c,re),B=B.next}while(B!==O)}zl(l,c,w);break;case 1:if(!ei&&(Mf(w,c),O=w.stateNode,typeof O.componentWillUnmount=="function"))try{O.props=w.memoizedProps,O.state=w.memoizedState,O.componentWillUnmount()}catch(ce){Yr(w,c,ce)}zl(l,c,w);break;case 21:zl(l,c,w);break;case 22:w.mode&1?(ei=(O=ei)||w.memoizedState!==null,zl(l,c,w),ei=O):zl(l,c,w);break;default:zl(l,c,w)}}function bb(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var w=l.stateNode;w===null&&(w=l.stateNode=new v6),c.forEach(function(O){var B=C6.bind(null,l,O);w.has(O)||(w.add(O),O.then(B,B))})}}function Qa(l,c){var w=c.deletions;if(w!==null)for(var O=0;O<w.length;O++){var B=w[O];try{var j=l,re=c,ce=re;e:for(;ce!==null;){switch(ce.tag){case 5:Un=ce.stateNode,Ka=!1;break e;case 3:Un=ce.stateNode.containerInfo,Ka=!0;break e;case 4:Un=ce.stateNode.containerInfo,Ka=!0;break e}ce=ce.return}if(Un===null)throw Error(r(160));vb(j,re,B),Un=null,Ka=!1;var ye=B.alternate;ye!==null&&(ye.return=null),B.return=null}catch(De){Yr(B,c,De)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)wb(c,l),c=c.sibling}function wb(l,c){var w=l.alternate,O=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(Qa(c,l),Do(l),O&4){try{xh(3,l,l.return),Am(3,l)}catch(vt){Yr(l,l.return,vt)}try{xh(5,l,l.return)}catch(vt){Yr(l,l.return,vt)}}break;case 1:Qa(c,l),Do(l),O&512&&w!==null&&Mf(w,w.return);break;case 5:if(Qa(c,l),Do(l),O&512&&w!==null&&Mf(w,w.return),l.flags&32){var B=l.stateNode;try{le(B,"")}catch(vt){Yr(l,l.return,vt)}}if(O&4&&(B=l.stateNode,B!=null)){var j=l.memoizedProps,re=w!==null?w.memoizedProps:j,ce=l.type,ye=l.updateQueue;if(l.updateQueue=null,ye!==null)try{ce==="input"&&j.type==="radio"&&j.name!=null&&dt(B,j),Ce(ce,re);var De=Ce(ce,j);for(re=0;re<ye.length;re+=2){var He=ye[re],We=ye[re+1];He==="style"?Ze(B,We):He==="dangerouslySetInnerHTML"?Ve(B,We):He==="children"?le(B,We):P(B,He,We,De)}switch(ce){case"input":ke(B,j);break;case"textarea":Oe(B,j);break;case"select":var Ue=B._wrapperState.wasMultiple;B._wrapperState.wasMultiple=!!j.multiple;var ft=j.value;ft!=null?Te(B,!!j.multiple,ft,!1):Ue!==!!j.multiple&&(j.defaultValue!=null?Te(B,!!j.multiple,j.defaultValue,!0):Te(B,!!j.multiple,j.multiple?[]:"",!1))}B[ju]=j}catch(vt){Yr(l,l.return,vt)}}break;case 6:if(Qa(c,l),Do(l),O&4){if(l.stateNode===null)throw Error(r(162));B=l.stateNode,j=l.memoizedProps;try{B.nodeValue=j}catch(vt){Yr(l,l.return,vt)}}break;case 3:if(Qa(c,l),Do(l),O&4&&w!==null&&w.memoizedState.isDehydrated)try{Yn(c.containerInfo)}catch(vt){Yr(l,l.return,vt)}break;case 4:Qa(c,l),Do(l);break;case 13:Qa(c,l),Do(l),B=l.child,B.flags&8192&&(j=B.memoizedState!==null,B.stateNode.isHidden=j,!j||B.alternate!==null&&B.alternate.memoizedState!==null||(Z0=zr())),O&4&&bb(l);break;case 22:if(He=w!==null&&w.memoizedState!==null,l.mode&1?(ei=(De=ei)||He,Qa(c,l),ei=De):Qa(c,l),Do(l),O&8192){if(De=l.memoizedState!==null,(l.stateNode.isHidden=De)&&!He&&(l.mode&1)!==0)for(gt=l,He=l.child;He!==null;){for(We=gt=He;gt!==null;){switch(Ue=gt,ft=Ue.child,Ue.tag){case 0:case 11:case 14:case 15:xh(4,Ue,Ue.return);break;case 1:Mf(Ue,Ue.return);var yt=Ue.stateNode;if(typeof yt.componentWillUnmount=="function"){O=Ue,w=Ue.return;try{c=O,yt.props=c.memoizedProps,yt.state=c.memoizedState,yt.componentWillUnmount()}catch(vt){Yr(O,w,vt)}}break;case 5:Mf(Ue,Ue.return);break;case 22:if(Ue.memoizedState!==null){kb(We);continue}}ft!==null?(ft.return=Ue,gt=ft):kb(We)}He=He.sibling}e:for(He=null,We=l;;){if(We.tag===5){if(He===null){He=We;try{B=We.stateNode,De?(j=B.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(ce=We.stateNode,ye=We.memoizedProps.style,re=ye!=null&&ye.hasOwnProperty("display")?ye.display:null,ce.style.display=at("display",re))}catch(vt){Yr(l,l.return,vt)}}}else if(We.tag===6){if(He===null)try{We.stateNode.nodeValue=De?"":We.memoizedProps}catch(vt){Yr(l,l.return,vt)}}else if((We.tag!==22&&We.tag!==23||We.memoizedState===null||We===l)&&We.child!==null){We.child.return=We,We=We.child;continue}if(We===l)break e;for(;We.sibling===null;){if(We.return===null||We.return===l)break e;He===We&&(He=null),We=We.return}He===We&&(He=null),We.sibling.return=We.return,We=We.sibling}}break;case 19:Qa(c,l),Do(l),O&4&&bb(l);break;case 21:break;default:Qa(c,l),Do(l)}}function Do(l){var c=l.flags;if(c&2){try{e:{for(var w=l.return;w!==null;){if(gb(w)){var O=w;break e}w=w.return}throw Error(r(160))}switch(O.tag){case 5:var B=O.stateNode;O.flags&32&&(le(B,""),O.flags&=-33);var j=yb(l);Y0(l,j,B);break;case 3:case 4:var re=O.stateNode.containerInfo,ce=yb(l);X0(l,ce,re);break;default:throw Error(r(161))}}catch(ye){Yr(l,l.return,ye)}l.flags&=-3}c&4096&&(l.flags&=-4097)}function w6(l,c,w){gt=l,xb(l)}function xb(l,c,w){for(var O=(l.mode&1)!==0;gt!==null;){var B=gt,j=B.child;if(B.tag===22&&O){var re=B.memoizedState!==null||Om;if(!re){var ce=B.alternate,ye=ce!==null&&ce.memoizedState!==null||ei;ce=Om;var De=ei;if(Om=re,(ei=ye)&&!De)for(gt=B;gt!==null;)re=gt,ye=re.child,re.tag===22&&re.memoizedState!==null?_b(B):ye!==null?(ye.return=re,gt=ye):_b(B);for(;j!==null;)gt=j,xb(j),j=j.sibling;gt=B,Om=ce,ei=De}Sb(l)}else(B.subtreeFlags&8772)!==0&&j!==null?(j.return=B,gt=j):Sb(l)}}function Sb(l){for(;gt!==null;){var c=gt;if((c.flags&8772)!==0){var w=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:ei||Am(5,c);break;case 1:var O=c.stateNode;if(c.flags&4&&!ei)if(w===null)O.componentDidMount();else{var B=c.elementType===c.type?w.memoizedProps:vn(c.type,w.memoizedProps);O.componentDidUpdate(B,w.memoizedState,O.__reactInternalSnapshotBeforeUpdate)}var j=c.updateQueue;j!==null&&Nr(c,j,O);break;case 3:var re=c.updateQueue;if(re!==null){if(w=null,c.child!==null)switch(c.child.tag){case 5:w=c.child.stateNode;break;case 1:w=c.child.stateNode}Nr(c,re,w)}break;case 5:var ce=c.stateNode;if(w===null&&c.flags&4){w=ce;var ye=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":ye.autoFocus&&w.focus();break;case"img":ye.src&&(w.src=ye.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var De=c.alternate;if(De!==null){var He=De.memoizedState;if(He!==null){var We=He.dehydrated;We!==null&&Yn(We)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}ei||c.flags&512&&G0(c)}catch(Ue){Yr(c,c.return,Ue)}}if(c===l){gt=null;break}if(w=c.sibling,w!==null){w.return=c.return,gt=w;break}gt=c.return}}function kb(l){for(;gt!==null;){var c=gt;if(c===l){gt=null;break}var w=c.sibling;if(w!==null){w.return=c.return,gt=w;break}gt=c.return}}function _b(l){for(;gt!==null;){var c=gt;try{switch(c.tag){case 0:case 11:case 15:var w=c.return;try{Am(4,c)}catch(ye){Yr(c,w,ye)}break;case 1:var O=c.stateNode;if(typeof O.componentDidMount=="function"){var B=c.return;try{O.componentDidMount()}catch(ye){Yr(c,B,ye)}}var j=c.return;try{G0(c)}catch(ye){Yr(c,j,ye)}break;case 5:var re=c.return;try{G0(c)}catch(ye){Yr(c,re,ye)}}}catch(ye){Yr(c,c.return,ye)}if(c===l){gt=null;break}var ce=c.sibling;if(ce!==null){ce.return=c.return,gt=ce;break}gt=c.return}}var x6=Math.ceil,Im=_.ReactCurrentDispatcher,K0=_.ReactCurrentOwner,ka=_.ReactCurrentBatchConfig,Zt=0,An=null,dn=null,Hn=0,Qi=0,Df=qa(0),bn=0,Sh=null,Qu=0,Rm=0,Q0=0,kh=null,Ii=null,Z0=0,Nf=1/0,Es=null,Mm=!1,J0=null,jl=null,Dm=!1,Ul=null,Nm=0,_h=0,e1=null,Lm=-1,Fm=0;function xi(){return(Zt&6)!==0?zr():Lm!==-1?Lm:Lm=zr()}function Hl(l){return(l.mode&1)===0?1:(Zt&2)!==0&&Hn!==0?Hn&-Hn:ch.transition!==null?(Fm===0&&(Fm=Nd()),Fm):(l=Kt,l!==0||(l=window.event,l=l===void 0?16:Qp(l.type)),l)}function Za(l,c,w,O){if(50<_h)throw _h=0,e1=null,Error(r(185));Pu(l,w,O),((Zt&2)===0||l!==An)&&(l===An&&((Zt&2)===0&&(Rm|=w),bn===4&&$l(l,Hn)),Ri(l,O),w===1&&Zt===0&&(c.mode&1)===0&&(Nf=zr()+500,Sl&&Po()))}function Ri(l,c){var w=l.callbackNode;Wp(l,c);var O=es(l,l===An?Hn:0);if(O===0)w!==null&&_u(w),l.callbackNode=null,l.callbackPriority=0;else if(c=O&-O,l.callbackPriority!==c){if(w!=null&&_u(w),c===1)l.tag===0?Va(Eb.bind(null,l)):Hu(Eb.bind(null,l)),dm(function(){(Zt&6)===0&&Po()}),w=null;else{switch(Eu(O)){case 1:w=Jo;break;case 4:w=Bc;break;case 16:w=il;break;case 536870912:w=zc;break;default:w=il}w=Db(w,Pb.bind(null,l))}l.callbackPriority=c,l.callbackNode=w}}function Pb(l,c){if(Lm=-1,Fm=0,(Zt&6)!==0)throw Error(r(327));var w=l.callbackNode;if(Lf()&&l.callbackNode!==w)return null;var O=es(l,l===An?Hn:0);if(O===0)return null;if((O&30)!==0||(O&l.expiredLanes)!==0||c)c=Bm(l,O);else{c=O;var B=Zt;Zt|=2;var j=Cb();(An!==l||Hn!==c)&&(Es=null,Nf=zr()+500,Ju(l,c));do try{_6();break}catch(ce){Tb(l,ce)}while(!0);bf(),Im.current=j,Zt=B,dn!==null?c=0:(An=null,Hn=0,c=bn)}if(c!==0){if(c===2&&(B=al(l),B!==0&&(O=B,c=t1(l,B))),c===1)throw w=Sh,Ju(l,0),$l(l,O),Ri(l,zr()),w;if(c===6)$l(l,O);else{if(B=l.current.alternate,(O&30)===0&&!S6(B)&&(c=Bm(l,O),c===2&&(j=al(l),j!==0&&(O=j,c=t1(l,j))),c===1))throw w=Sh,Ju(l,0),$l(l,O),Ri(l,zr()),w;switch(l.finishedWork=B,l.finishedLanes=O,c){case 0:case 1:throw Error(r(345));case 2:ec(l,Ii,Es);break;case 3:if($l(l,O),(O&130023424)===O&&(c=Z0+500-zr(),10<c)){if(es(l,0)!==0)break;if(B=l.suspendedLanes,(B&O)!==O){xi(),l.pingedLanes|=l.suspendedLanes&B;break}l.timeoutHandle=pi(ec.bind(null,l,Ii,Es),c);break}ec(l,Ii,Es);break;case 4:if($l(l,O),(O&4194240)===O)break;for(c=l.eventTimes,B=-1;0<O;){var re=31-jt(O);j=1<<re,re=c[re],re>B&&(B=re),O&=~j}if(O=B,O=zr()-O,O=(120>O?120:480>O?480:1080>O?1080:1920>O?1920:3e3>O?3e3:4320>O?4320:1960*x6(O/1960))-O,10<O){l.timeoutHandle=pi(ec.bind(null,l,Ii,Es),O);break}ec(l,Ii,Es);break;case 5:ec(l,Ii,Es);break;default:throw Error(r(329))}}}return Ri(l,zr()),l.callbackNode===w?Pb.bind(null,l):null}function t1(l,c){var w=kh;return l.current.memoizedState.isDehydrated&&(Ju(l,c).flags|=256),l=Bm(l,c),l!==2&&(c=Ii,Ii=w,c!==null&&r1(c)),l}function r1(l){Ii===null?Ii=l:Ii.push.apply(Ii,l)}function S6(l){for(var c=l;;){if(c.flags&16384){var w=c.updateQueue;if(w!==null&&(w=w.stores,w!==null))for(var O=0;O<w.length;O++){var B=w[O],j=B.getSnapshot;B=B.value;try{if(!Qn(j(),B))return!1}catch{return!1}}}if(w=c.child,c.subtreeFlags&16384&&w!==null)w.return=c,c=w;else{if(c===l)break;for(;c.sibling===null;){if(c.return===null||c.return===l)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function $l(l,c){for(c&=~Q0,c&=~Rm,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var w=31-jt(c),O=1<<w;l[w]=-1,c&=~O}}function Eb(l){if((Zt&6)!==0)throw Error(r(327));Lf();var c=es(l,0);if((c&1)===0)return Ri(l,zr()),null;var w=Bm(l,c);if(l.tag!==0&&w===2){var O=al(l);O!==0&&(c=O,w=t1(l,O))}if(w===1)throw w=Sh,Ju(l,0),$l(l,c),Ri(l,zr()),w;if(w===6)throw Error(r(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,ec(l,Ii,Es),Ri(l,zr()),null}function n1(l,c){var w=Zt;Zt|=1;try{return l(c)}finally{Zt=w,Zt===0&&(Nf=zr()+500,Sl&&Po())}}function Zu(l){Ul!==null&&Ul.tag===0&&(Zt&6)===0&&Lf();var c=Zt;Zt|=1;var w=ka.transition,O=Kt;try{if(ka.transition=null,Kt=1,l)return l()}finally{Kt=O,ka.transition=w,Zt=c,(Zt&6)===0&&Po()}}function i1(){Qi=Df.current,pr(Df)}function Ju(l,c){l.finishedWork=null,l.finishedLanes=0;var w=l.timeoutHandle;if(w!==-1&&(l.timeoutHandle=-1,oh(w)),dn!==null)for(w=dn.return;w!==null;){var O=w;switch(fn(O),O.tag){case 1:O=O.type.childContextTypes,O!=null&&xl();break;case 3:Tr(),pr(_n),pr(yn),En();break;case 5:Ga(O);break;case 4:Tr();break;case 13:pr(mr);break;case 19:pr(mr);break;case 10:wf(O.type._context);break;case 22:case 23:i1()}w=w.return}if(An=l,dn=l=ql(l.current,null),Hn=Qi=c,bn=0,Sh=null,Q0=Rm=Qu=0,Ii=kh=null,va!==null){for(c=0;c<va.length;c++)if(w=va[c],O=w.interleaved,O!==null){w.interleaved=null;var B=O.next,j=w.pending;if(j!==null){var re=j.next;j.next=B,O.next=re}w.pending=O}va=null}return l}function Tb(l,c){do{var w=dn;try{if(bf(),Al.current=Nl,Ki){for(var O=sr.memoizedState;O!==null;){var B=O.queue;B!==null&&(B.pending=null),O=O.next}Ki=!1}if(zn=0,Gr=Lr=sr=null,Ao=!1,Ai=0,K0.current=null,w===null||w.return===null){bn=1,Sh=c,dn=null;break}e:{var j=l,re=w.return,ce=w,ye=c;if(c=Hn,ce.flags|=32768,ye!==null&&typeof ye=="object"&&typeof ye.then=="function"){var De=ye,He=ce,We=He.tag;if((He.mode&1)===0&&(We===0||We===11||We===15)){var Ue=He.alternate;Ue?(He.updateQueue=Ue.updateQueue,He.memoizedState=Ue.memoizedState,He.lanes=Ue.lanes):(He.updateQueue=null,He.memoizedState=null)}var ft=C(re);if(ft!==null){ft.flags&=-257,M(ft,re,ce,j,c),ft.mode&1&&g(j,De,c),c=ft,ye=De;var yt=c.updateQueue;if(yt===null){var vt=new Set;vt.add(ye),c.updateQueue=vt}else yt.add(ye);break e}else{if((c&1)===0){g(j,De,c),a1();break e}ye=Error(r(426))}}else if(rr&&ce.mode&1){var rn=C(re);if(rn!==null){(rn.flags&65536)===0&&(rn.flags|=256),M(rn,re,ce,j,c),qu(Ps(ye,ce));break e}}j=ye=Ps(ye,ce),bn!==4&&(bn=2),kh===null?kh=[j]:kh.push(j),j=re;do{switch(j.tag){case 3:j.flags|=65536,c&=-c,j.lanes|=c;var Ae=Cm(j,ye,c);Xu(j,Ae);break e;case 1:ce=ye;var we=j.type,Re=j.stateNode;if((j.flags&128)===0&&(typeof we.getDerivedStateFromError=="function"||Re!==null&&typeof Re.componentDidCatch=="function"&&(jl===null||!jl.has(Re)))){j.flags|=65536,c&=-c,j.lanes|=c;var Ke=m(j,ce,c);Xu(j,Ke);break e}}j=j.return}while(j!==null)}Ab(w)}catch(wt){c=wt,dn===w&&w!==null&&(dn=w=w.return);continue}break}while(!0)}function Cb(){var l=Im.current;return Im.current=Nl,l===null?Nl:l}function a1(){(bn===0||bn===3||bn===2)&&(bn=4),An===null||(Qu&268435455)===0&&(Rm&268435455)===0||$l(An,Hn)}function Bm(l,c){var w=Zt;Zt|=2;var O=Cb();(An!==l||Hn!==c)&&(Es=null,Ju(l,c));do try{k6();break}catch(B){Tb(l,B)}while(!0);if(bf(),Zt=w,Im.current=O,dn!==null)throw Error(r(261));return An=null,Hn=0,bn}function k6(){for(;dn!==null;)Ob(dn)}function _6(){for(;dn!==null&&!M0();)Ob(dn)}function Ob(l){var c=Mb(l.alternate,l,Qi);l.memoizedProps=l.pendingProps,c===null?Ab(l):dn=c,K0.current=null}function Ab(l){var c=l;do{var w=c.alternate;if(l=c.return,(c.flags&32768)===0){if(w=g6(w,c,Qi),w!==null){dn=w;return}}else{if(w=y6(w,c),w!==null){w.flags&=32767,dn=w;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{bn=6,dn=null;return}}if(c=c.sibling,c!==null){dn=c;return}dn=c=l}while(c!==null);bn===0&&(bn=5)}function ec(l,c,w){var O=Kt,B=ka.transition;try{ka.transition=null,Kt=1,P6(l,c,w,O)}finally{ka.transition=B,Kt=O}return null}function P6(l,c,w,O){do Lf();while(Ul!==null);if((Zt&6)!==0)throw Error(r(327));w=l.finishedWork;var B=l.finishedLanes;if(w===null)return null;if(l.finishedWork=null,l.finishedLanes=0,w===l.current)throw Error(r(177));l.callbackNode=null,l.callbackPriority=0;var j=w.lanes|w.childLanes;if(L0(l,j),l===An&&(dn=An=null,Hn=0),(w.subtreeFlags&2064)===0&&(w.flags&2064)===0||Dm||(Dm=!0,Db(il,function(){return Lf(),null})),j=(w.flags&15990)!==0,(w.subtreeFlags&15990)!==0||j){j=ka.transition,ka.transition=null;var re=Kt;Kt=1;var ce=Zt;Zt|=4,K0.current=null,b6(l,w),wb(w,l),Du(ih),Vc=!!nh,ih=nh=null,l.current=w,w6(w),D0(),Zt=ce,Kt=re,ka.transition=j}else l.current=w;if(Dm&&(Dm=!1,Ul=l,Nm=B),j=l.pendingLanes,j===0&&(jl=null),vr(w.stateNode),Ri(l,zr()),c!==null)for(O=l.onRecoverableError,w=0;w<c.length;w++)B=c[w],O(B.value,{componentStack:B.stack,digest:B.digest});if(Mm)throw Mm=!1,l=J0,J0=null,l;return(Nm&1)!==0&&l.tag!==0&&Lf(),j=l.pendingLanes,(j&1)!==0?l===e1?_h++:(_h=0,e1=l):_h=0,Po(),null}function Lf(){if(Ul!==null){var l=Eu(Nm),c=ka.transition,w=Kt;try{if(ka.transition=null,Kt=16>l?16:l,Ul===null)var O=!1;else{if(l=Ul,Ul=null,Nm=0,(Zt&6)!==0)throw Error(r(331));var B=Zt;for(Zt|=4,gt=l.current;gt!==null;){var j=gt,re=j.child;if((gt.flags&16)!==0){var ce=j.deletions;if(ce!==null){for(var ye=0;ye<ce.length;ye++){var De=ce[ye];for(gt=De;gt!==null;){var He=gt;switch(He.tag){case 0:case 11:case 15:xh(8,He,j)}var We=He.child;if(We!==null)We.return=He,gt=We;else for(;gt!==null;){He=gt;var Ue=He.sibling,ft=He.return;if(mb(He),He===De){gt=null;break}if(Ue!==null){Ue.return=ft,gt=Ue;break}gt=ft}}}var yt=j.alternate;if(yt!==null){var vt=yt.child;if(vt!==null){yt.child=null;do{var rn=vt.sibling;vt.sibling=null,vt=rn}while(vt!==null)}}gt=j}}if((j.subtreeFlags&2064)!==0&&re!==null)re.return=j,gt=re;else e:for(;gt!==null;){if(j=gt,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:xh(9,j,j.return)}var Ae=j.sibling;if(Ae!==null){Ae.return=j.return,gt=Ae;break e}gt=j.return}}var we=l.current;for(gt=we;gt!==null;){re=gt;var Re=re.child;if((re.subtreeFlags&2064)!==0&&Re!==null)Re.return=re,gt=Re;else e:for(re=we;gt!==null;){if(ce=gt,(ce.flags&2048)!==0)try{switch(ce.tag){case 0:case 11:case 15:Am(9,ce)}}catch(wt){Yr(ce,ce.return,wt)}if(ce===re){gt=null;break e}var Ke=ce.sibling;if(Ke!==null){Ke.return=ce.return,gt=Ke;break e}gt=ce.return}}if(Zt=B,Po(),hn&&typeof hn.onPostCommitFiberRoot=="function")try{hn.onPostCommitFiberRoot(Fa,l)}catch{}O=!0}return O}finally{Kt=w,ka.transition=c}}return!1}function Ib(l,c,w){c=Ps(w,c),c=Cm(l,c,1),l=xa(l,c,1),c=xi(),l!==null&&(Pu(l,1,c),Ri(l,c))}function Yr(l,c,w){if(l.tag===3)Ib(l,l,w);else for(;c!==null;){if(c.tag===3){Ib(c,l,w);break}else if(c.tag===1){var O=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof O.componentDidCatch=="function"&&(jl===null||!jl.has(O))){l=Ps(w,l),l=m(c,l,1),c=xa(c,l,1),l=xi(),c!==null&&(Pu(c,1,l),Ri(c,l));break}}c=c.return}}function E6(l,c,w){var O=l.pingCache;O!==null&&O.delete(c),c=xi(),l.pingedLanes|=l.suspendedLanes&w,An===l&&(Hn&w)===w&&(bn===4||bn===3&&(Hn&130023424)===Hn&&500>zr()-Z0?Ju(l,0):Q0|=w),Ri(l,c)}function Rb(l,c){c===0&&((l.mode&1)===0?c=1:(c=Ba,Ba<<=1,(Ba&130023424)===0&&(Ba=4194304)));var w=xi();l=bi(l,c),l!==null&&(Pu(l,c,w),Ri(l,w))}function T6(l){var c=l.memoizedState,w=0;c!==null&&(w=c.retryLane),Rb(l,w)}function C6(l,c){var w=0;switch(l.tag){case 13:var O=l.stateNode,B=l.memoizedState;B!==null&&(w=B.retryLane);break;case 19:O=l.stateNode;break;default:throw Error(r(314))}O!==null&&O.delete(c),Rb(l,w)}var Mb;Mb=function(l,c,w){if(l!==null)if(l.memoizedProps!==c.pendingProps||_n.current)G=!0;else{if((l.lanes&w)===0&&(c.flags&128)===0)return G=!1,q0(l,c,w);G=(l.flags&131072)!==0}else G=!1,rr&&(c.flags&1048576)!==0&&ym(c,To,c.index);switch(c.lanes=0,c.tag){case 2:var O=c.type;qt(l,c),l=c.pendingProps;var B=gs(c,yn.current);Wa(c,w),B=Il(null,c,O,l,B,w);var j=Rl();return c.flags|=1,typeof B=="object"&&B!==null&&typeof B.render=="function"&&B.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Pn(O)?(j=!0,ys(c)):j=!1,c.memoizedState=B.state!==null&&B.state!==void 0?B.state:null,Gu(c),B.updater=Fl,c.stateNode=B,B._reactInternals=c,If(c,O,l,w),c=nr(null,c,O,!0,j,w)):(c.tag=0,rr&&j&&kl(c),ie(null,c,B,w),c=c.child),c;case 16:O=c.elementType;e:{switch(qt(l,c),l=c.pendingProps,B=O._init,O=B(O._payload),c.type=O,B=c.tag=A6(O),l=vn(O,l),B){case 0:c=ot(null,c,O,l,w);break e;case 1:c=gr(null,c,O,l,w);break e;case 11:c=Se(null,c,O,l,w);break e;case 14:c=Ne(null,c,O,vn(O.type,l),w);break e}throw Error(r(306,O,""))}return c;case 0:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:vn(O,B),ot(l,c,O,B,w);case 1:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:vn(O,B),gr(l,c,O,B,w);case 3:e:{if(jn(c),l===null)throw Error(r(387));O=c.pendingProps,j=c.memoizedState,B=j.element,Sf(l,c),Tl(c,O,null,w);var re=c.memoizedState;if(O=re.element,j.isDehydrated)if(j={element:O,isDehydrated:!1,cache:re.cache,pendingSuspenseBoundaries:re.pendingSuspenseBoundaries,transitions:re.transitions},c.updateQueue.baseState=j,c.memoizedState=j,c.flags&256){B=Ps(Error(r(423)),c),c=Sa(l,c,O,w,B);break e}else if(O!==B){B=Ps(Error(r(424)),c),c=Sa(l,c,O,w,B);break e}else for(rt=pa(c.stateNode.containerInfo.firstChild),gi=c,rr=!0,yi=null,w=Oi(c,null,O,w),c.child=w;w;)w.flags=w.flags&-3|4096,w=w.sibling;else{if(xs(),O===B){c=On(l,c,w);break e}ie(l,c,O,w)}c=c.child}return c;case 5:return Cl(c),l===null&&_l(c),O=c.type,B=c.pendingProps,j=l!==null?l.memoizedProps:null,re=B.children,ah(O,B)?re=null:j!==null&&ah(O,j)&&(c.flags|=32),Mt(l,c),ie(l,c,re,w),c.child;case 6:return l===null&&_l(c),null;case 13:return ze(l,c,w);case 4:return Oo(c,c.stateNode.containerInfo),O=c.pendingProps,l===null?c.child=Ss(c,null,O,w):ie(l,c,O,w),c.child;case 11:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:vn(O,B),Se(l,c,O,B,w);case 7:return ie(l,c,c.pendingProps,w),c.child;case 8:return ie(l,c,c.pendingProps.children,w),c.child;case 12:return ie(l,c,c.pendingProps.children,w),c.child;case 10:e:{if(O=c.type._context,B=c.pendingProps,j=c.memoizedProps,re=B.value,cr(Vu,O._currentValue),O._currentValue=re,j!==null)if(Qn(j.value,re)){if(j.children===B.children&&!_n.current){c=On(l,c,w);break e}}else for(j=c.child,j!==null&&(j.return=c);j!==null;){var ce=j.dependencies;if(ce!==null){re=j.child;for(var ye=ce.firstContext;ye!==null;){if(ye.context===O){if(j.tag===1){ye=wa(-1,w&-w),ye.tag=2;var De=j.updateQueue;if(De!==null){De=De.shared;var He=De.pending;He===null?ye.next=ye:(ye.next=He.next,He.next=ye),De.pending=ye}}j.lanes|=w,ye=j.alternate,ye!==null&&(ye.lanes|=w),xf(j.return,w,c),ce.lanes|=w;break}ye=ye.next}}else if(j.tag===10)re=j.type===c.type?null:j.child;else if(j.tag===18){if(re=j.return,re===null)throw Error(r(341));re.lanes|=w,ce=re.alternate,ce!==null&&(ce.lanes|=w),xf(re,w,c),re=j.sibling}else re=j.child;if(re!==null)re.return=j;else for(re=j;re!==null;){if(re===c){re=null;break}if(j=re.sibling,j!==null){j.return=re.return,re=j;break}re=re.return}j=re}ie(l,c,B.children,w),c=c.child}return c;case 9:return B=c.type,O=c.pendingProps.children,Wa(c,w),B=Bn(B),O=O(B),c.flags|=1,ie(l,c,O,w),c.child;case 14:return O=c.type,B=vn(O,c.pendingProps),B=vn(O.type,B),Ne(l,c,O,B,w);case 15:return Ge(l,c,c.type,c.pendingProps,w);case 17:return O=c.type,B=c.pendingProps,B=c.elementType===O?B:vn(O,B),qt(l,c),c.tag=1,Pn(O)?(l=!0,ys(c)):l=!1,Wa(c,w),Tm(c,O,B),If(c,O,B,w),nr(null,c,O,!0,l,w);case 19:return tn(l,c,w);case 22:return mt(l,c,w)}throw Error(r(156,c.tag))};function Db(l,c){return Fc(l,c)}function O6(l,c,w,O){this.tag=l,this.key=w,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=O,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _a(l,c,w,O){return new O6(l,c,w,O)}function o1(l){return l=l.prototype,!(!l||!l.isReactComponent)}function A6(l){if(typeof l=="function")return o1(l)?1:0;if(l!=null){if(l=l.$$typeof,l===F)return 11;if(l===X)return 14}return 2}function ql(l,c){var w=l.alternate;return w===null?(w=_a(l.tag,c,l.key,l.mode),w.elementType=l.elementType,w.type=l.type,w.stateNode=l.stateNode,w.alternate=l,l.alternate=w):(w.pendingProps=c,w.type=l.type,w.flags=0,w.subtreeFlags=0,w.deletions=null),w.flags=l.flags&14680064,w.childLanes=l.childLanes,w.lanes=l.lanes,w.child=l.child,w.memoizedProps=l.memoizedProps,w.memoizedState=l.memoizedState,w.updateQueue=l.updateQueue,c=l.dependencies,w.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},w.sibling=l.sibling,w.index=l.index,w.ref=l.ref,w}function zm(l,c,w,O,B,j){var re=2;if(O=l,typeof l=="function")o1(l)&&(re=1);else if(typeof l=="string")re=5;else e:switch(l){case T:return tc(w.children,B,j,c);case I:re=8,B|=8;break;case L:return l=_a(12,w,c,B|2),l.elementType=L,l.lanes=j,l;case H:return l=_a(13,w,c,B),l.elementType=H,l.lanes=j,l;case $:return l=_a(19,w,c,B),l.elementType=$,l.lanes=j,l;case K:return jm(w,B,j,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case R:re=10;break e;case N:re=9;break e;case F:re=11;break e;case X:re=14;break e;case Z:re=16,O=null;break e}throw Error(r(130,l==null?l:typeof l,""))}return c=_a(re,w,c,B),c.elementType=l,c.type=O,c.lanes=j,c}function tc(l,c,w,O){return l=_a(7,l,O,c),l.lanes=w,l}function jm(l,c,w,O){return l=_a(22,l,O,c),l.elementType=K,l.lanes=w,l.stateNode={isHidden:!1},l}function s1(l,c,w){return l=_a(6,l,null,c),l.lanes=w,l}function l1(l,c,w){return c=_a(4,l.children!==null?l.children:[],l.key,c),c.lanes=w,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function I6(l,c,w,O,B){this.tag=c,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ui(0),this.expirationTimes=ui(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ui(0),this.identifierPrefix=O,this.onRecoverableError=B,this.mutableSourceEagerHydrationData=null}function u1(l,c,w,O,B,j,re,ce,ye){return l=new I6(l,c,w,ce,ye),c===1?(c=1,j===!0&&(c|=8)):c=0,j=_a(3,null,null,c),l.current=j,j.stateNode=l,j.memoizedState={element:O,isDehydrated:w,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gu(j),l}function R6(l,c,w){var O=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:O==null?null:""+O,children:l,containerInfo:c,implementation:w}}function Nb(l){if(!l)return ga;l=l._reactInternals;e:{if(Gn(l)!==l||l.tag!==1)throw Error(r(170));var c=l;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(Pn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(r(171))}if(l.tag===1){var w=l.type;if(Pn(w))return pf(l,w,c)}return c}function Lb(l,c,w,O,B,j,re,ce,ye){return l=u1(w,O,!0,l,B,j,re,ce,ye),l.context=Nb(null),w=l.current,O=xi(),B=Hl(w),j=wa(O,B),j.callback=c??null,xa(w,j,B),l.current.lanes=B,Pu(l,B,O),Ri(l,O),l}function Um(l,c,w,O){var B=c.current,j=xi(),re=Hl(B);return w=Nb(w),c.context===null?c.context=w:c.pendingContext=w,c=wa(j,re),c.payload={element:l},O=O===void 0?null:O,O!==null&&(c.callback=O),l=xa(B,c,re),l!==null&&(Za(l,B,re,j),kf(l,B,re)),re}function Hm(l){return l=l.current,l.child?(l.child.tag===5,l.child.stateNode):null}function Fb(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var w=l.retryLane;l.retryLane=w!==0&&w<c?w:c}}function c1(l,c){Fb(l,c),(l=l.alternate)&&Fb(l,c)}function M6(){return null}var Bb=typeof reportError=="function"?reportError:function(l){console.error(l)};function f1(l){this._internalRoot=l}$m.prototype.render=f1.prototype.render=function(l){var c=this._internalRoot;if(c===null)throw Error(r(409));Um(l,c,null,null)},$m.prototype.unmount=f1.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var c=l.containerInfo;Zu(function(){Um(null,l,null,null)}),c[ma]=null}};function $m(l){this._internalRoot=l}$m.prototype.unstable_scheduleHydration=function(l){if(l){var c=Xp();l={blockedOn:null,target:l,priority:c};for(var w=0;w<ha.length&&c!==0&&c<ha[w].priority;w++);ha.splice(w,0,l),w===0&&Hc(l)}};function d1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function qm(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function zb(){}function D6(l,c,w,O,B){if(B){if(typeof O=="function"){var j=O;O=function(){var De=Hm(re);j.call(De)}}var re=Lb(c,O,l,0,null,!1,!1,"",zb);return l._reactRootContainer=re,l[ma]=re.current,fs(l.nodeType===8?l.parentNode:l),Zu(),re}for(;B=l.lastChild;)l.removeChild(B);if(typeof O=="function"){var ce=O;O=function(){var De=Hm(ye);ce.call(De)}}var ye=u1(l,0,!1,null,null,!1,!1,"",zb);return l._reactRootContainer=ye,l[ma]=ye.current,fs(l.nodeType===8?l.parentNode:l),Zu(function(){Um(c,ye,w,O)}),ye}function Vm(l,c,w,O,B){var j=w._reactRootContainer;if(j){var re=j;if(typeof B=="function"){var ce=B;B=function(){var ye=Hm(re);ce.call(ye)}}Um(c,re,l,B)}else re=D6(w,c,l,B,O);return Hm(re)}ol=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var w=sn(c.pendingLanes);w!==0&&(Ld(c,w|1),Ri(c,zr()),(Zt&6)===0&&(Nf=zr()+500,Po()))}break;case 13:Zu(function(){var O=bi(l,1);if(O!==null){var B=xi();Za(O,l,1,B)}}),c1(l,1)}},sl=function(l){if(l.tag===13){var c=bi(l,134217728);if(c!==null){var w=xi();Za(c,l,134217728,w)}c1(l,134217728)}},Gp=function(l){if(l.tag===13){var c=Hl(l),w=bi(l,c);if(w!==null){var O=xi();Za(w,l,c,O)}c1(l,c)}},Xp=function(){return Kt},jc=function(l,c){var w=Kt;try{return Kt=l,c()}finally{Kt=w}},Et=function(l,c,w){switch(c){case"input":if(ke(l,w),c=w.name,w.type==="radio"&&c!=null){for(w=l;w.parentNode;)w=w.parentNode;for(w=w.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<w.length;c++){var O=w[c];if(O!==l&&O.form===l.form){var B=cn(O);if(!B)throw Error(r(90));Fe(O),ke(O,B)}}}break;case"textarea":Oe(l,w);break;case"select":c=w.value,c!=null&&Te(l,!!w.multiple,c,!1)}},on=n1,Vr=Zu;var N6={usingClientEntryPoint:!1,Events:[Uu,Zr,cn,Yt,dr,n1]},Ph={findFiberByHostInstance:ko,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},L6={bundleType:Ph.bundleType,version:Ph.version,rendererPackageName:Ph.rendererPackageName,rendererConfig:Ph.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=_i(l),l===null?null:l.stateNode},findFiberByHostInstance:Ph.findFiberByHostInstance||M6,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wm.isDisabled&&Wm.supportsFiber)try{Fa=Wm.inject(L6),hn=Wm}catch{}}return Mi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N6,Mi.createPortal=function(l,c){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d1(c))throw Error(r(200));return R6(l,c,null,w)},Mi.createRoot=function(l,c){if(!d1(l))throw Error(r(299));var w=!1,O="",B=Bb;return c!=null&&(c.unstable_strictMode===!0&&(w=!0),c.identifierPrefix!==void 0&&(O=c.identifierPrefix),c.onRecoverableError!==void 0&&(B=c.onRecoverableError)),c=u1(l,1,!1,null,null,w,!1,O,B),l[ma]=c.current,fs(l.nodeType===8?l.parentNode:l),new f1(c)},Mi.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var c=l._reactInternals;if(c===void 0)throw typeof l.render=="function"?Error(r(188)):(l=Object.keys(l).join(","),Error(r(268,l)));return l=_i(c),l=l===null?null:l.stateNode,l},Mi.flushSync=function(l){return Zu(l)},Mi.hydrate=function(l,c,w){if(!qm(c))throw Error(r(200));return Vm(null,l,c,!0,w)},Mi.hydrateRoot=function(l,c,w){if(!d1(l))throw Error(r(405));var O=w!=null&&w.hydratedSources||null,B=!1,j="",re=Bb;if(w!=null&&(w.unstable_strictMode===!0&&(B=!0),w.identifierPrefix!==void 0&&(j=w.identifierPrefix),w.onRecoverableError!==void 0&&(re=w.onRecoverableError)),c=Lb(c,null,l,1,w??null,B,!1,j,re),l[ma]=c.current,fs(l),O)for(l=0;l<O.length;l++)w=O[l],B=w._getVersion,B=B(w._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[w,B]:c.mutableSourceEagerHydrationData.push(w,B);return new $m(c)},Mi.render=function(l,c,w){if(!qm(c))throw Error(r(200));return Vm(null,l,c,!1,w)},Mi.unmountComponentAtNode=function(l){if(!qm(l))throw Error(r(40));return l._reactRootContainer?(Zu(function(){Vm(null,null,l,!1,function(){l._reactRootContainer=null,l[ma]=null})}),!0):!1},Mi.unstable_batchedUpdates=n1,Mi.unstable_renderSubtreeIntoContainer=function(l,c,w,O){if(!qm(w))throw Error(r(200));if(l==null||l._reactInternals===void 0)throw Error(r(38));return Vm(l,c,w,!1,O)},Mi.version="18.3.1-next-f1338f8080-20240426",Mi}var Wb;function Qx(){if(Wb)return p1.exports;Wb=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),p1.exports=$6(),p1.exports}var Gb;function q6(){if(Gb)return Gm;Gb=1;var t=Qx();return Gm.createRoot=t.createRoot,Gm.hydrateRoot=t.hydrateRoot,Gm}var V6=q6();const Zx=Ec(V6);function zt(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];throw new Error(typeof t=="number"?"[MobX] minified error nr: "+t+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+t)}var W6={};function n0(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:W6}var Jx=Object.assign,Cg=Object.getOwnPropertyDescriptor,Uo=Object.defineProperty,i0=Object.prototype,wv=[];Object.freeze(wv);var d2={};Object.freeze(d2);var G6=typeof Proxy<"u",X6=Object.toString();function eS(){G6||zt("Proxy not available")}function tS(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var Qf=function(){};function sa(t){return typeof t=="function"}function xc(t){var e=typeof t;switch(e){case"string":case"symbol":case"number":return!0}return!1}function a0(t){return t!==null&&typeof t=="object"}function uu(t){if(!a0(t))return!1;var e=Object.getPrototypeOf(t);if(e==null)return!0;var r=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r.toString()===X6}function rS(t){var e=t?.constructor;return e?e.name==="GeneratorFunction"||e.displayName==="GeneratorFunction":!1}function o0(t,e,r){Uo(t,e,{enumerable:!1,writable:!0,configurable:!0,value:r})}function nS(t,e,r){Uo(t,e,{enumerable:!1,writable:!1,configurable:!0,value:r})}function hu(t,e){var r="isMobX"+t;return e.prototype[r]=!0,function(n){return a0(n)&&n[r]===!0}}function _d(t){return t!=null&&Object.prototype.toString.call(t)==="[object Map]"}function Y6(t){var e=Object.getPrototypeOf(t),r=Object.getPrototypeOf(e),n=Object.getPrototypeOf(r);return n===null}function Ns(t){return t!=null&&Object.prototype.toString.call(t)==="[object Set]"}var iS=typeof Object.getOwnPropertySymbols<"u";function K6(t){var e=Object.keys(t);if(!iS)return e;var r=Object.getOwnPropertySymbols(t);return r.length?[].concat(e,r.filter(function(n){return i0.propertyIsEnumerable.call(t,n)})):e}var s0=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:iS?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames;function aS(t){return t===null?null:typeof t=="object"?""+t:t}function Hs(t,e){return i0.hasOwnProperty.call(t,e)}var Q6=Object.getOwnPropertyDescriptors||function(e){var r={};return s0(e).forEach(function(n){r[n]=Cg(e,n)}),r};function na(t,e){return!!(t&e)}function ia(t,e,r){return r?t|=e:t&=~e,t}function Xb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Z6(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,e_(n.key),n)}}function Pd(t,e,r){return e&&Z6(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Zf(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=t_(t))||e){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
9
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cu(){return cu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},cu.apply(null,arguments)}function oS(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,xv(t,e)}function xv(t,e){return xv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},xv(t,e)}function J6(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function e_(t){var e=J6(t,"string");return typeof e=="symbol"?e:e+""}function t_(t,e){if(t){if(typeof t=="string")return Xb(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xb(t,e):void 0}}var Bo=Symbol("mobx-stored-annotations");function Ho(t){function e(r,n){if(Rp(n))return t.decorate_20223_(r,n);Ip(r,n,t)}return Object.assign(e,t)}function Ip(t,e,r){Hs(t,Bo)||o0(t,Bo,cu({},t[Bo])),l_(r)||(t[Bo][e]=r)}function r_(t){return Hs(t,Bo)||o0(t,Bo,cu({},t[Bo])),t[Bo]}function Rp(t){return typeof t=="object"&&typeof t.kind=="string"}var At=Symbol("mobx administration"),pu=(function(){function t(r){r===void 0&&(r="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=tr.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var e=t.prototype;return e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},e.reportObserved=function(){return kS(this)},e.reportChanged=function(){Ni(),_S(this),Li()},e.toString=function(){return this.name_},Pd(t,[{key:"isBeingObserved",get:function(){return na(this.flags_,t.isBeingObservedMask_)},set:function(n){this.flags_=ia(this.flags_,t.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return na(this.flags_,t.isPendingUnobservationMask_)},set:function(n){this.flags_=ia(this.flags_,t.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return na(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=ia(this.flags_,t.diffValueMask_,n===1)}}])})();pu.isBeingObservedMask_=1;pu.isPendingUnobservationMask_=2;pu.diffValueMask_=4;var h2=hu("Atom",pu);function Og(t,e,r){e===void 0&&(e=Qf),r===void 0&&(r=Qf);var n=new pu(t);return e!==Qf&&f9(n,e),r!==Qf&&RS(n,r),n}function n_(t,e){return YS(t,e)}function i_(t,e){return Object.is?Object.is(t,e):t===e?t!==0||1/t===1/e:t!==t&&e!==e}var md={structural:n_,default:i_};function Sc(t,e,r){return FS(t)?t:Array.isArray(t)?Gt.array(t,{name:r}):uu(t)?Gt.object(t,void 0,{name:r}):_d(t)?Gt.map(t,{name:r}):Ns(t)?Gt.set(t,{name:r}):typeof t=="function"&&!gd(t)&&!pp(t)?rS(t)?yd(t):hp(r,t):t}function a_(t,e,r){if(t==null||oo(t)||Yo(t)||Ma(t)||ki(t))return t;if(Array.isArray(t))return Gt.array(t,{name:r,deep:!1});if(uu(t))return Gt.object(t,void 0,{name:r,deep:!1});if(_d(t))return Gt.map(t,{name:r,deep:!1});if(Ns(t))return Gt.set(t,{name:r,deep:!1})}function l0(t){return t}function o_(t,e){return YS(t,e)?e:t}var s_="override";function l_(t){return t.annotationType_===s_}function Mp(t,e){return{annotationType_:t,options_:e,make_:u_,extend_:c_,decorate_20223_:f_}}function u_(t,e,r,n){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(t,e,r,!1)===null?0:1;if(n===t.target_)return this.extend_(t,e,r,!1)===null?0:2;if(gd(r.value))return 1;var a=sS(t,this,e,r,!1);return Uo(n,e,a),2}function c_(t,e,r,n){var i=sS(t,this,e,r);return t.defineProperty_(e,i,n)}function f_(t,e){var r=e.kind,n=e.name,i=e.addInitializer,a=this,o=function(f){var d,h,p,y;return fu((d=(h=a.options_)==null?void 0:h.name)!=null?d:n.toString(),f,(p=(y=a.options_)==null?void 0:y.autoAction)!=null?p:!1)};if(r=="field")return function(u){var f,d=u;return gd(d)||(d=o(d)),(f=a.options_)!=null&&f.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(r=="method"){var s;return gd(t)||(t=o(t)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,f=u[n].bind(u);f.isMobxAction=!0,u[n]=f}),t}zt("Cannot apply '"+a.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
10
+ '`+a.annotationType_+"' can only be used on properties with a function value."))}function d_(t,e,r,n){e.annotationType_,n.value}function sS(t,e,r,n,i){var a,o,s,u,f,d,h;i===void 0&&(i=nt.safeDescriptors),d_(t,e,r,n);var p=n.value;if((a=e.options_)!=null&&a.bound){var y;p=p.bind((y=t.proxy_)!=null?y:t.target_)}return{value:fu((o=(s=e.options_)==null?void 0:s.name)!=null?o:r.toString(),p,(u=(f=e.options_)==null?void 0:f.autoAction)!=null?u:!1,(d=e.options_)!=null&&d.bound?(h=t.proxy_)!=null?h:t.target_:void 0),configurable:i?t.isPlainObject_:!0,enumerable:!1,writable:!i}}function lS(t,e){return{annotationType_:t,options_:e,make_:h_,extend_:p_,decorate_20223_:m_}}function h_(t,e,r,n){var i;if(n===t.target_)return this.extend_(t,e,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Hs(t.target_,e)||!pp(t.target_[e]))&&this.extend_(t,e,r,!1)===null)return 0;if(pp(r.value))return 1;var a=uS(t,this,e,r,!1,!1);return Uo(n,e,a),2}function p_(t,e,r,n){var i,a=uS(t,this,e,r,(i=this.options_)==null?void 0:i.bound);return t.defineProperty_(e,a,n)}function m_(t,e){var r,n=e.name,i=e.addInitializer;return pp(t)||(t=yd(t)),(r=this.options_)!=null&&r.bound&&i(function(){var a=this,o=a[n].bind(a);o.isMobXFlow=!0,a[n]=o}),t}function g_(t,e,r,n){e.annotationType_,n.value}function uS(t,e,r,n,i,a){a===void 0&&(a=nt.safeDescriptors),g_(t,e,r,n);var o=n.value;if(pp(o)||(o=yd(o)),i){var s;o=o.bind((s=t.proxy_)!=null?s:t.target_),o.isMobXFlow=!0}return{value:o,configurable:a?t.isPlainObject_:!0,enumerable:!1,writable:!a}}function p2(t,e){return{annotationType_:t,options_:e,make_:y_,extend_:v_,decorate_20223_:b_}}function y_(t,e,r){return this.extend_(t,e,r,!1)===null?0:1}function v_(t,e,r,n){return w_(t,this,e,r),t.defineComputedProperty_(e,cu({},this.options_,{get:r.get,set:r.set}),n)}function b_(t,e){var r=this,n=e.name,i=e.addInitializer;return i(function(){var a=Ed(this)[At],o=cu({},r.options_,{get:t,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new no(o))}),function(){return this[At].getObservablePropValue_(n)}}function w_(t,e,r,n){e.annotationType_,n.get}function u0(t,e){return{annotationType_:t,options_:e,make_:x_,extend_:S_,decorate_20223_:k_}}function x_(t,e,r){return this.extend_(t,e,r,!1)===null?0:1}function S_(t,e,r,n){var i,a;return __(t,this),t.defineObservableProperty_(e,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:Sc,n)}function k_(t,e){var r=this,n=e.kind,i=e.name,a=new WeakSet;function o(s,u){var f,d,h=Ed(s)[At],p=new su(u,(f=(d=r.options_)==null?void 0:d.enhancer)!=null?f:Sc,"ObservableObject."+i.toString(),!1);h.values_.set(i,p),a.add(s)}if(n=="accessor")return{get:function(){return a.has(this)||o(this,t.get.call(this)),this[At].getObservablePropValue_(i)},set:function(u){return a.has(this)||o(this,u),this[At].setObservablePropValue_(i,u)},init:function(u){return a.has(this)||o(this,u),u}}}function __(t,e,r,n){e.annotationType_}var P_="true",E_=cS();function cS(t){return{annotationType_:P_,options_:t,make_:T_,extend_:C_,decorate_20223_:O_}}function T_(t,e,r,n){var i,a;if(r.get)return Tc.make_(t,e,r,n);if(r.set){var o=gd(r.set)?r.set:fu(e.toString(),r.set);return n===t.target_?t.defineProperty_(e,{configurable:nt.safeDescriptors?t.isPlainObject_:!0,set:o})===null?0:2:(Uo(n,e,{configurable:!0,set:o}),2)}if(n!==t.target_&&typeof r.value=="function"){var s;if(rS(r.value)){var u,f=(u=this.options_)!=null&&u.autoBind?yd.bound:yd;return f.make_(t,e,r,n)}var d=(s=this.options_)!=null&&s.autoBind?hp.bound:hp;return d.make_(t,e,r,n)}var h=((i=this.options_)==null?void 0:i.deep)===!1?Gt.ref:Gt;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var p;r.value=r.value.bind((p=t.proxy_)!=null?p:t.target_)}return h.make_(t,e,r,n)}function C_(t,e,r,n){var i,a;if(r.get)return Tc.extend_(t,e,r,n);if(r.set)return t.defineProperty_(e,{configurable:nt.safeDescriptors?t.isPlainObject_:!0,set:fu(e.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var o;r.value=r.value.bind((o=t.proxy_)!=null?o:t.target_)}var s=((a=this.options_)==null?void 0:a.deep)===!1?Gt.ref:Gt;return s.extend_(t,e,r,n)}function O_(t,e){zt("'"+this.annotationType_+"' cannot be used as a decorator")}var A_="observable",I_="observable.ref",R_="observable.shallow",M_="observable.struct",fS={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(fS);function Xm(t){return t||fS}var Sv=u0(A_),D_=u0(I_,{enhancer:l0}),N_=u0(R_,{enhancer:a_}),L_=u0(M_,{enhancer:o_}),dS=Ho(Sv);function Ym(t){return t.deep===!0?Sc:t.deep===!1?l0:B_(t.defaultDecorator)}function F_(t){var e;return t?(e=t.defaultDecorator)!=null?e:cS(t):void 0}function B_(t){var e,r;return t&&(e=(r=t.options_)==null?void 0:r.enhancer)!=null?e:Sc}function hS(t,e,r){if(Rp(e))return Sv.decorate_20223_(t,e);if(xc(e)){Ip(t,e,Sv);return}return FS(t)?t:uu(t)?Gt.object(t,e,r):Array.isArray(t)?Gt.array(t,e):_d(t)?Gt.map(t,e):Ns(t)?Gt.set(t,e):typeof t=="object"&&t!==null?t:Gt.box(t,e)}Jx(hS,dS);var z_={box:function(e,r){var n=Xm(r);return new su(e,Ym(n),n.name,!0,n.equals)},array:function(e,r){var n=Xm(r);return(nt.useProxies===!1||n.proxy===!1?U9:I9)(e,Ym(n),n.name)},map:function(e,r){var n=Xm(r);return new b2(e,Ym(n),n.name)},set:function(e,r){var n=Xm(r);return new qS(e,Ym(n),n.name)},object:function(e,r,n){return Oc(function(){return m9(nt.useProxies===!1||n?.proxy===!1?Ed({},n):C9({},n),e,r)})},ref:Ho(D_),shallow:Ho(N_),deep:dS,struct:Ho(L_)},Gt=Jx(hS,z_),pS="computed",j_="computed.struct",kv=p2(pS),U_=p2(j_,{equals:md.structural}),Tc=function(e,r){if(Rp(r))return kv.decorate_20223_(e,r);if(xc(r))return Ip(e,r,kv);if(uu(e))return Ho(p2(pS,e));var n=uu(r)?r:{};return n.get=e,n.name||(n.name=e.name||""),new no(n)};Object.assign(Tc,kv);Tc.struct=Ho(U_);var Yb,Kb,Ag=0,H_=1,$_=(Yb=(Kb=Cg(function(){},"name"))==null?void 0:Kb.configurable)!=null?Yb:!1,Qb={value:"action",configurable:!0,writable:!1,enumerable:!1};function fu(t,e,r,n){r===void 0&&(r=!1);function i(){return mS(t,r,e,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return e.toString()},$_&&(Qb.value=t,Uo(i,"name",Qb)),i}function mS(t,e,r,n,i){var a=q_(t,e);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{V_(a)}}function q_(t,e,r,n){var i=!1,a=0,o=nt.trackingDerivation,s=!e||!o;Ni();var u=nt.allowStateChanges;s&&(Cc(),u=c0(!0));var f=m2(!0),d={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:u,prevAllowStateReads_:f,notifySpy_:i,startTime_:a,actionId_:H_++,parentActionId_:Ag};return Ag=d.actionId_,d}function V_(t){Ag!==t.actionId_&&zt(30),Ag=t.parentActionId_,t.error_!==void 0&&(nt.suppressReactionErrors=!0),f0(t.prevAllowStateChanges_),Qh(t.prevAllowStateReads_),Li(),t.runAsAction_&&$s(t.prevDerivation_),nt.suppressReactionErrors=!1}function gS(t,e){var r=c0(t);try{return e()}finally{f0(r)}}function c0(t){var e=nt.allowStateChanges;return nt.allowStateChanges=t,e}function f0(t){nt.allowStateChanges=t}var su=(function(t){function e(n,i,a,o,s){var u;return a===void 0&&(a="ObservableValue"),s===void 0&&(s=md.default),u=t.call(this,a)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=i,u.name_=a,u.equals=s,u.value_=i(n,void 0,a),u}oS(e,t);var r=e.prototype;return r.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},r.set=function(i){this.value_,i=this.prepareNewValue_(i),i!==nt.UNCHANGED&&this.setNewValue_(i)},r.prepareNewValue_=function(i){if(Ea(this)){var a=Ta(this,{object:this,type:$o,newValue:i});if(!a)return nt.UNCHANGED;i=a.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?nt.UNCHANGED:i},r.setNewValue_=function(i){var a=this.value_;this.value_=i,this.reportChanged(),to(this)&&ro(this,{type:$o,object:this,newValue:i,oldValue:a})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return Dp(this,i)},r.observe_=function(i,a){return a&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:$o,newValue:this.value_,oldValue:void 0}),Np(this,i)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return aS(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},e})(pu),W_=hu("ObservableValue",su),no=(function(){function t(r){this.dependenciesState_=tr.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=tr.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Rg(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ig.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,r.get||zt(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=fu("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?md.structural:md.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var e=t.prototype;return e.onBecomeStale_=function(){Z_(this)},e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},e.get=function(){if(this.isComputing&&zt(32,this.name_,this.derivation),nt.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)_v(this)&&(this.warnAboutUntrackedRead_(),Ni(),this.value_=this.computeValue_(!1),Li());else if(kS(this),_v(this)){var n=nt.trackingContext;this.keepAlive_&&!n&&(nt.trackingContext=this),this.trackAndCompute()&&Q_(this),nt.trackingContext=n}var i=this.value_;if(mg(i))throw i.cause;return i},e.set=function(n){if(this.setter_){this.isRunningSetter&&zt(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter=!1}}else zt(34,this.name_)},e.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===tr.NOT_TRACKING_,a=this.computeValue_(!0),o=i||mg(n)||mg(a)||!this.equals_(n,a);return o&&(this.value_=a),o},e.computeValue_=function(n){this.isComputing=!0;var i=c0(!1),a;if(n)a=yS(this,this.derivation,this.scope_);else if(nt.disableErrorBoundaries===!0)a=this.derivation.call(this.scope_);else try{a=this.derivation.call(this.scope_)}catch(o){a=new Rg(o)}return f0(i),this.isComputing=!1,a},e.suspend_=function(){this.keepAlive_||(Pv(this),this.value_=void 0)},e.observe_=function(n,i){var a=this,o=!0,s=void 0;return io(function(){var u=a.get();if(!o||i){var f=Cc();n({observableKind:"computed",debugObjectName:a.name_,type:$o,object:a,newValue:u,oldValue:s}),$s(f)}o=!1,s=u})},e.warnAboutUntrackedRead_=function(){},e.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},e.valueOf=function(){return aS(this.get())},e[Symbol.toPrimitive]=function(){return this.valueOf()},Pd(t,[{key:"isComputing",get:function(){return na(this.flags_,t.isComputingMask_)},set:function(n){this.flags_=ia(this.flags_,t.isComputingMask_,n)}},{key:"isRunningSetter",get:function(){return na(this.flags_,t.isRunningSetterMask_)},set:function(n){this.flags_=ia(this.flags_,t.isRunningSetterMask_,n)}},{key:"isBeingObserved",get:function(){return na(this.flags_,t.isBeingObservedMask_)},set:function(n){this.flags_=ia(this.flags_,t.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return na(this.flags_,t.isPendingUnobservationMask_)},set:function(n){this.flags_=ia(this.flags_,t.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return na(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=ia(this.flags_,t.diffValueMask_,n===1)}}])})();no.isComputingMask_=1;no.isRunningSetterMask_=2;no.isBeingObservedMask_=4;no.isPendingUnobservationMask_=8;no.diffValueMask_=16;var d0=hu("ComputedValue",no),tr;(function(t){t[t.NOT_TRACKING_=-1]="NOT_TRACKING_",t[t.UP_TO_DATE_=0]="UP_TO_DATE_",t[t.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",t[t.STALE_=2]="STALE_"})(tr||(tr={}));var Ig;(function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"})(Ig||(Ig={}));var Rg=function(e){this.cause=void 0,this.cause=e};function mg(t){return t instanceof Rg}function _v(t){switch(t.dependenciesState_){case tr.UP_TO_DATE_:return!1;case tr.NOT_TRACKING_:case tr.STALE_:return!0;case tr.POSSIBLY_STALE_:{for(var e=m2(!0),r=Cc(),n=t.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(d0(o)){if(nt.disableErrorBoundaries)o.get();else try{o.get()}catch{return $s(r),Qh(e),!0}if(t.dependenciesState_===tr.STALE_)return $s(r),Qh(e),!0}}return bS(t),$s(r),Qh(e),!1}}}function yS(t,e,r){var n=m2(!0);bS(t),t.newObserving_=new Array(t.runId_===0?100:t.observing_.length),t.unboundDepsCount_=0,t.runId_=++nt.runId;var i=nt.trackingDerivation;nt.trackingDerivation=t,nt.inBatch++;var a;if(nt.disableErrorBoundaries===!0)a=e.call(r);else try{a=e.call(r)}catch(o){a=new Rg(o)}return nt.inBatch--,nt.trackingDerivation=i,G_(t),Qh(n),a}function G_(t){for(var e=t.observing_,r=t.observing_=t.newObserving_,n=tr.UP_TO_DATE_,i=0,a=t.unboundDepsCount_,o=0;o<a;o++){var s=r[o];s.diffValue===0&&(s.diffValue=1,i!==o&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,t.newObserving_=null,a=e.length;a--;){var u=e[a];u.diffValue===0&&xS(u,t),u.diffValue=0}for(;i--;){var f=r[i];f.diffValue===1&&(f.diffValue=0,K_(f,t))}n!==tr.UP_TO_DATE_&&(t.dependenciesState_=n,t.onBecomeStale_())}function Pv(t){var e=t.observing_;t.observing_=[];for(var r=e.length;r--;)xS(e[r],t);t.dependenciesState_=tr.NOT_TRACKING_}function vS(t){var e=Cc();try{return t()}finally{$s(e)}}function Cc(){var t=nt.trackingDerivation;return nt.trackingDerivation=null,t}function $s(t){nt.trackingDerivation=t}function m2(t){var e=nt.allowStateReads;return nt.allowStateReads=t,e}function Qh(t){nt.allowStateReads=t}function bS(t){if(t.dependenciesState_!==tr.UP_TO_DATE_){t.dependenciesState_=tr.UP_TO_DATE_;for(var e=t.observing_,r=e.length;r--;)e[r].lowestObserverState_=tr.UP_TO_DATE_}}var gg=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},yg=!0,wS=!1,nt=(function(){var t=n0();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(yg=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==new gg().version&&(yg=!1),yg?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new gg):(setTimeout(function(){wS||zt(35)},1),new gg)})();function X_(){if((nt.pendingReactions.length||nt.inBatch||nt.isRunningReactions)&&zt(36),wS=!0,yg){var t=n0();--t.__mobxInstanceCount===0&&(t.__mobxGlobals=void 0),nt=new gg}}function Y_(){return nt}function K_(t,e){t.observers_.add(e),t.lowestObserverState_>e.dependenciesState_&&(t.lowestObserverState_=e.dependenciesState_)}function xS(t,e){t.observers_.delete(e),t.observers_.size===0&&SS(t)}function SS(t){t.isPendingUnobservation===!1&&(t.isPendingUnobservation=!0,nt.pendingUnobservations.push(t))}function Ni(){nt.inBatch++}function Li(){if(--nt.inBatch===0){PS();for(var t=nt.pendingUnobservations,e=0;e<t.length;e++){var r=t[e];r.isPendingUnobservation=!1,r.observers_.size===0&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof no&&r.suspend_())}nt.pendingUnobservations=[]}}function kS(t){var e=nt.trackingDerivation;return e!==null?(e.runId_!==t.lastAccessedBy_&&(t.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=t,!t.isBeingObserved&&nt.trackingContext&&(t.isBeingObserved=!0,t.onBO())),t.isBeingObserved):(t.observers_.size===0&&nt.inBatch>0&&SS(t),!1)}function _S(t){t.lowestObserverState_!==tr.STALE_&&(t.lowestObserverState_=tr.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===tr.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=tr.STALE_}))}function Q_(t){t.lowestObserverState_!==tr.STALE_&&(t.lowestObserverState_=tr.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===tr.POSSIBLY_STALE_?e.dependenciesState_=tr.STALE_:e.dependenciesState_===tr.UP_TO_DATE_&&(t.lowestObserverState_=tr.UP_TO_DATE_)}))}function Z_(t){t.lowestObserverState_===tr.UP_TO_DATE_&&(t.lowestObserverState_=tr.POSSIBLY_STALE_,t.observers_.forEach(function(e){e.dependenciesState_===tr.UP_TO_DATE_&&(e.dependenciesState_=tr.POSSIBLY_STALE_,e.onBecomeStale_())}))}var Vo=(function(){function t(r,n,i,a){r===void 0&&(r="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=tr.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Ig.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=a}var e=t.prototype;return e.onBecomeStale_=function(){this.schedule_()},e.schedule_=function(){this.isScheduled||(this.isScheduled=!0,nt.pendingReactions.push(this),PS())},e.runReaction_=function(){if(!this.isDisposed){Ni(),this.isScheduled=!1;var n=nt.trackingContext;if(nt.trackingContext=this,_v(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}nt.trackingContext=n,Li()}},e.track=function(n){if(!this.isDisposed){Ni(),this.isRunning=!0;var i=nt.trackingContext;nt.trackingContext=this;var a=yS(this,n,void 0);nt.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Pv(this),mg(a)&&this.reportExceptionInDerivation_(a.cause),Li()}},e.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(nt.disableErrorBoundaries)throw n;var a="[mobx] uncaught error in '"+this+"'";nt.suppressReactionErrors||console.error(a,n),nt.globalReactionErrorHandlers.forEach(function(o){return o(n,i)})},e.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Ni(),Pv(this),Li()))},e.getDisposer_=function(n){var i=this,a=function o(){i.dispose(),n==null||n.removeEventListener==null||n.removeEventListener("abort",o)};return n==null||n.addEventListener==null||n.addEventListener("abort",a),a[At]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(a[Symbol.dispose]=a),a},e.toString=function(){return"Reaction["+this.name_+"]"},e.trace=function(n){},Pd(t,[{key:"isDisposed",get:function(){return na(this.flags_,t.isDisposedMask_)},set:function(n){this.flags_=ia(this.flags_,t.isDisposedMask_,n)}},{key:"isScheduled",get:function(){return na(this.flags_,t.isScheduledMask_)},set:function(n){this.flags_=ia(this.flags_,t.isScheduledMask_,n)}},{key:"isTrackPending",get:function(){return na(this.flags_,t.isTrackPendingMask_)},set:function(n){this.flags_=ia(this.flags_,t.isTrackPendingMask_,n)}},{key:"isRunning",get:function(){return na(this.flags_,t.isRunningMask_)},set:function(n){this.flags_=ia(this.flags_,t.isRunningMask_,n)}},{key:"diffValue",get:function(){return na(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=ia(this.flags_,t.diffValueMask_,n===1)}}])})();Vo.isDisposedMask_=1;Vo.isScheduledMask_=2;Vo.isTrackPendingMask_=4;Vo.isRunningMask_=8;Vo.diffValueMask_=16;var J_=100,Ev=function(e){return e()};function PS(){nt.inBatch>0||nt.isRunningReactions||Ev(e9)}function e9(){nt.isRunningReactions=!0;for(var t=nt.pendingReactions,e=0;t.length>0;){++e===J_&&(console.error("[mobx] cycle in reaction: "+t[0]),t.splice(0));for(var r=t.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}nt.isRunningReactions=!1}var Mg=hu("Reaction",Vo);function t9(t){var e=Ev;Ev=function(n){return t(function(){return e(n)})}}function Zh(){return!1}function r9(t){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var ES="action",n9="action.bound",TS="autoAction",i9="autoAction.bound",CS="<unnamed action>",Tv=Mp(ES),a9=Mp(n9,{bound:!0}),Cv=Mp(TS,{autoAction:!0}),o9=Mp(i9,{autoAction:!0,bound:!0});function OS(t){var e=function(n,i){if(sa(n))return fu(n.name||CS,n,t);if(sa(i))return fu(n,i,t);if(Rp(i))return(t?Cv:Tv).decorate_20223_(n,i);if(xc(i))return Ip(n,i,t?Cv:Tv);if(xc(n))return Ho(Mp(t?TS:ES,{name:n,autoAction:t}))};return e}var Ft=OS(!1);Object.assign(Ft,Tv);var hp=OS(!0);Object.assign(hp,Cv);Ft.bound=Ho(a9);hp.bound=Ho(o9);function Ls(t){return mS(t.name||CS,!1,t,this,void 0)}function gd(t){return sa(t)&&t.isMobxAction===!0}function io(t,e){var r,n,i,a;e===void 0&&(e=d2);var o=(r=(n=e)==null?void 0:n.name)!=null?r:"Autorun",s=!e.scheduler&&!e.delay,u;if(s)u=new Vo(o,function(){this.track(h)},e.onError,e.requiresObservable);else{var f=AS(e),d=!1;u=new Vo(o,function(){d||(d=!0,f(function(){d=!1,u.isDisposed||u.track(h)}))},e.onError,e.requiresObservable)}function h(){t(u)}return(i=e)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((a=e)==null?void 0:a.signal)}var s9=function(e){return e()};function AS(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:s9}function IS(t,e,r){var n,i,a;r===void 0&&(r=d2);var o=(n=r.name)!=null?n:"Reaction",s=Ft(o,r.onError?l9(r.onError,e):e),u=!r.scheduler&&!r.delay,f=AS(r),d=!0,h=!1,p,y=r.compareStructural?md.structural:r.equals||md.default,v=new Vo(o,function(){d||u?b():h||(h=!0,f(b))},r.onError,r.requiresObservable);function b(){if(h=!1,!v.isDisposed){var x=!1,k=p;v.track(function(){var S=gS(!1,function(){return t(v)});x=d||!y(p,S),p=S}),(d&&r.fireImmediately||!d&&x)&&s(p,k,v),d=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||v.schedule_(),v.getDisposer_((a=r)==null?void 0:a.signal)}function l9(t,e){return function(){try{return e.apply(this,arguments)}catch(r){t.call(this,r)}}}var u9="onBO",c9="onBUO";function f9(t,e,r){return MS(u9,t,e,r)}function RS(t,e,r){return MS(c9,t,e,r)}function MS(t,e,r,n){var i=vd(e),a=sa(n)?n:r,o=t+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var s=i[o];s&&(s.delete(a),s.size===0&&delete i[o])}}var d9="never",Km="always",h9="observed";function p9(t){t.isolateGlobalState===!0&&X_();var e=t.useProxies,r=t.enforceActions;if(e!==void 0&&(nt.useProxies=e===Km?!0:e===d9?!1:typeof Proxy<"u"),e==="ifavailable"&&(nt.verifyProxies=!0),r!==void 0){var n=r===Km?Km:r===h9;nt.enforceActions=n,nt.allowStateChanges=!(n===!0||n===Km)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in t&&(nt[i]=!!t[i])}),nt.allowStateReads=!nt.observableRequiresReaction,t.reactionScheduler&&t9(t.reactionScheduler)}function m9(t,e,r,n){var i=Q6(e);return Oc(function(){var a=Ed(t,n)[At];s0(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),t}function g9(t,e){return DS(vd(t,e))}function DS(t){var e={name:t.name_};return t.observing_&&t.observing_.length>0&&(e.dependencies=y9(t.observing_).map(DS)),e}function y9(t){return Array.from(new Set(t))}var v9=0;function NS(){this.message="FLOW_CANCELLED"}NS.prototype=Object.create(Error.prototype);var y1=lS("flow"),b9=lS("flow.bound",{bound:!0}),yd=Object.assign(function(e,r){if(Rp(r))return y1.decorate_20223_(e,r);if(xc(r))return Ip(e,r,y1);var n=e,i=n.name||"<unnamed flow>",a=function(){var s=this,u=arguments,f=++v9,d=Ft(i+" - runid: "+f+" - init",n).apply(s,u),h,p=void 0,y=new Promise(function(v,b){var x=0;h=b;function k(_){p=void 0;var E;try{E=Ft(i+" - runid: "+f+" - yield "+x++,d.next).call(d,_)}catch(A){return b(A)}P(E)}function S(_){p=void 0;var E;try{E=Ft(i+" - runid: "+f+" - yield "+x++,d.throw).call(d,_)}catch(A){return b(A)}P(E)}function P(_){if(sa(_?.then)){_.then(P,b);return}return _.done?v(_.value):(p=Promise.resolve(_.value),p.then(k,S))}k(void 0)});return y.cancel=Ft(i+" - runid: "+f+" - cancel",function(){try{p&&Zb(p);var v=d.return(void 0),b=Promise.resolve(v.value);b.then(Qf,Qf),Zb(b),h(new NS)}catch(x){h(x)}}),y};return a.isMobXFlow=!0,a},y1);yd.bound=Ho(b9);function Zb(t){sa(t.cancel)&&t.cancel()}function pp(t){return t?.isMobXFlow===!0}function LS(t,e,r){var n;return Ma(t)||Yo(t)||W_(t)?n=Wo(t):oo(t)&&(n=Wo(t,e)),n.dehancer=typeof e=="function"?e:r,function(){n.dehancer=void 0}}function g2(t,e,r){return sa(r)?x9(t,e,r):w9(t,e)}function w9(t,e){return Wo(t).intercept_(e)}function x9(t,e,r){return Wo(t,e).intercept_(r)}function S9(t,e){return t?oo(t)||!!t[At]||h2(t)||Mg(t)||d0(t):!1}function FS(t){return S9(t)}function Dg(t){if(oo(t))return t[At].keys_();if(Ma(t)||ki(t))return Array.from(t.keys());if(Yo(t))return t.map(function(e,r){return r});zt(5)}function BS(t){if(oo(t))return Dg(t).map(function(e){return t[e]});if(Ma(t))return Dg(t).map(function(e){return t.get(e)});if(ki(t))return Array.from(t.values());if(Yo(t))return t.slice();zt(6)}function k9(t){if(oo(t))return Dg(t).map(function(e){return[e,t[e]]});if(Ma(t))return Dg(t).map(function(e){return[e,t.get(e)]});if(ki(t))return Array.from(t.entries());if(Yo(t))return t.map(function(e,r){return[r,e]});zt(7)}function zS(t,e,r){if(arguments.length===2&&!ki(t)){Ni();var n=e;try{for(var i in n)zS(t,i,n[i])}finally{Li()}return}oo(t)?t[At].set_(e,r):Ma(t)?t.set(e,r):ki(t)?t.add(e):Yo(t)?(typeof e!="number"&&(e=parseInt(e,10)),e<0&&zt("Invalid index: '"+e+"'"),Ni(),e>=t.length&&(t.length=e+1),t[e]=r,Li()):zt(8)}function jS(t,e,r){if(oo(t))return t[At].defineProperty_(e,r);zt(39)}function y2(t,e,r,n){return sa(r)?P9(t,e,r,n):_9(t,e,r)}function _9(t,e,r){return Wo(t).observe_(e,r)}function P9(t,e,r,n){return Wo(t,e).observe_(r,n)}function Fs(t,e){e===void 0&&(e=void 0),Ni();try{return t.apply(e)}finally{Li()}}function Jb(t,e,r){return arguments.length===1||e&&typeof e=="object"?E9(t,e):US(t,e,{})}function US(t,e,r){var n;if(typeof r.timeout=="number"){var i=new Error("WHEN_TIMEOUT");n=setTimeout(function(){if(!o[At].isDisposed)if(o(),r.onError)r.onError(i);else throw i},r.timeout)}r.name="When";var a=fu("When-effect",e),o=io(function(s){var u=gS(!1,t);u&&(s.dispose(),n&&clearTimeout(n),a())},r);return o}function E9(t,e){var r;if(e!=null&&(r=e.signal)!=null&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var n,i,a=new Promise(function(o,s){var u,f=US(t,o,cu({},e,{onError:s}));n=function(){f(),s(new Error("WHEN_CANCELLED"))},i=function(){f(),s(new Error("WHEN_ABORTED"))},e==null||(u=e.signal)==null||u.addEventListener==null||u.addEventListener("abort",i)}).finally(function(){var o;return e==null||(o=e.signal)==null||o.removeEventListener==null?void 0:o.removeEventListener("abort",i)});return a.cancel=n,a}function Ff(t){return t[At]}var T9={has:function(e,r){return Ff(e).has_(r)},get:function(e,r){return Ff(e).get_(r)},set:function(e,r,n){var i;return xc(r)?(i=Ff(e).set_(r,n,!0))!=null?i:!0:!1},deleteProperty:function(e,r){var n;return xc(r)?(n=Ff(e).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(e,r,n){var i;return(i=Ff(e).defineProperty_(r,n))!=null?i:!0},ownKeys:function(e){return Ff(e).ownKeys_()},preventExtensions:function(e){zt(13)}};function C9(t,e){var r,n;return eS(),t=Ed(t,e),(n=(r=t[At]).proxy_)!=null?n:r.proxy_=new Proxy(t,T9)}function Ea(t){return t.interceptors_!==void 0&&t.interceptors_.length>0}function Dp(t,e){var r=t.interceptors_||(t.interceptors_=[]);return r.push(e),tS(function(){var n=r.indexOf(e);n!==-1&&r.splice(n,1)})}function Ta(t,e){var r=Cc();try{for(var n=[].concat(t.interceptors_||[]),i=0,a=n.length;i<a&&(e=n[i](e),e&&!e.type&&zt(14),!!e);i++);return e}finally{$s(r)}}function to(t){return t.changeListeners_!==void 0&&t.changeListeners_.length>0}function Np(t,e){var r=t.changeListeners_||(t.changeListeners_=[]);return r.push(e),tS(function(){var n=r.indexOf(e);n!==-1&&r.splice(n,1)})}function ro(t,e){var r=Cc(),n=t.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](e);$s(r)}}function HS(t,e,r){return Oc(function(){var n,i=Ed(t,r)[At];(n=e)!=null||(e=r_(t)),s0(e).forEach(function(a){return i.make_(a,e[a])})}),t}var ew="splice",$o="update",O9=1e4,A9={get:function(e,r){var n=e[At];return r===At?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):Hs(Ng,r)?Ng[r]:e[r]},set:function(e,r,n){var i=e[At];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?e[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){zt(15)}},v2=(function(){function t(r,n,i,a){r===void 0&&(r="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=a,this.atom_=new pu(r),this.enhancer_=function(o,s){return n(o,s,"ObservableArray[..]")}}var e=t.prototype;return e.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},e.dehanceValues_=function(n){return this.dehancer!==void 0&&n.length>0?n.map(this.dehancer):n},e.intercept_=function(n){return Dp(this,n)},e.observe_=function(n,i){return i===void 0&&(i=!1),i&&n({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Np(this,n)},e.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},e.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&zt("Out of range: "+n);var i=this.values_.length;if(n!==i)if(n>i){for(var a=new Array(n-i),o=0;o<n-i;o++)a[o]=void 0;this.spliceWithArray_(i,0,a)}else this.spliceWithArray_(n,i-n)},e.updateArrayLength_=function(n,i){n!==this.lastKnownLength_&&zt(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&XS(n+i+1)},e.spliceWithArray_=function(n,i,a){var o=this;this.atom_;var s=this.values_.length;if(n===void 0?n=0:n>s?n=s:n<0&&(n=Math.max(0,s+n)),arguments.length===1?i=s-n:i==null?i=0:i=Math.max(0,Math.min(i,s-n)),a===void 0&&(a=wv),Ea(this)){var u=Ta(this,{object:this.proxy_,type:ew,index:n,removedCount:i,added:a});if(!u)return wv;i=u.removedCount,a=u.added}if(a=a.length===0?a:a.map(function(h){return o.enhancer_(h,void 0)}),this.legacyMode_){var f=a.length-i;this.updateArrayLength_(s,f)}var d=this.spliceItemsIntoValues_(n,i,a);return(i!==0||a.length!==0)&&this.notifyArraySplice_(n,a,d),this.dehanceValues_(d)},e.spliceItemsIntoValues_=function(n,i,a){if(a.length<O9){var o;return(o=this.values_).splice.apply(o,[n,i].concat(a))}else{var s=this.values_.slice(n,n+i),u=this.values_.slice(n+i);this.values_.length+=a.length-i;for(var f=0;f<a.length;f++)this.values_[n+f]=a[f];for(var d=0;d<u.length;d++)this.values_[n+a.length+d]=u[d];return s}},e.notifyArrayChildUpdate_=function(n,i,a){var o=!this.owned_&&Zh(),s=to(this),u=s||o?{observableKind:"array",object:this.proxy_,type:$o,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:a}:null;this.atom_.reportChanged(),s&&ro(this,u)},e.notifyArraySplice_=function(n,i,a){var o=!this.owned_&&Zh(),s=to(this),u=s||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:ew,index:n,removed:a,added:i,removedCount:a.length,addedCount:i.length}:null;this.atom_.reportChanged(),s&&ro(this,u)},e.get_=function(n){if(this.legacyMode_&&n>=this.values_.length){console.warn("[mobx] Out of bounds read: "+n);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[n])},e.set_=function(n,i){var a=this.values_;if(this.legacyMode_&&n>a.length&&zt(17,n,a.length),n<a.length){this.atom_;var o=a[n];if(Ea(this)){var s=Ta(this,{type:$o,object:this.proxy_,index:n,newValue:i});if(!s)return;i=s.newValue}i=this.enhancer_(i,o);var u=i!==o;u&&(a[n]=i,this.notifyArrayChildUpdate_(n,i,o))}else{for(var f=new Array(n+1-a.length),d=0;d<f.length-1;d++)f[d]=void 0;f[f.length-1]=i,this.spliceWithArray_(a.length,0,f)}},t})();function I9(t,e,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),eS(),Oc(function(){var i=new v2(r,e,n,!1);nS(i.values_,At,i);var a=new Proxy(i.values_,A9);return i.proxy_=a,t&&t.length&&i.spliceWithArray_(0,0,t),a})}var Ng={clear:function(){return this.splice(0)},replace:function(e){var r=this[At];return r.spliceWithArray_(0,r.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];var o=this[At];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,r)}return o.spliceWithArray_(e,r,i)},spliceWithArray:function(e,r,n){return this[At].spliceWithArray_(e,r,n)},push:function(){for(var e=this[At],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.spliceWithArray_(e.values_.length,0,n),e.values_.length},pop:function(){return this.splice(Math.max(this[At].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[At],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.spliceWithArray_(0,0,n),e.values_.length},reverse:function(){return nt.trackingDerivation&&zt(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){nt.trackingDerivation&&zt(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var r=this[At],n=r.dehanceValues_(r.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};Ar("at",ua);Ar("concat",ua);Ar("flat",ua);Ar("includes",ua);Ar("indexOf",ua);Ar("join",ua);Ar("lastIndexOf",ua);Ar("slice",ua);Ar("toString",ua);Ar("toLocaleString",ua);Ar("toSorted",ua);Ar("toSpliced",ua);Ar("with",ua);Ar("every",ao);Ar("filter",ao);Ar("find",ao);Ar("findIndex",ao);Ar("findLast",ao);Ar("findLastIndex",ao);Ar("flatMap",ao);Ar("forEach",ao);Ar("map",ao);Ar("some",ao);Ar("toReversed",ao);Ar("reduce",$S);Ar("reduceRight",$S);function Ar(t,e){typeof Array.prototype[t]=="function"&&(Ng[t]=e(t))}function ua(t){return function(){var e=this[At];e.atom_.reportObserved();var r=e.dehanceValues_(e.values_);return r[t].apply(r,arguments)}}function ao(t){return function(e,r){var n=this,i=this[At];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[t](function(o,s){return e.call(r,o,s,n)})}}function $S(t){return function(){var e=this,r=this[At];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(a,o,s){return i(a,o,s,e)},n[t].apply(n,arguments)}}var R9=hu("ObservableArrayAdministration",v2);function Yo(t){return a0(t)&&R9(t[At])}var M9={},eu="add",Lg="delete",b2=(function(){function t(r,n,i){var a=this;n===void 0&&(n=Sc),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[At]=M9,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=i,sa(Map)||zt(18),Oc(function(){a.keysAtom_=Og("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,r&&a.merge(r)})}var e=t.prototype;return e.has_=function(n){return this.data_.has(n)},e.has=function(n){var i=this;if(!nt.trackingDerivation)return this.has_(n);var a=this.hasMap_.get(n);if(!a){var o=a=new su(this.has_(n),l0,"ObservableMap.key?",!1);this.hasMap_.set(n,o),RS(o,function(){return i.hasMap_.delete(n)})}return a.get()},e.set=function(n,i){var a=this.has_(n);if(Ea(this)){var o=Ta(this,{type:a?$o:eu,object:this,newValue:i,name:n});if(!o)return this;i=o.newValue}return a?this.updateValue_(n,i):this.addValue_(n,i),this},e.delete=function(n){var i=this;if(this.keysAtom_,Ea(this)){var a=Ta(this,{type:Lg,object:this,name:n});if(!a)return!1}if(this.has_(n)){var o=Zh(),s=to(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:Lg,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return Fs(function(){var f;i.keysAtom_.reportChanged(),(f=i.hasMap_.get(n))==null||f.setNewValue_(!1);var d=i.data_.get(n);d.setNewValue_(void 0),i.data_.delete(n)}),s&&ro(this,u),!0}return!1},e.updateValue_=function(n,i){var a=this.data_.get(n);if(i=a.prepareNewValue_(i),i!==nt.UNCHANGED){var o=Zh(),s=to(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:$o,object:this,oldValue:a.value_,name:n,newValue:i}:null;a.setNewValue_(i),s&&ro(this,u)}},e.addValue_=function(n,i){var a=this;this.keysAtom_,Fs(function(){var f,d=new su(i,a.enhancer_,"ObservableMap.key",!1);a.data_.set(n,d),i=d.value_,(f=a.hasMap_.get(n))==null||f.setNewValue_(!0),a.keysAtom_.reportChanged()});var o=Zh(),s=to(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:eu,object:this,name:n,newValue:i}:null;s&&ro(this,u)},e.get=function(n){return this.has(n)?this.dehanceValue_(this.data_.get(n).get()):this.dehanceValue_(void 0)},e.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},e.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},e.values=function(){var n=this,i=this.keys();return tw({next:function(){var o=i.next(),s=o.done,u=o.value;return{done:s,value:s?void 0:n.get(u)}}})},e.entries=function(){var n=this,i=this.keys();return tw({next:function(){var o=i.next(),s=o.done,u=o.value;return{done:s,value:s?void 0:[u,n.get(u)]}}})},e[Symbol.iterator]=function(){return this.entries()},e.forEach=function(n,i){for(var a=Zf(this),o;!(o=a()).done;){var s=o.value,u=s[0],f=s[1];n.call(i,f,u,this)}},e.merge=function(n){var i=this;return Ma(n)&&(n=new Map(n)),Fs(function(){uu(n)?K6(n).forEach(function(a){return i.set(a,n[a])}):Array.isArray(n)?n.forEach(function(a){var o=a[0],s=a[1];return i.set(o,s)}):_d(n)?(Y6(n)||zt(19,n),n.forEach(function(a,o){return i.set(o,a)})):n!=null&&zt(20,n)}),this},e.clear=function(){var n=this;Fs(function(){vS(function(){for(var i=Zf(n.keys()),a;!(a=i()).done;){var o=a.value;n.delete(o)}})})},e.replace=function(n){var i=this;return Fs(function(){for(var a=D9(n),o=new Map,s=!1,u=Zf(i.data_.keys()),f;!(f=u()).done;){var d=f.value;if(!a.has(d)){var h=i.delete(d);if(h)s=!0;else{var p=i.data_.get(d);o.set(d,p)}}}for(var y=Zf(a.entries()),v;!(v=y()).done;){var b=v.value,x=b[0],k=b[1],S=i.data_.has(x);if(i.set(x,k),i.data_.has(x)){var P=i.data_.get(x);o.set(x,P),S||(s=!0)}}if(!s)if(i.data_.size!==o.size)i.keysAtom_.reportChanged();else for(var _=i.data_.keys(),E=o.keys(),A=_.next(),T=E.next();!A.done;){if(A.value!==T.value){i.keysAtom_.reportChanged();break}A=_.next(),T=E.next()}i.data_=o}),this},e.toString=function(){return"[object ObservableMap]"},e.toJSON=function(){return Array.from(this)},e.observe_=function(n,i){return Np(this,n)},e.intercept_=function(n){return Dp(this,n)},Pd(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),Ma=hu("ObservableMap",b2);function tw(t){return t[Symbol.toStringTag]="MapIterator",x2(t)}function D9(t){if(_d(t)||Ma(t))return t;if(Array.isArray(t))return new Map(t);if(uu(t)){var e=new Map;for(var r in t)e.set(r,t[r]);return e}else return zt(21,t)}var N9={},qS=(function(){function t(r,n,i){var a=this;n===void 0&&(n=Sc),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[At]=N9,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,sa(Set)||zt(22),this.enhancer_=function(o,s){return n(o,s,i)},Oc(function(){a.atom_=Og(a.name_),r&&a.replace(r)})}var e=t.prototype;return e.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},e.clear=function(){var n=this;Fs(function(){vS(function(){for(var i=Zf(n.data_.values()),a;!(a=i()).done;){var o=a.value;n.delete(o)}})})},e.forEach=function(n,i){for(var a=Zf(this),o;!(o=a()).done;){var s=o.value;n.call(i,s,s,this)}},e.add=function(n){var i=this;if(this.atom_,Ea(this)){var a=Ta(this,{type:eu,object:this,newValue:n});if(!a)return this;n=a.newValue}if(!this.has(n)){Fs(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var o=!1,s=to(this),u=s||o?{observableKind:"set",debugObjectName:this.name_,type:eu,object:this,newValue:n}:null;s&&ro(this,u)}return this},e.delete=function(n){var i=this;if(Ea(this)){var a=Ta(this,{type:Lg,object:this,oldValue:n});if(!a)return!1}if(this.has(n)){var o=!1,s=to(this),u=s||o?{observableKind:"set",debugObjectName:this.name_,type:Lg,object:this,oldValue:n}:null;return Fs(function(){i.atom_.reportChanged(),i.data_.delete(n)}),s&&ro(this,u),!0}return!1},e.has=function(n){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(n))},e.entries=function(){var n=this.values();return rw({next:function(){var a=n.next(),o=a.value,s=a.done;return s?{value:void 0,done:s}:{value:[o,o],done:s}}})},e.keys=function(){return this.values()},e.values=function(){this.atom_.reportObserved();var n=this,i=this.data_.values();return rw({next:function(){var o=i.next(),s=o.value,u=o.done;return u?{value:void 0,done:u}:{value:n.dehanceValue_(s),done:u}}})},e.intersection=function(n){if(Ns(n)&&!ki(n))return n.intersection(this);var i=new Set(this);return i.intersection(n)},e.union=function(n){if(Ns(n)&&!ki(n))return n.union(this);var i=new Set(this);return i.union(n)},e.difference=function(n){return new Set(this).difference(n)},e.symmetricDifference=function(n){if(Ns(n)&&!ki(n))return n.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(n)},e.isSubsetOf=function(n){return new Set(this).isSubsetOf(n)},e.isSupersetOf=function(n){return new Set(this).isSupersetOf(n)},e.isDisjointFrom=function(n){if(Ns(n)&&!ki(n))return n.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(n)},e.replace=function(n){var i=this;return ki(n)&&(n=new Set(n)),Fs(function(){Array.isArray(n)?(i.clear(),n.forEach(function(a){return i.add(a)})):Ns(n)?(i.clear(),n.forEach(function(a){return i.add(a)})):n!=null&&zt("Cannot initialize set from "+n)}),this},e.observe_=function(n,i){return Np(this,n)},e.intercept_=function(n){return Dp(this,n)},e.toJSON=function(){return Array.from(this)},e.toString=function(){return"[object ObservableSet]"},e[Symbol.iterator]=function(){return this.values()},Pd(t,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),ki=hu("ObservableSet",qS);function rw(t){return t[Symbol.toStringTag]="SetIterator",x2(t)}var nw=Object.create(null),iw="remove",VS=(function(){function t(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=E_),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=a,this.keysAtom_=new pu("ObservableObject.keys"),this.isPlainObject_=uu(this.target_)}var e=t.prototype;return e.getObservablePropValue_=function(n){return this.values_.get(n).get()},e.setObservablePropValue_=function(n,i){var a=this.values_.get(n);if(a instanceof no)return a.set(i),!0;if(Ea(this)){var o=Ta(this,{type:$o,object:this.proxy_||this.target_,name:n,newValue:i});if(!o)return null;i=o.newValue}if(i=a.prepareNewValue_(i),i!==nt.UNCHANGED){var s=to(this),u=!1,f=s||u?{type:$o,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:a.value_,name:n,newValue:i}:null;a.setNewValue_(i),s&&ro(this,f)}return!0},e.get_=function(n){return nt.trackingDerivation&&!Hs(this.target_,n)&&this.has_(n),this.target_[n]},e.set_=function(n,i,a){return a===void 0&&(a=!1),Hs(this.target_,n)?this.values_.has(n)?this.setObservablePropValue_(n,i):a?Reflect.set(this.target_,n,i):(this.target_[n]=i,!0):this.extend_(n,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,a)},e.has_=function(n){if(!nt.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new su(n in this.target_,l0,"ObservableObject.key?",!1),this.pendingKeys_.set(n,i)),i.get()},e.make_=function(n,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(!(n in this.target_)){var a;if((a=this.target_[Bo])!=null&&a[n])return;zt(1,i.annotationType_,this.name_+"."+n.toString())}for(var o=this.target_;o&&o!==i0;){var s=Cg(o,n);if(s){var u=i.make_(this,n,s,o);if(u===0)return;if(u===1)break}o=Object.getPrototypeOf(o)}ow(this,i,n)}},e.extend_=function(n,i,a,o){if(o===void 0&&(o=!1),a===!0&&(a=this.defaultAnnotation_),a===!1)return this.defineProperty_(n,i,o);var s=a.extend_(this,n,i,o);return s&&ow(this,a,n),s},e.defineProperty_=function(n,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Ni();var o=this.delete_(n);if(!o)return o;if(Ea(this)){var s=Ta(this,{object:this.proxy_||this.target_,name:n,type:eu,newValue:i.value});if(!s)return null;var u=s.newValue;i.value!==u&&(i=cu({},i,{value:u}))}if(a){if(!Reflect.defineProperty(this.target_,n,i))return!1}else Uo(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{Li()}return!0},e.defineObservableProperty_=function(n,i,a,o){o===void 0&&(o=!1),this.keysAtom_;try{Ni();var s=this.delete_(n);if(!s)return s;if(Ea(this)){var u=Ta(this,{object:this.proxy_||this.target_,name:n,type:eu,newValue:i});if(!u)return null;i=u.newValue}var f=aw(n),d={configurable:nt.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:f.get,set:f.set};if(o){if(!Reflect.defineProperty(this.target_,n,d))return!1}else Uo(this.target_,n,d);var h=new su(i,a,"ObservableObject.key",!1);this.values_.set(n,h),this.notifyPropertyAddition_(n,h.value_)}finally{Li()}return!0},e.defineComputedProperty_=function(n,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Ni();var o=this.delete_(n);if(!o)return o;if(Ea(this)){var s=Ta(this,{object:this.proxy_||this.target_,name:n,type:eu,newValue:void 0});if(!s)return null}i.name||(i.name="ObservableObject.key"),i.context=this.proxy_||this.target_;var u=aw(n),f={configurable:nt.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,n,f))return!1}else Uo(this.target_,n,f);this.values_.set(n,new no(i)),this.notifyPropertyAddition_(n,void 0)}finally{Li()}return!0},e.delete_=function(n,i){if(i===void 0&&(i=!1),this.keysAtom_,!Hs(this.target_,n))return!0;if(Ea(this)){var a=Ta(this,{object:this.proxy_||this.target_,name:n,type:iw});if(!a)return null}try{var o;Ni();var s=to(this),u=!1,f=this.values_.get(n),d=void 0;if(!f&&(s||u)){var h;d=(h=Cg(this.target_,n))==null?void 0:h.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(f&&(this.values_.delete(n),f instanceof su&&(d=f.value_),_S(f)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(n))==null||o.set(n in this.target_),s||u){var p={type:iw,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:n};s&&ro(this,p)}}finally{Li()}return!0},e.observe_=function(n,i){return Np(this,n)},e.intercept_=function(n){return Dp(this,n)},e.notifyPropertyAddition_=function(n,i){var a,o=to(this),s=!1;if(o||s){var u=o||s?{type:eu,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;o&&ro(this,u)}(a=this.pendingKeys_)==null||(a=a.get(n))==null||a.set(!0),this.keysAtom_.reportChanged()},e.ownKeys_=function(){return this.keysAtom_.reportObserved(),s0(this.target_)},e.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},t})();function Ed(t,e){var r;if(Hs(t,At))return t;var n=(r=e?.name)!=null?r:"ObservableObject",i=new VS(t,new Map,String(n),F_(e));return o0(t,At,i),t}var L9=hu("ObservableObjectAdministration",VS);function aw(t){return nw[t]||(nw[t]={get:function(){return this[At].getObservablePropValue_(t)},set:function(r){return this[At].setObservablePropValue_(t,r)}})}function oo(t){return a0(t)?L9(t[At]):!1}function ow(t,e,r){var n;(n=t.target_[Bo])==null||delete n[r]}var F9=GS(0),B9=(function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,t===!1})(),v1=0,WS=function(){};function z9(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t.prototype,e):t.prototype.__proto__!==void 0?t.prototype.__proto__=e:t.prototype=e}z9(WS,Array.prototype);var w2=(function(t){function e(n,i,a,o){var s;return a===void 0&&(a="ObservableArray"),o===void 0&&(o=!1),s=t.call(this)||this,Oc(function(){var u=new v2(a,i,o,!0);u.proxy_=s,nS(s,At,u),n&&n.length&&s.spliceWithArray(0,0,n),B9&&Object.defineProperty(s,"0",F9)}),s}oS(e,t);var r=e.prototype;return r.concat=function(){this[At].atom_.reportObserved();for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),a.map(function(s){return Yo(s)?s.slice():s}))},r[Symbol.iterator]=function(){var n=this,i=0;return x2({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},Pd(e,[{key:"length",get:function(){return this[At].getArrayLength_()},set:function(i){this[At].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(WS);Object.entries(Ng).forEach(function(t){var e=t[0],r=t[1];e!=="concat"&&o0(w2.prototype,e,r)});function GS(t){return{enumerable:!1,configurable:!0,get:function(){return this[At].get_(t)},set:function(r){this[At].set_(t,r)}}}function j9(t){Uo(w2.prototype,""+t,GS(t))}function XS(t){if(t>v1){for(var e=v1;e<t+100;e++)j9(e);v1=t}}XS(1e3);function U9(t,e,r){return new w2(t,e,r)}function vd(t,e){if(typeof t=="object"&&t!==null){if(Yo(t))return e!==void 0&&zt(23),t[At].atom_;if(ki(t))return t.atom_;if(Ma(t)){if(e===void 0)return t.keysAtom_;var r=t.data_.get(e)||t.hasMap_.get(e);return r||zt(25,e,Ov(t)),r}if(oo(t)){if(!e)return zt(26);var n=t[At].values_.get(e);return n||zt(27,e,Ov(t)),n}if(h2(t)||d0(t)||Mg(t))return t}else if(sa(t)&&Mg(t[At]))return t[At];zt(28)}function Wo(t,e){if(t||zt(29),e!==void 0)return Wo(vd(t,e));if(h2(t)||d0(t)||Mg(t)||Ma(t)||ki(t))return t;if(t[At])return t[At];zt(24,t)}function Ov(t,e){var r;if(e!==void 0)r=vd(t,e);else{if(gd(t))return t.name;oo(t)||Ma(t)||ki(t)?r=Wo(t):r=vd(t)}return r.name_}function Oc(t){var e=Cc(),r=c0(!0);Ni();try{return t()}finally{Li(),f0(r),$s(e)}}var sw=i0.toString;function YS(t,e,r){return r===void 0&&(r=-1),Av(t,e,r)}function Av(t,e,r,n,i){if(t===e)return t!==0||1/t===1/e;if(t==null||e==null)return!1;if(t!==t)return e!==e;var a=typeof t;if(a!=="function"&&a!=="object"&&typeof e!="object")return!1;var o=sw.call(t);if(o!==sw.call(e))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:+t==0?1/+t===1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(t)===Symbol.valueOf.call(e);case"[object Map]":case"[object Set]":r>=0&&r++;break}t=lw(t),e=lw(e);var s=o==="[object Array]";if(!s){if(typeof t!="object"||typeof e!="object")return!1;var u=t.constructor,f=e.constructor;if(u!==f&&!(sa(u)&&u instanceof u&&sa(f)&&f instanceof f)&&"constructor"in t&&"constructor"in e)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var d=n.length;d--;)if(n[d]===t)return i[d]===e;if(n.push(t),i.push(e),s){if(d=t.length,d!==e.length)return!1;for(;d--;)if(!Av(t[d],e[d],r-1,n,i))return!1}else{var h=Object.keys(t),p=h.length;if(Object.keys(e).length!==p)return!1;for(var y=0;y<p;y++){var v=h[y];if(!(Hs(e,v)&&Av(t[v],e[v],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function lw(t){return Yo(t)?t.slice():_d(t)||Ma(t)||Ns(t)||ki(t)?Array.from(t.entries()):t}var uw,H9=((uw=n0().Iterator)==null?void 0:uw.prototype)||{};function x2(t){return t[Symbol.iterator]=$9,Object.assign(Object.create(H9),t)}function $9(){return this}["Symbol","Map","Set"].forEach(function(t){var e=n0();typeof e[t]>"u"&&zt("MobX requires global '"+t+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:r9,extras:{getDebugName:Ov},$mobx:At});if(!Hr.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!HS)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var KS=Qx();function q9(t){t()}function V9(t){t||(t=q9),p9({reactionScheduler:t})}function W9(t){return g9(t)}var G9=1e4,X9=1e4,Y9=(function(){function t(e){var r=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(n){n===void 0&&(n=G9),clearTimeout(r.sweepTimeout),r.sweepTimeout=void 0;var i=Date.now();r.registrations.forEach(function(a,o){i-a.registeredAt>=n&&(r.finalize(a.value),r.registrations.delete(o))}),r.registrations.size>0&&r.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.sweep(0)}})}return Object.defineProperty(t.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){this.registrations.set(n,{value:r,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(t.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(t.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,X9))}}),t})(),K9=typeof FinalizationRegistry<"u"?FinalizationRegistry:Y9,Iv=new K9(function(t){var e;(e=t.reaction)===null||e===void 0||e.dispose(),t.reaction=null}),b1={exports:{}},w1={};var cw;function Q9(){if(cw)return w1;cw=1;var t=Ap();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function s(h,p){var y=p(),v=n({inst:{value:y,getSnapshot:p}}),b=v[0].inst,x=v[1];return a(function(){b.value=y,b.getSnapshot=p,u(b)&&x({inst:b})},[h,y,p]),i(function(){return u(b)&&x({inst:b}),h(function(){u(b)&&x({inst:b})})},[h]),o(y),y}function u(h){var p=h.getSnapshot;h=h.value;try{var y=p();return!r(h,y)}catch{return!0}}function f(h,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:s;return w1.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,w1}var fw;function Z9(){return fw||(fw=1,b1.exports=Q9()),b1.exports}var J9=Z9();function dw(t){t.reaction=new Vo("observer".concat(t.name),function(){var e;t.stateVersion=Symbol(),(e=t.onStoreChange)===null||e===void 0||e.call(t)})}function eP(t,e){e===void 0&&(e="observed");var r=Y.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:e,subscribe:function(s){return Iv.unregister(n),n.onStoreChange=s,n.reaction||(dw(n),n.stateVersion=Symbol()),function(){var u;n.onStoreChange=null,(u=n.reaction)===null||u===void 0||u.dispose(),n.reaction=null}},getSnapshot:function(){return n.stateVersion}};r.current=n}var i=r.current;i.reaction||(dw(i),Iv.register(r,i,i)),Y.useDebugValue(i.reaction,W9),J9.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var a,o;if(i.reaction.track(function(){try{a=t()}catch(s){o=s}}),o)throw o;return a}var x1,S1,QS=typeof Symbol=="function"&&Symbol.for,tP=(S1=(x1=Object.getOwnPropertyDescriptor(function(){},"name"))===null||x1===void 0?void 0:x1.configurable)!==null&&S1!==void 0?S1:!1,hw=QS?Symbol.for("react.forward_ref"):typeof Hr.forwardRef=="function"&&Hr.forwardRef(function(t){return null}).$$typeof,pw=QS?Symbol.for("react.memo"):typeof Hr.memo=="function"&&Hr.memo(function(t){return null}).$$typeof;function Sr(t,e){var r;if(pw&&t.$$typeof===pw)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var n=(r=void 0)!==null&&r!==void 0?r:!1,i=t,a=t.displayName||t.name;if(hw&&t.$$typeof===hw&&(n=!0,i=t.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o=function(s,u){return eP(function(){return i(s,u)},a)};return o.displayName=t.displayName,tP&&Object.defineProperty(o,"name",{value:t.name,writable:!0,configurable:!0}),t.contextTypes&&(o.contextTypes=t.contextTypes),n&&(o=Hr.forwardRef(o)),o=Hr.memo(o),nP(t,o),o}var rP={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function nP(t,e){Object.keys(t).forEach(function(r){rP[r]||Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}function iP(t,e){return Hr.useState(function(){return Gt(t(),e,{autoBind:!0})})[0]}var k1;V9(KS.unstable_batchedUpdates);k1=Iv.finalizeAllImmediately;const aP=Math.PI/180;function oP(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const dc=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},et={_global:dc,version:"10.2.0",isBrowser:oP(),isUnminified:/param/.test((function(t){}).toString()),dblClickWindow:400,getAngle(t){return et.angleDeg?t*aP:t},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return et.DD.isDragging},isTransforming(){var t,e;return(e=(t=et.Transformer)===null||t===void 0?void 0:t.isTransforming())!==null&&e!==void 0?e:!1},isDragReady(){return!!et.DD.node},releaseCanvasOnDestroy:!0,document:dc.document,_injectGlobal(t){typeof dc.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),dc.Konva=t}},qr=t=>{et[t.prototype.getClassName()]=t};et._injectGlobal(et);const sP=`Konva.js unsupported environment.
11
+
12
+ Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
13
+
14
+ To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
15
+
16
+ bash: npm install canvas
17
+ js: import "konva/canvas-backend";
18
+
19
+ or
20
+
21
+ bash: npm install skia-canvas
22
+ js: import "konva/skia-backend";
23
+ `,mw=()=>{if(typeof document>"u")throw new Error(sP)};class aa{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new aa(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){const r=this.m;return{x:r[0]*e.x+r[2]*e.y+r[4],y:r[1]*e.x+r[3]*e.y+r[5]}}translate(e,r){return this.m[4]+=this.m[0]*e+this.m[2]*r,this.m[5]+=this.m[1]*e+this.m[3]*r,this}scale(e,r){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=r,this.m[3]*=r,this}rotate(e){const r=Math.cos(e),n=Math.sin(e),i=this.m[0]*r+this.m[2]*n,a=this.m[1]*r+this.m[3]*n,o=this.m[0]*-n+this.m[2]*r,s=this.m[1]*-n+this.m[3]*r;return this.m[0]=i,this.m[1]=a,this.m[2]=o,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,r){const n=this.m[0]+this.m[2]*r,i=this.m[1]+this.m[3]*r,a=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=i,this.m[2]=a,this.m[3]=o,this}multiply(e){const r=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],s=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=r,this.m[1]=n,this.m[2]=i,this.m[3]=a,this.m[4]=o,this.m[5]=s,this}invert(){const e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),r=this.m[3]*e,n=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=r,this.m[1]=n,this.m[2]=i,this.m[3]=a,this.m[4]=o,this.m[5]=s,this}getMatrix(){return this.m}decompose(){const e=this.m[0],r=this.m[1],n=this.m[2],i=this.m[3],a=this.m[4],o=this.m[5],s=e*i-r*n,u={x:a,y:o,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||r!=0){const f=Math.sqrt(e*e+r*r);u.rotation=r>0?Math.acos(e/f):-Math.acos(e/f),u.scaleX=f,u.scaleY=s/f,u.skewX=(e*n+r*i)/s,u.skewY=0}else if(n!=0||i!=0){const f=Math.sqrt(n*n+i*i);u.rotation=Math.PI/2-(i>0?Math.acos(-n/f):-Math.acos(n/f)),u.scaleX=s/f,u.scaleY=f,u.skewX=0,u.skewY=(e*n+r*i)/s}return u.rotation=Pe._getRotation(u.rotation),u}}const lP="[object Array]",uP="[object Number]",cP="[object String]",fP="[object Boolean]",dP=Math.PI/180,hP=180/Math.PI,Eh="#",pP="",mP="0",gP="Konva warning: ",gw="Konva error: ",yP="rgb(",_1={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},vP=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let Qm=[],Th=null;const bP=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,16)},Pe={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===lP},_isNumber(t){return Object.prototype.toString.call(t)===uP&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===cP},_isBoolean(t){return Object.prototype.toString.call(t)===fP},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;const e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Qm.push(t),Qm.length===1&&bP(function(){const e=Qm;Qm=[],e.forEach(function(r){r()})})},createCanvasElement(){mw();const t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return mw(),document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){const r=Pe.createImageElement();r.onload=function(){e(r)},r.src=t},_rgbToHex(t,e,r){return((1<<24)+(t<<16)+(e<<8)+r).toString(16).slice(1)},_hexToRgb(t){t=t.replace(Eh,pP);const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){let t=(Math.random()*16777215<<0).toString(16);for(;t.length<6;)t=mP+t;return Eh+t},isCanvasFarblingActive(){if(Th!==null)return Th;if(typeof document>"u")return Th=!1,!1;const t=this.createCanvasElement();t.width=10,t.height=10;const e=t.getContext("2d",{willReadFrequently:!0});e.clearRect(0,0,10,10),e.fillStyle="#282828",e.fillRect(0,0,10,10);const r=e.getImageData(0,0,10,10).data;let n=!1;for(let i=0;i<100;i++)if(r[i*4]!==40||r[i*4+1]!==40||r[i*4+2]!==40||r[i*4+3]!==255){n=!0;break}return Th=n,this.releaseCanvas(t),Th},getHitColor(){const t=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(t):t},getHitColorKey(t,e,r){return this.isCanvasFarblingActive()&&(t=Math.round(t/5)*5,e=Math.round(e/5)*5,r=Math.round(r/5)*5),Eh+this._rgbToHex(t,e,r)},getSnappedHexColor(t){const e=this._hexToRgb(t);return Eh+this._rgbToHex(Math.round(e.r/5)*5,Math.round(e.g/5)*5,Math.round(e.b/5)*5)},getRGB(t){let e;return t in _1?(e=_1[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Eh?this._hexToRgb(t.substring(1)):t.substr(0,4)===yP?(e=vP.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",Pe._namedColorToRBA(t)||Pe._hex3ColorToRGBA(t)||Pe._hex4ColorToRGBA(t)||Pe._hex6ColorToRGBA(t)||Pe._hex8ColorToRGBA(t)||Pe._rgbColorToRGBA(t)||Pe._rgbaColorToRGBA(t)||Pe._hslColorToRGBA(t)},_namedColorToRBA(t){const e=_1[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];const e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];const e=t.split(/ *, */).map((r,n)=>r.slice(-1)==="%"?n===3?parseInt(r)/100:parseInt(r)/100*255:Number(r));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...r]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),n=Number(r[0])/360,i=Number(r[1])/100,a=Number(r[2])/100;let o,s,u;if(i===0)return u=a*255,{r:Math.round(u),g:Math.round(u),b:Math.round(u),a:1};a<.5?o=a*(1+i):o=a+i-a*i;const f=2*a-o,d=[0,0,0];for(let h=0;h<3;h++)s=n+1/3*-(h-1),s<0&&s++,s>1&&s--,6*s<1?u=f+(o-f)*6*s:2*s<1?u=o:3*s<2?u=f+(o-f)*(2/3-s)*6:u=f,d[h]=u*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y)},cloneObject(t){const e={};for(const r in t)this._isPlainObject(t[r])?e[r]=this.cloneObject(t[r]):this._isArray(t[r])?e[r]=this.cloneArray(t[r]):e[r]=t[r];return e},cloneArray(t){return t.slice(0)},degToRad(t){return t*dP},radToDeg(t){return t*hP},_degToRad(t){return Pe.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Pe.degToRad(t)},_radToDeg(t){return Pe.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Pe.radToDeg(t)},_getRotation(t){return et.angleDeg?Pe.radToDeg(t):t},_capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw(t){throw new Error(gw+t)},error(t){console.error(gw+t)},warn(t){et.showWarnings&&console.warn(gP+t)},each(t,e){for(const r in t)e(r,t[r])},_inRange(t,e,r){return e<=t&&t<r},_getProjectionToSegment(t,e,r,n,i,a){let o,s,u;const f=(t-r)*(t-r)+(e-n)*(e-n);if(f==0)o=t,s=e,u=(i-r)*(i-r)+(a-n)*(a-n);else{const d=((i-t)*(r-t)+(a-e)*(n-e))/f;d<0?(o=t,s=e,u=(t-i)*(t-i)+(e-a)*(e-a)):d>1?(o=r,s=n,u=(r-i)*(r-i)+(n-a)*(n-a)):(o=t+d*(r-t),s=e+d*(n-e),u=(o-i)*(o-i)+(s-a)*(s-a))}return[o,s,u]},_getProjectionToLine(t,e,r){const n=Pe.cloneObject(t);let i=Number.MAX_VALUE;return e.forEach(function(a,o){if(!r&&o===e.length-1)return;const s=e[(o+1)%e.length],u=Pe._getProjectionToSegment(a.x,a.y,s.x,s.y,t.x,t.y),f=u[0],d=u[1],h=u[2];h<i&&(n.x=f,n.y=d,i=h)}),n},_prepareArrayForTween(t,e,r){const n=[],i=[];if(t.length>e.length){const o=e;e=t,t=o}for(let o=0;o<t.length;o+=2)n.push({x:t[o],y:t[o+1]});for(let o=0;o<e.length;o+=2)i.push({x:e[o],y:e[o+1]});const a=[];return i.forEach(function(o){const s=Pe._getProjectionToLine(o,n,r);a.push(s.x),a.push(s.y)}),a},_prepareToStringify(t){let e;t.visitedByCircularReferenceRemoval=!0;for(const r in t)if(t.hasOwnProperty(r)&&t[r]&&typeof t[r]=="object"){if(e=Object.getOwnPropertyDescriptor(t,r),t[r].visitedByCircularReferenceRemoval||Pe._isElement(t[r]))if(e.configurable)delete t[r];else return null;else if(Pe._prepareToStringify(t[r])===null)if(e.configurable)delete t[r];else return null}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(const r in e)t[r]=e[r];return t},_getFirstPointerId(t){return t.touches?t.changedTouches[0].identifier:t.pointerId||999},releaseCanvas(...t){et.releaseCanvasOnDestroy&&t.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(t,e,r,n){let i=e<0?e:0,a=r<0?r:0;e=Math.abs(e),r=Math.abs(r);let o=0,s=0,u=0,f=0;typeof n=="number"?o=s=u=f=Math.min(n,e/2,r/2):(o=Math.min(n[0]||0,e/2,r/2),s=Math.min(n[1]||0,e/2,r/2),f=Math.min(n[2]||0,e/2,r/2),u=Math.min(n[3]||0,e/2,r/2)),t.moveTo(i+o,a),t.lineTo(i+e-s,a),t.arc(i+e-s,a+s,s,Math.PI*3/2,0,!1),t.lineTo(i+e,a+r-f),t.arc(i+e-f,a+r-f,f,0,Math.PI/2,!1),t.lineTo(i+u,a+r),t.arc(i+u,a+r-u,u,Math.PI/2,Math.PI,!1),t.lineTo(i,a+o),t.arc(i+o,a+o,o,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(t,e,r,n,i){n=Math.abs(n);for(let a=0;a<r;a++){const o=e[(a-1+r)%r],s=e[a],u=e[(a+1)%r],f={x:s.x-o.x,y:s.y-o.y},d={x:u.x-s.x,y:u.y-s.y},h=Math.hypot(f.x,f.y),p=Math.hypot(d.x,d.y);let y;typeof i=="number"?y=i:y=a<i.length?i[a]:0,y=n*Math.cos(Math.PI/r)*Math.min(1,y/n*2);const b={x:f.x/h,y:f.y/h},x={x:d.x/p,y:d.y/p},k={x:s.x-b.x*y,y:s.y-b.y*y},S={x:s.x+x.x*y,y:s.y+x.y*y};a===0?t.moveTo(k.x,k.y):t.lineTo(k.x,k.y),t.arcTo(s.x,s.y,S.x,S.y,y)}}};function wP(t){const e=[],r=t.length,n=Pe;for(let i=0;i<r;i++){let a=t[i];n._isNumber(a)?a=Math.round(a*1e3)/1e3:n._isString(a)||(a=a+""),e.push(a)}return e}const yw=",",xP="(",SP=")",kP="([",_P="])",PP=";",EP="()",TP="=",vw=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],CP=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],OP=100;let Zm=null;function bw(){if(Zm!==null)return Zm;try{const e=Pe.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(Zm=!1,!1)}catch{return Zm=!1,!1}}class h0{constructor(e){this.canvas=e,et.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,r){let n=this.traceArr,i=n.length,a="",o,s,u,f;for(o=0;o<i;o++)s=n[o],u=s.method,u?(f=s.args,a+=u,e?a+=EP:Pe._isArray(f[0])?a+=kP+f.join(yw)+_P:(r&&(f=f.map(d=>typeof d=="number"?Math.floor(d):d)),a+=xP+f.join(yw)+SP)):(a+=s.property,e||(a+=TP+s.val)),a+=PP;return a}clearTrace(){this.traceArr=[]}_trace(e){let r=this.traceArr,n;r.push(e),n=r.length,n>=OP&&r.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const r=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,r.getWidth()/r.pixelRatio,r.getHeight()/r.pixelRatio)}_applyLineCap(e){const r=e.attrs.lineCap;r&&this.setAttr("lineCap",r)}_applyOpacity(e){const r=e.getAbsoluteOpacity();r!==1&&this.setAttr("globalAlpha",r)}_applyLineJoin(e){const r=e.attrs.lineJoin;r&&this.setAttr("lineJoin",r)}_applyMiterLimit(e){const r=e.attrs.miterLimit;r!=null&&this.setAttr("miterLimit",r)}setAttr(e,r){this._context[e]=r}arc(e,r,n,i,a,o){this._context.arc(e,r,n,i,a,o)}arcTo(e,r,n,i,a){this._context.arcTo(e,r,n,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,r,n,i,a,o){this._context.bezierCurveTo(e,r,n,i,a,o)}clearRect(e,r,n,i){this._context.clearRect(e,r,n,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,r){const n=arguments;if(n.length===2)return this._context.createImageData(e,r);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,r,n,i){return this._context.createLinearGradient(e,r,n,i)}createPattern(e,r){return this._context.createPattern(e,r)}createRadialGradient(e,r,n,i,a,o){return this._context.createRadialGradient(e,r,n,i,a,o)}drawImage(e,r,n,i,a,o,s,u,f){const d=arguments,h=this._context;d.length===3?h.drawImage(e,r,n):d.length===5?h.drawImage(e,r,n,i,a):d.length===9&&h.drawImage(e,r,n,i,a,o,s,u,f)}ellipse(e,r,n,i,a,o,s,u){this._context.ellipse(e,r,n,i,a,o,s,u)}isPointInPath(e,r,n,i){return n?this._context.isPointInPath(n,e,r,i):this._context.isPointInPath(e,r,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,r,n,i){this._context.fillRect(e,r,n,i)}strokeRect(e,r,n,i){this._context.strokeRect(e,r,n,i)}fillText(e,r,n,i){i?this._context.fillText(e,r,n,i):this._context.fillText(e,r,n)}measureText(e){return this._context.measureText(e)}getImageData(e,r,n,i){return this._context.getImageData(e,r,n,i)}lineTo(e,r){this._context.lineTo(e,r)}moveTo(e,r){this._context.moveTo(e,r)}rect(e,r,n,i){this._context.rect(e,r,n,i)}roundRect(e,r,n,i,a){this._context.roundRect(e,r,n,i,a)}putImageData(e,r,n){this._context.putImageData(e,r,n)}quadraticCurveTo(e,r,n,i){this._context.quadraticCurveTo(e,r,n,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,r){this._context.scale(e,r)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,r,n,i,a,o){this._context.setTransform(e,r,n,i,a,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,r,n,i){this._context.strokeText(e,r,n,i)}transform(e,r,n,i,a,o){this._context.transform(e,r,n,i,a,o)}translate(e,r){this._context.translate(e,r)}_enableTrace(){let e=this,r=vw.length,n=this.setAttr,i,a;const o=function(s){let u=e[s],f;e[s]=function(){return a=wP(Array.prototype.slice.call(arguments,0)),f=u.apply(e,arguments),e._trace({method:s,args:a}),f}};for(i=0;i<r;i++)o(vw[i]);e.setAttr=function(){n.apply(e,arguments);const s=arguments[0];let u=arguments[1];(s==="shadowOffsetX"||s==="shadowOffsetY"||s==="shadowBlur")&&(u=u/this.canvas.getPixelRatio()),e._trace({property:s,val:u})}}_applyGlobalCompositeOperation(e){const r=e.attrs.globalCompositeOperation;!r||r==="source-over"||this.setAttr("globalCompositeOperation",r)}}CP.forEach(function(t){Object.defineProperty(h0.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class AP extends h0{constructor(e,{willReadFrequently:r=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:r})}_fillColor(e){const r=e.fill();this.setAttr("fillStyle",r),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const r=e._getLinearGradient();r&&(this.setAttr("fillStyle",r),e._fillFunc(this))}_fillRadialGradient(e){const r=e._getRadialGradient();r&&(this.setAttr("fillStyle",r),e._fillFunc(this))}_fill(e){const r=e.fill(),n=e.getFillPriority();if(r&&n==="color"){this._fillColor(e);return}const i=e.getFillPatternImage();if(i&&n==="pattern"){this._fillPattern(e);return}const a=e.getFillLinearGradientColorStops();if(a&&n==="linear-gradient"){this._fillLinearGradient(e);return}const o=e.getFillRadialGradientColorStops();if(o&&n==="radial-gradient"){this._fillRadialGradient(e);return}r?this._fillColor(e):i?this._fillPattern(e):a?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const r=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),i=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(r.x,r.y,n.x,n.y);if(i){for(let o=0;o<i.length;o+=2)a.addColorStop(i[o],i[o+1]);this.setAttr("strokeStyle",a)}}_stroke(e){const r=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();const a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(e),r&&e.dashEnabled()&&(this.setLineDash(r),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var r,n,i;const a=(r=e.getShadowRGBA())!==null&&r!==void 0?r:"black",o=(n=e.getShadowBlur())!==null&&n!==void 0?n:5,s=(i=e.getShadowOffset())!==null&&i!==void 0?i:{x:0,y:0},u=e.getAbsoluteScale(),f=this.canvas.getPixelRatio(),d=u.x*f,h=u.y*f;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",o*Math.min(Math.abs(d),Math.abs(h))),this.setAttr("shadowOffsetX",s.x*d),this.setAttr("shadowOffsetY",s.y*h)}}class IP extends h0{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const r=e.getStrokeScaleEnabled();if(!r){this.save();const a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(e);const n=e.hitStrokeWidth(),i=n==="auto"?e.strokeWidth():n;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),r||this.restore()}}}let Jm;function RP(){if(Jm)return Jm;const t=Pe.createCanvasElement(),e=t.getContext("2d");return Jm=(function(){const r=et._global.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return r/n})(),Pe.releaseCanvas(t),Jm}class S2{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const n=(e||{}).pixelRatio||et.pixelRatio||RP();this.pixelRatio=n,this._canvas=Pe.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const r=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/r,this.getHeight()/r)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const r=this.pixelRatio;this.getContext()._context.scale(r,r)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const r=this.pixelRatio;this.getContext()._context.scale(r,r)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,r){this.setWidth(e||0),this.setHeight(r||0)}toDataURL(e,r){try{return this._canvas.toDataURL(e,r)}catch{try{return this._canvas.toDataURL()}catch(i){return Pe.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Ca extends S2{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new AP(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}class k2 extends S2{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new IP(this),this.setSize(e.width,e.height)}}const ar={get isDragging(){let t=!1;return ar._dragElements.forEach(e=>{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){let t;return ar._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];ar._dragElements.forEach((r,n)=>{const{node:i}=r,a=i.getStage();a.setPointersPositions(t),r.pointerId===void 0&&(r.pointerId=Pe._getFirstPointerId(t));const o=a._changedPointerPositions.find(s=>s.id===r.pointerId);if(o){if(r.dragStatus!=="dragging"){const s=i.dragDistance();if(Math.max(Math.abs(o.x-r.startPointerPos.x),Math.abs(o.y-r.startPointerPos.y))<s||(i.startDrag({evt:t}),!i.isDragging()))return}i._setDragPosition(t,r),e.push(i)}}),e.forEach(r=>{r.fire("dragmove",{type:"dragmove",target:r,evt:t},!0)})},_endDragBefore(t){const e=[];ar._dragElements.forEach(r=>{const{node:n}=r,i=n.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(s=>s.id===r.pointerId))return;(r.dragStatus==="dragging"||r.dragStatus==="stopped")&&(ar.justDragged=!0,et._mouseListenClick=!1,et._touchListenClick=!1,et._pointerListenClick=!1,r.dragStatus="stopped");const o=r.node.getLayer()||r.node instanceof et.Stage&&r.node;o&&e.indexOf(o)===-1&&e.push(o)}),e.forEach(r=>{r.draw()})},_endDragAfter(t){ar._dragElements.forEach((e,r)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&ar._dragElements.delete(r)})}};et.isBrowser&&(window.addEventListener("mouseup",ar._endDragBefore,!0),window.addEventListener("touchend",ar._endDragBefore,!0),window.addEventListener("touchcancel",ar._endDragBefore,!0),window.addEventListener("mousemove",ar._drag),window.addEventListener("touchmove",ar._drag),window.addEventListener("mouseup",ar._endDragAfter,!1),window.addEventListener("touchend",ar._endDragAfter,!1),window.addEventListener("touchcancel",ar._endDragAfter,!1));function mu(t){return Pe._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||Pe._isBoolean(t)?t:Object.prototype.toString.call(t)}function ZS(t){return t>255?255:t<0?0:Math.round(t)}function Qe(){if(et.isUnminified)return function(t,e){return Pe._isNumber(t)||Pe.warn(mu(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function p0(t){if(et.isUnminified)return function(e,r){let n=Pe._isNumber(e),i=Pe._isArray(e)&&e.length==t;return!n&&!i&&Pe.warn(mu(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function _2(){if(et.isUnminified)return function(t,e){return Pe._isNumber(t)||t==="auto"||Pe.warn(mu(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function Ac(){if(et.isUnminified)return function(t,e){return Pe._isString(t)||Pe.warn(mu(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function JS(){if(et.isUnminified)return function(t,e){const r=Pe._isString(t),n=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return r||n||Pe.warn(mu(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function MP(){if(et.isUnminified)return function(t,e){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&t instanceof r||(Pe._isArray(t)?t.forEach(function(n){Pe._isNumber(n)||Pe.warn('"'+e+'" attribute has non numeric element '+n+". Make sure that all elements are numbers.")}):Pe.warn(mu(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function so(){if(et.isUnminified)return function(t,e){return t===!0||t===!1||Pe.warn(mu(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function DP(t){if(et.isUnminified)return function(e,r){return e==null||Pe.isObject(e)||Pe.warn(mu(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+t),e}}const Ch="get",Oh="set",fe={addGetterSetter(t,e,r,n,i){fe.addGetter(t,e,r),fe.addSetter(t,e,n,i),fe.addOverloadedGetterSetter(t,e)},addGetter(t,e,r){const n=Ch+Pe._capitalize(e);t.prototype[n]=t.prototype[n]||function(){const i=this.attrs[e];return i===void 0?r:i}},addSetter(t,e,r,n){const i=Oh+Pe._capitalize(e);t.prototype[i]||fe.overWriteSetter(t,e,r,n)},overWriteSetter(t,e,r,n){const i=Oh+Pe._capitalize(e);t.prototype[i]=function(a){return r&&a!==void 0&&a!==null&&(a=r.call(this,a,e)),this._setAttr(e,a),n&&n.call(this),this}},addComponentsGetterSetter(t,e,r,n,i){const a=r.length,o=Pe._capitalize,s=Ch+o(e),u=Oh+o(e);t.prototype[s]=function(){const d={};for(let h=0;h<a;h++){const p=r[h];d[p]=this.getAttr(e+o(p))}return d};const f=DP(r);t.prototype[u]=function(d){const h=this.attrs[e];n&&(d=n.call(this,d,e)),f&&f.call(this,d,e);for(const p in d)d.hasOwnProperty(p)&&this._setAttr(e+o(p),d[p]);return d||r.forEach(p=>{this._setAttr(e+o(p),void 0)}),this._fireChangeEvent(e,h,d),i&&i.call(this),this},fe.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){const r=Pe._capitalize(e),n=Oh+r,i=Ch+r;t.prototype[e]=function(){return arguments.length?(this[n](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,r,n){Pe.error("Adding deprecated "+e);const i=Ch+Pe._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){Pe.error(a);const o=this.attrs[e];return o===void 0?r:o},fe.addSetter(t,e,n,function(){Pe.error(a)}),fe.addOverloadedGetterSetter(t,e)},backCompat(t,e){Pe.each(e,function(r,n){const i=t.prototype[n],a=Ch+Pe._capitalize(r),o=Oh+Pe._capitalize(r);function s(){i.apply(this,arguments),Pe.error('"'+r+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}t.prototype[r]=s,t.prototype[a]=s,t.prototype[o]=s})},afterSetFilter(){this._filterUpToDate=!1}};function NP(t){const e=/(\w+)\(([^)]+)\)/g;let r;for(;(r=e.exec(t))!==null;){const[,n,i]=r;switch(n){case"blur":{const a=parseFloat(i.replace("px",""));return function(o){this.blurRadius(a*.5);const s=et.Filters;s&&s.Blur&&s.Blur.call(this,o)}}case"brightness":{const a=i.includes("%")?parseFloat(i)/100:parseFloat(i);return function(o){this.brightness(a);const s=et.Filters;s&&s.Brightness&&s.Brightness.call(this,o)}}case"contrast":{const a=parseFloat(i);return function(o){const s=100*(Math.sqrt(a)-1);this.contrast(s);const u=et.Filters;u&&u.Contrast&&u.Contrast.call(this,o)}}case"grayscale":return function(a){const o=et.Filters;o&&o.Grayscale&&o.Grayscale.call(this,a)};case"sepia":return function(a){const o=et.Filters;o&&o.Sepia&&o.Sepia.call(this,a)};case"invert":return function(a){const o=et.Filters;o&&o.Invert&&o.Invert.call(this,a)};default:Pe.warn(`CSS filter "${n}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}const vg="absoluteOpacity",ww="allEventListeners",Os="absoluteTransform",xw="absoluteScale",rc="canvas",LP="Change",FP="children",BP="konva",Rv="listening",zP="mouseenter",jP="mouseleave",UP="pointerenter",HP="pointerleave",$P="touchenter",qP="touchleave",Sw="set",kw="Shape",bg=" ",_w="stage",Xl="transform",VP="Stage",Mv="visible",WP=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(bg);let GP=1,Je=class jh{constructor(e){this._id=GP++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===Xl||e===Os)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,r){let n=this._cache.get(e);return(n===void 0||(e===Xl||e===Os)&&n.dirty===!0)&&(n=r.call(this),this._cache.set(e,n)),n}_calculate(e,r,n){if(!this._attachedDepsListeners.get(e)){const i=r.map(a=>a+"Change.konva").join(bg);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(rc)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Os&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(rc)){const{scene:e,filter:r,hit:n}=this._cache.get(rc);Pe.releaseCanvas(e._canvas,r._canvas,n._canvas),this._cache.delete(rc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const r=e||{};let n={};(r.x===void 0||r.y===void 0||r.width===void 0||r.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let i=Math.ceil(r.width||n.width),a=Math.ceil(r.height||n.height),o=r.pixelRatio,s=r.x===void 0?Math.floor(n.x):r.x,u=r.y===void 0?Math.floor(n.y):r.y,f=r.offset||0,d=r.drawBorder||!1,h=r.hitCanvasPixelRatio||1;if(!i||!a){Pe.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(n.x)-s)>.5?1:0,y=Math.abs(Math.round(n.y)-u)>.5?1:0;i+=f*2+p,a+=f*2+y,s-=f,u-=f;const v=new Ca({pixelRatio:o,width:i,height:a}),b=new Ca({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),x=new k2({pixelRatio:h,width:i,height:a}),k=v.getContext(),S=x.getContext(),P=new Ca({width:v.width/v.pixelRatio+Math.abs(s),height:v.height/v.pixelRatio+Math.abs(u),pixelRatio:v.pixelRatio}),_=P.getContext();return x.isCache=!0,v.isCache=!0,this._cache.delete(rc),this._filterUpToDate=!1,r.imageSmoothingEnabled===!1&&(v.getContext()._context.imageSmoothingEnabled=!1,b.getContext()._context.imageSmoothingEnabled=!1),k.save(),S.save(),_.save(),k.translate(-s,-u),S.translate(-s,-u),_.translate(-s,-u),P.x=s,P.y=u,this._isUnderCache=!0,this._clearSelfAndDescendantCache(vg),this._clearSelfAndDescendantCache(xw),this.drawScene(v,this,P),this.drawHit(x,this),this._isUnderCache=!1,k.restore(),S.restore(),d&&(k.save(),k.beginPath(),k.rect(0,0,i,a),k.closePath(),k.setAttr("strokeStyle","red"),k.setAttr("lineWidth",5),k.stroke(),k.restore()),Pe.releaseCanvas(P._canvas),this._cache.set(rc,{scene:v,filter:b,hit:x,x:s,y:u}),this._requestDraw(),this}isCached(){return this._cache.has(rc)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,r){const n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,a=1/0,o=-1/0,s=-1/0;const u=this.getAbsoluteTransform(r);return n.forEach(function(f){const d=u.point(f);i===void 0&&(i=o=d.x,a=s=d.y),i=Math.min(i,d.x),a=Math.min(a,d.y),o=Math.max(o,d.x),s=Math.max(s,d.y)}),{x:i,y:a,width:o-i,height:s-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const r=this._getCanvasCache();e.translate(r.x,r.y);const n=this._getCachedSceneCanvas(),i=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/i,n.height/i),e.restore()}_drawCachedHitCanvas(e){const r=this._getCanvasCache(),n=r.hit;e.save(),e.translate(r.x,r.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),r=this._getCanvasCache(),n=r.scene,i=r.filter,a=i.getContext(),o,s,u,f;if(!e||e.length===0)return n;if(this._filterUpToDate)return i;let d=!0;for(let p=0;p<e.length;p++)if(typeof e[p]=="string"&&bw(),typeof e[p]!="string"||!bw()){d=!1;break}const h=n.pixelRatio;if(i.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio),d){const p=e.join(" ");return a.save(),a.setAttr("filter",p),a.drawImage(n._canvas,0,0,n.getWidth()/h,n.getHeight()/h),a.restore(),this._filterUpToDate=!0,i}try{for(o=e.length,a.clear(),a.drawImage(n._canvas,0,0,n.getWidth()/h,n.getHeight()/h),s=a.getImageData(0,0,i.getWidth(),i.getHeight()),u=0;u<o;u++)f=e[u],typeof f=="string"&&(f=NP(f)),f.call(this,s),a.putImageData(s,0,0)}catch(p){Pe.error("Unable to apply filter. "+p.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,i}on(e,r){if(this._cache&&this._cache.delete(ww),arguments.length===3)return this._delegate.apply(this,arguments);const n=e.split(bg);for(let i=0;i<n.length;i++){const o=n[i].split("."),s=o[0],u=o[1]||"";this.eventListeners[s]||(this.eventListeners[s]=[]),this.eventListeners[s].push({name:u,handler:r})}return this}off(e,r){let n=(e||"").split(bg),i=n.length,a,o,s,u,f,d;if(this._cache&&this._cache.delete(ww),!e)for(o in this.eventListeners)this._off(o);for(a=0;a<i;a++)if(s=n[a],u=s.split("."),f=u[0],d=u[1],f)this.eventListeners[f]&&this._off(f,d,r);else for(o in this.eventListeners)this._off(o,d,r);return this}dispatchEvent(e){const r={target:this,type:e.type,evt:e};return this.fire(e.type,r),this}addEventListener(e,r){return this.on(e,function(n){r.call(this,n.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,r,n){const i=this;this.on(e,function(a){const o=a.target.findAncestors(r,!0,i);for(let s=0;s<o.length;s++)a=Pe.cloneObject(a),a.currentTarget=o[s],n.call(o[s],a)})}remove(){return this.isDragging()&&this.stopDrag(),ar._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Os),this._clearSelfAndDescendantCache(vg),this._clearSelfAndDescendantCache(xw),this._clearSelfAndDescendantCache(_w),this._clearSelfAndDescendantCache(Mv),this._clearSelfAndDescendantCache(Rv)}_remove(){this._clearCaches();const e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){const r="get"+Pe._capitalize(e);return Pe._isFunction(this[r])?this[r]():this.attrs[e]}getAncestors(){let e=this.getParent(),r=[];for(;e;)r.push(e),e=e.getParent();return r}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let r,n;if(!e)return this;for(r in e)r!==FP&&(n=Sw+Pe._capitalize(r),Pe._isFunction(this[n])?this[n](e[r]):this._setAttr(r,e[r]))}),this}isListening(){return this._getCache(Rv,this._isListening)}_isListening(e){if(!this.listening())return!1;const n=this.getParent();return n&&n!==e&&this!==e?n._isListening(e):!0}isVisible(){return this._getCache(Mv,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const n=this.getParent();return n&&n!==e&&this!==e?n._isVisible(e):!0}shouldDrawHit(e,r=!1){if(e)return this._isVisible(e)&&this._isListening(e);const n=this.getLayer();let i=!1;ar._dragElements.forEach(o=>{o.dragStatus==="dragging"&&(o.node.nodeType==="Stage"||o.node.getLayer()===n)&&(i=!0)});const a=!r&&!et.hitOnDragEnabled&&(i||et.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),r=this,n=0,i,a,o,s;function u(d){for(i=[],a=d.length,o=0;o<a;o++)s=d[o],n++,s.nodeType!==kw&&(i=i.concat(s.getChildren().slice())),s._id===r._id&&(o=a);i.length>0&&i[0].getDepth()<=e&&u(i)}const f=this.getStage();return r.nodeType!==VP&&f&&u(f.getChildren()),n}getDepth(){let e=0,r=this.parent;for(;r;)e++,r=r.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Xl),this._clearSelfAndDescendantCache(Os)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const r=e.getPointerPosition();if(!r)return null;const n=this.getAbsoluteTransform().copy();return n.invert(),n.point(r)}getAbsolutePosition(e){let r=!1,n=this.parent;for(;n;){if(n.isCached()){r=!0;break}n=n.parent}r&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),a=new aa,o=this.offset();return a.m=i.slice(),a.translate(o.x,o.y),a.getTranslation()}setAbsolutePosition(e){const{x:r,y:n,...i}=this._clearTransform();this.attrs.x=r,this.attrs.y=n,this._clearCache(Xl);const a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(e.x,e.y),e={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(Xl),this._clearSelfAndDescendantCache(Os),this}_setTransform(e){let r;for(r in e)this.attrs[r]=e[r]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let r=e.x,n=e.y,i=this.x(),a=this.y();return r!==void 0&&(i+=r),n!==void 0&&(a+=n),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(e,r){let n=[],i=this.getParent(),a,o;if(!(r&&r._id===this._id)){for(n.unshift(this);i&&(!r||i._id!==r._id);)n.unshift(i),i=i.parent;for(a=n.length,o=0;o<a;o++)e(n[o])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Pe.warn("Node has no parent. moveToTop function is ignored."),!1;const e=this.index,r=this.parent.getChildren().length;return e<r-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Pe.warn("Node has no parent. moveUp function is ignored."),!1;const e=this.index,r=this.parent.getChildren().length;return e<r-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Pe.warn("Node has no parent. moveDown function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Pe.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return Pe.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Pe.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const r=this.index;return this.parent.children.splice(r,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(vg,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const r=this.getParent();return r&&!r._isUnderCache&&(e*=r.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),r,n,i,a,o;const s={attrs:{},className:this.getClassName()};for(r in e)n=e[r],o=Pe.isObject(n)&&!Pe._isPlainObject(n)&&!Pe._isArray(n),!o&&(i=typeof this[r]=="function"&&this[r],delete e[r],a=i?i.call(this):null,e[r]=n,a!==n&&(s.attrs[r]=n));return Pe._prepareToStringify(s)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,r,n){const i=[];r&&this._isMatch(e)&&i.push(this);let a=this.parent;for(;a;){if(a===n)return i;a._isMatch(e)&&i.push(a),a=a.parent}return i}isAncestorOf(e){return!1}findAncestor(e,r,n){return this.findAncestors(e,r,n)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let r=e.replace(/ /g,"").split(","),n=r.length,i,a;for(i=0;i<n;i++)if(a=r[i],Pe.isValidSelector(a)||(Pe.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Pe.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Pe.warn("Konva is awesome, right?")),a.charAt(0)==="#"){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)==="."){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0;return!1}getLayer(){const e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(_w,this._getStage)}_getStage(){const e=this.getParent();return e?e.getStage():null}fire(e,r={},n){return r.target=r.target||this,n?this._fireAndBubble(e,r):this._fire(e,r),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Os,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let r;if(e)return r=new aa,this._eachAncestorReverse(function(n){const i=n.transformsEnabled();i==="all"?r.multiply(n.getTransform()):i==="position"&&r.translate(n.x()-n.offsetX(),n.y()-n.offsetY())},e),r;{r=this._cache.get(Os)||new aa,this.parent?this.parent.getAbsoluteTransform().copyInto(r):r.reset();const n=this.transformsEnabled();if(n==="all")r.multiply(this.getTransform());else if(n==="position"){const i=this.attrs.x||0,a=this.attrs.y||0,o=this.attrs.offsetX||0,s=this.attrs.offsetY||0;r.translate(i-o,a-s)}return r.dirty=!1,r}}getAbsoluteScale(e){let r=this;for(;r;)r._isUnderCache&&(e=r),r=r.getParent();const i=this.getAbsoluteTransform(e).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Xl,this._getTransform)}_getTransform(){var e,r;const n=this._cache.get(Xl)||new aa;n.reset();const i=this.x(),a=this.y(),o=et.getAngle(this.rotation()),s=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,u=(r=this.attrs.scaleY)!==null&&r!==void 0?r:1,f=this.attrs.skewX||0,d=this.attrs.skewY||0,h=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return(i!==0||a!==0)&&n.translate(i,a),o!==0&&n.rotate(o),(f!==0||d!==0)&&n.skew(f,d),(s!==1||u!==1)&&n.scale(s,u),(h!==0||p!==0)&&n.translate(-1*h,-1*p),n.dirty=!1,n}clone(e){let r=Pe.cloneObject(this.attrs),n,i,a,o,s;for(n in e)r[n]=e[n];const u=new this.constructor(r);for(n in this.eventListeners)for(i=this.eventListeners[n],a=i.length,o=0;o<a;o++)s=i[o],s.name.indexOf(BP)<0&&(u.eventListeners[n]||(u.eventListeners[n]=[]),u.eventListeners[n].push(s));return u}_toKonvaCanvas(e){e=e||{};const r=this.getClientRect(),n=this.getStage(),i=e.x!==void 0?e.x:Math.floor(r.x),a=e.y!==void 0?e.y:Math.floor(r.y),o=e.pixelRatio||1,s=new Ca({width:e.width||Math.ceil(r.width)||(n?n.width():0),height:e.height||Math.ceil(r.height)||(n?n.height():0),pixelRatio:o}),u=s.getContext(),f=new Ca({width:s.width/s.pixelRatio+Math.abs(i),height:s.height/s.pixelRatio+Math.abs(a),pixelRatio:s.pixelRatio});return e.imageSmoothingEnabled===!1&&(u._context.imageSmoothingEnabled=!1),u.save(),(i||a)&&u.translate(-1*i,-1*a),this.drawScene(s,void 0,f),u.restore(),s}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};const r=e.mimeType||null,n=e.quality||null,i=this._toKonvaCanvas(e).toDataURL(r,n);return e.callback&&e.callback(i),i}toImage(e){return new Promise((r,n)=>{try{const i=e?.callback;i&&delete e.callback,Pe._urlToImage(this.toDataURL(e),function(a){r(a),i?.(a)})}catch(i){n(i)}})}toBlob(e){return new Promise((r,n)=>{try{const i=e?.callback;i&&delete e.callback,this.toCanvas(e).toBlob(a=>{r(a),i?.(a)},e?.mimeType,e?.quality)}catch(i){n(i)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():et.dragDistance}_off(e,r,n){let i=this.eventListeners[e],a,o,s;for(a=0;a<i.length;a++)if(o=i[a].name,s=i[a].handler,(o!=="konva"||r==="konva")&&(!r||o===r)&&(!n||n===s)){if(i.splice(a,1),i.length===0){delete this.eventListeners[e];break}a--}}_fireChangeEvent(e,r,n){this._fire(e+LP,{oldVal:r,newVal:n})}addName(e){if(!this.hasName(e)){const r=this.name(),n=r?r+" "+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;const r=this.name();return r?(r||"").split(/\s/g).indexOf(e)!==-1:!1}removeName(e){const r=(this.name()||"").split(/\s/g),n=r.indexOf(e);return n!==-1&&(r.splice(n,1),this.name(r.join(" "))),this}setAttr(e,r){const n=this[Sw+Pe._capitalize(e)];return Pe._isFunction(n)?n.call(this,r):this._setAttr(e,r),this}_requestDraw(){if(et.autoDrawEnabled){const e=this.getLayer()||this.getStage();e?.batchDraw()}}_setAttr(e,r){const n=this.attrs[e];n===r&&!Pe.isObject(r)||(r==null?delete this.attrs[e]:this.attrs[e]=r,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,r),this._requestDraw())}_setComponentAttr(e,r,n){let i;n!==void 0&&(i=this.attrs[e],i||(this.attrs[e]=this.getAttr(e)),this.attrs[e][r]=n,this._fireChangeEvent(e,i,n))}_fireAndBubble(e,r,n){r&&this.nodeType===kw&&(r.target=this);const i=[zP,jP,UP,HP,$P,qP];if(!(i.indexOf(e)!==-1&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType==="Stage"&&!n))){this._fire(e,r);const o=i.indexOf(e)!==-1&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(r&&!r.cancelBubble||!r)&&this.parent&&this.parent.isListening()&&!o&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,r,n):this._fireAndBubble.call(this.parent,e,r))}}_getProtoListeners(e){var r,n;const{nodeType:i}=this,a=jh.protoListenerMap.get(i)||{};let o=a?.[e];if(o===void 0){o=[];let s=Object.getPrototypeOf(this);for(;s;){const u=(n=(r=s.eventListeners)===null||r===void 0?void 0:r[e])!==null&&n!==void 0?n:[];o.push(...u),s=Object.getPrototypeOf(s)}a[e]=o,jh.protoListenerMap.set(i,a)}return o}_fire(e,r){r=r||{},r.currentTarget=this,r.type=e;const n=this._getProtoListeners(e);if(n)for(let a=0;a<n.length;a++)n[a].handler.call(this,r);const i=this.eventListeners[e];if(i)for(let a=0;a<i.length;a++)i[a].handler.call(this,r)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){const r=e?e.pointerId:void 0,n=this.getStage(),i=this.getAbsolutePosition();if(!n)return;const a=n._getPointerById(r)||n._changedPointerPositions[0]||i;ar._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-i.x,y:a.y-i.y},dragStatus:"ready",pointerId:r})}startDrag(e,r=!0){ar._dragElements.has(this._id)||this._createDragElement(e);const n=ar._dragElements.get(this._id);n.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},r)}_setDragPosition(e,r){const n=this.getStage()._getPointerById(r.pointerId);if(!n)return;let i={x:n.x-r.offset.x,y:n.y-r.offset.y};const a=this.dragBoundFunc();if(a!==void 0){const o=a.call(this,i,e);o?i=o:Pe.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==i.x||this._lastPos.y!==i.y)&&(this.setAbsolutePosition(i),this._requestDraw()),this._lastPos=i}stopDrag(e){const r=ar._dragElements.get(this._id);r&&(r.dragStatus="stopped"),ar._endDragBefore(e),ar._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=ar._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if(!(!(e.evt.button!==void 0)||et.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let i=!1;ar._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const r=ar._dragElements.get(this._id),n=r&&r.dragStatus==="dragging",i=r&&r.dragStatus==="ready";n?this.stopDrag():i&&ar._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const r=this.getStage();if(!r)return!1;const n={x:-e.x,y:-e.y,width:r.width()+2*e.x,height:r.height()+2*e.y};return Pe.haveIntersection(n,this.getClientRect())}static create(e,r){return Pe._isString(e)&&(e=JSON.parse(e)),this._createNode(e,r)}static _createNode(e,r){let n=jh.prototype.getClassName.call(e),i=e.children,a,o,s;r&&(e.attrs.container=r),et[n]||(Pe.warn('Can not find a node with class name "'+n+'". Fallback to "Shape".'),n="Shape");const u=et[n];if(a=new u(e.attrs),i)for(o=i.length,s=0;s<o;s++)a.add(jh._createNode(i[s]));return a}};Je.protoListenerMap=new Map;Je.prototype.nodeType="Node";Je.prototype._attrsAffectingSize=[];Je.prototype.eventListeners={};Je.prototype.on.call(Je.prototype,WP,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Xl),this._clearSelfAndDescendantCache(Os)});Je.prototype.on.call(Je.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Mv)});Je.prototype.on.call(Je.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Rv)});Je.prototype.on.call(Je.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(vg)});const kr=fe.addGetterSetter;kr(Je,"zIndex");kr(Je,"absolutePosition");kr(Je,"position");kr(Je,"x",0,Qe());kr(Je,"y",0,Qe());kr(Je,"globalCompositeOperation","source-over",Ac());kr(Je,"opacity",1,Qe());kr(Je,"name","",Ac());kr(Je,"id","",Ac());kr(Je,"rotation",0,Qe());fe.addComponentsGetterSetter(Je,"scale",["x","y"]);kr(Je,"scaleX",1,Qe());kr(Je,"scaleY",1,Qe());fe.addComponentsGetterSetter(Je,"skew",["x","y"]);kr(Je,"skewX",0,Qe());kr(Je,"skewY",0,Qe());fe.addComponentsGetterSetter(Je,"offset",["x","y"]);kr(Je,"offsetX",0,Qe());kr(Je,"offsetY",0,Qe());kr(Je,"dragDistance",void 0,Qe());kr(Je,"width",0,Qe());kr(Je,"height",0,Qe());kr(Je,"listening",!0,so());kr(Je,"preventDefault",!0,so());kr(Je,"filters",void 0,function(t){return this._filterUpToDate=!1,t});kr(Je,"visible",!0,so());kr(Je,"transformsEnabled","all",Ac());kr(Je,"size");kr(Je,"dragBoundFunc");kr(Je,"draggable",!1,so());fe.backCompat(Je,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class oa extends Je{constructor(){super(...arguments),this.children=[]}getChildren(e){const r=this.children||[];return e?r.filter(e):r}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let n=0;n<e.length;n++)this.add(e[n]);return this}const r=e[0];return r.getParent()?(r.moveTo(this),this):(this._validateAdd(r),r.index=this.getChildren().length,r.parent=this,r._clearCaches(),this.getChildren().push(r),this._fire("add",{child:r}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const r=this._generalFind(e,!0);return r.length>0?r[0]:void 0}_generalFind(e,r){const n=[];return this._descendants(i=>{const a=i._isMatch(e);return a&&n.push(i),!!(a&&r)}),n}_descendants(e){let r=!1;const n=this.getChildren();for(const i of n){if(r=e(i),r)return!0;if(i.hasChildren()&&(r=i._descendants(e),r))return!0}return!1}toObject(){const e=Je.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(r=>{e.children.push(r.toObject())}),e}isAncestorOf(e){let r=e.getParent();for(;r;){if(r._id===this._id)return!0;r=r.getParent()}return!1}clone(e){const r=Je.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){r.add(n.clone())}),r}getAllIntersections(e){const r=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&r.push(n)}),r}_clearSelfAndDescendantCache(e){var r;super._clearSelfAndDescendantCache(e),!this.isCached()&&((r=this.children)===null||r===void 0||r.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(r,n){r.index=n}),this._requestDraw()}drawScene(e,r,n){const i=this.getLayer(),a=e||i&&i.getCanvas(),o=a&&a.getContext(),s=this._getCanvasCache(),u=s&&s.scene,f=a&&a.isCache;if(!this.isVisible()&&!f)return this;if(u){o.save();const d=this.getAbsoluteTransform(r).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",a,r,n);return this}drawHit(e,r){if(!this.shouldDrawHit(r))return this;const n=this.getLayer(),i=e||n&&n.hitCanvas,a=i&&i.getContext(),o=this._getCanvasCache();if(o&&o.hit){a.save();const u=this.getAbsoluteTransform(r).getMatrix();a.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,r);return this}_drawChildren(e,r,n,i){var a;const o=r&&r.getContext(),s=this.clipWidth(),u=this.clipHeight(),f=this.clipFunc(),d=typeof s=="number"&&typeof u=="number"||f,h=n===this;if(d){o.save();const y=this.getAbsoluteTransform(n);let v=y.getMatrix();o.transform(v[0],v[1],v[2],v[3],v[4],v[5]),o.beginPath();let b;if(f)b=f.call(this,o,this);else{const x=this.clipX(),k=this.clipY();o.rect(x||0,k||0,s,u)}o.clip.apply(o,b),v=y.copy().invert().getMatrix(),o.transform(v[0],v[1],v[2],v[3],v[4],v[5])}const p=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";p&&(o.save(),o._applyGlobalCompositeOperation(this)),(a=this.children)===null||a===void 0||a.forEach(function(y){y[e](r,n,i)}),p&&o.restore(),d&&o.restore()}getClientRect(e={}){var r;const n=e.skipTransform,i=e.relativeTo;let a,o,s,u,f={x:1/0,y:1/0,width:0,height:0};const d=this;(r=this.children)===null||r===void 0||r.forEach(function(y){if(!y.visible())return;const v=y.getClientRect({relativeTo:d,skipShadow:e.skipShadow,skipStroke:e.skipStroke});v.width===0&&v.height===0||(a===void 0?(a=v.x,o=v.y,s=v.x+v.width,u=v.y+v.height):(a=Math.min(a,v.x),o=Math.min(o,v.y),s=Math.max(s,v.x+v.width),u=Math.max(u,v.y+v.height)))});const h=this.find("Shape");let p=!1;for(let y=0;y<h.length;y++)if(h[y]._isVisible(this)){p=!0;break}return p&&a!==void 0?f={x:a,y:o,width:s-a,height:u-o}:f={x:0,y:0,width:0,height:0},n?f:this._transformedRect(f,i)}}fe.addComponentsGetterSetter(oa,"clip",["x","y","width","height"]);fe.addGetterSetter(oa,"clipX",void 0,Qe());fe.addGetterSetter(oa,"clipY",void 0,Qe());fe.addGetterSetter(oa,"clipWidth",void 0,Qe());fe.addGetterSetter(oa,"clipHeight",void 0,Qe());fe.addGetterSetter(oa,"clipFunc");const mp=new Map,e5=et._global.PointerEvent!==void 0;function P1(t){return mp.get(t)}function P2(t){return{evt:t,pointerId:t.pointerId}}function t5(t,e){return mp.get(t)===e}function r5(t,e){Jh(t),e.getStage()&&(mp.set(t,e),e5&&e._fire("gotpointercapture",P2(new PointerEvent("gotpointercapture"))))}function Jh(t,e){const r=mp.get(t);if(!r)return;const n=r.getStage();n&&n.content,mp.delete(t),e5&&r._fire("lostpointercapture",P2(new PointerEvent("lostpointercapture")))}const XP="Stage",YP="string",Pw="px",KP="mouseout",n5="mouseleave",i5="mouseover",a5="mouseenter",o5="mousemove",s5="mousedown",l5="mouseup",Uh="pointermove",Hh="pointerdown",Jf="pointerup",$h="pointercancel",QP="lostpointercapture",eg="pointerout",qh="pointerleave",tg="pointerover",rg="pointerenter",Dv="contextmenu",u5="touchstart",c5="touchend",f5="touchmove",d5="touchcancel",Nv="wheel",ZP=5,JP=[[a5,"_pointerenter"],[s5,"_pointerdown"],[o5,"_pointermove"],[l5,"_pointerup"],[n5,"_pointerleave"],[u5,"_pointerdown"],[f5,"_pointermove"],[c5,"_pointerup"],[d5,"_pointercancel"],[i5,"_pointerover"],[Nv,"_wheel"],[Dv,"_contextmenu"],[Hh,"_pointerdown"],[Uh,"_pointermove"],[Jf,"_pointerup"],[$h,"_pointercancel"],[qh,"_pointerleave"],[QP,"_lostpointercapture"]],E1={mouse:{[eg]:KP,[qh]:n5,[tg]:i5,[rg]:a5,[Uh]:o5,[Hh]:s5,[Jf]:l5,[$h]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[eg]:"touchout",[qh]:"touchleave",[tg]:"touchover",[rg]:"touchenter",[Uh]:f5,[Hh]:u5,[Jf]:c5,[$h]:d5,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[eg]:eg,[qh]:qh,[tg]:tg,[rg]:rg,[Uh]:Uh,[Hh]:Hh,[Jf]:Jf,[$h]:$h,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Vh=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",Bf=t=>{const e=Vh(t);if(e==="pointer")return et.pointerEventsEnabled&&E1.pointer;if(e==="touch")return E1.touch;if(e==="mouse")return E1.mouse};function Ew(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&Pe.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const eE="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",ep=[];let m0=class extends oa{constructor(e){super(Ew(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),ep.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Ew(this.attrs)}),this._checkVisibility()}_validateAdd(e){const r=e.getType()==="Layer",n=e.getType()==="FastLayer";r||n||Pe.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===YP){let r;if(e.charAt(0)==="."){const n=e.slice(1);e=document.getElementsByClassName(n)[0]}else e.charAt(0)!=="#"?r=e:r=e.slice(1),e=document.getElementById(r);if(!e)throw"Can not find container in document with id "+r}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,r=e.length;for(let n=0;n<r;n++)e[n].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),oa.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Pe._isInDocument(e)&&this.container().removeChild(e);const r=ep.indexOf(this);return r>-1&&ep.splice(r,1),Pe.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(Pe.warn(eE),null)}_getPointerById(e){return this._pointerPositions.find(r=>r.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const r=new Ca({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=r.getContext()._context,i=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),i.forEach(function(a){if(!a.isVisible())return;const o=a._toKonvaCanvas(e);n.drawImage(o._canvas,e.x,e.y,o.getWidth()/o.getPixelRatio(),o.getHeight()/o.getPixelRatio())}),r}getIntersection(e){if(!e)return null;const r=this.children,n=r.length,i=n-1;for(let a=i;a>=0;a--){const o=r[a].getIntersection(e);if(o)return o}return null}_resizeDOM(){const e=this.width(),r=this.height();this.content&&(this.content.style.width=e+Pw,this.content.style.height=r+Pw),this.bufferCanvas.setSize(e,r),this.bufferHitCanvas.setSize(e,r),this.children.forEach(n=>{n.setSize({width:e,height:r}),n.draw()})}add(e,...r){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}super.add(e);const n=this.children.length;return n>ZP&&Pe.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),et.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return t5(e,this)}setPointerCapture(e){r5(e,this)}releaseCapture(e){Jh(e)}getLayers(){return this.children}_bindContentEvents(){et.isBrowser&&JP.forEach(([e,r])=>{this.content.addEventListener(e,n=>{this[r](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const r=Bf(e.type);r&&this._fire(r.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const r=Bf(e.type);r&&this._fire(r.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let r=this[e+"targetShape"];return r&&!r.getStage()&&(r=null),r}_pointerleave(e){const r=Bf(e.type),n=Vh(e.type);if(!r)return;this.setPointersPositions(e);const i=this._getTargetShape(n),a=!(et.isDragging()||et.isTransforming())||et.hitOnDragEnabled;i&&a?(i._fireAndBubble(r.pointerout,{evt:e}),i._fireAndBubble(r.pointerleave,{evt:e}),this._fire(r.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):a&&(this._fire(r.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(r.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const r=Bf(e.type),n=Vh(e.type);if(!r)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(a=>{const o=this.getIntersection(a);if(ar.justDragged=!1,et["_"+n+"ListenClick"]=!0,!o||!o.isListening()){this[n+"ClickStartShape"]=void 0;return}et.capturePointerEventsEnabled&&o.setPointerCapture(a.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(r.pointerdown,{evt:e,pointerId:a.id}),i=!0;const s=e.type.indexOf("touch")>=0;o.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),i||this._fire(r.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const r=Bf(e.type),n=Vh(e.type);if(!r)return;const i=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(et.isDragging()&&ar.node.preventDefault()&&e.cancelable&&i&&e.preventDefault(),this.setPointersPositions(e),!(!(et.isDragging()||et.isTransforming())||et.hitOnDragEnabled))return;const o={};let s=!1;const u=this._getTargetShape(n);this._changedPointerPositions.forEach(f=>{const d=P1(f.id)||this.getIntersection(f),h=f.id,p={evt:e,pointerId:h},y=u!==d;if(y&&u&&(u._fireAndBubble(r.pointerout,{...p},d),u._fireAndBubble(r.pointerleave,{...p},d)),d){if(o[d._id])return;o[d._id]=!0}d&&d.isListening()?(s=!0,y&&(d._fireAndBubble(r.pointerover,{...p},u),d._fireAndBubble(r.pointerenter,{...p},u),this[n+"targetShape"]=d),d._fireAndBubble(r.pointermove,{...p})):u&&(this._fire(r.pointerover,{evt:e,target:this,currentTarget:this,pointerId:h}),this[n+"targetShape"]=null)}),s||this._fire(r.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const r=Bf(e.type),n=Vh(e.type);if(!r)return;this.setPointersPositions(e);const i=this[n+"ClickStartShape"],a=this[n+"ClickEndShape"],o={};let s=!1;this._changedPointerPositions.forEach(u=>{const f=P1(u.id)||this.getIntersection(u);if(f){if(f.releaseCapture(u.id),o[f._id])return;o[f._id]=!0}const d=u.id,h={evt:e,pointerId:d};let p=!1;et["_"+n+"InDblClickWindow"]?(p=!0,clearTimeout(this[n+"DblTimeout"])):ar.justDragged||(et["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){et["_"+n+"InDblClickWindow"]=!1},et.dblClickWindow),f&&f.isListening()?(s=!0,this[n+"ClickEndShape"]=f,f._fireAndBubble(r.pointerup,{...h}),et["_"+n+"ListenClick"]&&i&&i===f&&(f._fireAndBubble(r.pointerclick,{...h}),p&&a&&a===f&&f._fireAndBubble(r.pointerdblclick,{...h}))):(this[n+"ClickEndShape"]=null,s||(this._fire(r.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),et["_"+n+"ListenClick"]&&this._fire(r.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:d}),p&&this._fire(r.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:d}))}),s||this._fire(r.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),et["_"+n+"ListenClick"]=!1,e.cancelable&&n!=="touch"&&n!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const r=this.getIntersection(this.getPointerPosition());r&&r.isListening()?r._fireAndBubble(Dv,{evt:e}):this._fire(Dv,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const r=this.getIntersection(this.getPointerPosition());r&&r.isListening()?r._fireAndBubble(Nv,{evt:e}):this._fire(Nv,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const r=P1(e.pointerId)||this.getIntersection(this.getPointerPosition());r&&r._fireAndBubble(Jf,P2(e)),Jh(e.pointerId)}_lostpointercapture(e){Jh(e.pointerId)}setPointersPositions(e){const r=this._getContentPosition();let n=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,a=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-r.left)/r.scaleX,y:(a.clientY-r.top)/r.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,a=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-r.left)/r.scaleX,y:(a.clientY-r.top)/r.scaleY})})):(n=(e.clientX-r.left)/r.scaleX,i=(e.clientY-r.top)/r.scaleY,this.pointerPos={x:n,y:i},this._pointerPositions=[{x:n,y:i,id:Pe._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:i,id:Pe._getFirstPointerId(e)}])}_setPointerPosition(e){Pe.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ca({width:this.width(),height:this.height()}),this.bufferHitCanvas=new k2({pixelRatio:1,width:this.width(),height:this.height()}),!et.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return Pe.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};m0.prototype.nodeType=XP;qr(m0);fe.addGetterSetter(m0,"container");et.isBrowser&&document.addEventListener("visibilitychange",()=>{ep.forEach(t=>{t.batchDraw()})});const h5="hasShadow",p5="shadowRGBA",m5="patternImage",g5="linearGradient",y5="radialGradient";let ng;function T1(){return ng||(ng=Pe.createCanvasElement().getContext("2d"),ng)}const tp={};function tE(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function rE(t){t.stroke()}function nE(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function iE(t){t.stroke()}function aE(){this._clearCache(h5)}function oE(){this._clearCache(p5)}function sE(){this._clearCache(m5)}function lE(){this._clearCache(g5)}function uE(){this._clearCache(y5)}let qe=class extends Je{constructor(e){super(e);let r,n=0;for(;r=Pe.getHitColor(),!(r&&!(r in tp));)if(n++,n>=1e4){Pe.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),r=Pe.getRandomColor();break}this.colorKey=r,tp[r]=this}getContext(){return Pe.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Pe.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h5,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(m5,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const r=T1().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(r&&r.setTransform){const n=new aa;n.translate(this.fillPatternX(),this.fillPatternY()),n.rotate(et.getAngle(this.fillPatternRotation())),n.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),n.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=n.getMatrix(),a=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);r.setTransform(a)}return r}}_getLinearGradient(){return this._getCache(g5,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const r=T1(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),a=r.createLinearGradient(n.x,n.y,i.x,i.y);for(let o=0;o<e.length;o+=2)a.addColorStop(e[o],e[o+1]);return a}}_getRadialGradient(){return this._getCache(y5,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const r=T1(),n=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),a=r.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let o=0;o<e.length;o+=2)a.addColorStop(e[o],e[o+1]);return a}}getShadowRGBA(){return this._getCache(p5,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Pe.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const r=this.getStage();if(!r)return!1;const n=r.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return Je.prototype.destroy.call(this),delete tp[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var r;if(!((r=this.attrs.perfectDrawEnabled)!==null&&r!==void 0?r:!0))return!1;const i=e||this.hasFill(),a=this.hasStroke(),o=this.getAbsoluteOpacity()!==1;if(i&&a&&o)return!0;const s=this.hasShadow(),u=this.shadowForStrokeEnabled();return!!(i&&a&&s&&u)}setStrokeHitEnabled(e){Pe.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let r=!1,n=this.getParent();for(;n;){if(n.isCached()){r=!0;break}n=n.getParent()}const i=e.skipTransform,a=e.relativeTo||r&&this.getStage()||void 0,o=this.getSelfRect(),u=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,f=o.width+u,d=o.height+u,h=!e.skipShadow&&this.hasShadow(),p=h?this.shadowOffsetX():0,y=h?this.shadowOffsetY():0,v=f+Math.abs(p),b=d+Math.abs(y),x=h&&this.shadowBlur()||0,k=v+x*2,S=b+x*2,P={width:k,height:S,x:-(u/2+x)+Math.min(p,0)+o.x,y:-(u/2+x)+Math.min(y,0)+o.y};return i?P:this._transformedRect(P,a)}drawScene(e,r,n){const i=this.getLayer(),a=e||i.getCanvas(),o=a.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),f=this.hasShadow();let d;const h=r===this;if(!this.isVisible()&&!h)return this;if(s){o.save();const p=this.getAbsoluteTransform(r).getMatrix();return o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!u)return this;if(o.save(),this._useBufferCanvas()){d=this.getStage();const p=n||d.bufferCanvas,y=p.getContext();n?(y.save(),y.setTransform(1,0,0,1,0,0),y.clearRect(0,0,p.width,p.height),y.restore()):y.clear(),y.save(),y._applyLineJoin(this),y._applyMiterLimit(this);const v=this.getAbsoluteTransform(r).getMatrix();y.transform(v[0],v[1],v[2],v[3],v[4],v[5]),u.call(this,y,this),y.restore();const b=p.pixelRatio;f&&o._applyShadow(this),h||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(p._canvas,p.x||0,p.y||0,p.width/b,p.height/b)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!h){const p=this.getAbsoluteTransform(r).getMatrix();o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}f&&o._applyShadow(this),u.call(this,o,this)}return o.restore(),this}drawHit(e,r,n=!1){if(!this.shouldDrawHit(r,n))return this;const i=this.getLayer(),a=e||i.hitCanvas,o=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),u=this._getCanvasCache(),f=u&&u.hit;if(this.colorKey||Pe.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),f){o.save();const h=this.getAbsoluteTransform(r).getMatrix();return o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),o._applyLineJoin(this),o._applyMiterLimit(this),!(this===r)){const h=this.getAbsoluteTransform(r).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5])}return s.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){const r=this._getCanvasCache(),n=this._getCachedSceneCanvas(),i=r.hit,a=i.getContext(),o=i.getWidth(),s=i.getHeight();a.clear(),a.drawImage(n._canvas,0,0,o,s);try{const u=a.getImageData(0,0,o,s),f=u.data,d=f.length,h=Pe._hexToRgb(this.colorKey);for(let p=0;p<d;p+=4)f[p+3]>e?(f[p]=h.r,f[p+1]=h.g,f[p+2]=h.b,f[p+3]=255):f[p+3]=0;a.putImageData(u,0,0)}catch(u){Pe.error("Unable to draw hit graph from cached scene canvas. "+u.message)}return this}hasPointerCapture(e){return t5(e,this)}setPointerCapture(e){r5(e,this)}releaseCapture(e){Jh(e)}};qe.prototype._fillFunc=tE;qe.prototype._strokeFunc=rE;qe.prototype._fillFuncHit=nE;qe.prototype._strokeFuncHit=iE;qe.prototype._centroid=!1;qe.prototype.nodeType="Shape";qr(qe);qe.prototype.eventListeners={};qe.prototype.on.call(qe.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",aE);qe.prototype.on.call(qe.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",oE);qe.prototype.on.call(qe.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",sE);qe.prototype.on.call(qe.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",lE);qe.prototype.on.call(qe.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",uE);fe.addGetterSetter(qe,"stroke",void 0,JS());fe.addGetterSetter(qe,"strokeWidth",2,Qe());fe.addGetterSetter(qe,"fillAfterStrokeEnabled",!1);fe.addGetterSetter(qe,"hitStrokeWidth","auto",_2());fe.addGetterSetter(qe,"strokeHitEnabled",!0,so());fe.addGetterSetter(qe,"perfectDrawEnabled",!0,so());fe.addGetterSetter(qe,"shadowForStrokeEnabled",!0,so());fe.addGetterSetter(qe,"lineJoin");fe.addGetterSetter(qe,"lineCap");fe.addGetterSetter(qe,"miterLimit");fe.addGetterSetter(qe,"sceneFunc");fe.addGetterSetter(qe,"hitFunc");fe.addGetterSetter(qe,"dash");fe.addGetterSetter(qe,"dashOffset",0,Qe());fe.addGetterSetter(qe,"shadowColor",void 0,Ac());fe.addGetterSetter(qe,"shadowBlur",0,Qe());fe.addGetterSetter(qe,"shadowOpacity",1,Qe());fe.addComponentsGetterSetter(qe,"shadowOffset",["x","y"]);fe.addGetterSetter(qe,"shadowOffsetX",0,Qe());fe.addGetterSetter(qe,"shadowOffsetY",0,Qe());fe.addGetterSetter(qe,"fillPatternImage");fe.addGetterSetter(qe,"fill",void 0,JS());fe.addGetterSetter(qe,"fillPatternX",0,Qe());fe.addGetterSetter(qe,"fillPatternY",0,Qe());fe.addGetterSetter(qe,"fillLinearGradientColorStops");fe.addGetterSetter(qe,"strokeLinearGradientColorStops");fe.addGetterSetter(qe,"fillRadialGradientStartRadius",0);fe.addGetterSetter(qe,"fillRadialGradientEndRadius",0);fe.addGetterSetter(qe,"fillRadialGradientColorStops");fe.addGetterSetter(qe,"fillPatternRepeat","repeat");fe.addGetterSetter(qe,"fillEnabled",!0);fe.addGetterSetter(qe,"strokeEnabled",!0);fe.addGetterSetter(qe,"shadowEnabled",!0);fe.addGetterSetter(qe,"dashEnabled",!0);fe.addGetterSetter(qe,"strokeScaleEnabled",!0);fe.addGetterSetter(qe,"fillPriority","color");fe.addComponentsGetterSetter(qe,"fillPatternOffset",["x","y"]);fe.addGetterSetter(qe,"fillPatternOffsetX",0,Qe());fe.addGetterSetter(qe,"fillPatternOffsetY",0,Qe());fe.addComponentsGetterSetter(qe,"fillPatternScale",["x","y"]);fe.addGetterSetter(qe,"fillPatternScaleX",1,Qe());fe.addGetterSetter(qe,"fillPatternScaleY",1,Qe());fe.addComponentsGetterSetter(qe,"fillLinearGradientStartPoint",["x","y"]);fe.addComponentsGetterSetter(qe,"strokeLinearGradientStartPoint",["x","y"]);fe.addGetterSetter(qe,"fillLinearGradientStartPointX",0);fe.addGetterSetter(qe,"strokeLinearGradientStartPointX",0);fe.addGetterSetter(qe,"fillLinearGradientStartPointY",0);fe.addGetterSetter(qe,"strokeLinearGradientStartPointY",0);fe.addComponentsGetterSetter(qe,"fillLinearGradientEndPoint",["x","y"]);fe.addComponentsGetterSetter(qe,"strokeLinearGradientEndPoint",["x","y"]);fe.addGetterSetter(qe,"fillLinearGradientEndPointX",0);fe.addGetterSetter(qe,"strokeLinearGradientEndPointX",0);fe.addGetterSetter(qe,"fillLinearGradientEndPointY",0);fe.addGetterSetter(qe,"strokeLinearGradientEndPointY",0);fe.addComponentsGetterSetter(qe,"fillRadialGradientStartPoint",["x","y"]);fe.addGetterSetter(qe,"fillRadialGradientStartPointX",0);fe.addGetterSetter(qe,"fillRadialGradientStartPointY",0);fe.addComponentsGetterSetter(qe,"fillRadialGradientEndPoint",["x","y"]);fe.addGetterSetter(qe,"fillRadialGradientEndPointX",0);fe.addGetterSetter(qe,"fillRadialGradientEndPointY",0);fe.addGetterSetter(qe,"fillPatternRotation",0);fe.addGetterSetter(qe,"fillRule",void 0,Ac());fe.backCompat(qe,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});const cE="beforeDraw",fE="draw",v5=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],dE=v5.length;let Ic=class extends oa{constructor(e){super(e),this.canvas=new Ca,this.hitCanvas=new k2({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const r=this.getStage();return r&&r.content&&(r.content.removeChild(this.getNativeCanvasElement()),e<r.children.length-1?r.content.insertBefore(this.getNativeCanvasElement(),r.children[e+1].getCanvas()._canvas):r.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Je.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!Je.prototype.moveUp.call(this))return!1;const r=this.getStage();return!r||!r.content?!1:(r.content.removeChild(this.getNativeCanvasElement()),this.index<r.children.length-1?r.content.insertBefore(this.getNativeCanvasElement(),r.children[this.index+1].getCanvas()._canvas):r.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Je.prototype.moveDown.call(this)){const e=this.getStage();if(e){const r=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),r[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Je.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const r=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),r[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return Je.prototype.remove.call(this),e&&e.parentNode&&Pe._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:r}){return this.canvas.setSize(e,r),this.hitCanvas.setSize(e,r),this._setSmoothEnabled(),this}_validateAdd(e){const r=e.getType();r!=="Group"&&r!=="Shape"&&Pe.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Je.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Pe.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Pe.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Pe.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let r=1,n=!1;for(;;){for(let i=0;i<dE;i++){const a=v5[i],o=this._getIntersection({x:e.x+a.x*r,y:e.y+a.y*r}),s=o.shape;if(s)return s;if(n=!!o.antialiased,!o.antialiased)break}if(n)r+=1;else return null}}_getIntersection(e){const r=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*r),Math.round(e.y*r),1,1).data,i=n[3];if(i===255){const a=Pe.getHitColorKey(n[0],n[1],n[2]),o=tp[a];return o?{shape:o}:{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(e,r,n){const i=this.getLayer(),a=e||i&&i.getCanvas();return this._fire(cE,{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),oa.prototype.drawScene.call(this,a,r,n),this._fire(fE,{node:this}),this}drawHit(e,r){const n=this.getLayer(),i=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),oa.prototype.drawHit.call(this,i,r),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Pe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Pe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Pe.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Ic.prototype.nodeType="Layer";qr(Ic);fe.addGetterSetter(Ic,"imageSmoothingEnabled",!0);fe.addGetterSetter(Ic,"clearBeforeDraw",!0);fe.addGetterSetter(Ic,"hitGraphEnabled",!0,so());class E2 extends Ic{constructor(e){super(e),this.listening(!1),Pe.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}E2.prototype.nodeType="FastLayer";qr(E2);let bd=class extends oa{_validateAdd(e){const r=e.getType();r!=="Group"&&r!=="Shape"&&Pe.throw("You may only add groups and shapes to groups.")}};bd.prototype.nodeType="Group";qr(bd);const C1=(function(){return dc.performance&&dc.performance.now?function(){return dc.performance.now()}:function(){return new Date().getTime()}})();let Td=class qf{constructor(e,r){this.id=qf.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:C1(),frameRate:0},this.func=e,this.setLayers(r)}setLayers(e){let r=[];return e&&(r=Array.isArray(e)?e:[e]),this.layers=r,this}getLayers(){return this.layers}addLayer(e){const r=this.layers,n=r.length;for(let i=0;i<n;i++)if(r[i]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const r=qf.animations,n=r.length;for(let i=0;i<n;i++)if(r[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=C1(),qf._addAnimation(this),this}stop(){return qf._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const r=e.id,n=this.animations,i=n.length;for(let a=0;a<i;a++)if(n[a].id===r){this.animations.splice(a,1);break}}static _runFrames(){const e={},r=this.animations;for(let n=0;n<r.length;n++){const i=r[n],a=i.layers,o=i.func;i._updateFrameObject(C1());const s=a.length;let u;if(o?u=o.call(i,i.frame)!==!1:u=!0,!!u)for(let f=0;f<s;f++){const d=a[f];d._id!==void 0&&(e[d._id]=d)}}for(const n in e)e.hasOwnProperty(n)&&e[n].batchDraw()}static _animationLoop(){const e=qf;e.animations.length?(e._runFrames(),Pe.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Pe.requestAnimFrame(this._animationLoop))}};Td.animations=[];Td.animIdCounter=0;Td.animRunning=!1;const hE={node:1,duration:1,easing:1,onFinish:1,yoyo:1},pE=1,Tw=2,Cw=3,Ow=["fill","stroke","shadowColor"];let mE=0;class gE{constructor(e,r,n,i,a,o,s){this.prop=e,this.propFunc=r,this.begin=i,this._pos=i,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=a-this.begin,this.pause()}fire(e){const r=this[e];r&&r()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Tw,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Cw,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===Tw?this.setTime(e):this.state===Cw&&this.setTime(this.duration-e)}pause(){this.state=pE,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Cr{constructor(e){const r=this,n=e.node,i=n._id,a=e.easing||rp.Linear,o=!!e.yoyo;let s,u;typeof e.duration>"u"?s=.3:e.duration===0?s=.001:s=e.duration,this.node=n,this._id=mE++;const f=n.getLayer()||(n instanceof et.Stage?n.getLayers():null);f||Pe.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Td(function(){r.tween.onEnterFrame()},f),this.tween=new gE(u,function(d){r._tweenFunc(d)},a,0,1,s*1e3,o),this._addListeners(),Cr.attrs[i]||(Cr.attrs[i]={}),Cr.attrs[i][this._id]||(Cr.attrs[i][this._id]={}),Cr.tweens[i]||(Cr.tweens[i]={});for(u in e)hE[u]===void 0&&this._addAttr(u,e[u]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,r){const n=this.node,i=n._id;let a,o,s,u,f;const d=Cr.tweens[i][e];d&&delete Cr.attrs[i][d][e];let h=n.getAttr(e);if(Pe._isArray(r))if(a=[],o=Math.max(r.length,h.length),e==="points"&&r.length!==h.length&&(r.length>h.length?(u=h,h=Pe._prepareArrayForTween(h,r,n.closed())):(s=r,r=Pe._prepareArrayForTween(r,h,n.closed()))),e.indexOf("fill")===0)for(let p=0;p<o;p++)if(p%2===0)a.push(r[p]-h[p]);else{const y=Pe.colorToRGBA(h[p]);f=Pe.colorToRGBA(r[p]),h[p]=y,a.push({r:f.r-y.r,g:f.g-y.g,b:f.b-y.b,a:f.a-y.a})}else for(let p=0;p<o;p++)a.push(r[p]-h[p]);else Ow.indexOf(e)!==-1?(h=Pe.colorToRGBA(h),f=Pe.colorToRGBA(r),a={r:f.r-h.r,g:f.g-h.g,b:f.b-h.b,a:f.a-h.a}):a=r-h;Cr.attrs[i][this._id][e]={start:h,diff:a,end:r,trueEnd:s,trueStart:u},Cr.tweens[i][e]=this._id}_tweenFunc(e){const r=this.node,n=Cr.attrs[r._id][this._id];let i,a,o,s,u,f,d,h;for(i in n){if(a=n[i],o=a.start,s=a.diff,h=a.end,Pe._isArray(o))if(u=[],d=Math.max(o.length,h.length),i.indexOf("fill")===0)for(f=0;f<d;f++)f%2===0?u.push((o[f]||0)+s[f]*e):u.push("rgba("+Math.round(o[f].r+s[f].r*e)+","+Math.round(o[f].g+s[f].g*e)+","+Math.round(o[f].b+s[f].b*e)+","+(o[f].a+s[f].a*e)+")");else for(f=0;f<d;f++)u.push((o[f]||0)+s[f]*e);else Ow.indexOf(i)!==-1?u="rgba("+Math.round(o.r+s.r*e)+","+Math.round(o.g+s.g*e)+","+Math.round(o.b+s.b*e)+","+(o.a+s.a*e)+")":u=o+s*e;r.setAttr(i,u)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const e=this.node,r=Cr.attrs[e._id][this._id];r.points&&r.points.trueEnd&&e.setAttr("points",r.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const e=this.node,r=Cr.attrs[e._id][this._id];r.points&&r.points.trueStart&&e.points(r.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const e=this.node._id,r=this._id,n=Cr.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const i in n)delete Cr.tweens[e][i];delete Cr.attrs[e][r],Cr.tweens[e]&&(Object.keys(Cr.tweens[e]).length===0&&delete Cr.tweens[e],Object.keys(Cr.attrs[e]).length===0&&delete Cr.attrs[e])}}Cr.attrs={};Cr.tweens={};Je.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Cr(t).play()};const rp={BackEaseIn(t,e,r,n){return r*(t/=n)*t*((1.70158+1)*t-1.70158)+e},BackEaseOut(t,e,r,n){return r*((t=t/n-1)*t*((1.70158+1)*t+1.70158)+1)+e},BackEaseInOut(t,e,r,n){let i=1.70158;return(t/=n/2)<1?r/2*(t*t*(((i*=1.525)+1)*t-i))+e:r/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,r,n,i,a){let o=0;return t===0?e:(t/=n)===1?e+r:(a||(a=n*.3),!i||i<Math.abs(r)?(i=r,o=a/4):o=a/(2*Math.PI)*Math.asin(r/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((t*n-o)*(2*Math.PI)/a))+e)},ElasticEaseOut(t,e,r,n,i,a){let o=0;return t===0?e:(t/=n)===1?e+r:(a||(a=n*.3),!i||i<Math.abs(r)?(i=r,o=a/4):o=a/(2*Math.PI)*Math.asin(r/i),i*Math.pow(2,-10*t)*Math.sin((t*n-o)*(2*Math.PI)/a)+r+e)},ElasticEaseInOut(t,e,r,n,i,a){let o=0;return t===0?e:(t/=n/2)===2?e+r:(a||(a=n*(.3*1.5)),!i||i<Math.abs(r)?(i=r,o=a/4):o=a/(2*Math.PI)*Math.asin(r/i),t<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((t*n-o)*(2*Math.PI)/a))+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*n-o)*(2*Math.PI)/a)*.5+r+e)},BounceEaseOut(t,e,r,n){return(t/=n)<1/2.75?r*(7.5625*t*t)+e:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+e:r*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn(t,e,r,n){return r-rp.BounceEaseOut(n-t,0,r,n)+e},BounceEaseInOut(t,e,r,n){return t<n/2?rp.BounceEaseIn(t*2,0,r,n)*.5+e:rp.BounceEaseOut(t*2-n,0,r,n)*.5+r*.5+e},EaseIn(t,e,r,n){return r*(t/=n)*t+e},EaseOut(t,e,r,n){return-r*(t/=n)*(t-2)+e},EaseInOut(t,e,r,n){return(t/=n/2)<1?r/2*t*t+e:-r/2*(--t*(t-2)-1)+e},StrongEaseIn(t,e,r,n){return r*(t/=n)*t*t*t*t+e},StrongEaseOut(t,e,r,n){return r*((t=t/n-1)*t*t*t*t+1)+e},StrongEaseInOut(t,e,r,n){return(t/=n/2)<1?r/2*t*t*t*t*t+e:r/2*((t-=2)*t*t*t*t+2)+e},Linear(t,e,r,n){return r*t/n+e}},kc=Pe._assign(et,{Util:Pe,Transform:aa,Node:Je,Container:oa,Stage:m0,stages:ep,Layer:Ic,FastLayer:E2,Group:bd,DD:ar,Shape:qe,shapes:tp,Animation:Td,Tween:Cr,Easings:rp,Context:h0,Canvas:S2});let Qs=class extends qe{_sceneFunc(e){const r=et.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,r,n),e.arc(0,0,this.innerRadius(),r,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),r=this.outerRadius(),n=this.clockwise(),i=et.getAngle(n?360-this.angle():this.angle()),a=Math.cos(Math.min(i,Math.PI)),o=1,s=Math.sin(Math.min(Math.max(Math.PI,i),3*Math.PI/2)),u=Math.sin(Math.min(i,Math.PI/2)),f=a*(a>0?e:r),d=o*r,h=s*(s>0?e:r),p=u*(u>0?r:e);return{x:f,y:n?-1*p:h,width:d-f,height:p-h}}};Qs.prototype._centroid=!0;Qs.prototype.className="Arc";Qs.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];qr(Qs);fe.addGetterSetter(Qs,"innerRadius",0,Qe());fe.addGetterSetter(Qs,"outerRadius",0,Qe());fe.addGetterSetter(Qs,"angle",0,Qe());fe.addGetterSetter(Qs,"clockwise",!1,so());function Lv(t,e,r,n,i,a,o){const s=Math.sqrt(Math.pow(r-t,2)+Math.pow(n-e,2)),u=Math.sqrt(Math.pow(i-r,2)+Math.pow(a-n,2)),f=o*s/(s+u),d=o*u/(s+u),h=r-f*(i-t),p=n-f*(a-e),y=r+d*(i-t),v=n+d*(a-e);return[h,p,y,v]}function Aw(t,e){const r=t.length,n=[];for(let i=2;i<r-2;i+=2){const a=Lv(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e);isNaN(a[0])||(n.push(a[0]),n.push(a[1]),n.push(t[i]),n.push(t[i+1]),n.push(a[2]),n.push(a[3]))}return n}function yE(t){const e=[[t[0],t[2],t[4],t[6]],[t[1],t[3],t[5],t[7]]],r=[];for(const n of e){const i=-3*n[0]+9*n[1]-9*n[2]+3*n[3];if(i!==0){const a=6*n[0]-12*n[1]+6*n[2],o=-3*n[0]+3*n[1],s=a*a-4*i*o;if(s>=0){const u=Math.sqrt(s);r.push((-a+u)/(2*i)),r.push((-a-u)/(2*i))}}}return r.filter(n=>n>0&&n<1).flatMap(n=>e.map(i=>{const a=1-n;return a*a*a*i[0]+3*a*a*n*i[1]+3*a*n*n*i[2]+n*n*n*i[3]}))}let Zs=class extends qe{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const r=this.points(),n=r.length,i=this.tension(),a=this.closed(),o=this.bezier();if(!n)return;let s=0;if(e.beginPath(),e.moveTo(r[0],r[1]),i!==0&&n>4){const u=this.getTensionPoints(),f=u.length;for(s=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);s<f-2;)e.bezierCurveTo(u[s++],u[s++],u[s++],u[s++],u[s++],u[s++]);a||e.quadraticCurveTo(u[f-2],u[f-1],r[n-2],r[n-1])}else if(o)for(s=2;s<n;)e.bezierCurveTo(r[s++],r[s++],r[s++],r[s++],r[s++],r[s++]);else for(s=2;s<n;s+=2)e.lineTo(r[s],r[s+1]);a?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Aw(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),r=e.length,n=this.tension(),i=Lv(e[r-2],e[r-1],e[0],e[1],e[2],e[3],n),a=Lv(e[r-4],e[r-3],e[r-2],e[r-1],e[0],e[1],n),o=Aw(e,n);return[i[2],i[3]].concat(o).concat([a[0],a[1],e[r-2],e[r-1],a[2],a[3],i[0],i[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...yE(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let r=e[0],n=e[0],i=e[1],a=e[1],o,s;for(let u=0;u<e.length/2;u++)o=e[u*2],s=e[u*2+1],r=Math.min(r,o),n=Math.max(n,o),i=Math.min(i,s),a=Math.max(a,s);return{x:r,y:i,width:n-r,height:a-i}}};Zs.prototype.className="Line";Zs.prototype._attrsAffectingSize=["points","bezier","tension"];qr(Zs);fe.addGetterSetter(Zs,"closed",!1);fe.addGetterSetter(Zs,"bezier",!1);fe.addGetterSetter(Zs,"tension",0,Qe());fe.addGetterSetter(Zs,"points",[],MP());const vE=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],bE=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],wE=[[1],[1,1],[1,2,1],[1,3,3,1]],Iw=(t,e,r)=>{let n,i;const o=r/2;n=0;for(let s=0;s<20;s++)i=o*vE[20][s]+o,n+=bE[20][s]*xE(t,e,i);return o*n},Rw=(t,e,r)=>{r===void 0&&(r=1);const n=t[0]-2*t[1]+t[2],i=e[0]-2*e[1]+e[2],a=2*t[1]-2*t[0],o=2*e[1]-2*e[0],s=4*(n*n+i*i),u=4*(n*a+i*o),f=a*a+o*o;if(s===0)return r*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const d=u/(2*s),h=f/s,p=r+d,y=h-d*d,v=p*p+y>0?Math.sqrt(p*p+y):0,b=d*d+y>0?Math.sqrt(d*d+y):0,x=d+Math.sqrt(d*d+y)!==0?y*Math.log(Math.abs((p+v)/(d+b))):0;return Math.sqrt(s)/2*(p*v-d*b+x)};function xE(t,e,r){const n=Fv(1,r,t),i=Fv(1,r,e),a=n*n+i*i;return Math.sqrt(a)}const Fv=(t,e,r)=>{const n=r.length-1;let i,a;if(n===0)return 0;if(t===0){a=0;for(let o=0;o<=n;o++)a+=wE[n][o]*Math.pow(1-e,n-o)*Math.pow(e,o)*r[o];return a}else{i=new Array(n);for(let o=0;o<n;o++)i[o]=n*(r[o+1]-r[o]);return Fv(t-1,e,i)}},Mw=(t,e,r)=>{let n=1,i=t/e,a=(t-r(i))/e,o=0;for(;n>.001;){const s=r(i+a),u=Math.abs(t-s)/e;if(u<n)n=u,i+=a;else{const f=r(i-a),d=Math.abs(t-f)/e;d<n?(n=d,i-=a):a/=2}if(o++,o>500)break}return i};let Oa=class Di extends qe{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Di.parsePathData(this.data()),this.pathLength=Di.getPathLength(this.dataArray)}_sceneFunc(e){const r=this.dataArray;e.beginPath();let n=!1;for(let i=0;i<r.length;i++){const a=r[i].command,o=r[i].points;switch(a){case"L":e.lineTo(o[0],o[1]);break;case"M":e.moveTo(o[0],o[1]);break;case"C":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":const s=o[0],u=o[1],f=o[2],d=o[3],h=o[4],p=o[5],y=o[6],v=o[7],b=f>d?f:d,x=f>d?1:f/d,k=f>d?d/f:1;e.translate(s,u),e.rotate(y),e.scale(x,k),e.arc(0,0,b,h,h+p,1-v),e.scale(1/x,1/k),e.rotate(-y),e.translate(-s,-u);break;case"z":n=!0,e.closePath();break}}!n&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(u){if(u.command==="A"){const f=u.points[4],d=u.points[5],h=u.points[4]+d;let p=Math.PI/180;if(Math.abs(f-h)<p&&(p=Math.abs(f-h)),d<0)for(let y=f-p;y>h;y-=p){const v=Di.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],y,0);e.push(v.x,v.y)}else for(let y=f+p;y<h;y+=p){const v=Di.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],y,0);e.push(v.x,v.y)}}else if(u.command==="C")for(let f=0;f<=1;f+=.01){const d=Di.getPointOnCubicBezier(f,u.start.x,u.start.y,u.points[0],u.points[1],u.points[2],u.points[3],u.points[4],u.points[5]);e.push(d.x,d.y)}else e=e.concat(u.points)});let r=e[0],n=e[0],i=e[1],a=e[1],o,s;for(let u=0;u<e.length/2;u++)o=e[u*2],s=e[u*2+1],isNaN(o)||(r=Math.min(r,o),n=Math.max(n,o)),isNaN(s)||(i=Math.min(i,s),a=Math.max(a,s));return{x:r,y:i,width:n-r,height:a-i}}getLength(){return this.pathLength}getPointAtLength(e){return Di.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,r,n,i){return Math.sqrt((n-e)*(n-e)+(i-r)*(i-r))}static getPathLength(e){let r=0;for(let n=0;n<e.length;++n)r+=e[n].pathLength;return r}static getPointAtLengthOfDataArray(e,r){let n,i=0,a=r.length;if(!a)return null;for(;i<a&&e>r[i].pathLength;)e-=r[i].pathLength,++i;if(i===a)return n=r[i-1].points.slice(-2),{x:n[0],y:n[1]};if(e<.01)return r[i].command==="M"?(n=r[i].points.slice(0,2),{x:n[0],y:n[1]}):{x:r[i].start.x,y:r[i].start.y};const o=r[i],s=o.points;switch(o.command){case"L":return Di.getPointOnLine(e,o.start.x,o.start.y,s[0],s[1]);case"C":return Di.getPointOnCubicBezier(Mw(e,Di.getPathLength(r),b=>Iw([o.start.x,s[0],s[2],s[4]],[o.start.y,s[1],s[3],s[5]],b)),o.start.x,o.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return Di.getPointOnQuadraticBezier(Mw(e,Di.getPathLength(r),b=>Rw([o.start.x,s[0],s[2]],[o.start.y,s[1],s[3]],b)),o.start.x,o.start.y,s[0],s[1],s[2],s[3]);case"A":const u=s[0],f=s[1],d=s[2],h=s[3],p=s[5],y=s[6];let v=s[4];return v+=p*e/o.pathLength,Di.getPointOnEllipticalArc(u,f,d,h,v,y)}return null}static getPointOnLine(e,r,n,i,a,o,s){o=o??r,s=s??n;const u=this.getLineLength(r,n,i,a);if(u<1e-10)return{x:r,y:n};if(i===r)return{x:o,y:s+(a>n?e:-e)};const f=(a-n)/(i-r),d=Math.sqrt(e*e/(1+f*f))*(i<r?-1:1),h=f*d;if(Math.abs(s-n-f*(o-r))<1e-10)return{x:o+d,y:s+h};const p=((o-r)*(i-r)+(s-n)*(a-n))/(u*u),y=r+p*(i-r),v=n+p*(a-n),b=this.getLineLength(o,s,y,v),x=Math.sqrt(e*e-b*b),k=Math.sqrt(x*x/(1+f*f))*(i<r?-1:1),S=f*k;return{x:y+k,y:v+S}}static getPointOnCubicBezier(e,r,n,i,a,o,s,u,f){function d(x){return x*x*x}function h(x){return 3*x*x*(1-x)}function p(x){return 3*x*(1-x)*(1-x)}function y(x){return(1-x)*(1-x)*(1-x)}const v=u*d(e)+o*h(e)+i*p(e)+r*y(e),b=f*d(e)+s*h(e)+a*p(e)+n*y(e);return{x:v,y:b}}static getPointOnQuadraticBezier(e,r,n,i,a,o,s){function u(y){return y*y}function f(y){return 2*y*(1-y)}function d(y){return(1-y)*(1-y)}const h=o*u(e)+i*f(e)+r*d(e),p=s*u(e)+a*f(e)+n*d(e);return{x:h,y:p}}static getPointOnEllipticalArc(e,r,n,i,a,o){const s=Math.cos(o),u=Math.sin(o),f={x:n*Math.cos(a),y:i*Math.sin(a)};return{x:e+(f.x*s-f.y*u),y:r+(f.x*u+f.y*s)}}static parsePathData(e){if(!e)return[];let r=e;const n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];r=r.replace(new RegExp(" ","g"),",");for(let h=0;h<n.length;h++)r=r.replace(new RegExp(n[h],"g"),"|"+n[h]);const i=r.split("|"),a=[],o=[];let s=0,u=0;const f=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let h=1;h<i.length;h++){let p=i[h],y=p.charAt(0);for(p=p.slice(1),o.length=0;d=f.exec(p);)o.push(d[0]);let v=[],b=y==="A"||y==="a"?0:-1;for(let x=0,k=o.length;x<k;x++){const S=o[x];if(S==="00"){v.push(0,0),b>=0&&(b+=2,b>=7&&(b-=7));continue}if(b>=0){if(b===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(S)){v.push(parseInt(S[0],10)),v.push(parseInt(S[1],10)),v.push(parseFloat(S.slice(2))),b+=3,b>=7&&(b-=7);continue}if(S==="11"||S==="10"||S==="01"){v.push(parseInt(S[0],10)),v.push(parseInt(S[1],10)),b+=2,b>=7&&(b-=7);continue}if(S==="0"||S==="1"){v.push(parseInt(S,10)),b+=1,b>=7&&(b-=7);continue}}else if(b===4){if(/^[01]\d+(?:\.\d+)?$/.test(S)){v.push(parseInt(S[0],10)),v.push(parseFloat(S.slice(1))),b+=2,b>=7&&(b-=7);continue}if(S==="0"||S==="1"){v.push(parseInt(S,10)),b+=1,b>=7&&(b-=7);continue}}const P=parseFloat(S);isNaN(P)?v.push(0):v.push(P),b+=1,b>=7&&(b-=7)}else{const P=parseFloat(S);isNaN(P)?v.push(0):v.push(P)}}for(;v.length>0&&!isNaN(v[0]);){let x="",k=[];const S=s,P=u;let _,E,A,T,I,L,R,N,F,H;switch(y){case"l":s+=v.shift(),u+=v.shift(),x="L",k.push(s,u);break;case"L":s=v.shift(),u=v.shift(),k.push(s,u);break;case"m":const $=v.shift(),X=v.shift();if(s+=$,u+=X,x="M",a.length>2&&a[a.length-1].command==="z"){for(let Z=a.length-2;Z>=0;Z--)if(a[Z].command==="M"){s=a[Z].points[0]+$,u=a[Z].points[1]+X;break}}k.push(s,u),y="l";break;case"M":s=v.shift(),u=v.shift(),x="M",k.push(s,u),y="L";break;case"h":s+=v.shift(),x="L",k.push(s,u);break;case"H":s=v.shift(),x="L",k.push(s,u);break;case"v":u+=v.shift(),x="L",k.push(s,u);break;case"V":u=v.shift(),x="L",k.push(s,u);break;case"C":k.push(v.shift(),v.shift(),v.shift(),v.shift()),s=v.shift(),u=v.shift(),k.push(s,u);break;case"c":k.push(s+v.shift(),u+v.shift(),s+v.shift(),u+v.shift()),s+=v.shift(),u+=v.shift(),x="C",k.push(s,u);break;case"S":E=s,A=u,_=a[a.length-1],_.command==="C"&&(E=s+(s-_.points[2]),A=u+(u-_.points[3])),k.push(E,A,v.shift(),v.shift()),s=v.shift(),u=v.shift(),x="C",k.push(s,u);break;case"s":E=s,A=u,_=a[a.length-1],_.command==="C"&&(E=s+(s-_.points[2]),A=u+(u-_.points[3])),k.push(E,A,s+v.shift(),u+v.shift()),s+=v.shift(),u+=v.shift(),x="C",k.push(s,u);break;case"Q":k.push(v.shift(),v.shift()),s=v.shift(),u=v.shift(),k.push(s,u);break;case"q":k.push(s+v.shift(),u+v.shift()),s+=v.shift(),u+=v.shift(),x="Q",k.push(s,u);break;case"T":E=s,A=u,_=a[a.length-1],_.command==="Q"&&(E=s+(s-_.points[0]),A=u+(u-_.points[1])),s=v.shift(),u=v.shift(),x="Q",k.push(E,A,s,u);break;case"t":E=s,A=u,_=a[a.length-1],_.command==="Q"&&(E=s+(s-_.points[0]),A=u+(u-_.points[1])),s+=v.shift(),u+=v.shift(),x="Q",k.push(E,A,s,u);break;case"A":T=v.shift(),I=v.shift(),L=v.shift(),R=v.shift(),N=v.shift(),F=s,H=u,s=v.shift(),u=v.shift(),x="A",k=this.convertEndpointToCenterParameterization(F,H,s,u,R,N,T,I,L);break;case"a":T=v.shift(),I=v.shift(),L=v.shift(),R=v.shift(),N=v.shift(),F=s,H=u,s+=v.shift(),u+=v.shift(),x="A",k=this.convertEndpointToCenterParameterization(F,H,s,u,R,N,T,I,L);break}a.push({command:x||y,points:k,start:{x:S,y:P},pathLength:this.calcLength(S,P,x||y,k)})}(y==="z"||y==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,r,n,i){let a,o,s,u;const f=Di;switch(n){case"L":return f.getLineLength(e,r,i[0],i[1]);case"C":return Iw([e,i[0],i[2],i[4]],[r,i[1],i[3],i[5]],1);case"Q":return Rw([e,i[0],i[2]],[r,i[1],i[3]],1);case"A":a=0;const d=i[4],h=i[5],p=i[4]+h;let y=Math.PI/180;if(Math.abs(d-p)<y&&(y=Math.abs(d-p)),o=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],d,0),h<0)for(u=d-y;u>p;u-=y)s=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=f.getLineLength(o.x,o.y,s.x,s.y),o=s;else for(u=d+y;u<p;u+=y)s=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=f.getLineLength(o.x,o.y,s.x,s.y),o=s;return s=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],p,0),a+=f.getLineLength(o.x,o.y,s.x,s.y),a}return 0}static convertEndpointToCenterParameterization(e,r,n,i,a,o,s,u,f){const d=f*(Math.PI/180),h=Math.cos(d)*(e-n)/2+Math.sin(d)*(r-i)/2,p=-1*Math.sin(d)*(e-n)/2+Math.cos(d)*(r-i)/2,y=h*h/(s*s)+p*p/(u*u);y>1&&(s*=Math.sqrt(y),u*=Math.sqrt(y));let v=Math.sqrt((s*s*(u*u)-s*s*(p*p)-u*u*(h*h))/(s*s*(p*p)+u*u*(h*h)));a===o&&(v*=-1),isNaN(v)&&(v=0);const b=v*s*p/u,x=v*-u*h/s,k=(e+n)/2+Math.cos(d)*b-Math.sin(d)*x,S=(r+i)/2+Math.sin(d)*b+Math.cos(d)*x,P=function(R){return Math.sqrt(R[0]*R[0]+R[1]*R[1])},_=function(R,N){return(R[0]*N[0]+R[1]*N[1])/(P(R)*P(N))},E=function(R,N){return(R[0]*N[1]<R[1]*N[0]?-1:1)*Math.acos(_(R,N))},A=E([1,0],[(h-b)/s,(p-x)/u]),T=[(h-b)/s,(p-x)/u],I=[(-1*h-b)/s,(-1*p-x)/u];let L=E(T,I);return _(T,I)<=-1&&(L=Math.PI),_(T,I)>=1&&(L=0),o===0&&L>0&&(L=L-2*Math.PI),o===1&&L<0&&(L=L+2*Math.PI),[k,S,s,u,A,L,d,o]}};Oa.prototype.className="Path";Oa.prototype._attrsAffectingSize=["data"];qr(Oa);fe.addGetterSetter(Oa,"data");class Rc extends Zs{_sceneFunc(e){super._sceneFunc(e);const r=Math.PI*2,n=this.points();let i=n;const a=this.tension()!==0&&n.length>4;a&&(i=this.getTensionPoints());const o=this.pointerLength(),s=n.length;let u,f;if(a){const p=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],n[s-2],n[s-1]],y=Oa.calcLength(i[i.length-4],i[i.length-3],"C",p),v=Oa.getPointOnQuadraticBezier(Math.min(1,1-o/y),p[0],p[1],p[2],p[3],p[4],p[5]);u=n[s-2]-v.x,f=n[s-1]-v.y}else u=n[s-2]-n[s-4],f=n[s-1]-n[s-3];const d=(Math.atan2(f,u)+r)%r,h=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(d),e.moveTo(0,0),e.lineTo(-o,h/2),e.lineTo(-o,-h/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),a?(u=(i[0]+i[2])/2-n[0],f=(i[1]+i[3])/2-n[1]):(u=n[2]-n[0],f=n[3]-n[1]),e.rotate((Math.atan2(-f,-u)+r)%r),e.moveTo(0,0),e.lineTo(-o,h/2),e.lineTo(-o,-h/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const r=this.dashEnabled();r&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),r&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),r=this.pointerWidth()/2;return{x:e.x,y:e.y-r,width:e.width,height:e.height+r*2}}}Rc.prototype.className="Arrow";qr(Rc);fe.addGetterSetter(Rc,"pointerLength",10,Qe());fe.addGetterSetter(Rc,"pointerWidth",10,Qe());fe.addGetterSetter(Rc,"pointerAtBeginning",!1);fe.addGetterSetter(Rc,"pointerAtEnding",!0);let Cd=class extends qe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};Cd.prototype._centroid=!0;Cd.prototype.className="Circle";Cd.prototype._attrsAffectingSize=["radius"];qr(Cd);fe.addGetterSetter(Cd,"radius",0,Qe());class gu extends qe{_sceneFunc(e){const r=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),r!==n&&e.scale(1,n/r),e.arc(0,0,r,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}gu.prototype.className="Ellipse";gu.prototype._centroid=!0;gu.prototype._attrsAffectingSize=["radiusX","radiusY"];qr(gu);fe.addComponentsGetterSetter(gu,"radius",["x","y"]);fe.addGetterSetter(gu,"radiusX",0,Qe());fe.addGetterSetter(gu,"radiusY",0,Qe());let lo=class b5 extends qe{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",r=>{this._removeImageLoad(r.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const e=!!this.cornerRadius(),r=this.hasShadow();return e&&r?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const r=this.getWidth(),n=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let o;if(a){const s=this.attrs.cropWidth,u=this.attrs.cropHeight;s&&u?o=[a,this.cropX(),this.cropY(),s,u,0,0,r,n]:o=[a,0,0,r,n]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?Pe.drawRoundedRectPath(e,r,n,i):e.rect(0,0,r,n),e.closePath(),e.fillStrokeShape(this)),a&&(i&&e.clip(),e.drawImage.apply(e,o))}_hitFunc(e){const r=this.width(),n=this.height(),i=this.cornerRadius();e.beginPath(),i?Pe.drawRoundedRectPath(e,r,n,i):e.rect(0,0,r,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,r,n;return(n=(e=this.attrs.width)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.width)!==null&&n!==void 0?n:0}getHeight(){var e,r,n;return(n=(e=this.attrs.height)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.height)!==null&&n!==void 0?n:0}static fromURL(e,r,n=null){const i=Pe.createImageElement();i.onload=function(){const a=new b5({image:i});r(a)},i.onerror=n,i.crossOrigin="Anonymous",i.src=e}};lo.prototype.className="Image";lo.prototype._attrsAffectingSize=["image"];qr(lo);fe.addGetterSetter(lo,"cornerRadius",0,p0(4));fe.addGetterSetter(lo,"image");fe.addComponentsGetterSetter(lo,"crop",["x","y","width","height"]);fe.addGetterSetter(lo,"cropX",0,Qe());fe.addGetterSetter(lo,"cropY",0,Qe());fe.addGetterSetter(lo,"cropWidth",0,Qe());fe.addGetterSetter(lo,"cropHeight",0,Qe());const w5=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],SE="Change.konva",kE="none",Bv="up",zv="right",jv="down",Uv="left",_E=w5.length;let T2=class extends bd{constructor(e){super(e),this.on("add.konva",function(r){this._addListeners(r.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let r=this,n;const i=function(){r._sync()};for(n=0;n<_E;n++)e.on(w5[n]+SE,i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),r=this.getTag(),n,i,a,o,s,u,f;if(e&&r){switch(n=e.width(),i=e.height(),a=r.pointerDirection(),o=r.pointerWidth(),f=r.pointerHeight(),s=0,u=0,a){case Bv:s=n/2,u=-1*f;break;case zv:s=n+o,u=i/2;break;case jv:s=n/2,u=i+f;break;case Uv:s=-1*o,u=i/2;break}r.setAttrs({x:-1*s,y:-1*u,width:n,height:i}),e.setAttrs({x:-1*s,y:-1*u})}}};T2.prototype.className="Label";qr(T2);let Mc=class extends qe{_sceneFunc(e){const r=this.width(),n=this.height(),i=this.pointerDirection(),a=this.pointerWidth(),o=this.pointerHeight(),s=this.cornerRadius();let u=0,f=0,d=0,h=0;typeof s=="number"?u=f=d=h=Math.min(s,r/2,n/2):(u=Math.min(s[0]||0,r/2,n/2),f=Math.min(s[1]||0,r/2,n/2),h=Math.min(s[2]||0,r/2,n/2),d=Math.min(s[3]||0,r/2,n/2)),e.beginPath(),e.moveTo(u,0),i===Bv&&(e.lineTo((r-a)/2,0),e.lineTo(r/2,-1*o),e.lineTo((r+a)/2,0)),e.lineTo(r-f,0),e.arc(r-f,f,f,Math.PI*3/2,0,!1),i===zv&&(e.lineTo(r,(n-o)/2),e.lineTo(r+a,n/2),e.lineTo(r,(n+o)/2)),e.lineTo(r,n-h),e.arc(r-h,n-h,h,0,Math.PI/2,!1),i===jv&&(e.lineTo((r+a)/2,n),e.lineTo(r/2,n+o),e.lineTo((r-a)/2,n)),e.lineTo(d,n),e.arc(d,n-d,d,Math.PI/2,Math.PI,!1),i===Uv&&(e.lineTo(0,(n+o)/2),e.lineTo(-1*a,n/2),e.lineTo(0,(n-o)/2)),e.lineTo(0,u),e.arc(u,u,u,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,r=0,n=this.pointerWidth(),i=this.pointerHeight(),a=this.pointerDirection(),o=this.width(),s=this.height();return a===Bv?(r-=i,s+=i):a===jv?s+=i:a===Uv?(e-=n*1.5,o+=n):a===zv&&(o+=n*1.5),{x:e,y:r,width:o,height:s}}};Mc.prototype.className="Tag";qr(Mc);fe.addGetterSetter(Mc,"pointerDirection",kE);fe.addGetterSetter(Mc,"pointerWidth",0,Qe());fe.addGetterSetter(Mc,"pointerHeight",0,Qe());fe.addGetterSetter(Mc,"cornerRadius",0,p0(4));let Lp=class extends qe{_sceneFunc(e){const r=this.cornerRadius(),n=this.width(),i=this.height();e.beginPath(),r?Pe.drawRoundedRectPath(e,n,i,r):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}};Lp.prototype.className="Rect";qr(Lp);fe.addGetterSetter(Lp,"cornerRadius",0,p0(4));class yu extends qe{_sceneFunc(e){const r=this._getPoints(),n=this.radius(),i=this.sides(),a=this.cornerRadius();if(e.beginPath(),a)Pe.drawRoundedPolygonPath(e,r,i,n,a);else{e.moveTo(r[0].x,r[0].y);for(let o=1;o<r.length;o++)e.lineTo(r[o].x,r[o].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,r=this.attrs.radius||0,n=[];for(let i=0;i<e;i++)n.push({x:r*Math.sin(i*2*Math.PI/e),y:-1*r*Math.cos(i*2*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();let r=e[0].x,n=e[0].x,i=e[0].y,a=e[0].y;return e.forEach(o=>{r=Math.min(r,o.x),n=Math.max(n,o.x),i=Math.min(i,o.y),a=Math.max(a,o.y)}),{x:r,y:i,width:n-r,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}yu.prototype.className="RegularPolygon";yu.prototype._centroid=!0;yu.prototype._attrsAffectingSize=["radius"];qr(yu);fe.addGetterSetter(yu,"radius",0,Qe());fe.addGetterSetter(yu,"sides",0,Qe());fe.addGetterSetter(yu,"cornerRadius",0,p0(4));const Dw=Math.PI*2;class Dc extends qe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Dw,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Dw,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Dc.prototype.className="Ring";Dc.prototype._centroid=!0;Dc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];qr(Dc);fe.addGetterSetter(Dc,"innerRadius",0,Qe());fe.addGetterSetter(Dc,"outerRadius",0,Qe());class Ko extends qe{constructor(e){super(e),this._updated=!0,this.anim=new Td(()=>{const r=this._updated;return this._updated=!1,r}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const r=this.animation(),n=this.frameIndex(),i=n*4,a=this.animations()[r],o=this.frameOffsets(),s=a[i+0],u=a[i+1],f=a[i+2],d=a[i+3],h=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,d),e.closePath(),e.fillStrokeShape(this)),h)if(o){const p=o[r],y=n*2;e.drawImage(h,s,u,f,d,p[y+0],p[y+1],f,d)}else e.drawImage(h,s,u,f,d,0,0,f,d)}_hitFunc(e){const r=this.animation(),n=this.frameIndex(),i=n*4,a=this.animations()[r],o=this.frameOffsets(),s=a[i+2],u=a[i+3];if(e.beginPath(),o){const f=o[r],d=n*2;e.rect(f[d+0],f[d+1],s,u)}else e.rect(0,0,s,u);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),r=this.animation(),n=this.animations(),i=n[r],a=i.length/4;e<a-1?this.frameIndex(e+1):this.frameIndex(0)}}Ko.prototype.className="Sprite";qr(Ko);fe.addGetterSetter(Ko,"animation");fe.addGetterSetter(Ko,"animations");fe.addGetterSetter(Ko,"frameOffsets");fe.addGetterSetter(Ko,"image");fe.addGetterSetter(Ko,"frameIndex",0,Qe());fe.addGetterSetter(Ko,"frameRate",17,Qe());fe.backCompat(Ko,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class vu extends qe{_sceneFunc(e){const r=this.innerRadius(),n=this.outerRadius(),i=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let a=1;a<i*2;a++){const o=a%2===0?n:r,s=o*Math.sin(a*Math.PI/i),u=-1*o*Math.cos(a*Math.PI/i);e.lineTo(s,u)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}vu.prototype.className="Star";vu.prototype._centroid=!0;vu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];qr(vu);fe.addGetterSetter(vu,"numPoints",5,Qe());fe.addGetterSetter(vu,"innerRadius",0,Qe());fe.addGetterSetter(vu,"outerRadius",0,Qe());function Yl(t){return[...t].reduce((e,r,n,i)=>{if(new RegExp("\\p{Emoji}","u").test(r)){const a=i[n+1];a&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(a)?(e.push(r+a),i[n+1]=""):e.push(r)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(r+(i[n+1]||""))?e.push(r+i[n+1]):n>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(r)?e[e.length-1]+=r:r&&e.push(r);return e},[])}const zf="auto",PE="center",x5="inherit",Ah="justify",EE="Change.konva",TE="2d",Nw="-",S5="left",CE="text",OE="Text",AE="top",IE="bottom",Lw="middle",k5="normal",RE="px ",ig=" ",ME="right",Fw="rtl",DE="word",NE="char",Bw="none",O1="…",_5=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],LE=_5.length;function FE(t){return t.split(",").map(e=>{e=e.trim();const r=e.indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return r&&!n&&(e=`"${e}"`),e}).join(", ")}let ag;function A1(){return ag||(ag=Pe.createCanvasElement().getContext(TE),ag)}function BE(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function zE(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function jE(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let Or=class extends qe{constructor(e){super(jE(e)),this._partialTextX=0,this._partialTextY=0;for(let r=0;r<LE;r++)this.on(_5[r]+EE,this._setTextData);this._setTextData()}_sceneFunc(e){var r,n;const i=this.textArr,a=i.length;if(!this.text())return;let o=this.padding(),s=this.fontSize(),u=this.lineHeight()*s,f=this.verticalAlign(),d=this.direction(),h=0,p=this.align(),y=this.getWidth(),v=this.letterSpacing(),b=this.charRenderFunc(),x=this.fill(),k=this.textDecoration(),S=this.underlineOffset(),P=k.indexOf("underline")!==-1,_=k.indexOf("line-through")!==-1,E;d=d===x5?e.direction:d;let A=u/2,T=Lw;if(!et.legacyTextRendering){const I=this.measureSize("M");T="alphabetic";const L=(r=I.fontBoundingBoxAscent)!==null&&r!==void 0?r:I.actualBoundingBoxAscent,R=(n=I.fontBoundingBoxDescent)!==null&&n!==void 0?n:I.actualBoundingBoxDescent;A=(L-R)/2+u/2}for(d===Fw&&e.setAttr("direction",d),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",T),e.setAttr("textAlign",S5),f===Lw?h=(this.getHeight()-a*u-o*2)/2:f===IE&&(h=this.getHeight()-a*u-o*2),e.translate(o,h+o),E=0;E<a;E++){let I=0,L=0;const R=i[E],N=R.text,F=R.width,H=R.lastInParagraph;if(e.save(),p===ME?I+=y-F-o*2:p===PE&&(I+=(y-F-o*2)/2),P){e.save(),e.beginPath();const X=S??(et.legacyTextRendering?Math.round(s/2):Math.round(s/4)),Z=I,K=A+L+X;e.moveTo(Z,K);const q=p===Ah&&!H?y-o*2:F;e.lineTo(Z+Math.round(q),K),e.lineWidth=s/15;const J=this._getLinearGradient();e.strokeStyle=J||x,e.stroke(),e.restore()}const $=I;if(d!==Fw&&(v!==0||p===Ah||b)){const X=N.split(" ").length-1,Z=Yl(N);for(let K=0;K<Z.length;K++){const q=Z[K];if(q===" "&&!H&&p===Ah&&(I+=(y-o*2-F)/X),this._partialTextX=I,this._partialTextY=A+L,this._partialText=q,b){e.save();const U=i.slice(0,E).reduce((W,V)=>W+Yl(V.text).length,0),D=K+U;b({char:q,index:D,x:I,y:A+L,lineIndex:E,column:K,isLastInLine:H,width:this.measureSize(q).width,context:e})}e.fillStrokeShape(this),b&&e.restore(),I+=this.measureSize(q).width+v}}else v!==0&&e.setAttr("letterSpacing",`${v}px`),this._partialTextX=I,this._partialTextY=A+L,this._partialText=N,e.fillStrokeShape(this);if(_){e.save(),e.beginPath();const X=et.legacyTextRendering?0:-Math.round(s/4),Z=$;e.moveTo(Z,A+L+X);const K=p===Ah&&!H?y-o*2:F;e.lineTo(Z+Math.round(K),A+L+X),e.lineWidth=s/15;const q=this._getLinearGradient();e.strokeStyle=q||x,e.stroke(),e.restore()}e.restore(),a>1&&(A+=u)}}_hitFunc(e){const r=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,r,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const r=Pe._isString(e)?e:e==null?"":e+"";return this._setAttr(CE,r),this}getWidth(){return this.attrs.width===zf||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===zf||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Pe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var r,n,i,a,o,s,u,f,d,h,p;let y=A1(),v=this.fontSize(),b;y.save(),y.font=this._getContextFont(),b=y.measureText(e),y.restore();const x=v/100;return{actualBoundingBoxAscent:(r=b.actualBoundingBoxAscent)!==null&&r!==void 0?r:71.58203125*x,actualBoundingBoxDescent:(n=b.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(i=b.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*x,actualBoundingBoxRight:(a=b.actualBoundingBoxRight)!==null&&a!==void 0?a:75.732421875*x,alphabeticBaseline:(o=b.alphabeticBaseline)!==null&&o!==void 0?o:0,emHeightAscent:(s=b.emHeightAscent)!==null&&s!==void 0?s:100*x,emHeightDescent:(u=b.emHeightDescent)!==null&&u!==void 0?u:-20*x,fontBoundingBoxAscent:(f=b.fontBoundingBoxAscent)!==null&&f!==void 0?f:91*x,fontBoundingBoxDescent:(d=b.fontBoundingBoxDescent)!==null&&d!==void 0?d:21*x,hangingBaseline:(h=b.hangingBaseline)!==null&&h!==void 0?h:72.80000305175781*x,ideographicBaseline:(p=b.ideographicBaseline)!==null&&p!==void 0?p:-21*x,width:b.width,height:v}}_getContextFont(){return this.fontStyle()+ig+this.fontVariant()+ig+(this.fontSize()+RE)+FE(this.fontFamily())}_addTextLine(e){this.align()===Ah&&(e=e.trim());const n=this._getTextWidth(e);return this.textArr.push({text:e,width:n,lastInParagraph:!1})}_getTextWidth(e){const r=this.letterSpacing(),n=e.length;return A1().measureText(e).width+r*n}_setTextData(){let e=this.text().split(`
24
+ `),r=+this.fontSize(),n=0,i=this.lineHeight()*r,a=this.attrs.width,o=this.attrs.height,s=a!==zf&&a!==void 0,u=o!==zf&&o!==void 0,f=this.padding(),d=a-f*2,h=o-f*2,p=0,y=this.wrap(),v=y!==Bw,b=y!==NE&&v,x=this.ellipsis();this.textArr=[],A1().font=this._getContextFont();const k=x?this._getTextWidth(O1):0;for(let S=0,P=e.length;S<P;++S){let _=e[S],E=this._getTextWidth(_);if(s&&E>d)for(;_.length>0;){let A=0,T=Yl(_).length,I="",L=0;for(;A<T;){const R=A+T>>>1,N=Yl(_),F=N.slice(0,R+1).join(""),H=this._getTextWidth(F);(x&&u&&p+i>h?H+k:H)<=d?(A=R+1,I=F,L=H):T=R}if(I){if(b){const F=Yl(_),H=Yl(I),$=F[H.length],X=$===ig||$===Nw;let Z;if(X&&L<=d)Z=H.length;else{const K=H.lastIndexOf(ig),q=H.lastIndexOf(Nw);Z=Math.max(K,q)+1}Z>0&&(A=Z,I=F.slice(0,A).join(""),L=this._getTextWidth(I))}if(I=I.trimRight(),this._addTextLine(I),n=Math.max(n,L),p+=i,this._shouldHandleEllipsis(p)){this._tryToAddEllipsisToLastLine();break}if(_=Yl(_).slice(A).join("").trimLeft(),_.length>0&&(E=this._getTextWidth(_),E<=d)){this._addTextLine(_),p+=i,n=Math.max(n,E);break}}else break}else this._addTextLine(_),p+=i,n=Math.max(n,E),this._shouldHandleEllipsis(p)&&S<P-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),u&&p+i>h)break}this.textHeight=r,this.textWidth=n}_shouldHandleEllipsis(e){const r=+this.fontSize(),n=this.lineHeight()*r,i=this.attrs.height,a=i!==zf&&i!==void 0,o=this.padding(),s=i-o*2;return!(this.wrap()!==Bw)||a&&e+n>s}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,r=e!==zf&&e!==void 0,n=this.padding(),i=e-n*2,a=this.ellipsis(),o=this.textArr[this.textArr.length-1];!o||!a||(r&&(this._getTextWidth(o.text+O1)<i||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+O1))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,r=this.hasShadow();return e&&r?!0:super._useBufferCanvas()}};Or.prototype._fillFunc=BE;Or.prototype._strokeFunc=zE;Or.prototype.className=OE;Or.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];qr(Or);fe.overWriteSetter(Or,"width",_2());fe.overWriteSetter(Or,"height",_2());fe.addGetterSetter(Or,"direction",x5);fe.addGetterSetter(Or,"fontFamily","Arial");fe.addGetterSetter(Or,"fontSize",12,Qe());fe.addGetterSetter(Or,"fontStyle",k5);fe.addGetterSetter(Or,"fontVariant",k5);fe.addGetterSetter(Or,"padding",0,Qe());fe.addGetterSetter(Or,"align",S5);fe.addGetterSetter(Or,"verticalAlign",AE);fe.addGetterSetter(Or,"lineHeight",1,Qe());fe.addGetterSetter(Or,"wrap",DE);fe.addGetterSetter(Or,"ellipsis",!1,so());fe.addGetterSetter(Or,"letterSpacing",0,Qe());fe.addGetterSetter(Or,"text","",Ac());fe.addGetterSetter(Or,"textDecoration","");fe.addGetterSetter(Or,"underlineOffset",void 0,Qe());fe.addGetterSetter(Or,"charRenderFunc",void 0);const UE="",P5="normal";function E5(t){t.fillText(this.partialText,0,0)}function T5(t){t.strokeText(this.partialText,0,0)}let Sn=class extends qe{constructor(e){super(e),this.dummyCanvas=Pe.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Oa.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const r=this.pathLength;return e>r?null:Oa.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Oa.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const r=this.textDecoration(),n=this.fill(),i=this.fontSize(),a=this.glyphInfo,o=r.indexOf("underline")!==-1,s=r.indexOf("line-through")!==-1;o&&e.beginPath();for(let u=0;u<a.length;u++){e.save();const f=a[u].p0;e.translate(f.x,f.y),e.rotate(a[u].rotation),this.partialText=a[u].text,e.fillStrokeShape(this),o&&(u===0&&e.moveTo(0,i/2+1),e.lineTo(a[u].width,i/2+1)),e.restore()}if(o&&(e.strokeStyle=n,e.lineWidth=i/20,e.stroke()),s){e.beginPath();for(let u=0;u<a.length;u++){e.save();const f=a[u].p0;e.translate(f.x,f.y),e.rotate(a[u].rotation),u===0&&e.moveTo(0,0),e.lineTo(a[u].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=i/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const r=this.glyphInfo;if(r.length>=1){const n=r[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<r.length;n++){const i=r[n].p1;e.lineTo(i.x,i.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Pe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Or.prototype.setText.call(this,e)}_getContextFont(){return Or.prototype._getContextFont.call(this)}_getTextSize(e){const n=this.dummyCanvas.getContext("2d");n.save(),n.font=this._getContextFont();const i=n.measureText(e);return n.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=Yl(this.text()),r=[];let n=0;for(let h=0;h<e.length;h++)r.push({char:e[h],width:this._getTextSize(e[h]).width}),n+=r[h].width;const{height:i}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=i,this.glyphInfo=[],!this.attrs.data)return null;const a=this.letterSpacing(),o=this.align(),s=this.kerningFunc(),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*a,0);let f=0;o==="center"&&(f=Math.max(0,this.pathLength/2-u/2)),o==="right"&&(f=Math.max(0,this.pathLength-u));let d=f;for(let h=0;h<r.length;h++){const p=this._getPointAtLength(d);if(!p)return;const y=r[h].char;let v=r[h].width+a;if(y===" "&&o==="justify"){const _=this.text().split(" ").length-1;v+=(this.pathLength-u)/_}const b=this._getPointAtLength(d+v);if(!b)return;const x=Oa.getLineLength(p.x,p.y,b.x,b.y);let k=0;if(s)try{k=s(r[h-1].char,y)*this.fontSize()}catch{k=0}p.x+=k,b.x+=k,this.textWidth+=k;const S=Oa.getPointOnLine(k+x/2,p.x,p.y,b.x,b.y),P=Math.atan2(b.y-p.y,b.x-p.x);this.glyphInfo.push({transposeX:S.x,transposeY:S.y,text:e[h],rotation:P,p0:p,p1:b,width:x}),d+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(f){e.push(f.p0.x),e.push(f.p0.y),e.push(f.p1.x),e.push(f.p1.y)});let r=e[0]||0,n=e[0]||0,i=e[1]||0,a=e[1]||0,o,s;for(let f=0;f<e.length/2;f++)o=e[f*2],s=e[f*2+1],r=Math.min(r,o),n=Math.max(n,o),i=Math.min(i,s),a=Math.max(a,s);const u=this.fontSize();return{x:r-u/2,y:i-u/2,width:n-r+u,height:a-i+u}}destroy(){return Pe.releaseCanvas(this.dummyCanvas),super.destroy()}};Sn.prototype._fillFunc=E5;Sn.prototype._strokeFunc=T5;Sn.prototype._fillFuncHit=E5;Sn.prototype._strokeFuncHit=T5;Sn.prototype.className="TextPath";Sn.prototype._attrsAffectingSize=["text","fontSize","data"];qr(Sn);fe.addGetterSetter(Sn,"data");fe.addGetterSetter(Sn,"fontFamily","Arial");fe.addGetterSetter(Sn,"fontSize",12,Qe());fe.addGetterSetter(Sn,"fontStyle",P5);fe.addGetterSetter(Sn,"align","left");fe.addGetterSetter(Sn,"letterSpacing",0,Qe());fe.addGetterSetter(Sn,"textBaseline","middle");fe.addGetterSetter(Sn,"fontVariant",P5);fe.addGetterSetter(Sn,"text",UE);fe.addGetterSetter(Sn,"textDecoration","");fe.addGetterSetter(Sn,"kerningFunc",void 0);const C5="tr-konva",HE=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${C5}`).join(" "),zw="nodesRect",$E=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],qE={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},VE="ontouchstart"in et._global;function WE(t,e,r){if(t==="rotater")return r;e+=Pe.degToRad(qE[t]||0);const n=(Pe.radToDeg(e)%360+360)%360;return Pe._inRange(n,315+22.5,360)||Pe._inRange(n,0,22.5)?"ns-resize":Pe._inRange(n,45-22.5,45+22.5)?"nesw-resize":Pe._inRange(n,90-22.5,90+22.5)?"ew-resize":Pe._inRange(n,135-22.5,135+22.5)?"nwse-resize":Pe._inRange(n,180-22.5,180+22.5)?"ns-resize":Pe._inRange(n,225-22.5,225+22.5)?"nesw-resize":Pe._inRange(n,270-22.5,270+22.5)?"ew-resize":Pe._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Pe.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}const Fg=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function GE(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function O5(t,e,r){const n=r.x+(t.x-r.x)*Math.cos(e)-(t.y-r.y)*Math.sin(e),i=r.y+(t.x-r.x)*Math.sin(e)+(t.y-r.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:n,y:i}}function XE(t,e){const r=GE(t);return O5(t,e,r)}function YE(t,e,r){let n=e;for(let i=0;i<t.length;i++){const a=et.getAngle(t[i]),o=Math.abs(a-e)%(Math.PI*2);Math.min(o,Math.PI*2-o)<r&&(n=a)}return n}let Hv=0,Xt=class extends bd{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(HE,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Pe.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return C5+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const r=e.filter(i=>i.isAncestorOf(this)?(Pe.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=r,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const a=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(i._attrsAffectingSize.length){const o=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(o,a)}i.on($E.map(o=>o+`.${this._getEventNamespace()}`).join(" "),a),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,a),this._proxyDrag(i)}),this._resetTransformCache(),this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let r;e.on(`dragstart.${this._getEventNamespace()}`,n=>{r=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!r)return;const i=e.getAbsolutePosition(),a=i.x-r.x,o=i.y-r.y;this.nodes().forEach(s=>{if(s===e||s.isDragging())return;const u=s.getAbsolutePosition();s.setAbsolutePosition({x:u.x+a,y:u.y+o}),s.startDrag(n)}),r=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(zw),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(zw,this.__getNodeRect)}__getNodeShape(e,r=this.rotation(),n){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),s=i.x*a.x-e.offsetX()*a.x,u=i.y*a.y-e.offsetY()*a.y,f=(et.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),d={x:o.x+s*Math.cos(f)+u*Math.sin(-f),y:o.y+u*Math.cos(f)+s*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return O5(d,-et.getAngle(r),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const r=[];this.nodes().map(f=>{const d=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),h=[{x:d.x,y:d.y},{x:d.x+d.width,y:d.y},{x:d.x+d.width,y:d.y+d.height},{x:d.x,y:d.y+d.height}],p=f.getAbsoluteTransform();h.forEach(function(y){const v=p.point(y);r.push(v)})});const n=new aa;n.rotate(-et.getAngle(this.rotation()));let i=1/0,a=1/0,o=-1/0,s=-1/0;r.forEach(function(f){const d=n.point(f);i===void 0&&(i=o=d.x,a=s=d.y),i=Math.min(i,d.x),a=Math.min(a,d.y),o=Math.max(o,d.x),s=Math.max(s,d.y)}),n.invert();const u=n.point({x:i,y:a});return{x:u.x,y:u.y,width:o-i,height:s-a,rotation:et.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Fg.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const r=new Lp({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:VE?10:"auto"}),n=this;r.on("mousedown touchstart",function(i){n._handleMouseDown(i)}),r.on("dragstart",i=>{r.stopDrag(),i.cancelBubble=!0}),r.on("dragend",i=>{i.cancelBubble=!0}),r.on("mouseenter",()=>{const i=et.getAngle(this.rotation()),a=this.rotateAnchorCursor(),o=WE(e,i,a);r.getStage().content&&(r.getStage().content.style.cursor=o),this._cursorChange=!0}),r.on("mouseout",()=>{r.getStage().content&&(r.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(r)}_createBack(){const e=new qe({name:"back",width:0,height:0,sceneFunc(r,n){const i=n.getParent(),a=i.padding(),o=n.width(),s=n.height();if(r.beginPath(),r.rect(-a,-a,o+a*2,s+a*2),i.rotateEnabled()&&i.rotateLineVisible()){const u=i.rotateAnchorAngle(),f=i.rotateAnchorOffset(),d=Pe.degToRad(u),h=Math.sin(d),p=-Math.cos(d),y=o/2,v=s/2;let b=1/0;p<0?b=Math.min(b,-v/p):p>0&&(b=Math.min(b,(s-v)/p)),h<0?b=Math.min(b,-y/h):h>0&&(b=Math.min(b,(o-y)/h));const x=y+h*b,k=v+p*b,S=Pe._sign(s),P=x+h*f*S,_=k+p*f*S;r.moveTo(x,k),r.lineTo(P,_)}r.fillStrokeShape(n)},hitFunc:(r,n)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();r.beginPath(),r.rect(-i,-i,n.width()+i*2,n.height()+i*2),r.fillStrokeShape(n)}});this.add(e),this._proxyDrag(e),e.on("dragstart",r=>{r.cancelBubble=!0}),e.on("dragmove",r=>{r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),this.on("dragmove",r=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const r=this._getNodeRect(),n=r.width,i=r.height,a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(n/a),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const o=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-o.x,y:s.y-o.y},Hv++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(u=>{u._fire("transformstart",{evt:e.evt,target:u})})}_handleMouseMove(e){let r,n,i;const a=this.findOne("."+this._movingAnchorName),o=a.getStage();o.setPointersPositions(e);const s=o.getPointerPosition();let u={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(u=this.anchorDragBoundFunc()(f,u,e)),a.setAbsolutePosition(u);const d=a.getAbsolutePosition();if(f.x===d.x&&f.y===d.y)return;if(this._movingAnchorName==="rotater"){const S=this._getNodeRect();r=a.x()-S.width/2,n=-a.y()+S.height/2;const P=et.getAngle(this.rotateAnchorAngle());let _=Math.atan2(-n,r)+Math.PI/2-P;S.height<0&&(_-=Math.PI);const A=et.getAngle(this.rotation())+_,T=et.getAngle(this.rotationSnapTolerance()),L=YE(this.rotationSnaps(),A,T)-S.rotation,R=XE(S,L);this._fitNodesInto(R,e);return}const h=this.shiftBehavior();let p;h==="inverted"?p=this.keepRatio()&&!e.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||e.shiftKey;let y=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(p){const S=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(S.x-a.x(),2)+Math.pow(S.y-a.y(),2));const P=this.findOne(".top-left").x()>S.x?-1:1,_=this.findOne(".top-left").y()>S.y?-1:1;r=i*this.cos*P,n=i*this.sin*_,this.findOne(".top-left").x(S.x-r),this.findOne(".top-left").y(S.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(p){const S=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(a.x()-S.x,2)+Math.pow(S.y-a.y(),2));const P=this.findOne(".top-right").x()<S.x?-1:1,_=this.findOne(".top-right").y()>S.y?-1:1;r=i*this.cos*P,n=i*this.sin*_,this.findOne(".top-right").x(S.x+r),this.findOne(".top-right").y(S.y-n)}var v=a.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(p){const S=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(S.x-a.x(),2)+Math.pow(a.y()-S.y,2));const P=S.x<a.x()?-1:1,_=a.y()<S.y?-1:1;r=i*this.cos*P,n=i*this.sin*_,a.x(S.x-r),a.y(S.y+n)}v=a.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(a.y());else if(this._movingAnchorName==="bottom-right"){if(p){const S=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(a.x()-S.x,2)+Math.pow(a.y()-S.y,2));const P=this.findOne(".bottom-right").x()<S.x?-1:1,_=this.findOne(".bottom-right").y()<S.y?-1:1;r=i*this.cos*P,n=i*this.sin*_,this.findOne(".bottom-right").x(S.x+r),this.findOne(".bottom-right").y(S.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(y=this.centeredScaling()||e.altKey,y){const S=this.findOne(".top-left"),P=this.findOne(".bottom-right"),_=S.x(),E=S.y(),A=this.getWidth()-P.x(),T=this.getHeight()-P.y();P.move({x:-_,y:-E}),S.move({x:A,y:T})}const b=this.findOne(".top-left").getAbsolutePosition();r=b.x,n=b.y;const x=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),k=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:r,y:n,width:x,height:k,rotation:et.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var r;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();Hv--,this._fire("transformend",{evt:e,target:n}),(r=this.getLayer())===null||r===void 0||r.batchDraw(),n&&this._nodes.forEach(i=>{var a;i._fire("transformend",{evt:e,target:i}),(a=i.getLayer())===null||a===void 0||a.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,r){const n=this._getNodeRect(),i=1;if(Pe._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(Pe._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=new aa;if(a.rotate(et.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=a.point({x:-this.padding()*2,y:0});e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=a.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=a.point({x:0,y:-this.padding()*2});e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=a.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(n,e);p?e=p:Pe.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,s=new aa;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/o,n.height/o);const u=new aa,f=e.width/o,d=e.height/o;this.flipEnabled()===!1?(u.translate(e.x,e.y),u.rotate(e.rotation),u.translate(e.width<0?e.width:0,e.height<0?e.height:0),u.scale(Math.abs(f),Math.abs(d))):(u.translate(e.x,e.y),u.rotate(e.rotation),u.scale(f,d));const h=u.multiply(s.invert());this._nodes.forEach(p=>{var y;if(!p.getStage())return;const v=p.getParent().getAbsoluteTransform(),b=p.getTransform().copy();b.translate(p.offsetX(),p.offsetY());const x=new aa;x.multiply(v.copy().invert()).multiply(h).multiply(v).multiply(b);const k=x.decompose();p.setAttrs(k),(y=p.getLayer())===null||y===void 0||y.batchDraw()}),this.rotation(Pe._getRotation(e.rotation)),this._nodes.forEach(p=>{this._fire("transform",{evt:r,target:p}),p._fire("transform",{evt:r,target:p})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,r){this.findOne(e).setAttrs(r)}update(){var e;const r=this._getNodeRect();this.rotation(Pe._getRotation(r.rotation));const n=r.width,i=r.height,a=this.enabledAnchors(),o=this.resizeEnabled(),s=this.padding(),u=this.anchorSize(),f=this.find("._anchor");f.forEach(A=>{A.setAttrs({width:u,height:u,offsetX:u/2,offsetY:u/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:u/2+s,offsetY:u/2+s,visible:o&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:u/2+s,visible:o&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:u/2-s,offsetY:u/2+s,visible:o&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:u/2+s,visible:o&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:i/2,offsetX:u/2-s,visible:o&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:u/2+s,offsetY:u/2-s,visible:o&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:i,offsetY:u/2-s,visible:o&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:i,offsetX:u/2-s,offsetY:u/2-s,visible:o&&a.indexOf("bottom-right")>=0});const d=this.rotateAnchorAngle(),h=this.rotateAnchorOffset(),p=Pe.degToRad(d),y=Math.sin(p),v=-Math.cos(p),b=n/2,x=i/2;let k=1/0;v<0?k=Math.min(k,-x/v):v>0&&(k=Math.min(k,(i-x)/v)),y<0?k=Math.min(k,-b/y):y>0&&(k=Math.min(k,(n-b)/y));const S=b+y*k,P=x+v*k,_=Pe._sign(i);this._batchChangeChild(".rotater",{x:S+y*h*_,y:P+v*h*_-s*v,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(A=>A.draggable()),x:0,y:0});const E=this.anchorStyleFunc();E&&f.forEach(A=>{E(A)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),bd.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Je.prototype.toObject.call(this)}clone(e){return Je.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Xt.isTransforming=()=>Hv>0;function KE(t){return t instanceof Array||Pe.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){Fg.indexOf(e)===-1&&Pe.warn("Unknown anchor name: "+e+". Available names are: "+Fg.join(", "))}),t||[]}Xt.prototype.className="Transformer";qr(Xt);fe.addGetterSetter(Xt,"enabledAnchors",Fg,KE);fe.addGetterSetter(Xt,"flipEnabled",!0,so());fe.addGetterSetter(Xt,"resizeEnabled",!0);fe.addGetterSetter(Xt,"anchorSize",10,Qe());fe.addGetterSetter(Xt,"rotateEnabled",!0);fe.addGetterSetter(Xt,"rotateLineVisible",!0);fe.addGetterSetter(Xt,"rotationSnaps",[]);fe.addGetterSetter(Xt,"rotateAnchorOffset",50,Qe());fe.addGetterSetter(Xt,"rotateAnchorAngle",0,Qe());fe.addGetterSetter(Xt,"rotateAnchorCursor","crosshair");fe.addGetterSetter(Xt,"rotationSnapTolerance",5,Qe());fe.addGetterSetter(Xt,"borderEnabled",!0);fe.addGetterSetter(Xt,"anchorStroke","rgb(0, 161, 255)");fe.addGetterSetter(Xt,"anchorStrokeWidth",1,Qe());fe.addGetterSetter(Xt,"anchorFill","white");fe.addGetterSetter(Xt,"anchorCornerRadius",0,Qe());fe.addGetterSetter(Xt,"borderStroke","rgb(0, 161, 255)");fe.addGetterSetter(Xt,"borderStrokeWidth",1,Qe());fe.addGetterSetter(Xt,"borderDash");fe.addGetterSetter(Xt,"keepRatio",!0);fe.addGetterSetter(Xt,"shiftBehavior","default");fe.addGetterSetter(Xt,"centeredScaling",!1);fe.addGetterSetter(Xt,"ignoreStroke",!1);fe.addGetterSetter(Xt,"padding",0,Qe());fe.addGetterSetter(Xt,"nodes");fe.addGetterSetter(Xt,"node");fe.addGetterSetter(Xt,"boundBoxFunc");fe.addGetterSetter(Xt,"anchorDragBoundFunc");fe.addGetterSetter(Xt,"anchorStyleFunc");fe.addGetterSetter(Xt,"shouldOverdrawWholeArea",!1);fe.addGetterSetter(Xt,"useSingleNodeRotation",!0);fe.backCompat(Xt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class Js extends qe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,et.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Js.prototype.className="Wedge";Js.prototype._centroid=!0;Js.prototype._attrsAffectingSize=["radius"];qr(Js);fe.addGetterSetter(Js,"radius",0,Qe());fe.addGetterSetter(Js,"angle",0,Qe());fe.addGetterSetter(Js,"clockwise",!1);fe.backCompat(Js,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function jw(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const QE=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],ZE=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function JE(t,e){const r=t.data,n=t.width,i=t.height;let a,o,s,u,f,d,h,p,y,v,b,x,k,S,P,_,E,A,T,I;const L=e+e+1,R=n-1,N=i-1,F=e+1,H=F*(F+1)/2,$=new jw,X=QE[e],Z=ZE[e];let K=null,q=$,J=null,U=null;for(let D=1;D<L;D++)q=q.next=new jw,D===F&&(K=q);q.next=$,s=o=0;for(let D=0;D<i;D++){x=k=S=P=u=f=d=h=0,p=F*(_=r[o]),y=F*(E=r[o+1]),v=F*(A=r[o+2]),b=F*(T=r[o+3]),u+=H*_,f+=H*E,d+=H*A,h+=H*T,q=$;for(let W=0;W<F;W++)q.r=_,q.g=E,q.b=A,q.a=T,q=q.next;for(let W=1;W<F;W++)a=o+((R<W?R:W)<<2),u+=(q.r=_=r[a])*(I=F-W),f+=(q.g=E=r[a+1])*I,d+=(q.b=A=r[a+2])*I,h+=(q.a=T=r[a+3])*I,x+=_,k+=E,S+=A,P+=T,q=q.next;J=$,U=K;for(let W=0;W<n;W++)r[o+3]=T=h*X>>Z,T!==0?(T=255/T,r[o]=(u*X>>Z)*T,r[o+1]=(f*X>>Z)*T,r[o+2]=(d*X>>Z)*T):r[o]=r[o+1]=r[o+2]=0,u-=p,f-=y,d-=v,h-=b,p-=J.r,y-=J.g,v-=J.b,b-=J.a,a=s+((a=W+e+1)<R?a:R)<<2,x+=J.r=r[a],k+=J.g=r[a+1],S+=J.b=r[a+2],P+=J.a=r[a+3],u+=x,f+=k,d+=S,h+=P,J=J.next,p+=_=U.r,y+=E=U.g,v+=A=U.b,b+=T=U.a,x-=_,k-=E,S-=A,P-=T,U=U.next,o+=4;s+=n}for(let D=0;D<n;D++){k=S=P=x=f=d=h=u=0,o=D<<2,p=F*(_=r[o]),y=F*(E=r[o+1]),v=F*(A=r[o+2]),b=F*(T=r[o+3]),u+=H*_,f+=H*E,d+=H*A,h+=H*T,q=$;for(let V=0;V<F;V++)q.r=_,q.g=E,q.b=A,q.a=T,q=q.next;let W=n;for(let V=1;V<=e;V++)o=W+D<<2,u+=(q.r=_=r[o])*(I=F-V),f+=(q.g=E=r[o+1])*I,d+=(q.b=A=r[o+2])*I,h+=(q.a=T=r[o+3])*I,x+=_,k+=E,S+=A,P+=T,q=q.next,V<N&&(W+=n);o=D,J=$,U=K;for(let V=0;V<i;V++)a=o<<2,r[a+3]=T=h*X>>Z,T>0?(T=255/T,r[a]=(u*X>>Z)*T,r[a+1]=(f*X>>Z)*T,r[a+2]=(d*X>>Z)*T):r[a]=r[a+1]=r[a+2]=0,u-=p,f-=y,d-=v,h-=b,p-=J.r,y-=J.g,v-=J.b,b-=J.a,a=D+((a=V+F)<N?a:N)*n<<2,u+=x+=J.r=r[a],f+=k+=J.g=r[a+1],d+=S+=J.b=r[a+2],h+=P+=J.a=r[a+3],J=J.next,p+=_=U.r,y+=E=U.g,v+=A=U.b,b+=T=U.a,x-=_,k-=E,S-=A,P-=T,U=U.next,o+=n}}const e7=function(e){const r=Math.round(this.blurRadius());r>0&&JE(e,r)};fe.addGetterSetter(Je,"blurRadius",0,Qe(),fe.afterSetFilter);const t7=function(t){const e=this.brightness()*255,r=t.data,n=r.length;for(let i=0;i<n;i+=4)r[i]+=e,r[i+1]+=e,r[i+2]+=e};fe.addGetterSetter(Je,"brightness",0,Qe(),fe.afterSetFilter);const r7=function(t){const e=this.brightness(),r=t.data,n=r.length;for(let i=0;i<n;i+=4)r[i]=Math.min(255,r[i]*e),r[i+1]=Math.min(255,r[i+1]*e),r[i+2]=Math.min(255,r[i+2]*e)},n7=function(t){const e=Math.pow((this.contrast()+100)/100,2),r=t.data,n=r.length;let i=150,a=150,o=150;for(let s=0;s<n;s+=4)i=r[s],a=r[s+1],o=r[s+2],i/=255,i-=.5,i*=e,i+=.5,i*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,o/=255,o-=.5,o*=e,o+=.5,o*=255,i=i<0?0:i>255?255:i,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,r[s]=i,r[s+1]=a,r[s+2]=o};fe.addGetterSetter(Je,"contrast",0,Qe(),fe.afterSetFilter);const i7=function(t){var e,r,n,i,a,o,s,u,f;const d=t.data,h=t.width,p=t.height,y=Math.min(1,Math.max(0,(r=(e=this.embossStrength)===null||e===void 0?void 0:e.call(this))!==null&&r!==void 0?r:.5)),v=Math.min(1,Math.max(0,(i=(n=this.embossWhiteLevel)===null||n===void 0?void 0:n.call(this))!==null&&i!==void 0?i:.5)),x=(s={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(o=(a=this.embossDirection)===null||a===void 0?void 0:a.call(this))!==null&&o!==void 0?o:"top-left"])!==null&&s!==void 0?s:315,k=!!((f=(u=this.embossBlend)===null||u===void 0?void 0:u.call(this))!==null&&f!==void 0&&f),S=y*10,P=v*255,_=x*Math.PI/180,E=Math.cos(_),A=Math.sin(_),T=128/1020*S,I=new Uint8ClampedArray(d),L=new Float32Array(h*p);for(let $=0,X=0;X<d.length;X+=4,$++)L[$]=.2126*I[X]+.7152*I[X+1]+.0722*I[X+2];const R=[-1,0,1,-2,0,2,-1,0,1],N=[-1,-2,-1,0,0,0,1,2,1],F=[-h-1,-h,-h+1,-1,0,1,h-1,h,h+1],H=$=>$<0?0:$>255?255:$;for(let $=1;$<p-1;$++)for(let X=1;X<h-1;X++){const Z=$*h+X;let K=0,q=0;K+=L[Z+F[0]]*R[0],q+=L[Z+F[0]]*N[0],K+=L[Z+F[1]]*R[1],q+=L[Z+F[1]]*N[1],K+=L[Z+F[2]]*R[2],q+=L[Z+F[2]]*N[2],K+=L[Z+F[3]]*R[3],q+=L[Z+F[3]]*N[3],K+=L[Z+F[5]]*R[5],q+=L[Z+F[5]]*N[5],K+=L[Z+F[6]]*R[6],q+=L[Z+F[6]]*N[6],K+=L[Z+F[7]]*R[7],q+=L[Z+F[7]]*N[7],K+=L[Z+F[8]]*R[8],q+=L[Z+F[8]]*N[8];const J=E*K+A*q,U=H(P+J*T),D=Z*4;if(k){const W=U-P;d[D]=H(I[D]+W),d[D+1]=H(I[D+1]+W),d[D+2]=H(I[D+2]+W),d[D+3]=I[D+3]}else d[D]=d[D+1]=d[D+2]=U,d[D+3]=I[D+3]}for(let $=0;$<h;$++){let X=$*4,Z=((p-1)*h+$)*4;d[X]=I[X],d[X+1]=I[X+1],d[X+2]=I[X+2],d[X+3]=I[X+3],d[Z]=I[Z],d[Z+1]=I[Z+1],d[Z+2]=I[Z+2],d[Z+3]=I[Z+3]}for(let $=1;$<p-1;$++){let X=$*h*4,Z=($*h+(h-1))*4;d[X]=I[X],d[X+1]=I[X+1],d[X+2]=I[X+2],d[X+3]=I[X+3],d[Z]=I[Z],d[Z+1]=I[Z+1],d[Z+2]=I[Z+2],d[Z+3]=I[Z+3]}return t};fe.addGetterSetter(Je,"embossStrength",.5,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"embossWhiteLevel",.5,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"embossDirection","top-left",void 0,fe.afterSetFilter);fe.addGetterSetter(Je,"embossBlend",!1,void 0,fe.afterSetFilter);function I1(t,e,r,n,i){const a=r-e,o=i-n;if(a===0)return n+o/2;if(o===0)return n;let s=(t-e)/a;return s=o*s+n,s}const a7=function(t){const e=t.data,r=e.length;let n=e[0],i=n,a,o=e[1],s=o,u,f=e[2],d=f,h;const p=this.enhance();if(p===0)return;for(let P=0;P<r;P+=4)a=e[P+0],a<n?n=a:a>i&&(i=a),u=e[P+1],u<o?o=u:u>s&&(s=u),h=e[P+2],h<f?f=h:h>d&&(d=h);i===n&&(i=255,n=0),s===o&&(s=255,o=0),d===f&&(d=255,f=0);let y,v,b,x,k,S;if(p>0)y=i+p*(255-i),v=n-p*(n-0),b=s+p*(255-s),x=o-p*(o-0),k=d+p*(255-d),S=f-p*(f-0);else{const P=(i+n)*.5;y=i+p*(i-P),v=n+p*(n-P);const _=(s+o)*.5;b=s+p*(s-_),x=o+p*(o-_);const E=(d+f)*.5;k=d+p*(d-E),S=f+p*(f-E)}for(let P=0;P<r;P+=4)e[P+0]=I1(e[P+0],n,i,v,y),e[P+1]=I1(e[P+1],o,s,x,b),e[P+2]=I1(e[P+2],f,d,S,k)};fe.addGetterSetter(Je,"enhance",0,Qe(),fe.afterSetFilter);const o7=function(t){const e=t.data,r=e.length;for(let n=0;n<r;n+=4){const i=.34*e[n]+.5*e[n+1]+.16*e[n+2];e[n]=i,e[n+1]=i,e[n+2]=i}};fe.addGetterSetter(Je,"hue",0,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"saturation",0,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"luminance",0,Qe(),fe.afterSetFilter);const s7=function(t){const e=t.data,r=e.length,n=1,i=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,o=this.luminance()*127,s=n*i*Math.cos(a*Math.PI/180),u=n*i*Math.sin(a*Math.PI/180),f=.299*n+.701*s+.167*u,d=.587*n-.587*s+.33*u,h=.114*n-.114*s-.497*u,p=.299*n-.299*s-.328*u,y=.587*n+.413*s+.035*u,v=.114*n-.114*s+.293*u,b=.299*n-.3*s+1.25*u,x=.587*n-.586*s-1.05*u,k=.114*n+.886*s-.2*u;let S,P,_,E;for(let A=0;A<r;A+=4)S=e[A+0],P=e[A+1],_=e[A+2],E=e[A+3],e[A+0]=f*S+d*P+h*_+o,e[A+1]=p*S+y*P+v*_+o,e[A+2]=b*S+x*P+k*_+o,e[A+3]=E},l7=function(t){const e=t.data,r=e.length,n=Math.pow(2,this.value()),i=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,o=n*i*Math.cos(a*Math.PI/180),s=n*i*Math.sin(a*Math.PI/180),u=.299*n+.701*o+.167*s,f=.587*n-.587*o+.33*s,d=.114*n-.114*o-.497*s,h=.299*n-.299*o-.328*s,p=.587*n+.413*o+.035*s,y=.114*n-.114*o+.293*s,v=.299*n-.3*o+1.25*s,b=.587*n-.586*o-1.05*s,x=.114*n+.886*o-.2*s;for(let k=0;k<r;k+=4){const S=e[k+0],P=e[k+1],_=e[k+2],E=e[k+3];e[k+0]=u*S+f*P+d*_,e[k+1]=h*S+p*P+y*_,e[k+2]=v*S+b*P+x*_,e[k+3]=E}};fe.addGetterSetter(Je,"hue",0,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"saturation",0,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"value",0,Qe(),fe.afterSetFilter);const u7=function(t){const e=t.data,r=e.length;for(let n=0;n<r;n+=4)e[n]=255-e[n],e[n+1]=255-e[n+1],e[n+2]=255-e[n+2]},c7=function(t,e,r){const n=t.data,i=e.data,a=t.width,o=t.height,s=r.polarCenterX||a/2,u=r.polarCenterY||o/2;let f=Math.sqrt(s*s+u*u),d=a-s,h=o-u;const p=Math.sqrt(d*d+h*h);f=p>f?p:f;const y=o,v=a,b=360/v*Math.PI/180;for(let x=0;x<v;x+=1){const k=Math.sin(x*b),S=Math.cos(x*b);for(let P=0;P<y;P+=1){d=Math.floor(s+f*P/y*S),h=Math.floor(u+f*P/y*k);let _=(h*a+d)*4;const E=n[_+0],A=n[_+1],T=n[_+2],I=n[_+3];_=(x+P*a)*4,i[_+0]=E,i[_+1]=A,i[_+2]=T,i[_+3]=I}}},f7=function(t,e,r){const n=t.data,i=e.data,a=t.width,o=t.height,s=r.polarCenterX||a/2,u=r.polarCenterY||o/2;let f=Math.sqrt(s*s+u*u),d=a-s,h=o-u;const p=Math.sqrt(d*d+h*h);f=p>f?p:f;const y=o,v=a,b=0;let x,k;for(d=0;d<a;d+=1)for(h=0;h<o;h+=1){const S=d-s,P=h-u,_=Math.sqrt(S*S+P*P)*y/f;let E=(Math.atan2(P,S)*180/Math.PI+360+b)%360;E=E*v/360,x=Math.floor(E),k=Math.floor(_);let A=(k*a+x)*4;const T=n[A+0],I=n[A+1],L=n[A+2],R=n[A+3];A=(h*a+d)*4,i[A+0]=T,i[A+1]=I,i[A+2]=L,i[A+3]=R}},d7=function(t){const e=t.width,r=t.height;let n,i,a,o,s,u,f,d,h,p,y=Math.round(this.kaleidoscopePower());const v=Math.round(this.kaleidoscopeAngle()),b=Math.floor(e*(v%360)/360);if(y<1)return;const x=Pe.createCanvasElement();x.width=e,x.height=r;const k=x.getContext("2d").getImageData(0,0,e,r);Pe.releaseCanvas(x),c7(t,k,{polarCenterX:e/2,polarCenterY:r/2});let S=e/Math.pow(2,y);for(;S<=8;)S=S*2,y-=1;S=Math.ceil(S);let P=S,_=0,E=P,A=1;for(b+S>e&&(_=P,E=0,A=-1),i=0;i<r;i+=1)for(n=_;n!==E;n+=A)a=Math.round(n+b)%e,h=(e*i+a)*4,s=k.data[h+0],u=k.data[h+1],f=k.data[h+2],d=k.data[h+3],p=(e*i+n)*4,k.data[p+0]=s,k.data[p+1]=u,k.data[p+2]=f,k.data[p+3]=d;for(i=0;i<r;i+=1)for(P=Math.floor(S),o=0;o<y;o+=1){for(n=0;n<P+1;n+=1)h=(e*i+n)*4,s=k.data[h+0],u=k.data[h+1],f=k.data[h+2],d=k.data[h+3],p=(e*i+P*2-n-1)*4,k.data[p+0]=s,k.data[p+1]=u,k.data[p+2]=f,k.data[p+3]=d;P*=2}f7(k,t,{})};fe.addGetterSetter(Je,"kaleidoscopePower",2,Qe(),fe.afterSetFilter);fe.addGetterSetter(Je,"kaleidoscopeAngle",0,Qe(),fe.afterSetFilter);function og(t,e,r){let n=(r*t.width+e)*4;const i=[];return i.push(t.data[n++],t.data[n++],t.data[n++],t.data[n++]),i}function Ih(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}function h7(t){const e=[0,0,0];for(let r=0;r<t.length;r++)e[0]+=t[r][0],e[1]+=t[r][1],e[2]+=t[r][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}function p7(t,e){const r=og(t,0,0),n=og(t,t.width-1,0),i=og(t,0,t.height-1),a=og(t,t.width-1,t.height-1),o=e||10;if(Ih(r,n)<o&&Ih(n,a)<o&&Ih(a,i)<o&&Ih(i,r)<o){const s=h7([n,r,a,i]),u=[];for(let f=0;f<t.width*t.height;f++){const d=Ih(s,[t.data[f*4],t.data[f*4+1],t.data[f*4+2]]);u[f]=d<o?0:255}return u}}function m7(t,e){for(let r=0;r<t.width*t.height;r++)t.data[4*r+3]=e[r]}function g7(t,e,r){const n=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(n.length)),a=Math.floor(i/2),o=[];for(let s=0;s<r;s++)for(let u=0;u<e;u++){const f=s*e+u;let d=0;for(let h=0;h<i;h++)for(let p=0;p<i;p++){const y=s+h-a,v=u+p-a;if(y>=0&&y<r&&v>=0&&v<e){const b=y*e+v,x=n[h*i+p];d+=t[b]*x}}o[f]=d===2040?255:0}return o}function y7(t,e,r){const n=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(n.length)),a=Math.floor(i/2),o=[];for(let s=0;s<r;s++)for(let u=0;u<e;u++){const f=s*e+u;let d=0;for(let h=0;h<i;h++)for(let p=0;p<i;p++){const y=s+h-a,v=u+p-a;if(y>=0&&y<r&&v>=0&&v<e){const b=y*e+v,x=n[h*i+p];d+=t[b]*x}}o[f]=d>=1020?255:0}return o}function v7(t,e,r){const n=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(n.length)),a=Math.floor(i/2),o=[];for(let s=0;s<r;s++)for(let u=0;u<e;u++){const f=s*e+u;let d=0;for(let h=0;h<i;h++)for(let p=0;p<i;p++){const y=s+h-a,v=u+p-a;if(y>=0&&y<r&&v>=0&&v<e){const b=y*e+v,x=n[h*i+p];d+=t[b]*x}}o[f]=d}return o}const b7=function(t){const e=this.threshold();let r=p7(t,e);return r&&(r=g7(r,t.width,t.height),r=y7(r,t.width,t.height),r=v7(r,t.width,t.height),m7(t,r)),t};fe.addGetterSetter(Je,"threshold",0,Qe(),fe.afterSetFilter);const w7=function(t){const e=this.noise()*255,r=t.data,n=r.length,i=e/2;for(let a=0;a<n;a+=4)r[a+0]+=i-2*i*Math.random(),r[a+1]+=i-2*i*Math.random(),r[a+2]+=i-2*i*Math.random()};fe.addGetterSetter(Je,"noise",.2,Qe(),fe.afterSetFilter);const x7=function(t){let e=Math.ceil(this.pixelSize()),r=t.width,n=t.height,i=Math.ceil(r/e),a=Math.ceil(n/e),o=t.data;if(e<=0){Pe.error("pixelSize value can not be <= 0");return}for(let s=0;s<i;s+=1)for(let u=0;u<a;u+=1){let f=0,d=0,h=0,p=0;const y=s*e,v=y+e,b=u*e,x=b+e;let k=0;for(let S=y;S<v;S+=1)if(!(S>=r))for(let P=b;P<x;P+=1){if(P>=n)continue;const _=(r*P+S)*4;f+=o[_+0],d+=o[_+1],h+=o[_+2],p+=o[_+3],k+=1}f=f/k,d=d/k,h=h/k,p=p/k;for(let S=y;S<v;S+=1)if(!(S>=r))for(let P=b;P<x;P+=1){if(P>=n)continue;const _=(r*P+S)*4;o[_+0]=f,o[_+1]=d,o[_+2]=h,o[_+3]=p}}};fe.addGetterSetter(Je,"pixelSize",8,Qe(),fe.afterSetFilter);const S7=function(t){const e=Math.round(this.levels()*254)+1,r=t.data,n=r.length,i=255/e;for(let a=0;a<n;a+=1)r[a]=Math.floor(r[a]/i)*i};fe.addGetterSetter(Je,"levels",.5,Qe(),fe.afterSetFilter);const k7=function(t){const e=t.data,r=e.length,n=this.red(),i=this.green(),a=this.blue();for(let o=0;o<r;o+=4){const s=(.34*e[o]+.5*e[o+1]+.16*e[o+2])/255;e[o]=s*n,e[o+1]=s*i,e[o+2]=s*a,e[o+3]=e[o+3]}};fe.addGetterSetter(Je,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});fe.addGetterSetter(Je,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});fe.addGetterSetter(Je,"blue",0,ZS,fe.afterSetFilter);const _7=function(t){const e=t.data,r=e.length,n=this.red(),i=this.green(),a=this.blue(),o=this.alpha();for(let s=0;s<r;s+=4){const u=1-o;e[s]=n*o+e[s]*u,e[s+1]=i*o+e[s+1]*u,e[s+2]=a*o+e[s+2]*u}};fe.addGetterSetter(Je,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});fe.addGetterSetter(Je,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});fe.addGetterSetter(Je,"blue",0,ZS,fe.afterSetFilter);fe.addGetterSetter(Je,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const P7=function(t){const e=t.data,r=e.length;for(let n=0;n<r;n+=4){const i=e[n+0],a=e[n+1],o=e[n+2];e[n+0]=Math.min(255,i*.393+a*.769+o*.189),e[n+1]=Math.min(255,i*.349+a*.686+o*.168),e[n+2]=Math.min(255,i*.272+a*.534+o*.131)}},E7=function(t){const r=t.data;for(let n=0;n<r.length;n+=4){const i=r[n],a=r[n+1],o=r[n+2];.2126*i+.7152*a+.0722*o>=128&&(r[n]=255-i,r[n+1]=255-a,r[n+2]=255-o)}return t},T7=function(t){const e=this.threshold()*255,r=t.data,n=r.length;for(let i=0;i<n;i+=1)r[i]=r[i]<e?0:255};fe.addGetterSetter(Je,"threshold",.5,Qe(),fe.afterSetFilter);const _t=kc.Util._assign(kc,{Arc:Qs,Arrow:Rc,Circle:Cd,Ellipse:gu,Image:lo,Label:T2,Tag:Mc,Line:Zs,Path:Oa,Rect:Lp,RegularPolygon:yu,Ring:Dc,Sprite:Ko,Star:vu,Text:Or,TextPath:Sn,Transformer:Xt,Wedge:Js,Filters:{Blur:e7,Brightness:r7,Brighten:t7,Contrast:n7,Emboss:i7,Enhance:a7,Grayscale:o7,HSL:s7,HSV:l7,Invert:u7,Kaleidoscope:d7,Mask:b7,Noise:w7,Pixelate:x7,Posterize:S7,RGB:k7,RGBA:_7,Sepia:P7,Solarize:E7,Threshold:T7}});var R1={exports:{}};var M1,Uw;function C7(){return Uw||(Uw=1,M1=function(e){var r={},n=Ap(),i=f2(),a=Object.assign;function o(m){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+m,C=1;C<arguments.length;C++)g+="&args[]="+encodeURIComponent(arguments[C]);return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),f=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),v=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),E=Symbol.iterator;function A(m){return m===null||typeof m!="object"?null:(m=E&&m[E]||m["@@iterator"],typeof m=="function"?m:null)}function T(m){if(m==null)return null;if(typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case d:return"Fragment";case f:return"Portal";case p:return"Profiler";case h:return"StrictMode";case x:return"Suspense";case k:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case v:return(m.displayName||"Context")+".Consumer";case y:return(m._context.displayName||"Context")+".Provider";case b:var g=m.render;return m=m.displayName,m||(m=g.displayName||g.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case S:return g=m.displayName||null,g!==null?g:T(m.type)||"Memo";case P:g=m._payload,m=m._init;try{return T(m(g))}catch{}}return null}function I(m){var g=m.type;switch(m.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return m=g.render,m=m.displayName||m.name||"",g.displayName||(m!==""?"ForwardRef("+m+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return T(g);case 8:return g===h?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function L(m){var g=m,C=m;if(m.alternate)for(;g.return;)g=g.return;else{m=g;do g=m,(g.flags&4098)!==0&&(C=g.return),m=g.return;while(m)}return g.tag===3?C:null}function R(m){if(L(m)!==m)throw Error(o(188))}function N(m){var g=m.alternate;if(!g){if(g=L(m),g===null)throw Error(o(188));return g!==m?null:m}for(var C=m,M=g;;){var z=C.return;if(z===null)break;var G=z.alternate;if(G===null){if(M=z.return,M!==null){C=M;continue}break}if(z.child===G.child){for(G=z.child;G;){if(G===C)return R(z),m;if(G===M)return R(z),g;G=G.sibling}throw Error(o(188))}if(C.return!==M.return)C=z,M=G;else{for(var ie=!1,Se=z.child;Se;){if(Se===C){ie=!0,C=z,M=G;break}if(Se===M){ie=!0,M=z,C=G;break}Se=Se.sibling}if(!ie){for(Se=G.child;Se;){if(Se===C){ie=!0,C=G,M=z;break}if(Se===M){ie=!0,M=G,C=z;break}Se=Se.sibling}if(!ie)throw Error(o(189))}}if(C.alternate!==M)throw Error(o(190))}if(C.tag!==3)throw Error(o(188));return C.stateNode.current===C?m:g}function F(m){return m=N(m),m!==null?H(m):null}function H(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){var g=H(m);if(g!==null)return g;m=m.sibling}return null}function $(m){if(m.tag===5||m.tag===6)return m;for(m=m.child;m!==null;){if(m.tag!==4){var g=$(m);if(g!==null)return g}m=m.sibling}return null}var X=Array.isArray,Z=e.getPublicInstance,K=e.getRootHostContext,q=e.getChildHostContext,J=e.prepareForCommit,U=e.resetAfterCommit,D=e.createInstance,W=e.appendInitialChild,V=e.finalizeInitialChildren,ee=e.prepareUpdate,te=e.shouldSetTextContent,Q=e.createTextInstance,ne=e.scheduleTimeout,ue=e.cancelTimeout,oe=e.noTimeout,de=e.isPrimaryRenderer,Ee=e.supportsMutation,Fe=e.supportsPersistence,Le=e.supportsHydration,$e=e.getInstanceFromNode,Xe=e.preparePortalMount,dt=e.getCurrentEventPriority,ke=e.detachDeletedInstance,ge=e.supportsMicrotasks,se=e.scheduleMicrotask,me=e.supportsTestSelectors,Te=e.findFiberRoot,ae=e.getBoundingRect,xe=e.getTextContent,Oe=e.isHiddenSubtree,Be=e.matchAccessibilityRole,ct=e.setFocusIfFocusable,be=e.setupIntersectionObserver,he=e.appendChild,Ve=e.appendChildToContainer,le=e.commitTextUpdate,Ie=e.commitMount,Ye=e.commitUpdate,at=e.insertBefore,Ze=e.insertInContainerBefore,ht=e.removeChild,ve=e.removeChildFromContainer,Ce=e.resetTextContent,Pt=e.hideInstance,Ot=e.hideTextInstance,Et=e.unhideInstance,pt=e.unhideTextInstance,Bt=e.clearContainer,Br=e.cloneInstance,Yt=e.createContainerChildSet,dr=e.appendChildToContainerChildSet,on=e.finalizeContainerChildren,Vr=e.replaceContainerChildren,yr=e.cloneHiddenInstance,Hi=e.cloneHiddenTextInstance,Rn=e.canHydrateInstance,Da=e.canHydrateTextInstance,ai=e.canHydrateSuspenseInstance,ca=e.isSuspenseInstancePending,Wn=e.isSuspenseInstanceFallback,oi=e.getSuspenseInstanceFallbackErrorDetails,$i=e.registerSuspenseInstanceRetry,si=e.getNextHydratableSibling,nl=e.getFirstHydratableChild,Na=e.getFirstHydratableChildWithinContainer,Qo=e.getFirstHydratableChildWithinSuspenseInstance,Gn=e.hydrateInstance,Zo=e.hydrateTextInstance,li=e.hydrateSuspenseInstance,co=e.getNextHydratableInstanceAfterSuspenseInstance,_i=e.commitHydratedContainer,La=e.commitHydratedSuspenseInstance,Fc=e.clearSuspenseBoundary,_u=e.clearSuspenseBoundaryFromContainer,M0=e.shouldDeleteUnhydratedTailInstances,D0=e.didNotMatchHydratedContainerTextInstance,zr=e.didNotMatchHydratedTextInstance,Dd;function Jo(m){if(Dd===void 0)try{throw Error()}catch(C){var g=C.stack.trim().match(/\n( *(at )?)/);Dd=g&&g[1]||""}return`
25
+ `+Dd+m}var Bc=!1;function il(m,g){if(!m||Bc)return"";Bc=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(g)if(g=function(){throw Error()},Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(Ge){var M=Ge}Reflect.construct(m,[],g)}else{try{g.call()}catch(Ge){M=Ge}m.call(g.prototype)}else{try{throw Error()}catch(Ge){M=Ge}m()}}catch(Ge){if(Ge&&M&&typeof Ge.stack=="string"){for(var z=Ge.stack.split(`
26
+ `),G=M.stack.split(`
27
+ `),ie=z.length-1,Se=G.length-1;1<=ie&&0<=Se&&z[ie]!==G[Se];)Se--;for(;1<=ie&&0<=Se;ie--,Se--)if(z[ie]!==G[Se]){if(ie!==1||Se!==1)do if(ie--,Se--,0>Se||z[ie]!==G[Se]){var Ne=`
28
+ `+z[ie].replace(" at new "," at ");return m.displayName&&Ne.includes("<anonymous>")&&(Ne=Ne.replace("<anonymous>",m.displayName)),Ne}while(1<=ie&&0<=Se);break}}}finally{Bc=!1,Error.prepareStackTrace=C}return(m=m?m.displayName||m.name:"")?Jo(m):""}var N0=Object.prototype.hasOwnProperty,zc=[],Fa=-1;function hn(m){return{current:m}}function vr(m){0>Fa||(m.current=zc[Fa],zc[Fa]=null,Fa--)}function jt(m,g){Fa++,zc[Fa]=m.current,m.current=g}var fo={},kn=hn(fo),Xn=hn(!1),fa=fo;function Ba(m,g){var C=m.type.contextTypes;if(!C)return fo;var M=m.stateNode;if(M&&M.__reactInternalMemoizedUnmaskedChildContext===g)return M.__reactInternalMemoizedMaskedChildContext;var z={},G;for(G in C)z[G]=g[G];return M&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=g,m.__reactInternalMemoizedMaskedChildContext=z),z}function sn(m){return m=m.childContextTypes,m!=null}function es(){vr(Xn),vr(kn)}function Vp(m,g,C){if(kn.current!==fo)throw Error(o(168));jt(kn,g),jt(Xn,C)}function Wp(m,g,C){var M=m.stateNode;if(g=g.childContextTypes,typeof M.getChildContext!="function")return C;M=M.getChildContext();for(var z in M)if(!(z in g))throw Error(o(108,I(m)||"Unknown",z));return a({},C,M)}function al(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||fo,fa=kn.current,jt(kn,m),jt(Xn,Xn.current),!0}function Nd(m,g,C){var M=m.stateNode;if(!M)throw Error(o(169));C?(m=Wp(m,g,fa),M.__reactInternalMemoizedMergedChildContext=m,vr(Xn),vr(kn),jt(kn,m)):vr(Xn),jt(Xn,C)}var ui=Math.clz32?Math.clz32:Ld,Pu=Math.log,L0=Math.LN2;function Ld(m){return m>>>=0,m===0?32:31-(Pu(m)/L0|0)|0}var Kt=64,Eu=4194304;function ol(m){switch(m&-m){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: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 m&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return m&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return m}}function sl(m,g){var C=m.pendingLanes;if(C===0)return 0;var M=0,z=m.suspendedLanes,G=m.pingedLanes,ie=C&268435455;if(ie!==0){var Se=ie&~z;Se!==0?M=ol(Se):(G&=ie,G!==0&&(M=ol(G)))}else ie=C&~z,ie!==0?M=ol(ie):G!==0&&(M=ol(G));if(M===0)return 0;if(g!==0&&g!==M&&(g&z)===0&&(z=M&-M,G=g&-g,z>=G||z===16&&(G&4194240)!==0))return g;if((M&4)!==0&&(M|=C&16),g=m.entangledLanes,g!==0)for(m=m.entanglements,g&=M;0<g;)C=31-ui(g),z=1<<C,M|=m[C],g&=~z;return M}function Gp(m,g){switch(m){case 1:case 2:case 4:return g+250;case 8: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 g+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xp(m,g){for(var C=m.suspendedLanes,M=m.pingedLanes,z=m.expirationTimes,G=m.pendingLanes;0<G;){var ie=31-ui(G),Se=1<<ie,Ne=z[ie];Ne===-1?((Se&C)===0||(Se&M)!==0)&&(z[ie]=Gp(Se,g)):Ne<=g&&(m.expiredLanes|=Se),G&=~Se}}function jc(m){return m=m.pendingLanes&-1073741825,m!==0?m:m&1073741824?1073741824:0}function Uc(){var m=Kt;return Kt<<=1,(Kt&4194240)===0&&(Kt=64),m}function ll(m){for(var g=[],C=0;31>C;C++)g.push(m);return g}function Pi(m,g,C){m.pendingLanes|=g,g!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,g=31-ui(g),m[g]=C}function ho(m,g){var C=m.pendingLanes&~g;m.pendingLanes=g,m.suspendedLanes=0,m.pingedLanes=0,m.expiredLanes&=g,m.mutableReadLanes&=g,m.entangledLanes&=g,g=m.entanglements;var M=m.eventTimes;for(m=m.expirationTimes;0<C;){var z=31-ui(C),G=1<<z;g[z]=0,M[z]=-1,m[z]=-1,C&=~G}}function da(m,g){var C=m.entangledLanes|=g;for(m=m.entanglements;C;){var M=31-ui(C),z=1<<M;z&g|m[M]&g&&(m[M]|=g),C&=~z}}var Ut=0;function ul(m){return m&=-m,1<m?4<m?(m&268435455)!==0?16:536870912:4:1}var ha=i.unstable_scheduleCallback,Yp=i.unstable_cancelCallback,Kp=i.unstable_shouldYield,Tu=i.unstable_requestPaint,ln=i.unstable_now,Hc=i.unstable_ImmediatePriority,$c=i.unstable_UserBlockingPriority,qc=i.unstable_NormalPriority,F0=i.unstable_IdlePriority,po=null,Yn=null;function cl(m){if(Yn&&typeof Yn.onCommitFiberRoot=="function")try{Yn.onCommitFiberRoot(po,m,void 0,(m.current.flags&128)===128)}catch{}}function Vc(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var qi=typeof Object.is=="function"?Object.is:Vc,za=null,fl=!1,dl=!1;function Wc(m){za===null?za=[m]:za.push(m)}function Qp(m){fl=!0,Wc(m)}function pn(){if(!dl&&za!==null){dl=!0;var m=0,g=Ut;try{var C=za;for(Ut=1;m<C.length;m++){var M=C[m];do M=M(!0);while(M!==null)}za=null,fl=!1}catch(z){throw za!==null&&(za=za.slice(m+1)),ha(Hc,pn),z}finally{Ut=g,dl=!1}}return null}var mo=[],ja=0,Cu=null,ts=0,Mn=[],ci=0,Kr=null,Kn=1,Vi="";function Wi(m,g){mo[ja++]=ts,mo[ja++]=Cu,Cu=m,ts=g}function Zp(m,g,C){Mn[ci++]=Kn,Mn[ci++]=Vi,Mn[ci++]=Kr,Kr=m;var M=Kn;m=Vi;var z=32-ui(M)-1;M&=~(1<<z),C+=1;var G=32-ui(g)+z;if(30<G){var ie=z-z%5;G=(M&(1<<ie)-1).toString(32),M>>=ie,z-=ie,Kn=1<<32-ui(g)+z|C<<z|M,Vi=G+m}else Kn=1<<G|C<<z|M,Vi=m}function Ou(m){m.return!==null&&(Wi(m,1),Zp(m,1,0))}function Au(m){for(;m===Cu;)Cu=mo[--ja],mo[ja]=null,ts=mo[--ja],mo[ja]=null;for(;m===Kr;)Kr=Mn[--ci],Mn[ci]=null,Vi=Mn[--ci],Mn[ci]=null,Kn=Mn[--ci],Mn[ci]=null}var mn=null,Dn=null,br=!1,Iu=!1,Gi=null;function Jp(m,g){var C=wi(5,null,null,0);C.elementType="DELETED",C.stateNode=g,C.return=m,g=m.deletions,g===null?(m.deletions=[C],m.flags|=16):g.push(C)}function Gc(m,g){switch(m.tag){case 5:return g=Rn(g,m.type,m.pendingProps),g!==null?(m.stateNode=g,mn=m,Dn=nl(g),!0):!1;case 6:return g=Da(g,m.pendingProps),g!==null?(m.stateNode=g,mn=m,Dn=null,!0):!1;case 13:if(g=ai(g),g!==null){var C=Kr!==null?{id:Kn,overflow:Vi}:null;return m.memoizedState={dehydrated:g,treeContext:C,retryLane:1073741824},C=wi(18,null,null,0),C.stateNode=g,C.return=m,m.child=C,mn=m,Dn=null,!0}return!1;default:return!1}}function Fd(m){return(m.mode&1)!==0&&(m.flags&128)===0}function Bd(m){if(br){var g=Dn;if(g){var C=g;if(!Gc(m,g)){if(Fd(m))throw Error(o(418));g=si(C);var M=mn;g&&Gc(m,g)?Jp(M,C):(m.flags=m.flags&-4097|2,br=!1,mn=m)}}else{if(Fd(m))throw Error(o(418));m.flags=m.flags&-4097|2,br=!1,mn=m}}}function em(m){for(m=m.return;m!==null&&m.tag!==5&&m.tag!==3&&m.tag!==13;)m=m.return;mn=m}function Xc(m){if(!Le||m!==mn)return!1;if(!br)return em(m),br=!0,!1;if(m.tag!==3&&(m.tag!==5||M0(m.type)&&!te(m.type,m.memoizedProps))){var g=Dn;if(g){if(Fd(m))throw tm(),Error(o(418));for(;g;)Jp(m,g),g=si(g)}}if(em(m),m.tag===13){if(!Le)throw Error(o(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));Dn=co(m)}else Dn=mn?si(m.stateNode):null;return!0}function tm(){for(var m=Dn;m;)m=si(m)}function rs(){Le&&(Dn=mn=null,Iu=br=!1)}function zd(m){Gi===null?Gi=[m]:Gi.push(m)}var B0=s.ReactCurrentBatchConfig;function Yc(m,g){if(qi(m,g))return!0;if(typeof m!="object"||m===null||typeof g!="object"||g===null)return!1;var C=Object.keys(m),M=Object.keys(g);if(C.length!==M.length)return!1;for(M=0;M<C.length;M++){var z=C[M];if(!N0.call(g,z)||!qi(m[z],g[z]))return!1}return!0}function z0(m){switch(m.tag){case 5:return Jo(m.type);case 16:return Jo("Lazy");case 13:return Jo("Suspense");case 19:return Jo("SuspenseList");case 0:case 2:case 15:return m=il(m.type,!1),m;case 11:return m=il(m.type.render,!1),m;case 1:return m=il(m.type,!0),m;default:return""}}function ns(m,g,C){if(m=C.ref,m!==null&&typeof m!="function"&&typeof m!="object"){if(C._owner){if(C=C._owner,C){if(C.tag!==1)throw Error(o(309));var M=C.stateNode}if(!M)throw Error(o(147,m));var z=M,G=""+m;return g!==null&&g.ref!==null&&typeof g.ref=="function"&&g.ref._stringRef===G?g.ref:(g=function(ie){var Se=z.refs;ie===null?delete Se[G]:Se[G]=ie},g._stringRef=G,g)}if(typeof m!="string")throw Error(o(284));if(!C._owner)throw Error(o(290,m))}return m}function Kc(m,g){throw m=Object.prototype.toString.call(g),Error(o(31,m==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":m))}function rm(m){var g=m._init;return g(m._payload)}function nm(m){function g(Me,_e){if(m){var ze=Me.deletions;ze===null?(Me.deletions=[_e],Me.flags|=16):ze.push(_e)}}function C(Me,_e){if(!m)return null;for(;_e!==null;)g(Me,_e),_e=_e.sibling;return null}function M(Me,_e){for(Me=new Map;_e!==null;)_e.key!==null?Me.set(_e.key,_e):Me.set(_e.index,_e),_e=_e.sibling;return Me}function z(Me,_e){return Me=Mo(Me,_e),Me.index=0,Me.sibling=null,Me}function G(Me,_e,ze){return Me.index=ze,m?(ze=Me.alternate,ze!==null?(ze=ze.index,ze<_e?(Me.flags|=2,_e):ze):(Me.flags|=2,_e)):(Me.flags|=1048576,_e)}function ie(Me){return m&&Me.alternate===null&&(Me.flags|=2),Me}function Se(Me,_e,ze,st){return _e===null||_e.tag!==6?(_e=Fl(ze,Me.mode,st),_e.return=Me,_e):(_e=z(_e,ze),_e.return=Me,_e)}function Ne(Me,_e,ze,st){var St=ze.type;return St===d?mt(Me,_e,ze.props.children,st,ze.key):_e!==null&&(_e.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===P&&rm(St)===_e.type)?(st=z(_e,ze.props),st.ref=ns(Me,_e,ze),st.return=Me,st):(st=Of(ze.type,ze.key,ze.props,null,Me.mode,st),st.ref=ns(Me,_e,ze),st.return=Me,st)}function Ge(Me,_e,ze,st){return _e===null||_e.tag!==4||_e.stateNode.containerInfo!==ze.containerInfo||_e.stateNode.implementation!==ze.implementation?(_e=Af(ze,Me.mode,st),_e.return=Me,_e):(_e=z(_e,ze.children||[]),_e.return=Me,_e)}function mt(Me,_e,ze,st,St){return _e===null||_e.tag!==7?(_e=vn(ze,Me.mode,st,St),_e.return=Me,_e):(_e=z(_e,ze),_e.return=Me,_e)}function Mt(Me,_e,ze){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return _e=Fl(""+_e,Me.mode,ze),_e.return=Me,_e;if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case u:return ze=Of(_e.type,_e.key,_e.props,null,Me.mode,ze),ze.ref=ns(Me,null,_e),ze.return=Me,ze;case f:return _e=Af(_e,Me.mode,ze),_e.return=Me,_e;case P:var st=_e._init;return Mt(Me,st(_e._payload),ze)}if(X(_e)||A(_e))return _e=vn(_e,Me.mode,ze,null),_e.return=Me,_e;Kc(Me,_e)}return null}function ot(Me,_e,ze,st){var St=_e!==null?_e.key:null;if(typeof ze=="string"&&ze!==""||typeof ze=="number")return St!==null?null:Se(Me,_e,""+ze,st);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case u:return ze.key===St?Ne(Me,_e,ze,st):null;case f:return ze.key===St?Ge(Me,_e,ze,st):null;case P:return St=ze._init,ot(Me,_e,St(ze._payload),st)}if(X(ze)||A(ze))return St!==null?null:mt(Me,_e,ze,st,null);Kc(Me,ze)}return null}function gr(Me,_e,ze,st,St){if(typeof st=="string"&&st!==""||typeof st=="number")return Me=Me.get(ze)||null,Se(_e,Me,""+st,St);if(typeof st=="object"&&st!==null){switch(st.$$typeof){case u:return Me=Me.get(st.key===null?ze:st.key)||null,Ne(_e,Me,st,St);case f:return Me=Me.get(st.key===null?ze:st.key)||null,Ge(_e,Me,st,St);case P:var Lt=st._init;return gr(Me,_e,ze,Lt(st._payload),St)}if(X(st)||A(st))return Me=Me.get(ze)||null,mt(_e,Me,st,St,null);Kc(_e,st)}return null}function nr(Me,_e,ze,st){for(var St=null,Lt=null,Dt=_e,Wt=_e=0,tn=null;Dt!==null&&Wt<ze.length;Wt++){Dt.index>Wt?(tn=Dt,Dt=null):tn=Dt.sibling;var qt=ot(Me,Dt,ze[Wt],st);if(qt===null){Dt===null&&(Dt=tn);break}m&&Dt&&qt.alternate===null&&g(Me,Dt),_e=G(qt,_e,Wt),Lt===null?St=qt:Lt.sibling=qt,Lt=qt,Dt=tn}if(Wt===ze.length)return C(Me,Dt),br&&Wi(Me,Wt),St;if(Dt===null){for(;Wt<ze.length;Wt++)Dt=Mt(Me,ze[Wt],st),Dt!==null&&(_e=G(Dt,_e,Wt),Lt===null?St=Dt:Lt.sibling=Dt,Lt=Dt);return br&&Wi(Me,Wt),St}for(Dt=M(Me,Dt);Wt<ze.length;Wt++)tn=gr(Dt,Me,Wt,ze[Wt],st),tn!==null&&(m&&tn.alternate!==null&&Dt.delete(tn.key===null?Wt:tn.key),_e=G(tn,_e,Wt),Lt===null?St=tn:Lt.sibling=tn,Lt=tn);return m&&Dt.forEach(function(On){return g(Me,On)}),br&&Wi(Me,Wt),St}function jn(Me,_e,ze,st){var St=A(ze);if(typeof St!="function")throw Error(o(150));if(ze=St.call(ze),ze==null)throw Error(o(151));for(var Lt=St=null,Dt=_e,Wt=_e=0,tn=null,qt=ze.next();Dt!==null&&!qt.done;Wt++,qt=ze.next()){Dt.index>Wt?(tn=Dt,Dt=null):tn=Dt.sibling;var On=ot(Me,Dt,qt.value,st);if(On===null){Dt===null&&(Dt=tn);break}m&&Dt&&On.alternate===null&&g(Me,Dt),_e=G(On,_e,Wt),Lt===null?St=On:Lt.sibling=On,Lt=On,Dt=tn}if(qt.done)return C(Me,Dt),br&&Wi(Me,Wt),St;if(Dt===null){for(;!qt.done;Wt++,qt=ze.next())qt=Mt(Me,qt.value,st),qt!==null&&(_e=G(qt,_e,Wt),Lt===null?St=qt:Lt.sibling=qt,Lt=qt);return br&&Wi(Me,Wt),St}for(Dt=M(Me,Dt);!qt.done;Wt++,qt=ze.next())qt=gr(Dt,Me,Wt,qt.value,st),qt!==null&&(m&&qt.alternate!==null&&Dt.delete(qt.key===null?Wt:qt.key),_e=G(qt,_e,Wt),Lt===null?St=qt:Lt.sibling=qt,Lt=qt);return m&&Dt.forEach(function(q0){return g(Me,q0)}),br&&Wi(Me,Wt),St}function Sa(Me,_e,ze,st){if(typeof ze=="object"&&ze!==null&&ze.type===d&&ze.key===null&&(ze=ze.props.children),typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case u:e:{for(var St=ze.key,Lt=_e;Lt!==null;){if(Lt.key===St){if(St=ze.type,St===d){if(Lt.tag===7){C(Me,Lt.sibling),_e=z(Lt,ze.props.children),_e.return=Me,Me=_e;break e}}else if(Lt.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===P&&rm(St)===Lt.type){C(Me,Lt.sibling),_e=z(Lt,ze.props),_e.ref=ns(Me,Lt,ze),_e.return=Me,Me=_e;break e}C(Me,Lt);break}else g(Me,Lt);Lt=Lt.sibling}ze.type===d?(_e=vn(ze.props.children,Me.mode,st,ze.key),_e.return=Me,Me=_e):(st=Of(ze.type,ze.key,ze.props,null,Me.mode,st),st.ref=ns(Me,_e,ze),st.return=Me,Me=st)}return ie(Me);case f:e:{for(Lt=ze.key;_e!==null;){if(_e.key===Lt)if(_e.tag===4&&_e.stateNode.containerInfo===ze.containerInfo&&_e.stateNode.implementation===ze.implementation){C(Me,_e.sibling),_e=z(_e,ze.children||[]),_e.return=Me,Me=_e;break e}else{C(Me,_e);break}else g(Me,_e);_e=_e.sibling}_e=Af(ze,Me.mode,st),_e.return=Me,Me=_e}return ie(Me);case P:return Lt=ze._init,Sa(Me,_e,Lt(ze._payload),st)}if(X(ze))return nr(Me,_e,ze,st);if(A(ze))return jn(Me,_e,ze,st);Kc(Me,ze)}return typeof ze=="string"&&ze!==""||typeof ze=="number"?(ze=""+ze,_e!==null&&_e.tag===6?(C(Me,_e.sibling),_e=z(_e,ze),_e.return=Me,Me=_e):(C(Me,_e),_e=Fl(ze,Me.mode,st),_e.return=Me,Me=_e),ie(Me)):C(Me,_e)}return Sa}var is=nm(!0),im=nm(!1),Qc=hn(null),Zc=null,hl=null,jd=null;function Ud(){jd=hl=Zc=null}function am(m,g,C){de?(jt(Qc,g._currentValue),g._currentValue=C):(jt(Qc,g._currentValue2),g._currentValue2=C)}function Ru(m){var g=Qc.current;vr(Qc),de?m._currentValue=g:m._currentValue2=g}function as(m,g,C){for(;m!==null;){var M=m.alternate;if((m.childLanes&g)!==g?(m.childLanes|=g,M!==null&&(M.childLanes|=g)):M!==null&&(M.childLanes&g)!==g&&(M.childLanes|=g),m===C)break;m=m.return}}function pl(m,g){Zc=m,jd=hl=null,m=m.dependencies,m!==null&&m.firstContext!==null&&((m.lanes&g)!==0&&(Zr=!0),m.firstContext=null)}function fi(m){var g=de?m._currentValue:m._currentValue2;if(jd!==m)if(m={context:m,memoizedValue:g,next:null},hl===null){if(Zc===null)throw Error(o(308));hl=m,Zc.dependencies={lanes:0,firstContext:m}}else hl=hl.next=m;return g}var go=null;function Jc(m){go===null?go=[m]:go.push(m)}function Hd(m,g,C,M){var z=g.interleaved;return z===null?(C.next=C,Jc(g)):(C.next=z.next,z.next=C),g.interleaved=C,Xi(m,M)}function Xi(m,g){m.lanes|=g;var C=m.alternate;for(C!==null&&(C.lanes|=g),C=m,m=m.return;m!==null;)m.childLanes|=g,C=m.alternate,C!==null&&(C.childLanes|=g),C=m,m=m.return;return C.tag===3?C.stateNode:null}var di=!1;function $d(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function om(m,g){m=m.updateQueue,g.updateQueue===m&&(g.updateQueue={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,effects:m.effects})}function Ua(m,g){return{eventTime:m,lane:g,tag:0,payload:null,callback:null,next:null}}function Ha(m,g,C){var M=m.updateQueue;if(M===null)return null;if(M=M.shared,(Nt&2)!==0){var z=M.pending;return z===null?g.next=g:(g.next=z.next,z.next=g),M.pending=g,Xi(m,C)}return z=M.interleaved,z===null?(g.next=g,Jc(M)):(g.next=z.next,z.next=g),M.interleaved=g,Xi(m,C)}function Mu(m,g,C){if(g=g.updateQueue,g!==null&&(g=g.shared,(C&4194240)!==0)){var M=g.lanes;M&=m.pendingLanes,C|=M,g.lanes=C,da(m,C)}}function ml(m,g){var C=m.updateQueue,M=m.alternate;if(M!==null&&(M=M.updateQueue,C===M)){var z=null,G=null;if(C=C.firstBaseUpdate,C!==null){do{var ie={eventTime:C.eventTime,lane:C.lane,tag:C.tag,payload:C.payload,callback:C.callback,next:null};G===null?z=G=ie:G=G.next=ie,C=C.next}while(C!==null);G===null?z=G=g:G=G.next=g}else z=G=g;C={baseState:M.baseState,firstBaseUpdate:z,lastBaseUpdate:G,shared:M.shared,effects:M.effects},m.updateQueue=C;return}m=C.lastBaseUpdate,m===null?C.firstBaseUpdate=g:m.next=g,C.lastBaseUpdate=g}function yo(m,g,C,M){var z=m.updateQueue;di=!1;var G=z.firstBaseUpdate,ie=z.lastBaseUpdate,Se=z.shared.pending;if(Se!==null){z.shared.pending=null;var Ne=Se,Ge=Ne.next;Ne.next=null,ie===null?G=Ge:ie.next=Ge,ie=Ne;var mt=m.alternate;mt!==null&&(mt=mt.updateQueue,Se=mt.lastBaseUpdate,Se!==ie&&(Se===null?mt.firstBaseUpdate=Ge:Se.next=Ge,mt.lastBaseUpdate=Ne))}if(G!==null){var Mt=z.baseState;ie=0,mt=Ge=Ne=null,Se=G;do{var ot=Se.lane,gr=Se.eventTime;if((M&ot)===ot){mt!==null&&(mt=mt.next={eventTime:gr,lane:0,tag:Se.tag,payload:Se.payload,callback:Se.callback,next:null});e:{var nr=m,jn=Se;switch(ot=g,gr=C,jn.tag){case 1:if(nr=jn.payload,typeof nr=="function"){Mt=nr.call(gr,Mt,ot);break e}Mt=nr;break e;case 3:nr.flags=nr.flags&-65537|128;case 0:if(nr=jn.payload,ot=typeof nr=="function"?nr.call(gr,Mt,ot):nr,ot==null)break e;Mt=a({},Mt,ot);break e;case 2:di=!0}}Se.callback!==null&&Se.lane!==0&&(m.flags|=64,ot=z.effects,ot===null?z.effects=[Se]:ot.push(Se))}else gr={eventTime:gr,lane:ot,tag:Se.tag,payload:Se.payload,callback:Se.callback,next:null},mt===null?(Ge=mt=gr,Ne=Mt):mt=mt.next=gr,ie|=ot;if(Se=Se.next,Se===null){if(Se=z.shared.pending,Se===null)break;ot=Se,Se=ot.next,ot.next=null,z.lastBaseUpdate=ot,z.shared.pending=null}}while(!0);if(mt===null&&(Ne=Mt),z.baseState=Ne,z.firstBaseUpdate=Ge,z.lastBaseUpdate=mt,g=z.shared.interleaved,g!==null){z=g;do ie|=z.lane,z=z.next;while(z!==g)}else G===null&&(z.shared.lanes=0);Ga|=ie,m.lanes=ie,m.memoizedState=Mt}}function sm(m,g,C){if(m=g.effects,g.effects=null,m!==null)for(g=0;g<m.length;g++){var M=m[g],z=M.callback;if(z!==null){if(M.callback=null,M=C,typeof z!="function")throw Error(o(191,z));z.call(M)}}}var vo={},Ei=hn(vo),gl=hn(vo),bo=hn(vo);function Ti(m){if(m===vo)throw Error(o(174));return m}function ef(m,g){jt(bo,g),jt(gl,m),jt(Ei,vo),m=K(g),vr(Ei),jt(Ei,m)}function os(){vr(Ei),vr(gl),vr(bo)}function qd(m){var g=Ti(bo.current),C=Ti(Ei.current);g=q(C,m.type,g),C!==g&&(jt(gl,m),jt(Ei,g))}function Vd(m){gl.current===m&&(vr(Ei),vr(gl))}var Rr=hn(0);function tf(m){for(var g=m;g!==null;){if(g.tag===13){var C=g.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||ca(C)||Wn(C)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var Wd=[];function Gd(){for(var m=0;m<Wd.length;m++){var g=Wd[m];de?g._workInProgressVersionPrimary=null:g._workInProgressVersionSecondary=null}Wd.length=0}var Qn=s.ReactCurrentDispatcher,ss=s.ReactCurrentBatchConfig,wo=0,_r=null,Wr=null,Qr=null,yl=!1,Du=!1,Nu=0,vl=0;function un(){throw Error(o(321))}function ls(m,g){if(g===null)return!1;for(var C=0;C<g.length&&C<m.length;C++)if(!qi(m[C],g[C]))return!1;return!0}function Lu(m,g,C,M,z,G){if(wo=G,_r=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,Qn.current=m===null||m.memoizedState===null?nh:ih,m=C(M,z),Du){G=0;do{if(Du=!1,Nu=0,25<=G)throw Error(o(301));G+=1,Qr=Wr=null,g.updateQueue=null,Qn.current=ah,m=C(M,z)}while(Du)}if(Qn.current=hs,g=Wr!==null&&Wr.next!==null,wo=0,Qr=Wr=_r=null,yl=!1,g)throw Error(o(300));return m}function rf(){var m=Nu!==0;return Nu=0,m}function hi(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qr===null?_r.memoizedState=Qr=m:Qr=Qr.next=m,Qr}function gn(){if(Wr===null){var m=_r.alternate;m=m!==null?m.memoizedState:null}else m=Wr.next;var g=Qr===null?_r.memoizedState:Qr.next;if(g!==null)Qr=g,Wr=m;else{if(m===null)throw Error(o(310));Wr=m,m={memoizedState:Wr.memoizedState,baseState:Wr.baseState,baseQueue:Wr.baseQueue,queue:Wr.queue,next:null},Qr===null?_r.memoizedState=Qr=m:Qr=Qr.next=m}return Qr}function us(m,g){return typeof g=="function"?g(m):g}function nf(m){var g=gn(),C=g.queue;if(C===null)throw Error(o(311));C.lastRenderedReducer=m;var M=Wr,z=M.baseQueue,G=C.pending;if(G!==null){if(z!==null){var ie=z.next;z.next=G.next,G.next=ie}M.baseQueue=z=G,C.pending=null}if(z!==null){G=z.next,M=M.baseState;var Se=ie=null,Ne=null,Ge=G;do{var mt=Ge.lane;if((wo&mt)===mt)Ne!==null&&(Ne=Ne.next={lane:0,action:Ge.action,hasEagerState:Ge.hasEagerState,eagerState:Ge.eagerState,next:null}),M=Ge.hasEagerState?Ge.eagerState:m(M,Ge.action);else{var Mt={lane:mt,action:Ge.action,hasEagerState:Ge.hasEagerState,eagerState:Ge.eagerState,next:null};Ne===null?(Se=Ne=Mt,ie=M):Ne=Ne.next=Mt,_r.lanes|=mt,Ga|=mt}Ge=Ge.next}while(Ge!==null&&Ge!==G);Ne===null?ie=M:Ne.next=Se,qi(M,g.memoizedState)||(Zr=!0),g.memoizedState=M,g.baseState=ie,g.baseQueue=Ne,C.lastRenderedState=M}if(m=C.interleaved,m!==null){z=m;do G=z.lane,_r.lanes|=G,Ga|=G,z=z.next;while(z!==m)}else z===null&&(C.lanes=0);return[g.memoizedState,C.dispatch]}function bl(m){var g=gn(),C=g.queue;if(C===null)throw Error(o(311));C.lastRenderedReducer=m;var M=C.dispatch,z=C.pending,G=g.memoizedState;if(z!==null){C.pending=null;var ie=z=z.next;do G=m(G,ie.action),ie=ie.next;while(ie!==z);qi(G,g.memoizedState)||(Zr=!0),g.memoizedState=G,g.baseQueue===null&&(g.baseState=G),C.lastRenderedState=G}return[G,M]}function Xd(){}function Yd(m,g){var C=_r,M=gn(),z=g(),G=!qi(M.memoizedState,z);if(G&&(M.memoizedState=z,Zr=!0),M=M.queue,sf(Zd.bind(null,C,M,m),[m]),M.getSnapshot!==g||G||Qr!==null&&Qr.memoizedState.tag&1){if(C.flags|=2048,cs(9,Qd.bind(null,C,M,z,g),void 0,null),fr===null)throw Error(o(349));(wo&30)!==0||Kd(C,g,z)}return z}function Kd(m,g,C){m.flags|=16384,m={getSnapshot:g,value:C},g=_r.updateQueue,g===null?(g={lastEffect:null,stores:null},_r.updateQueue=g,g.stores=[m]):(C=g.stores,C===null?g.stores=[m]:C.push(m))}function Qd(m,g,C,M){g.value=C,g.getSnapshot=M,Jd(g)&&$a(m)}function Zd(m,g,C){return C(function(){Jd(g)&&$a(m)})}function Jd(m){var g=m.getSnapshot;m=m.value;try{var C=g();return!qi(m,C)}catch{return!0}}function $a(m){var g=Xi(m,1);g!==null&&Tn(g,m,1,-1)}function af(m){var g=hi();return typeof m=="function"&&(m=m()),g.memoizedState=g.baseState=m,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:us,lastRenderedState:m},g.queue=m,m=m.dispatch=j0.bind(null,_r,m),[g.memoizedState,m]}function cs(m,g,C,M){return m={tag:m,create:g,destroy:C,deps:M,next:null},g=_r.updateQueue,g===null?(g={lastEffect:null,stores:null},_r.updateQueue=g,g.lastEffect=m.next=m):(C=g.lastEffect,C===null?g.lastEffect=m.next=m:(M=C.next,C.next=m,m.next=M,g.lastEffect=m)),m}function lm(){return gn().memoizedState}function of(m,g,C,M){var z=hi();_r.flags|=m,z.memoizedState=cs(1|g,C,void 0,M===void 0?null:M)}function xo(m,g,C,M){var z=gn();M=M===void 0?null:M;var G=void 0;if(Wr!==null){var ie=Wr.memoizedState;if(G=ie.destroy,M!==null&&ls(M,ie.deps)){z.memoizedState=cs(g,C,G,M);return}}_r.flags|=m,z.memoizedState=cs(1|g,C,G,M)}function um(m,g){return of(8390656,8,m,g)}function sf(m,g){return xo(2048,8,m,g)}function eh(m,g){return xo(4,2,m,g)}function hr(m,g){return xo(4,4,m,g)}function lf(m,g){if(typeof g=="function")return m=m(),g(m),function(){g(null)};if(g!=null)return m=m(),g.current=m,function(){g.current=null}}function Fu(m,g,C){return C=C!=null?C.concat([m]):null,xo(4,4,lf.bind(null,g,m),C)}function fs(){}function th(m,g){var C=gn();g=g===void 0?null:g;var M=C.memoizedState;return M!==null&&g!==null&&ls(g,M[1])?M[0]:(C.memoizedState=[m,g],m)}function uf(m,g){var C=gn();g=g===void 0?null:g;var M=C.memoizedState;return M!==null&&g!==null&&ls(g,M[1])?M[0]:(m=m(),C.memoizedState=[m,g],m)}function wl(m,g,C){return(wo&21)===0?(m.baseState&&(m.baseState=!1,Zr=!0),m.memoizedState=C):(qi(C,g)||(C=Uc(),_r.lanes|=C,Ga|=C,m.baseState=!0),g)}function cf(m,g){var C=Ut;Ut=C!==0&&4>C?C:4,m(!0);var M=ss.transition;ss.transition={};try{m(!1),g()}finally{Ut=C,ss.transition=M}}function ds(){return gn().memoizedState}function cm(m,g,C){var M=en(m);if(C={lane:M,action:C,hasEagerState:!1,eagerState:null,next:null},fm(m))rh(g,C);else if(C=Hd(m,g,C,M),C!==null){var z=wr();Tn(C,m,M,z),Bu(C,g,M)}}function j0(m,g,C){var M=en(m),z={lane:M,action:C,hasEagerState:!1,eagerState:null,next:null};if(fm(m))rh(g,z);else{var G=m.alternate;if(m.lanes===0&&(G===null||G.lanes===0)&&(G=g.lastRenderedReducer,G!==null))try{var ie=g.lastRenderedState,Se=G(ie,C);if(z.hasEagerState=!0,z.eagerState=Se,qi(Se,ie)){var Ne=g.interleaved;Ne===null?(z.next=z,Jc(g)):(z.next=Ne.next,Ne.next=z),g.interleaved=z;return}}catch{}C=Hd(m,g,z,M),C!==null&&(z=wr(),Tn(C,m,M,z),Bu(C,g,M))}}function fm(m){var g=m.alternate;return m===_r||g!==null&&g===_r}function rh(m,g){Du=yl=!0;var C=m.pending;C===null?g.next=g:(g.next=C.next,C.next=g),m.pending=g}function Bu(m,g,C){if((C&4194240)!==0){var M=g.lanes;M&=m.pendingLanes,C|=M,g.lanes=C,da(m,C)}}var hs={readContext:fi,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},nh={readContext:fi,useCallback:function(m,g){return hi().memoizedState=[m,g===void 0?null:g],m},useContext:fi,useEffect:um,useImperativeHandle:function(m,g,C){return C=C!=null?C.concat([m]):null,of(4194308,4,lf.bind(null,g,m),C)},useLayoutEffect:function(m,g){return of(4194308,4,m,g)},useInsertionEffect:function(m,g){return of(4,2,m,g)},useMemo:function(m,g){var C=hi();return g=g===void 0?null:g,m=m(),C.memoizedState=[m,g],m},useReducer:function(m,g,C){var M=hi();return g=C!==void 0?C(g):g,M.memoizedState=M.baseState=g,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:g},M.queue=m,m=m.dispatch=cm.bind(null,_r,m),[M.memoizedState,m]},useRef:function(m){var g=hi();return m={current:m},g.memoizedState=m},useState:af,useDebugValue:fs,useDeferredValue:function(m){return hi().memoizedState=m},useTransition:function(){var m=af(!1),g=m[0];return m=cf.bind(null,m[1]),hi().memoizedState=m,[g,m]},useMutableSource:function(){},useSyncExternalStore:function(m,g,C){var M=_r,z=hi();if(br){if(C===void 0)throw Error(o(407));C=C()}else{if(C=g(),fr===null)throw Error(o(349));(wo&30)!==0||Kd(M,g,C)}z.memoizedState=C;var G={value:C,getSnapshot:g};return z.queue=G,um(Zd.bind(null,M,G,m),[m]),M.flags|=2048,cs(9,Qd.bind(null,M,G,C,g),void 0,null),C},useId:function(){var m=hi(),g=fr.identifierPrefix;if(br){var C=Vi,M=Kn;C=(M&~(1<<32-ui(M)-1)).toString(32)+C,g=":"+g+"R"+C,C=Nu++,0<C&&(g+="H"+C.toString(32)),g+=":"}else C=vl++,g=":"+g+"r"+C.toString(32)+":";return m.memoizedState=g},unstable_isNewReconciler:!1},ih={readContext:fi,useCallback:th,useContext:fi,useEffect:sf,useImperativeHandle:Fu,useInsertionEffect:eh,useLayoutEffect:hr,useMemo:uf,useReducer:nf,useRef:lm,useState:function(){return nf(us)},useDebugValue:fs,useDeferredValue:function(m){var g=gn();return wl(g,Wr.memoizedState,m)},useTransition:function(){var m=nf(us)[0],g=gn().memoizedState;return[m,g]},useMutableSource:Xd,useSyncExternalStore:Yd,useId:ds,unstable_isNewReconciler:!1},ah={readContext:fi,useCallback:th,useContext:fi,useEffect:sf,useImperativeHandle:Fu,useInsertionEffect:eh,useLayoutEffect:hr,useMemo:uf,useReducer:bl,useRef:lm,useState:function(){return bl(us)},useDebugValue:fs,useDeferredValue:function(m){var g=gn();return Wr===null?g.memoizedState=m:wl(g,Wr.memoizedState,m)},useTransition:function(){var m=bl(us)[0],g=gn().memoizedState;return[m,g]},useMutableSource:Xd,useSyncExternalStore:Yd,useId:ds,unstable_isNewReconciler:!1};function pi(m,g){if(m&&m.defaultProps){g=a({},g),m=m.defaultProps;for(var C in m)g[C]===void 0&&(g[C]=m[C]);return g}return g}function oh(m,g,C,M){g=m.memoizedState,C=C(M,g),C=C==null?g:a({},g,C),m.memoizedState=C,m.lanes===0&&(m.updateQueue.baseState=C)}var zu={isMounted:function(m){return(m=m._reactInternals)?L(m)===m:!1},enqueueSetState:function(m,g,C){m=m._reactInternals;var M=wr(),z=en(m),G=Ua(M,z);G.payload=g,C!=null&&(G.callback=C),g=Ha(m,G,z),g!==null&&(Tn(g,m,z,M),Mu(g,m,z))},enqueueReplaceState:function(m,g,C){m=m._reactInternals;var M=wr(),z=en(m),G=Ua(M,z);G.tag=1,G.payload=g,C!=null&&(G.callback=C),g=Ha(m,G,z),g!==null&&(Tn(g,m,z,M),Mu(g,m,z))},enqueueForceUpdate:function(m,g){m=m._reactInternals;var C=wr(),M=en(m),z=Ua(C,M);z.tag=2,g!=null&&(z.callback=g),g=Ha(m,z,M),g!==null&&(Tn(g,m,M,C),Mu(g,m,M))}};function dm(m,g,C,M,z,G,ie){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(M,G,ie):g.prototype&&g.prototype.isPureReactComponent?!Yc(C,M)||!Yc(z,G):!0}function hm(m,g,C){var M=!1,z=fo,G=g.contextType;return typeof G=="object"&&G!==null?G=fi(G):(z=sn(g)?fa:kn.current,M=g.contextTypes,G=(M=M!=null)?Ba(m,z):fo),g=new g(C,G),m.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=zu,m.stateNode=g,g._reactInternals=m,M&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=z,m.__reactInternalMemoizedMaskedChildContext=G),g}function ff(m,g,C,M){m=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(C,M),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(C,M),g.state!==m&&zu.enqueueReplaceState(g,g.state,null)}function pa(m,g,C,M){var z=m.stateNode;z.props=C,z.state=m.memoizedState,z.refs={},$d(m);var G=g.contextType;typeof G=="object"&&G!==null?z.context=fi(G):(G=sn(g)?fa:kn.current,z.context=Ba(m,G)),z.state=m.memoizedState,G=g.getDerivedStateFromProps,typeof G=="function"&&(oh(m,g,G,C),z.state=m.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof z.getSnapshotBeforeUpdate=="function"||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(g=z.state,typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount(),g!==z.state&&zu.enqueueReplaceState(z,z.state,null),yo(m,C,z,M),z.state=m.memoizedState),typeof z.componentDidMount=="function"&&(m.flags|=4194308)}function ps(m,g){try{var C="",M=g;do C+=z0(M),M=M.return;while(M);var z=C}catch(G){z=`
29
+ Error generating stack: `+G.message+`
30
+ `+G.stack}return{value:m,source:g,stack:z,digest:null}}function So(m,g,C){return{value:m,source:null,stack:C??null,digest:g??null}}function Ci(m,g){try{console.error(g.value)}catch(C){setTimeout(function(){throw C})}}var ju=typeof WeakMap=="function"?WeakMap:Map;function ma(m,g,C){C=Ua(-1,C),C.tag=3,C.payload={element:null};var M=g.value;return C.callback=function(){Lr||(Lr=!0,Gr=M),Ci(m,g)},C}function df(m,g,C){C=Ua(-1,C),C.tag=3;var M=m.type.getDerivedStateFromError;if(typeof M=="function"){var z=g.value;C.payload=function(){return M(z)},C.callback=function(){Ci(m,g)}}var G=m.stateNode;return G!==null&&typeof G.componentDidCatch=="function"&&(C.callback=function(){Ci(m,g),typeof M!="function"&&(Ki===null?Ki=new Set([this]):Ki.add(this));var ie=g.stack;this.componentDidCatch(g.value,{componentStack:ie!==null?ie:""})}),C}function pm(m,g,C){var M=m.pingCache;if(M===null){M=m.pingCache=new ju;var z=new Set;M.set(g,z)}else z=M.get(g),z===void 0&&(z=new Set,M.set(g,z));z.has(C)||(z.add(C),m=Sm.bind(null,m,g,C),g.then(m,m))}function mm(m){do{var g;if((g=m.tag===13)&&(g=m.memoizedState,g=g!==null?g.dehydrated!==null:!0),g)return m;m=m.return}while(m!==null);return null}function ko(m,g,C,M,z){return(m.mode&1)===0?(m===g?m.flags|=65536:(m.flags|=128,C.flags|=131072,C.flags&=-52805,C.tag===1&&(C.alternate===null?C.tag=17:(g=Ua(-1,1),g.tag=2,Ha(C,g,1))),C.lanes|=1),m):(m.flags|=65536,m.lanes=z,m)}var Uu=s.ReactCurrentOwner,Zr=!1;function cn(m,g,C,M){g.child=m===null?im(g,null,C,M):is(g,m.child,C,M)}function hf(m,g,C,M,z){C=C.render;var G=g.ref;return pl(g,z),M=Lu(m,g,C,M,G,z),C=rf(),m!==null&&!Zr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~z,Va(m,g,z)):(br&&C&&Ou(g),g.flags|=1,cn(m,g,M,z),g.child)}function ms(m,g,C,M,z){if(m===null){var G=C.type;return typeof G=="function"&&!Nl(G)&&G.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(g.tag=15,g.type=G,qa(m,g,G,M,z)):(m=Of(C.type,null,M,g,g.mode,z),m.ref=g.ref,m.return=g,g.child=m)}if(G=m.child,(m.lanes&z)===0){var ie=G.memoizedProps;if(C=C.compare,C=C!==null?C:Yc,C(ie,M)&&m.ref===g.ref)return Va(m,g,z)}return g.flags|=1,m=Mo(G,M),m.ref=g.ref,m.return=g,g.child=m}function qa(m,g,C,M,z){if(m!==null){var G=m.memoizedProps;if(Yc(G,M)&&m.ref===g.ref)if(Zr=!1,g.pendingProps=M=G,(m.lanes&z)!==0)(m.flags&131072)!==0&&(Zr=!0);else return g.lanes=m.lanes,Va(m,g,z)}return ga(m,g,C,M,z)}function pr(m,g,C){var M=g.pendingProps,z=M.children,G=m!==null?m.memoizedState:null;if(M.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null,transitions:null},jt(Oo,Jr),Jr|=C;else{if((C&1073741824)===0)return m=G!==null?G.baseLanes|C:C,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:m,cachePool:null,transitions:null},g.updateQueue=null,jt(Oo,Jr),Jr|=m,null;g.memoizedState={baseLanes:0,cachePool:null,transitions:null},M=G!==null?G.baseLanes:C,jt(Oo,Jr),Jr|=M}else G!==null?(M=G.baseLanes|C,g.memoizedState=null):M=C,jt(Oo,Jr),Jr|=M;return cn(m,g,z,C),g.child}function cr(m,g){var C=g.ref;(m===null&&C!==null||m!==null&&m.ref!==C)&&(g.flags|=512,g.flags|=2097152)}function ga(m,g,C,M,z){var G=sn(C)?fa:kn.current;return G=Ba(g,G),pl(g,z),C=Lu(m,g,C,M,G,z),M=rf(),m!==null&&!Zr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~z,Va(m,g,z)):(br&&M&&Ou(g),g.flags|=1,cn(m,g,C,z),g.child)}function yn(m,g,C,M,z){if(sn(C)){var G=!0;al(g)}else G=!1;if(pl(g,z),g.stateNode===null)Hu(m,g),hm(g,C,M),pa(g,C,M,z),M=!0;else if(m===null){var ie=g.stateNode,Se=g.memoizedProps;ie.props=Se;var Ne=ie.context,Ge=C.contextType;typeof Ge=="object"&&Ge!==null?Ge=fi(Ge):(Ge=sn(C)?fa:kn.current,Ge=Ba(g,Ge));var mt=C.getDerivedStateFromProps,Mt=typeof mt=="function"||typeof ie.getSnapshotBeforeUpdate=="function";Mt||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(Se!==M||Ne!==Ge)&&ff(g,ie,M,Ge),di=!1;var ot=g.memoizedState;ie.state=ot,yo(g,M,ie,z),Ne=g.memoizedState,Se!==M||ot!==Ne||Xn.current||di?(typeof mt=="function"&&(oh(g,C,mt,M),Ne=g.memoizedState),(Se=di||dm(g,C,Se,M,ot,Ne,Ge))?(Mt||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(g.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=M,g.memoizedState=Ne),ie.props=M,ie.state=Ne,ie.context=Ge,M=Se):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),M=!1)}else{ie=g.stateNode,om(m,g),Se=g.memoizedProps,Ge=g.type===g.elementType?Se:pi(g.type,Se),ie.props=Ge,Mt=g.pendingProps,ot=ie.context,Ne=C.contextType,typeof Ne=="object"&&Ne!==null?Ne=fi(Ne):(Ne=sn(C)?fa:kn.current,Ne=Ba(g,Ne));var gr=C.getDerivedStateFromProps;(mt=typeof gr=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(Se!==Mt||ot!==Ne)&&ff(g,ie,M,Ne),di=!1,ot=g.memoizedState,ie.state=ot,yo(g,M,ie,z);var nr=g.memoizedState;Se!==Mt||ot!==nr||Xn.current||di?(typeof gr=="function"&&(oh(g,C,gr,M),nr=g.memoizedState),(Ge=di||dm(g,C,Ge,M,ot,nr,Ne)||!1)?(mt||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(M,nr,Ne),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(M,nr,Ne)),typeof ie.componentDidUpdate=="function"&&(g.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof ie.componentDidUpdate!="function"||Se===m.memoizedProps&&ot===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||Se===m.memoizedProps&&ot===m.memoizedState||(g.flags|=1024),g.memoizedProps=M,g.memoizedState=nr),ie.props=M,ie.state=nr,ie.context=Ne,M=Ge):(typeof ie.componentDidUpdate!="function"||Se===m.memoizedProps&&ot===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||Se===m.memoizedProps&&ot===m.memoizedState||(g.flags|=1024),M=!1)}return _n(m,g,C,M,G,z)}function _n(m,g,C,M,z,G){cr(m,g);var ie=(g.flags&128)!==0;if(!M&&!ie)return z&&Nd(g,C,!1),Va(m,g,G);M=g.stateNode,Uu.current=g;var Se=ie&&typeof C.getDerivedStateFromError!="function"?null:M.render();return g.flags|=1,m!==null&&ie?(g.child=is(g,m.child,null,G),g.child=is(g,null,Se,G)):cn(m,g,Se,G),g.memoizedState=M.state,z&&Nd(g,C,!0),g.child}function _o(m){var g=m.stateNode;g.pendingContext?Vp(m,g.pendingContext,g.pendingContext!==g.context):g.context&&Vp(m,g.context,!1),ef(m,g.containerInfo)}function gs(m,g,C,M,z){return rs(),zd(z),g.flags|=256,cn(m,g,C,M),g.child}var Pn={dehydrated:null,treeContext:null,retryLane:0};function xl(m){return{baseLanes:m,cachePool:null,transitions:null}}function sh(m,g,C){var M=g.pendingProps,z=Rr.current,G=!1,ie=(g.flags&128)!==0,Se;if((Se=ie)||(Se=m!==null&&m.memoizedState===null?!1:(z&2)!==0),Se?(G=!0,g.flags&=-129):(m===null||m.memoizedState!==null)&&(z|=1),jt(Rr,z&1),m===null)return Bd(g),m=g.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((g.mode&1)===0?g.lanes=1:Wn(m)?g.lanes=8:g.lanes=1073741824,null):(ie=M.children,m=M.fallback,G?(M=g.mode,G=g.child,ie={mode:"hidden",children:ie},(M&1)===0&&G!==null?(G.childLanes=0,G.pendingProps=ie):G=Ll(ie,M,0,null),m=vn(m,M,C,null),G.return=g,m.return=g,G.sibling=m,g.child=G,g.child.memoizedState=xl(C),g.memoizedState=Pn,m):pf(g,ie));if(z=m.memoizedState,z!==null&&(Se=z.dehydrated,Se!==null))return gm(m,g,ie,M,Se,z,C);if(G){G=M.fallback,ie=g.mode,z=m.child,Se=z.sibling;var Ne={mode:"hidden",children:M.children};return(ie&1)===0&&g.child!==z?(M=g.child,M.childLanes=0,M.pendingProps=Ne,g.deletions=null):(M=Mo(z,Ne),M.subtreeFlags=z.subtreeFlags&14680064),Se!==null?G=Mo(Se,G):(G=vn(G,ie,C,null),G.flags|=2),G.return=g,M.return=g,M.sibling=G,g.child=M,M=G,G=g.child,ie=m.child.memoizedState,ie=ie===null?xl(C):{baseLanes:ie.baseLanes|C,cachePool:null,transitions:ie.transitions},G.memoizedState=ie,G.childLanes=m.childLanes&~C,g.memoizedState=Pn,M}return G=m.child,m=G.sibling,M=Mo(G,{mode:"visible",children:M.children}),(g.mode&1)===0&&(M.lanes=C),M.return=g,M.sibling=null,m!==null&&(C=g.deletions,C===null?(g.deletions=[m],g.flags|=16):C.push(m)),g.child=M,g.memoizedState=null,M}function pf(m,g){return g=Ll({mode:"visible",children:g},m.mode,0,null),g.return=m,m.child=g}function ys(m,g,C,M){return M!==null&&zd(M),is(g,m.child,null,C),m=pf(g,g.pendingProps.children),m.flags|=2,g.memoizedState=null,m}function gm(m,g,C,M,z,G,ie){if(C)return g.flags&256?(g.flags&=-257,M=So(Error(o(422))),ys(m,g,ie,M)):g.memoizedState!==null?(g.child=m.child,g.flags|=128,null):(G=M.fallback,z=g.mode,M=Ll({mode:"visible",children:M.children},z,0,null),G=vn(G,z,ie,null),G.flags|=2,M.return=g,G.return=g,M.sibling=G,g.child=M,(g.mode&1)!==0&&is(g,m.child,null,ie),g.child.memoizedState=xl(ie),g.memoizedState=Pn,G);if((g.mode&1)===0)return ys(m,g,ie,null);if(Wn(z))return M=oi(z).digest,G=Error(o(419)),M=So(G,M,void 0),ys(m,g,ie,M);if(C=(ie&m.childLanes)!==0,Zr||C){if(M=fr,M!==null){switch(ie&-ie){case 4:z=2;break;case 16:z=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:z=32;break;case 536870912:z=268435456;break;default:z=0}z=(z&(M.suspendedLanes|ie))!==0?0:z,z!==0&&z!==G.retryLane&&(G.retryLane=z,Xi(m,z),Tn(M,m,z,-1))}return Dl(),M=So(Error(o(421))),ys(m,g,ie,M)}return ca(z)?(g.flags|=128,g.child=m.child,g=_m.bind(null,m),$i(z,g),null):(m=G.treeContext,Le&&(Dn=Qo(z),mn=g,br=!0,Gi=null,Iu=!1,m!==null&&(Mn[ci++]=Kn,Mn[ci++]=Vi,Mn[ci++]=Kr,Kn=m.id,Vi=m.overflow,Kr=g)),g=pf(g,M.children),g.flags|=4096,g)}function ya(m,g,C){m.lanes|=g;var M=m.alternate;M!==null&&(M.lanes|=g),as(m.return,g,C)}function Sl(m,g,C,M,z){var G=m.memoizedState;G===null?m.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:M,tail:C,tailMode:z}:(G.isBackwards=g,G.rendering=null,G.renderingStartTime=0,G.last=M,G.tail=C,G.tailMode=z)}function mf(m,g,C){var M=g.pendingProps,z=M.revealOrder,G=M.tail;if(cn(m,g,M.children,C),M=Rr.current,(M&2)!==0)M=M&1|2,g.flags|=128;else{if(m!==null&&(m.flags&128)!==0)e:for(m=g.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&ya(m,C,g);else if(m.tag===19)ya(m,C,g);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===g)break e;for(;m.sibling===null;){if(m.return===null||m.return===g)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}M&=1}if(jt(Rr,M),(g.mode&1)===0)g.memoizedState=null;else switch(z){case"forwards":for(C=g.child,z=null;C!==null;)m=C.alternate,m!==null&&tf(m)===null&&(z=C),C=C.sibling;C=z,C===null?(z=g.child,g.child=null):(z=C.sibling,C.sibling=null),Sl(g,!1,z,C,G);break;case"backwards":for(C=null,z=g.child,g.child=null;z!==null;){if(m=z.alternate,m!==null&&tf(m)===null){g.child=z;break}m=z.sibling,z.sibling=C,C=z,z=m}Sl(g,!0,C,null,G);break;case"together":Sl(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function Hu(m,g){(g.mode&1)===0&&m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2)}function Va(m,g,C){if(m!==null&&(g.dependencies=m.dependencies),Ga|=g.lanes,(C&g.childLanes)===0)return null;if(m!==null&&g.child!==m.child)throw Error(o(153));if(g.child!==null){for(m=g.child,C=Mo(m,m.pendingProps),g.child=C,C.return=g;m.sibling!==null;)m=m.sibling,C=C.sibling=Mo(m,m.pendingProps),C.return=g;C.sibling=null}return g.child}function Po(m,g,C){switch(g.tag){case 3:_o(g),rs();break;case 5:qd(g);break;case 1:sn(g.type)&&al(g);break;case 4:ef(g,g.stateNode.containerInfo);break;case 10:am(g,g.type._context,g.memoizedProps.value);break;case 13:var M=g.memoizedState;if(M!==null)return M.dehydrated!==null?(jt(Rr,Rr.current&1),g.flags|=128,null):(C&g.child.childLanes)!==0?sh(m,g,C):(jt(Rr,Rr.current&1),m=Va(m,g,C),m!==null?m.sibling:null);jt(Rr,Rr.current&1);break;case 19:if(M=(C&g.childLanes)!==0,(m.flags&128)!==0){if(M)return mf(m,g,C);g.flags|=128}var z=g.memoizedState;if(z!==null&&(z.rendering=null,z.tail=null,z.lastEffect=null),jt(Rr,Rr.current),M)break;return null;case 22:case 23:return g.lanes=0,pr(m,g,C)}return Va(m,g,C)}function Nn(m){m.flags|=4}function vs(m,g){if(m!==null&&m.child===g.child)return!0;if((g.flags&16)!==0)return!1;for(m=g.child;m!==null;){if((m.flags&12854)!==0||(m.subtreeFlags&12854)!==0)return!1;m=m.sibling}return!0}var Eo,To,Ln,Fn;if(Ee)Eo=function(m,g){for(var C=g.child;C!==null;){if(C.tag===5||C.tag===6)W(m,C.stateNode);else if(C.tag!==4&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}},To=function(){},Ln=function(m,g,C,M,z){if(m=m.memoizedProps,m!==M){var G=g.stateNode,ie=Ti(Ei.current);C=ee(G,C,m,M,z,ie),(g.updateQueue=C)&&Nn(g)}},Fn=function(m,g,C,M){C!==M&&Nn(g)};else if(Fe){Eo=function(m,g,C,M){for(var z=g.child;z!==null;){if(z.tag===5){var G=z.stateNode;C&&M&&(G=yr(G,z.type,z.memoizedProps,z)),W(m,G)}else if(z.tag===6)G=z.stateNode,C&&M&&(G=Hi(G,z.memoizedProps,z)),W(m,G);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)G=z.child,G!==null&&(G.return=z),Eo(m,z,!0,!0);else if(z.child!==null){z.child.return=z,z=z.child;continue}}if(z===g)break;for(;z.sibling===null;){if(z.return===null||z.return===g)return;z=z.return}z.sibling.return=z.return,z=z.sibling}};var Co=function(m,g,C,M){for(var z=g.child;z!==null;){if(z.tag===5){var G=z.stateNode;C&&M&&(G=yr(G,z.type,z.memoizedProps,z)),dr(m,G)}else if(z.tag===6)G=z.stateNode,C&&M&&(G=Hi(G,z.memoizedProps,z)),dr(m,G);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)G=z.child,G!==null&&(G.return=z),Co(m,z,!0,!0);else if(z.child!==null){z.child.return=z,z=z.child;continue}}if(z===g)break;for(;z.sibling===null;){if(z.return===null||z.return===g)return;z=z.return}z.sibling.return=z.return,z=z.sibling}};To=function(m,g){var C=g.stateNode;if(!vs(m,g)){m=C.containerInfo;var M=Yt(m);Co(M,g,!1,!1),C.pendingChildren=M,Nn(g),on(m,M)}},Ln=function(m,g,C,M,z){var G=m.stateNode,ie=m.memoizedProps;if((m=vs(m,g))&&ie===M)g.stateNode=G;else{var Se=g.stateNode,Ne=Ti(Ei.current),Ge=null;ie!==M&&(Ge=ee(Se,C,ie,M,z,Ne)),m&&Ge===null?g.stateNode=G:(G=Br(G,Ge,C,ie,M,g,m,Se),V(G,C,M,z,Ne)&&Nn(g),g.stateNode=G,m?Nn(g):Eo(G,g,!1,!1))}},Fn=function(m,g,C,M){C!==M?(m=Ti(bo.current),C=Ti(Ei.current),g.stateNode=Q(M,m,C,g),Nn(g)):g.stateNode=m.stateNode}}else To=function(){},Ln=function(){},Fn=function(){};function mi(m,g){if(!br)switch(m.tailMode){case"hidden":g=m.tail;for(var C=null;g!==null;)g.alternate!==null&&(C=g),g=g.sibling;C===null?m.tail=null:C.sibling=null;break;case"collapsed":C=m.tail;for(var M=null;C!==null;)C.alternate!==null&&(M=C),C=C.sibling;M===null?g||m.tail===null?m.tail=null:m.tail.sibling=null:M.sibling=null}}function Pr(m){var g=m.alternate!==null&&m.alternate.child===m.child,C=0,M=0;if(g)for(var z=m.child;z!==null;)C|=z.lanes|z.childLanes,M|=z.subtreeFlags&14680064,M|=z.flags&14680064,z.return=m,z=z.sibling;else for(z=m.child;z!==null;)C|=z.lanes|z.childLanes,M|=z.subtreeFlags,M|=z.flags,z.return=m,z=z.sibling;return m.subtreeFlags|=M,m.childLanes=C,g}function bs(m,g,C){var M=g.pendingProps;switch(Au(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pr(g),null;case 1:return sn(g.type)&&es(),Pr(g),null;case 3:return C=g.stateNode,os(),vr(Xn),vr(kn),Gd(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(Xc(g)?Nn(g):m===null||m.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,Gi!==null&&(Tf(Gi),Gi=null))),To(m,g),Pr(g),null;case 5:Vd(g),C=Ti(bo.current);var z=g.type;if(m!==null&&g.stateNode!=null)Ln(m,g,z,M,C),m.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!M){if(g.stateNode===null)throw Error(o(166));return Pr(g),null}if(m=Ti(Ei.current),Xc(g)){if(!Le)throw Error(o(175));m=Gn(g.stateNode,g.type,g.memoizedProps,C,m,g,!Iu),g.updateQueue=m,m!==null&&Nn(g)}else{var G=D(z,M,C,m,g);Eo(G,g,!1,!1),g.stateNode=G,V(G,z,M,C,m)&&Nn(g)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return Pr(g),null;case 6:if(m&&g.stateNode!=null)Fn(m,g,m.memoizedProps,M);else{if(typeof M!="string"&&g.stateNode===null)throw Error(o(166));if(m=Ti(bo.current),C=Ti(Ei.current),Xc(g)){if(!Le)throw Error(o(176));if(m=g.stateNode,C=g.memoizedProps,(M=Zo(m,C,g,!Iu))&&(z=mn,z!==null))switch(z.tag){case 3:D0(z.stateNode.containerInfo,m,C,(z.mode&1)!==0);break;case 5:zr(z.type,z.memoizedProps,z.stateNode,m,C,(z.mode&1)!==0)}M&&Nn(g)}else g.stateNode=Q(M,m,C,g)}return Pr(g),null;case 13:if(vr(Rr),M=g.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if(br&&Dn!==null&&(g.mode&1)!==0&&(g.flags&128)===0)tm(),rs(),g.flags|=98560,z=!1;else if(z=Xc(g),M!==null&&M.dehydrated!==null){if(m===null){if(!z)throw Error(o(318));if(!Le)throw Error(o(344));if(z=g.memoizedState,z=z!==null?z.dehydrated:null,!z)throw Error(o(317));li(z,g)}else rs(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Pr(g),z=!1}else Gi!==null&&(Tf(Gi),Gi=null),z=!0;if(!z)return g.flags&65536?g:null}return(g.flags&128)!==0?(g.lanes=C,g):(C=M!==null,C!==(m!==null&&m.memoizedState!==null)&&C&&(g.child.flags|=8192,(g.mode&1)!==0&&(m===null||(Rr.current&1)!==0?Tr===0&&(Tr=3):Dl())),g.updateQueue!==null&&(g.flags|=4),Pr(g),null);case 4:return os(),To(m,g),m===null&&Xe(g.stateNode.containerInfo),Pr(g),null;case 10:return Ru(g.type._context),Pr(g),null;case 17:return sn(g.type)&&es(),Pr(g),null;case 19:if(vr(Rr),z=g.memoizedState,z===null)return Pr(g),null;if(M=(g.flags&128)!==0,G=z.rendering,G===null)if(M)mi(z,!1);else{if(Tr!==0||m!==null&&(m.flags&128)!==0)for(m=g.child;m!==null;){if(G=tf(m),G!==null){for(g.flags|=128,mi(z,!1),m=G.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),g.subtreeFlags=0,m=C,C=g.child;C!==null;)M=C,z=m,M.flags&=14680066,G=M.alternate,G===null?(M.childLanes=0,M.lanes=z,M.child=null,M.subtreeFlags=0,M.memoizedProps=null,M.memoizedState=null,M.updateQueue=null,M.dependencies=null,M.stateNode=null):(M.childLanes=G.childLanes,M.lanes=G.lanes,M.child=G.child,M.subtreeFlags=0,M.deletions=null,M.memoizedProps=G.memoizedProps,M.memoizedState=G.memoizedState,M.updateQueue=G.updateQueue,M.type=G.type,z=G.dependencies,M.dependencies=z===null?null:{lanes:z.lanes,firstContext:z.firstContext}),C=C.sibling;return jt(Rr,Rr.current&1|2),g.child}m=m.sibling}z.tail!==null&&ln()>Yu&&(g.flags|=128,M=!0,mi(z,!1),g.lanes=4194304)}else{if(!M)if(m=tf(G),m!==null){if(g.flags|=128,M=!0,m=m.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),mi(z,!0),z.tail===null&&z.tailMode==="hidden"&&!G.alternate&&!br)return Pr(g),null}else 2*ln()-z.renderingStartTime>Yu&&C!==1073741824&&(g.flags|=128,M=!0,mi(z,!1),g.lanes=4194304);z.isBackwards?(G.sibling=g.child,g.child=G):(m=z.last,m!==null?m.sibling=G:g.child=G,z.last=G)}return z.tail!==null?(g=z.tail,z.rendering=g,z.tail=g.sibling,z.renderingStartTime=ln(),g.sibling=null,m=Rr.current,jt(Rr,M?m&1|2:m&1),g):(Pr(g),null);case 22:case 23:return Cf(),C=g.memoizedState!==null,m!==null&&m.memoizedState!==null!==C&&(g.flags|=8192),C&&(g.mode&1)!==0?(Jr&1073741824)!==0&&(Pr(g),Ee&&g.subtreeFlags&6&&(g.flags|=8192)):Pr(g),null;case 24:return null;case 25:return null}throw Error(o(156,g.tag))}function ym(m,g){switch(Au(g),g.tag){case 1:return sn(g.type)&&es(),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return os(),vr(Xn),vr(kn),Gd(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 5:return Vd(g),null;case 13:if(vr(Rr),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(o(340));rs()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return vr(Rr),null;case 4:return os(),null;case 10:return Ru(g.type._context),null;case 22:case 23:return Cf(),null;case 24:return null;default:return null}}var kl=!1,fn=!1,gi=typeof WeakSet=="function"?WeakSet:Set,rt=null;function rr(m,g){var C=m.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(M){xr(m,g,M)}else C.current=null}function yi(m,g,C){try{C()}catch(M){xr(m,g,M)}}var lh=!1;function vm(m,g){for(J(m.containerInfo),rt=g;rt!==null;)if(m=rt,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,rt=g;else for(;rt!==null;){m=rt;try{var C=m.alternate;if((m.flags&1024)!==0)switch(m.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var M=C.memoizedProps,z=C.memoizedState,G=m.stateNode,ie=G.getSnapshotBeforeUpdate(m.elementType===m.type?M:pi(m.type,M),z);G.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:Ee&&Bt(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Se){xr(m,m.return,Se)}if(g=m.sibling,g!==null){g.return=m.return,rt=g;break}rt=m.return}return C=lh,lh=!1,C}function ws(m,g,C){var M=g.updateQueue;if(M=M!==null?M.lastEffect:null,M!==null){var z=M=M.next;do{if((z.tag&m)===m){var G=z.destroy;z.destroy=void 0,G!==void 0&&yi(g,C,G)}z=z.next}while(z!==M)}}function _l(m,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var C=g=g.next;do{if((C.tag&m)===m){var M=C.create;C.destroy=M()}C=C.next}while(C!==g)}}function gf(m){var g=m.ref;if(g!==null){var C=m.stateNode;m.tag===5?m=Z(C):m=C,typeof g=="function"?g(m):g.current=m}}function $u(m){var g=m.alternate;g!==null&&(m.alternate=null,$u(g)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(g=m.stateNode,g!==null&&ke(g)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pendingProps=null,m.stateNode=null,m.updateQueue=null}function uh(m){return m.tag===5||m.tag===3||m.tag===4}function xs(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||uh(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function qu(m,g,C){var M=m.tag;if(M===5||M===6)m=m.stateNode,g?Ze(C,m,g):Ve(C,m);else if(M!==4&&(m=m.child,m!==null))for(qu(m,g,C),m=m.sibling;m!==null;)qu(m,g,C),m=m.sibling}function ch(m,g,C){var M=m.tag;if(M===5||M===6)m=m.stateNode,g?at(C,m,g):he(C,m);else if(M!==4&&(m=m.child,m!==null))for(ch(m,g,C),m=m.sibling;m!==null;)ch(m,g,C),m=m.sibling}var jr=null,Zn=!1;function Yi(m,g,C){for(C=C.child;C!==null;)yf(m,g,C),C=C.sibling}function yf(m,g,C){if(Yn&&typeof Yn.onCommitFiberUnmount=="function")try{Yn.onCommitFiberUnmount(po,C)}catch{}switch(C.tag){case 5:fn||rr(C,g);case 6:if(Ee){var M=jr,z=Zn;jr=null,Yi(m,g,C),jr=M,Zn=z,jr!==null&&(Zn?ve(jr,C.stateNode):ht(jr,C.stateNode))}else Yi(m,g,C);break;case 18:Ee&&jr!==null&&(Zn?_u(jr,C.stateNode):Fc(jr,C.stateNode));break;case 4:Ee?(M=jr,z=Zn,jr=C.stateNode.containerInfo,Zn=!0,Yi(m,g,C),jr=M,Zn=z):(Fe&&(M=C.stateNode.containerInfo,z=Yt(M),Vr(M,z)),Yi(m,g,C));break;case 0:case 11:case 14:case 15:if(!fn&&(M=C.updateQueue,M!==null&&(M=M.lastEffect,M!==null))){z=M=M.next;do{var G=z,ie=G.destroy;G=G.tag,ie!==void 0&&((G&2)!==0||(G&4)!==0)&&yi(C,g,ie),z=z.next}while(z!==M)}Yi(m,g,C);break;case 1:if(!fn&&(rr(C,g),M=C.stateNode,typeof M.componentWillUnmount=="function"))try{M.props=C.memoizedProps,M.state=C.memoizedState,M.componentWillUnmount()}catch(Se){xr(C,g,Se)}Yi(m,g,C);break;case 21:Yi(m,g,C);break;case 22:C.mode&1?(fn=(M=fn)||C.memoizedState!==null,Yi(m,g,C),fn=M):Yi(m,g,C);break;default:Yi(m,g,C)}}function Ss(m){var g=m.updateQueue;if(g!==null){m.updateQueue=null;var C=m.stateNode;C===null&&(C=m.stateNode=new gi),g.forEach(function(M){var z=U0.bind(null,m,M);C.has(M)||(C.add(M),M.then(z,z))})}}function Oi(m,g){var C=g.deletions;if(C!==null)for(var M=0;M<C.length;M++){var z=C[M];try{var G=m,ie=g;if(Ee){var Se=ie;e:for(;Se!==null;){switch(Se.tag){case 5:jr=Se.stateNode,Zn=!1;break e;case 3:jr=Se.stateNode.containerInfo,Zn=!0;break e;case 4:jr=Se.stateNode.containerInfo,Zn=!0;break e}Se=Se.return}if(jr===null)throw Error(o(160));yf(G,ie,z),jr=null,Zn=!1}else yf(G,ie,z);var Ne=z.alternate;Ne!==null&&(Ne.return=null),z.return=null}catch(Ge){xr(z,g,Ge)}}if(g.subtreeFlags&12854)for(g=g.child;g!==null;)Vu(g,m),g=g.sibling}function Vu(m,g){var C=m.alternate,M=m.flags;switch(m.tag){case 0:case 11:case 14:case 15:if(Oi(g,m),vi(m),M&4){try{ws(3,m,m.return),_l(3,m)}catch(ot){xr(m,m.return,ot)}try{ws(5,m,m.return)}catch(ot){xr(m,m.return,ot)}}break;case 1:Oi(g,m),vi(m),M&512&&C!==null&&rr(C,C.return);break;case 5:if(Oi(g,m),vi(m),M&512&&C!==null&&rr(C,C.return),Ee){if(m.flags&32){var z=m.stateNode;try{Ce(z)}catch(ot){xr(m,m.return,ot)}}if(M&4&&(z=m.stateNode,z!=null)){var G=m.memoizedProps;if(C=C!==null?C.memoizedProps:G,M=m.type,g=m.updateQueue,m.updateQueue=null,g!==null)try{Ye(z,g,M,C,G,m)}catch(ot){xr(m,m.return,ot)}}}break;case 6:if(Oi(g,m),vi(m),M&4&&Ee){if(m.stateNode===null)throw Error(o(162));z=m.stateNode,G=m.memoizedProps,C=C!==null?C.memoizedProps:G;try{le(z,C,G)}catch(ot){xr(m,m.return,ot)}}break;case 3:if(Oi(g,m),vi(m),M&4){if(Ee&&Le&&C!==null&&C.memoizedState.isDehydrated)try{_i(g.containerInfo)}catch(ot){xr(m,m.return,ot)}if(Fe){z=g.containerInfo,G=g.pendingChildren;try{Vr(z,G)}catch(ot){xr(m,m.return,ot)}}}break;case 4:if(Oi(g,m),vi(m),M&4&&Fe){G=m.stateNode,z=G.containerInfo,G=G.pendingChildren;try{Vr(z,G)}catch(ot){xr(m,m.return,ot)}}break;case 13:Oi(g,m),vi(m),z=m.child,z.flags&8192&&(G=z.memoizedState!==null,z.stateNode.isHidden=G,!G||z.alternate!==null&&z.alternate.memoizedState!==null||(Al=ln())),M&4&&Ss(m);break;case 22:var ie=C!==null&&C.memoizedState!==null;if(m.mode&1?(fn=(C=fn)||ie,Oi(g,m),fn=C):Oi(g,m),vi(m),M&8192){if(C=m.memoizedState!==null,(m.stateNode.isHidden=C)&&!ie&&(m.mode&1)!==0)for(rt=m,M=m.child;M!==null;){for(g=rt=M;rt!==null;){ie=rt;var Se=ie.child;switch(ie.tag){case 0:case 11:case 14:case 15:ws(4,ie,ie.return);break;case 1:rr(ie,ie.return);var Ne=ie.stateNode;if(typeof Ne.componentWillUnmount=="function"){var Ge=ie,mt=ie.return;try{var Mt=Ge;Ne.props=Mt.memoizedProps,Ne.state=Mt.memoizedState,Ne.componentWillUnmount()}catch(ot){xr(Ge,mt,ot)}}break;case 5:rr(ie,ie.return);break;case 22:if(ie.memoizedState!==null){wf(g);continue}}Se!==null?(Se.return=ie,rt=Se):wf(g)}M=M.sibling}if(Ee){e:if(M=null,Ee)for(g=m;;){if(g.tag===5){if(M===null){M=g;try{z=g.stateNode,C?Pt(z):Et(g.stateNode,g.memoizedProps)}catch(ot){xr(m,m.return,ot)}}}else if(g.tag===6){if(M===null)try{G=g.stateNode,C?Ot(G):pt(G,g.memoizedProps)}catch(ot){xr(m,m.return,ot)}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===m)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===m)break e;for(;g.sibling===null;){if(g.return===null||g.return===m)break e;M===g&&(M=null),g=g.return}M===g&&(M=null),g.sibling.return=g.return,g=g.sibling}}}break;case 19:Oi(g,m),vi(m),M&4&&Ss(m);break;case 21:break;default:Oi(g,m),vi(m)}}function vi(m){var g=m.flags;if(g&2){try{if(Ee){e:{for(var C=m.return;C!==null;){if(uh(C)){var M=C;break e}C=C.return}throw Error(o(160))}switch(M.tag){case 5:var z=M.stateNode;M.flags&32&&(Ce(z),M.flags&=-33);var G=xs(m);ch(m,G,z);break;case 3:case 4:var ie=M.stateNode.containerInfo,Se=xs(m);qu(m,Se,ie);break;default:throw Error(o(161))}}}catch(Ne){xr(m,m.return,Ne)}m.flags&=-3}g&4096&&(m.flags&=-4097)}function Pl(m,g,C){rt=m,vf(m)}function vf(m,g,C){for(var M=(m.mode&1)!==0;rt!==null;){var z=rt,G=z.child;if(z.tag===22&&M){var ie=z.memoizedState!==null||kl;if(!ie){var Se=z.alternate,Ne=Se!==null&&Se.memoizedState!==null||fn;Se=kl;var Ge=fn;if(kl=ie,(fn=Ne)&&!Ge)for(rt=z;rt!==null;)ie=rt,Ne=ie.child,ie.tag===22&&ie.memoizedState!==null?xf(z):Ne!==null?(Ne.return=ie,rt=Ne):xf(z);for(;G!==null;)rt=G,vf(G),G=G.sibling;rt=z,kl=Se,fn=Ge}bf(m)}else(z.subtreeFlags&8772)!==0&&G!==null?(G.return=z,rt=G):bf(m)}}function bf(m){for(;rt!==null;){var g=rt;if((g.flags&8772)!==0){var C=g.alternate;try{if((g.flags&8772)!==0)switch(g.tag){case 0:case 11:case 15:fn||_l(5,g);break;case 1:var M=g.stateNode;if(g.flags&4&&!fn)if(C===null)M.componentDidMount();else{var z=g.elementType===g.type?C.memoizedProps:pi(g.type,C.memoizedProps);M.componentDidUpdate(z,C.memoizedState,M.__reactInternalSnapshotBeforeUpdate)}var G=g.updateQueue;G!==null&&sm(g,G,M);break;case 3:var ie=g.updateQueue;if(ie!==null){if(C=null,g.child!==null)switch(g.child.tag){case 5:C=Z(g.child.stateNode);break;case 1:C=g.child.stateNode}sm(g,ie,C)}break;case 5:var Se=g.stateNode;C===null&&g.flags&4&&Ie(Se,g.type,g.memoizedProps,g);break;case 6:break;case 4:break;case 12:break;case 13:if(Le&&g.memoizedState===null){var Ne=g.alternate;if(Ne!==null){var Ge=Ne.memoizedState;if(Ge!==null){var mt=Ge.dehydrated;mt!==null&&La(mt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}fn||g.flags&512&&gf(g)}catch(Mt){xr(g,g.return,Mt)}}if(g===m){rt=null;break}if(C=g.sibling,C!==null){C.return=g.return,rt=C;break}rt=g.return}}function wf(m){for(;rt!==null;){var g=rt;if(g===m){rt=null;break}var C=g.sibling;if(C!==null){C.return=g.return,rt=C;break}rt=g.return}}function xf(m){for(;rt!==null;){var g=rt;try{switch(g.tag){case 0:case 11:case 15:var C=g.return;try{_l(4,g)}catch(Ne){xr(g,C,Ne)}break;case 1:var M=g.stateNode;if(typeof M.componentDidMount=="function"){var z=g.return;try{M.componentDidMount()}catch(Ne){xr(g,z,Ne)}}var G=g.return;try{gf(g)}catch(Ne){xr(g,G,Ne)}break;case 5:var ie=g.return;try{gf(g)}catch(Ne){xr(g,ie,Ne)}}}catch(Ne){xr(g,g.return,Ne)}if(g===m){rt=null;break}var Se=g.sibling;if(Se!==null){Se.return=g.return,rt=Se;break}rt=g.return}}var Wa=0,Bn=1,va=2,El=3,Wu=4;if(typeof Symbol=="function"&&Symbol.for){var bi=Symbol.for;Wa=bi("selector.component"),Bn=bi("selector.has_pseudo_class"),va=bi("selector.role"),El=bi("selector.test_id"),Wu=bi("selector.text")}function ba(m){var g=$e(m);if(g!=null){if(typeof g.memoizedProps["data-testname"]!="string")throw Error(o(364));return g}if(m=Te(m),m===null)throw Error(o(362));return m.stateNode.current}function Gu(m,g){switch(g.$$typeof){case Wa:if(m.type===g.value)return!0;break;case Bn:e:{g=g.value,m=[m,0];for(var C=0;C<m.length;){var M=m[C++],z=m[C++],G=g[z];if(M.tag!==5||!Oe(M)){for(;G!=null&&Gu(M,G);)z++,G=g[z];if(z===g.length){g=!0;break e}else for(M=M.child;M!==null;)m.push(M,z),M=M.sibling}}g=!1}return g;case va:if(m.tag===5&&Be(m.stateNode,g.value))return!0;break;case Wu:if((m.tag===5||m.tag===6)&&(m=xe(m),m!==null&&0<=m.indexOf(g.value)))return!0;break;case El:if(m.tag===5&&(m=m.memoizedProps["data-testname"],typeof m=="string"&&m.toLowerCase()===g.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Sf(m){switch(m.$$typeof){case Wa:return"<"+(T(m.value)||"Unknown")+">";case Bn:return":has("+(Sf(m)||"")+")";case va:return'[role="'+m.value+'"]';case Wu:return'"'+m.value+'"';case El:return'[data-testname="'+m.value+'"]';default:throw Error(o(365))}}function wa(m,g){var C=[];m=[m,0];for(var M=0;M<m.length;){var z=m[M++],G=m[M++],ie=g[G];if(z.tag!==5||!Oe(z)){for(;ie!=null&&Gu(z,ie);)G++,ie=g[G];if(G===g.length)C.push(z);else for(z=z.child;z!==null;)m.push(z,G),z=z.sibling}}return C}function xa(m,g){if(!me)throw Error(o(363));m=ba(m),m=wa(m,g),g=[],m=Array.from(m);for(var C=0;C<m.length;){var M=m[C++];if(M.tag===5)Oe(M)||g.push(M.stateNode);else for(M=M.child;M!==null;)m.push(M),M=M.sibling}return g}var kf=Math.ceil,Xu=s.ReactCurrentDispatcher,Tl=s.ReactCurrentOwner,Nr=s.ReactCurrentBatchConfig,Nt=0,fr=null,Er=null,Ur=0,Jr=0,Oo=hn(0),Tr=0,Cl=null,Ga=0,mr=0,Ol=0,ks=null,En=null,Al=0,Yu=1/0,zn=null;function sr(){Yu=ln()+500}var Lr=!1,Gr=null,Ki=null,Ao=!1,Ai=null,_f=0,Xr=0,Ku=null,Il=-1,Rl=0;function wr(){return(Nt&6)!==0?ln():Il!==-1?Il:Il=ln()}function en(m){return(m.mode&1)===0?1:(Nt&2)!==0&&Ur!==0?Ur&-Ur:B0.transition!==null?(Rl===0&&(Rl=Uc()),Rl):(m=Ut,m!==0?m:dt())}function Tn(m,g,C,M){if(50<Xr)throw Xr=0,Ku=null,Error(o(185));Pi(m,C,M),((Nt&2)===0||m!==fr)&&(m===fr&&((Nt&2)===0&&(mr|=C),Tr===4&&Xa(m,Ur)),Cn(m,M),C===1&&Nt===0&&(g.mode&1)===0&&(sr(),fl&&pn()))}function Cn(m,g){var C=m.callbackNode;Xp(m,g);var M=sl(m,m===fr?Ur:0);if(M===0)C!==null&&Yp(C),m.callbackNode=null,m.callbackPriority=0;else if(g=M&-M,m.callbackPriority!==g){if(C!=null&&Yp(C),g===1)m.tag===0?Qp(fh.bind(null,m)):Wc(fh.bind(null,m)),ge?se(function(){(Nt&6)===0&&pn()}):ha(Hc,pn),C=null;else{switch(ul(M)){case 1:C=Hc;break;case 4:C=$c;break;case 16:C=qc;break;case 536870912:C=F0;break;default:C=qc}C=vh(C,Pf.bind(null,m))}m.callbackPriority=g,m.callbackNode=C}}function Pf(m,g){if(Il=-1,Rl=0,(Nt&6)!==0)throw Error(o(327));var C=m.callbackNode;if(Ya()&&m.callbackNode!==C)return null;var M=sl(m,m===fr?Ur:0);if(M===0)return null;if((M&30)!==0||(M&m.expiredLanes)!==0||g)g=_s(m,M);else{g=M;var z=Nt;Nt|=2;var G=hh();(fr!==m||Ur!==g)&&(zn=null,sr(),Io(m,g));do try{ph();break}catch(Se){Ml(m,Se)}while(!0);Ud(),Xu.current=G,Nt=z,Er!==null?g=0:(fr=null,Ur=0,g=Tr)}if(g!==0){if(g===2&&(z=jc(m),z!==0&&(M=z,g=Ef(m,z))),g===1)throw C=Cl,Io(m,0),Xa(m,M),Cn(m,ln()),C;if(g===6)Xa(m,M);else{if(z=m.current.alternate,(M&30)===0&&!bm(z)&&(g=_s(m,M),g===2&&(G=jc(m),G!==0&&(M=G,g=Ef(m,G))),g===1))throw C=Cl,Io(m,0),Xa(m,M),Cn(m,ln()),C;switch(m.finishedWork=z,m.finishedLanes=M,g){case 0:case 1:throw Error(o(345));case 2:Ro(m,En,zn);break;case 3:if(Xa(m,M),(M&130023424)===M&&(g=Al+500-ln(),10<g)){if(sl(m,0)!==0)break;if(z=m.suspendedLanes,(z&M)!==M){wr(),m.pingedLanes|=m.suspendedLanes&z;break}m.timeoutHandle=ne(Ro.bind(null,m,En,zn),g);break}Ro(m,En,zn);break;case 4:if(Xa(m,M),(M&4194240)===M)break;for(g=m.eventTimes,z=-1;0<M;){var ie=31-ui(M);G=1<<ie,ie=g[ie],ie>z&&(z=ie),M&=~G}if(M=z,M=ln()-M,M=(120>M?120:480>M?480:1080>M?1080:1920>M?1920:3e3>M?3e3:4320>M?4320:1960*kf(M/1960))-M,10<M){m.timeoutHandle=ne(Ro.bind(null,m,En,zn),M);break}Ro(m,En,zn);break;case 5:Ro(m,En,zn);break;default:throw Error(o(329))}}}return Cn(m,ln()),m.callbackNode===C?Pf.bind(null,m):null}function Ef(m,g){var C=ks;return m.current.memoizedState.isDehydrated&&(Io(m,g).flags|=256),m=_s(m,g),m!==2&&(g=En,En=C,g!==null&&Tf(g)),m}function Tf(m){En===null?En=m:En.push.apply(En,m)}function bm(m){for(var g=m;;){if(g.flags&16384){var C=g.updateQueue;if(C!==null&&(C=C.stores,C!==null))for(var M=0;M<C.length;M++){var z=C[M],G=z.getSnapshot;z=z.value;try{if(!qi(G(),z))return!1}catch{return!1}}}if(C=g.child,g.subtreeFlags&16384&&C!==null)C.return=g,g=C;else{if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function Xa(m,g){for(g&=~Ol,g&=~mr,m.suspendedLanes|=g,m.pingedLanes&=~g,m=m.expirationTimes;0<g;){var C=31-ui(g),M=1<<C;m[C]=-1,g&=~M}}function fh(m){if((Nt&6)!==0)throw Error(o(327));Ya();var g=sl(m,0);if((g&1)===0)return Cn(m,ln()),null;var C=_s(m,g);if(m.tag!==0&&C===2){var M=jc(m);M!==0&&(g=M,C=Ef(m,M))}if(C===1)throw C=Cl,Io(m,0),Xa(m,g),Cn(m,ln()),C;if(C===6)throw Error(o(345));return m.finishedWork=m.current.alternate,m.finishedLanes=g,Ro(m,En,zn),Cn(m,ln()),null}function dh(m){Ai!==null&&Ai.tag===0&&(Nt&6)===0&&Ya();var g=Nt;Nt|=1;var C=Nr.transition,M=Ut;try{if(Nr.transition=null,Ut=1,m)return m()}finally{Ut=M,Nr.transition=C,Nt=g,(Nt&6)===0&&pn()}}function Cf(){Jr=Oo.current,vr(Oo)}function Io(m,g){m.finishedWork=null,m.finishedLanes=0;var C=m.timeoutHandle;if(C!==oe&&(m.timeoutHandle=oe,ue(C)),Er!==null)for(C=Er.return;C!==null;){var M=C;switch(Au(M),M.tag){case 1:M=M.type.childContextTypes,M!=null&&es();break;case 3:os(),vr(Xn),vr(kn),Gd();break;case 5:Vd(M);break;case 4:os();break;case 13:vr(Rr);break;case 19:vr(Rr);break;case 10:Ru(M.type._context);break;case 22:case 23:Cf()}C=C.return}if(fr=m,Er=m=Mo(m.current,null),Ur=Jr=g,Tr=0,Cl=null,Ol=mr=Ga=0,En=ks=null,go!==null){for(g=0;g<go.length;g++)if(C=go[g],M=C.interleaved,M!==null){C.interleaved=null;var z=M.next,G=C.pending;if(G!==null){var ie=G.next;G.next=z,M.next=ie}C.pending=M}go=null}return m}function Ml(m,g){do{var C=Er;try{if(Ud(),Qn.current=hs,yl){for(var M=_r.memoizedState;M!==null;){var z=M.queue;z!==null&&(z.pending=null),M=M.next}yl=!1}if(wo=0,Qr=Wr=_r=null,Du=!1,Nu=0,Tl.current=null,C===null||C.return===null){Tr=1,Cl=g,Er=null;break}e:{var G=m,ie=C.return,Se=C,Ne=g;if(g=Ur,Se.flags|=32768,Ne!==null&&typeof Ne=="object"&&typeof Ne.then=="function"){var Ge=Ne,mt=Se,Mt=mt.tag;if((mt.mode&1)===0&&(Mt===0||Mt===11||Mt===15)){var ot=mt.alternate;ot?(mt.updateQueue=ot.updateQueue,mt.memoizedState=ot.memoizedState,mt.lanes=ot.lanes):(mt.updateQueue=null,mt.memoizedState=null)}var gr=mm(ie);if(gr!==null){gr.flags&=-257,ko(gr,ie,Se,G,g),gr.mode&1&&pm(G,Ge,g),g=gr,Ne=Ge;var nr=g.updateQueue;if(nr===null){var jn=new Set;jn.add(Ne),g.updateQueue=jn}else nr.add(Ne);break e}else{if((g&1)===0){pm(G,Ge,g),Dl();break e}Ne=Error(o(426))}}else if(br&&Se.mode&1){var Sa=mm(ie);if(Sa!==null){(Sa.flags&65536)===0&&(Sa.flags|=256),ko(Sa,ie,Se,G,g),zd(ps(Ne,Se));break e}}G=Ne=ps(Ne,Se),Tr!==4&&(Tr=2),ks===null?ks=[G]:ks.push(G),G=ie;do{switch(G.tag){case 3:G.flags|=65536,g&=-g,G.lanes|=g;var Me=ma(G,Ne,g);ml(G,Me);break e;case 1:Se=Ne;var _e=G.type,ze=G.stateNode;if((G.flags&128)===0&&(typeof _e.getDerivedStateFromError=="function"||ze!==null&&typeof ze.componentDidCatch=="function"&&(Ki===null||!Ki.has(ze)))){G.flags|=65536,g&=-g,G.lanes|=g;var st=df(G,Se,g);ml(G,st);break e}}G=G.return}while(G!==null)}gh(C)}catch(St){g=St,Er===C&&C!==null&&(Er=C=C.return);continue}break}while(!0)}function hh(){var m=Xu.current;return Xu.current=hs,m===null?hs:m}function Dl(){(Tr===0||Tr===3||Tr===2)&&(Tr=4),fr===null||(Ga&268435455)===0&&(mr&268435455)===0||Xa(fr,Ur)}function _s(m,g){var C=Nt;Nt|=2;var M=hh();(fr!==m||Ur!==g)&&(zn=null,Io(m,g));do try{wm();break}catch(z){Ml(m,z)}while(!0);if(Ud(),Nt=C,Xu.current=M,Er!==null)throw Error(o(261));return fr=null,Ur=0,Tr}function wm(){for(;Er!==null;)mh(Er)}function ph(){for(;Er!==null&&!Kp();)mh(Er)}function mh(m){var g=Pm(m.alternate,m,Jr);m.memoizedProps=m.pendingProps,g===null?gh(m):Er=g,Tl.current=null}function gh(m){var g=m;do{var C=g.alternate;if(m=g.return,(g.flags&32768)===0){if(C=bs(C,g,Jr),C!==null){Er=C;return}}else{if(C=ym(C,g),C!==null){C.flags&=32767,Er=C;return}if(m!==null)m.flags|=32768,m.subtreeFlags=0,m.deletions=null;else{Tr=6,Er=null;return}}if(g=g.sibling,g!==null){Er=g;return}Er=g=m}while(g!==null);Tr===0&&(Tr=5)}function Ro(m,g,C){var M=Ut,z=Nr.transition;try{Nr.transition=null,Ut=1,xm(m,g,C,M)}finally{Nr.transition=z,Ut=M}return null}function xm(m,g,C,M){do Ya();while(Ai!==null);if((Nt&6)!==0)throw Error(o(327));C=m.finishedWork;var z=m.finishedLanes;if(C===null)return null;if(m.finishedWork=null,m.finishedLanes=0,C===m.current)throw Error(o(177));m.callbackNode=null,m.callbackPriority=0;var G=C.lanes|C.childLanes;if(ho(m,G),m===fr&&(Er=fr=null,Ur=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||Ao||(Ao=!0,vh(qc,function(){return Ya(),null})),G=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||G){G=Nr.transition,Nr.transition=null;var ie=Ut;Ut=1;var Se=Nt;Nt|=4,Tl.current=null,vm(m,C),Vu(C,m),U(m.containerInfo),m.current=C,Pl(C),Tu(),Nt=Se,Ut=ie,Nr.transition=G}else m.current=C;if(Ao&&(Ao=!1,Ai=m,_f=z),G=m.pendingLanes,G===0&&(Ki=null),cl(C.stateNode),Cn(m,ln()),g!==null)for(M=m.onRecoverableError,C=0;C<g.length;C++)z=g[C],M(z.value,{componentStack:z.stack,digest:z.digest});if(Lr)throw Lr=!1,m=Gr,Gr=null,m;return(_f&1)!==0&&m.tag!==0&&Ya(),G=m.pendingLanes,(G&1)!==0?m===Ku?Xr++:(Xr=0,Ku=m):Xr=0,pn(),null}function Ya(){if(Ai!==null){var m=ul(_f),g=Nr.transition,C=Ut;try{if(Nr.transition=null,Ut=16>m?16:m,Ai===null)var M=!1;else{if(m=Ai,Ai=null,_f=0,(Nt&6)!==0)throw Error(o(331));var z=Nt;for(Nt|=4,rt=m.current;rt!==null;){var G=rt,ie=G.child;if((rt.flags&16)!==0){var Se=G.deletions;if(Se!==null){for(var Ne=0;Ne<Se.length;Ne++){var Ge=Se[Ne];for(rt=Ge;rt!==null;){var mt=rt;switch(mt.tag){case 0:case 11:case 15:ws(8,mt,G)}var Mt=mt.child;if(Mt!==null)Mt.return=mt,rt=Mt;else for(;rt!==null;){mt=rt;var ot=mt.sibling,gr=mt.return;if($u(mt),mt===Ge){rt=null;break}if(ot!==null){ot.return=gr,rt=ot;break}rt=gr}}}var nr=G.alternate;if(nr!==null){var jn=nr.child;if(jn!==null){nr.child=null;do{var Sa=jn.sibling;jn.sibling=null,jn=Sa}while(jn!==null)}}rt=G}}if((G.subtreeFlags&2064)!==0&&ie!==null)ie.return=G,rt=ie;else e:for(;rt!==null;){if(G=rt,(G.flags&2048)!==0)switch(G.tag){case 0:case 11:case 15:ws(9,G,G.return)}var Me=G.sibling;if(Me!==null){Me.return=G.return,rt=Me;break e}rt=G.return}}var _e=m.current;for(rt=_e;rt!==null;){ie=rt;var ze=ie.child;if((ie.subtreeFlags&2064)!==0&&ze!==null)ze.return=ie,rt=ze;else e:for(ie=_e;rt!==null;){if(Se=rt,(Se.flags&2048)!==0)try{switch(Se.tag){case 0:case 11:case 15:_l(9,Se)}}catch(St){xr(Se,Se.return,St)}if(Se===ie){rt=null;break e}var st=Se.sibling;if(st!==null){st.return=Se.return,rt=st;break e}rt=Se.return}}if(Nt=z,pn(),Yn&&typeof Yn.onPostCommitFiberRoot=="function")try{Yn.onPostCommitFiberRoot(po,m)}catch{}M=!0}return M}finally{Ut=C,Nr.transition=g}}return!1}function yh(m,g,C){g=ps(C,g),g=ma(m,g,1),m=Ha(m,g,1),g=wr(),m!==null&&(Pi(m,1,g),Cn(m,g))}function xr(m,g,C){if(m.tag===3)yh(m,m,C);else for(;g!==null;){if(g.tag===3){yh(g,m,C);break}else if(g.tag===1){var M=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof M.componentDidCatch=="function"&&(Ki===null||!Ki.has(M))){m=ps(C,m),m=df(g,m,1),g=Ha(g,m,1),m=wr(),g!==null&&(Pi(g,1,m),Cn(g,m));break}}g=g.return}}function Sm(m,g,C){var M=m.pingCache;M!==null&&M.delete(g),g=wr(),m.pingedLanes|=m.suspendedLanes&C,fr===m&&(Ur&C)===C&&(Tr===4||Tr===3&&(Ur&130023424)===Ur&&500>ln()-Al?Io(m,0):Ol|=C),Cn(m,g)}function km(m,g){g===0&&((m.mode&1)===0?g=1:(g=Eu,Eu<<=1,(Eu&130023424)===0&&(Eu=4194304)));var C=wr();m=Xi(m,g),m!==null&&(Pi(m,g,C),Cn(m,C))}function _m(m){var g=m.memoizedState,C=0;g!==null&&(C=g.retryLane),km(m,C)}function U0(m,g){var C=0;switch(m.tag){case 13:var M=m.stateNode,z=m.memoizedState;z!==null&&(C=z.retryLane);break;case 19:M=m.stateNode;break;default:throw Error(o(314))}M!==null&&M.delete(g),km(m,C)}var Pm;Pm=function(m,g,C){if(m!==null)if(m.memoizedProps!==g.pendingProps||Xn.current)Zr=!0;else{if((m.lanes&C)===0&&(g.flags&128)===0)return Zr=!1,Po(m,g,C);Zr=(m.flags&131072)!==0}else Zr=!1,br&&(g.flags&1048576)!==0&&Zp(g,ts,g.index);switch(g.lanes=0,g.tag){case 2:var M=g.type;Hu(m,g),m=g.pendingProps;var z=Ba(g,kn.current);pl(g,C),z=Lu(null,g,M,m,z,C);var G=rf();return g.flags|=1,typeof z=="object"&&z!==null&&typeof z.render=="function"&&z.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,sn(M)?(G=!0,al(g)):G=!1,g.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,$d(g),z.updater=zu,g.stateNode=z,z._reactInternals=g,pa(g,M,m,C),g=_n(null,g,M,!0,G,C)):(g.tag=0,br&&G&&Ou(g),cn(null,g,z,C),g=g.child),g;case 16:M=g.elementType;e:{switch(Hu(m,g),m=g.pendingProps,z=M._init,M=z(M._payload),g.type=M,z=g.tag=H0(M),m=pi(M,m),z){case 0:g=ga(null,g,M,m,C);break e;case 1:g=yn(null,g,M,m,C);break e;case 11:g=hf(null,g,M,m,C);break e;case 14:g=ms(null,g,M,pi(M.type,m),C);break e}throw Error(o(306,M,""))}return g;case 0:return M=g.type,z=g.pendingProps,z=g.elementType===M?z:pi(M,z),ga(m,g,M,z,C);case 1:return M=g.type,z=g.pendingProps,z=g.elementType===M?z:pi(M,z),yn(m,g,M,z,C);case 3:e:{if(_o(g),m===null)throw Error(o(387));M=g.pendingProps,G=g.memoizedState,z=G.element,om(m,g),yo(g,M,null,C);var ie=g.memoizedState;if(M=ie.element,Le&&G.isDehydrated)if(G={element:M,isDehydrated:!1,cache:ie.cache,pendingSuspenseBoundaries:ie.pendingSuspenseBoundaries,transitions:ie.transitions},g.updateQueue.baseState=G,g.memoizedState=G,g.flags&256){z=ps(Error(o(423)),g),g=gs(m,g,M,C,z);break e}else if(M!==z){z=ps(Error(o(424)),g),g=gs(m,g,M,C,z);break e}else for(Le&&(Dn=Na(g.stateNode.containerInfo),mn=g,br=!0,Gi=null,Iu=!1),C=im(g,null,M,C),g.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(rs(),M===z){g=Va(m,g,C);break e}cn(m,g,M,C)}g=g.child}return g;case 5:return qd(g),m===null&&Bd(g),M=g.type,z=g.pendingProps,G=m!==null?m.memoizedProps:null,ie=z.children,te(M,z)?ie=null:G!==null&&te(M,G)&&(g.flags|=32),cr(m,g),cn(m,g,ie,C),g.child;case 6:return m===null&&Bd(g),null;case 13:return sh(m,g,C);case 4:return ef(g,g.stateNode.containerInfo),M=g.pendingProps,m===null?g.child=is(g,null,M,C):cn(m,g,M,C),g.child;case 11:return M=g.type,z=g.pendingProps,z=g.elementType===M?z:pi(M,z),hf(m,g,M,z,C);case 7:return cn(m,g,g.pendingProps,C),g.child;case 8:return cn(m,g,g.pendingProps.children,C),g.child;case 12:return cn(m,g,g.pendingProps.children,C),g.child;case 10:e:{if(M=g.type._context,z=g.pendingProps,G=g.memoizedProps,ie=z.value,am(g,M,ie),G!==null)if(qi(G.value,ie)){if(G.children===z.children&&!Xn.current){g=Va(m,g,C);break e}}else for(G=g.child,G!==null&&(G.return=g);G!==null;){var Se=G.dependencies;if(Se!==null){ie=G.child;for(var Ne=Se.firstContext;Ne!==null;){if(Ne.context===M){if(G.tag===1){Ne=Ua(-1,C&-C),Ne.tag=2;var Ge=G.updateQueue;if(Ge!==null){Ge=Ge.shared;var mt=Ge.pending;mt===null?Ne.next=Ne:(Ne.next=mt.next,mt.next=Ne),Ge.pending=Ne}}G.lanes|=C,Ne=G.alternate,Ne!==null&&(Ne.lanes|=C),as(G.return,C,g),Se.lanes|=C;break}Ne=Ne.next}}else if(G.tag===10)ie=G.type===g.type?null:G.child;else if(G.tag===18){if(ie=G.return,ie===null)throw Error(o(341));ie.lanes|=C,Se=ie.alternate,Se!==null&&(Se.lanes|=C),as(ie,C,g),ie=G.sibling}else ie=G.child;if(ie!==null)ie.return=G;else for(ie=G;ie!==null;){if(ie===g){ie=null;break}if(G=ie.sibling,G!==null){G.return=ie.return,ie=G;break}ie=ie.return}G=ie}cn(m,g,z.children,C),g=g.child}return g;case 9:return z=g.type,M=g.pendingProps.children,pl(g,C),z=fi(z),M=M(z),g.flags|=1,cn(m,g,M,C),g.child;case 14:return M=g.type,z=pi(M,g.pendingProps),z=pi(M.type,z),ms(m,g,M,z,C);case 15:return qa(m,g,g.type,g.pendingProps,C);case 17:return M=g.type,z=g.pendingProps,z=g.elementType===M?z:pi(M,z),Hu(m,g),g.tag=1,sn(M)?(m=!0,al(g)):m=!1,pl(g,C),hm(g,M,z),pa(g,M,z,C),_n(null,g,M,!0,m,C);case 19:return mf(m,g,C);case 22:return pr(m,g,C)}throw Error(o(156,g.tag))};function vh(m,g){return ha(m,g)}function Em(m,g,C,M){this.tag=m,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wi(m,g,C,M){return new Em(m,g,C,M)}function Nl(m){return m=m.prototype,!(!m||!m.isReactComponent)}function H0(m){if(typeof m=="function")return Nl(m)?1:0;if(m!=null){if(m=m.$$typeof,m===b)return 11;if(m===S)return 14}return 2}function Mo(m,g){var C=m.alternate;return C===null?(C=wi(m.tag,g,m.key,m.mode),C.elementType=m.elementType,C.type=m.type,C.stateNode=m.stateNode,C.alternate=m,m.alternate=C):(C.pendingProps=g,C.type=m.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=m.flags&14680064,C.childLanes=m.childLanes,C.lanes=m.lanes,C.child=m.child,C.memoizedProps=m.memoizedProps,C.memoizedState=m.memoizedState,C.updateQueue=m.updateQueue,g=m.dependencies,C.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},C.sibling=m.sibling,C.index=m.index,C.ref=m.ref,C}function Of(m,g,C,M,z,G){var ie=2;if(M=m,typeof m=="function")Nl(m)&&(ie=1);else if(typeof m=="string")ie=5;else e:switch(m){case d:return vn(C.children,z,G,g);case h:ie=8,z|=8;break;case p:return m=wi(12,C,g,z|2),m.elementType=p,m.lanes=G,m;case x:return m=wi(13,C,g,z),m.elementType=x,m.lanes=G,m;case k:return m=wi(19,C,g,z),m.elementType=k,m.lanes=G,m;case _:return Ll(C,z,G,g);default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case y:ie=10;break e;case v:ie=9;break e;case b:ie=11;break e;case S:ie=14;break e;case P:ie=16,M=null;break e}throw Error(o(130,m==null?m:typeof m,""))}return g=wi(ie,C,g,z),g.elementType=m,g.type=M,g.lanes=G,g}function vn(m,g,C,M){return m=wi(7,m,M,g),m.lanes=C,m}function Ll(m,g,C,M){return m=wi(22,m,M,g),m.elementType=_,m.lanes=C,m.stateNode={isHidden:!1},m}function Fl(m,g,C){return m=wi(6,m,null,g),m.lanes=C,m}function Af(m,g,C){return g=wi(4,m.children!==null?m.children:[],m.key,g),g.lanes=C,g.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},g}function Tm(m,g,C,M,z){this.tag=g,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=oe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ll(0),this.expirationTimes=ll(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ll(0),this.identifierPrefix=M,this.onRecoverableError=z,Le&&(this.mutableSourceEagerHydrationData=null)}function bh(m,g,C,M,z,G,ie,Se,Ne){return m=new Tm(m,g,C,Se,Ne),g===1?(g=1,G===!0&&(g|=8)):g=0,G=wi(3,null,null,g),m.current=G,G.stateNode=m,G.memoizedState={element:M,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},$d(G),m}function If(m){if(!m)return fo;m=m._reactInternals;e:{if(L(m)!==m||m.tag!==1)throw Error(o(170));var g=m;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(sn(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(o(171))}if(m.tag===1){var C=m.type;if(sn(C))return Wp(m,C,g)}return g}function Ps(m){var g=m._reactInternals;if(g===void 0)throw typeof m.render=="function"?Error(o(188)):(m=Object.keys(m).join(","),Error(o(268,m)));return m=F(g),m===null?null:m.stateNode}function Rf(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var C=m.retryLane;m.retryLane=C!==0&&C<g?C:g}}function Bl(m,g){Rf(m,g),(m=m.alternate)&&Rf(m,g)}function $0(m){return m=F(m),m===null?null:m.stateNode}function Cm(){return null}return r.attemptContinuousHydration=function(m){if(m.tag===13){var g=Xi(m,134217728);if(g!==null){var C=wr();Tn(g,m,134217728,C)}Bl(m,134217728)}},r.attemptDiscreteHydration=function(m){if(m.tag===13){var g=Xi(m,1);if(g!==null){var C=wr();Tn(g,m,1,C)}Bl(m,1)}},r.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13){var g=en(m),C=Xi(m,g);if(C!==null){var M=wr();Tn(C,m,g,M)}Bl(m,g)}},r.attemptSynchronousHydration=function(m){switch(m.tag){case 3:var g=m.stateNode;if(g.current.memoizedState.isDehydrated){var C=ol(g.pendingLanes);C!==0&&(da(g,C|1),Cn(g,ln()),(Nt&6)===0&&(sr(),pn()))}break;case 13:dh(function(){var M=Xi(m,1);if(M!==null){var z=wr();Tn(M,m,1,z)}}),Bl(m,1)}},r.batchedUpdates=function(m,g){var C=Nt;Nt|=1;try{return m(g)}finally{Nt=C,Nt===0&&(sr(),fl&&pn())}},r.createComponentSelector=function(m){return{$$typeof:Wa,value:m}},r.createContainer=function(m,g,C,M,z,G,ie){return bh(m,g,!1,null,C,M,z,G,ie)},r.createHasPseudoClassSelector=function(m){return{$$typeof:Bn,value:m}},r.createHydrationContainer=function(m,g,C,M,z,G,ie,Se,Ne){return m=bh(C,M,!0,m,z,G,ie,Se,Ne),m.context=If(null),C=m.current,M=wr(),z=en(C),G=Ua(M,z),G.callback=g??null,Ha(C,G,z),m.current.lanes=z,Pi(m,z,M),Cn(m,M),m},r.createPortal=function(m,g,C){var M=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:M==null?null:""+M,children:m,containerInfo:g,implementation:C}},r.createRoleSelector=function(m){return{$$typeof:va,value:m}},r.createTestNameSelector=function(m){return{$$typeof:El,value:m}},r.createTextSelector=function(m){return{$$typeof:Wu,value:m}},r.deferredUpdates=function(m){var g=Ut,C=Nr.transition;try{return Nr.transition=null,Ut=16,m()}finally{Ut=g,Nr.transition=C}},r.discreteUpdates=function(m,g,C,M,z){var G=Ut,ie=Nr.transition;try{return Nr.transition=null,Ut=1,m(g,C,M,z)}finally{Ut=G,Nr.transition=ie,Nt===0&&sr()}},r.findAllNodes=xa,r.findBoundingRects=function(m,g){if(!me)throw Error(o(363));g=xa(m,g),m=[];for(var C=0;C<g.length;C++)m.push(ae(g[C]));for(g=m.length-1;0<g;g--){C=m[g];for(var M=C.x,z=M+C.width,G=C.y,ie=G+C.height,Se=g-1;0<=Se;Se--)if(g!==Se){var Ne=m[Se],Ge=Ne.x,mt=Ge+Ne.width,Mt=Ne.y,ot=Mt+Ne.height;if(M>=Ge&&G>=Mt&&z<=mt&&ie<=ot){m.splice(g,1);break}else if(M!==Ge||C.width!==Ne.width||ot<G||Mt>ie){if(!(G!==Mt||C.height!==Ne.height||mt<M||Ge>z)){Ge>M&&(Ne.width+=Ge-M,Ne.x=M),mt<z&&(Ne.width=z-Ge),m.splice(g,1);break}}else{Mt>G&&(Ne.height+=Mt-G,Ne.y=G),ot<ie&&(Ne.height=ie-Mt),m.splice(g,1);break}}}return m},r.findHostInstance=Ps,r.findHostInstanceWithNoPortals=function(m){return m=N(m),m=m!==null?$(m):null,m===null?null:m.stateNode},r.findHostInstanceWithWarning=function(m){return Ps(m)},r.flushControlled=function(m){var g=Nt;Nt|=1;var C=Nr.transition,M=Ut;try{Nr.transition=null,Ut=1,m()}finally{Ut=M,Nr.transition=C,Nt=g,Nt===0&&(sr(),pn())}},r.flushPassiveEffects=Ya,r.flushSync=dh,r.focusWithin=function(m,g){if(!me)throw Error(o(363));for(m=ba(m),g=wa(m,g),g=Array.from(g),m=0;m<g.length;){var C=g[m++];if(!Oe(C)){if(C.tag===5&&ct(C.stateNode))return!0;for(C=C.child;C!==null;)g.push(C),C=C.sibling}}return!1},r.getCurrentUpdatePriority=function(){return Ut},r.getFindAllNodesFailureDescription=function(m,g){if(!me)throw Error(o(363));var C=0,M=[];m=[ba(m),0];for(var z=0;z<m.length;){var G=m[z++],ie=m[z++],Se=g[ie];if((G.tag!==5||!Oe(G))&&(Gu(G,Se)&&(M.push(Sf(Se)),ie++,ie>C&&(C=ie)),ie<g.length))for(G=G.child;G!==null;)m.push(G,ie),G=G.sibling}if(C<g.length){for(m=[];C<g.length;C++)m.push(Sf(g[C]));return`findAllNodes was able to match part of the selector:
31
+ `+(M.join(" > ")+`
32
+
33
+ No matching component was found for:
34
+ `)+m.join(" > ")}return null},r.getPublicRootInstance=function(m){return m=m.current,m.child?m.child.tag===5?Z(m.child.stateNode):m.child.stateNode:null},r.injectIntoDevTools=function(m){if(m={bundleType:m.bundleType,version:m.version,rendererPackageName:m.rendererPackageName,rendererConfig:m.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:s.ReactCurrentDispatcher,findHostInstanceByFiber:$0,findFiberByHostInstance:m.findFiberByHostInstance||Cm,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)m=!0;else{try{po=g.inject(m),Yn=g}catch{}m=!!g.checkDCE}}return m},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(m,g,C,M){if(!me)throw Error(o(363));m=xa(m,g);var z=be(m,C,M).disconnect;return{disconnect:function(){z()}}},r.registerMutableSourceForHydration=function(m,g){var C=g._getVersion;C=C(g._source),m.mutableSourceEagerHydrationData==null?m.mutableSourceEagerHydrationData=[g,C]:m.mutableSourceEagerHydrationData.push(g,C)},r.runWithPriority=function(m,g){var C=Ut;try{return Ut=m,g()}finally{Ut=C}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(m,g,C,M){var z=g.current,G=wr(),ie=en(z);return C=If(C),g.context===null?g.context=C:g.pendingContext=C,g=Ua(G,ie),g.payload={element:m},M=M===void 0?null:M,M!==null&&(g.callback=M),m=Ha(z,g,ie),m!==null&&(Tn(m,z,ie,G),Mu(m,z,ie)),ie},r}),M1}var Hw;function O7(){return Hw||(Hw=1,R1.exports=C7()),R1.exports}var A7=O7();const I7=Ec(A7);var D1={exports:{}},Wl={};var $w;function R7(){return $w||($w=1,Wl.ConcurrentRoot=1,Wl.ContinuousEventPriority=4,Wl.DefaultEventPriority=16,Wl.DiscreteEventPriority=1,Wl.IdleEventPriority=536870912,Wl.LegacyRoot=0),Wl}var qw;function M7(){return qw||(qw=1,D1.exports=R7()),D1.exports}var A5=M7();const Vw={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let Ww=!1,Gw=!1;const C2=".react-konva-event",D7=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
35
+ Position of a node will be changed during drag&drop, so you should update state of the react app as well.
36
+ Consider to add onDragMove or onDragEnd events.
37
+ For more info see: https://github.com/konvajs/react-konva/issues/256
38
+ `,N7=`ReactKonva: You are using "zIndex" attribute for a Konva node.
39
+ react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
40
+ For more info see: https://github.com/konvajs/react-konva/issues/194
41
+ `,L7={};function g0(t,e,r=L7){if(!Ww&&"zIndex"in e&&(console.warn(N7),Ww=!0),!Gw&&e.draggable){var n=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;n&&!i&&(console.warn(D7),Gw=!0)}for(var a in r)if(!Vw[a]){var o=a.slice(0,2)==="on",s=r[a]!==e[a];if(o&&s){var u=a.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t.off(u,r[a])}var f=!e.hasOwnProperty(a);f&&t.setAttr(a,void 0)}var d=e._useStrictMode,h={},p=!1;const y={};for(var a in e)if(!Vw[a]){var o=a.slice(0,2)==="on",v=r[a]!==e[a];if(o&&v){var u=a.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e[a]&&(y[u]=e[a])}!o&&(e[a]!==r[a]||d&&e[a]!==t.getAttr(a))&&(p=!0,h[a]=e[a])}p&&(t.setAttrs(h),bu(t));for(var u in y)t.on(u+C2,y[u])}function bu(t){if(!et.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}var N1=f2();const I5={},F7={};kc.Node.prototype._applyProps=g0;function B7(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),bu(t)}function z7(t,e,r){let n=kc[t];n||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),n=kc.Group);const i={},a={};for(var o in e){var s=o.slice(0,2)==="on";s?a[o]=e[o]:i[o]=e[o]}const u=new n(i);return g0(u,a),u}function j7(t,e,r){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function U7(t,e,r){return!1}function H7(t){return t}function $7(){return null}function q7(){return null}function V7(t,e,r,n){return F7}function W7(){}function G7(t){}function X7(t,e){return!1}function Y7(){return I5}function K7(){return I5}const Q7=setTimeout,Z7=clearTimeout,J7=-1;function eT(t,e){return!1}const tT=!1,rT=!0,nT=!0;function iT(t,e){e.parent===t?e.moveToTop():t.add(e),bu(t)}function aT(t,e){e.parent===t?e.moveToTop():t.add(e),bu(t)}function R5(t,e,r){e._remove(),t.add(e),e.setZIndex(r.getZIndex()),bu(t)}function oT(t,e,r){R5(t,e,r)}function sT(t,e){e.destroy(),e.off(C2),bu(t)}function lT(t,e){e.destroy(),e.off(C2),bu(t)}function uT(t,e,r){console.error(`Text components are not yet supported in ReactKonva. You text is: "${r}"`)}function cT(t,e,r){}function fT(t,e,r,n,i){g0(t,i,n)}function dT(t){t.hide(),bu(t)}function hT(t){}function pT(t,e){(e.visible==null||e.visible)&&t.show()}function mT(t,e){}function gT(t){}function yT(){}const vT=()=>A5.DefaultEventPriority,bT=Object.freeze(Object.defineProperty({__proto__:null,appendChild:iT,appendChildToContainer:aT,appendInitialChild:B7,cancelTimeout:Z7,clearContainer:gT,commitMount:cT,commitTextUpdate:uT,commitUpdate:fT,createInstance:z7,createTextInstance:j7,detachDeletedInstance:yT,finalizeInitialChildren:U7,getChildHostContext:K7,getCurrentEventPriority:vT,getPublicInstance:H7,getRootHostContext:Y7,hideInstance:dT,hideTextInstance:hT,idlePriority:N1.unstable_IdlePriority,insertBefore:R5,insertInContainerBefore:oT,isPrimaryRenderer:tT,noTimeout:J7,now:N1.unstable_now,prepareForCommit:$7,preparePortalMount:q7,prepareUpdate:V7,removeChild:sT,removeChildFromContainer:lT,resetAfterCommit:W7,resetTextContent:G7,run:N1.unstable_runWithPriority,scheduleTimeout:Q7,shouldDeprioritizeSubtree:X7,shouldSetTextContent:eT,supportsMutation:nT,unhideInstance:pT,unhideTextInstance:mT,warnsIfNotActing:rT},Symbol.toStringTag,{value:"Module"}));var wT=Object.defineProperty,xT=Object.defineProperties,ST=Object.getOwnPropertyDescriptors,Xw=Object.getOwnPropertySymbols,kT=Object.prototype.hasOwnProperty,_T=Object.prototype.propertyIsEnumerable,Yw=(t,e,r)=>e in t?wT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kw=(t,e)=>{for(var r in e||(e={}))kT.call(e,r)&&Yw(t,r,e[r]);if(Xw)for(var r of Xw(e))_T.call(e,r)&&Yw(t,r,e[r]);return t},PT=(t,e)=>xT(t,ST(e)),Qw,Zw;typeof window<"u"&&((Qw=window.document)!=null&&Qw.createElement||((Zw=window.navigator)==null?void 0:Zw.product)==="ReactNative")?Hr.useLayoutEffect:Hr.useEffect;function M5(t,e,r){if(!t)return;if(r(t)===!0)return t;let n=t.child;for(;n;){const i=M5(n,e,r);if(i)return i;n=n.sibling}}function D5(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const Jw=console.error;console.error=function(){const t=[...arguments].join("");if(t?.startsWith("Warning:")&&t.includes("useContext")){console.error=Jw;return}return Jw.apply(this,arguments)};const O2=D5(Hr.createContext(null));class N5 extends Hr.Component{render(){return Hr.createElement(O2.Provider,{value:this._reactInternals},this.props.children)}}function ET(){const t=Hr.useContext(O2);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Hr.useId();return Hr.useMemo(()=>{for(const n of[t,t?.alternate]){if(!n)continue;const i=M5(n,!1,a=>{let o=a.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function TT(){const t=ET(),[e]=Hr.useState(()=>new Map);e.clear();let r=t;for(;r;){if(r.type&&typeof r.type=="object"){const i=r.type._context===void 0&&r.type.Provider===r.type?r.type:r.type._context;i&&i!==O2&&!e.has(i)&&e.set(i,Hr.useContext(D5(i)))}r=r.return}return e}function L5(){const t=TT();return Hr.useMemo(()=>Array.from(t.keys()).reduce((e,r)=>n=>Hr.createElement(e,null,Hr.createElement(r.Provider,PT(Kw({},n),{value:t.get(r)}))),e=>Hr.createElement(N5,Kw({},e))),[t])}function CT(t){const e=Y.useRef({});return Y.useLayoutEffect(()=>{e.current=t}),Y.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const OT=t=>{const e=Y.useRef(null),r=Y.useRef(null),n=Y.useRef(null),i=CT(t),a=L5(),o=s=>{const{forwardedRef:u}=t;u&&(typeof u=="function"?u(s):u.current=s)};return Y.useLayoutEffect(()=>(r.current=new kc.Stage({width:t.width,height:t.height,container:e.current}),o(r.current),n.current=Wh.createContainer(r.current,A5.LegacyRoot,!1,null),Wh.updateContainer(Y.createElement(a,{},t.children),n.current),()=>{kc.isBrowser&&(o(null),Wh.updateContainer(null,n.current,null),r.current.destroy())}),[]),Y.useLayoutEffect(()=>{o(r.current),g0(r.current,t,i),Wh.updateContainer(Y.createElement(a,{},t.children),n.current,null)}),Y.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},AT="Layer",Jt="Group",Bg="Label",ur="Rect",IT="Circle",js="Line",zo="Image",qo="Text",RT="TextPath",A2="Arc",zg="Tag",gp="Path",yp="Transformer",Wh=I7(bT);Wh.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Y.version,rendererPackageName:"react-konva"});const MT=Y.forwardRef((t,e)=>Y.createElement(N5,{},Y.createElement(OT,{...t,forwardedRef:e})));var L1,e3;function DT(){if(e3)return L1;e3=1;var t=Ap();return L1=function(r,n,i){const a=t.useRef("loading"),o=t.useRef(),[s,u]=t.useState(0),f=t.useRef(),d=t.useRef(),h=t.useRef();return(f.current!==r||d.current!==n||h.current!==i)&&(a.current="loading",o.current=void 0,f.current=r,d.current=n,h.current=i),t.useLayoutEffect(function(){if(!r)return;var p=document.createElement("img");function y(){p.decode().catch(()=>{}).finally(()=>{a.current="loaded",o.current=p,u(Math.random())})}function v(){a.current="failed",o.current=void 0,u(Math.random())}return p.addEventListener("load",y),p.addEventListener("error",v),n&&(p.crossOrigin=n),i&&(p.referrerPolicy=i),p.src=r,function(){p.removeEventListener("load",y),p.removeEventListener("error",v)}},[r,n,i]),[o.current,a.current]},L1}var NT=DT();const I2=Ec(NT);var LT=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r};const FT=t=>{const e=window.getComputedStyle(t).position;return!(e==="absolute"||e==="relative")};function BT(t=()=>{}){const e=Y.useRef(t);return e.current=t,Y.useCallback((...r)=>e.current.apply(null,r),[])}const jg=({children:t,groupProps:e,divProps:r,transform:n,transformFunc:i,parentNodeFunc:a})=>{const o=L5(),s=Y.useRef(null),[u]=Y.useState(()=>document.createElement("div")),f=Y.useMemo(()=>Zx.createRoot(u),[u]),d=n??!0,h=BT(()=>{if(d&&s.current){let x=s.current.getAbsoluteTransform().decompose();i&&(x=i(x)),u.style.position="absolute",u.style.zIndex="10",u.style.top="0px",u.style.left="0px",u.style.transform=`translate(${x.x}px, ${x.y}px) rotate(${x.rotation}deg) scaleX(${x.scaleX}) scaleY(${x.scaleY})`,u.style.transformOrigin="top left"}else u.style.position="",u.style.zIndex="",u.style.top="",u.style.left="",u.style.transform="",u.style.transformOrigin="";const p=r||{},{style:y}=p,v=LT(p,["style"]);Object.assign(u.style,y),Object.assign(u,v)});return Y.useLayoutEffect(()=>{var p;const y=s.current;if(!y)return;const v=a?a({stage:y.getStage()}):(p=y.getStage())===null||p===void 0?void 0:p.container();if(v)return v.appendChild(u),d&&FT(v)&&(v.style.position="relative"),y.on("absoluteTransformChange",h),h(),()=>{var b;y.off("absoluteTransformChange",h),(b=u.parentNode)===null||b===void 0||b.removeChild(u)}},[d,a]),Y.useLayoutEffect(()=>{h()},[r,i]),Y.useLayoutEffect(()=>{queueMicrotask(()=>{KS.flushSync(()=>{f.render(Y.createElement(o,null,t))})})}),Y.useLayoutEffect(()=>()=>{setTimeout(()=>{f.unmount()})},[]),Y.createElement(Jt,Object.assign({ref:s},e))},R2=({selector:t,enabled:e,children:r})=>{const n=Y.useRef(null),i=Y.useRef(null),a=Y.useRef(null),o=e??!0;return Y.useLayoutEffect(()=>{if(!n.current||!i.current)return;a.current=i.current;const u=n.current.getStage().findOne(t);o&&u?i.current.moveTo(u):i.current.moveTo(n.current);const f=n.current.getLayer();if(f&&(f.batchDraw(),u)){const d=u.getLayer();if(!d)return;d.batchDraw()}},[t,o]),Y.useEffect(()=>()=>{var s;(s=a.current)===null||s===void 0||s.destroy()},[]),Y.createElement(Jt,{name:"_outer_portal",ref:n},Y.createElement(Jt,{name:"_inner_portal",ref:i},r))};function F5(t,e,r){const n=e-1,i=r[z5(n,r.length)];return i.marker!=="Z"?i:F5(t,n,r)}function B5(t,e,r){const n=e+1,i=r[z5(n,r.length)];return i.marker==="Z"?B5(t,n,r):i}function zT(t,e,r){let n=r[e-1]||{values:{x:0,y:0}};if(t.marker===t.marker.toLowerCase())switch(t.marker=t.marker.toUpperCase(),t.marker){case"M":t.values.x+=n.values.x,t.values.y+=n.values.y;break;case"L":case"A":t.values.x+=n.values.x,t.values.y+=n.values.y;break;case"H":t.marker="L",t.values.x+=n.values.x,t.values.y=n.values.y;break;case"V":t.marker="L",t.values.x=n.values.x,t.values.y+=n.values.y;break;case"C":t.values.x+=n.values.x,t.values.y+=n.values.y,t.values.x1+=n.values.x,t.values.y1+=n.values.y,t.values.x2+=n.values.x,t.values.y2+=n.values.y;break;case"S":t.values.x+=n.values.x,t.values.y+=n.values.y,t.values.x2+=n.values.x,t.values.y2+=n.values.y;break;case"Q":t.values.x+=n.values.x,t.values.y+=n.values.y,t.values.x1+=n.values.x,t.values.y1+=n.values.y;break;case"T":t.values.x+=n.values.x,t.values.y+=n.values.y;break}else if(t.marker===t.marker.toUpperCase())switch(t.marker){case"H":t.marker="L",t.values.y=n.values.y;break;case"V":t.marker="L",t.values.x=n.values.x;break}if(t.marker==="Z"){let i=function(o,s){return o[s].marker==="M"?o[s]:i(o,s-1)},a=i(r,e);t.values.x=a.values.x,t.values.y=a.values.y}return t}function jT(t,e){const r=[];switch(t.toUpperCase()){case"M":for(let n=0;n<e.length;n+=2){let i;t===t.toUpperCase()?i=n===0?"M":"L":i=n===0?"m":"l",r.push({marker:i,values:{x:e[n],y:e[n+1]}})}break;case"L":for(let n=0;n<e.length;n+=2)r.push({marker:t,values:{x:e[n],y:e[n+1]}});break;case"H":for(let n=0;n<e.length;n++)r.push({marker:t,values:{x:e[n],y:0}});break;case"V":for(let n=0;n<e.length;n++)r.push({marker:t,values:{x:0,y:e[n]}});break;case"C":for(let n=0;n<e.length;n+=6)r.push({marker:t,values:{x1:e[n],y1:e[n+1],x2:e[n+2],y2:e[n+3],x:e[n+4],y:e[n+5]}});break;case"S":for(let n=0;n<e.length;n+=4)r.push({marker:t,values:{x2:e[n],y2:e[n+1],x:e[n+2],y:e[n+3]}});break;case"Q":for(let n=0;n<e.length;n+=4)r.push({marker:t,values:{x1:e[n],y1:e[n+1],x:e[n+2],y:e[n+3]}});break;case"T":for(let n=0;n<e.length;n+=2)r.push({marker:t,values:{x:e[n],y:e[n+1]}});break;case"A":for(let n=0;n<e.length;n+=7)r.push({marker:t,values:{radiusX:e[n],radiusY:e[n+1],rotation:e[n+2],largeArc:e[n+3],sweep:e[n+4],x:e[n+5],y:e[n+6]}});break;case"Z":r.push({marker:t,values:{x:0,y:0}});break}return r}function z5(t,e){return(t%e+e)%e}function UT(t,e,r){if(e!==0&&t.marker==="L"){let n=r[e-1];["x","y"].every(a=>Math.round(Math.abs(n.values[a]-t.values[a]))===0)&&(t.overlap=!0)}return t}function $v(t,e){const r=["x","y"].every(n=>Math.round(Math.abs(t[e].values[n]-t[0].values[n]))===0);t[e].marker==="L"&&r&&(t[e].overlap=!0,$v(t,e-1)),t[e].marker==="Z"&&$v(t,e-1)}function HT(t,e,r){const n=r3(t.values,r.values),i=r3(e.values,t.values);return Math.min(i,n)}function t3(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}function r3(t,e){const r=t.x-e.x,n=t.y-e.y;return Math.sqrt(Math.pow(r,2)+Math.pow(n,2))}function n3(t,e){return Math.sin(t)*e}function i3(t,e){return Math.cos(t)*e}function a3(t,e){const r=e/Math.tan(t);return r===1/0||r===-1/0||isNaN(r)?e:r}function $T(t,e){return e*Math.tan(t)}function qT(t,e){let r,n=0,i=t*(180/Math.PI);return i<0&&i>=-180||i>180&&i<360?r=a3(t/2,-e):(r=a3(t/2,e),n=1,r===1/0&&(r=e)),{offset:r,sweepFlag:n}}function VT(t){const e=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return t.map(r=>{let n="";if(r.marker!=="Z"){const i=Object.keys(r.values);n=e.filter(a=>i.indexOf(a)!==-1).map(a=>r.values[a]).join()}return`${r.marker}${n}`}).join("").trim()}function o3(t){const e=/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g,r=/-?[0-9]*\.?\d+/g;return[...t.matchAll(e)].map(n=>({marker:n[0],index:n.index})).reduceRight((n,i)=>{const a=t.substring(i.index,n.length?n[n.length-1].index:t.length);return n.concat([{marker:i.marker,index:i.index,chunk:a.length>0?a.substr(1,a.length-1):a}])},[]).reverse().flatMap(n=>{const i=n.chunk.match(r),a=i?i.map(parseFloat):[];return jT(n.marker,a)}).map(zT)}function s3(t,e,r){let n=[],i=[];return t.forEach(a=>{a.marker==="M"&&n.push([]),n[n.length-1].push(a)}),n.forEach(a=>{a.map(UT),$v(a,a.length-1);const o=a[a.length-1].marker=="Z";a.filter(s=>!s.overlap).map((s,u,f)=>{const h=F5(s,u,f),p=B5(s,u,f),y=t3(s.values,h.values),v=t3(s.values,p.values),b=v-y,x=b*(180/Math.PI),k=HT(s,h,p),S=Math.abs($T(b/2,k/2)),P=Math.min(e,S),_=qT(b,P),E=_.offset,A=_.sweepFlag,T=(u==0||u==f.length-1)&&!o;switch(s.marker){case"M":case"L":const I=[s.values.x+n3(y,E),s.values.y+i3(y,E)],L=[s.values.x+n3(v,E),s.values.y+i3(v,E)];T?i.push({marker:s.marker,values:s.values}):i.push({marker:s.marker,values:{x:parseFloat(I[0].toFixed(3)),y:parseFloat(I[1].toFixed(3))}}),!T&&(p.marker==="L"||p.marker==="M")&&i.push({marker:"A",radius:P,values:{radiusX:parseFloat(P.toFixed(3)),radiusY:parseFloat(P.toFixed(3)),rotation:x,largeArc:0,sweep:A,x:parseFloat(L[0].toFixed(3)),y:parseFloat(L[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":i.push({marker:s.marker,values:s.values});break}})}),{path:VT(i),commands:i}}var sg={},l3;function WT(){if(l3)return sg;l3=1;var t=t||{};t.stringify=(function(){var e={"visit_linear-gradient":function(r){return e.visit_gradient(r)},"visit_repeating-linear-gradient":function(r){return e.visit_gradient(r)},"visit_radial-gradient":function(r){return e.visit_gradient(r)},"visit_repeating-radial-gradient":function(r){return e.visit_gradient(r)},visit_gradient:function(r){var n=e.visit(r.orientation);return n&&(n+=", "),r.type+"("+n+e.visit(r.colorStops)+")"},visit_shape:function(r){var n=r.value,i=e.visit(r.at),a=e.visit(r.style);return a&&(n+=" "+a),i&&(n+=" at "+i),n},"visit_default-radial":function(r){var n="",i=e.visit(r.at);return i&&(n+=i),n},"visit_extent-keyword":function(r){var n=r.value,i=e.visit(r.at);return i&&(n+=" at "+i),n},"visit_position-keyword":function(r){return r.value},visit_position:function(r){return e.visit(r.value.x)+" "+e.visit(r.value.y)},"visit_%":function(r){return r.value+"%"},visit_em:function(r){return r.value+"em"},visit_px:function(r){return r.value+"px"},visit_calc:function(r){return"calc("+r.value+")"},visit_literal:function(r){return e.visit_color(r.value,r)},visit_hex:function(r){return e.visit_color("#"+r.value,r)},visit_rgb:function(r){return e.visit_color("rgb("+r.value.join(", ")+")",r)},visit_rgba:function(r){return e.visit_color("rgba("+r.value.join(", ")+")",r)},visit_hsl:function(r){return e.visit_color("hsl("+r.value[0]+", "+r.value[1]+"%, "+r.value[2]+"%)",r)},visit_hsla:function(r){return e.visit_color("hsla("+r.value[0]+", "+r.value[1]+"%, "+r.value[2]+"%, "+r.value[3]+")",r)},visit_var:function(r){return e.visit_color("var("+r.value+")",r)},visit_color:function(r,n){var i=r,a=e.visit(n.length);return a&&(i+=" "+a),i},visit_angular:function(r){return r.value+"deg"},visit_directional:function(r){return"to "+r.value},visit_array:function(r){var n="",i=r.length;return r.forEach(function(a,o){n+=e.visit(a),o<i-1&&(n+=", ")}),n},visit_object:function(r){return r.width&&r.height?e.visit(r.width)+" "+e.visit(r.height):""},visit:function(r){if(!r)return"";if(r instanceof Array)return e.visit_array(r);if(typeof r=="object"&&!r.type)return e.visit_object(r);if(r.type){var n=e["visit_"+r.type];if(n)return n(r);throw Error("Missing visitor visit_"+r.type)}else throw Error("Invalid node.")}};return function(r){return e.visit(r)}})();var t=t||{};return t.parse=(function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,radianValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-zA-Z0-9-,\s\#]+)/,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},r="";function n(V){var ee=new Error(r+": "+V);throw ee.source=r,ee}function i(){var V=a();return r.length>0&&n("Invalid input not EOF"),V}function a(){return _(o)}function o(){return s("linear-gradient",e.linearGradient,f)||s("repeating-linear-gradient",e.repeatingLinearGradient,f)||s("radial-gradient",e.radialGradient,p)||s("repeating-radial-gradient",e.repeatingRadialGradient,p)}function s(V,ee,te){return u(ee,function(Q){var ne=te();return ne&&(D(e.comma)||n("Missing comma before color stops")),{type:V,orientation:ne,colorStops:_(E)}})}function u(V,ee){var te=D(V);if(te){D(e.startCall)||n("Missing (");var Q=ee(te);return D(e.endCall)||n("Missing )"),Q}}function f(){var V=d();if(V)return V;var ee=U("position-keyword",e.positionKeywords,1);return ee?{type:"directional",value:ee.value}:h()}function d(){return U("directional",e.sideOrCorner,1)}function h(){return U("angular",e.angleValue,1)||U("angular",e.radianValue,1)}function p(){var V,ee=y(),te;return ee&&(V=[],V.push(ee),te=r,D(e.comma)&&(ee=y(),ee?V.push(ee):r=te)),V}function y(){var V=v()||b();if(V)V.at=k();else{var ee=x();if(ee){V=ee;var te=k();te&&(V.at=te)}else{var Q=k();if(Q)V={type:"default-radial",at:Q};else{var ne=S();ne&&(V={type:"default-radial",at:ne})}}}return V}function v(){var V=U("shape",/^(circle)/i,0);return V&&(V.style=J()||x()),V}function b(){var V=U("shape",/^(ellipse)/i,0);return V&&(V.style=S()||Z()||x()),V}function x(){return U("extent-keyword",e.extentKeywords,1)}function k(){if(U("position",/^at/,0)){var V=S();return V||n("Missing positioning value"),V}}function S(){var V=P();if(V.x||V.y)return{type:"position",value:V}}function P(){return{x:Z(),y:Z()}}function _(V){var ee=V(),te=[];if(ee)for(te.push(ee);D(e.comma);)ee=V(),ee?te.push(ee):n("One extra comma");return te}function E(){var V=A();return V||n("Expected color definition"),V.length=Z(),V}function A(){return I()||H()||F()||R()||L()||N()||T()}function T(){return U("literal",e.literalColor,0)}function I(){return U("hex",e.hexColor,1)}function L(){return u(e.rgbColor,function(){return{type:"rgb",value:_(X)}})}function R(){return u(e.rgbaColor,function(){return{type:"rgba",value:_(X)}})}function N(){return u(e.varColor,function(){return{type:"var",value:$()}})}function F(){return u(e.hslColor,function(){var V=D(e.percentageValue);V&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");var ee=X();D(e.comma);var te=D(e.percentageValue),Q=te?te[1]:null;D(e.comma),te=D(e.percentageValue);var ne=te?te[1]:null;return(!Q||!ne)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[ee,Q,ne]}})}function H(){return u(e.hslaColor,function(){var V=X();D(e.comma);var ee=D(e.percentageValue),te=ee?ee[1]:null;D(e.comma),ee=D(e.percentageValue);var Q=ee?ee[1]:null;D(e.comma);var ne=X();return(!te||!Q)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[V,te,Q,ne]}})}function $(){return D(e.variableName)[1]}function X(){return D(e.number)[1]}function Z(){return U("%",e.percentageValue,1)||K()||q()||J()}function K(){return U("position-keyword",e.positionKeywords,1)}function q(){return u(e.calcValue,function(){for(var V=1,ee=0;V>0&&ee<r.length;){var te=r.charAt(ee);te==="("?V++:te===")"&&V--,ee++}V>0&&n("Missing closing parenthesis in calc() expression");var Q=r.substring(0,ee-1);return W(ee-1),{type:"calc",value:Q}})}function J(){return U("px",e.pixelValue,1)||U("em",e.emValue,1)}function U(V,ee,te){var Q=D(ee);if(Q)return{type:V,value:Q[te]}}function D(V){var ee,te;return te=/^[\n\r\t\s]+/.exec(r),te&&W(te[0].length),ee=V.exec(r),ee&&W(ee[0].length),ee}function W(V){r=r.substr(V)}return function(V){return r=V.toString().trim(),r.endsWith(";")&&(r=r.slice(0,-1)),i()}})(),sg.parse=t.parse,sg.stringify=t.stringify,sg}var GT=WT();const XT=Ec(GT),an=t=>t.indexOf("linear-gradient")>=0,YT=t=>t.type==="hex"?"#"+t.value:t.type==="literal"?t.value:`${t.type}(${t.value.join(",")})`,Fp=t=>{if(!an(t))return{rotation:0,stops:[{offset:0,color:t},{offset:1,color:t}]};const e=XT.parse(t)[0];return{rotation:e.orientation&&"value"in e.orientation?parseFloat(e.orientation.value):0,stops:e.colorStops.map((r,n)=>({color:YT(r),offset:r.length?parseFloat(r.length.value)/100:n/(e.colorStops.length-1)}))}},Go=(t,e=t.fill,r="fill")=>Y.useMemo(()=>{if(!an(e))return{[r]:e};const{stops:n,rotation:i}=Fp(e),a=t.a.width/2,o=t.a.height/2,s=(i%180+180)%180,u=s>45&&s<135?t.a.width:t.a.height,f=_t.Util.degToRad(i)-Math.PI/2,d=[];return n.forEach(({offset:h,color:p})=>{d.push(h,p)}),r==="fill"?{fillLinearGradientStartPointX:a-u/2*Math.cos(f),fillLinearGradientStartPointY:o-u/2*Math.sin(f),fillLinearGradientColorStops:d,fillLinearGradientEndPointX:a+u/2*Math.cos(f),fillLinearGradientEndPointY:o+u/2*Math.sin(f),fill:n[1].color,fillPriority:"linear-gradient"}:{strokeLinearGradientStartPointX:a-u/2*Math.cos(f),strokeLinearGradientStartPointY:o-u/2*Math.sin(f),strokeLinearGradientColorStops:d,strokeLinearGradientEndPointX:a+u/2*Math.cos(f),strokeLinearGradientEndPointY:o+u/2*Math.sin(f)}},[e,t.width,t.height]);let Ug=!1;const KT=(t=!Ug)=>{Ug=t},QT=()=>Ug;function Bp(t,e){const r=Y.useRef();Y.useLayoutEffect(()=>{r.current&&r.current.destroy()},[e]),Y.useLayoutEffect(()=>{if(!Ug)return;const n=t.current.opacity();return n?(t.current.opacity(0),r.current=new _t.Tween({node:t.current,opacity:n,onFinish:()=>{var i;(i=r.current)===null||i===void 0||i.destroy()}}),r.current.play(),()=>{var i;(i=r.current)===null||i===void 0||i.destroy()}):void 0},[])}let Hg=0,qv=[],j5=3e4;const ZT=t=>{j5=t};let U5=6e3;const JT=t=>{U5=t},eC=()=>U5;function Ws(t){Hg+=1;let e=!1,r=!1;const n=setTimeout(()=>{e||(Od(`Timeout loading asset ${t}`),console.error("Timeout triggered for loader. Some assets may not have loaded.",t),e=!0,u3())},j5);return()=>{r?console.error("Finish called twice! That is not expected. id: ",t):(r=!0,e||(clearTimeout(n),u3()))}}function u3(){Hg-=1,Hg===0&&(qv.forEach(t=>t()),qv=[])}function tC(){return new Promise(t=>{return e=()=>{QT()?setTimeout(t,300):t(!0)},void(Hg===0?e():qv.push(e));var e})}let H5=[];function rC(t){H5.push(t)}function Od(t){H5.forEach(e=>e(t))}Gt(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]);Gt({value:!1});const M2=Gt([]);function nC(t){M2.push(t)}var Vv="Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1";let Ms;function lg(t,e="sans-serif",r="normal",n="normal"){Ms||(Ms=document.createElement("canvas"));var i=Ms.getContext("2d");return i.font=`${r} ${n} 40px '${t}', ${e}`,i.measureText(Vv).width}const np={Arial:!0},c3=t=>Object.keys(np).some(e=>e.startsWith(t+"_"))||!!np[t];async function iC(t,e,r,n=""){var i;const a=`${t}_${e}_${r}`;if(np[a])return;const o=!!(!((i=document.fonts)===null||i===void 0)&&i.load),s=(function(h="normal",p="normal"){Ms||(Ms=document.createElement("canvas"));var y=Ms.getContext("2d");return y.font=`${h} ${p} 40px sans-serif`,y.measureText(Vv).width})(e,r);if(o)try{if(await document.fonts.load(`${e} ${r} 16px '${t}'`),s!==lg(t,"sans-serif",e,r))return void(np[a]=!0)}catch{}const u=(function(h="normal",p="normal"){Ms||(Ms=document.createElement("canvas"));var y=Ms.getContext("2d");return y.font=`${h} ${p} 40px serif`,y.measureText(Vv).width})(e,r),f=lg(t,"sans-serif",e,r),d=Math.min(6e3,eC())/60;for(let h=0;h<d;h++){const p=lg(t,"sans-serif",e,r),y=lg(t,"serif",e,r);if(p!==f||p!==s||y!==u)return await new Promise(v=>setTimeout(v,100)),void(np[a]=!0);await new Promise(v=>setTimeout(v,60))}console.warn(`Timeout for loading font "${t}". Looks like polotno can't load it. Is it a correct font family?`),Od(`Timeout for loading font "${t}"`)}const f3={};let $5="400,400italic,700,700italic";function aC(){return $5}function q5(t){return`https://fonts.googleapis.com/css?family=${t.replace(/ /g,"+")}:${$5}`}function oC(t){if(f3[t])return;const e=q5(t),r=document.createElement("link");r.type="text/css",r.href=e,r.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(r),f3[t]=!0}const d3={};let nc;function sC(t){const e=t.fontFamily;if(d3[e]||!t.url&&!t.styles)return;const r=t.styles||(t.url?[{src:`url("${t.url}")`}]:[]),n=(nc||(nc=document.getElementById("polotno-font-style"),nc||(nc=document.createElement("style"),nc.id="polotno-font-style",document.head.appendChild(nc)),nc)).sheet;r.forEach(i=>{n.insertRule(`
42
+ @font-face{
43
+ font-family:'${e}';
44
+ src:${i.src};
45
+ font-style:${i.fontStyle||"normal"};
46
+ font-weight:${i.fontWeight||"normal"};
47
+ font-display:swap; /* optional but recommended */
48
+ }`,n.cssRules.length)}),d3[t.fontFamily]=!0}const lr=Gt({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:"resize",textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),lC=typeof window<"u"&&window.location.hostname==="localhost",uC=typeof process<"u"&&!1,V5=lC||uC,cC=Ft(t=>{lr.textVerticalResizeEnabled=t}),W5=Ft(t=>{lr.removeBackgroundEnabled=t});Ft(t=>{V5&&console.warn("useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead."),W5(t)});Ft(t=>{lr.aiTextEnabled=t});Ft(t=>{V5&&console.warn("useHtmlTextRender is deprecated. Use setRichTextEnabled instead."),lr.htmlRenderEnabled=t});const fC=Ft(t=>{lr.htmlRenderEnabled=t}),dC=Ft(t=>{lr.imageDownScalingEnabled=t});Ft(t=>{console.warn("useDownScaling is deprecated. Use setDownScalingEnabled instead."),dC(t)});Ft(t=>{console.warn("setForceTextFit is deprecated. Use setTextOverflow instead."),lr.textOverflow="change-font-size"});const G5=Ft(t=>{lr.textOverflow=t}),hC=Ft(t=>{lr.textSplitAllowed=t});Ft(t=>{lr.animationsEnabled=t});Ft(t=>{lr.autoDeleteEmptyText=t});function ri(t=""){return(t.match(/<\/p>/gi)||[]).length>1&&(t=t.replace(/<\/p>/gi,(e,r,n)=>(n.slice(r+e.length).match(/<\/p>/gi)||[]).length>0?`
49
+ `:e)),t.replace(/(<([^>]+)>)/gi,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&nbsp;/g," ")}function h3(t){return t?/<[a-z][a-z0-9]*(\s[^>]*)?>[^<]*<\/[a-z][a-z0-9]*>/i.test(t)?t=(t=t.replace(/<(?![a-z/!])/gi,"&lt;")).replace(/([^a-z0-9"'\s/])>/gi,"$1&gt;"):t.replace(/</g,"&lt;").replace(/>/g,"&gt;"):""}const pC={fontSize:14,fontFamily:"Roboto",fontWeight:"normal",fontStyle:"normal",lineHeight:1.2,letterSpacing:0,textTransform:"none",textDecoration:"",align:"center",fill:"black",stroke:"black",strokeWidth:0,curveEnabled:!1,curvePower:.5};function X5(t){return Object.assign(Object.assign({},pC),t)}function mC(t){var e="֑-߿‏‫‮יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+e+"]*?["+e+"]").test(t)}function vp(t){return(function(e){e=e.replace(/\s/g,"");let r=0;for(var n=0;n<e.length;n++)mC(e[n])&&(r+=1);return r>e.length/2})(t)?"rtl":"ltr"}function _c(t,e,r,n){const i=Math.max(-.9999,Math.min(.9999,r));if(Math.abs(i)<1e-4)return`M 0 ${e/2} L ${t} ${e/2}`;const a=5*n/(2*Math.abs(i))-n,o=t/2;if(i>0){const s=2*a+n/2;return[`M ${o} ${s}`,`A ${a} ${a} 0 1 1 ${o} ${s-2*a}`,`A ${a} ${a} 0 1 1 ${o} ${s}`].join(" ")}{const s=-(2*a-Math.round(e))-n/2;return[`M ${o} ${s}`,`A ${a} ${a} 0 1 0 ${o} ${s+2*a}`,`A ${a} ${a} 0 1 0 ${o} ${s}`].join(" ")}}function ed(t,e,r,n){if(!an(t))return"";const{stops:i,rotation:a}=Fp(t),o=a*Math.PI/180;return`<linearGradient id="${e}" x1="${100*(.5-.5*Math.sin(o))}%" y1="${100*(.5+.5*Math.cos(o))}%" x2="${100*(.5+.5*Math.sin(o))}%" y2="${100*(.5-.5*Math.cos(o))}%">${i.map(({offset:s,color:u})=>`<stop offset="${100*s}%" stop-color="${u}" />`).join("")}</linearGradient>`}function gC(t){var e,r,n,i,a,o;const s=t.a?t.a:t,u=X5(t),f=new _t.TextPath({data:_c((e=s.width)!==null&&e!==void 0?e:u.width,(n=(r=s.height)!==null&&r!==void 0?r:u.height)!==null&&n!==void 0?n:0,u.curvePower,(i=s.fontSize)!==null&&i!==void 0?i:u.fontSize),align:"center",textBaseline:"middle",text:ri(u.text),fontSize:(a=s.fontSize)!==null&&a!==void 0?a:u.fontSize,fontFamily:u.fontFamily,fontWeight:u.fontWeight,fontStyle:u.fontStyle,letterSpacing:u.letterSpacing*((o=s.fontSize)!==null&&o!==void 0?o:u.fontSize),fill:u.fill}),d=f.getSelfRect().height;return f.destroy(),d}function F1(t,{fontFamily:e="",color:r="black",forEditor:n=!1}={}){const i=X5(t),a=e||i.fontFamily,o=an(i.fill),s=an(i.stroke),u=lr.textOverflow==="ellipsis"&&!n&&!i.curveEnabled&&!!i.height,f=(()=>{if(!u)return[];const v=Math.max(1,Math.round(i.height)),b=typeof i.lineHeight=="number"?i.lineHeight:1.2,x=Math.max(1,b*i.fontSize),k=Math.max(1,Math.floor(v/x));return[`max-height: ${v}px`,"overflow: hidden","display: -webkit-box","-webkit-box-orient: vertical",`-webkit-line-clamp: ${k}`,`line-clamp: ${k}`]})(),d=v=>`
50
+ background-image: ${v};
51
+ background-size: 100% 100%;
52
+ background-repeat: repeat;
53
+ -webkit-background-clip: text;
54
+ -moz-background-clip: text;
55
+ background-clip: text;
56
+ -webkit-text-fill-color: transparent;
57
+ color: transparent
58
+ `.trim();let h=`color: ${r||i.fill}`,p="";s&&i.strokeWidth?(h=`color: ${r||i.fill}; ${d(i.stroke)}`,p=`-webkit-text-stroke: ${i.strokeWidth}px transparent`):o&&(h=d(i.fill));const y=["white-space: pre-wrap","word-break: break-word",`width: ${Math.round(i.width||100)}px`,...f,h,`font-size: ${i.fontSize}px`,`font-family: '${a}'`,`text-align: ${i.align}`,`text-transform: ${i.textTransform}`,i.textDecoration?`text-decoration: ${i.textDecoration}; text-decoration-color: ${r||i.fill}; text-decoration-layer: over`:"",i.lineHeight?`line-height: ${i.lineHeight}`:"",i.letterSpacing?`letter-spacing: ${i.letterSpacing*i.fontSize}px`:"",i.fontStyle?`font-style: ${i.fontStyle}`:"",i.fontWeight?`font-weight: ${i.fontWeight}`:"",p||(i.strokeWidth?`-webkit-text-stroke: ${i.strokeWidth}px ${i.stroke}`:""),i.strokeWidth&&!s?"paint-order: stroke fill":""].filter(Boolean).join("; ");if(i.curveEnabled){const v=gC(t),b=Math.round(i.width||100),x=_c(b,v,i.curvePower,i.fontSize),k=ri(i.text).replace(/\\n/g," "),S=`curve-${i.id||"temp"}`,P=i.strokeWidth&&(s||o&&!s);let _=`<svg xmlns="http://www.w3.org/2000/svg" width="${b}" height="${v}">
59
+ <defs>
60
+ <path id="${S}" d="${x}" fill="none" />`;if(o){const E=`curve-fill-grad-${i.id||"temp"}`;_+=ed(i.fill,E)}if(s&&i.strokeWidth){const E=`curve-stroke-grad-${i.id||"temp"}`;_+=ed(i.stroke,E)}if(_+="</defs>",P){const E=`
61
+ font-family="'${a}'"
62
+ font-size="${i.fontSize}"
63
+ font-weight="${i.fontWeight}"
64
+ font-style="${i.fontStyle}"
65
+ text-anchor="middle"
66
+ dominant-baseline="central"
67
+ letter-spacing="${i.letterSpacing*i.fontSize}px"${i.textDecoration?` text-decoration="${i.textDecoration}"`:""}`,A=s?`url(#curve-stroke-grad-${i.id||"temp"})`:i.stroke;_+=`
68
+ <text ${E} fill="${A}" stroke="${A}" stroke-width="${i.strokeWidth}">
69
+ <textPath href="#${S}" startOffset="50%">${k}</textPath>
70
+ </text>`,_+=`
71
+ <text ${E} fill="${o?`url(#curve-fill-grad-${i.id||"temp"})`:r}">
72
+ <textPath href="#${S}" startOffset="50%">${k}</textPath>
73
+ </text>`}else{const E=o?`url(#curve-fill-grad-${i.id||"temp"})`:r,A=s?`url(#curve-stroke-grad-${i.id||"temp"})`:i.stroke;_+=`
74
+ <text
75
+ font-family="'${a}'"
76
+ font-size="${i.fontSize}"
77
+ font-weight="${i.fontWeight}"
78
+ font-style="${i.fontStyle}"
79
+ fill="${E}"
80
+ text-anchor="middle"
81
+ dominant-baseline="central"
82
+ letter-spacing="${i.letterSpacing*i.fontSize}px"${i.textDecoration?` text-decoration="${i.textDecoration}"`:""}${i.strokeWidth?` stroke="${A}" stroke-width="${i.strokeWidth}" paint-order="stroke fill"`:""}>
83
+ <textPath href="#${S}" startOffset="50%">${k}</textPath>
84
+ </text>`}return _+="</svg>",_}if(i.strokeWidth&&(s||o&&!s)&&!n){const v=h3(i.text).replace(/\n/g,"<br/>"),b=Math.round(i.width||100),x=["white-space: pre-wrap","word-break: break-word",`width: ${b}px`,...f,`font-size: ${i.fontSize}px`,`font-family: '${a}'`,`text-align: ${i.align}`,`text-transform: ${i.textTransform}`,i.textDecoration?`text-decoration: ${i.textDecoration}; text-decoration-color: ${r||i.fill}; text-decoration-layer: over`:"",i.lineHeight?`line-height: ${i.lineHeight}`:"",i.letterSpacing?`letter-spacing: ${i.letterSpacing*i.fontSize}px`:"",i.fontStyle?`font-style: ${i.fontStyle}`:"",i.fontWeight?`font-weight: ${i.fontWeight}`:""].filter(Boolean).join("; ");let k;return k=s?`${x}; ${d(i.stroke)}; -webkit-text-stroke: ${i.strokeWidth}px transparent`:`${x}; color: transparent; -webkit-text-stroke: ${i.strokeWidth}px ${i.stroke}`,`
85
+ <div style="position: relative; width: ${b}px;">
86
+ <div style="${k}; position: absolute; top: 0; left: 0; pointer-events: none;" aria-hidden="true">${v}</div>
87
+ <div style="${x}; ${o?d(i.fill):`color: ${r||i.fill}`}; position: relative;" contentEditable dir="${vp(ri(i.text))}">${v}</div>
88
+ </div>
89
+ `}return`<div style="${y}" contentEditable dir="${vp(ri(i.text))}">${h3(i.text).replace(/\n/g,"</br>")}</div>`}function yC({fontFamily:t,fontSize:e,lineHeight:r}){if(typeof r=="number")return r;const n=document.createElement("div");n.style.fontFamily=t,n.style.fontSize=e+"px",n.style.lineHeight=r,n.innerText="Test text",document.body.appendChild(n);const i=n.offsetHeight;return document.body.removeChild(n),i/e}const vC={warm:t=>e=>{const r=e.data;t=Math.max(0,Math.min(1,t));for(let n=0;n<r.length;n+=4)r[n]=Math.min(r[n]+30*t,255),r[n+1]=Math.min(r[n+1]+15*t,255);return e},cold:t=>e=>{const r=e.data;t=Math.max(0,Math.min(1,t));for(let n=0;n<r.length;n+=4)r[n]=Math.min(r[n]-15*t,255),r[n+1]=Math.min(r[n+1]-10*t,255),r[n+2]=Math.min(r[n+2]+15*t,255);return e},natural:t=>e=>{const r=e.data;t=Math.max(0,Math.min(1,t));for(let n=0;n<r.length;n+=4){r[n]=Math.min(r[n]*(1+.1*t),255),r[n+1]=Math.min(r[n+1]*(1+.1*t),255),r[n+2]=Math.min(r[n+2]*(1+.1*t),255);const i=(r[n]+r[n+1]+r[n+2])/3;r[n]=Math.min((r[n]-i)*(1+.2*t)+i,255),r[n+1]=Math.min((r[n+1]-i)*(1+.2*t)+i,255),r[n+2]=Math.min((r[n+2]-i)*(1+.2*t)+i,255)}return e},temperature:t=>e=>{const r=e.data;t=Math.max(-1,Math.min(1,t));for(let n=0;n<r.length;n+=4){const i=r[n],a=(r[n+1],r[n+2]);r[n]=Math.min(Math.max(i+15*t,0),255),r[n+2]=Math.min(Math.max(a-15*t,0),255)}return e},contrast:t=>e=>{const r=e.data,n=100*(t=Math.max(-1,Math.min(1,t))),i=259*(n+255)/(255*(259-n));for(let a=0;a<r.length;a+=4)r[a]=Math.min(Math.max(i*(r[a]-128)+128,0),255),r[a+1]=Math.min(Math.max(i*(r[a+1]-128)+128,0),255),r[a+2]=Math.min(Math.max(i*(r[a+2]-128)+128,0),255);return e},shadows:t=>e=>{const r=e.data;t=Math.max(-1,Math.min(1,t));for(let n=0;n<r.length;n+=4){const i=(r[n]+r[n+1]+r[n+2])/3;if(i<128){const a=1+t*(1-i/128)*2;r[n]=Math.min(Math.max(r[n]*a,0),255),r[n+1]=Math.min(Math.max(r[n+1]*a,0),255),r[n+2]=Math.min(Math.max(r[n+2]*a,0),255)}}return e},white:t=>e=>{const r=e.data;t=Math.max(-1,Math.min(1,t));for(let n=0;n<r.length;n+=4){const i=r[n],a=r[n+1],o=r[n+2],s=(i+a+o)/3;if(s>128){const u=1+t*((s-128)/127);r[n]=Math.min(Math.max(i*u,0),255),r[n+1]=Math.min(Math.max(a*u,0),255),r[n+2]=Math.min(Math.max(o*u,0),255)}}return e},black:t=>e=>{const r=e.data;t=Math.max(-1,Math.min(1,t));for(let n=0;n<r.length;n+=4){const i=r[n],a=r[n+1],o=r[n+2],s=(i+a+o)/3;if(s<128){const u=1+t*((128-s)/128);r[n]=Math.min(Math.max(i*u,0),255),r[n+1]=Math.min(Math.max(a*u,0),255),r[n+2]=Math.min(Math.max(o*u,0),255)}}return e},vibrance:t=>e=>{const r=e.data;t=Math.max(-1,Math.min(1,t));for(let n=0;n<r.length;n+=4){const i=r[n],a=r[n+1],o=r[n+2],s=Math.max(i,a,o),u=t<0?(1-(s===0?0:(s-(i+a+o)/3)/s))*t*1.5:.5*t;r[n]=Math.min(Math.max(i-(s-i)*u,0),255),r[n+1]=Math.min(Math.max(a-(s-a)*u,0),255),r[n+2]=Math.min(Math.max(o-(s-o)*u,0),255)}return e},saturation:t=>e=>{const r=e.data;t=Math.max(-1,Math.min(1,t));for(let n=0;n<r.length;n+=4){const i=r[n],a=r[n+1],o=r[n+2],s=.2126*i+.7152*a+.0722*o;r[n]=Math.min(Math.max(s+(i-s)*(1+t),0),255),r[n+1]=Math.min(Math.max(s+(a-s)*(1+t),0),255),r[n+2]=Math.min(Math.max(s+(o-s)*(1+t),0),255)}return e}};function Fi(t,e){var r;const n={filters:[]},i={};e.brightnessEnabled&&(n.filters.push(_t.Filters.Brighten),n.brightness=e.brightness),e.blurEnabled&&(n.filters.push(_t.Filters.Blur),n.blurRadius=e.blurRadius,e.type==="text"&&e.lineHeight<1&&(i.offset=e.fontSize)),e.sepiaEnabled&&n.filters.push(_t.Filters.Sepia),e.grayscaleEnabled&&n.filters.push(_t.Filters.Grayscale),e.filters.forEach((a,o)=>{const s=vC[o];s&&n.filters.push(s(a.intensity))}),t.setAttrs(n),n.filters.length?t.cache(Object.assign(Object.assign({},i),{pixelRatio:e.store._elementsPixelRatio})):t.clearCache(),(r=t.getLayer())===null||r===void 0||r.batchDraw()}const wu=()=>"ontouchstart"in window||navigator.maxTouchPoints>0;var p3={},Y5="warn";function bC(t){Y5=t}function wC(){return Y5}var wn;(function(t){t.afterCreate="afterCreate",t.afterAttach="afterAttach",t.afterCreationFinalization="afterCreationFinalization",t.beforeDetach="beforeDetach",t.beforeDestroy="beforeDestroy"})(wn||(wn={}));var Wv=function(t,e){return Wv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Wv(t,e)};function Ir(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Wv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xo=function(){return Xo=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Xo.apply(this,arguments)};function xC(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function ip(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function du(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a}function Pc(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))}function K5(t){return $t(t).type}function Q5(t,e){return $t(t).onSnapshot(e)}function m3(t,e){$t(t).applyPatches(ok(e))}function Gv(t,e){return $t(t).applySnapshot(e)}function Fo(t,e){e===void 0&&(e=!0);var r=$t(t);return e?r.snapshot:r.type.getSnapshot(r,!1)}function ug(t,e){for(var r=$t(t).parent;r;){if(e.is(r.storedValue))return!0;r=r.parent}return!1}function uc(t,e){for(var r=$t(t).parent;r;){if(e.is(r.storedValue))return r.storedValue;r=r.parent}throw new xt("Failed to find the parent of ".concat($t(t)," of a given type"))}function SC(t){return $t(t).root.storedValue}function kC(t){return $t(t).path}function _C(t,e){var r=VC($t(t),e);return r?r.value:void 0}function PC(t){return $t(t).identifier}function gc(t){return $t(t).detach(),t}function B1(t){var e=$t(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)}function g3(t){return $t(t).observableIsAlive}var Z5=(function(){function t(e,r,n,i){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"environment",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_escapedSubpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storedValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"aliveAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_state",{enumerable:!0,configurable:!0,writable:!0,value:qn.INITIALIZING}),Object.defineProperty(this,"_hookSubscribers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.environment=i,this.baseSetParent(r,n)}return Object.defineProperty(t.prototype,"subpath",{get:function(){return this._subpath},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},set:function(e){var r=this.isAlive;this._state=e;var n=this.isAlive;this.aliveAtom&&r!==n&&this.aliveAtom.reportChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fireInternalHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._hookSubscribers&&this._hookSubscribers.emit(e,this,e)}}),Object.defineProperty(t.prototype,"registerHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return this._hookSubscribers||(this._hookSubscribers=new uk),this._hookSubscribers.register(e,r)}}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getReconciliationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type}}),Object.defineProperty(t.prototype,"baseSetParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){this._parent=e,this._subpath=r,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()}}),Object.defineProperty(t.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getEscapedPath",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&(this.pathAtom||(this.pathAtom=Og("path")),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?vc(this._subpath):""),this.parent.getEscapedPath(e)+"/"+this._escapedSubpath):""}}),Object.defineProperty(t.prototype,"isRoot",{get:function(){return this.parent===null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAlive",{get:function(){return this.state!==qn.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDetaching",{get:function(){return this.state===qn.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=Og("alive")),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseFinalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.state===qn.CREATED){if(this.parent){if(this.parent.state!==qn.FINALIZED)return;this.fireHook(wn.afterAttach)}this.state=qn.FINALIZED,e&&e()}}}),Object.defineProperty(t.prototype,"baseFinalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,""),this.state=qn.DEAD}}),Object.defineProperty(t.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(wn.beforeDestroy)}}),t})(),bp=(function(t){Ir(e,t);function e(r,n,i,a,o){var s=t.call(this,r,n,i,a)||this;try{s.storedValue=r.createNewInstance(o)}catch(u){throw s.state=qn.DEAD,u}return s.state=qn.CREATED,s.finalizeCreation(),s}return Object.defineProperty(e.prototype,"root",{get:function(){if(!this.parent)throw new xt("This scalar node is not part of a tree");return this.parent.root},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this.parent!==r,a=this.subpath!==n;!i&&!a||(this.environment=void 0,this.baseSetParent(this.parent,n))}}),Object.defineProperty(e.prototype,"snapshot",{get:function(){return this.getSnapshot()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(e.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=(this.isAlive?this.path:this.pathUponDeath)||"<root>";return"".concat(this.type.name,"@").concat(r).concat(this.isAlive?"":" [dead]")}}),Object.defineProperty(e.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===qn.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(e.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(e.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(e.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(e.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this.fireInternalHook(r)}}),e})(Z5);bp.prototype.die=Ft(bp.prototype.die);var EC=1,eo;(function(t){t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.CREATING=1]="CREATING",t[t.CREATED=2]="CREATED"})(eo||(eo={}));var Zi;(function(t){t.Dispose="dispose",t.Patch="patch",t.Snapshot="snapshot"})(Zi||(Zi={}));var TC={onError:function(t){throw t}},Bi=(function(t){Ir(e,t);function e(r,n,i,a,o){var s=t.call(this,r,n,i,a)||this;if(Object.defineProperty(s,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++EC}),Object.defineProperty(s,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(s,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"hasSnapshotPostProcessor",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(s,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:eo.UNINITIALIZED}),Object.defineProperty(s,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s._snapshotComputed=Tc(function(){return s.getSnapshot()}),s.unbox=s.unbox.bind(s),s._initialSnapshot=o,s.identifierAttribute=r.identifierAttribute,n||(s.identifierCache=new HC),s._childNodes=r.initializeChildNodes(s,s._initialSnapshot),s.identifier=null,s.unnormalizedIdentifier=null,s.identifierAttribute&&s._initialSnapshot){var u=s._initialSnapshot[s.identifierAttribute];if(u===void 0){var f=s._childNodes[s.identifierAttribute];f&&(u=f.value)}if(typeof u!="string"&&typeof u!="number")throw new xt("Instance identifier '".concat(s.identifierAttribute,"' for type '").concat(s.type.name,"' must be a string or a number"));s.identifier=zp(u),s.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(s):s.identifierCache.addNodeToCache(s),s}return Object.defineProperty(e.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this.createObservableInstanceIfNeeded(),this._applyPatches(r)}}),Object.defineProperty(e.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this.createObservableInstanceIfNeeded(),this._applySnapshot(r)}}),Object.defineProperty(e.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=!0),this._observableInstanceState===eo.UNINITIALIZED&&this.createObservableInstance(r)}}),Object.defineProperty(e.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n,i,a,o;r===void 0&&(r=!0),this._observableInstanceState=eo.CREATING;for(var s=[],u=this.parent;u&&u._observableInstanceState===eo.UNINITIALIZED;)s.unshift(u),u=u.parent;try{for(var f=ip(s),d=f.next();!d.done;d=f.next()){var h=d.value;h.createObservableInstanceIfNeeded(!1)}}catch(b){n={error:b}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}var p=this.type;try{this.storedValue=p.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,p.finalizeNewInstance(this,this.storedValue)}catch(b){throw this.state=qn.DEAD,b}finally{this._isRunningAction=!1}if(this._observableInstanceState=eo.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=Sd,this.state=qn.CREATED,r){this.fireHook(wn.afterCreate),this.finalizeCreation();try{for(var y=ip(s.reverse()),v=y.next();!v.done;v=y.next()){var h=v.value;h.fireHook(wn.afterCreate),h.finalizeCreation()}}catch(b){a={error:b}}finally{try{v&&!v.done&&(o=y.return)&&o.call(y)}finally{if(a)throw a.error}}}}}),Object.defineProperty(e.prototype,"root",{get:function(){var r=this.parent;return r?r.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(wn.beforeDetach);var r=this.state;this.state=qn.DETACHING;var n=this.root,i=n.environment,a=n.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=i,this.identifierCache=a}finally{this.state=r}}}}),Object.defineProperty(e.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=r!==this.parent,a=n!==this.subpath;!i&&!a||(i?(this.environment=void 0,r.root.identifierCache.mergeCache(this),this.baseSetParent(r,n),this.fireHook(wn.afterAttach)):a&&this.baseSetParent(this.parent,n))}}),Object.defineProperty(e.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;this.fireInternalHook(r);var i=this.storedValue&&typeof this.storedValue=="object"&&this.storedValue[r];typeof i=="function"&&(Ls?Ls(function(){i.apply(n.storedValue)}):i.apply(this.storedValue))}}),Object.defineProperty(e.prototype,"snapshot",{get:function(){return this.hasSnapshotPostProcessor&&this.createObservableInstanceIfNeeded(),this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?this._observableInstanceState===eo.CREATED?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(e.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(e.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var r=this.type,n=this._childNodes,i=this._initialSnapshot;this._cachedInitialSnapshot=r.processInitialSnapshot(n,i),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(e.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isRunningAction?!0:this.isRoot?!1:this.parent.isRunningAction()}}),Object.defineProperty(e.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=wC();if(!this.isAlive&&n!=="ignore"){var i=this._getAssertAliveError(r);switch(n){case"error":throw new xt(i);case"warn":tO(i)}}}}),Object.defineProperty(e.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.getEscapedPath(!1)||this.pathUponDeath||"",i=r.subpath&&vc(r.subpath)||"",a=r.actionContext||AC();a&&a.type!=="action"&&a.parentActionEvent&&(a=a.parentActionEvent);var o="";if(a&&a.name!=null){var s=a&&a.context&&kC(a.context)||n;o="".concat(s,".").concat(a.name,"()")}return"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '".concat(this.type.name,"', Path upon death: '").concat(n,"', Subpath: '").concat(i,"', Action: '").concat(o,"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.")}}),Object.defineProperty(e.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this.assertAlive({subpath:r}),this._autoUnbox=!1;try{return this._observableInstanceState===eo.CREATED?this.type.getChildNode(this,r):this._childNodes[r]}finally{this._autoUnbox=!0}}}),Object.defineProperty(e.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(Sd),this._autoUnbox=!1;try{return this._observableInstanceState===eo.CREATED?this.type.getChildren(this):ik(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(e.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.type.getChildType(r)}}),Object.defineProperty(e.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(this.assertAlive(r),!this.isRunningAction()&&this.isProtected)throw new xt("Cannot modify '".concat(this,"', the object is protected and can only be modified by using an action."))}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this.type.removeChild(this,r)}}),Object.defineProperty(e.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r&&(this.assertAlive({subpath:r.subpath||r.subpathUponDeath}),this._autoUnbox?r.value:r)}}),Object.defineProperty(e.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=(this.isAlive?this.path:this.pathUponDeath)||"<root>",n=this.identifier?"(id: ".concat(this.identifier,")"):"";return"".concat(this.type.name,"@").concat(r).concat(n).concat(this.isAlive?"":" [dead]")}}),Object.defineProperty(e.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this;this.baseFinalizeCreation(function(){var n,i;try{for(var a=ip(r.getChildren()),o=a.next();!o.done;o=a.next()){var s=o.value;s.finalizeCreation()}}catch(u){n={error:u}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r.fireInternalHook(wn.afterCreationFinalization)})}}),Object.defineProperty(e.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new xt("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(e.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this;this._applyPatches=wp(this.storedValue,"@APPLY_PATCHES",function(n){n.forEach(function(i){if(!i.path){r.type.applySnapshot(r,i.value);return}var a=ck(i.path),o=nk(r,a.slice(0,-1));o.applyPatchLocally(a[a.length-1],i)})}),this._applySnapshot=wp(this.storedValue,"@APPLY_SNAPSHOT",function(n){if(n!==r.snapshot)return r.type.applySnapshot(r,n)}),yc(this.storedValue,"$treenode",this),yc(this.storedValue,"toJSON",qC)}}),Object.defineProperty(e.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===qn.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(e.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==eo.UNINITIALIZED&&(this.getChildren().forEach(function(r){r.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(Zi.Dispose),this._internalEventsClear(Zi.Dispose))}}),Object.defineProperty(e.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach(function(n){n.finalizeDeath()}),this.root.identifierCache.notifyDied(this);var r=this.snapshot;this._snapshotUponDeath=r,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(e.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._addSnapshotReaction(),this._internalEventsRegister(Zi.Snapshot,r)}}),Object.defineProperty(e.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this._internalEventsEmit(Zi.Snapshot,r)}}),Object.defineProperty(e.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._internalEventsRegister(Zi.Patch,r)}}),Object.defineProperty(e.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this._internalEventsHasSubscribers(Zi.Patch)){var i=n.path.substr(this.path.length)+(r.path?"/"+r.path:""),a=QC({},r,{path:i}),o=du(nO(a),2),s=o[0],u=o[1];this._internalEventsEmit(Zi.Patch,s,u)}this.parent&&this.parent.emitPatch(r,n)}}),Object.defineProperty(e.prototype,"hasDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._internalEventsHas(Zi.Dispose,r)}}),Object.defineProperty(e.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!this.hasDisposer(r)){this._internalEventsRegister(Zi.Dispose,r,!0);return}throw new xt("cannot add a disposer when it is already registered for execution")}}),Object.defineProperty(e.prototype,"removeDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!this._internalEventsHas(Zi.Dispose,r))throw new xt("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister(Zi.Dispose,r)}}),Object.defineProperty(e.prototype,"removeMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(this.middlewares){var n=this.middlewares.indexOf(r);n>=0&&this.middlewares.splice(n,1)}}}),Object.defineProperty(e.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;n===void 0&&(n=!0);var a={handler:r,includeHooks:n};return this.middlewares?this.middlewares.push(a):this.middlewares=[a],function(){i.removeMiddleware(a)}}}),Object.defineProperty(e.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){this.assertWritable({subpath:r}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,r,n)}}),Object.defineProperty(e.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this;if(!this._hasSnapshotReaction){var n=IS(function(){return r.snapshot},function(i){return r.emitSnapshot(i)},TC);this.addDisposer(n),this._hasSnapshotReaction=!0}}}),Object.defineProperty(e.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return!!this._internalEvents&&this._internalEvents.hasSubscribers(r)}}),Object.defineProperty(e.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){return i===void 0&&(i=!1),this._internalEvents||(this._internalEvents=new uk),this._internalEvents.register(r,n,i)}}),Object.defineProperty(e.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return!!this._internalEvents&&this._internalEvents.has(r,n)}}),Object.defineProperty(e.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){this._internalEvents&&this._internalEvents.unregister(r,n)}}),Object.defineProperty(e.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(r){for(var n,i=[],a=1;a<arguments.length;a++)i[a-1]=arguments[a];this._internalEvents&&(n=this._internalEvents).emit.apply(n,Pc([r],du(i),!1))}}),Object.defineProperty(e.prototype,"_internalEventsClear",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this._internalEvents&&this._internalEvents.clear(r)}}),Object.defineProperty(e.prototype,"_internalEventsClearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._internalEvents&&this._internalEvents.clearAll()}}),e})(Z5);Bi.prototype.createObservableInstance=Ft(Bi.prototype.createObservableInstance);Bi.prototype.detach=Ft(Bi.prototype.detach);Bi.prototype.die=Ft(Bi.prototype.die);var J5,Qt;(function(t){t[t.String=1]="String",t[t.Number=2]="Number",t[t.Boolean=4]="Boolean",t[t.Date=8]="Date",t[t.Literal=16]="Literal",t[t.Array=32]="Array",t[t.Map=64]="Map",t[t.Object=128]="Object",t[t.Frozen=256]="Frozen",t[t.Optional=512]="Optional",t[t.Reference=1024]="Reference",t[t.Identifier=2048]="Identifier",t[t.Late=4096]="Late",t[t.Refinement=8192]="Refinement",t[t.Union=16384]="Union",t[t.Null=32768]="Null",t[t.Undefined=65536]="Undefined",t[t.Integer=131072]="Integer",t[t.Custom=262144]="Custom",t[t.SnapshotProcessor=524288]="SnapshotProcessor",t[t.Lazy=1048576]="Lazy",t[t.Finite=2097152]="Finite",t[t.Float=4194304]="Float"})(Qt||(Qt={}));var ek="cannotDetermine",CC=Symbol("$type"),Gs=(function(){function t(e){Object.defineProperty(this,J5,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"C",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"S",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"T",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"N",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isType",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e}return Object.defineProperty(t.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return qs(this,e),this.instantiate(null,"",r,e).value}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){throw new xt("unimplemented method")}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e===this}}),Object.defineProperty(t.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=rk(e);if(n){var i=K5(e);return this.isAssignableFrom(i)?zi():ji(r,e)}return this.isValidSnapshot(e,r)}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.validate(e,[{path:"",type:this}]).length===0}}),Object.defineProperty(t.prototype,"Type",{get:function(){throw new xt("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"TypeWithoutSTN",{get:function(){throw new xt("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"SnapshotType",{get:function(){throw new xt("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"CreationType",{get:function(){throw new xt("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!1,configurable:!0}),t})();J5=CC;Gs.prototype.create=Ft(Gs.prototype.create);var wd=(function(t){Ir(e,t);function e(r){var n=t.call(this,r)||this;return Object.defineProperty(n,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return r===void 0&&(r=this.getDefaultSnapshot()),t.prototype.create.call(this,r,n)}}),Object.defineProperty(e.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.createObservableInstanceIfNeeded(),r.storedValue}}),Object.defineProperty(e.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return!r.identifierAttribute||r.identifier===zp(n[r.identifierAttribute])}}),Object.defineProperty(e.prototype,"tryToReconcileNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return r.isDetaching?!1:r.snapshot===n||$r(n)&&$t(n)===r?!0:r.type===this&&sk(n)&&!$r(n)&&this.isMatchingSnapshotId(r,n)?(r.applySnapshot(n),!0):!1}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=this.tryToReconcileNode(r,n);if(o)return r.setParent(i,a),r;if(r.die(),$r(n)&&this.isAssignableFrom(K5(n))){var s=$t(n);return s.setParent(i,a),s}return this.instantiate(i,a,void 0,n)}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),e})(Gs);wd.prototype.create=Ft(wd.prototype.create);var Nc=(function(t){Ir(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r}}),Object.defineProperty(e.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){if(!r.isDetaching&&r.type===this&&r.storedValue===n)return r;var o=this.instantiate(i,a,void 0,n);return r.die(),o}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),e})(Gs);function Xs(t){return typeof t=="object"&&t&&t.isType===!0}var OC=1,ap;function AC(){return ap}function IC(){return OC++}function RC(t,e){var r=$t(t.context);t.type==="action"&&r.assertAlive({actionContext:t});var n=r._isRunningAction;r._isRunningAction=!0;var i=ap;ap=t;try{return NC(r,t,e)}finally{ap=i,r._isRunningAction=n}}function MC(t){if(t)return t.type==="action"?t:t.parentActionEvent}function wp(t,e,r){var n=function(){var i=IC(),a=ap,o=MC(a);return RC({type:"action",name:e,id:i,args:eO(arguments),context:t,tree:SC(t),rootId:a?a.rootId:i,parentId:a?a.id:0,allParentIds:a?Pc(Pc([],du(a.allParentIds),!1),[a.id],!1):[],parentEvent:a,parentActionEvent:o},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var DC=(function(){function t(e,r){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),r.$mst_middleware&&this.middlewares.push(r.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e){var r=e[this.inArrayIndex++];return r||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}}),t})();function NC(t,e,r){var n=new DC(t,r);if(n.isEmpty)return Ft(r).apply(null,e.args);var i=null;function a(o){var s=n.getNextMiddleware(),u=s&&s.handler;if(!u)return Ft(r).apply(null,o.args);if(!s.includeHooks&&wn[o.name])return a(o);function f(h,p){i=a(h),p&&(i=p(i))}function d(h){i=h}return u(o,f,d),i}return a(e)}function LC(t){try{return JSON.stringify(t)}catch(e){return"<Unserializable: ".concat(e,">")}}function tk(t){return typeof t=="function"?"<function".concat(t.name?" "+t.name:"",">"):$r(t)?"<".concat(t,">"):"`".concat(LC(t),"`")}function FC(t){return t.length<280?t:"".concat(t.substring(0,272),"......").concat(t.substring(t.length-8))}function BC(t){var e=t.value,r=t.context[t.context.length-1].type,n=t.context.map(function(s){var u=s.path;return u}).filter(function(s){return s.length>0}).join("/"),i=n.length>0?'at path "/'.concat(n,'" '):"",a=$r(e)?"value of type ".concat($t(e).type.name,":"):xp(e)?"value":"snapshot",o=r&&$r(e)&&r.is($t(e).snapshot);return"".concat(i).concat(a," ").concat(tk(e)," is not assignable ").concat(r?"to type: `".concat(r.name,"`"):"")+(t.message?" (".concat(t.message,")"):"")+(r?kO(r)||xp(e)?".":", expected an instance of `".concat(r.name,"` or a snapshot like `").concat(r.describe(),"` instead.")+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function D2(t,e,r){return t.concat([{path:e,type:r}])}function zi(){return xd}function ji(t,e,r){return[{context:t,value:e,message:r}]}function y0(t){return t.reduce(function(e,r){return e.concat(r)},[])}function qs(t,e){rO()&&zC(t,e)}function zC(t,e){var r=t.validate(e,[{path:"",type:t}]);if(r.length>0)throw new xt(jC(t,e,r))}function jC(t,e,r){if(r.length!==0)return"Error while converting ".concat(FC(tk(e))," to `").concat(t.name,`\`:
90
+
91
+ `)+r.map(BC).join(`
92
+ `)}var UC=0,HC=(function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:UC++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Gt.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Gt.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,r===void 0?1:r+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.lastCacheModificationPerId.get(e)||0;return"".concat(this.cacheId,"-").concat(r)}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){if(r===void 0&&(r=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Gt.array([],v0));var i=this.cache.get(n);if(i.indexOf(e)!==-1)throw new xt("Already registered");i.push(e),r&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;BS(e.identifierCache.cache).forEach(function(n){return n.forEach(function(i){r.addNodeToCache(i)})})}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var r=e.identifier,n=this.cache.get(r);n&&(n.remove(e),n.length||this.cache.delete(r),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this,n=new t,i=e.path+"/";return k9(this.cache).forEach(function(a){for(var o=du(a,2),s=o[0],u=o[1],f=!1,d=u.length-1;d>=0;d--){var h=u[d];(h===e||h.path.indexOf(i)===0)&&(n.addNodeToCache(h,!1),u.splice(d,1),u.length||r.cache.delete(s),f=!0)}f&&r.updateLastCacheModificationPerId(s)}),n}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=this.cache.get(r);return n?n.some(function(i){return e.isAssignableFrom(i.type)}):!1}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=this.cache.get(r);if(!n)return null;var i=n.filter(function(a){return e.isAssignableFrom(a.type)});switch(i.length){case 0:return null;case 1:return i[0];default:throw new xt("Cannot resolve a reference to type '".concat(e.name,"' with id: '").concat(r,"' unambigously, there are multiple candidates: ").concat(i.map(function(a){return a.path}).join(", ")))}}}),t})();function N2(t,e,r,n,i){var a=rk(i);if(a){if(a.parent)throw new xt("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(e?e.path:"","/").concat(r,"', but it lives already at '").concat(a.path,"'"));return e&&a.setParent(e,r),a}return new Bi(t,e,r,n,i)}function xu(t,e,r,n,i){return new bp(t,e,r,n,i)}function $C(t){return t instanceof bp||t instanceof Bi}var qn;(function(t){t[t.INITIALIZING=0]="INITIALIZING",t[t.CREATED=1]="CREATED",t[t.FINALIZED=2]="FINALIZED",t[t.DETACHING=3]="DETACHING",t[t.DEAD=4]="DEAD"})(qn||(qn={}));function $r(t){return!!(t&&t.$treenode)}function $t(t){if(!$r(t))throw new xt("Value ".concat(t," is no MST Node"));return t.$treenode}function rk(t){return t&&t.$treenode||null}function qC(){return $t(this).snapshot}function VC(t,e,r){return r===void 0&&(r=!0),nk(t,ck(e),r)}function nk(t,e,r){r===void 0&&(r=!0);var n=t;try{for(var i=0;i<e.length;i++){var a=e[i];if(a===".."){if(n=n.parent,n)continue}else{if(a===".")continue;if(n){if(n instanceof bp){var o=n.value;$r(o)&&(n=$t(o))}if(n instanceof Bi){var s=n.getChildType(a);if(s&&(n=n.getChildNode(a),n))continue}}}throw new xt("Could not resolve '".concat(a,"' in path '").concat(y3(e.slice(0,i))||"/","' while resolving '").concat(y3(e),"'"))}}catch(u){if(!r)return;throw u}return n}function ik(t){if(!t)return xd;var e=Object.keys(t);if(!e.length)return xd;var r=new Array(e.length);return e.forEach(function(n,i){r[i]=t[n]}),r}var WC=Object.toString(),xd=Object.freeze([]),Sd=Object.freeze({}),v0=Y_().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(v0);var xt=(function(t){Ir(e,t);function e(r){return r===void 0&&(r="Illegal state"),t.call(this,"[mobx-state-tree] ".concat(r))||this}return e})(Error);function GC(t){return t}var XC=Number.isInteger;function YC(t){return Number(t)===t&&t%1!==0}function KC(t){return Number.isFinite(t)}function ak(t){return Array.isArray(t)||Yo(t)}function ok(t){return t?ak(t)?t:[t]:xd}function QC(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n++){var i=e[n];for(var a in i)t[a]=i[a]}return t}function td(t){var e;if(t===null||typeof t!="object")return!1;var r=Object.getPrototypeOf(t);return r==null?!0:((e=r.constructor)===null||e===void 0?void 0:e.toString())===WC}function sk(t){return t!==null&&typeof t=="object"&&!(t instanceof Date)&&!(t instanceof RegExp)}function xp(t,e){return e===void 0&&(e=!0),t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||e&&t instanceof Date}function lk(t){return typeof t!="function"}function ZC(t,e,r){oo(t)?jS(t,e,r):Object.defineProperty(t,e,r)}function yc(t,e,r){ZC(t,e,{enumerable:!1,writable:!1,configurable:!0,value:r})}var JC=(function(){function t(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(t.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=this;return r===void 0&&(r=!1),r?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(t.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.handlers.indexOf(e);r>=0&&this.handlers.splice(r,1)}}),Object.defineProperty(t.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(t.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this.handlers.slice();n.forEach(function(i){return i.apply(void 0,Pc([],du(e),!1))})}}),t})(),uk=(function(){function t(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(t.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.eventHandlers&&this.eventHandlers[e];return!!r&&r.hasSubscribers}}),Object.defineProperty(t.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){n===void 0&&(n=!1),this.eventHandlers||(this.eventHandlers={});var i=this.eventHandlers[e];return i||(i=this.eventHandlers[e]=new JC),i.register(r,n)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=this.eventHandlers&&this.eventHandlers[e];return!!n&&n.has(r)}}),Object.defineProperty(t.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var n=this.eventHandlers&&this.eventHandlers[e];n&&n.unregister(r)}}),Object.defineProperty(t.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.eventHandlers&&delete this.eventHandlers[e]}}),Object.defineProperty(t.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(t.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this.eventHandlers&&this.eventHandlers[e];a&&(r=a).emit.apply(r,Pc([],du(n),!1))}}),t})();function eO(t){for(var e=new Array(t.length),r=0;r<t.length;r++)e[r]=t[r];return e}function z1(t,e){return t.indexOf(e)===0}function tO(t){console.warn(new Error("[mobx-state-tree] ".concat(t)))}function rO(){return typeof process<"u"&&p3&&p3.ENABLE_TYPE_CHECK==="true"}function nO(t){if(!("oldValue"in t))throw new xt("Patches without `oldValue` field cannot be inversed");return[iO(t),aO(t)]}function iO(t){switch(t.op){case"add":return{op:"add",path:t.path,value:t.value};case"remove":return{op:"remove",path:t.path};case"replace":return{op:"replace",path:t.path,value:t.value}}}function aO(t){switch(t.op){case"add":return{op:"remove",path:t.path};case"remove":return{op:"add",path:t.path,value:t.oldValue};case"replace":return{op:"replace",path:t.path,value:t.oldValue}}}function oO(t){return typeof t=="number"}function vc(t){return oO(t)===!0?""+t:t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function sO(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function y3(t){if(t.length===0)return"";var e=function(r){return r.map(vc).join("/")};return t[0]==="."||t[0]===".."?e(t):"/"+e(t)}function ck(t){var e=t.split("/").map(sO),r=t===""||t==="."||t===".."||z1(t,"/")||z1(t,"./")||z1(t,"../");if(!r)throw new xt("a json path must be either rooted, empty or relative, but got '".concat(t,"'"));return e[0]===""&&e.shift(),e}var j1=Symbol("$preProcessorFailed"),lO=(function(t){Ir(e,t);function e(r,n,i){var a=t.call(this,i||r.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:n}),a}return Object.defineProperty(e.prototype,"flags",{get:function(){return this._subtype.flags|Qt.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor(".concat(this._subtype.describe(),")")}}),Object.defineProperty(e.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._processors.preProcessor?this._processors.preProcessor.call(null,r):r}}),Object.defineProperty(e.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(r){try{return this.preProcessSnapshot(r)}catch{return j1}}}),Object.defineProperty(e.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this._processors.postProcessor?this._processors.postProcessor.call(null,r,n.storedValue):r}}),Object.defineProperty(e.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;uO(r.type,this,"create"),r instanceof Bi&&(r.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=r.getSnapshot;r.getSnapshot=function(){return n.postProcessSnapshot(i.call(r),r)},OO(this._subtype)||(r.getReconciliationType=function(){return n})}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=$r(a)?a:this.preProcessSnapshot(a),s=this._subtype.instantiate(r,n,i,o);return this._fixNode(s),s}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=this._subtype.reconcile(r,$r(n)?n:this.preProcessSnapshot(n),i,a);return o!==r&&this._fixNode(o),o}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n=!0);var i=this._subtype.getSnapshot(r);return n?this.postProcessSnapshot(i,r):i}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this.preProcessSnapshotSafe(r);return i===j1?ji(n,r,"Failed to preprocess value"):this._subtype.validate(i,n)}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(e.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=Xs(r)?this._subtype:$r(r)?r:this.preProcessSnapshotSafe(r);return n===j1?!1:this._subtype.validate(n,[{path:"",type:this._subtype}]).length===0}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._subtype.isAssignableFrom(r)}}),Object.defineProperty(e.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(!(this._subtype instanceof wd))return!1;var i=this.preProcessSnapshot(n);return this._subtype.isMatchingSnapshotId(r,i)}}),e})(Gs);function uO(t,e){for(var r,n,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var o=ip(i),s=o.next();!s.done;s=o.next()){var u=s.value;t[u]=e[u].bind(e)}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}function cO(t,e,r){return new lO(t,e,r)}var v3="Map.put can only be used to store complex values that have an identifier type attribute";function fk(t,e){var r,n,i=t.getSubTypes();if(i===ek)return!1;if(i){var a=ok(i);try{for(var o=ip(a),s=o.next();!s.done;s=o.next()){var u=s.value;if(!fk(u,e))return!1}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return t instanceof Sp&&e.push(t),!0}var Zl;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.YES=1]="YES",t[t.NO=2]="NO"})(Zl||(Zl={}));var fO=(function(t){Ir(e,t);function e(r,n){return t.call(this,r,Gt.ref.enhancer,n)||this}return Object.defineProperty(e.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return t.prototype.get.call(this,""+r)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return t.prototype.has.call(this,""+r)}}),Object.defineProperty(e.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return t.prototype.delete.call(this,""+r)}}),Object.defineProperty(e.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return t.prototype.set.call(this,""+r,n)}}),Object.defineProperty(e.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!r)throw new xt("Map.put cannot be used to set empty values");if($r(r)){var n=$t(r);if(n.identifier===null)throw new xt(v3);return this.set(n.identifier,r),r}else if(sk(r)){var i=$t(this),a=i.type;if(a.identifierMode!==Zl.YES)throw new xt(v3);var o=a.mapIdentifierAttribute,s=r[o];if(!L2(s)){var u=this.put(a.getChildType().create(r,i.environment));return this.put(Fo(u))}var f=zp(s);return this.set(f,r),this.get(f)}else throw new xt("Map.put can only be used to store complex values")}}),e})(b2),$g=(function(t){Ir(e,t);function e(r,n,i){i===void 0&&(i=[]);var a=t.call(this,r)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Zl.UNKNOWN}),Object.defineProperty(a,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Map}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a._determineIdentifierMode(),a.hookInitializers=i,a}return Object.defineProperty(e.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.hookInitializers.length>0?this.hookInitializers.concat(r):[r];return new e(this.name,this._subType,n)}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this._determineIdentifierMode(),N2(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Zl.UNKNOWN){var r=[];if(fk(this._subType,r)){var n=r.reduce(function(i,a){if(!a.identifierAttribute)return i;if(i&&i!==a.identifierAttribute)throw new xt("The objects in a map should all have the same identifier attribute, expected '".concat(i,"', but child of type '").concat(a.name,"' declared attribute '").concat(a.identifierAttribute,"' as identifier"));return a.identifierAttribute},void 0);n?(this.identifierMode=Zl.YES,this.mapIdentifierAttribute=n):this.identifierMode=Zl.NO}}}}),Object.defineProperty(e.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n={});var i=r.type._subType,a={};return Object.keys(n).forEach(function(o){a[o]=i.instantiate(r,o,void 0,n[o])}),a}}),Object.defineProperty(e.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return new fO(r,this.name)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){LS(n,r.unbox);var i=r.type;i.hookInitializers.forEach(function(a){var o=a(n);Object.keys(o).forEach(function(s){var u=o[s],f=wp(n,s,u);yc(n,s,f)})}),g2(n,this.willChange),y2(n,this.didChange)}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(e.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return BS(r.storedValue)}}),Object.defineProperty(e.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=r.storedValue.get(""+n);if(!i)throw new xt("Not a child "+n);return i}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object),i=r.name;n.assertWritable({subpath:i});var a=n.type,o=a._subType;switch(r.type){case"update":{var s=r.newValue,u=r.object.get(i);if(s===u)return null;qs(o,s),r.newValue=o.reconcile(n.getChildNode(i),r.newValue,n,i),a.processIdentifier(i,r.newValue)}break;case"add":qs(o,r.newValue),r.newValue=o.instantiate(n,i,void 0,r.newValue),a.processIdentifier(i,r.newValue);break}return r}}),Object.defineProperty(e.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this.identifierMode===Zl.YES&&n instanceof Bi){var i=n.identifier;if(i!==r)throw new xt("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(r,"'"))}}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return r.getChildren().forEach(function(i){n[i.subpath]=i.snapshot}),n}}),Object.defineProperty(e.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return Object.keys(r).forEach(function(i){n[i]=r[i].getSnapshot()}),n}}),Object.defineProperty(e.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path:vc(r.name),value:r.newValue.snapshot,oldValue:r.oldValue?r.oldValue.snapshot:void 0},n);case"add":return void n.emitPatch({op:"add",path:vc(r.name),value:r.newValue.snapshot,oldValue:void 0},n);case"delete":var i=r.oldValue.snapshot;return r.oldValue.die(),void n.emitPatch({op:"remove",path:vc(r.name),oldValue:i},n)}}}),Object.defineProperty(e.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var a=r.storedValue;switch(i.op){case"add":case"replace":a.set(n,i.value);break;case"remove":a.delete(n);break}}}),Object.defineProperty(e.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){qs(this,n);var i=r.storedValue,a={};if(Array.from(i.keys()).forEach(function(s){a[s]=!1}),n)for(var o in n)i.set(o,n[o]),a[""+o]=!0;Object.keys(a).forEach(function(s){a[s]===!1&&i.delete(s)})}}),Object.defineProperty(e.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;return td(r)?y0(Object.keys(r).map(function(a){return i._subType.validate(r[a],D2(n,a,i._subType))})):ji(n,r,"Value is not a plain object")}}),Object.defineProperty(e.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Sd}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue.delete(n)}}),e})(wd);$g.prototype.applySnapshot=Ft($g.prototype.applySnapshot);function dO(t){return new $g("Map<string, ".concat(t.name,">"),t)}var qg=(function(t){Ir(e,t);function e(r,n,i){i===void 0&&(i=[]);var a=t.call(this,r)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Array}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a.hookInitializers=i,a}return Object.defineProperty(e.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.hookInitializers.length>0?this.hookInitializers.concat(r):[r];return new e(this.name,this._subType,n)}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return N2(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n=[]);var i=r.type._subType,a={};return n.forEach(function(o,s){var u=""+s;a[u]=i.instantiate(r,u,void 0,o)}),a}}),Object.defineProperty(e.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=Xo(Xo({},v0),{name:this.name});return Gt.array(ik(r),n)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){Wo(n).dehancer=r.unbox;var i=r.type;i.hookInitializers.forEach(function(a){var o=a(n);Object.keys(o).forEach(function(s){var u=o[s],f=wp(n,s,u);yc(n,s,f)})}),g2(n,this.willChange),y2(n,this.didChange)}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(e.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue.slice()}}),Object.defineProperty(e.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=Number(n);if(i<r.storedValue.length)return r.storedValue[i];throw new xt("Not a child: "+n)}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object);n.assertWritable({subpath:""+r.index});var i=n.type._subType,a=n.getChildren();switch(r.type){case"update":{if(r.newValue===r.object[r.index])return null;var o=b3(n,i,[a[r.index]],[r.newValue],[r.index]);if(!o)return null;r.newValue=o[0]}break;case"splice":{var s=r.index,u=r.removedCount,f=r.added,d=b3(n,i,a.slice(s,s+u),f,f.map(function(p,y){return s+y}));if(!d)return null;r.added=d;for(var h=s+u;h<a.length;h++)a[h].setParent(n,""+(h+f.length-u))}break}return r}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.getChildren().map(function(n){return n.snapshot})}}),Object.defineProperty(e.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=[];return Object.keys(r).forEach(function(i){n.push(r[i].getSnapshot())}),n}}),Object.defineProperty(e.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=$t(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path:""+r.index,value:r.newValue.snapshot,oldValue:r.oldValue?r.oldValue.snapshot:void 0},n);case"splice":if(r.removedCount&&r.addedCount===r.object.length)return void n.emitPatch({op:"replace",path:"",value:n.snapshot,oldValue:r.removed.map(function(a){return a.snapshot})},n);for(var i=r.removedCount-1;i>=0;i--)n.emitPatch({op:"remove",path:""+(r.index+i),oldValue:r.removed[i].snapshot},n);for(var i=0;i<r.addedCount;i++)n.emitPatch({op:"add",path:""+(r.index+i),value:r.added[i].snapshot,oldValue:void 0},n);return}}}),Object.defineProperty(e.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var a=r.storedValue,o=n==="-"?a.length:Number(n);switch(i.op){case"replace":a[o]=i.value;break;case"add":a.splice(o,0,i.value);break;case"remove":a.splice(o,1);break}}}),Object.defineProperty(e.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){qs(this,n);var i=r.storedValue;i.replace(n)}}),Object.defineProperty(e.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;return ak(r)?y0(r.map(function(a,o){return i._subType.validate(a,D2(n,""+o,i._subType))})):ji(n,r,"Value is not an array")}}),Object.defineProperty(e.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return xd}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue.splice(Number(n),1)}}),e})(wd);qg.prototype.applySnapshot=Ft(qg.prototype.applySnapshot);function hO(t){return new qg("".concat(t.name,"[]"),t)}function b3(t,e,r,n,i){for(var a=!0,o=0;;o++){var s=o<=n.length-1,u=r[o],f=s?n[o]:void 0,d=""+i[o];if($C(f)&&(f=f.storedValue),!u&&!s)break;if(!s)a=!1,r.splice(o,1),u instanceof Bi&&u.createObservableInstanceIfNeeded(),u.die(),o--;else if(u)if(w3(u,f))r[o]=U1(e,t,d,f,u);else{for(var p=void 0,y=o;y<r.length;y++)if(w3(r[y],f)){p=r.splice(y,1)[0];break}a=!1;var h=U1(e,t,d,f,p);r.splice(o,0,h)}else{if($r(f)&&$t(f).parent===t)throw new xt("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(t.path,"/").concat(d,"', but it lives already at '").concat($t(f).path,"'"));a=!1;var h=U1(e,t,d,f);r.splice(o,0,h)}}return a?null:r}function U1(t,e,r,n,i){qs(t,n);function a(){if($r(n)){var s=$t(n);if(s.assertAlive(Sd),s.parent!==null&&s.parent===e)return s.setParent(e,r),s}return i?t.reconcile(i,n,e,r):t.instantiate(e,r,void 0,n)}var o=a();return i&&i!==o&&(i instanceof Bi&&i.createObservableInstanceIfNeeded(),i.die()),o}function w3(t,e){if(!t.isAlive)return!1;if($r(e)){var r=$t(e);return r.isAlive&&r===t}if(t.snapshot===e)return!0;if(!(t instanceof Bi))return!1;var n=t.getReconciliationType();return t.identifier!==null&&t.identifierAttribute&&td(e)&&n.is(e)&&n.isMatchingSnapshotId(t,e)}var x3="preProcessSnapshot",S3="postProcessSnapshot";function pO(){return $t(this).toString()}var k3={name:"AnonymousModel",properties:{},initializers:xd};function mO(t){var e=Object.keys(t),r=new Set;return e.forEach(function(n){if(r.has(n))throw new xt("".concat(n," is declared twice in the model. Model should not contain the same keys"));r.add(n)}),e.reduce(function(n,i){if(i in wn)throw new xt("Hook '".concat(i,"' was defined as property. Hooks should be defined as part of the actions"));var a=Object.getOwnPropertyDescriptor(t,i);if("get"in a)throw new xt("Getters are not supported as properties. Please use views instead");var o=a.value;if(o==null)throw new xt("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(xp(o))n[i]=bc(SO(o),o);else if(o instanceof $g)n[i]=bc(o,{});else if(o instanceof qg)n[i]=bc(o,[]);else if(!Xs(o))throw new xt("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(o,"' (").concat(typeof o,")"));return n},Xo({},t))}var Sp=(function(t){Ir(e,t);function e(r){var n=t.call(this,r.name||k3.name)||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Object}),Object.defineProperty(n,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return n.cloneAndEnhance({name:i})}}),Object.defineProperty(n,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return n.cloneAndEnhance({properties:i})}}),Object.defineProperty(n,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=n.preProcessor;return a?n.cloneAndEnhance({preProcessor:function(o){return a(i(o))}}):n.cloneAndEnhance({preProcessor:i})}}),Object.defineProperty(n,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=n.postProcessor;return a?n.cloneAndEnhance({postProcessor:function(o){return i(a(o))}}):n.cloneAndEnhance({postProcessor:i})}}),Object.assign(n,k3,r),n.properties=mO(n.properties),n.properties,n.propertyNames=Object.keys(n.properties),n.identifierAttribute=n._getIdentifierAttribute(),n}return Object.defineProperty(e.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=void 0;return this.forAllProps(function(n,i){if(i.flags&Qt.Identifier){if(r)throw new xt("Cannot define property '".concat(n,"' as object identifier, property '").concat(r,"' is already defined as identifier property"));r=n}}),r}}),Object.defineProperty(e.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return new e({name:r.name||this.name,properties:Object.assign({},this.properties,r.properties),initializers:this.initializers.concat(r.initializers||[]),preProcessor:r.preProcessor||this.preProcessor,postProcessor:r.postProcessor||this.postProcessor})}}),Object.defineProperty(e.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=function(a){return n.instantiateActions(a,r(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(e.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;if(!td(n))throw new xt("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(n).forEach(function(a){if(a in i.properties)throw new xt("'".concat(a,"' is a property and cannot be declared as an action"));if(a===x3)throw new xt("Cannot define action '".concat(x3,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===S3)throw new xt("Cannot define action '".concat(S3,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var o=n[a],s=r[a];if(a in wn&&s){var u=o;o=function(){s.apply(null,arguments),u.apply(null,arguments)}}var f=o.$mst_middleware,d=o.bind(n);d._isFlowAction=o._isFlowAction||!1,d.$mst_middleware=f;var h=wp(r,a,d);n[a]=h,yc(r,a,h)})}}),Object.defineProperty(e.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;if(typeof r!="function")throw new xt("You passed an ".concat(typeof r," to volatile state as an argument, when function is expected"));var i=function(a){return n.instantiateVolatileState(a,r(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(e.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;if(!td(n))throw new xt("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(n).forEach(function(a){if(a in i.properties)throw new xt("'".concat(a,"' is a property and cannot be declared as volatile state"));zS(r,a,n[a])})}}),Object.defineProperty(e.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=function(a){var o=r(a),s=o.actions,u=o.views,f=o.state,d=xC(o,["actions","views","state"]);for(var h in d)throw new xt("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(h,"'"));return f&&n.instantiateVolatileState(a,f),u&&n.instantiateViews(a,u),s&&n.instantiateActions(a,s),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(e.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=function(a){return n.instantiateViews(a,r(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(e.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;if(!td(n))throw new xt("views initializer should return a plain object containing views");Object.getOwnPropertyNames(n).forEach(function(a){var o;if(a in i.properties)throw new xt("'".concat(a,"' is a property and cannot be declared as a view"));var s=Object.getOwnPropertyDescriptor(n,a);if("get"in s)jS(r,a,s),HS(r,(o={},o[a]=Tc,o));else if(typeof s.value=="function")yc(r,a,s.value);else throw new xt("A view member should either be a function or getter based property")})}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=$r(a)?a:this.applySnapshotPreProcessor(a);return N2(this,r,n,i,o)}}),Object.defineProperty(e.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){n===void 0&&(n={});var i=r.type,a={};return i.forAllProps(function(o,s){a[o]=s.instantiate(r,o,void 0,n[o])}),a}}),Object.defineProperty(e.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=Xo(Xo({},v0),{name:this.name});return Gt.object(r,Sd,n)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){yc(n,"toString",pO),this.forAllProps(function(i){LS(n,i,r.unbox)}),this.initializers.reduce(function(i,a){return a(i)},n),g2(n,this.willChange),y2(n,this.didChange)}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r,i=$t(n.object),a=n.name;i.assertWritable({subpath:a});var o=i.type.properties[a];return o&&(qs(o,n.newValue),n.newValue=o.reconcile(i.getChildNode(a),n.newValue,i,a)),n}}),Object.defineProperty(e.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r,i=$t(n.object),a=i.type.properties[n.name];if(a){var o=n.oldValue?n.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:vc(n.name),value:n.newValue.snapshot,oldValue:o},i)}}}),Object.defineProperty(e.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this,i=[];return this.forAllProps(function(a){i.push(n.getChildNode(r,a))}),i}}),Object.defineProperty(e.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i;if(!(n in this.properties))throw new xt("Not a value property: "+n);var a=Wo(r.storedValue,n),o=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!o)throw new xt("Node not available for property "+n);return o}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this;n===void 0&&(n=!0);var a={};return this.forAllProps(function(o,s){var u=vd(r.storedValue,o);u.reportObserved(),a[o]=i.getChildNode(r,o).snapshot}),n?this.applySnapshotPostProcessor(a):a}}),Object.defineProperty(e.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n={};return Object.keys(r).forEach(function(i){n[i]=r[i].getSnapshot()}),this.applySnapshotPostProcessor(n)}}),Object.defineProperty(e.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){if(!(i.op==="replace"||i.op==="add"))throw new xt("object does not support operation ".concat(i.op));r.storedValue[n]=i.value}}),Object.defineProperty(e.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){qs(this,n);var i=this.applySnapshotPreProcessor(n);this.forAllProps(function(a){r.storedValue[a]=i[a]})}}),Object.defineProperty(e.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.preProcessor;return n?n.call(null,r):r}}),Object.defineProperty(e.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.postProcessor;return n?n.call(null,r):r}}),Object.defineProperty(e.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.properties[r]}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this,a=this.applySnapshotPreProcessor(r);return td(a)?y0(this.propertyNames.map(function(o){return i.properties[o].validate(a[o],D2(n,o,i.properties[o]))})):ji(n,a,"Value is not a plain object")}}),Object.defineProperty(e.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;this.propertyNames.forEach(function(i){return r(i,n.properties[i])})}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this;return"{ "+this.propertyNames.map(function(n){return n+": "+r.properties[n].describe()}).join("; ")+" }"}}),Object.defineProperty(e.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Sd}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue[n]=void 0}}),e})(wd);Sp.prototype.applySnapshot=Ft(Sp.prototype.applySnapshot);function gO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=typeof t[0]=="string"?t.shift():"AnonymousModel",n=t.shift()||{};return new Sp({name:r,properties:n})}function yO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=typeof t[0]=="string",n=r?t[0]:"AnonymousModel";return r&&t.shift(),t.reduce(function(i,a){return i.cloneAndEnhance({name:i.name+"_"+a.name,properties:a.properties,initializers:a.initializers,preProcessor:function(o){return a.applySnapshotPreProcessor(i.applySnapshotPreProcessor(o))},postProcessor:function(o){return a.applySnapshotPostProcessor(i.applySnapshotPostProcessor(o))}})}).named(n)}function vO(t){return Xs(t)&&(t.flags&Qt.Object)>0}var el=(function(t){Ir(e,t);function e(r,n,i,a){a===void 0&&(a=GC);var o=t.call(this,r)||this;return Object.defineProperty(o,"flags",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"checker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:a}),o.flags=n,o}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return xu(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.initializer(r)}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(xp(r)&&this.checker(r))return zi();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return ji(n,r,"Value is not a ".concat(i))}}),e})(Nc),dk=new el("string",Qt.String,function(t){return typeof t=="string"}),hk=new el("number",Qt.Number,function(t){return typeof t=="number"}),bO=new el("integer",Qt.Integer,function(t){return XC(t)}),wO=new el("float",Qt.Float,function(t){return YC(t)}),xO=new el("finite",Qt.Finite,function(t){return KC(t)}),pk=new el("boolean",Qt.Boolean,function(t){return typeof t=="boolean"}),mk=new el("null",Qt.Null,function(t){return t===null}),gk=new el("undefined",Qt.Undefined,function(t){return t===void 0}),yk=new el("Date",Qt.Date,function(t){return typeof t=="number"||t instanceof Date},function(t){return t instanceof Date?t:new Date(t)});yk.getSnapshot=function(t){return t.storedValue.getTime()};var vk=yk;function SO(t){switch(typeof t){case"string":return dk;case"number":return hk;case"boolean":return pk;case"object":if(t instanceof Date)return vk}throw new xt("Cannot determine primitive type from value "+t)}function kO(t){return Xs(t)&&(t.flags&(Qt.String|Qt.Number|Qt.Integer|Qt.Boolean|Qt.Date))>0}var _O=(function(t){Ir(e,t);function e(r){var n=t.call(this,JSON.stringify(r))||this;return Object.defineProperty(n,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Literal}),n.value=r,n}return Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return xu(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return xp(r)&&r===this.value?zi():ji(n,r,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),e})(Nc);function bk(t){return new _O(t)}var PO=(function(t){Ir(e,t);function e(r,n,i,a){var o=t.call(this,r)||this;return Object.defineProperty(o,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_message",{enumerable:!0,configurable:!0,writable:!0,value:a}),o}return Object.defineProperty(e.prototype,"flags",{get:function(){return this._subtype.flags|Qt.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this._subtype.instantiate(r,n,i,a)}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._subtype.isAssignableFrom(r)}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this._subtype.validate(r,n);if(i.length>0)return i;var a=$r(r)?$t(r).snapshot:r;return this._predicate(a)?zi():ji(n,r,this._message(r))}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this._subtype.reconcile(r,n,i,a)}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),e})(Gs);function EO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=typeof t[0]=="string"?t.shift():Xs(t[0])?t[0].name:null,n=t[0],i=t[1],a=t[2]?t[2]:function(o){return"Value does not respect the refinement predicate"};return new PO(r,n,i,a)}function TO(t,e){var r=typeof t=="string"?e:t,n=b0.apply(void 0,Pc([],du(r.map(function(i){return bk(""+i)})),!1));return typeof t=="string"&&(n.name=t),n}var CO=(function(t){Ir(e,t);function e(r,n,i){var a=t.call(this,r)||this;return Object.defineProperty(a,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),i=Xo({eager:!0,dispatcher:void 0},i),a._dispatcher=i.dispatcher,i.eager||(a._eager=!1),a}return Object.defineProperty(e.prototype,"flags",{get:function(){var r=Qt.Union;return this._types.forEach(function(n){r|=n.flags}),r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._types.some(function(n){return n.isAssignableFrom(r)})}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(r){return r.describe()}).join(" | ")+")"}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=this.determineType(a,void 0);if(!o)throw new xt("No matching type for union "+this.describe());return o.instantiate(r,n,i,a)}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=this.determineType(n,r.getReconciliationType());if(!o)throw new xt("No matching type for union "+this.describe());return o.reconcile(r,n,i,a)}}),Object.defineProperty(e.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this._dispatcher?this._dispatcher(r):n?n.is(r)?n:this._types.filter(function(i){return i!==n}).find(function(i){return i.is(r)}):this._types.find(function(i){return i.is(r)})}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this._dispatcher)return this._dispatcher(r).validate(r,n);for(var i=[],a=0,o=0;o<this._types.length;o++){var s=this._types[o],u=s.validate(r,n);if(u.length===0){if(this._eager)return zi();a++}else i.push(u)}return a===1?zi():ji(n,r,"No type is applicable for the union").concat(y0(i))}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),e})(Gs);function b0(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=Xs(t)?void 0:t,i=Xs(t)?Pc([t],du(e),!1):e,a="("+i.map(function(o){return o.name}).join(" | ")+")";return new CO(a,i,n)}function OO(t){return Xs(t)&&(t.flags&Qt.Union)>0}var AO=(function(t){Ir(e,t);function e(r,n,i){var a=t.call(this,r.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),a}return Object.defineProperty(e.prototype,"flags",{get:function(){return this._subtype.flags|Qt.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){if(this.optionalValues.indexOf(a)>=0){var o=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(r,n,i,o)}return this._subtype.instantiate(r,n,i,a)}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this._subtype.reconcile(r,this.optionalValues.indexOf(n)<0&&this._subtype.is(n)?n:this.getDefaultInstanceOrSnapshot(),i,a)}}),Object.defineProperty(e.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=typeof this._defaultValue=="function"?this._defaultValue():this._defaultValue;return typeof this._defaultValue=="function"&&qs(this,r),r}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this.optionalValues.indexOf(r)>=0?zi():this._subtype.validate(r,n)}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._subtype.isAssignableFrom(r)}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),e})(Gs);function IO(t,e){if(typeof e!="function"&&$r(e))throw new xt("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function bc(t,e,r){return IO(t,e),new AO(t,e,r||RO)}var RO=[void 0],MO=bc(gk,void 0),DO=bc(mk,null);function wk(t){return b0(t,MO)}function NO(t){return b0(t,DO)}var LO=(function(t){Ir(e,t);function e(r,n){var i=t.call(this,r)||this;return Object.defineProperty(i,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return Object.defineProperty(e.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Qt.Late},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!this._subType){var n=void 0;try{n=this._definition()}catch(i){if(i instanceof ReferenceError)n=void 0;else throw i}if(r&&n===void 0)throw new xt("Late type seems to be used too early, the definition (still) returns undefined");n&&(this._subType=n)}return this._subType}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this.getSubType(!0).instantiate(r,n,i,a)}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this.getSubType(!0).reconcile(r,n,i,a)}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this.getSubType(!1);return r?r.name:"<uknown late type>"}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this.getSubType(!1);return i?i.validate(r,n):zi()}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this.getSubType(!1);return n?n.isAssignableFrom(r):!1}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this.getSubType(!1);return r||ek}}),e})(Gs);function FO(t,e){var r=typeof t=="string"?t:"late(".concat(t.toString(),")"),n=typeof t=="string"?e:t;return new LO(r,n)}function BO(t,e){return new zO(t,e)}var zO=(function(t){Ir(e,t);function e(r,n){var i=t.call(this,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Gt.array()}),Jb(function(){return i.pendingNodeList.length>0&&i.pendingNodeList.some(function(a){return a.isAlive&&i.options.shouldLoadPredicate(a.parent?a.parent.value:null)})},function(){i.options.loadType().then(Ft(function(a){i.loadedType=a,i.pendingNodeList.forEach(function(o){o.parent&&i.loadedType&&o.parent.applyPatches([{op:"replace",path:"/".concat(o.subpath),value:o.snapshot}])})}))}),i}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<lazy ".concat(this.name,">")}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=this;if(this.loadedType)return this.loadedType.instantiate(r,n,i,a);var s=xu(this,r,n,i,a);return this.pendingNodeList.push(s),Jb(function(){return!s.isAlive},function(){return o.pendingNodeList.splice(o.pendingNodeList.indexOf(s),1)}),s}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this.loadedType?this.loadedType.validate(r,n):lk(r)?zi():ji(n,r,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return this.loadedType?(r.die(),this.loadedType.instantiate(i,a,i.environment,n)):t.prototype.reconcile.call(this,r,n,i,a)}}),e})(Nc),xk=(function(t){Ir(e,t);function e(r){var n=t.call(this,r?"frozen(".concat(r.name,")"):"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Frozen}),n}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return xu(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return lk(r)?this.subType?this.subType.validate(r,n):zi():ji(n,r,"Value is not serializable and cannot be frozen")}}),e})(Nc),_3=new xk;function jO(t){return arguments.length===0?_3:Xs(t)?new xk(t):bc(_3,t)}function UO(t){switch(t){case wn.beforeDestroy:return"destroy";case wn.beforeDetach:return"detach";default:return}}var HO=(function(){function t(e,r){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),L2(e))this.identifier=e;else if($r(e)){var n=$t(e);if(!n.identifierAttribute)throw new xt("Can only store references with a defined identifier attribute.");var i=n.unnormalizedIdentifier;if(i==null)throw new xt("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new xt("Can only store references to tree nodes or identifiers, got: '".concat(e,"'"))}return Object.defineProperty(t.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=zp(this.identifier),n=e.root,i=n.identifierCache.getLastCacheModificationPerId(r);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==i){var a=this.targetType,o=n.identifierCache.resolve(a,r);if(!o)throw new $O("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier,"' to type '").concat(this.targetType.name,"' (from node: ").concat(e.path,")"));this.resolvedReference={node:o,lastCacheModification:i}}}}),Object.defineProperty(t.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),t})(),$O=(function(t){Ir(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return e})(Error),Sk=(function(t){Ir(e,t);function e(r,n){var i=t.call(this,"reference(".concat(r.name,")"))||this;return Object.defineProperty(i,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Reference}),i}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.targetType.isAssignableFrom(r)}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return L2(r)?zi():ji(n,r,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(e.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=n.parent;if(!(!o||!o.isAlive)){var s=o.storedValue;s&&this.onInvalidated({cause:r,parent:s,invalidTarget:a?a.storedValue:void 0,invalidId:i,replaceRef:function(u){m3(n.root.storedValue,{op:"replace",value:u,path:n.path})},removeRef:function(){vO(o.type)?this.replaceRef(void 0):m3(n.root.storedValue,{op:"remove",path:n.path})}})}}}),Object.defineProperty(e.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){var i=this,a=this.getValue(r);if(a){var o=$t(a),s=function(d,h){var p=UO(h);p&&i.fireInvalidated(p,r,n,o)},u=o.registerHook(wn.beforeDetach,s),f=o.registerHook(wn.beforeDestroy,s);return function(){u(),f()}}}}),Object.defineProperty(e.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i){var a=this;if(this.onInvalidated){var o;r.registerHook(wn.beforeDestroy,function(){o&&o()});var s=function(u){o&&o();var f=r.parent,d=f&&f.storedValue;if(f&&f.isAlive&&d){var h=void 0;i?h=!!i.get(n,d):h=r.root.identifierCache.has(a.targetType,zp(n)),h?o=a.addTargetNodeWatcher(r,n):u||a.fireInvalidated("invalidSnapshotReference",r,n,null)}};r.state===qn.FINALIZED?s(!0):(r.isRoot||r.root.registerHook(wn.afterCreationFinalization,function(){r.parent&&r.parent.createObservableInstanceIfNeeded()}),r.registerHook(wn.afterAttach,function(){s(!1)}))}}}),e})(Nc),qO=(function(t){Ir(e,t);function e(r,n){return t.call(this,r,n)||this}return Object.defineProperty(e.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(r.isAlive){var n=r.storedValue;return n.resolvedValue}}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r.storedValue;return n.identifier}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=$r(a)?PC(a):a,s=new HO(a,this.targetType),u=xu(this,r,n,i,s);return s.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){if(!r.isDetaching&&r.type===this){var o=$r(n),s=r.storedValue;if(!o&&s.identifier===n||o&&s.resolvedValue===n)return r.setParent(i,a),r}var u=this.instantiate(i,a,void 0,n);return r.die(),u}}),e})(Sk),VO=(function(t){Ir(e,t);function e(r,n,i){var a=t.call(this,r,i)||this;return Object.defineProperty(a,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),a}return Object.defineProperty(e.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(r.isAlive){var n=this.options.get(r.storedValue,r.parent?r.parent.storedValue:null);return n}}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=$r(a)?this.options.set(a,r?r.storedValue:null):a,s=xu(this,r,n,i,o);return this.watchTargetNodeForInvalidations(s,o,this.options),s}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=$r(n)?this.options.set(n,r?r.storedValue:null):n;if(!r.isDetaching&&r.type===this&&r.storedValue===o)return r.setParent(i,a),r;var s=this.instantiate(i,a,void 0,o);return r.die(),s}}),e})(Sk);function kk(t,e){var r=e||void 0,n=e?e.onInvalidated:void 0;return r&&(r.get||r.set)?new VO(t,{get:r.get,set:r.set},n):new qO(t,n)}function WO(t,e){var r=kk(t,Xo(Xo({},e),{onInvalidated:function(n){e&&e.onInvalidated&&e.onInvalidated(n),n.removeRef()}}));return e&&e.acceptsUndefined===!1?r:wk(r)}var _k=(function(t){Ir(e,t);function e(r,n){var i=t.call(this,r)||this;return Object.defineProperty(i,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Identifier}),i}return Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){if(!r||!(r.type instanceof Sp))throw new xt("Identifier types can only be instantiated as direct child of a model type");return xu(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){if(r.storedValue!==n)throw new xt("Tried to change identifier from '".concat(r.storedValue,"' to '").concat(n,"'. Changing identifiers is not allowed."));return r.setParent(i,a),r}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return typeof r!==this.validType?ji(n,r,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):zi()}}),e})(Nc),GO=(function(t){Ir(e,t);function e(){var r=t.call(this,"identifier","string")||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Identifier}),r}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),e})(_k),XO=(function(t){Ir(e,t);function e(){return t.call(this,"identifierNumber","number")||this}return Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return r.storedValue}}),Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),e})(_k),YO=new GO,KO=new XO;function zp(t){return""+t}function L2(t){return typeof t=="string"||typeof t=="number"}function QO(t){return new ZO(t)}var ZO=(function(t){Ir(e,t);function e(r){var n=t.call(this,r.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Qt.Custom}),n}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this.options.isTargetType(r))return zi();var i=this.options.getValidationMessage(r);return i?ji(n,r,"Invalid value for type '".concat(this.name,"': ").concat(i)):zi()}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this.options.toSnapshot(r.storedValue)}}),Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=this.options.isTargetType(a)?a:this.options.fromSnapshot(a,r&&r.root.environment);return xu(this,r,n,i,o)}}),Object.defineProperty(e.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){var o=!this.options.isTargetType(n);if(!r.isDetaching){var s=r.type===this&&(o?n===r.snapshot:n===r.storedValue);if(s)return r.setParent(i,a),r}var u=o?this.options.fromSnapshot(n,i.root.environment):n,f=this.instantiate(i,a,void 0,u);return r.die(),f}}),e})(Nc),ut={enumeration:TO,model:gO,compose:yO,custom:QO,reference:kk,safeReference:WO,union:b0,optional:bc,literal:bk,maybe:wk,maybeNull:NO,refinement:EO,string:dk,boolean:pk,number:hk,integer:bO,float:wO,finite:xO,Date:vk,map:dO,array:hO,frozen:jO,identifier:YO,identifierNumber:KO,late:FO,lazy:BO,undefined:gk,null:mk,snapshotProcessor:cO};function Pk({oldText:t,newText:e,element:r}){if(!(e.length/Math.max(20,t.length)>=4))return r.fontSize;const n=r.width*r.page.computedHeight/e.length,i=1.5*Math.sqrt(n),a=r.fontSize;return Math.min(a,Math.max(5,Math.round(i)))}function JO(t){try{const{stops:e}=Fp(t);if(e.length===0)return 127.5;let r=0,n=0;for(const i of e)try{const a=_t.Util.colorToRGBA(i.color);if(!a||a.a<.5)continue;r+=(299*a.r+587*a.g+114*a.b)/1e3,n++}catch{continue}return n===0?127.5:r/n}catch(e){return console.warn("Error calculating gradient brightness:",e),127.5}}function P3(t){if(an(t))return JO(t);const e=_t.Util.colorToRGBA(t);if(!e)return 127.5;const{r,g:n,b:i}=e;return(299*r+587*n+114*i)/1e3}function Ek(t){const{outlineSize:e,outlineColor:r}=(function(a){const o=a.strokeWidth||0;return o>0?{outlineSize:o,outlineColor:a.stroke}:{outlineSize:a.shadowEnabled&&a.shadowBlur>0&&a.shadowOpacity>.1?a.shadowBlur*a.shadowOpacity:0,outlineColor:a.shadowColor}})(t);if(e<.001)return t.fill;const n=P3(t.fill),i=P3(r);return Math.abs(n-i)>=50?r:t.fill}let ic;function eA(){return ic||(ic=document.getElementById("polotno-text-style"),ic||(ic=document.createElement("style"),ic.id="polotno-text-style",document.head.appendChild(ic)),ic)}_t._fixTextRendering=!0;const E3={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal",textTransform:"none"},tA=Sr(({textNodeRef:t,element:e,onBlur:r,selectAll:n,cursorPosition:i})=>{const[a,o]=Y.useState(E3),s=t.current;Y.useLayoutEffect(()=>{const p={};p.width=s.width()-2*s.padding()+"px",p.height=s.height()-2*s.padding()+s.fontSize()*s.lineHeight()+"px",p.fontSize=s.fontSize()+"px",p.lineHeight=s.lineHeight()+.01,p.fontFamily=s.fontFamily(),p.textAlign=s.align(),p.color=s.fill(),p.fontWeight=e.fontWeight,p.fontStyle=e.fontStyle,p.letterSpacing=e.letterSpacing+"em",p.opacity=Math.max(e.a.opacity,.2),p.textTransform=e.textTransform,p.caretColor=Ek(e);const y=`
93
+ .polotno-input::placeholder {
94
+ color: ${a.color};
95
+ opacity: 0.6;
96
+ }
97
+ `,v=eA();v.innerHTML="",v.appendChild(document.createTextNode(y)),JSON.stringify(p)!==JSON.stringify(a)&&o(p)});const u=Y.useRef(null);if(Y.useLayoutEffect(()=>{var p;const y=u.current;if(!y)return;(p=u.current)===null||p===void 0||p.focus();const v=i||y.value.length;y.selectionStart=y.selectionEnd=v,n&&(y?.select(),document.execCommand("selectAll",!1,null))},[]),Y.useEffect(()=>{window.addEventListener("blur",r);const p=y=>{var v;!((v=u.current)===null||v===void 0)&&v.contains(y.target)||r()};return window.addEventListener("touchstart",p),()=>{window.removeEventListener("blur",r),window.removeEventListener("touchstart",p)}},[]),!s)return null;let f=0;const d=s.textArr.length*s.lineHeight()*s.fontSize();e.verticalAlign==="middle"&&(f=(e.a.height-d)/2),e.verticalAlign==="bottom"&&(f=e.a.height-d);const h=ri(e.text);return Y.createElement("textarea",{className:"polotno-input",ref:u,dir:vp(h),style:Object.assign(Object.assign(Object.assign({},E3),a),{paddingTop:f+"px"}),value:h,onChange:p=>{const y=Pk({oldText:e.text,newText:p.target.value,element:e});e.set({text:p.target.value,fontSize:y})},placeholder:e.placeholder,onBlur:r})}),rA=t=>Y.createElement(jg,null,Y.createElement(tA,Object.assign({},t))),Tk=(t,e)=>{const[r,n]=Y.useReducer(o=>o+1,0),i=Y.useRef(c3(e)),a=Y.useRef(null);return Y.useLayoutEffect(()=>{if(i.current=c3(e),i.current)return;let o=!0;return(async()=>{i.current=!1,n();const s=Ws(`text ${e}`);await t.loadFont(e),o?(a.current=s,i.current=!0,n()):s()})(),()=>{a.current&&(a.current(),a.current=null),o=!1}},[e]),Y.useEffect(()=>{i.current&&setTimeout(()=>{a.current&&(a.current(),a.current=null)})},[i.current]),[i.current]},Ck=({fontLoaded:t,fontFamily:e,fontSize:r,lineHeight:n})=>Y.useMemo(()=>yC({fontFamily:e,fontSize:r,lineHeight:n}),[t,e,r,n]);function Vg(t){const e=Y.useRef(t),r=Y.useRef(t);return Y.useMemo(()=>{r.current=e.current,e.current=t},[t]),r.current}const nA=Sr(({element:t,store:e})=>{const r=Y.useRef(null),n=Y.useRef(null),i=Y.useRef(null),{editorEnabled:a,selectAll:o}=(K=>{const[q,J]=Y.useState(!1),U=Y.useRef(!1);return Y.useEffect(()=>{var D=!0;return setTimeout(()=>{D&&(K._editModeEnabled&&(U.current=!0),J(!0),setTimeout(()=>{U.current=!1},50))},50),()=>{D=!1}},[]),{editorEnabled:q&&K._editModeEnabled,selectAll:U.current}})(t),[s,u]=Y.useState(!1),f=Y.useRef(t.a.height),d=e.selectedShapes.indexOf(t)>=0&&t.selectable,h=Vg(d),{textVerticalResizeEnabled:p}=lr,y=lr.autoDeleteEmptyText,v=Vg(t.fontFamily),[b,x]=Y.useState([]);Y.useEffect(()=>{var K,q;const J=(q=(K=r.current)===null||K===void 0?void 0:K.textArr)!==null&&q!==void 0?q:[];JSON.stringify(J)!==JSON.stringify(b)&&x(J)}),Y.useEffect(()=>{if(t.a.width)return;const K=r.current;K.width(600),t.set({width:1.4*K.getTextWidth()})},[]),Y.useEffect(()=>{h&&!d&&y&&t.text===""&&t.removable&&!t.placeholder&&e.deleteElements([t.id])},[y,t.placeholder,t.removable,t.text,d,h]),Y.useLayoutEffect(()=>io(()=>{const K=r.current;Fi(K,t)}));const[k]=Tk(e,t.fontFamily);let S=ri(t.text);t.textTransform==="uppercase"&&(S=S.toUpperCase());const P=()=>{if(t.curveEnabled){const J=n.current;return J.getSelfRect().height||J.fontSize()}const K=r.current.clone({height:void 0}),q=Math.ceil(K.fontSize()*K.lineHeight()*K.textArr.length+1);return K.destroy(),q};Y.useLayoutEffect(()=>{if(!k)return;const{textOverflow:K,textSplitAllowed:q}=lr,J=(U,...D)=>{const W=Ws(`text ${t.id} before ignore`);e.history.ignore(U,...D).then(()=>{W()})};if(!t.a.height){const U=P();return void J(()=>{t.set({height:U})})}if(!e.isPlaying)if(K!=="change-font-size"||s){if(K==="resize"){const U=P();p&&t.a.height<U&&!s&&J(()=>{var D;g3(t)&&t.set({height:U}),(D=r.current)===null||D===void 0||D.height(U)},!1,!0),p||t.a.height===U||s||J(()=>{var D;g3(t)&&t.set({height:U}),(D=r.current)===null||D===void 0||D.height(U)},!1,!0)}}else{const U=(function(W,V,ee=!1){const te=W.fontSize(),Q=W.height(),ne=ri(V.text);let ue=V.a.fontSize;W.height(void 0);const oe=Math.round(2*V.a.fontSize)-1;for(let de=1;de<oe;de++){const Ee=V.a.height&&W.height()>V.a.height;let Fe=ne.split(`
98
+ `).join(" ").split(/[\s-]+/).reduce((Xe,dt)=>(dt=dt.toLowerCase(),/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(dt)?Xe.concat(dt.split("")):Xe.concat(dt)),[]),Le=W.textArr.map(Xe=>Xe.text.toLowerCase()).join(";");const $e=Fe.find(Xe=>!Le.includes(Xe)||(Le=Le.replace(Xe,""),!1));if(!(Ee||$e&&!ee))break;ue-=.5,W.fontSize(ue)}return W.fontSize(te),W.height(Q),ue})(r.current,t,q);if(U!==t.a.fontSize)return void J(()=>{t.set({fontSize:U})},!1,!0);const D=P();t.a.height===D||p||J(()=>{t.set({height:D})},!1,!0)}}),Y.useLayoutEffect(()=>{var K;if(k&&t.curveEnabled){const q=(K=n.current)===null||K===void 0?void 0:K.getSelfRect().width;if(q){const J=q-t.a.width,U=t.a.rotation*Math.PI/180,D=-J/2*Math.cos(U),W=-J/2*Math.sin(U);t.set({width:q,x:t.a.x+D,y:t.a.y+W})}}},[k,t.curveEnabled,t.curvePower,t.text,t.fontSize,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing]),Y.useLayoutEffect(()=>{const K=r.current;K&&(K.width(K.width()+1e-8),K.width(K.width()-1e-8),K._setTextData(),Fi(K,t))},[k]);const _=Y.useRef(null),E=Y.useRef(0),A=K=>{K.evt.preventDefault(),e.selectedShapes.find(J=>J===t)&&t.contentEditable&&(E.current=(function(J){var U;const D=J.target,W=(function(ue){var oe=ue.getAbsoluteTransform().copy();oe.invert();var de=ue.getStage().getPointerPosition();return oe.point(de)})(D),V=D.textArr,ee=Math.floor(W.y/(D.fontSize()*D.lineHeight())),te=V.slice(0,ee).reduce((ue,oe)=>ue+oe.text.length,ee),Q=(U=V[ee])!==null&&U!==void 0?U:V[0];let ne=0;return D.align()==="right"?ne=D.width()-Q.width:D.align()==="center"&&(ne=D.width()/2-Q.width/2),te+Math.round((W.x-ne)/Q.width*Q.text.length)})(K),t.toggleEditMode())},T=!S&&t.placeholder?.6:t.a.opacity;Bp(r,T);const I=Ck({fontLoaded:k,fontFamily:t.fontFamily,fontSize:t.a.fontSize,lineHeight:t.lineHeight}),L=t.selectable||e.role==="admin",R=Go(t),N=Go(t,t.stroke,"stroke"),F=Y.useMemo(()=>t.backgroundEnabled?t.curveEnabled?(function({width:K,height:q,padding:J=0,cornerRadius:U=0}){const D=-J,W=-J,V=K+J,ee=q+J,te=o3(`M ${D} ${W} L ${V} ${W} L ${V} ${ee} L ${D} ${ee} Z`);return s3(te,U).path})({width:t.a.width,height:t.a.height,cornerRadius:t.backgroundCornerRadius*(t.a.fontSize*I*.5),padding:t.backgroundPadding*(t.a.fontSize*I*.5)}):(function({lines:K,lineHeight:q,width:J,align:U="left",padding:D=0,cornerRadius:W=0}){var V;K.forEach((ne,ue)=>{ne.cx=J/2,U==="right"?ne.cx=J-ne.width/2:U==="left"&&(ne.cx=ne.width/2),U!=="justify"||ne.lastInParagraph||(ne.width=J),U==="justify"&&(ne.cx=ne.width/2)});let ee=`M ${(V=K[0])===null||V===void 0?void 0:V.cx} ${-D}`;K.forEach((ne,ue)=>{const{cx:oe}=ne,de=K[ue-1];de&&de.width>ne.width?ee+=` L ${oe+ne.width/2+D} ${ue*q+D}`:ee+=` L ${oe+ne.width/2+D} ${ue*q-D}`;const Ee=K[ue+1];Ee&&Ee.width>ne.width?ee+=` L ${oe+ne.width/2+D} ${(ue+1)*q-D}`:ee+=` L ${oe+ne.width/2+D} ${(ue+1)*q+D}`});for(var te=K.length-1;te>=0;te--){const ne=K[te],{cx:ue}=ne,oe=K[te+1];oe&&oe.width>ne.width?ee+=` L ${ue-ne.width/2-D} ${(te+1)*q-D}`:ee+=` L ${ue-ne.width/2-D} ${(te+1)*q+D}`;const de=K[te-1];de&&de.width>ne.width?ee+=` L ${ue-ne.width/2-D} ${te*q+D}`:ee+=` L ${ue-ne.width/2-D} ${te*q-D}`}ee+=" Z";const Q=o3(ee);return s3(Q,W).path})({lines:JSON.parse(JSON.stringify(b)),cornerRadius:t.backgroundCornerRadius*(t.a.fontSize*I*.5),lineHeight:I*t.a.fontSize,padding:t.backgroundPadding*(t.a.fontSize*I*.5),width:t.a.width,align:t.align}):"",[t.backgroundEnabled,t.curveEnabled,t.backgroundCornerRadius,t.a.fontSize,t.a.height,I,t.backgroundPadding,t.a.width,t.align,b]),H=wu();let $=0;t.curveEnabled||(t.verticalAlign==="middle"?$=(t.a.height-b.length*I*t.a.fontSize)/2:t.verticalAlign==="bottom"&&($=t.a.height-b.length*I*t.a.fontSize));const X=t.curveEnabled?_c(t.a.width,t.a.height,t.curvePower,t.a.fontSize):"",Z=k?'"'+t.fontFamily+'"':v===t.fontFamily?"Arial":'"'+v+'"';return Y.createElement(Y.Fragment,null,Y.createElement(gp,{ref:i,x:t.a.x,y:t.a.y,rotation:t.a.rotation,hideInExport:!t.showInExport,listening:!1,visible:t.backgroundEnabled,opacity:t.backgroundOpacity*T,data:F,fill:t.backgroundColor,offsetY:-$}),Y.createElement(gp,{data:X,stroke:"red",strokeWidth:1,x:t.a.x,y:t.a.y,rotation:t.a.rotation,visible:!1}),Y.createElement(RT,Object.assign({ref:n,visible:t.curveEnabled,data:X,text:S||t.placeholder,listening:!1,align:"center",textBaseline:"middle"},R,N,{strokeWidth:t.strokeWidth,lineJoin:"round",fillAfterStrokeEnabled:!0,fontSize:t.a.fontSize,fontFamily:`"${t.fontFamily}", "${v}"`,fontStyle:t.fontStyle+" "+t.fontWeight,textDecoration:t.textDecoration.trim(),letterSpacing:t.letterSpacing*t.a.fontSize,x:t.a.x,y:t.a.y,rotation:t.a.rotation,opacity:t._editModeEnabled?.3:T,hideInExport:!t.showInExport,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity})),Y.createElement(qo,Object.assign({ref:r,id:t.id,name:"element",hideInExport:!t.showInExport,editModeEnabled:t._editModeEnabled,x:t.a.x,y:t.a.y,rotation:t.a.rotation,width:t.a.width,height:t.a.height,text:S||t.placeholder,direction:vp(S)},R,N,{lineJoin:"round",strokeWidth:t.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:t.a.fontSize,fontFamily:Z,fontStyle:t.fontStyle+" "+t.fontWeight,textDecoration:t.textDecoration,align:t.align,verticalAlign:t.verticalAlign,draggable:H?t.draggable&&d:t.draggable,preventDefault:!H||d,opacity:t.curveEnabled?0:T,visible:!t._editModeEnabled,ellipsis:lr.textOverflow==="ellipsis",shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,lineHeight:I,letterSpacing:t.letterSpacing*t.a.fontSize,listening:L,onDragMove:K=>{t.set({x:K.target.x(),y:K.target.y()})},onDragEnd:K=>{t.set({x:K.target.x(),y:K.target.y()})},onClick:A,onTap:A,onTransformStart:()=>{u(!0),f.current=r.current.height()},onTransform:K=>{var q,J,U;const D=K.target;(q=i.current)===null||q===void 0||q.setAttrs({x:D.x(),y:D.y(),rotation:D.rotation(),scale:D.scale()});const W=((J=D.getStage())===null||J===void 0?void 0:J.findOne("Transformer")).getActiveAnchor();if(W==="middle-left"||W==="middle-right"){const ee=D.scaleX(),te=D.width()*ee,Q=t.a.fontSize;let ne=te;te<Q&&(ne=Q,_.current&&D.position(_.current)),D.width(ne),D.scaleX(1),D.scaleY(1);let ue=P();if(lr.textOverflow==="ellipsis")ue=f.current;else{const de=Math.max(ue,f.current);D.height(de),t.set({height:D.height()})}const oe=lr.textVerticalResizeEnabled?Math.max(ue,f.current):P();t.set({x:D.x(),width:D.width(),rotation:D.rotation(),height:oe}),Fi(D,t)}if(W==="top-center"||W==="bottom-center"){let ee=lr.textOverflow==="resize"?P():I*t.a.fontSize;K.target.height(Math.max(ee,K.target.height()*K.target.scaleY())),K.target.scaleY(1)}_.current=K.target.position();const V=K.target.scaleX();(U=i.current)===null||U===void 0||U.setAttrs({scaleX:1,scaleY:1}),K.target.scaleX(1),K.target.scaleY(1),t.set({fontSize:t.a.fontSize*V,width:K.target.width()*V,x:K.target.x(),y:K.target.y(),rotation:K.target.rotation(),height:K.target.height()*V,shadowBlur:t.shadowBlur*V,shadowOffsetX:t.shadowOffsetX*V,shadowOffsetY:t.shadowOffsetY*V,strokeWidth:t.strokeWidth*V})},onTransformEnd:K=>{var q;const J=K.target.scaleX();K.target.scaleX(1),K.target.scaleY(1),t.set({fontSize:Math.round(t.a.fontSize*J),width:Math.ceil(K.target.width()*J),x:K.target.x(),y:K.target.y(),rotation:K.target.rotation(),height:K.target.height()*J,shadowBlur:t.shadowBlur*J,shadowOffsetX:t.shadowOffsetX*J,shadowOffsetY:t.shadowOffsetY*J,strokeWidth:t.strokeWidth*J}),(q=i.current)===null||q===void 0||q.setAttrs({scaleX:1,scaleY:1}),u(!1)}})),a&&Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation},Y.createElement(rA,{textNodeRef:r,element:t,selectAll:o,cursorPosition:E.current,onBlur:()=>{t.toggleEditMode(!1)}})))});var H1={exports:{}},$1={exports:{}},T3;function F2(){return T3||(T3=1,(function(t,e){t.exports=r;function r(i){return n.bind(null,i)}function n(i){var a=[].slice.call(arguments,1);a.unshift("["+i+"]"),process.stderr.write(a.join(" ")+`
99
+ `)}})($1)),$1.exports}var C3;function Ok(){return C3||(C3=1,(function(t,e){F2()("lex"),t.exports=r;function r(n){var i="",a,o=0,s=-1,u=0,f=1,d="before-selector",h=[d],p={},y=[],v=["media","keyframes",{name:"-webkit-keyframes",type:"keyframes",prefix:"-webkit-"},{name:"-moz-keyframes",type:"keyframes",prefix:"-moz-"},{name:"-ms-keyframes",type:"keyframes",prefix:"-ms-"},{name:"-o-keyframes",type:"keyframes",prefix:"-o-"},"font-face",{name:"import",state:"before-at-value"},{name:"charset",state:"before-at-value"},"supports","viewport",{name:"namespace",state:"before-at-value"},"document",{name:"-moz-document",type:"document",prefix:"-moz-"},"page"];function b(){return I(),n[s]}function x(K){return K?h[h.length-1-K]:d}function k(K){var q=s+1;return K===n.slice(q,q+K.length)}function S(K){var q=n.slice(s).indexOf(K);return q>0?q:!1}function P(K){return K===_(1)}function _(K){return n[s+(K||1)]}function E(){var K=h.pop();return d=h[h.length-1],K}function A(K){return d=K,h.push(d),h.length}function T(K){var q=d;return h[h.length-1]=d=K,q}function I(K){if((K||1)==1)n[s]==`
100
+ `?(f++,o=1):o++,s++;else{var q=n.slice(s,s+K).split(`
101
+ `);q.length>1&&(f+=q.length-1,o=1),o+=q[q.length-1].length,s=s+K}}function L(){p.end={line:f,col:o},y.push(p),i="",p={}}function R(K){p={type:K,start:{line:f,col:o}}}for(;a=b();)switch(a){case" ":switch(x()){case"selector":case"value":case"value-paren":case"at-group":case"at-value":case"comment":case"double-string":case"single-string":i+=a;break}break;case`
102
+ `:case" ":case"\r":case"\f":switch(x()){case"value":case"value-paren":case"at-group":case"comment":case"single-string":case"double-string":case"selector":i+=a;break;case"at-value":a===`
103
+ `&&(p.value=i.trim(),L(),E());break}break;case":":switch(x()){case"name":p.name=i.trim(),i="",T("before-value");break;case"before-selector":i+=a,R("selector"),A("selector");break;case"before-value":T("value"),i+=a;break;default:i+=a;break}break;case";":switch(x()){case"name":case"before-value":case"value":i.trim().length>0&&(p.value=i.trim(),L()),T("before-name");break;case"value-paren":i+=a;break;case"at-value":p.value=i.trim(),L(),E();break;case"before-name":break;default:i+=a;break}break;case"{":switch(x()){case"selector":if(_(-1)==="\\"){i+=a;break}p.text=i.trim(),L(),T("before-name"),u=u+1;break;case"at-group":switch(p.name=i.trim(),p.type){case"font-face":case"viewport":case"page":A("before-name");break;default:A("before-selector")}L(),u=u+1;break;case"name":case"at-rule":p.name=i.trim(),L(),A("before-name"),u=u+1;break;case"comment":case"double-string":case"single-string":i+=a;break;case"before-value":T("value"),i+=a;break}break;case"}":switch(x()){case"before-name":case"name":case"before-value":case"value":i&&(p.value=i.trim()),p.name&&p.value&&L(),R("end"),L(),E(),x()==="at-group"&&(R("at-group-end"),L(),E()),u>0&&(u=u-1);break;case"at-group":case"before-selector":case"selector":if(_(-1)==="\\"){i+=a;break}u>0&&x(1)==="at-group"&&(R("at-group-end"),L()),u>1&&E(),u>0&&(u=u-1);break;case"double-string":case"single-string":case"comment":i+=a;break}break;case'"':case"'":switch(x()){case"double-string":a==='"'&&_(-1)!=="\\"&&E();break;case"single-string":a==="'"&&_(-1)!=="\\"&&E();break;case"before-at-value":T("at-value"),A(a==='"'?"double-string":"single-string");break;case"before-value":T("value"),A(a==='"'?"double-string":"single-string");break;case"comment":break;default:_(-1)!=="\\"&&A(a==='"'?"double-string":"single-string")}i+=a;break;case"/":switch(x()){case"comment":case"double-string":case"single-string":i+=a;break;case"before-value":case"selector":case"name":case"value":if(P("*")){var N=S("*/");N&&I(N+1)}else x()=="before-value"&&T("value"),i+=a;break;default:P("*")?(R("comment"),A("comment"),I()):i+=a;break}break;case"*":switch(x()){case"comment":P("/")?(p.text=i,I(),L(),E()):i+=a;break;case"before-selector":i+=a,R("selector"),A("selector");break;case"before-value":T("value"),i+=a;break;default:i+=a}break;case"@":switch(x()){case"comment":case"double-string":case"single-string":i+=a;break;case"before-value":T("value"),i+=a;break;default:for(var F=!1,H,$,X=0,Z=v.length;!F&&X<Z;++X)$=v[X],H=$.name||$,k(H)&&(F=!0,R(H),A($.state||"at-group"),I(H.length),$.prefix&&(p.prefix=$.prefix),$.type&&(p.type=$.type));F||(i+=a);break}break;case"(":switch(x()){case"value":A("value-paren");break;case"before-value":T("value");break}i+=a;break;case")":switch(x()){case"value-paren":E();break;case"before-value":T("value");break}i+=a;break;default:switch(x()){case"before-selector":R("selector"),A("selector");break;case"before-name":R("property"),T("name");break;case"before-value":T("value");break;case"before-at-value":T("at-value");break}i+=a;break}return y}})(H1)),H1.exports}var q1={exports:{}},O3;function iA(){return O3||(O3=1,(function(t,e){F2()("parse");var r=Ok();t.exports=s;var n,i,a,o;function s(E,A){A||(A={}),n=!!A.comments,a=!!A.position,i=0,o=Array.isArray(E)?E.slice():r(E);for(var T,I=[],L;L=f();)T=k(L),T&&I.push(T);return{type:"stylesheet",stylesheet:{rules:I}}}function u(E,A){A||(A={});for(var T,I=["type","name","value"],L={},R=0;R<I.length;++R)T=I[R],E[T]&&(L[T]=A[T]||E[T]);for(I=Object.keys(A),R=0;R<I.length;++R)T=I[R],L[T]||(L[T]=A[T]);return a&&(L.position={start:E.start,end:E.end}),L}function f(){var E=o.shift();return E}function d(E){i=i+1;var A={};switch(E.type){case"font-face":case"viewport":A.declarations=P();break;case"page":A.prefix=E.prefix,A.declarations=P();break;default:A.prefix=E.prefix,A.rules=_()}return u(E,A)}function h(E){return u(E)}function p(E){return u(E)}function y(E){return u(E,{text:E.text})}function v(E){return u(E)}function b(E){return u(E)}function x(E){function A(T){return T.trim()}return u(E,{type:"rule",selectors:E.text.split(",").map(A),declarations:P()})}function k(E){switch(E.type){case"property":return b(E);case"selector":return x(E);case"at-group-end":i=i-1;return;case"media":case"keyframes":return d(E);case"comment":if(n)return y(E);break;case"charset":return p(E);case"import":return h(E);case"namespace":return v(E);case"font-face":case"supports":case"viewport":case"document":case"page":return d(E)}}function S(E){for(var A,T=[],I;(I=f())&&E&&E(I);)A=k(I),A&&T.push(A);return I&&I.type!=="end"&&o.unshift(I),T}function P(){return S(function(E){return E.type==="property"||E.type==="comment"})}function _(){return S(function(){return i})}})(q1)),q1.exports}var V1={exports:{}},A3;function aA(){return A3||(A3=1,(function(t,e){F2()("stringify");var r,n,i,a,o,s;t.exports=u;function u(_,E){E||(E={}),i=E.indentation||"",n=!!E.compress,r=!!E.comments,a=1,n?o=s="":(o=`
104
+ `,s=" ");var A=v(_.stylesheet.rules,S).join(`
105
+ `).trim();return A}function f(_){if(_){a+=_;return}return n?"":Array(a).join(i||"")}function d(_){return"@"+_.type+" "+_.value+";"+o}function h(_){var E="",A=_.prefix||"";_.name&&(E=" "+_.name);var T=_.type!=="page";return"@"+A+_.type+E+s+b(_,T)+o}function p(_){return r?"/*"+(_.text||"")+"*/"+o:""}function y(_){var E;return _.selectors?E=_.selectors.join(","+o):(E="@"+_.type,E+=_.name?" "+_.name:""),f()+E+s+b(_)+o}function v(_,E){return _.reduce(function(A,T){var I=T.type==="comment"?p(T):E(T);return I&&A.push(I),A},[])}function b(_,E){var A=_.declarations,T=k;return _.rules&&(A=_.rules,T=y),A=x(A,T),A&&(A=o+A+(E?"":o)),"{"+A+f()+"}"}function x(_,E){if(!_)return"";f(1);var A=v(_,E);return f(-1),A.length?A.join(o):""}function k(_){if(_.type==="property")return P(_)}function S(_){switch(_.type){case"rule":return y(_);case"media":case"keyframes":return h(_);case"comment":return p(_);case"import":case"charset":case"namespace":return d(_);case"font-face":case"supports":case"viewport":case"document":case"page":return h(_)}}function P(_){var E=_.name?_.name+":"+s:"";return f()+E+_.value+";"}})(V1)),V1.exports}var W1,I3;function oA(){return I3||(I3=1,W1={lex:Ok(),parse:iA(),stringify:aA()}),W1}var sA=oA();const lA=Ec(sA);function uA(t){for(;t.parentNode;){if(t.nodeName==="defs")return!0;t=t.parentNode}return!1}function cA(t){const e={};return t.querySelectorAll("style").forEach(r=>{const n=lA.parse(r.textContent).stylesheet.rules;for(let i of n)i.selectors&&i.selectors.forEach(a=>{const o=e[a]||{};i.declarations.forEach(s=>{o[s.name]=s.value}),e[a]=o})}),e}function Ak(t,e){var r;const n={fill:"",stroke:""},i=((r=t.getAttribute("class"))===null||r===void 0?void 0:r.split(" "))||[],a=t.getAttribute("id");let o={};a&&e[`#${a}`]?o=e[`#${a}`]:i.forEach(f=>{e[`.${f}`]&&(o=Object.assign(Object.assign({},o),e[`.${f}`]))}),e[t.nodeName]&&(o=Object.assign(Object.assign({},o),e[t.nodeName]));const s=t.getAttribute("fill");s&&s!=="none"?n.fill=s:o.fill&&o.fill!=="none"&&(n.fill=o.fill);const u=t.getAttribute("stroke");if(u&&u!=="none"?n.stroke=u:o.stroke&&o.stroke!=="none"&&(n.stroke=o.stroke),!n.fill&&t.style.fill&&t.style.fill!=="none"&&(n.fill=t.style.fill),!n.stroke&&t.style.stroke&&t.style.stroke!=="none"&&(n.stroke=t.style.stroke),!n.stroke&&!n.fill){const f=t.ownerSVGElement,d=f&&f!==t?Ak(f,e):null;d?.fill==="currentColor"||d?.stroke==="currentColor"||(n.fill="black")}return n}const fA=["path","rect","circle","line","polygon","polyline","ellipse","text"];function dA(t){for(var e=[],r=t.getElementsByTagName("*"),n=0,i=r.length;n<i;n++){const a=r[n];uA(a)||(a.getAttribute("fill")!==null&&e.push(a),(a.getAttribute("stroke")!==null||a.style&&a.style.fill||fA.indexOf(a.nodeName)>=0)&&e.push(a))}return e}async function R3(t){const e=await fetch(t);return tl(await e.text())}async function jp(t){return await(await fetch(t,{mode:"cors"})).text()}function tl(t){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t)))}function B2(t){var e=new DOMParser().parseFromString(t,"image/svg+xml");const r=e.documentElement.getAttribute("viewBox"),[n,i,a,o]=r?.split(" ")||[],s=e.documentElement.getAttribute("width");!s&&e.documentElement.setAttribute("width",a+"px");const u=e.documentElement.getAttribute("height");if((!u||u.indexOf("%")>=0)&&e.documentElement.setAttribute("height",o+"px"),s&&s.indexOf("%")>=0&&u&&u.indexOf("%")===-1){const f=parseFloat(u)/parseFloat(o);e.documentElement.setAttribute("width",f*parseFloat(a)+"px")}if(u&&u.indexOf("%")>=0&&s&&s.indexOf("%")===-1){const f=parseFloat(s)/parseFloat(a);e.documentElement.setAttribute("height",f*parseFloat(o)+"px")}return s==="100%"&&u==="100%"&&(e.documentElement.setAttribute("width",a+"px"),e.documentElement.setAttribute("height",o+"px")),new XMLSerializer().serializeToString(e)}const hA=(t,e)=>{if(!t||!e)return!1;if(e==="currentColor"&&t==="black")return!0;const r=_t.Util.colorToRGBA(t),n=_t.Util.colorToRGBA(e);return r&&n?r.r===n.r&&r.g===n.g&&r.b===n.b&&r.a===n.a:void 0};function z2(t,e){var r=new DOMParser().parseFromString(t,"image/svg+xml");const n=dA(r),i=Array.from(e.keys()),a=cA(r);return n.forEach(o=>{const{fill:s,stroke:u}=Ak(o,a);[{prop:"fill",color:s},{prop:"stroke",color:u}].forEach(({prop:f,color:d})=>{const h=i.find(p=>hA(p,d));if(h){const p=e.get(h);if(an(p)){const{rotation:y,stops:v}=Fp(p),b=v.map(k=>({offset:100*k.offset+"%","stop-color":k.color})),x="color"+Math.round(1e8*Math.random());(function(k,S,P,_){var E=k.namespaceURI,A=document.createElementNS(E,"linearGradient");const T=_t.Util.degToRad(P+90),I=(Math.cos(T)+1)/2,L=(Math.sin(T)+1)/2,R=(Math.cos(T+Math.PI)+1)/2,N=(Math.sin(T+Math.PI)+1)/2;A.setAttribute("x1",100*I+"%"),A.setAttribute("y1",100*L+"%"),A.setAttribute("x2",100*R+"%"),A.setAttribute("y2",100*N+"%"),A.setAttribute("gradientUnits","userSpaceOnUse"),A.setAttribute("id",S);for(var F=0;F<_.length;F++){var H=_[F],$=document.createElementNS(E,"stop");for(var X in H)H.hasOwnProperty(X)&&$.setAttribute(X,H[X]);A.appendChild($)}(k.querySelector("defs")||k.insertBefore(document.createElementNS(E,"defs"),k.firstChild)).appendChild(A)})(r.children[0],x,y,b),o.style[f]=null,o.setAttribute(f,`url('#${x}')`)}else o.style[f]=e.get(h)}})}),tl(new XMLSerializer().serializeToString(r))}const j2=(t,e,r)=>{let n=e,i=r,a=1;for(;n>0&&i>0;){if(t.width=n,t.height=i,n+i<4e3)return;const o=t.getContext("2d");if(!o)return;if(o.fillStyle="rgba(0,0,0,0.1)",o.fillRect(0,0,1,1),o.getImageData(0,0,1,1).data[3]!==0)return void o.clearRect(0,0,t.width,t.height);if(a*=.9,n=Math.floor(e*a),i=Math.floor(r*a),n=Math.max(n,1),i=Math.max(i,1),n<=1&&i<=1)return t.width=1,void(t.height=1)}};function pA(t,e){var r,n;const i=(r=e.x)!==null&&r!==void 0?r:0,a=(n=e.y)!==null&&n!==void 0?n:0,o=e.pixelRatio||1,s=Math.round(e.width*o),u=Math.round(e.height*o),f=s/o,d=u/o;let h=e.sceneCanvas;h?(h.width!==s||h.height!==u||h.pixelRatio!==o)&&(h.setSize(f,d),h.setPixelRatio(o)):h=new Ca({width:f,height:d,pixelRatio:o});const p=h.getContext(),y=h.width/h.pixelRatio+Math.abs(i),v=h.height/h.pixelRatio+Math.abs(a);let b=e.bufferCanvas;if(b){const x=Math.round(y*h.pixelRatio),k=Math.round(v*h.pixelRatio);(b.width!==x||b.height!==k||b.pixelRatio!==h.pixelRatio)&&(b.setSize(y,v),b.setPixelRatio(h.pixelRatio))}else b=new Ca({width:y,height:v,pixelRatio:h.pixelRatio});return e.imageSmoothingEnabled===!1&&(p._context.imageSmoothingEnabled=!1),p.save(),(i||a)&&p.translate(-1*i,-1*a),t.drawScene(h,void 0,b),p.restore(),h}function dL(){return{sceneCanvas:new Ca({width:1,height:1,pixelRatio:1}),bufferCanvas:new Ca({width:1,height:1,pixelRatio:1})}}const Xv=(t,e=100,r=!1,n)=>{const i=Y.useRef(n??t),[,a]=Y.useReducer(u=>u+1,0),o=Y.useCallback(u=>{i.current!==u&&(i.current=u,a())},[i]),s=Y.useRef(null);return t===r&&(s.current&&(clearTimeout(s.current),s.current=null),i.current=r),Y.useEffect(()=>(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o(t),s.current=null},e),()=>{s.current&&clearTimeout(s.current)}),[t,e,r]),[i.current,o]};function hc(){return document.createElement("canvas")}const Ik=t=>t.indexOf("data:image/svg+xml")>=0||t.indexOf(".svg")>=0,M3=t=>{const[e,r]=Y.useState(t);return Y.useEffect(()=>{(async()=>{const n=await(async function(i){if(!Ik(i))return i;const a=await jp(i),o=B2(a);return tl(o)})(t);n!==e&&r(n)})()},[t]),e};function D3(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}const mA={boundBoxFunc:(t,e)=>e.width<5||e.height<5?t:e,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2},gA={boundBoxFunc:(t,e)=>e.width<5||e.height<5?t:e,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},N3=(t,e,r)=>Math.max(e,Math.min(r,t)),yA=(t,e,r,n,i=0,a=!1,o=!0)=>{const s=Math.floor(N3(t.a.width*n,1,1e4)),u=Math.floor(N3(t.a.height*n,1,1e4)),f=Math.min(i*n,s/2,u/2),d=Math.max(t.a.width/r.width,t.a.height/r.height)*n,h=t.page._exportingOrRendering&&lr.imageDownScalingEnabled&&d<1&&!a,p=r.x===0&&r.y===0&&r.width===e?.width&&r.height===e?.height,y=Y.useMemo(()=>{if(e&&e.width&&e.height)return p&&f===0&&!h?void 0:hc()},[e,f,h,p]);return Y.useLayoutEffect(()=>{if(!y||!e)return;j2(y,s,u);const v=y.getContext("2d");if(!v)return;f&&(v.beginPath(),v.moveTo(f,0),v.lineTo(s-f,0),v.arc(s-f,f,f,3*Math.PI/2,0,!1),v.lineTo(s,u-f),v.arc(s-f,u-f,f,0,Math.PI/2,!1),v.lineTo(f,u),v.arc(f,u-f,f,Math.PI/2,Math.PI,!1),v.lineTo(0,f),v.arc(f,f,f,Math.PI,3*Math.PI/2,!1),v.clip());const b=h?(function(k,S){var P,_;const E=hc();E.width=k.width,E.height=k.height;const A=Math.max(1,Math.floor(E.width*S)),T=Math.max(1,Math.floor(E.height*S));(P=E.getContext("2d"))===null||P===void 0||P.drawImage(k,0,0,E.width,E.height);const I=(function(L,R,N,F,H,$,X){for(var Z=new ImageData(R,N),K=new Int32Array(L.data.buffer),q=L.width,J=new Int32Array(Z.data.buffer),U=Z.width,D=R/$,W=N/X,V=Math.round(1/D),ee=Math.round(1/W),te=V*ee,Q=0;Q<Z.height;Q++)for(var ne=0;ne<U;ne++){for(var ue=0+Math.round(ne/D)+(0+Math.round(Q/W))*q,oe=0,de=0,Ee=0,Fe=0,Le=0;Le<ee;Le++)for(var $e=0;$e<V;$e++){var Xe=K[ue+$e+Le*q];oe+=Xe<<24>>>24,de+=Xe<<16>>>24,Ee+=Xe<<8>>>24,Fe+=Xe>>>24}oe=Math.round(oe/te),de=Math.round(de/te),Ee=Math.round(Ee/te),Fe=Math.round(Fe/te),J[ne+Q*U]=Fe<<24|Ee<<16|de<<8|oe}return Z})(E.getContext("2d").getImageData(0,0,E.width,E.height),A,T,0,0,E.width,E.height);return E.width=A,E.height=T,(_=E.getContext("2d"))===null||_===void 0||_.putImageData(I,0,0),E})(e,d):e,x=h?{x:Math.floor(r.x*d),y:Math.floor(r.y*d),width:Math.floor(r.width*d),height:Math.floor(r.height*d)}:r;v.drawImage(b,x.x,x.y,x.width,x.height,0,0,y.width,y.height)},[y,t.a.width,t.a.height,r.x,r.y,r.width,r.height,i,n,a,t.page._exportingOrRendering,h]),Y.useEffect(()=>()=>{y&&y.nodeName==="CANVAS"&&_t.Util.releaseCanvas(y)},[y]),y||e},vA=hc(),bA=Sr(({element:t})=>{const e=Math.min(30,t.a.width/4,t.a.height/4),r=Y.useRef(null);return Y.useEffect(()=>{const n=r.current;if(!n)return;const i=new _t.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}}),Y.createElement(Jt,{x:t.x,y:t.y,rotation:t.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},Y.createElement(ur,{width:t.a.width,height:t.a.height,fill:"rgba(124, 173, 212, 0.8)"}),Y.createElement(A2,{ref:r,x:t.a.width/2,y:t.a.height/2,fill:"white",outerRadius:Math.abs(e),innerRadius:Math.max(1,e-5),angle:270}))}),wA=Sr(({element:t})=>{const e=Math.max(10,Math.min(30,t.a.width/25));return Y.createElement(Jt,{x:t.x,y:t.y,rotation:t.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},Y.createElement(ur,{width:t.a.width,height:t.a.height,fill:"rgba(223, 102, 102, 0.8)"}),Y.createElement(qo,{text:"Can not load the image...",fontSize:e,width:t.a.width,height:t.a.height,align:"center",fill:"white",verticalAlign:"middle",padding:5}))});let G1=I2;const op=(t,e="",r="")=>{const n=Y.useRef(),i=()=>{var a;(a=n.current)===null||a===void 0||a.call(n),n.current=void 0};Y.useEffect(()=>i,[]),Y.useLayoutEffect(()=>{const a=e.slice(0,200),o=`image with id ${r} url: ${a}`;t!=="loading"||n.current||(n.current=Ws(o)),t!=="loading"&&i(),t==="failed"&&Od(o)},[t])},L3=Sr(({element:t,store:e})=>{var r;const[n,i]=Y.useState(!1),a=Y.useRef(null),o=Y.useRef(null),s=e.selectedShapes.indexOf(t)>=0&&t.selectable,[u,f]=(ke=>{const[ge,se]=Y.useReducer(Oe=>Oe+1,0),me=Y.useRef("loading"),Te=Y.useRef(ke.src),ae=Y.useRef(ke.src);ae.current!==ke.src&&(ae.current=ke.src,me.current="loading");const xe=Y.useMemo(()=>Ik(ke.src)||ke.type==="svg",[ke.src,ke.type]);return Y.useEffect(()=>{if(!xe||!ke.src)return;let Oe=!1;return(async()=>{me.current="loading",se();const Be=await jp(ke.src),ct=B2(Be);let be;be=ke.colorsReplace?z2(ct,ke.colorsReplace||new Map):tl(ct),Oe||(Te.current=be,me.current="loaded",se())})(),()=>{Oe=!0}},[ke.src,JSON.stringify(ke.colorsReplace)]),xe?[Te.current,me.current]:[ke.src,"loaded"]})(t),[d,h]=G1(u,"anonymous"),p=t.type!=="svg"||f==="loaded"?h:"loading";op(p,t.src,t.id);const y=t.page._exportingOrRendering?1:Math.max(1,e.scale),v=e._elementsPixelRatio*y,b=(({image:ke,status:ge,type:se})=>{const me=Y.useRef();return Y.useEffect(()=>{me.current=ke||me.current},[ke]),ge!=="failed"||ge!=="failed"&&se==="svg"?me.current:void 0})({image:d,status:h,type:t.type}),x=((ke,ge,se)=>{const me=Y.useMemo(()=>{var Te,ae;const{flipX:xe,flipY:Oe}=ke,Be=ke.type==="svg"||ke.src.indexOf("data:image/svg+xml")>=0||ke.src.indexOf(".svg")>=0,ct=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,be=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||ct)&&Be||ke.maskSrc;if(!xe&&!Oe&&!be)return ge;if(!ge||!ge.width||!ge.height)return null;const he=hc();let Ve=1;ke.type==="svg"&&(Ve=Math.max(ke.a.width/ge.width*se,ke.a.height/ge.height*se)),j2(he,Math.max(ge.width*Ve,1),Math.max(ge.height*Ve,1));let le=xe?-he.width:0,Ie=Oe?-he.height:0;return(Te=he.getContext("2d"))===null||Te===void 0||Te.scale(xe?-1:1,Oe?-1:1),(ae=he.getContext("2d"))===null||ae===void 0||ae.drawImage(ge,le,Ie,he.width,he.height),he},[ke.maskSrc,ke.flipX,ke.flipY,ge,ke.a.width,ke.a.height,se]);return Y.useEffect(()=>()=>{me&&me.nodeName==="CANVAS"&&_t.Util.releaseCanvas(me)},[me]),me})(t,d||b,v),k=((ke,ge)=>{const se=M3(ke.maskSrc||""),[me,Te]=G1(se,"anonymous");return op(se?Te:"loaded",se||"",ke.id),Y.useMemo(()=>{if(!me||!ge||!ge.width||!ge.height)return ge;const ae=hc();ae.width=Math.max(ge.width,1),ae.height=Math.max(ge.height,1);const xe=ae.getContext("2d");if(!xe)return ge;xe.drawImage(ge,0,0),xe.globalCompositeOperation="source-in";const Oe=(function(Be,ct){const be=ct.width/ct.height;let he,Ve;return be>=Be.width/Be.height?(he=Be.width,Ve=Be.width/be):(he=Be.height*be,Ve=Be.height),{x:(Be.width-he)/2,y:(Be.height-Ve)/2,width:he,height:Ve}})(me,ke);return xe.drawImage(me,Oe.x,Oe.y,Oe.width,Oe.height,0,0,ge.width,ge.height),ae},[ge,me,ke.a.width,ke.a.height])})(t,x)||vA;let{cropX:S,cropY:P,cropWidth:_,cropHeight:E}=t.a;h!=="loaded"&&(S=P=0,_=E=1);const A=k.width*_,T=k.height*E,I=t.a.width/t.a.height;let L,R;const N=A/T,F=t.stretchEnabled;F?(L=A,R=T):I>=N?(L=A,R=A/I):(L=T*I,R=T);const H={x:k.width*S,y:k.height*P,width:L,height:R},$=(r=t.cornerRadius)!==null&&r!==void 0?r:0,X=t.page._exportingOrRendering?1:Math.min(2,e.scale),Z=e._elementsPixelRatio*X;let K=((ke,ge,se,me)=>{const Te=M3(ke.clipSrc||""),[ae,xe]=G1(Te,"anonymous"),Oe=ke.clipSrc?xe:"loaded";op(Oe,ke.clipSrc,ke.id);const Be=Y.useMemo(()=>{if(ge&&ae)return hc()},[ge,ae]);return Y.useLayoutEffect(()=>{var ct;if(!ae||!ge||!ge.width||!ge.height||!ae||!ae.width||!ae.height||!Be)return;const be=hc(),he=Math.max(ke.a.width/ae.width*se,ke.a.height/ae.height*se);be.width=Math.max(ae.width*he,1),be.height=Math.max(ae.height*he,1),(ct=be.getContext("2d"))===null||ct===void 0||ct.drawImage(ae,0,0,be.width,be.height),Be.width=Math.max(ge.width,1),Be.height=Math.max(ge.height,1);const Ve=Be.getContext("2d");Ve&&(Ve.save(),Ve.drawImage(be,0,0,ge.width,ge.height),_t.Util.releaseCanvas(be),Ve.globalCompositeOperation="source-in",Ve.drawImage(ge,0,0,Be.width,Be.height),Ve.restore())},[Be,ge,ae,ke.a.width,ke.a.height,se,...me]),ke.clipSrc&&ae?Be:ge})(t,yA(t,k,H,Z,$,n||t._cropModeEnabled||t.type==="svg",!0),Z,[H,$,Z]);const q=Math.max(t.a.width/L,t.a.height/R);Y.useEffect(()=>{var ke;if(!t._cropModeEnabled)return;const ge=(ke=a.current)===null||ke===void 0?void 0:ke.getStage();function se(Te){t._cropModeEnabled&&Te.target!==o.current&&t.toggleCropMode(!1)}function me(Te){t._cropModeEnabled&&Te.target.parentNode!==ge.content&&t.toggleCropMode(!1)}return document.body.addEventListener("click",me),ge?.on("click",se),ge?.on("tap",se),()=>{document.body.removeEventListener("click",me),document.body.removeEventListener("touchstart",me),ge?.off("click",se),ge?.off("click",se)}},[t._cropModeEnabled]),Y.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled)return Fi(a.current,t),io(()=>{Fi(a.current,t)},{delay:100})},[K,t.page._exportingOrRendering,n,_,E,t._cropModeEnabled]),Y.useLayoutEffect(()=>{var ke;n||t._cropModeEnabled?(ke=a.current)===null||ke===void 0||ke.clearCache():Fi(a.current,t)},[n,t.a.width,t.a.height,t._cropModeEnabled]),Y.useEffect(()=>{Fi(a.current,t)},[t.shadowEnabled,t.shadowBlur,t.cornerRadius,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]);const J=Y.useRef(null),U=Y.useRef(null),D=Y.useRef(null);Y.useLayoutEffect(()=>{t._cropModeEnabled&&(U.current.nodes([J.current]),D.current.nodes([o.current]))},[t._cropModeEnabled]);var W=Y.useRef(null),V=Y.useRef(0),ee=Y.useRef(!1);const te=ke=>{var ge;((ge=ke.evt.touches)===null||ge===void 0?void 0:ge.length)>2&&ke.target.stopDrag(),Math.round(ke.target.x())>0&&(ke.target.x(0),ke.target.scaleX(1)),Math.round(ke.target.y())>0&&(ke.target.y(0),ke.target.scaleY(1));const se=ke.target.width()*ke.target.scaleX(),me=ke.target.height()*ke.target.scaleY(),Te=Math.min(1,L/se),ae=Math.min(1,R/me),xe=1-Te,Oe=Math.min(xe,Math.max(0,Math.round(-ke.target.x())/se)),Be=1-ae,ct=Math.min(Be,Math.max(0,Math.round(-ke.target.y())/me));ke.target.setAttrs({x:-Oe*k.width,y:-ct*k.height,scaleX:1,scaleY:1}),t.set({cropX:Oe,cropY:ct,cropWidth:Te,cropHeight:ae})},Q=()=>{t.type!=="svg"&&t.contentEditable&&(t.stretchEnabled||setTimeout(()=>{t.toggleCropMode(!0)}))},ne=t.type==="svg"&&b,ue=h==="loading"&&!ne,[oe]=Xv(ue,100,!1,!1),de=h==="failed",Ee=!oe&&!de,Fe=Y.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Le=Ee?t.a.opacity:0;Bp(a,Le);const $e=t.selectable||e.role==="admin",Xe=wu(),dt=Go(t,t.borderColor,"stroke");return Y.createElement(Y.Fragment,null,oe&&Y.createElement(bA,{element:t}),de&&Y.createElement(wA,{element:t}),Y.createElement(zo,{ref:a,name:"element",id:t.id,image:K,x:t.a.x,y:t.a.y,width:t.a.width||1,height:t.a.height||1,rotation:t.a.rotation,opacity:Le,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,customCrop:H,listening:$e,draggable:Xe?t.draggable&&s:t.draggable,preventDefault:!Xe||s,hideInExport:!t.showInExport,onDragMove:ke=>{t.set({x:ke.target.x(),y:ke.target.y()})},onDragEnd:ke=>{t.set({x:ke.target.x(),y:ke.target.y()})},onDblClick:Q,onDblTap:Q,onTransformStart:()=>{i(!0),Fe.current={cropX:t.cropX,cropY:t.cropY,cropWidth:t.cropWidth,cropHeight:t.cropHeight}},onTransform:ke=>{var ge;const se=ke.currentTarget,me=Math.abs(se.scaleX()-1)<1e-7?1:se.scaleX(),Te=Math.abs(se.scaleY()-1)<1e-7?1:se.scaleY();se.scaleX(1),se.scaleY(1);const ae=(ge=ke.target.getStage())===null||ge===void 0?void 0:ge.findOne("Transformer"),xe=1-L/k.width,Oe=Math.min(xe,Math.max(0,t.cropX)),Be=1-R/k.height,ct=Math.min(Be,Math.max(0,t.cropY)),be=ae.getActiveAnchor(),he=!(be.indexOf("middle")>=0||be.indexOf("center")>=0),Ve=!he&&me<1&&Fe.current.cropHeight>R/k.height;let le=he?t.cropWidth:t.cropWidth*me;Ve&&(le=t.cropWidth);const Ie=!he&&Te<1&&Fe.current.cropWidth>L/k.width;let Ye=he?t.cropHeight:t.cropHeight*Te;Ie&&(Ye=t.cropHeight),F&&(le=t.cropWidth,Ye=t.cropHeight),t.set({cropX:Oe,cropY:ct,x:se.x(),y:se.y(),width:se.width()*me,height:se.height()*Te,rotation:ke.target.rotation(),cropWidth:Math.min(le,1-Oe),cropHeight:Math.min(Ye,1-ct)})},onTransformEnd:ke=>{const ge=ke.currentTarget;t.set({width:ge.width(),height:ge.height(),x:ge.x(),y:ge.y(),rotation:ke.target.rotation(),cropWidth:L/k.width,cropHeight:R/k.height}),i(!1)}}),Y.createElement(ur,Object.assign({x:t.x,y:t.y,width:Math.max(t.a.width-t.borderSize,0),height:Math.max(t.a.height-t.borderSize,0),opacity:Le,offsetX:-t.borderSize/2,offsetY:-t.borderSize/2},dt,{strokeWidth:t.borderSize,listening:!1,visible:!!t.borderSize,rotation:t.rotation,cornerRadius:Math.max(0,$-t.borderSize),hideInExport:!t.showInExport})),t._cropModeEnabled&&Y.createElement(R2,{selector:".page-abs-container",enabled:!0},Y.createElement(ur,{x:-window.innerWidth/e.scale,y:-window.innerWidth/e.scale,width:window.innerWidth/e.scale*3,height:window.innerWidth/e.scale*3,fill:"rgba(0,0,0,0.3)"}),Y.createElement(zo,{listening:!1,image:K,x:t.x,y:t.y,width:t.a.width,height:t.a.height,rotation:t.rotation,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur}),Y.createElement(Jt,{x:t.x,y:t.y,rotation:t.rotation,scaleX:q,scaleY:q},Y.createElement(zo,{image:k,ref:o,opacity:.4,draggable:!0,x:-t.cropX*k.width,y:-t.cropY*k.height,onDragMove:te,onTransform:te,onTouchMove:ke=>{ke.evt.preventDefault();const ge=ke.target.getStage().getPointersPositions();var se=ge[0],me=ge[1];const Te=ke.target;if(se&&!me&&!Te.isDragging()&&ee.current&&(Te.startDrag(),ee.current=!1),se&&me){_t.hitOnDragEnabled=!0,Te.isDragging()&&(ee.current=!0,Te.stopDrag());const Ie=ke.target.getAbsoluteTransform().copy();Ie.invert();var ae={x:se.x,y:se.y},xe={x:me.x,y:me.y};if(!W.current)return void(W.current=D3(ae,xe));var Oe=D3(ae,xe),Be=(function(ht,ve){return Math.sqrt(Math.pow(ve.x-ht.x,2)+Math.pow(ve.y-ht.y,2))})(ae,xe);V.current||(V.current=Be);const Ye=Te.position();var ct={x:Oe.x-Ye.x,y:Oe.y-Ye.y},be=Be/V.current;Te.scaleX(be),Te.scaleY(be);const at=Ie.point(Oe),Ze=Ie.point(W.current);var he=at.x-Ze.x,Ve=at.y-Ze.y,le={x:Math.min(0,Oe.x-ct.x*be+he),y:Math.min(0,Oe.y-ct.y*be+Ve)};Te.position(le),V.current=Be,W.current=Oe,te(ke)}},onTouchEnd:ke=>{V.current=0,W.current=null,_t.hitOnDragEnabled=!1}}),Y.createElement(yp,Object.assign({ref:D},gA)),Y.createElement(ur,{width:L,height:R,ref:J,listening:!1,onTransform:ke=>{if(t.cropX<Math.abs(ke.target.x()/k.width)&&ke.target.x()<0&&t.cropX>0){const Be=(t.cropWidth+t.cropX)*k.width;ke.target.scaleX(1),ke.target.width(Be)}if(t.cropY<Math.abs(ke.target.y()/k.height)&&ke.target.y()<0&&t.cropY>0){const Be=(t.cropHeight+t.cropY)*k.height;ke.target.scaleY(1),ke.target.height(Be)}ke.target.x()<-t.cropX*k.width-1e-9&&(ke.target.x(-t.cropX*k.width),ke.target.scaleX(1)),ke.target.y()<-t.cropY*k.height-1e-9&&(ke.target.y(-t.cropY*k.height),ke.target.scaleY(1));const ge=Math.min(1,Math.max(0,t.cropX+ke.target.x()/k.width)),se=Math.min(1,Math.max(0,ke.target.y()/k.height+t.cropY)),me=ke.target.width()*ke.target.scaleX(),Te=ke.target.height()*ke.target.scaleY(),ae=Math.min(1-ge,me/k.width),xe=Math.min(1-se,Te/k.height),Oe=ke.target.getAbsolutePosition(ke.target.getParent().getParent());ke.target.scale({x:1,y:1}),ke.target.position({x:0,y:0}),t.set({x:Oe.x,y:Oe.y,cropX:ge,cropY:se,cropWidth:ae,cropHeight:xe,width:Math.min(me*q,k.width*(1-ge)*q),height:Math.min(Te*q,k.height*(1-se)*q)})}}),Y.createElement(yp,Object.assign({ref:U},mA,{visible:t.resizable})))))});var wg={exports:{}};var xA=wg.exports,F3;function SA(){return F3||(F3=1,(function(t,e){(function(n,i){t.exports=i()})(typeof self<"u"?self:xA,function(){return(function(r){var n={};function i(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return r[a].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=r,i.c=n,i.d=function(a,o,s){i.o(a,o)||Object.defineProperty(a,o,{configurable:!1,enumerable:!0,get:s})},i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,"a",o),o},i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)},i.p="",i(i.s=109)})([(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(17),o=i(18),s=i(19),u=i(45),f=i(46),d=i(47),h=i(48),p=i(49),y=i(12),v=i(32),b=i(33),x=i(31),k=i(1),S={Scope:k.Scope,create:k.create,find:k.find,query:k.query,register:k.register,Container:a.default,Format:o.default,Leaf:s.default,Embed:h.default,Scroll:u.default,Block:d.default,Inline:f.default,Text:p.default,Attributor:{Attribute:y.default,Class:v.default,Style:b.default,Store:x.default}};n.default=S}),(function(r,n,i){var a=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,S){k.__proto__=S}||function(k,S){for(var P in S)S.hasOwnProperty(P)&&(k[P]=S[P])};return function(k,S){x(k,S);function P(){this.constructor=k}k.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=(function(x){a(k,x);function k(S){var P=this;return S="[Parchment] "+S,P=x.call(this,S)||this,P.message=S,P.name=P.constructor.name,P}return k})(Error);n.ParchmentError=o;var s={},u={},f={},d={};n.DATA_KEY="__blot";var h;(function(x){x[x.TYPE=3]="TYPE",x[x.LEVEL=12]="LEVEL",x[x.ATTRIBUTE=13]="ATTRIBUTE",x[x.BLOT=14]="BLOT",x[x.INLINE=7]="INLINE",x[x.BLOCK=11]="BLOCK",x[x.BLOCK_BLOT=10]="BLOCK_BLOT",x[x.INLINE_BLOT=6]="INLINE_BLOT",x[x.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",x[x.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",x[x.ANY=15]="ANY"})(h=n.Scope||(n.Scope={}));function p(x,k){var S=v(x);if(S==null)throw new o("Unable to create "+x+" blot");var P=S,_=x instanceof Node||x.nodeType===Node.TEXT_NODE?x:P.create(k);return new P(_,k)}n.create=p;function y(x,k){return k===void 0&&(k=!1),x==null?null:x[n.DATA_KEY]!=null?x[n.DATA_KEY].blot:k?y(x.parentNode,k):null}n.find=y;function v(x,k){k===void 0&&(k=h.ANY);var S;if(typeof x=="string")S=d[x]||s[x];else if(x instanceof Text||x.nodeType===Node.TEXT_NODE)S=d.text;else if(typeof x=="number")x&h.LEVEL&h.BLOCK?S=d.block:x&h.LEVEL&h.INLINE&&(S=d.inline);else if(x instanceof HTMLElement){var P=(x.getAttribute("class")||"").split(/\s+/);for(var _ in P)if(S=u[P[_]],S)break;S=S||f[x.tagName]}return S==null?null:k&h.LEVEL&S.scope&&k&h.TYPE&S.scope?S:null}n.query=v;function b(){for(var x=[],k=0;k<arguments.length;k++)x[k]=arguments[k];if(x.length>1)return x.map(function(_){return b(_)});var S=x[0];if(typeof S.blotName!="string"&&typeof S.attrName!="string")throw new o("Invalid definition");if(S.blotName==="abstract")throw new o("Cannot register abstract class");if(d[S.blotName||S.attrName]=S,typeof S.keyName=="string")s[S.keyName]=S;else if(S.className!=null&&(u[S.className]=S),S.tagName!=null){Array.isArray(S.tagName)?S.tagName=S.tagName.map(function(_){return _.toUpperCase()}):S.tagName=S.tagName.toUpperCase();var P=Array.isArray(S.tagName)?S.tagName:[S.tagName];P.forEach(function(_){(f[_]==null||S.className==null)&&(f[_]=S)})}return S}n.register=b}),(function(r,n,i){var a=i(51),o=i(11),s=i(3),u=i(20),f="\0",d=function(h){Array.isArray(h)?this.ops=h:h!=null&&Array.isArray(h.ops)?this.ops=h.ops:this.ops=[]};d.prototype.insert=function(h,p){var y={};return h.length===0?this:(y.insert=h,p!=null&&typeof p=="object"&&Object.keys(p).length>0&&(y.attributes=p),this.push(y))},d.prototype.delete=function(h){return h<=0?this:this.push({delete:h})},d.prototype.retain=function(h,p){if(h<=0)return this;var y={retain:h};return p!=null&&typeof p=="object"&&Object.keys(p).length>0&&(y.attributes=p),this.push(y)},d.prototype.push=function(h){var p=this.ops.length,y=this.ops[p-1];if(h=s(!0,{},h),typeof y=="object"){if(typeof h.delete=="number"&&typeof y.delete=="number")return this.ops[p-1]={delete:y.delete+h.delete},this;if(typeof y.delete=="number"&&h.insert!=null&&(p-=1,y=this.ops[p-1],typeof y!="object"))return this.ops.unshift(h),this;if(o(h.attributes,y.attributes)){if(typeof h.insert=="string"&&typeof y.insert=="string")return this.ops[p-1]={insert:y.insert+h.insert},typeof h.attributes=="object"&&(this.ops[p-1].attributes=h.attributes),this;if(typeof h.retain=="number"&&typeof y.retain=="number")return this.ops[p-1]={retain:y.retain+h.retain},typeof h.attributes=="object"&&(this.ops[p-1].attributes=h.attributes),this}}return p===this.ops.length?this.ops.push(h):this.ops.splice(p,0,h),this},d.prototype.chop=function(){var h=this.ops[this.ops.length-1];return h&&h.retain&&!h.attributes&&this.ops.pop(),this},d.prototype.filter=function(h){return this.ops.filter(h)},d.prototype.forEach=function(h){this.ops.forEach(h)},d.prototype.map=function(h){return this.ops.map(h)},d.prototype.partition=function(h){var p=[],y=[];return this.forEach(function(v){var b=h(v)?p:y;b.push(v)}),[p,y]},d.prototype.reduce=function(h,p){return this.ops.reduce(h,p)},d.prototype.changeLength=function(){return this.reduce(function(h,p){return p.insert?h+u.length(p):p.delete?h-p.delete:h},0)},d.prototype.length=function(){return this.reduce(function(h,p){return h+u.length(p)},0)},d.prototype.slice=function(h,p){h=h||0,typeof p!="number"&&(p=1/0);for(var y=[],v=u.iterator(this.ops),b=0;b<p&&v.hasNext();){var x;b<h?x=v.next(h-b):(x=v.next(p-b),y.push(x)),b+=u.length(x)}return new d(y)},d.prototype.compose=function(h){var p=u.iterator(this.ops),y=u.iterator(h.ops),v=[],b=y.peek();if(b!=null&&typeof b.retain=="number"&&b.attributes==null){for(var x=b.retain;p.peekType()==="insert"&&p.peekLength()<=x;)x-=p.peekLength(),v.push(p.next());b.retain-x>0&&y.next(b.retain-x)}for(var k=new d(v);p.hasNext()||y.hasNext();)if(y.peekType()==="insert")k.push(y.next());else if(p.peekType()==="delete")k.push(p.next());else{var S=Math.min(p.peekLength(),y.peekLength()),P=p.next(S),_=y.next(S);if(typeof _.retain=="number"){var E={};typeof P.retain=="number"?E.retain=S:E.insert=P.insert;var A=u.attributes.compose(P.attributes,_.attributes,typeof P.retain=="number");if(A&&(E.attributes=A),k.push(E),!y.hasNext()&&o(k.ops[k.ops.length-1],E)){var T=new d(p.rest());return k.concat(T).chop()}}else typeof _.delete=="number"&&typeof P.retain=="number"&&k.push(_)}return k.chop()},d.prototype.concat=function(h){var p=new d(this.ops.slice());return h.ops.length>0&&(p.push(h.ops[0]),p.ops=p.ops.concat(h.ops.slice(1))),p},d.prototype.diff=function(h,p){if(this.ops===h.ops)return new d;var y=[this,h].map(function(S){return S.map(function(P){if(P.insert!=null)return typeof P.insert=="string"?P.insert:f;var _=S===h?"on":"with";throw new Error("diff() called "+_+" non-document")}).join("")}),v=new d,b=a(y[0],y[1],p),x=u.iterator(this.ops),k=u.iterator(h.ops);return b.forEach(function(S){for(var P=S[1].length;P>0;){var _=0;switch(S[0]){case a.INSERT:_=Math.min(k.peekLength(),P),v.push(k.next(_));break;case a.DELETE:_=Math.min(P,x.peekLength()),x.next(_),v.delete(_);break;case a.EQUAL:_=Math.min(x.peekLength(),k.peekLength(),P);var E=x.next(_),A=k.next(_);o(E.insert,A.insert)?v.retain(_,u.attributes.diff(E.attributes,A.attributes)):v.push(A).delete(_);break}P-=_}}),v.chop()},d.prototype.eachLine=function(h,p){p=p||`
106
+ `;for(var y=u.iterator(this.ops),v=new d,b=0;y.hasNext();){if(y.peekType()!=="insert")return;var x=y.peek(),k=u.length(x)-y.peekLength(),S=typeof x.insert=="string"?x.insert.indexOf(p,k)-k:-1;if(S<0)v.push(y.next());else if(S>0)v.push(y.next(S));else{if(h(v,y.next(1).attributes||{},b)===!1)return;b+=1,v=new d}}v.length()>0&&h(v,{},b)},d.prototype.transform=function(h,p){if(p=!!p,typeof h=="number")return this.transformPosition(h,p);for(var y=u.iterator(this.ops),v=u.iterator(h.ops),b=new d;y.hasNext()||v.hasNext();)if(y.peekType()==="insert"&&(p||v.peekType()!=="insert"))b.retain(u.length(y.next()));else if(v.peekType()==="insert")b.push(v.next());else{var x=Math.min(y.peekLength(),v.peekLength()),k=y.next(x),S=v.next(x);if(k.delete)continue;S.delete?b.push(S):b.retain(x,u.attributes.transform(k.attributes,S.attributes,p))}return b.chop()},d.prototype.transformPosition=function(h,p){p=!!p;for(var y=u.iterator(this.ops),v=0;y.hasNext()&&v<=h;){var b=y.peekLength(),x=y.peekType();if(y.next(),x==="delete"){h-=Math.min(b,h-v);continue}else x==="insert"&&(v<h||!p)&&(h+=b);v+=b}return h},r.exports=d}),(function(r,n){var i=Object.prototype.hasOwnProperty,a=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u=function(y){return typeof Array.isArray=="function"?Array.isArray(y):a.call(y)==="[object Array]"},f=function(y){if(!y||a.call(y)!=="[object Object]")return!1;var v=i.call(y,"constructor"),b=y.constructor&&y.constructor.prototype&&i.call(y.constructor.prototype,"isPrototypeOf");if(y.constructor&&!v&&!b)return!1;var x;for(x in y);return typeof x>"u"||i.call(y,x)},d=function(y,v){o&&v.name==="__proto__"?o(y,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):y[v.name]=v.newValue},h=function(y,v){if(v==="__proto__")if(i.call(y,v)){if(s)return s(y,v).value}else return;return y[v]};r.exports=function p(){var y,v,b,x,k,S,P=arguments[0],_=1,E=arguments.length,A=!1;for(typeof P=="boolean"&&(A=P,P=arguments[1]||{},_=2),(P==null||typeof P!="object"&&typeof P!="function")&&(P={});_<E;++_)if(y=arguments[_],y!=null)for(v in y)b=h(P,v),x=h(y,v),P!==x&&(A&&x&&(f(x)||(k=u(x)))?(k?(k=!1,S=b&&u(b)?b:[]):S=b&&f(b)?b:{},d(P,{name:v,newValue:p(A,S,x)})):typeof x<"u"&&d(P,{name:v,newValue:x}));return P}}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BlockEmbed=n.bubbleFormats=void 0;var a=(function(){function N(F,H){for(var $=0;$<H.length;$++){var X=H[$];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(F,X.key,X)}}return function(F,H,$){return H&&N(F.prototype,H),$&&N(F,$),F}})(),o=function N(F,H,$){F===null&&(F=Function.prototype);var X=Object.getOwnPropertyDescriptor(F,H);if(X===void 0){var Z=Object.getPrototypeOf(F);return Z===null?void 0:N(Z,H,$)}else{if("value"in X)return X.value;var K=X.get;return K===void 0?void 0:K.call($)}},s=i(3),u=P(s),f=i(2),d=P(f),h=i(0),p=P(h),y=i(16),v=P(y),b=i(6),x=P(b),k=i(7),S=P(k);function P(N){return N&&N.__esModule?N:{default:N}}function _(N,F){if(!(N instanceof F))throw new TypeError("Cannot call a class as a function")}function E(N,F){if(!N)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F&&(typeof F=="object"||typeof F=="function")?F:N}function A(N,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof F);N.prototype=Object.create(F&&F.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),F&&(Object.setPrototypeOf?Object.setPrototypeOf(N,F):N.__proto__=F)}var T=1,I=(function(N){A(F,N);function F(){return _(this,F),E(this,(F.__proto__||Object.getPrototypeOf(F)).apply(this,arguments))}return a(F,[{key:"attach",value:function(){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"attach",this).call(this),this.attributes=new p.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return new d.default().insert(this.value(),(0,u.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function($,X){var Z=p.default.query($,p.default.Scope.BLOCK_ATTRIBUTE);Z!=null&&this.attributes.attribute(Z,X)}},{key:"formatAt",value:function($,X,Z,K){this.format(Z,K)}},{key:"insertAt",value:function($,X,Z){if(typeof X=="string"&&X.endsWith(`
107
+ `)){var K=p.default.create(L.blotName);this.parent.insertBefore(K,$===0?this:this.next),K.insertAt(0,X.slice(0,-1))}else o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertAt",this).call(this,$,X,Z)}}]),F})(p.default.Embed);I.scope=p.default.Scope.BLOCK_BLOT;var L=(function(N){A(F,N);function F(H){_(this,F);var $=E(this,(F.__proto__||Object.getPrototypeOf(F)).call(this,H));return $.cache={},$}return a(F,[{key:"delta",value:function(){return this.cache.delta==null&&(this.cache.delta=this.descendants(p.default.Leaf).reduce(function($,X){return X.length()===0?$:$.insert(X.value(),R(X))},new d.default).insert(`
108
+ `,R(this))),this.cache.delta}},{key:"deleteAt",value:function($,X){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"deleteAt",this).call(this,$,X),this.cache={}}},{key:"formatAt",value:function($,X,Z,K){X<=0||(p.default.query(Z,p.default.Scope.BLOCK)?$+X===this.length()&&this.format(Z,K):o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"formatAt",this).call(this,$,Math.min(X,this.length()-$-1),Z,K),this.cache={})}},{key:"insertAt",value:function($,X,Z){if(Z!=null)return o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertAt",this).call(this,$,X,Z);if(X.length!==0){var K=X.split(`
109
+ `),q=K.shift();q.length>0&&($<this.length()-1||this.children.tail==null?o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertAt",this).call(this,Math.min($,this.length()-1),q):this.children.tail.insertAt(this.children.tail.length(),q),this.cache={});var J=this;K.reduce(function(U,D){return J=J.split(U,!0),J.insertAt(0,D),D.length},$+q.length)}}},{key:"insertBefore",value:function($,X){var Z=this.children.head;o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"insertBefore",this).call(this,$,X),Z instanceof v.default&&Z.remove(),this.cache={}}},{key:"length",value:function(){return this.cache.length==null&&(this.cache.length=o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"length",this).call(this)+T),this.cache.length}},{key:"moveChildren",value:function($,X){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"moveChildren",this).call(this,$,X),this.cache={}}},{key:"optimize",value:function($){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"optimize",this).call(this,$),this.cache={}}},{key:"path",value:function($){return o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"path",this).call(this,$,!0)}},{key:"removeChild",value:function($){o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"removeChild",this).call(this,$),this.cache={}}},{key:"split",value:function($){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(X&&($===0||$>=this.length()-T)){var Z=this.clone();return $===0?(this.parent.insertBefore(Z,this),this):(this.parent.insertBefore(Z,this.next),Z)}else{var K=o(F.prototype.__proto__||Object.getPrototypeOf(F.prototype),"split",this).call(this,$,X);return this.cache={},K}}}]),F})(p.default.Block);L.blotName="block",L.tagName="P",L.defaultChild="break",L.allowedChildren=[x.default,p.default.Embed,S.default];function R(N){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return N==null||(typeof N.formats=="function"&&(F=(0,u.default)(F,N.formats())),N.parent==null||N.parent.blotName=="scroll"||N.parent.statics.scope!==N.statics.scope)?F:R(N.parent,F)}n.bubbleFormats=R,n.BlockEmbed=I,n.default=L}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.overload=n.expandConfig=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(J){return typeof J}:function(J){return J&&typeof Symbol=="function"&&J.constructor===Symbol&&J!==Symbol.prototype?"symbol":typeof J},o=(function(){function J(U,D){var W=[],V=!0,ee=!1,te=void 0;try{for(var Q=U[Symbol.iterator](),ne;!(V=(ne=Q.next()).done)&&(W.push(ne.value),!(D&&W.length===D));V=!0);}catch(ue){ee=!0,te=ue}finally{try{!V&&Q.return&&Q.return()}finally{if(ee)throw te}}return W}return function(U,D){if(Array.isArray(U))return U;if(Symbol.iterator in Object(U))return J(U,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function J(U,D){for(var W=0;W<D.length;W++){var V=D[W];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(U,V.key,V)}}return function(U,D,W){return D&&J(U.prototype,D),W&&J(U,W),U}})();i(50);var u=i(2),f=R(u),d=i(14),h=R(d),p=i(8),y=R(p),v=i(9),b=R(v),x=i(0),k=R(x),S=i(15),P=R(S),_=i(3),E=R(_),A=i(10),T=R(A),I=i(34),L=R(I);function R(J){return J&&J.__esModule?J:{default:J}}function N(J,U,D){return U in J?Object.defineProperty(J,U,{value:D,enumerable:!0,configurable:!0,writable:!0}):J[U]=D,J}function F(J,U){if(!(J instanceof U))throw new TypeError("Cannot call a class as a function")}var H=(0,T.default)("quill"),$=(function(){s(J,null,[{key:"debug",value:function(D){D===!0&&(D="log"),T.default.level(D)}},{key:"find",value:function(D){return D.__quill||k.default.find(D)}},{key:"import",value:function(D){return this.imports[D]==null&&H.error("Cannot import "+D+". Are you sure it was registered?"),this.imports[D]}},{key:"register",value:function(D,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof D!="string"){var te=D.attrName||D.blotName;typeof te=="string"?this.register("formats/"+te,D,W):Object.keys(D).forEach(function(Q){V.register(Q,D[Q],W)})}else this.imports[D]!=null&&!ee&&H.warn("Overwriting "+D+" with",W),this.imports[D]=W,(D.startsWith("blots/")||D.startsWith("formats/"))&&W.blotName!=="abstract"?k.default.register(W):D.startsWith("modules")&&typeof W.register=="function"&&W.register()}}]);function J(U){var D=this,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(F(this,J),this.options=X(U,W),this.container=this.options.container,this.container==null)return H.error("Invalid Quill container",U);this.options.debug&&J.debug(this.options.debug);var V=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new y.default,this.scroll=k.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new h.default(this.scroll),this.selection=new P.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(y.default.events.EDITOR_CHANGE,function(te){te===y.default.events.TEXT_CHANGE&&D.root.classList.toggle("ql-blank",D.editor.isBlank())}),this.emitter.on(y.default.events.SCROLL_UPDATE,function(te,Q){var ne=D.selection.lastRange,ue=ne&&ne.length===0?ne.index:void 0;Z.call(D,function(){return D.editor.update(null,Q,ue)},te)});var ee=this.clipboard.convert(`<div class='ql-editor' style="white-space: normal;">`+V+"<p><br></p></div>");this.setContents(ee),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return s(J,[{key:"addContainer",value:function(D){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof D=="string"){var V=D;D=document.createElement("div"),D.classList.add(V)}return this.container.insertBefore(D,W),D}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(D,W,V){var ee=this,te=K(D,W,V),Q=o(te,4);return D=Q[0],W=Q[1],V=Q[3],Z.call(this,function(){return ee.editor.deleteText(D,W)},V,D,-1*W)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(D),this.container.classList.toggle("ql-disabled",!D)}},{key:"focus",value:function(){var D=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=D,this.scrollIntoView()}},{key:"format",value:function(D,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.default.sources.API;return Z.call(this,function(){var te=V.getSelection(!0),Q=new f.default;if(te==null)return Q;if(k.default.query(D,k.default.Scope.BLOCK))Q=V.editor.formatLine(te.index,te.length,N({},D,W));else{if(te.length===0)return V.selection.format(D,W),Q;Q=V.editor.formatText(te.index,te.length,N({},D,W))}return V.setSelection(te,y.default.sources.SILENT),Q},ee)}},{key:"formatLine",value:function(D,W,V,ee,te){var Q=this,ne=void 0,ue=K(D,W,V,ee,te),oe=o(ue,4);return D=oe[0],W=oe[1],ne=oe[2],te=oe[3],Z.call(this,function(){return Q.editor.formatLine(D,W,ne)},te,D,0)}},{key:"formatText",value:function(D,W,V,ee,te){var Q=this,ne=void 0,ue=K(D,W,V,ee,te),oe=o(ue,4);return D=oe[0],W=oe[1],ne=oe[2],te=oe[3],Z.call(this,function(){return Q.editor.formatText(D,W,ne)},te,D,0)}},{key:"getBounds",value:function(D){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=void 0;typeof D=="number"?V=this.selection.getBounds(D,W):V=this.selection.getBounds(D.index,D.length);var ee=this.container.getBoundingClientRect();return{bottom:V.bottom-ee.top,height:V.height,left:V.left-ee.left,right:V.right-ee.left,top:V.top-ee.top,width:V.width}}},{key:"getContents",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,V=K(D,W),ee=o(V,2);return D=ee[0],W=ee[1],this.editor.getContents(D,W)}},{key:"getFormat",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof D=="number"?this.editor.getFormat(D,W):this.editor.getFormat(D.index,D.length)}},{key:"getIndex",value:function(D){return D.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(D){return this.scroll.leaf(D)}},{key:"getLine",value:function(D){return this.scroll.line(D)}},{key:"getLines",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof D!="number"?this.scroll.lines(D.index,D.length):this.scroll.lines(D,W)}},{key:"getModule",value:function(D){return this.theme.modules[D]}},{key:"getSelection",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return D&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,V=K(D,W),ee=o(V,2);return D=ee[0],W=ee[1],this.editor.getText(D,W)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(D,W,V){var ee=this,te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:J.sources.API;return Z.call(this,function(){return ee.editor.insertEmbed(D,W,V)},te,D)}},{key:"insertText",value:function(D,W,V,ee,te){var Q=this,ne=void 0,ue=K(D,0,V,ee,te),oe=o(ue,4);return D=oe[0],ne=oe[2],te=oe[3],Z.call(this,function(){return Q.editor.insertText(D,W,ne)},te,D,W.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(D,W,V){this.clipboard.dangerouslyPasteHTML(D,W,V)}},{key:"removeFormat",value:function(D,W,V){var ee=this,te=K(D,W,V),Q=o(te,4);return D=Q[0],W=Q[1],V=Q[3],Z.call(this,function(){return ee.editor.removeFormat(D,W)},V,D)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(D){var W=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API;return Z.call(this,function(){D=new f.default(D);var ee=W.getLength(),te=W.editor.deleteText(0,ee),Q=W.editor.applyDelta(D),ne=Q.ops[Q.ops.length-1];ne!=null&&typeof ne.insert=="string"&&ne.insert[ne.insert.length-1]===`
110
+ `&&(W.editor.deleteText(W.getLength()-1,1),Q.delete(1));var ue=te.compose(Q);return ue},V)}},{key:"setSelection",value:function(D,W,V){if(D==null)this.selection.setRange(null,W||J.sources.API);else{var ee=K(D,W,V),te=o(ee,4);D=te[0],W=te[1],V=te[3],this.selection.setRange(new S.Range(D,W),V),V!==y.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(D){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API,V=new f.default().insert(D);return this.setContents(V,W)}},{key:"update",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y.default.sources.USER,W=this.scroll.update(D);return this.selection.update(D),W}},{key:"updateContents",value:function(D){var W=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API;return Z.call(this,function(){return D=new f.default(D),W.editor.applyDelta(D,V)},V,!0)}}]),J})();$.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},$.events=y.default.events,$.sources=y.default.sources,$.version="1.3.7",$.imports={delta:f.default,parchment:k.default,"core/module":b.default,"core/theme":L.default};function X(J,U){if(U=(0,E.default)(!0,{container:J,modules:{clipboard:!0,keyboard:!0,history:!0}},U),!U.theme||U.theme===$.DEFAULTS.theme)U.theme=L.default;else if(U.theme=$.import("themes/"+U.theme),U.theme==null)throw new Error("Invalid theme "+U.theme+". Did you register it?");var D=(0,E.default)(!0,{},U.theme.DEFAULTS);[D,U].forEach(function(ee){ee.modules=ee.modules||{},Object.keys(ee.modules).forEach(function(te){ee.modules[te]===!0&&(ee.modules[te]={})})});var W=Object.keys(D.modules).concat(Object.keys(U.modules)),V=W.reduce(function(ee,te){var Q=$.import("modules/"+te);return Q==null?H.error("Cannot load "+te+" module. Are you sure you registered it?"):ee[te]=Q.DEFAULTS||{},ee},{});return U.modules!=null&&U.modules.toolbar&&U.modules.toolbar.constructor!==Object&&(U.modules.toolbar={container:U.modules.toolbar}),U=(0,E.default)(!0,{},$.DEFAULTS,{modules:V},D,U),["bounds","container","scrollingContainer"].forEach(function(ee){typeof U[ee]=="string"&&(U[ee]=document.querySelector(U[ee]))}),U.modules=Object.keys(U.modules).reduce(function(ee,te){return U.modules[te]&&(ee[te]=U.modules[te]),ee},{}),U}function Z(J,U,D,W){if(this.options.strict&&!this.isEnabled()&&U===y.default.sources.USER)return new f.default;var V=D==null?null:this.getSelection(),ee=this.editor.delta,te=J();if(V!=null&&(D===!0&&(D=V.index),W==null?V=q(V,te,U):W!==0&&(V=q(V,D,W,U)),this.setSelection(V,y.default.sources.SILENT)),te.length()>0){var Q,ne=[y.default.events.TEXT_CHANGE,te,ee,U];if((Q=this.emitter).emit.apply(Q,[y.default.events.EDITOR_CHANGE].concat(ne)),U!==y.default.sources.SILENT){var ue;(ue=this.emitter).emit.apply(ue,ne)}}return te}function K(J,U,D,W,V){var ee={};return typeof J.index=="number"&&typeof J.length=="number"?typeof U!="number"?(V=W,W=D,D=U,U=J.length,J=J.index):(U=J.length,J=J.index):typeof U!="number"&&(V=W,W=D,D=U,U=0),(typeof D>"u"?"undefined":a(D))==="object"?(ee=D,V=W):typeof D=="string"&&(W!=null?ee[D]=W:V=D),V=V||y.default.sources.API,[J,U,ee,V]}function q(J,U,D,W){if(J==null)return null;var V=void 0,ee=void 0;if(U instanceof f.default){var te=[J.index,J.index+J.length].map(function(oe){return U.transformPosition(oe,W!==y.default.sources.USER)}),Q=o(te,2);V=Q[0],ee=Q[1]}else{var ne=[J.index,J.index+J.length].map(function(oe){return oe<U||oe===U&&W===y.default.sources.USER?oe:D>=0?oe+D:Math.max(U,oe+D)}),ue=o(ne,2);V=ue[0],ee=ue[1]}return new S.Range(V,ee-V)}n.expandConfig=X,n.overload=K,n.default=$}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(k,S){for(var P=0;P<S.length;P++){var _=S[P];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}return function(k,S,P){return S&&x(k.prototype,S),P&&x(k,P),k}})(),o=function x(k,S,P){k===null&&(k=Function.prototype);var _=Object.getOwnPropertyDescriptor(k,S);if(_===void 0){var E=Object.getPrototypeOf(k);return E===null?void 0:x(E,S,P)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(P)}},s=i(7),u=h(s),f=i(0),d=h(f);function h(x){return x&&x.__esModule?x:{default:x}}function p(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}function y(x,k){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:x}function v(x,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);x.prototype=Object.create(k&&k.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(x,k):x.__proto__=k)}var b=(function(x){v(k,x);function k(){return p(this,k),y(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}return a(k,[{key:"formatAt",value:function(P,_,E,A){if(k.compare(this.statics.blotName,E)<0&&d.default.query(E,d.default.Scope.BLOT)){var T=this.isolate(P,_);A&&T.wrap(E,A)}else o(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"formatAt",this).call(this,P,_,E,A)}},{key:"optimize",value:function(P){if(o(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"optimize",this).call(this,P),this.parent instanceof k&&k.compare(this.statics.blotName,this.parent.statics.blotName)>0){var _=this.parent.isolate(this.offset(),this.length());this.moveChildren(_),_.wrap(this)}}}],[{key:"compare",value:function(P,_){var E=k.order.indexOf(P),A=k.order.indexOf(_);return E>=0||A>=0?E-A:P===_?0:P<_?-1:1}}]),k})(d.default.Inline);b.allowedChildren=[b,d.default.Embed,u.default],b.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],n.default=b}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(0),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}function u(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function f(p,y){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:p}function d(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(p,y):p.__proto__=y)}var h=(function(p){d(y,p);function y(){return u(this,y),f(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default.Text);n.default=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function S(P,_){for(var E=0;E<_.length;E++){var A=_[E];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(P,A.key,A)}}return function(P,_,E){return _&&S(P.prototype,_),E&&S(P,E),P}})(),o=function S(P,_,E){P===null&&(P=Function.prototype);var A=Object.getOwnPropertyDescriptor(P,_);if(A===void 0){var T=Object.getPrototypeOf(P);return T===null?void 0:S(T,_,E)}else{if("value"in A)return A.value;var I=A.get;return I===void 0?void 0:I.call(E)}},s=i(54),u=h(s),f=i(10),d=h(f);function h(S){return S&&S.__esModule?S:{default:S}}function p(S,P){if(!(S instanceof P))throw new TypeError("Cannot call a class as a function")}function y(S,P){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:S}function v(S,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);S.prototype=Object.create(P&&P.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(S,P):S.__proto__=P)}var b=(0,d.default)("quill:events"),x=["selectionchange","mousedown","mouseup","click"];x.forEach(function(S){document.addEventListener(S,function(){for(var P=arguments.length,_=Array(P),E=0;E<P;E++)_[E]=arguments[E];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(A){if(A.__quill&&A.__quill.emitter){var T;(T=A.__quill.emitter).handleDOM.apply(T,_)}})})});var k=(function(S){v(P,S);function P(){p(this,P);var _=y(this,(P.__proto__||Object.getPrototypeOf(P)).call(this));return _.listeners={},_.on("error",b.error),_}return a(P,[{key:"emit",value:function(){b.log.apply(b,arguments),o(P.prototype.__proto__||Object.getPrototypeOf(P.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(E){for(var A=arguments.length,T=Array(A>1?A-1:0),I=1;I<A;I++)T[I-1]=arguments[I];(this.listeners[E.type]||[]).forEach(function(L){var R=L.node,N=L.handler;(E.target===R||R.contains(E.target))&&N.apply(void 0,[E].concat(T))})}},{key:"listenDOM",value:function(E,A,T){this.listeners[E]||(this.listeners[E]=[]),this.listeners[E].push({node:A,handler:T})}}]),P})(u.default);k.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},k.sources={API:"api",SILENT:"silent",USER:"user"},n.default=k}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});function a(s,u){if(!(s instanceof u))throw new TypeError("Cannot call a class as a function")}var o=function s(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};a(this,s),this.quill=u,this.options=f};o.DEFAULTS={},n.default=o}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=["error","warn","log","info"],o="warn";function s(f){if(a.indexOf(f)<=a.indexOf(o)){for(var d,h=arguments.length,p=Array(h>1?h-1:0),y=1;y<h;y++)p[y-1]=arguments[y];(d=console)[f].apply(d,p)}}function u(f){return a.reduce(function(d,h){return d[h]=s.bind(console,h,f),d},{})}s.level=u.level=function(f){o=f},n.default=u}),(function(r,n,i){var a=Array.prototype.slice,o=i(52),s=i(53),u=r.exports=function(p,y,v){return v||(v={}),p===y?!0:p instanceof Date&&y instanceof Date?p.getTime()===y.getTime():!p||!y||typeof p!="object"&&typeof y!="object"?v.strict?p===y:p==y:h(p,y,v)};function f(p){return p==null}function d(p){return!(!p||typeof p!="object"||typeof p.length!="number"||typeof p.copy!="function"||typeof p.slice!="function"||p.length>0&&typeof p[0]!="number")}function h(p,y,v){var b,x;if(f(p)||f(y)||p.prototype!==y.prototype)return!1;if(s(p))return s(y)?(p=a.call(p),y=a.call(y),u(p,y,v)):!1;if(d(p)){if(!d(y)||p.length!==y.length)return!1;for(b=0;b<p.length;b++)if(p[b]!==y[b])return!1;return!0}try{var k=o(p),S=o(y)}catch{return!1}if(k.length!=S.length)return!1;for(k.sort(),S.sort(),b=k.length-1;b>=0;b--)if(k[b]!=S[b])return!1;for(b=k.length-1;b>=0;b--)if(x=k[b],!u(p[x],y[x],v))return!1;return typeof p==typeof y}}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(1),o=(function(){function s(u,f,d){d===void 0&&(d={}),this.attrName=u,this.keyName=f;var h=a.Scope.TYPE&a.Scope.ATTRIBUTE;d.scope!=null?this.scope=d.scope&a.Scope.LEVEL|h:this.scope=a.Scope.ATTRIBUTE,d.whitelist!=null&&(this.whitelist=d.whitelist)}return s.keys=function(u){return[].map.call(u.attributes,function(f){return f.name})},s.prototype.add=function(u,f){return this.canAdd(u,f)?(u.setAttribute(this.keyName,f),!0):!1},s.prototype.canAdd=function(u,f){var d=a.query(u,a.Scope.BLOT&(this.scope|a.Scope.TYPE));return d==null?!1:this.whitelist==null?!0:typeof f=="string"?this.whitelist.indexOf(f.replace(/["']/g,""))>-1:this.whitelist.indexOf(f)>-1},s.prototype.remove=function(u){u.removeAttribute(this.keyName)},s.prototype.value=function(u){var f=u.getAttribute(this.keyName);return this.canAdd(u,f)&&f?f:""},s})();n.default=o}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Code=void 0;var a=(function(){function I(L,R){var N=[],F=!0,H=!1,$=void 0;try{for(var X=L[Symbol.iterator](),Z;!(F=(Z=X.next()).done)&&(N.push(Z.value),!(R&&N.length===R));F=!0);}catch(K){H=!0,$=K}finally{try{!F&&X.return&&X.return()}finally{if(H)throw $}}return N}return function(L,R){if(Array.isArray(L))return L;if(Symbol.iterator in Object(L))return I(L,R);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function I(L,R){for(var N=0;N<R.length;N++){var F=R[N];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(L,F.key,F)}}return function(L,R,N){return R&&I(L.prototype,R),N&&I(L,N),L}})(),s=function I(L,R,N){L===null&&(L=Function.prototype);var F=Object.getOwnPropertyDescriptor(L,R);if(F===void 0){var H=Object.getPrototypeOf(L);return H===null?void 0:I(H,R,N)}else{if("value"in F)return F.value;var $=F.get;return $===void 0?void 0:$.call(N)}},u=i(2),f=S(u),d=i(0),h=S(d),p=i(4),y=S(p),v=i(6),b=S(v),x=i(7),k=S(x);function S(I){return I&&I.__esModule?I:{default:I}}function P(I,L){if(!(I instanceof L))throw new TypeError("Cannot call a class as a function")}function _(I,L){if(!I)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return L&&(typeof L=="object"||typeof L=="function")?L:I}function E(I,L){if(typeof L!="function"&&L!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof L);I.prototype=Object.create(L&&L.prototype,{constructor:{value:I,enumerable:!1,writable:!0,configurable:!0}}),L&&(Object.setPrototypeOf?Object.setPrototypeOf(I,L):I.__proto__=L)}var A=(function(I){E(L,I);function L(){return P(this,L),_(this,(L.__proto__||Object.getPrototypeOf(L)).apply(this,arguments))}return L})(b.default);A.blotName="code",A.tagName="CODE";var T=(function(I){E(L,I);function L(){return P(this,L),_(this,(L.__proto__||Object.getPrototypeOf(L)).apply(this,arguments))}return o(L,[{key:"delta",value:function(){var N=this,F=this.domNode.textContent;return F.endsWith(`
111
+ `)&&(F=F.slice(0,-1)),F.split(`
112
+ `).reduce(function(H,$){return H.insert($).insert(`
113
+ `,N.formats())},new f.default)}},{key:"format",value:function(N,F){if(!(N===this.statics.blotName&&F)){var H=this.descendant(k.default,this.length()-1),$=a(H,1),X=$[0];X?.deleteAt(X.length()-1,1),s(L.prototype.__proto__||Object.getPrototypeOf(L.prototype),"format",this).call(this,N,F)}}},{key:"formatAt",value:function(N,F,H,$){if(F!==0&&!(h.default.query(H,h.default.Scope.BLOCK)==null||H===this.statics.blotName&&$===this.statics.formats(this.domNode))){var X=this.newlineIndex(N);if(!(X<0||X>=N+F)){var Z=this.newlineIndex(N,!0)+1,K=X-Z+1,q=this.isolate(Z,K),J=q.next;q.format(H,$),J instanceof L&&J.formatAt(0,N-Z+F-K,H,$)}}}},{key:"insertAt",value:function(N,F,H){if(H==null){var $=this.descendant(k.default,N),X=a($,2),Z=X[0],K=X[1];Z.insertAt(K,F)}}},{key:"length",value:function(){var N=this.domNode.textContent.length;return this.domNode.textContent.endsWith(`
114
+ `)?N:N+1}},{key:"newlineIndex",value:function(N){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(F)return this.domNode.textContent.slice(0,N).lastIndexOf(`
115
+ `);var H=this.domNode.textContent.slice(N).indexOf(`
116
+ `);return H>-1?N+H:-1}},{key:"optimize",value:function(N){this.domNode.textContent.endsWith(`
117
+ `)||this.appendChild(h.default.create("text",`
118
+ `)),s(L.prototype.__proto__||Object.getPrototypeOf(L.prototype),"optimize",this).call(this,N);var F=this.next;F!=null&&F.prev===this&&F.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===F.statics.formats(F.domNode)&&(F.optimize(N),F.moveChildren(this),F.remove())}},{key:"replace",value:function(N){s(L.prototype.__proto__||Object.getPrototypeOf(L.prototype),"replace",this).call(this,N),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(F){var H=h.default.find(F);H==null?F.parentNode.removeChild(F):H instanceof h.default.Embed?H.remove():H.unwrap()})}}],[{key:"create",value:function(N){var F=s(L.__proto__||Object.getPrototypeOf(L),"create",this).call(this,N);return F.setAttribute("spellcheck",!1),F}},{key:"formats",value:function(){return!0}}]),L})(y.default);T.blotName="code-block",T.tagName="PRE",T.TAB=" ",n.Code=A,n.default=T}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(J){return typeof J}:function(J){return J&&typeof Symbol=="function"&&J.constructor===Symbol&&J!==Symbol.prototype?"symbol":typeof J},o=(function(){function J(U,D){var W=[],V=!0,ee=!1,te=void 0;try{for(var Q=U[Symbol.iterator](),ne;!(V=(ne=Q.next()).done)&&(W.push(ne.value),!(D&&W.length===D));V=!0);}catch(ue){ee=!0,te=ue}finally{try{!V&&Q.return&&Q.return()}finally{if(ee)throw te}}return W}return function(U,D){if(Array.isArray(U))return U;if(Symbol.iterator in Object(U))return J(U,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function J(U,D){for(var W=0;W<D.length;W++){var V=D[W];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(U,V.key,V)}}return function(U,D,W){return D&&J(U.prototype,D),W&&J(U,W),U}})(),u=i(2),f=F(u),d=i(20),h=F(d),p=i(0),y=F(p),v=i(13),b=F(v),x=i(24),k=F(x),S=i(4),P=F(S),_=i(16),E=F(_),A=i(21),T=F(A),I=i(11),L=F(I),R=i(3),N=F(R);function F(J){return J&&J.__esModule?J:{default:J}}function H(J,U,D){return U in J?Object.defineProperty(J,U,{value:D,enumerable:!0,configurable:!0,writable:!0}):J[U]=D,J}function $(J,U){if(!(J instanceof U))throw new TypeError("Cannot call a class as a function")}var X=/^[ -~]*$/,Z=(function(){function J(U){$(this,J),this.scroll=U,this.delta=this.getDelta()}return s(J,[{key:"applyDelta",value:function(D){var W=this,V=!1;this.scroll.update();var ee=this.scroll.length();return this.scroll.batchStart(),D=q(D),D.reduce(function(te,Q){var ne=Q.retain||Q.delete||Q.insert.length||1,ue=Q.attributes||{};if(Q.insert!=null){if(typeof Q.insert=="string"){var oe=Q.insert;oe.endsWith(`
119
+ `)&&V&&(V=!1,oe=oe.slice(0,-1)),te>=ee&&!oe.endsWith(`
120
+ `)&&(V=!0),W.scroll.insertAt(te,oe);var de=W.scroll.line(te),Ee=o(de,2),Fe=Ee[0],Le=Ee[1],$e=(0,N.default)({},(0,S.bubbleFormats)(Fe));if(Fe instanceof P.default){var Xe=Fe.descendant(y.default.Leaf,Le),dt=o(Xe,1),ke=dt[0];$e=(0,N.default)($e,(0,S.bubbleFormats)(ke))}ue=h.default.attributes.diff($e,ue)||{}}else if(a(Q.insert)==="object"){var ge=Object.keys(Q.insert)[0];if(ge==null)return te;W.scroll.insertAt(te,ge,Q.insert[ge])}ee+=ne}return Object.keys(ue).forEach(function(se){W.scroll.formatAt(te,ne,se,ue[se])}),te+ne},0),D.reduce(function(te,Q){return typeof Q.delete=="number"?(W.scroll.deleteAt(te,Q.delete),te):te+(Q.retain||Q.insert.length||1)},0),this.scroll.batchEnd(),this.update(D)}},{key:"deleteText",value:function(D,W){return this.scroll.deleteAt(D,W),this.update(new f.default().retain(D).delete(W))}},{key:"formatLine",value:function(D,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(ee).forEach(function(te){if(!(V.scroll.whitelist!=null&&!V.scroll.whitelist[te])){var Q=V.scroll.lines(D,Math.max(W,1)),ne=W;Q.forEach(function(ue){var oe=ue.length();if(!(ue instanceof b.default))ue.format(te,ee[te]);else{var de=D-ue.offset(V.scroll),Ee=ue.newlineIndex(de+ne)-de+1;ue.formatAt(de,Ee,te,ee[te])}ne-=oe})}}),this.scroll.optimize(),this.update(new f.default().retain(D).retain(W,(0,T.default)(ee)))}},{key:"formatText",value:function(D,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(ee).forEach(function(te){V.scroll.formatAt(D,W,te,ee[te])}),this.update(new f.default().retain(D).retain(W,(0,T.default)(ee)))}},{key:"getContents",value:function(D,W){return this.delta.slice(D,D+W)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(D,W){return D.concat(W.delta())},new f.default)}},{key:"getFormat",value:function(D){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=[],ee=[];W===0?this.scroll.path(D).forEach(function(Q){var ne=o(Q,1),ue=ne[0];ue instanceof P.default?V.push(ue):ue instanceof y.default.Leaf&&ee.push(ue)}):(V=this.scroll.lines(D,W),ee=this.scroll.descendants(y.default.Leaf,D,W));var te=[V,ee].map(function(Q){if(Q.length===0)return{};for(var ne=(0,S.bubbleFormats)(Q.shift());Object.keys(ne).length>0;){var ue=Q.shift();if(ue==null)return ne;ne=K((0,S.bubbleFormats)(ue),ne)}return ne});return N.default.apply(N.default,te)}},{key:"getText",value:function(D,W){return this.getContents(D,W).filter(function(V){return typeof V.insert=="string"}).map(function(V){return V.insert}).join("")}},{key:"insertEmbed",value:function(D,W,V){return this.scroll.insertAt(D,W,V),this.update(new f.default().retain(D).insert(H({},W,V)))}},{key:"insertText",value:function(D,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return W=W.replace(/\r\n/g,`
121
+ `).replace(/\r/g,`
122
+ `),this.scroll.insertAt(D,W),Object.keys(ee).forEach(function(te){V.scroll.formatAt(D,W.length,te,ee[te])}),this.update(new f.default().retain(D).insert(W,(0,T.default)(ee)))}},{key:"isBlank",value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var D=this.scroll.children.head;return D.statics.blotName!==P.default.blotName||D.children.length>1?!1:D.children.head instanceof E.default}},{key:"removeFormat",value:function(D,W){var V=this.getText(D,W),ee=this.scroll.line(D+W),te=o(ee,2),Q=te[0],ne=te[1],ue=0,oe=new f.default;Q!=null&&(Q instanceof b.default?ue=Q.newlineIndex(ne)-ne+1:ue=Q.length()-ne,oe=Q.delta().slice(ne,ne+ue-1).insert(`
123
+ `));var de=this.getContents(D,W+ue),Ee=de.diff(new f.default().insert(V).concat(oe)),Fe=new f.default().retain(D).concat(Ee);return this.applyDelta(Fe)}},{key:"update",value:function(D){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,ee=this.delta;if(W.length===1&&W[0].type==="characterData"&&W[0].target.data.match(X)&&y.default.find(W[0].target)){var te=y.default.find(W[0].target),Q=(0,S.bubbleFormats)(te),ne=te.offset(this.scroll),ue=W[0].oldValue.replace(k.default.CONTENTS,""),oe=new f.default().insert(ue),de=new f.default().insert(te.value()),Ee=new f.default().retain(ne).concat(oe.diff(de,V));D=Ee.reduce(function(Fe,Le){return Le.insert?Fe.insert(Le.insert,Q):Fe.push(Le)},new f.default),this.delta=ee.compose(D)}else this.delta=this.getDelta(),(!D||!(0,L.default)(ee.compose(D),this.delta))&&(D=ee.diff(this.delta,V));return D}}]),J})();function K(J,U){return Object.keys(U).reduce(function(D,W){return J[W]==null||(U[W]===J[W]?D[W]=U[W]:Array.isArray(U[W])?U[W].indexOf(J[W])<0&&(D[W]=U[W].concat([J[W]])):D[W]=[U[W],J[W]]),D},{})}function q(J){return J.reduce(function(U,D){if(D.insert===1){var W=(0,T.default)(D.attributes);return delete W.image,U.insert({image:D.attributes.image},W)}if(D.attributes!=null&&(D.attributes.list===!0||D.attributes.bullet===!0)&&(D=(0,T.default)(D),D.attributes.list?D.attributes.list="ordered":(D.attributes.list="bullet",delete D.attributes.bullet)),typeof D.insert=="string"){var V=D.insert.replace(/\r\n/g,`
124
+ `).replace(/\r/g,`
125
+ `);return U.insert(V,D.attributes)}return U.push(D)},new f.default)}n.default=Z}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Range=void 0;var a=(function(){function I(L,R){var N=[],F=!0,H=!1,$=void 0;try{for(var X=L[Symbol.iterator](),Z;!(F=(Z=X.next()).done)&&(N.push(Z.value),!(R&&N.length===R));F=!0);}catch(K){H=!0,$=K}finally{try{!F&&X.return&&X.return()}finally{if(H)throw $}}return N}return function(L,R){if(Array.isArray(L))return L;if(Symbol.iterator in Object(L))return I(L,R);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function I(L,R){for(var N=0;N<R.length;N++){var F=R[N];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(L,F.key,F)}}return function(L,R,N){return R&&I(L.prototype,R),N&&I(L,N),L}})(),s=i(0),u=k(s),f=i(21),d=k(f),h=i(11),p=k(h),y=i(8),v=k(y),b=i(10),x=k(b);function k(I){return I&&I.__esModule?I:{default:I}}function S(I){if(Array.isArray(I)){for(var L=0,R=Array(I.length);L<I.length;L++)R[L]=I[L];return R}else return Array.from(I)}function P(I,L){if(!(I instanceof L))throw new TypeError("Cannot call a class as a function")}var _=(0,x.default)("quill:selection"),E=function I(L){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;P(this,I),this.index=L,this.length=R},A=(function(){function I(L,R){var N=this;P(this,I),this.emitter=R,this.scroll=L,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=u.default.create("cursor",this),this.lastRange=this.savedRange=new E(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){N.mouseDown||setTimeout(N.update.bind(N,v.default.sources.USER),1)}),this.emitter.on(v.default.events.EDITOR_CHANGE,function(F,H){F===v.default.events.TEXT_CHANGE&&H.length()>0&&N.update(v.default.sources.SILENT)}),this.emitter.on(v.default.events.SCROLL_BEFORE_UPDATE,function(){if(N.hasFocus()){var F=N.getNativeRange();F!=null&&F.start.node!==N.cursor.textNode&&N.emitter.once(v.default.events.SCROLL_UPDATE,function(){try{N.setNativeRange(F.start.node,F.start.offset,F.end.node,F.end.offset)}catch{}})}}),this.emitter.on(v.default.events.SCROLL_OPTIMIZE,function(F,H){if(H.range){var $=H.range,X=$.startNode,Z=$.startOffset,K=$.endNode,q=$.endOffset;N.setNativeRange(X,Z,K,q)}}),this.update(v.default.sources.SILENT)}return o(I,[{key:"handleComposition",value:function(){var R=this;this.root.addEventListener("compositionstart",function(){R.composing=!0}),this.root.addEventListener("compositionend",function(){if(R.composing=!1,R.cursor.parent){var N=R.cursor.restore();if(!N)return;setTimeout(function(){R.setNativeRange(N.startNode,N.startOffset,N.endNode,N.endOffset)},1)}})}},{key:"handleDragging",value:function(){var R=this;this.emitter.listenDOM("mousedown",document.body,function(){R.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){R.mouseDown=!1,R.update(v.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(R,N){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[R])){this.scroll.update();var F=this.getNativeRange();if(!(F==null||!F.native.collapsed||u.default.query(R,u.default.Scope.BLOCK))){if(F.start.node!==this.cursor.textNode){var H=u.default.find(F.start.node,!1);if(H==null)return;if(H instanceof u.default.Leaf){var $=H.split(F.start.offset);H.parent.insertBefore(this.cursor,$)}else H.insertBefore(this.cursor,F.start.node);this.cursor.attach()}this.cursor.format(R,N),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(R){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F=this.scroll.length();R=Math.min(R,F-1),N=Math.min(R+N,F-1)-R;var H=void 0,$=this.scroll.leaf(R),X=a($,2),Z=X[0],K=X[1];if(Z==null)return null;var q=Z.position(K,!0),J=a(q,2);H=J[0],K=J[1];var U=document.createRange();if(N>0){U.setStart(H,K);var D=this.scroll.leaf(R+N),W=a(D,2);if(Z=W[0],K=W[1],Z==null)return null;var V=Z.position(K,!0),ee=a(V,2);return H=ee[0],K=ee[1],U.setEnd(H,K),U.getBoundingClientRect()}else{var te="left",Q=void 0;return H instanceof Text?(K<H.data.length?(U.setStart(H,K),U.setEnd(H,K+1)):(U.setStart(H,K-1),U.setEnd(H,K),te="right"),Q=U.getBoundingClientRect()):(Q=Z.domNode.getBoundingClientRect(),K>0&&(te="right")),{bottom:Q.top+Q.height,height:Q.height,left:Q[te],right:Q[te],top:Q.top,width:0}}}},{key:"getNativeRange",value:function(){var R=document.getSelection();if(R==null||R.rangeCount<=0)return null;var N=R.getRangeAt(0);if(N==null)return null;var F=this.normalizeNative(N);return _.info("getNativeRange",F),F}},{key:"getRange",value:function(){var R=this.getNativeRange();if(R==null)return[null,null];var N=this.normalizedToRange(R);return[N,R]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(R){var N=this,F=[[R.start.node,R.start.offset]];R.native.collapsed||F.push([R.end.node,R.end.offset]);var H=F.map(function(Z){var K=a(Z,2),q=K[0],J=K[1],U=u.default.find(q,!0),D=U.offset(N.scroll);return J===0?D:U instanceof u.default.Container?D+U.length():D+U.index(q,J)}),$=Math.min(Math.max.apply(Math,S(H)),this.scroll.length()-1),X=Math.min.apply(Math,[$].concat(S(H)));return new E(X,$-X)}},{key:"normalizeNative",value:function(R){if(!T(this.root,R.startContainer)||!R.collapsed&&!T(this.root,R.endContainer))return null;var N={start:{node:R.startContainer,offset:R.startOffset},end:{node:R.endContainer,offset:R.endOffset},native:R};return[N.start,N.end].forEach(function(F){for(var H=F.node,$=F.offset;!(H instanceof Text)&&H.childNodes.length>0;)if(H.childNodes.length>$)H=H.childNodes[$],$=0;else if(H.childNodes.length===$)H=H.lastChild,$=H instanceof Text?H.data.length:H.childNodes.length+1;else break;F.node=H,F.offset=$}),N}},{key:"rangeToNative",value:function(R){var N=this,F=R.collapsed?[R.index]:[R.index,R.index+R.length],H=[],$=this.scroll.length();return F.forEach(function(X,Z){X=Math.min($-1,X);var K=void 0,q=N.scroll.leaf(X),J=a(q,2),U=J[0],D=J[1],W=U.position(D,Z!==0),V=a(W,2);K=V[0],D=V[1],H.push(K,D)}),H.length<2&&(H=H.concat(H)),H}},{key:"scrollIntoView",value:function(R){var N=this.lastRange;if(N!=null){var F=this.getBounds(N.index,N.length);if(F!=null){var H=this.scroll.length()-1,$=this.scroll.line(Math.min(N.index,H)),X=a($,1),Z=X[0],K=Z;if(N.length>0){var q=this.scroll.line(Math.min(N.index+N.length,H)),J=a(q,1);K=J[0]}if(!(Z==null||K==null)){var U=R.getBoundingClientRect();F.top<U.top?R.scrollTop-=U.top-F.top:F.bottom>U.bottom&&(R.scrollTop+=F.bottom-U.bottom)}}}}},{key:"setNativeRange",value:function(R,N){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:R,H=arguments.length>3&&arguments[3]!==void 0?arguments[3]:N,$=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(_.info("setNativeRange",R,N,F,H),!(R!=null&&(this.root.parentNode==null||R.parentNode==null||F.parentNode==null))){var X=document.getSelection();if(X!=null)if(R!=null){this.hasFocus()||this.root.focus();var Z=(this.getNativeRange()||{}).native;if(Z==null||$||R!==Z.startContainer||N!==Z.startOffset||F!==Z.endContainer||H!==Z.endOffset){R.tagName=="BR"&&(N=[].indexOf.call(R.parentNode.childNodes,R),R=R.parentNode),F.tagName=="BR"&&(H=[].indexOf.call(F.parentNode.childNodes,F),F=F.parentNode);var K=document.createRange();K.setStart(R,N),K.setEnd(F,H),X.removeAllRanges(),X.addRange(K)}}else X.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(R){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v.default.sources.API;if(typeof N=="string"&&(F=N,N=!1),_.info("setRange",R),R!=null){var H=this.rangeToNative(R);this.setNativeRange.apply(this,S(H).concat([N]))}else this.setNativeRange(null);this.update(F)}},{key:"update",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v.default.sources.USER,N=this.lastRange,F=this.getRange(),H=a(F,2),$=H[0],X=H[1];if(this.lastRange=$,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,p.default)(N,this.lastRange)){var Z;!this.composing&&X!=null&&X.native.collapsed&&X.start.node!==this.cursor.textNode&&this.cursor.restore();var K=[v.default.events.SELECTION_CHANGE,(0,d.default)(this.lastRange),(0,d.default)(N),R];if((Z=this.emitter).emit.apply(Z,[v.default.events.EDITOR_CHANGE].concat(K)),R!==v.default.sources.SILENT){var q;(q=this.emitter).emit.apply(q,K)}}}}]),I})();function T(I,L){try{L.parentNode}catch{return!1}return L instanceof Text&&(L=L.parentNode),I.contains(L)}n.Range=E,n.default=A}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(b,x){for(var k=0;k<x.length;k++){var S=x[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,x,k){return x&&v(b.prototype,x),k&&v(b,k),b}})(),o=function v(b,x,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,x);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,x,k)}else{if("value"in S)return S.value;var _=S.get;return _===void 0?void 0:_.call(k)}},s=i(0),u=f(s);function f(v){return v&&v.__esModule?v:{default:v}}function d(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function h(v,b){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:v}function p(v,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);v.prototype=Object.create(b&&b.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(v,b):v.__proto__=b)}var y=(function(v){p(b,v);function b(){return d(this,b),h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return a(b,[{key:"insertInto",value:function(k,S){k.children.length===0?o(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"insertInto",this).call(this,k,S):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),b})(u.default.Embed);y.blotName="break",y.tagName="BR",n.default=y}),(function(r,n,i){var a=this&&this.__extends||(function(){var h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,y){p.__proto__=y}||function(p,y){for(var v in y)y.hasOwnProperty(v)&&(p[v]=y[v])};return function(p,y){h(p,y);function v(){this.constructor=p}p.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(44),s=i(30),u=i(1),f=(function(h){a(p,h);function p(y){var v=h.call(this,y)||this;return v.build(),v}return p.prototype.appendChild=function(y){this.insertBefore(y)},p.prototype.attach=function(){h.prototype.attach.call(this),this.children.forEach(function(y){y.attach()})},p.prototype.build=function(){var y=this;this.children=new o.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(v){try{var b=d(v);y.insertBefore(b,y.children.head||void 0)}catch(x){if(x instanceof u.ParchmentError)return;throw x}})},p.prototype.deleteAt=function(y,v){if(y===0&&v===this.length())return this.remove();this.children.forEachAt(y,v,function(b,x,k){b.deleteAt(x,k)})},p.prototype.descendant=function(y,v){var b=this.children.find(v),x=b[0],k=b[1];return y.blotName==null&&y(x)||y.blotName!=null&&x instanceof y?[x,k]:x instanceof p?x.descendant(y,k):[null,-1]},p.prototype.descendants=function(y,v,b){v===void 0&&(v=0),b===void 0&&(b=Number.MAX_VALUE);var x=[],k=b;return this.children.forEachAt(v,b,function(S,P,_){(y.blotName==null&&y(S)||y.blotName!=null&&S instanceof y)&&x.push(S),S instanceof p&&(x=x.concat(S.descendants(y,P,k))),k-=_}),x},p.prototype.detach=function(){this.children.forEach(function(y){y.detach()}),h.prototype.detach.call(this)},p.prototype.formatAt=function(y,v,b,x){this.children.forEachAt(y,v,function(k,S,P){k.formatAt(S,P,b,x)})},p.prototype.insertAt=function(y,v,b){var x=this.children.find(y),k=x[0],S=x[1];if(k)k.insertAt(S,v,b);else{var P=b==null?u.create("text",v):u.create(v,b);this.appendChild(P)}},p.prototype.insertBefore=function(y,v){if(this.statics.allowedChildren!=null&&!this.statics.allowedChildren.some(function(b){return y instanceof b}))throw new u.ParchmentError("Cannot insert "+y.statics.blotName+" into "+this.statics.blotName);y.insertInto(this,v)},p.prototype.length=function(){return this.children.reduce(function(y,v){return y+v.length()},0)},p.prototype.moveChildren=function(y,v){this.children.forEach(function(b){y.insertBefore(b,v)})},p.prototype.optimize=function(y){if(h.prototype.optimize.call(this,y),this.children.length===0)if(this.statics.defaultChild!=null){var v=u.create(this.statics.defaultChild);this.appendChild(v),v.optimize(y)}else this.remove()},p.prototype.path=function(y,v){v===void 0&&(v=!1);var b=this.children.find(y,v),x=b[0],k=b[1],S=[[this,y]];return x instanceof p?S.concat(x.path(k,v)):(x!=null&&S.push([x,k]),S)},p.prototype.removeChild=function(y){this.children.remove(y)},p.prototype.replace=function(y){y instanceof p&&y.moveChildren(this),h.prototype.replace.call(this,y)},p.prototype.split=function(y,v){if(v===void 0&&(v=!1),!v){if(y===0)return this;if(y===this.length())return this.next}var b=this.clone();return this.parent.insertBefore(b,this.next),this.children.forEachAt(y,this.length(),function(x,k,S){x=x.split(k,v),b.appendChild(x)}),b},p.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},p.prototype.update=function(y,v){var b=this,x=[],k=[];y.forEach(function(S){S.target===b.domNode&&S.type==="childList"&&(x.push.apply(x,S.addedNodes),k.push.apply(k,S.removedNodes))}),k.forEach(function(S){if(!(S.parentNode!=null&&S.tagName!=="IFRAME"&&document.body.compareDocumentPosition(S)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var P=u.find(S);P!=null&&(P.domNode.parentNode==null||P.domNode.parentNode===b.domNode)&&P.detach()}}),x.filter(function(S){return S.parentNode==b.domNode}).sort(function(S,P){return S===P?0:S.compareDocumentPosition(P)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(S){var P=null;S.nextSibling!=null&&(P=u.find(S.nextSibling));var _=d(S);(_.next!=P||_.next==null)&&(_.parent!=null&&_.parent.removeChild(b),b.insertBefore(_,P||void 0))})},p})(s.default);function d(h){var p=u.find(h);if(p==null)try{p=u.create(h)}catch{p=u.create(u.Scope.INLINE),[].slice.call(h.childNodes).forEach(function(v){p.domNode.appendChild(v)}),h.parentNode&&h.parentNode.replaceChild(p.domNode,h),p.attach()}return p}n.default=f}),(function(r,n,i){var a=this&&this.__extends||(function(){var h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,y){p.__proto__=y}||function(p,y){for(var v in y)y.hasOwnProperty(v)&&(p[v]=y[v])};return function(p,y){h(p,y);function v(){this.constructor=p}p.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(12),s=i(31),u=i(17),f=i(1),d=(function(h){a(p,h);function p(y){var v=h.call(this,y)||this;return v.attributes=new s.default(v.domNode),v}return p.formats=function(y){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return y.tagName.toLowerCase()},p.prototype.format=function(y,v){var b=f.query(y);b instanceof o.default?this.attributes.attribute(b,v):v&&b!=null&&(y!==this.statics.blotName||this.formats()[y]!==v)&&this.replaceWith(y,v)},p.prototype.formats=function(){var y=this.attributes.values(),v=this.statics.formats(this.domNode);return v!=null&&(y[this.statics.blotName]=v),y},p.prototype.replaceWith=function(y,v){var b=h.prototype.replaceWith.call(this,y,v);return this.attributes.copy(b),b},p.prototype.update=function(y,v){var b=this;h.prototype.update.call(this,y,v),y.some(function(x){return x.target===b.domNode&&x.type==="attributes"})&&this.attributes.build()},p.prototype.wrap=function(y,v){var b=h.prototype.wrap.call(this,y,v);return b instanceof p&&b.statics.scope===this.statics.scope&&this.attributes.move(b),b},p})(u.default);n.default=d}),(function(r,n,i){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,h){d.__proto__=h}||function(d,h){for(var p in h)h.hasOwnProperty(p)&&(d[p]=h[p])};return function(d,h){f(d,h);function p(){this.constructor=d}d.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(30),s=i(1),u=(function(f){a(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.value=function(h){return!0},d.prototype.index=function(h,p){return this.domNode===h||this.domNode.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(p,1):-1},d.prototype.position=function(h,p){var y=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return h>0&&(y+=1),[this.parent.domNode,y]},d.prototype.value=function(){var h;return h={},h[this.statics.blotName]=this.statics.value(this.domNode)||!0,h},d.scope=s.Scope.INLINE_BLOT,d})(o.default);n.default=u}),(function(r,n,i){var a=i(11),o=i(3),s={attributes:{compose:function(f,d,h){typeof f!="object"&&(f={}),typeof d!="object"&&(d={});var p=o(!0,{},d);h||(p=Object.keys(p).reduce(function(v,b){return p[b]!=null&&(v[b]=p[b]),v},{}));for(var y in f)f[y]!==void 0&&d[y]===void 0&&(p[y]=f[y]);return Object.keys(p).length>0?p:void 0},diff:function(f,d){typeof f!="object"&&(f={}),typeof d!="object"&&(d={});var h=Object.keys(f).concat(Object.keys(d)).reduce(function(p,y){return a(f[y],d[y])||(p[y]=d[y]===void 0?null:d[y]),p},{});return Object.keys(h).length>0?h:void 0},transform:function(f,d,h){if(typeof f!="object")return d;if(typeof d=="object"){if(!h)return d;var p=Object.keys(d).reduce(function(y,v){return f[v]===void 0&&(y[v]=d[v]),y},{});return Object.keys(p).length>0?p:void 0}}},iterator:function(f){return new u(f)},length:function(f){return typeof f.delete=="number"?f.delete:typeof f.retain=="number"?f.retain:typeof f.insert=="string"?f.insert.length:1}};function u(f){this.ops=f,this.index=0,this.offset=0}u.prototype.hasNext=function(){return this.peekLength()<1/0},u.prototype.next=function(f){f||(f=1/0);var d=this.ops[this.index];if(d){var h=this.offset,p=s.length(d);if(f>=p-h?(f=p-h,this.index+=1,this.offset=0):this.offset+=f,typeof d.delete=="number")return{delete:f};var y={};return d.attributes&&(y.attributes=d.attributes),typeof d.retain=="number"?y.retain=f:typeof d.insert=="string"?y.insert=d.insert.substr(h,f):y.insert=d.insert,y}else return{retain:1/0}},u.prototype.peek=function(){return this.ops[this.index]},u.prototype.peekLength=function(){return this.ops[this.index]?s.length(this.ops[this.index])-this.offset:1/0},u.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},u.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var f=this.offset,d=this.index,h=this.next(),p=this.ops.slice(this.index);return this.offset=f,this.index=d,[h].concat(p)}else return[]},r.exports=s}),(function(r,n){var i=(function(){function a(b,x){return x!=null&&b instanceof x}var o;try{o=Map}catch{o=function(){}}var s;try{s=Set}catch{s=function(){}}var u;try{u=Promise}catch{u=function(){}}function f(b,x,k,S,P){typeof x=="object"&&(k=x.depth,S=x.prototype,P=x.includeNonEnumerable,x=x.circular);var _=[],E=[],A=typeof Buffer<"u";typeof x>"u"&&(x=!0),typeof k>"u"&&(k=1/0);function T(I,L){if(I===null)return null;if(L===0)return I;var R,N;if(typeof I!="object")return I;if(a(I,o))R=new o;else if(a(I,s))R=new s;else if(a(I,u))R=new u(function(U,D){I.then(function(W){U(T(W,L-1))},function(W){D(T(W,L-1))})});else if(f.__isArray(I))R=[];else if(f.__isRegExp(I))R=new RegExp(I.source,v(I)),I.lastIndex&&(R.lastIndex=I.lastIndex);else if(f.__isDate(I))R=new Date(I.getTime());else{if(A&&Buffer.isBuffer(I))return Buffer.allocUnsafe?R=Buffer.allocUnsafe(I.length):R=new Buffer(I.length),I.copy(R),R;a(I,Error)?R=Object.create(I):typeof S>"u"?(N=Object.getPrototypeOf(I),R=Object.create(N)):(R=Object.create(S),N=S)}if(x){var F=_.indexOf(I);if(F!=-1)return E[F];_.push(I),E.push(R)}a(I,o)&&I.forEach(function(U,D){var W=T(D,L-1),V=T(U,L-1);R.set(W,V)}),a(I,s)&&I.forEach(function(U){var D=T(U,L-1);R.add(D)});for(var H in I){var $;N&&($=Object.getOwnPropertyDescriptor(N,H)),!($&&$.set==null)&&(R[H]=T(I[H],L-1))}if(Object.getOwnPropertySymbols)for(var X=Object.getOwnPropertySymbols(I),H=0;H<X.length;H++){var Z=X[H],K=Object.getOwnPropertyDescriptor(I,Z);K&&!K.enumerable&&!P||(R[Z]=T(I[Z],L-1),K.enumerable||Object.defineProperty(R,Z,{enumerable:!1}))}if(P)for(var q=Object.getOwnPropertyNames(I),H=0;H<q.length;H++){var J=q[H],K=Object.getOwnPropertyDescriptor(I,J);K&&K.enumerable||(R[J]=T(I[J],L-1),Object.defineProperty(R,J,{enumerable:!1}))}return R}return T(b,k)}f.clonePrototype=function(x){if(x===null)return null;var k=function(){};return k.prototype=x,new k};function d(b){return Object.prototype.toString.call(b)}f.__objToStr=d;function h(b){return typeof b=="object"&&d(b)==="[object Date]"}f.__isDate=h;function p(b){return typeof b=="object"&&d(b)==="[object Array]"}f.__isArray=p;function y(b){return typeof b=="object"&&d(b)==="[object RegExp]"}f.__isRegExp=y;function v(b){var x="";return b.global&&(x+="g"),b.ignoreCase&&(x+="i"),b.multiline&&(x+="m"),x}return f.__getRegExpFlags=v,f})();typeof r=="object"&&r.exports&&(r.exports=i)}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function R(N,F){var H=[],$=!0,X=!1,Z=void 0;try{for(var K=N[Symbol.iterator](),q;!($=(q=K.next()).done)&&(H.push(q.value),!(F&&H.length===F));$=!0);}catch(J){X=!0,Z=J}finally{try{!$&&K.return&&K.return()}finally{if(X)throw Z}}return H}return function(N,F){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return R(N,F);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function R(N,F){for(var H=0;H<F.length;H++){var $=F[H];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(N,$.key,$)}}return function(N,F,H){return F&&R(N.prototype,F),H&&R(N,H),N}})(),s=function R(N,F,H){N===null&&(N=Function.prototype);var $=Object.getOwnPropertyDescriptor(N,F);if($===void 0){var X=Object.getPrototypeOf(N);return X===null?void 0:R(X,F,H)}else{if("value"in $)return $.value;var Z=$.get;return Z===void 0?void 0:Z.call(H)}},u=i(0),f=_(u),d=i(8),h=_(d),p=i(4),y=_(p),v=i(16),b=_(v),x=i(13),k=_(x),S=i(25),P=_(S);function _(R){return R&&R.__esModule?R:{default:R}}function E(R,N){if(!(R instanceof N))throw new TypeError("Cannot call a class as a function")}function A(R,N){if(!R)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return N&&(typeof N=="object"||typeof N=="function")?N:R}function T(R,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);R.prototype=Object.create(N&&N.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(R,N):R.__proto__=N)}function I(R){return R instanceof y.default||R instanceof p.BlockEmbed}var L=(function(R){T(N,R);function N(F,H){E(this,N);var $=A(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,F));return $.emitter=H.emitter,Array.isArray(H.whitelist)&&($.whitelist=H.whitelist.reduce(function(X,Z){return X[Z]=!0,X},{})),$.domNode.addEventListener("DOMNodeInserted",function(){}),$.optimize(),$.enable(),$}return o(N,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(H,$){var X=this.line(H),Z=a(X,2),K=Z[0],q=Z[1],J=this.line(H+$),U=a(J,1),D=U[0];if(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"deleteAt",this).call(this,H,$),D!=null&&K!==D&&q>0){if(K instanceof p.BlockEmbed||D instanceof p.BlockEmbed){this.optimize();return}if(K instanceof k.default){var W=K.newlineIndex(K.length(),!0);if(W>-1&&(K=K.split(W+1),K===D)){this.optimize();return}}else if(D instanceof k.default){var V=D.newlineIndex(0);V>-1&&D.split(V+1)}var ee=D.children.head instanceof b.default?null:D.children.head;K.moveChildren(D,ee),K.remove()}this.optimize()}},{key:"enable",value:function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",H)}},{key:"formatAt",value:function(H,$,X,Z){this.whitelist!=null&&!this.whitelist[X]||(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"formatAt",this).call(this,H,$,X,Z),this.optimize())}},{key:"insertAt",value:function(H,$,X){if(!(X!=null&&this.whitelist!=null&&!this.whitelist[$])){if(H>=this.length())if(X==null||f.default.query($,f.default.Scope.BLOCK)==null){var Z=f.default.create(this.statics.defaultChild);this.appendChild(Z),X==null&&$.endsWith(`
126
+ `)&&($=$.slice(0,-1)),Z.insertAt(0,$,X)}else{var K=f.default.create($,X);this.appendChild(K)}else s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"insertAt",this).call(this,H,$,X);this.optimize()}}},{key:"insertBefore",value:function(H,$){if(H.statics.scope===f.default.Scope.INLINE_BLOT){var X=f.default.create(this.statics.defaultChild);X.appendChild(H),H=X}s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"insertBefore",this).call(this,H,$)}},{key:"leaf",value:function(H){return this.path(H).pop()||[null,-1]}},{key:"line",value:function(H){return H===this.length()?this.line(H-1):this.descendant(I,H)}},{key:"lines",value:function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,X=function Z(K,q,J){var U=[],D=J;return K.children.forEachAt(q,J,function(W,V,ee){I(W)?U.push(W):W instanceof f.default.Container&&(U=U.concat(Z(W,V,D))),D-=ee}),U};return X(this,H,$)}},{key:"optimize",value:function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"optimize",this).call(this,H,$),H.length>0&&this.emitter.emit(h.default.events.SCROLL_OPTIMIZE,H,$))}},{key:"path",value:function(H){return s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"path",this).call(this,H).slice(1)}},{key:"update",value:function(H){if(this.batch!==!0){var $=h.default.sources.USER;typeof H=="string"&&($=H),Array.isArray(H)||(H=this.observer.takeRecords()),H.length>0&&this.emitter.emit(h.default.events.SCROLL_BEFORE_UPDATE,$,H),s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"update",this).call(this,H.concat([])),H.length>0&&this.emitter.emit(h.default.events.SCROLL_UPDATE,$,H)}}}]),N})(f.default.Scroll);L.blotName="scroll",L.className="ql-editor",L.tagName="DIV",L.defaultChild="block",L.allowedChildren=[y.default,p.BlockEmbed,P.default],n.default=L}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SHORTKEY=n.default=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},o=(function(){function Q(ne,ue){var oe=[],de=!0,Ee=!1,Fe=void 0;try{for(var Le=ne[Symbol.iterator](),$e;!(de=($e=Le.next()).done)&&(oe.push($e.value),!(ue&&oe.length===ue));de=!0);}catch(Xe){Ee=!0,Fe=Xe}finally{try{!de&&Le.return&&Le.return()}finally{if(Ee)throw Fe}}return oe}return function(ne,ue){if(Array.isArray(ne))return ne;if(Symbol.iterator in Object(ne))return Q(ne,ue);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function Q(ne,ue){for(var oe=0;oe<ue.length;oe++){var de=ue[oe];de.enumerable=de.enumerable||!1,de.configurable=!0,"value"in de&&(de.writable=!0),Object.defineProperty(ne,de.key,de)}}return function(ne,ue,oe){return ue&&Q(ne.prototype,ue),oe&&Q(ne,oe),ne}})(),u=i(21),f=R(u),d=i(11),h=R(d),p=i(3),y=R(p),v=i(2),b=R(v),x=i(20),k=R(x),S=i(0),P=R(S),_=i(5),E=R(_),A=i(10),T=R(A),I=i(9),L=R(I);function R(Q){return Q&&Q.__esModule?Q:{default:Q}}function N(Q,ne,ue){return ne in Q?Object.defineProperty(Q,ne,{value:ue,enumerable:!0,configurable:!0,writable:!0}):Q[ne]=ue,Q}function F(Q,ne){if(!(Q instanceof ne))throw new TypeError("Cannot call a class as a function")}function H(Q,ne){if(!Q)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ne&&(typeof ne=="object"||typeof ne=="function")?ne:Q}function $(Q,ne){if(typeof ne!="function"&&ne!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ne);Q.prototype=Object.create(ne&&ne.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}}),ne&&(Object.setPrototypeOf?Object.setPrototypeOf(Q,ne):Q.__proto__=ne)}var X=(0,T.default)("quill:keyboard"),Z=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",K=(function(Q){$(ne,Q),s(ne,null,[{key:"match",value:function(oe,de){return de=te(de),["altKey","ctrlKey","metaKey","shiftKey"].some(function(Ee){return!!de[Ee]!==oe[Ee]&&de[Ee]!==null})?!1:de.key===(oe.which||oe.keyCode)}}]);function ne(ue,oe){F(this,ne);var de=H(this,(ne.__proto__||Object.getPrototypeOf(ne)).call(this,ue,oe));return de.bindings={},Object.keys(de.options.bindings).forEach(function(Ee){Ee==="list autofill"&&ue.scroll.whitelist!=null&&!ue.scroll.whitelist.list||de.options.bindings[Ee]&&de.addBinding(de.options.bindings[Ee])}),de.addBinding({key:ne.keys.ENTER,shiftKey:null},W),de.addBinding({key:ne.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(de.addBinding({key:ne.keys.BACKSPACE},{collapsed:!0},J),de.addBinding({key:ne.keys.DELETE},{collapsed:!0},U)):(de.addBinding({key:ne.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},J),de.addBinding({key:ne.keys.DELETE},{collapsed:!0,suffix:/^.?$/},U)),de.addBinding({key:ne.keys.BACKSPACE},{collapsed:!1},D),de.addBinding({key:ne.keys.DELETE},{collapsed:!1},D),de.addBinding({key:ne.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},J),de.listen(),de}return s(ne,[{key:"addBinding",value:function(oe){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Fe=te(oe);if(Fe==null||Fe.key==null)return X.warn("Attempted to add invalid keyboard binding",Fe);typeof de=="function"&&(de={handler:de}),typeof Ee=="function"&&(Ee={handler:Ee}),Fe=(0,y.default)(Fe,de,Ee),this.bindings[Fe.key]=this.bindings[Fe.key]||[],this.bindings[Fe.key].push(Fe)}},{key:"listen",value:function(){var oe=this;this.quill.root.addEventListener("keydown",function(de){if(!de.defaultPrevented){var Ee=de.which||de.keyCode,Fe=(oe.bindings[Ee]||[]).filter(function(le){return ne.match(de,le)});if(Fe.length!==0){var Le=oe.quill.getSelection();if(!(Le==null||!oe.quill.hasFocus())){var $e=oe.quill.getLine(Le.index),Xe=o($e,2),dt=Xe[0],ke=Xe[1],ge=oe.quill.getLeaf(Le.index),se=o(ge,2),me=se[0],Te=se[1],ae=Le.length===0?[me,Te]:oe.quill.getLeaf(Le.index+Le.length),xe=o(ae,2),Oe=xe[0],Be=xe[1],ct=me instanceof P.default.Text?me.value().slice(0,Te):"",be=Oe instanceof P.default.Text?Oe.value().slice(Be):"",he={collapsed:Le.length===0,empty:Le.length===0&&dt.length()<=1,format:oe.quill.getFormat(Le),offset:ke,prefix:ct,suffix:be},Ve=Fe.some(function(le){if(le.collapsed!=null&&le.collapsed!==he.collapsed||le.empty!=null&&le.empty!==he.empty||le.offset!=null&&le.offset!==he.offset)return!1;if(Array.isArray(le.format)){if(le.format.every(function(Ie){return he.format[Ie]==null}))return!1}else if(a(le.format)==="object"&&!Object.keys(le.format).every(function(Ie){return le.format[Ie]===!0?he.format[Ie]!=null:le.format[Ie]===!1?he.format[Ie]==null:(0,h.default)(le.format[Ie],he.format[Ie])}))return!1;return le.prefix!=null&&!le.prefix.test(he.prefix)||le.suffix!=null&&!le.suffix.test(he.suffix)?!1:le.handler.call(oe,Le,he)!==!0});Ve&&de.preventDefault()}}}})}}]),ne})(L.default);K.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},K.DEFAULTS={bindings:{bold:ee("bold"),italic:ee("italic"),underline:ee("underline"),indent:{key:K.keys.TAB,format:["blockquote","indent","list"],handler:function(ne,ue){if(ue.collapsed&&ue.offset!==0)return!0;this.quill.format("indent","+1",E.default.sources.USER)}},outdent:{key:K.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(ne,ue){if(ue.collapsed&&ue.offset!==0)return!0;this.quill.format("indent","-1",E.default.sources.USER)}},"outdent backspace":{key:K.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(ne,ue){ue.format.indent!=null?this.quill.format("indent","-1",E.default.sources.USER):ue.format.list!=null&&this.quill.format("list",!1,E.default.sources.USER)}},"indent code-block":V(!0),"outdent code-block":V(!1),"remove tab":{key:K.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(ne){this.quill.deleteText(ne.index-1,1,E.default.sources.USER)}},tab:{key:K.keys.TAB,handler:function(ne){this.quill.history.cutoff();var ue=new b.default().retain(ne.index).delete(ne.length).insert(" ");this.quill.updateContents(ue,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(ne.index+1,E.default.sources.SILENT)}},"list empty enter":{key:K.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(ne,ue){this.quill.format("list",!1,E.default.sources.USER),ue.format.indent&&this.quill.format("indent",!1,E.default.sources.USER)}},"checklist enter":{key:K.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(ne){var ue=this.quill.getLine(ne.index),oe=o(ue,2),de=oe[0],Ee=oe[1],Fe=(0,y.default)({},de.formats(),{list:"checked"}),Le=new b.default().retain(ne.index).insert(`
127
+ `,Fe).retain(de.length()-Ee-1).retain(1,{list:"unchecked"});this.quill.updateContents(Le,E.default.sources.USER),this.quill.setSelection(ne.index+1,E.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:K.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(ne,ue){var oe=this.quill.getLine(ne.index),de=o(oe,2),Ee=de[0],Fe=de[1],Le=new b.default().retain(ne.index).insert(`
128
+ `,ue.format).retain(Ee.length()-Fe-1).retain(1,{header:null});this.quill.updateContents(Le,E.default.sources.USER),this.quill.setSelection(ne.index+1,E.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(ne,ue){var oe=ue.prefix.length,de=this.quill.getLine(ne.index),Ee=o(de,2),Fe=Ee[0],Le=Ee[1];if(Le>oe)return!0;var $e=void 0;switch(ue.prefix.trim()){case"[]":case"[ ]":$e="unchecked";break;case"[x]":$e="checked";break;case"-":case"*":$e="bullet";break;default:$e="ordered"}this.quill.insertText(ne.index," ",E.default.sources.USER),this.quill.history.cutoff();var Xe=new b.default().retain(ne.index-Le).delete(oe+1).retain(Fe.length()-2-Le).retain(1,{list:$e});this.quill.updateContents(Xe,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(ne.index-oe,E.default.sources.SILENT)}},"code exit":{key:K.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(ne){var ue=this.quill.getLine(ne.index),oe=o(ue,2),de=oe[0],Ee=oe[1],Fe=new b.default().retain(ne.index+de.length()-Ee-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(Fe,E.default.sources.USER)}},"embed left":q(K.keys.LEFT,!1),"embed left shift":q(K.keys.LEFT,!0),"embed right":q(K.keys.RIGHT,!1),"embed right shift":q(K.keys.RIGHT,!0)}};function q(Q,ne){var ue,oe=Q===K.keys.LEFT?"prefix":"suffix";return ue={key:Q,shiftKey:ne,altKey:null},N(ue,oe,/^$/),N(ue,"handler",function(Ee){var Fe=Ee.index;Q===K.keys.RIGHT&&(Fe+=Ee.length+1);var Le=this.quill.getLeaf(Fe),$e=o(Le,1),Xe=$e[0];return Xe instanceof P.default.Embed?(Q===K.keys.LEFT?ne?this.quill.setSelection(Ee.index-1,Ee.length+1,E.default.sources.USER):this.quill.setSelection(Ee.index-1,E.default.sources.USER):ne?this.quill.setSelection(Ee.index,Ee.length+1,E.default.sources.USER):this.quill.setSelection(Ee.index+Ee.length+1,E.default.sources.USER),!1):!0}),ue}function J(Q,ne){if(!(Q.index===0||this.quill.getLength()<=1)){var ue=this.quill.getLine(Q.index),oe=o(ue,1),de=oe[0],Ee={};if(ne.offset===0){var Fe=this.quill.getLine(Q.index-1),Le=o(Fe,1),$e=Le[0];if($e!=null&&$e.length()>1){var Xe=de.formats(),dt=this.quill.getFormat(Q.index-1,1);Ee=k.default.attributes.diff(Xe,dt)||{}}}var ke=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(ne.prefix)?2:1;this.quill.deleteText(Q.index-ke,ke,E.default.sources.USER),Object.keys(Ee).length>0&&this.quill.formatLine(Q.index-ke,ke,Ee,E.default.sources.USER),this.quill.focus()}}function U(Q,ne){var ue=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(ne.suffix)?2:1;if(!(Q.index>=this.quill.getLength()-ue)){var oe={},de=0,Ee=this.quill.getLine(Q.index),Fe=o(Ee,1),Le=Fe[0];if(ne.offset>=Le.length()-1){var $e=this.quill.getLine(Q.index+1),Xe=o($e,1),dt=Xe[0];if(dt){var ke=Le.formats(),ge=this.quill.getFormat(Q.index,1);oe=k.default.attributes.diff(ke,ge)||{},de=dt.length()}}this.quill.deleteText(Q.index,ue,E.default.sources.USER),Object.keys(oe).length>0&&this.quill.formatLine(Q.index+de-1,ue,oe,E.default.sources.USER)}}function D(Q){var ne=this.quill.getLines(Q),ue={};if(ne.length>1){var oe=ne[0].formats(),de=ne[ne.length-1].formats();ue=k.default.attributes.diff(de,oe)||{}}this.quill.deleteText(Q,E.default.sources.USER),Object.keys(ue).length>0&&this.quill.formatLine(Q.index,1,ue,E.default.sources.USER),this.quill.setSelection(Q.index,E.default.sources.SILENT),this.quill.focus()}function W(Q,ne){var ue=this;Q.length>0&&this.quill.scroll.deleteAt(Q.index,Q.length);var oe=Object.keys(ne.format).reduce(function(de,Ee){return P.default.query(Ee,P.default.Scope.BLOCK)&&!Array.isArray(ne.format[Ee])&&(de[Ee]=ne.format[Ee]),de},{});this.quill.insertText(Q.index,`
129
+ `,oe,E.default.sources.USER),this.quill.setSelection(Q.index+1,E.default.sources.SILENT),this.quill.focus(),Object.keys(ne.format).forEach(function(de){oe[de]==null&&(Array.isArray(ne.format[de])||de!=="link"&&ue.quill.format(de,ne.format[de],E.default.sources.USER))})}function V(Q){return{key:K.keys.TAB,shiftKey:!Q,format:{"code-block":!0},handler:function(ue){var oe=P.default.query("code-block"),de=ue.index,Ee=ue.length,Fe=this.quill.scroll.descendant(oe,de),Le=o(Fe,2),$e=Le[0],Xe=Le[1];if($e!=null){var dt=this.quill.getIndex($e),ke=$e.newlineIndex(Xe,!0)+1,ge=$e.newlineIndex(dt+Xe+Ee),se=$e.domNode.textContent.slice(ke,ge).split(`
130
+ `);Xe=0,se.forEach(function(me,Te){Q?($e.insertAt(ke+Xe,oe.TAB),Xe+=oe.TAB.length,Te===0?de+=oe.TAB.length:Ee+=oe.TAB.length):me.startsWith(oe.TAB)&&($e.deleteAt(ke+Xe,oe.TAB.length),Xe-=oe.TAB.length,Te===0?de-=oe.TAB.length:Ee-=oe.TAB.length),Xe+=me.length+1}),this.quill.update(E.default.sources.USER),this.quill.setSelection(de,Ee,E.default.sources.SILENT)}}}}function ee(Q){return{key:Q[0].toUpperCase(),shortKey:!0,handler:function(ue,oe){this.quill.format(Q,!oe.format[Q],E.default.sources.USER)}}}function te(Q){if(typeof Q=="string"||typeof Q=="number")return te({key:Q});if((typeof Q>"u"?"undefined":a(Q))==="object"&&(Q=(0,f.default)(Q,!1)),typeof Q.key=="string")if(K.keys[Q.key.toUpperCase()]!=null)Q.key=K.keys[Q.key.toUpperCase()];else if(Q.key.length===1)Q.key=Q.key.toUpperCase().charCodeAt(0);else return null;return Q.shortKey&&(Q[Z]=Q.shortKey,delete Q.shortKey),Q}n.default=K,n.SHORTKEY=Z}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function k(S,P){var _=[],E=!0,A=!1,T=void 0;try{for(var I=S[Symbol.iterator](),L;!(E=(L=I.next()).done)&&(_.push(L.value),!(P&&_.length===P));E=!0);}catch(R){A=!0,T=R}finally{try{!E&&I.return&&I.return()}finally{if(A)throw T}}return _}return function(S,P){if(Array.isArray(S))return S;if(Symbol.iterator in Object(S))return k(S,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=function k(S,P,_){S===null&&(S=Function.prototype);var E=Object.getOwnPropertyDescriptor(S,P);if(E===void 0){var A=Object.getPrototypeOf(S);return A===null?void 0:k(A,P,_)}else{if("value"in E)return E.value;var T=E.get;return T===void 0?void 0:T.call(_)}},s=(function(){function k(S,P){for(var _=0;_<P.length;_++){var E=P[_];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(S,E.key,E)}}return function(S,P,_){return P&&k(S.prototype,P),_&&k(S,_),S}})(),u=i(0),f=p(u),d=i(7),h=p(d);function p(k){return k&&k.__esModule?k:{default:k}}function y(k,S){if(!(k instanceof S))throw new TypeError("Cannot call a class as a function")}function v(k,S){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:k}function b(k,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);k.prototype=Object.create(S&&S.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(k,S):k.__proto__=S)}var x=(function(k){b(S,k),s(S,null,[{key:"value",value:function(){}}]);function S(P,_){y(this,S);var E=v(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,P));return E.selection=_,E.textNode=document.createTextNode(S.CONTENTS),E.domNode.appendChild(E.textNode),E._length=0,E}return s(S,[{key:"detach",value:function(){this.parent!=null&&this.parent.removeChild(this)}},{key:"format",value:function(_,E){if(this._length!==0)return o(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"format",this).call(this,_,E);for(var A=this,T=0;A!=null&&A.statics.scope!==f.default.Scope.BLOCK_BLOT;)T+=A.offset(A.parent),A=A.parent;A!=null&&(this._length=S.CONTENTS.length,A.optimize(),A.formatAt(T,S.CONTENTS.length,_,E),this._length=0)}},{key:"index",value:function(_,E){return _===this.textNode?0:o(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"index",this).call(this,_,E)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){o(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!(this.selection.composing||this.parent==null)){var _=this.textNode,E=this.selection.getNativeRange(),A=void 0,T=void 0,I=void 0;if(E!=null&&E.start.node===_&&E.end.node===_){var L=[_,E.start.offset,E.end.offset];A=L[0],T=L[1],I=L[2]}for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==S.CONTENTS){var R=this.textNode.data.split(S.CONTENTS).join("");this.next instanceof h.default?(A=this.next.domNode,this.next.insertAt(0,R),this.textNode.data=S.CONTENTS):(this.textNode.data=R,this.parent.insertBefore(f.default.create(this.textNode),this),this.textNode=document.createTextNode(S.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),T!=null){var N=[T,I].map(function(H){return Math.max(0,Math.min(A.data.length,H-1))}),F=a(N,2);return T=F[0],I=F[1],{startNode:A,startOffset:T,endNode:A,endOffset:I}}}}},{key:"update",value:function(_,E){var A=this;if(_.some(function(I){return I.type==="characterData"&&I.target===A.textNode})){var T=this.restore();T&&(E.range=T)}}},{key:"value",value:function(){return""}}]),S})(f.default.Embed);x.blotName="cursor",x.className="ql-cursor",x.tagName="span",x.CONTENTS="\uFEFF",n.default=x}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(0),o=f(a),s=i(4),u=f(s);function f(v){return v&&v.__esModule?v:{default:v}}function d(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function h(v,b){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:v}function p(v,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);v.prototype=Object.create(b&&b.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(v,b):v.__proto__=b)}var y=(function(v){p(b,v);function b(){return d(this,b),h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return b})(o.default.Container);y.allowedChildren=[u.default,s.BlockEmbed,y],n.default=y}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.ColorStyle=n.ColorClass=n.ColorAttributor=void 0;var a=(function(){function x(k,S){for(var P=0;P<S.length;P++){var _=S[P];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}return function(k,S,P){return S&&x(k.prototype,S),P&&x(k,P),k}})(),o=function x(k,S,P){k===null&&(k=Function.prototype);var _=Object.getOwnPropertyDescriptor(k,S);if(_===void 0){var E=Object.getPrototypeOf(k);return E===null?void 0:x(E,S,P)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(P)}},s=i(0),u=f(s);function f(x){return x&&x.__esModule?x:{default:x}}function d(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}function h(x,k){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:x}function p(x,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);x.prototype=Object.create(k&&k.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(x,k):x.__proto__=k)}var y=(function(x){p(k,x);function k(){return d(this,k),h(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}return a(k,[{key:"value",value:function(P){var _=o(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"value",this).call(this,P);return _.startsWith("rgb(")?(_=_.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),"#"+_.split(",").map(function(E){return("00"+parseInt(E).toString(16)).slice(-2)}).join("")):_}}]),k})(u.default.Attributor.Style),v=new u.default.Attributor.Class("color","ql-color",{scope:u.default.Scope.INLINE}),b=new y("color","color",{scope:u.default.Scope.INLINE});n.ColorAttributor=y,n.ColorClass=v,n.ColorStyle=b}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.sanitize=n.default=void 0;var a=(function(){function b(x,k){for(var S=0;S<k.length;S++){var P=k[S];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(x,P.key,P)}}return function(x,k,S){return k&&b(x.prototype,k),S&&b(x,S),x}})(),o=function b(x,k,S){x===null&&(x=Function.prototype);var P=Object.getOwnPropertyDescriptor(x,k);if(P===void 0){var _=Object.getPrototypeOf(x);return _===null?void 0:b(_,k,S)}else{if("value"in P)return P.value;var E=P.get;return E===void 0?void 0:E.call(S)}},s=i(6),u=f(s);function f(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function h(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function p(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var y=(function(b){p(x,b);function x(){return d(this,x),h(this,(x.__proto__||Object.getPrototypeOf(x)).apply(this,arguments))}return a(x,[{key:"format",value:function(S,P){if(S!==this.statics.blotName||!P)return o(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"format",this).call(this,S,P);P=this.constructor.sanitize(P),this.domNode.setAttribute("href",P)}}],[{key:"create",value:function(S){var P=o(x.__proto__||Object.getPrototypeOf(x),"create",this).call(this,S);return S=this.sanitize(S),P.setAttribute("href",S),P.setAttribute("rel","noopener noreferrer"),P.setAttribute("target","_blank"),P}},{key:"formats",value:function(S){return S.getAttribute("href")}},{key:"sanitize",value:function(S){return v(S,this.PROTOCOL_WHITELIST)?S:this.SANITIZED_URL}}]),x})(u.default);y.blotName="link",y.tagName="A",y.SANITIZED_URL="about:blank",y.PROTOCOL_WHITELIST=["http","https","mailto","tel"];function v(b,x){var k=document.createElement("a");k.href=b;var S=k.href.slice(0,k.href.indexOf(":"));return x.indexOf(S)>-1}n.default=y,n.sanitize=v}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(x){return typeof x}:function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},o=(function(){function x(k,S){for(var P=0;P<S.length;P++){var _=S[P];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}return function(k,S,P){return S&&x(k.prototype,S),P&&x(k,P),k}})(),s=i(23),u=h(s),f=i(107),d=h(f);function h(x){return x&&x.__esModule?x:{default:x}}function p(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}var y=0;function v(x,k){x.setAttribute(k,x.getAttribute(k)!=="true")}var b=(function(){function x(k){var S=this;p(this,x),this.select=k,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){S.togglePicker()}),this.label.addEventListener("keydown",function(P){switch(P.keyCode){case u.default.keys.ENTER:S.togglePicker();break;case u.default.keys.ESCAPE:S.escape(),P.preventDefault();break}}),this.select.addEventListener("change",this.update.bind(this))}return o(x,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),v(this.label,"aria-expanded"),v(this.options,"aria-hidden")}},{key:"buildItem",value:function(S){var P=this,_=document.createElement("span");return _.tabIndex="0",_.setAttribute("role","button"),_.classList.add("ql-picker-item"),S.hasAttribute("value")&&_.setAttribute("data-value",S.getAttribute("value")),S.textContent&&_.setAttribute("data-label",S.textContent),_.addEventListener("click",function(){P.selectItem(_,!0)}),_.addEventListener("keydown",function(E){switch(E.keyCode){case u.default.keys.ENTER:P.selectItem(_,!0),E.preventDefault();break;case u.default.keys.ESCAPE:P.escape(),E.preventDefault();break}}),_}},{key:"buildLabel",value:function(){var S=document.createElement("span");return S.classList.add("ql-picker-label"),S.innerHTML=d.default,S.tabIndex="0",S.setAttribute("role","button"),S.setAttribute("aria-expanded","false"),this.container.appendChild(S),S}},{key:"buildOptions",value:function(){var S=this,P=document.createElement("span");P.classList.add("ql-picker-options"),P.setAttribute("aria-hidden","true"),P.tabIndex="-1",P.id="ql-picker-options-"+y,y+=1,this.label.setAttribute("aria-controls",P.id),this.options=P,[].slice.call(this.select.options).forEach(function(_){var E=S.buildItem(_);P.appendChild(E),_.selected===!0&&S.selectItem(E)}),this.container.appendChild(P)}},{key:"buildPicker",value:function(){var S=this;[].slice.call(this.select.attributes).forEach(function(P){S.container.setAttribute(P.name,P.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var S=this;this.close(),setTimeout(function(){return S.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(S){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=this.container.querySelector(".ql-selected");if(S!==_&&(_?.classList.remove("ql-selected"),S!=null&&(S.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(S.parentNode.children,S),S.hasAttribute("data-value")?this.label.setAttribute("data-value",S.getAttribute("data-value")):this.label.removeAttribute("data-value"),S.hasAttribute("data-label")?this.label.setAttribute("data-label",S.getAttribute("data-label")):this.label.removeAttribute("data-label"),P))){if(typeof Event=="function")this.select.dispatchEvent(new Event("change"));else if((typeof Event>"u"?"undefined":a(Event))==="object"){var E=document.createEvent("Event");E.initEvent("change",!0,!0),this.select.dispatchEvent(E)}this.close()}}},{key:"update",value:function(){var S=void 0;if(this.select.selectedIndex>-1){var P=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];S=this.select.options[this.select.selectedIndex],this.selectItem(P)}else this.selectItem(null);var _=S!=null&&S!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",_)}}]),x})();n.default=b}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(0),o=X(a),s=i(5),u=X(s),f=i(4),d=X(f),h=i(16),p=X(h),y=i(25),v=X(y),b=i(24),x=X(b),k=i(35),S=X(k),P=i(6),_=X(P),E=i(22),A=X(E),T=i(7),I=X(T),L=i(55),R=X(L),N=i(42),F=X(N),H=i(23),$=X(H);function X(Z){return Z&&Z.__esModule?Z:{default:Z}}u.default.register({"blots/block":d.default,"blots/block/embed":f.BlockEmbed,"blots/break":p.default,"blots/container":v.default,"blots/cursor":x.default,"blots/embed":S.default,"blots/inline":_.default,"blots/scroll":A.default,"blots/text":I.default,"modules/clipboard":R.default,"modules/history":F.default,"modules/keyboard":$.default}),o.default.register(d.default,p.default,x.default,_.default,A.default,I.default),n.default=u.default}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(1),o=(function(){function s(u){this.domNode=u,this.domNode[a.DATA_KEY]={blot:this}}return Object.defineProperty(s.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),s.create=function(u){if(this.tagName==null)throw new a.ParchmentError("Blot definition missing tagName");var f;return Array.isArray(this.tagName)?(typeof u=="string"&&(u=u.toUpperCase(),parseInt(u).toString()===u&&(u=parseInt(u))),typeof u=="number"?f=document.createElement(this.tagName[u-1]):this.tagName.indexOf(u)>-1?f=document.createElement(u):f=document.createElement(this.tagName[0])):f=document.createElement(this.tagName),this.className&&f.classList.add(this.className),f},s.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},s.prototype.clone=function(){var u=this.domNode.cloneNode(!1);return a.create(u)},s.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[a.DATA_KEY]},s.prototype.deleteAt=function(u,f){var d=this.isolate(u,f);d.remove()},s.prototype.formatAt=function(u,f,d,h){var p=this.isolate(u,f);if(a.query(d,a.Scope.BLOT)!=null&&h)p.wrap(d,h);else if(a.query(d,a.Scope.ATTRIBUTE)!=null){var y=a.create(this.statics.scope);p.wrap(y),y.format(d,h)}},s.prototype.insertAt=function(u,f,d){var h=d==null?a.create("text",f):a.create(f,d),p=this.split(u);this.parent.insertBefore(h,p)},s.prototype.insertInto=function(u,f){f===void 0&&(f=null),this.parent!=null&&this.parent.children.remove(this);var d=null;u.children.insertBefore(this,f),f!=null&&(d=f.domNode),(this.domNode.parentNode!=u.domNode||this.domNode.nextSibling!=d)&&u.domNode.insertBefore(this.domNode,d),this.parent=u,this.attach()},s.prototype.isolate=function(u,f){var d=this.split(u);return d.split(f),d},s.prototype.length=function(){return 1},s.prototype.offset=function(u){return u===void 0&&(u=this.parent),this.parent==null||this==u?0:this.parent.children.offset(this)+this.parent.offset(u)},s.prototype.optimize=function(u){this.domNode[a.DATA_KEY]!=null&&delete this.domNode[a.DATA_KEY].mutations},s.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},s.prototype.replace=function(u){u.parent!=null&&(u.parent.insertBefore(this,u.next),u.remove())},s.prototype.replaceWith=function(u,f){var d=typeof u=="string"?a.create(u,f):u;return d.replace(this),d},s.prototype.split=function(u,f){return u===0?this:this.next},s.prototype.update=function(u,f){},s.prototype.wrap=function(u,f){var d=typeof u=="string"?a.create(u,f):u;return this.parent!=null&&this.parent.insertBefore(d,this.next),d.appendChild(this),d},s.blotName="abstract",s})();n.default=o}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(12),o=i(32),s=i(33),u=i(1),f=(function(){function d(h){this.attributes={},this.domNode=h,this.build()}return d.prototype.attribute=function(h,p){p?h.add(this.domNode,p)&&(h.value(this.domNode)!=null?this.attributes[h.attrName]=h:delete this.attributes[h.attrName]):(h.remove(this.domNode),delete this.attributes[h.attrName])},d.prototype.build=function(){var h=this;this.attributes={};var p=a.default.keys(this.domNode),y=o.default.keys(this.domNode),v=s.default.keys(this.domNode);p.concat(y).concat(v).forEach(function(b){var x=u.query(b,u.Scope.ATTRIBUTE);x instanceof a.default&&(h.attributes[x.attrName]=x)})},d.prototype.copy=function(h){var p=this;Object.keys(this.attributes).forEach(function(y){var v=p.attributes[y].value(p.domNode);h.format(y,v)})},d.prototype.move=function(h){var p=this;this.copy(h),Object.keys(this.attributes).forEach(function(y){p.attributes[y].remove(p.domNode)}),this.attributes={}},d.prototype.values=function(){var h=this;return Object.keys(this.attributes).reduce(function(p,y){return p[y]=h.attributes[y].value(h.domNode),p},{})},d})();n.default=f}),(function(r,n,i){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,h){d.__proto__=h}||function(d,h){for(var p in h)h.hasOwnProperty(p)&&(d[p]=h[p])};return function(d,h){f(d,h);function p(){this.constructor=d}d.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(12);function s(f,d){var h=f.getAttribute("class")||"";return h.split(/\s+/).filter(function(p){return p.indexOf(d+"-")===0})}var u=(function(f){a(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.keys=function(h){return(h.getAttribute("class")||"").split(/\s+/).map(function(p){return p.split("-").slice(0,-1).join("-")})},d.prototype.add=function(h,p){return this.canAdd(h,p)?(this.remove(h),h.classList.add(this.keyName+"-"+p),!0):!1},d.prototype.remove=function(h){var p=s(h,this.keyName);p.forEach(function(y){h.classList.remove(y)}),h.classList.length===0&&h.removeAttribute("class")},d.prototype.value=function(h){var p=s(h,this.keyName)[0]||"",y=p.slice(this.keyName.length+1);return this.canAdd(h,y)?y:""},d})(o.default);n.default=u}),(function(r,n,i){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,h){d.__proto__=h}||function(d,h){for(var p in h)h.hasOwnProperty(p)&&(d[p]=h[p])};return function(d,h){f(d,h);function p(){this.constructor=d}d.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(12);function s(f){var d=f.split("-"),h=d.slice(1).map(function(p){return p[0].toUpperCase()+p.slice(1)}).join("");return d[0]+h}var u=(function(f){a(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.keys=function(h){return(h.getAttribute("style")||"").split(";").map(function(p){var y=p.split(":");return y[0].trim()})},d.prototype.add=function(h,p){return this.canAdd(h,p)?(h.style[s(this.keyName)]=p,!0):!1},d.prototype.remove=function(h){h.style[s(this.keyName)]="",h.getAttribute("style")||h.removeAttribute("style")},d.prototype.value=function(h){var p=h.style[s(this.keyName)];return this.canAdd(h,p)?p:""},d})(o.default);n.default=u}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function u(f,d){for(var h=0;h<d.length;h++){var p=d[h];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(f,p.key,p)}}return function(f,d,h){return d&&u(f.prototype,d),h&&u(f,h),f}})();function o(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}var s=(function(){function u(f,d){o(this,u),this.quill=f,this.options=d,this.modules={}}return a(u,[{key:"init",value:function(){var d=this;Object.keys(this.options.modules).forEach(function(h){d.modules[h]==null&&d.addModule(h)})}},{key:"addModule",value:function(d){var h=this.quill.constructor.import("modules/"+d);return this.modules[d]=new h(this.quill,this.options.modules[d]||{}),this.modules[d]}}]),u})();s.DEFAULTS={modules:{}},s.themes={default:s},n.default=s}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function k(S,P){for(var _=0;_<P.length;_++){var E=P[_];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(S,E.key,E)}}return function(S,P,_){return P&&k(S.prototype,P),_&&k(S,_),S}})(),o=function k(S,P,_){S===null&&(S=Function.prototype);var E=Object.getOwnPropertyDescriptor(S,P);if(E===void 0){var A=Object.getPrototypeOf(S);return A===null?void 0:k(A,P,_)}else{if("value"in E)return E.value;var T=E.get;return T===void 0?void 0:T.call(_)}},s=i(0),u=h(s),f=i(7),d=h(f);function h(k){return k&&k.__esModule?k:{default:k}}function p(k,S){if(!(k instanceof S))throw new TypeError("Cannot call a class as a function")}function y(k,S){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:k}function v(k,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);k.prototype=Object.create(S&&S.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(k,S):k.__proto__=S)}var b="\uFEFF",x=(function(k){v(S,k);function S(P){p(this,S);var _=y(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,P));return _.contentNode=document.createElement("span"),_.contentNode.setAttribute("contenteditable",!1),[].slice.call(_.domNode.childNodes).forEach(function(E){_.contentNode.appendChild(E)}),_.leftGuard=document.createTextNode(b),_.rightGuard=document.createTextNode(b),_.domNode.appendChild(_.leftGuard),_.domNode.appendChild(_.contentNode),_.domNode.appendChild(_.rightGuard),_}return a(S,[{key:"index",value:function(_,E){return _===this.leftGuard?0:_===this.rightGuard?1:o(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"index",this).call(this,_,E)}},{key:"restore",value:function(_){var E=void 0,A=void 0,T=_.data.split(b).join("");if(_===this.leftGuard)if(this.prev instanceof d.default){var I=this.prev.length();this.prev.insertAt(I,T),E={startNode:this.prev.domNode,startOffset:I+T.length}}else A=document.createTextNode(T),this.parent.insertBefore(u.default.create(A),this),E={startNode:A,startOffset:T.length};else _===this.rightGuard&&(this.next instanceof d.default?(this.next.insertAt(0,T),E={startNode:this.next.domNode,startOffset:T.length}):(A=document.createTextNode(T),this.parent.insertBefore(u.default.create(A),this.next),E={startNode:A,startOffset:T.length}));return _.data=b,E}},{key:"update",value:function(_,E){var A=this;_.forEach(function(T){if(T.type==="characterData"&&(T.target===A.leftGuard||T.target===A.rightGuard)){var I=A.restore(T.target);I&&(E.range=I)}})}}]),S})(u.default.Embed);n.default=x}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.AlignStyle=n.AlignClass=n.AlignAttribute=void 0;var a=i(0),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}var u={scope:o.default.Scope.BLOCK,whitelist:["right","center","justify"]},f=new o.default.Attributor.Attribute("align","align",u),d=new o.default.Attributor.Class("align","ql-align",u),h=new o.default.Attributor.Style("align","text-align",u);n.AlignAttribute=f,n.AlignClass=d,n.AlignStyle=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.BackgroundStyle=n.BackgroundClass=void 0;var a=i(0),o=u(a),s=i(26);function u(h){return h&&h.__esModule?h:{default:h}}var f=new o.default.Attributor.Class("background","ql-bg",{scope:o.default.Scope.INLINE}),d=new s.ColorAttributor("background","background-color",{scope:o.default.Scope.INLINE});n.BackgroundClass=f,n.BackgroundStyle=d}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.DirectionStyle=n.DirectionClass=n.DirectionAttribute=void 0;var a=i(0),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}var u={scope:o.default.Scope.BLOCK,whitelist:["rtl"]},f=new o.default.Attributor.Attribute("direction","dir",u),d=new o.default.Attributor.Class("direction","ql-direction",u),h=new o.default.Attributor.Style("direction","direction",u);n.DirectionAttribute=f,n.DirectionClass=d,n.DirectionStyle=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.FontClass=n.FontStyle=void 0;var a=(function(){function k(S,P){for(var _=0;_<P.length;_++){var E=P[_];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(S,E.key,E)}}return function(S,P,_){return P&&k(S.prototype,P),_&&k(S,_),S}})(),o=function k(S,P,_){S===null&&(S=Function.prototype);var E=Object.getOwnPropertyDescriptor(S,P);if(E===void 0){var A=Object.getPrototypeOf(S);return A===null?void 0:k(A,P,_)}else{if("value"in E)return E.value;var T=E.get;return T===void 0?void 0:T.call(_)}},s=i(0),u=f(s);function f(k){return k&&k.__esModule?k:{default:k}}function d(k,S){if(!(k instanceof S))throw new TypeError("Cannot call a class as a function")}function h(k,S){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:k}function p(k,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);k.prototype=Object.create(S&&S.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(k,S):k.__proto__=S)}var y={scope:u.default.Scope.INLINE,whitelist:["serif","monospace"]},v=new u.default.Attributor.Class("font","ql-font",y),b=(function(k){p(S,k);function S(){return d(this,S),h(this,(S.__proto__||Object.getPrototypeOf(S)).apply(this,arguments))}return a(S,[{key:"value",value:function(_){return o(S.prototype.__proto__||Object.getPrototypeOf(S.prototype),"value",this).call(this,_).replace(/["']/g,"")}}]),S})(u.default.Attributor.Style),x=new b("font","font-family",y);n.FontStyle=x,n.FontClass=v}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SizeStyle=n.SizeClass=void 0;var a=i(0),o=s(a);function s(d){return d&&d.__esModule?d:{default:d}}var u=new o.default.Attributor.Class("size","ql-size",{scope:o.default.Scope.INLINE,whitelist:["small","large","huge"]}),f=new o.default.Attributor.Style("size","font-size",{scope:o.default.Scope.INLINE,whitelist:["10px","18px","32px"]});n.SizeClass=u,n.SizeStyle=f}),(function(r,n,i){r.exports={align:{"":i(76),center:i(77),right:i(78),justify:i(79)},background:i(80),blockquote:i(81),bold:i(82),clean:i(83),code:i(58),"code-block":i(58),color:i(84),direction:{"":i(85),rtl:i(86)},float:{center:i(87),full:i(88),left:i(89),right:i(90)},formula:i(91),header:{1:i(92),2:i(93)},italic:i(94),image:i(95),indent:{"+1":i(96),"-1":i(97)},link:i(98),list:{ordered:i(99),bullet:i(100),check:i(101)},script:{sub:i(102),super:i(103)},strike:i(104),underline:i(105),video:i(106)}}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getLastChangeIndex=n.default=void 0;var a=(function(){function P(_,E){for(var A=0;A<E.length;A++){var T=E[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}return function(_,E,A){return E&&P(_.prototype,E),A&&P(_,A),_}})(),o=i(0),s=p(o),u=i(5),f=p(u),d=i(9),h=p(d);function p(P){return P&&P.__esModule?P:{default:P}}function y(P,_){if(!(P instanceof _))throw new TypeError("Cannot call a class as a function")}function v(P,_){if(!P)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:P}function b(P,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);P.prototype=Object.create(_&&_.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(P,_):P.__proto__=_)}var x=(function(P){b(_,P);function _(E,A){y(this,_);var T=v(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,E,A));return T.lastRecorded=0,T.ignoreChange=!1,T.clear(),T.quill.on(f.default.events.EDITOR_CHANGE,function(I,L,R,N){I!==f.default.events.TEXT_CHANGE||T.ignoreChange||(!T.options.userOnly||N===f.default.sources.USER?T.record(L,R):T.transform(L))}),T.quill.keyboard.addBinding({key:"Z",shortKey:!0},T.undo.bind(T)),T.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},T.redo.bind(T)),/Win/i.test(navigator.platform)&&T.quill.keyboard.addBinding({key:"Y",shortKey:!0},T.redo.bind(T)),T}return a(_,[{key:"change",value:function(A,T){if(this.stack[A].length!==0){var I=this.stack[A].pop();this.stack[T].push(I),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(I[A],f.default.sources.USER),this.ignoreChange=!1;var L=S(I[A]);this.quill.setSelection(L)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(A,T){if(A.ops.length!==0){this.stack.redo=[];var I=this.quill.getContents().diff(T),L=Date.now();if(this.lastRecorded+this.options.delay>L&&this.stack.undo.length>0){var R=this.stack.undo.pop();I=I.compose(R.undo),A=R.redo.compose(A)}else this.lastRecorded=L;this.stack.undo.push({redo:A,undo:I}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(A){this.stack.undo.forEach(function(T){T.undo=A.transform(T.undo,!0),T.redo=A.transform(T.redo,!0)}),this.stack.redo.forEach(function(T){T.undo=A.transform(T.undo,!0),T.redo=A.transform(T.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),_})(h.default);x.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function k(P){var _=P.ops[P.ops.length-1];return _==null?!1:_.insert!=null?typeof _.insert=="string"&&_.insert.endsWith(`
131
+ `):_.attributes!=null?Object.keys(_.attributes).some(function(E){return s.default.query(E,s.default.Scope.BLOCK)!=null}):!1}function S(P){var _=P.reduce(function(A,T){return A+=T.delete||0,A},0),E=P.length()-_;return k(P)&&(E-=1),E}n.default=x,n.getLastChangeIndex=S}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BaseTooltip=void 0;var a=(function(){function W(V,ee){for(var te=0;te<ee.length;te++){var Q=ee[te];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(V,Q.key,Q)}}return function(V,ee,te){return ee&&W(V.prototype,ee),te&&W(V,te),V}})(),o=function W(V,ee,te){V===null&&(V=Function.prototype);var Q=Object.getOwnPropertyDescriptor(V,ee);if(Q===void 0){var ne=Object.getPrototypeOf(V);return ne===null?void 0:W(ne,ee,te)}else{if("value"in Q)return Q.value;var ue=Q.get;return ue===void 0?void 0:ue.call(te)}},s=i(3),u=L(s),f=i(2),d=L(f),h=i(8),p=L(h),y=i(23),v=L(y),b=i(34),x=L(b),k=i(59),S=L(k),P=i(60),_=L(P),E=i(28),A=L(E),T=i(61),I=L(T);function L(W){return W&&W.__esModule?W:{default:W}}function R(W,V){if(!(W instanceof V))throw new TypeError("Cannot call a class as a function")}function N(W,V){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return V&&(typeof V=="object"||typeof V=="function")?V:W}function F(W,V){if(typeof V!="function"&&V!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof V);W.prototype=Object.create(V&&V.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),V&&(Object.setPrototypeOf?Object.setPrototypeOf(W,V):W.__proto__=V)}var H=[!1,"center","right","justify"],$=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],X=[!1,"serif","monospace"],Z=["1","2","3",!1],K=["small",!1,"large","huge"],q=(function(W){F(V,W);function V(ee,te){R(this,V);var Q=N(this,(V.__proto__||Object.getPrototypeOf(V)).call(this,ee,te)),ne=function ue(oe){if(!document.body.contains(ee.root))return document.body.removeEventListener("click",ue);Q.tooltip!=null&&!Q.tooltip.root.contains(oe.target)&&document.activeElement!==Q.tooltip.textbox&&!Q.quill.hasFocus()&&Q.tooltip.hide(),Q.pickers!=null&&Q.pickers.forEach(function(de){de.container.contains(oe.target)||de.close()})};return ee.emitter.listenDOM("click",document.body,ne),Q}return a(V,[{key:"addModule",value:function(te){var Q=o(V.prototype.__proto__||Object.getPrototypeOf(V.prototype),"addModule",this).call(this,te);return te==="toolbar"&&this.extendToolbar(Q),Q}},{key:"buildButtons",value:function(te,Q){te.forEach(function(ne){var ue=ne.getAttribute("class")||"";ue.split(/\s+/).forEach(function(oe){if(oe.startsWith("ql-")&&(oe=oe.slice(3),Q[oe]!=null))if(oe==="direction")ne.innerHTML=Q[oe][""]+Q[oe].rtl;else if(typeof Q[oe]=="string")ne.innerHTML=Q[oe];else{var de=ne.value||"";de!=null&&Q[oe][de]&&(ne.innerHTML=Q[oe][de])}})})}},{key:"buildPickers",value:function(te,Q){var ne=this;this.pickers=te.map(function(oe){if(oe.classList.contains("ql-align"))return oe.querySelector("option")==null&&D(oe,H),new _.default(oe,Q.align);if(oe.classList.contains("ql-background")||oe.classList.contains("ql-color")){var de=oe.classList.contains("ql-background")?"background":"color";return oe.querySelector("option")==null&&D(oe,$,de==="background"?"#ffffff":"#000000"),new S.default(oe,Q[de])}else return oe.querySelector("option")==null&&(oe.classList.contains("ql-font")?D(oe,X):oe.classList.contains("ql-header")?D(oe,Z):oe.classList.contains("ql-size")&&D(oe,K)),new A.default(oe)});var ue=function(){ne.pickers.forEach(function(de){de.update()})};this.quill.on(p.default.events.EDITOR_CHANGE,ue)}}]),V})(x.default);q.DEFAULTS=(0,u.default)(!0,{},x.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var V=this,ee=this.container.querySelector("input.ql-image[type=file]");ee==null&&(ee=document.createElement("input"),ee.setAttribute("type","file"),ee.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),ee.classList.add("ql-image"),ee.addEventListener("change",function(){if(ee.files!=null&&ee.files[0]!=null){var te=new FileReader;te.onload=function(Q){var ne=V.quill.getSelection(!0);V.quill.updateContents(new d.default().retain(ne.index).delete(ne.length).insert({image:Q.target.result}),p.default.sources.USER),V.quill.setSelection(ne.index+1,p.default.sources.SILENT),ee.value=""},te.readAsDataURL(ee.files[0])}}),this.container.appendChild(ee)),ee.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var J=(function(W){F(V,W);function V(ee,te){R(this,V);var Q=N(this,(V.__proto__||Object.getPrototypeOf(V)).call(this,ee,te));return Q.textbox=Q.root.querySelector('input[type="text"]'),Q.listen(),Q}return a(V,[{key:"listen",value:function(){var te=this;this.textbox.addEventListener("keydown",function(Q){v.default.match(Q,"enter")?(te.save(),Q.preventDefault()):v.default.match(Q,"escape")&&(te.cancel(),Q.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"link",Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),Q!=null?this.textbox.value=Q:te!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+te)||""),this.root.setAttribute("data-mode",te)}},{key:"restoreFocus",value:function(){var te=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=te}},{key:"save",value:function(){var te=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var Q=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",te,p.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",te,p.default.sources.USER)),this.quill.root.scrollTop=Q;break}case"video":te=U(te);case"formula":{if(!te)break;var ne=this.quill.getSelection(!0);if(ne!=null){var ue=ne.index+ne.length;this.quill.insertEmbed(ue,this.root.getAttribute("data-mode"),te,p.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(ue+1," ",p.default.sources.USER),this.quill.setSelection(ue+2,p.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),V})(I.default);function U(W){var V=W.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||W.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return V?(V[1]||"https")+"://www.youtube.com/embed/"+V[2]+"?showinfo=0":(V=W.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(V[1]||"https")+"://player.vimeo.com/video/"+V[2]+"/":W}function D(W,V){var ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;V.forEach(function(te){var Q=document.createElement("option");te===ee?Q.setAttribute("selected","selected"):Q.setAttribute("value",te),W.appendChild(Q)})}n.BaseTooltip=J,n.default=q}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function o(){this.head=this.tail=null,this.length=0}return o.prototype.append=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];this.insertBefore(s[0],null),s.length>1&&this.append.apply(this,s.slice(1))},o.prototype.contains=function(s){for(var u,f=this.iterator();u=f();)if(u===s)return!0;return!1},o.prototype.insertBefore=function(s,u){s&&(s.next=u,u!=null?(s.prev=u.prev,u.prev!=null&&(u.prev.next=s),u.prev=s,u===this.head&&(this.head=s)):this.tail!=null?(this.tail.next=s,s.prev=this.tail,this.tail=s):(s.prev=null,this.head=this.tail=s),this.length+=1)},o.prototype.offset=function(s){for(var u=0,f=this.head;f!=null;){if(f===s)return u;u+=f.length(),f=f.next}return-1},o.prototype.remove=function(s){this.contains(s)&&(s.prev!=null&&(s.prev.next=s.next),s.next!=null&&(s.next.prev=s.prev),s===this.head&&(this.head=s.next),s===this.tail&&(this.tail=s.prev),this.length-=1)},o.prototype.iterator=function(s){return s===void 0&&(s=this.head),function(){var u=s;return s!=null&&(s=s.next),u}},o.prototype.find=function(s,u){u===void 0&&(u=!1);for(var f,d=this.iterator();f=d();){var h=f.length();if(s<h||u&&s===h&&(f.next==null||f.next.length()!==0))return[f,s];s-=h}return[null,0]},o.prototype.forEach=function(s){for(var u,f=this.iterator();u=f();)s(u)},o.prototype.forEachAt=function(s,u,f){if(!(u<=0))for(var d=this.find(s),h=d[0],p=d[1],y,v=s-p,b=this.iterator(h);(y=b())&&v<s+u;){var x=y.length();s>v?f(y,s-v,Math.min(u,v+x-s)):f(y,0,Math.min(x,s+u-v)),v+=x}},o.prototype.map=function(s){return this.reduce(function(u,f){return u.push(s(f)),u},[])},o.prototype.reduce=function(s,u){for(var f,d=this.iterator();f=d();)u=s(u,f);return u},o})();n.default=a}),(function(r,n,i){var a=this&&this.__extends||(function(){var h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,y){p.__proto__=y}||function(p,y){for(var v in y)y.hasOwnProperty(v)&&(p[v]=y[v])};return function(p,y){h(p,y);function v(){this.constructor=p}p.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(17),s=i(1),u={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},f=100,d=(function(h){a(p,h);function p(y){var v=h.call(this,y)||this;return v.scroll=v,v.observer=new MutationObserver(function(b){v.update(b)}),v.observer.observe(v.domNode,u),v.attach(),v}return p.prototype.detach=function(){h.prototype.detach.call(this),this.observer.disconnect()},p.prototype.deleteAt=function(y,v){this.update(),y===0&&v===this.length()?this.children.forEach(function(b){b.remove()}):h.prototype.deleteAt.call(this,y,v)},p.prototype.formatAt=function(y,v,b,x){this.update(),h.prototype.formatAt.call(this,y,v,b,x)},p.prototype.insertAt=function(y,v,b){this.update(),h.prototype.insertAt.call(this,y,v,b)},p.prototype.optimize=function(y,v){var b=this;y===void 0&&(y=[]),v===void 0&&(v={}),h.prototype.optimize.call(this,v);for(var x=[].slice.call(this.observer.takeRecords());x.length>0;)y.push(x.pop());for(var k=function(E,A){A===void 0&&(A=!0),!(E==null||E===b)&&E.domNode.parentNode!=null&&(E.domNode[s.DATA_KEY].mutations==null&&(E.domNode[s.DATA_KEY].mutations=[]),A&&k(E.parent))},S=function(E){E.domNode[s.DATA_KEY]==null||E.domNode[s.DATA_KEY].mutations==null||(E instanceof o.default&&E.children.forEach(S),E.optimize(v))},P=y,_=0;P.length>0;_+=1){if(_>=f)throw new Error("[Parchment] Maximum optimize iterations reached");for(P.forEach(function(E){var A=s.find(E.target,!0);A!=null&&(A.domNode===E.target&&(E.type==="childList"?(k(s.find(E.previousSibling,!1)),[].forEach.call(E.addedNodes,function(T){var I=s.find(T,!1);k(I,!1),I instanceof o.default&&I.children.forEach(function(L){k(L,!1)})})):E.type==="attributes"&&k(A.prev)),k(A))}),this.children.forEach(S),P=[].slice.call(this.observer.takeRecords()),x=P.slice();x.length>0;)y.push(x.pop())}},p.prototype.update=function(y,v){var b=this;v===void 0&&(v={}),y=y||this.observer.takeRecords(),y.map(function(x){var k=s.find(x.target,!0);return k==null?null:k.domNode[s.DATA_KEY].mutations==null?(k.domNode[s.DATA_KEY].mutations=[x],k):(k.domNode[s.DATA_KEY].mutations.push(x),null)}).forEach(function(x){x==null||x===b||x.domNode[s.DATA_KEY]==null||x.update(x.domNode[s.DATA_KEY].mutations||[],v)}),this.domNode[s.DATA_KEY].mutations!=null&&h.prototype.update.call(this,this.domNode[s.DATA_KEY].mutations,v),this.optimize(y,v)},p.blotName="scroll",p.defaultChild="block",p.scope=s.Scope.BLOCK_BLOT,p.tagName="DIV",p})(o.default);n.default=d}),(function(r,n,i){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var y in p)p.hasOwnProperty(y)&&(h[y]=p[y])};return function(h,p){d(h,p);function y(){this.constructor=h}h.prototype=p===null?Object.create(p):(y.prototype=p.prototype,new y)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(18),s=i(1);function u(d,h){if(Object.keys(d).length!==Object.keys(h).length)return!1;for(var p in d)if(d[p]!==h[p])return!1;return!0}var f=(function(d){a(h,d);function h(){return d!==null&&d.apply(this,arguments)||this}return h.formats=function(p){if(p.tagName!==h.tagName)return d.formats.call(this,p)},h.prototype.format=function(p,y){var v=this;p===this.statics.blotName&&!y?(this.children.forEach(function(b){b instanceof o.default||(b=b.wrap(h.blotName,!0)),v.attributes.copy(b)}),this.unwrap()):d.prototype.format.call(this,p,y)},h.prototype.formatAt=function(p,y,v,b){if(this.formats()[v]!=null||s.query(v,s.Scope.ATTRIBUTE)){var x=this.isolate(p,y);x.format(v,b)}else d.prototype.formatAt.call(this,p,y,v,b)},h.prototype.optimize=function(p){d.prototype.optimize.call(this,p);var y=this.formats();if(Object.keys(y).length===0)return this.unwrap();var v=this.next;v instanceof h&&v.prev===this&&u(y,v.formats())&&(v.moveChildren(this),v.remove())},h.blotName="inline",h.scope=s.Scope.INLINE_BLOT,h.tagName="SPAN",h})(o.default);n.default=f}),(function(r,n,i){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,h){d.__proto__=h}||function(d,h){for(var p in h)h.hasOwnProperty(p)&&(d[p]=h[p])};return function(d,h){f(d,h);function p(){this.constructor=d}d.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(18),s=i(1),u=(function(f){a(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.formats=function(h){var p=s.query(d.blotName).tagName;if(h.tagName!==p)return f.formats.call(this,h)},d.prototype.format=function(h,p){s.query(h,s.Scope.BLOCK)!=null&&(h===this.statics.blotName&&!p?this.replaceWith(d.blotName):f.prototype.format.call(this,h,p))},d.prototype.formatAt=function(h,p,y,v){s.query(y,s.Scope.BLOCK)!=null?this.format(y,v):f.prototype.formatAt.call(this,h,p,y,v)},d.prototype.insertAt=function(h,p,y){if(y==null||s.query(p,s.Scope.INLINE)!=null)f.prototype.insertAt.call(this,h,p,y);else{var v=this.split(h),b=s.create(p,y);v.parent.insertBefore(b,v)}},d.prototype.update=function(h,p){navigator.userAgent.match(/Trident/)?this.build():f.prototype.update.call(this,h,p)},d.blotName="block",d.scope=s.Scope.BLOCK_BLOT,d.tagName="P",d})(o.default);n.default=u}),(function(r,n,i){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,d){f.__proto__=d}||function(f,d){for(var h in d)d.hasOwnProperty(h)&&(f[h]=d[h])};return function(f,d){u(f,d);function h(){this.constructor=f}f.prototype=d===null?Object.create(d):(h.prototype=d.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(19),s=(function(u){a(f,u);function f(){return u!==null&&u.apply(this,arguments)||this}return f.formats=function(d){},f.prototype.format=function(d,h){u.prototype.formatAt.call(this,0,this.length(),d,h)},f.prototype.formatAt=function(d,h,p,y){d===0&&h===this.length()?this.format(p,y):u.prototype.formatAt.call(this,d,h,p,y)},f.prototype.formats=function(){return this.statics.formats(this.domNode)},f})(o.default);n.default=s}),(function(r,n,i){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,h){d.__proto__=h}||function(d,h){for(var p in h)h.hasOwnProperty(p)&&(d[p]=h[p])};return function(d,h){f(d,h);function p(){this.constructor=d}d.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(19),s=i(1),u=(function(f){a(d,f);function d(h){var p=f.call(this,h)||this;return p.text=p.statics.value(p.domNode),p}return d.create=function(h){return document.createTextNode(h)},d.value=function(h){var p=h.data;return p.normalize&&(p=p.normalize()),p},d.prototype.deleteAt=function(h,p){this.domNode.data=this.text=this.text.slice(0,h)+this.text.slice(h+p)},d.prototype.index=function(h,p){return this.domNode===h?p:-1},d.prototype.insertAt=function(h,p,y){y==null?(this.text=this.text.slice(0,h)+p+this.text.slice(h),this.domNode.data=this.text):f.prototype.insertAt.call(this,h,p,y)},d.prototype.length=function(){return this.text.length},d.prototype.optimize=function(h){f.prototype.optimize.call(this,h),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof d&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},d.prototype.position=function(h,p){return[this.domNode,h]},d.prototype.split=function(h,p){if(p===void 0&&(p=!1),!p){if(h===0)return this;if(h===this.length())return this.next}var y=s.create(this.domNode.splitText(h));return this.parent.insertBefore(y,this.next),this.text=this.statics.value(this.domNode),y},d.prototype.update=function(h,p){var y=this;h.some(function(v){return v.type==="characterData"&&v.target===y.domNode})&&(this.text=this.statics.value(this.domNode))},d.prototype.value=function(){return this.text},d.blotName="text",d.scope=s.Scope.INLINE_BLOT,d})(o.default);n.default=u}),(function(r,n,i){var a=document.createElement("div");if(a.classList.toggle("test-class",!1),a.classList.contains("test-class")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(s,u){return arguments.length>1&&!this.contains(s)==!u?u:o.call(this,s)}}String.prototype.startsWith||(String.prototype.startsWith=function(s,u){return u=u||0,this.substr(u,s.length)===s}),String.prototype.endsWith||(String.prototype.endsWith=function(s,u){var f=this.toString();(typeof u!="number"||!isFinite(u)||Math.floor(u)!==u||u>f.length)&&(u=f.length),u-=s.length;var d=f.indexOf(s,u);return d!==-1&&d===u}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(u){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof u!="function")throw new TypeError("predicate must be a function");for(var f=Object(this),d=f.length>>>0,h=arguments[1],p,y=0;y<d;y++)if(p=f[y],u.call(h,p,y,f))return p}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})}),(function(r,n){var i=-1,a=1,o=0;function s(_,E,A){if(_==E)return _?[[o,_]]:[];(A<0||_.length<A)&&(A=null);var T=h(_,E),I=_.substring(0,T);_=_.substring(T),E=E.substring(T),T=p(_,E);var L=_.substring(_.length-T);_=_.substring(0,_.length-T),E=E.substring(0,E.length-T);var R=u(_,E);return I&&R.unshift([o,I]),L&&R.push([o,L]),v(R),A!=null&&(R=k(R,A)),R=S(R),R}function u(_,E){var A;if(!_)return[[a,E]];if(!E)return[[i,_]];var T=_.length>E.length?_:E,I=_.length>E.length?E:_,L=T.indexOf(I);if(L!=-1)return A=[[a,T.substring(0,L)],[o,I],[a,T.substring(L+I.length)]],_.length>E.length&&(A[0][0]=A[2][0]=i),A;if(I.length==1)return[[i,_],[a,E]];var R=y(_,E);if(R){var N=R[0],F=R[1],H=R[2],$=R[3],X=R[4],Z=s(N,H),K=s(F,$);return Z.concat([[o,X]],K)}return f(_,E)}function f(_,E){for(var A=_.length,T=E.length,I=Math.ceil((A+T)/2),L=I,R=2*I,N=new Array(R),F=new Array(R),H=0;H<R;H++)N[H]=-1,F[H]=-1;N[L+1]=0,F[L+1]=0;for(var $=A-T,X=$%2!=0,Z=0,K=0,q=0,J=0,U=0;U<I;U++){for(var D=-U+Z;D<=U-K;D+=2){var W=L+D,V;D==-U||D!=U&&N[W-1]<N[W+1]?V=N[W+1]:V=N[W-1]+1;for(var ee=V-D;V<A&&ee<T&&_.charAt(V)==E.charAt(ee);)V++,ee++;if(N[W]=V,V>A)K+=2;else if(ee>T)Z+=2;else if(X){var te=L+$-D;if(te>=0&&te<R&&F[te]!=-1){var Q=A-F[te];if(V>=Q)return d(_,E,V,ee)}}}for(var ne=-U+q;ne<=U-J;ne+=2){var te=L+ne,Q;ne==-U||ne!=U&&F[te-1]<F[te+1]?Q=F[te+1]:Q=F[te-1]+1;for(var ue=Q-ne;Q<A&&ue<T&&_.charAt(A-Q-1)==E.charAt(T-ue-1);)Q++,ue++;if(F[te]=Q,Q>A)J+=2;else if(ue>T)q+=2;else if(!X){var W=L+$-ne;if(W>=0&&W<R&&N[W]!=-1){var V=N[W],ee=L+V-W;if(Q=A-Q,V>=Q)return d(_,E,V,ee)}}}}return[[i,_],[a,E]]}function d(_,E,A,T){var I=_.substring(0,A),L=E.substring(0,T),R=_.substring(A),N=E.substring(T),F=s(I,L),H=s(R,N);return F.concat(H)}function h(_,E){if(!_||!E||_.charAt(0)!=E.charAt(0))return 0;for(var A=0,T=Math.min(_.length,E.length),I=T,L=0;A<I;)_.substring(L,I)==E.substring(L,I)?(A=I,L=A):T=I,I=Math.floor((T-A)/2+A);return I}function p(_,E){if(!_||!E||_.charAt(_.length-1)!=E.charAt(E.length-1))return 0;for(var A=0,T=Math.min(_.length,E.length),I=T,L=0;A<I;)_.substring(_.length-I,_.length-L)==E.substring(E.length-I,E.length-L)?(A=I,L=A):T=I,I=Math.floor((T-A)/2+A);return I}function y(_,E){var A=_.length>E.length?_:E,T=_.length>E.length?E:_;if(A.length<4||T.length*2<A.length)return null;function I(K,q,J){for(var U=K.substring(J,J+Math.floor(K.length/4)),D=-1,W="",V,ee,te,Q;(D=q.indexOf(U,D+1))!=-1;){var ne=h(K.substring(J),q.substring(D)),ue=p(K.substring(0,J),q.substring(0,D));W.length<ue+ne&&(W=q.substring(D-ue,D)+q.substring(D,D+ne),V=K.substring(0,J-ue),ee=K.substring(J+ne),te=q.substring(0,D-ue),Q=q.substring(D+ne))}return W.length*2>=K.length?[V,ee,te,Q,W]:null}var L=I(A,T,Math.ceil(A.length/4)),R=I(A,T,Math.ceil(A.length/2)),N;if(!L&&!R)return null;R?L?N=L[4].length>R[4].length?L:R:N=R:N=L;var F,H,$,X;_.length>E.length?(F=N[0],H=N[1],$=N[2],X=N[3]):($=N[0],X=N[1],F=N[2],H=N[3]);var Z=N[4];return[F,H,$,X,Z]}function v(_){_.push([o,""]);for(var E=0,A=0,T=0,I="",L="",R;E<_.length;)switch(_[E][0]){case a:T++,L+=_[E][1],E++;break;case i:A++,I+=_[E][1],E++;break;case o:A+T>1?(A!==0&&T!==0&&(R=h(L,I),R!==0&&(E-A-T>0&&_[E-A-T-1][0]==o?_[E-A-T-1][1]+=L.substring(0,R):(_.splice(0,0,[o,L.substring(0,R)]),E++),L=L.substring(R),I=I.substring(R)),R=p(L,I),R!==0&&(_[E][1]=L.substring(L.length-R)+_[E][1],L=L.substring(0,L.length-R),I=I.substring(0,I.length-R))),A===0?_.splice(E-T,A+T,[a,L]):T===0?_.splice(E-A,A+T,[i,I]):_.splice(E-A-T,A+T,[i,I],[a,L]),E=E-A-T+(A?1:0)+(T?1:0)+1):E!==0&&_[E-1][0]==o?(_[E-1][1]+=_[E][1],_.splice(E,1)):E++,T=0,A=0,I="",L="";break}_[_.length-1][1]===""&&_.pop();var N=!1;for(E=1;E<_.length-1;)_[E-1][0]==o&&_[E+1][0]==o&&(_[E][1].substring(_[E][1].length-_[E-1][1].length)==_[E-1][1]?(_[E][1]=_[E-1][1]+_[E][1].substring(0,_[E][1].length-_[E-1][1].length),_[E+1][1]=_[E-1][1]+_[E+1][1],_.splice(E-1,1),N=!0):_[E][1].substring(0,_[E+1][1].length)==_[E+1][1]&&(_[E-1][1]+=_[E+1][1],_[E][1]=_[E][1].substring(_[E+1][1].length)+_[E+1][1],_.splice(E+1,1),N=!0)),E++;N&&v(_)}var b=s;b.INSERT=a,b.DELETE=i,b.EQUAL=o,r.exports=b;function x(_,E){if(E===0)return[o,_];for(var A=0,T=0;T<_.length;T++){var I=_[T];if(I[0]===i||I[0]===o){var L=A+I[1].length;if(E===L)return[T+1,_];if(E<L){_=_.slice();var R=E-A,N=[I[0],I[1].slice(0,R)],F=[I[0],I[1].slice(R)];return _.splice(T,1,N,F),[T+1,_]}else A=L}}throw new Error("cursor_pos is out of bounds!")}function k(_,E){var A=x(_,E),T=A[1],I=A[0],L=T[I],R=T[I+1];if(L==null)return _;if(L[0]!==o)return _;if(R!=null&&L[1]+R[1]===R[1]+L[1])return T.splice(I,2,R,L),P(T,I,2);if(R!=null&&R[1].indexOf(L[1])===0){T.splice(I,2,[R[0],L[1]],[0,L[1]]);var N=R[1].slice(L[1].length);return N.length>0&&T.splice(I+2,0,[R[0],N]),P(T,I,3)}else return _}function S(_){for(var E=!1,A=function(R){return R.charCodeAt(0)>=56320&&R.charCodeAt(0)<=57343},T=function(R){return R.charCodeAt(R.length-1)>=55296&&R.charCodeAt(R.length-1)<=56319},I=2;I<_.length;I+=1)_[I-2][0]===o&&T(_[I-2][1])&&_[I-1][0]===i&&A(_[I-1][1])&&_[I][0]===a&&A(_[I][1])&&(E=!0,_[I-1][1]=_[I-2][1].slice(-1)+_[I-1][1],_[I][1]=_[I-2][1].slice(-1)+_[I][1],_[I-2][1]=_[I-2][1].slice(0,-1));if(!E)return _;for(var L=[],I=0;I<_.length;I+=1)_[I][1].length>0&&L.push(_[I]);return L}function P(_,E,A){for(var T=E+A-1;T>=0&&T>=E-1;T--)if(T+1<_.length){var I=_[T],L=_[T+1];I[0]===L[1]&&_.splice(T,2,[I[0],I[1]+L[1]])}return _}}),(function(r,n){n=r.exports=typeof Object.keys=="function"?Object.keys:i,n.shim=i;function i(a){var o=[];for(var s in a)o.push(s);return o}}),(function(r,n){var i=(function(){return Object.prototype.toString.call(arguments)})()=="[object Arguments]";n=r.exports=i?a:o,n.supported=a;function a(s){return Object.prototype.toString.call(s)=="[object Arguments]"}n.unsupported=o;function o(s){return s&&typeof s=="object"&&typeof s.length=="number"&&Object.prototype.hasOwnProperty.call(s,"callee")&&!Object.prototype.propertyIsEnumerable.call(s,"callee")||!1}}),(function(r,n){var i=Object.prototype.hasOwnProperty,a="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(a=!1));function s(f,d,h){this.fn=f,this.context=d,this.once=h||!1}function u(){this._events=new o,this._eventsCount=0}u.prototype.eventNames=function(){var d=[],h,p;if(this._eventsCount===0)return d;for(p in h=this._events)i.call(h,p)&&d.push(a?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(h)):d},u.prototype.listeners=function(d,h){var p=a?a+d:d,y=this._events[p];if(h)return!!y;if(!y)return[];if(y.fn)return[y.fn];for(var v=0,b=y.length,x=new Array(b);v<b;v++)x[v]=y[v].fn;return x},u.prototype.emit=function(d,h,p,y,v,b){var x=a?a+d:d;if(!this._events[x])return!1;var k=this._events[x],S=arguments.length,P,_;if(k.fn){switch(k.once&&this.removeListener(d,k.fn,void 0,!0),S){case 1:return k.fn.call(k.context),!0;case 2:return k.fn.call(k.context,h),!0;case 3:return k.fn.call(k.context,h,p),!0;case 4:return k.fn.call(k.context,h,p,y),!0;case 5:return k.fn.call(k.context,h,p,y,v),!0;case 6:return k.fn.call(k.context,h,p,y,v,b),!0}for(_=1,P=new Array(S-1);_<S;_++)P[_-1]=arguments[_];k.fn.apply(k.context,P)}else{var E=k.length,A;for(_=0;_<E;_++)switch(k[_].once&&this.removeListener(d,k[_].fn,void 0,!0),S){case 1:k[_].fn.call(k[_].context);break;case 2:k[_].fn.call(k[_].context,h);break;case 3:k[_].fn.call(k[_].context,h,p);break;case 4:k[_].fn.call(k[_].context,h,p,y);break;default:if(!P)for(A=1,P=new Array(S-1);A<S;A++)P[A-1]=arguments[A];k[_].fn.apply(k[_].context,P)}}return!0},u.prototype.on=function(d,h,p){var y=new s(h,p||this),v=a?a+d:d;return this._events[v]?this._events[v].fn?this._events[v]=[this._events[v],y]:this._events[v].push(y):(this._events[v]=y,this._eventsCount++),this},u.prototype.once=function(d,h,p){var y=new s(h,p||this,!0),v=a?a+d:d;return this._events[v]?this._events[v].fn?this._events[v]=[this._events[v],y]:this._events[v].push(y):(this._events[v]=y,this._eventsCount++),this},u.prototype.removeListener=function(d,h,p,y){var v=a?a+d:d;if(!this._events[v])return this;if(!h)return--this._eventsCount===0?this._events=new o:delete this._events[v],this;var b=this._events[v];if(b.fn)b.fn===h&&(!y||b.once)&&(!p||b.context===p)&&(--this._eventsCount===0?this._events=new o:delete this._events[v]);else{for(var x=0,k=[],S=b.length;x<S;x++)(b[x].fn!==h||y&&!b[x].once||p&&b[x].context!==p)&&k.push(b[x]);k.length?this._events[v]=k.length===1?k[0]:k:--this._eventsCount===0?this._events=new o:delete this._events[v]}return this},u.prototype.removeAllListeners=function(d){var h;return d?(h=a?a+d:d,this._events[h]&&(--this._eventsCount===0?this._events=new o:delete this._events[h])):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prototype.setMaxListeners=function(){return this},u.prefixed=a,u.EventEmitter=u,typeof r<"u"&&(r.exports=u)}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.matchText=n.matchSpacing=n.matchNewline=n.matchBlot=n.matchAttributor=n.default=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ge){return typeof ge}:function(ge){return ge&&typeof Symbol=="function"&&ge.constructor===Symbol&&ge!==Symbol.prototype?"symbol":typeof ge},o=(function(){function ge(se,me){var Te=[],ae=!0,xe=!1,Oe=void 0;try{for(var Be=se[Symbol.iterator](),ct;!(ae=(ct=Be.next()).done)&&(Te.push(ct.value),!(me&&Te.length===me));ae=!0);}catch(be){xe=!0,Oe=be}finally{try{!ae&&Be.return&&Be.return()}finally{if(xe)throw Oe}}return Te}return function(se,me){if(Array.isArray(se))return se;if(Symbol.iterator in Object(se))return ge(se,me);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function ge(se,me){for(var Te=0;Te<me.length;Te++){var ae=me[Te];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(se,ae.key,ae)}}return function(se,me,Te){return me&&ge(se.prototype,me),Te&&ge(se,Te),se}})(),u=i(3),f=F(u),d=i(2),h=F(d),p=i(0),y=F(p),v=i(5),b=F(v),x=i(10),k=F(x),S=i(9),P=F(S),_=i(36),E=i(37),A=i(13),T=F(A),I=i(26),L=i(38),R=i(39),N=i(40);function F(ge){return ge&&ge.__esModule?ge:{default:ge}}function H(ge,se,me){return se in ge?Object.defineProperty(ge,se,{value:me,enumerable:!0,configurable:!0,writable:!0}):ge[se]=me,ge}function $(ge,se){if(!(ge instanceof se))throw new TypeError("Cannot call a class as a function")}function X(ge,se){if(!ge)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return se&&(typeof se=="object"||typeof se=="function")?se:ge}function Z(ge,se){if(typeof se!="function"&&se!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof se);ge.prototype=Object.create(se&&se.prototype,{constructor:{value:ge,enumerable:!1,writable:!0,configurable:!0}}),se&&(Object.setPrototypeOf?Object.setPrototypeOf(ge,se):ge.__proto__=se)}var K=(0,k.default)("quill:clipboard"),q="__ql-matcher",J=[[Node.TEXT_NODE,ke],[Node.TEXT_NODE,$e],["br",Ee],[Node.ELEMENT_NODE,$e],[Node.ELEMENT_NODE,de],[Node.ELEMENT_NODE,Xe],[Node.ELEMENT_NODE,oe],[Node.ELEMENT_NODE,dt],["li",Le],["b",ue.bind(ue,"bold")],["i",ue.bind(ue,"italic")],["style",Fe]],U=[_.AlignAttribute,L.DirectionAttribute].reduce(function(ge,se){return ge[se.keyName]=se,ge},{}),D=[_.AlignStyle,E.BackgroundStyle,I.ColorStyle,L.DirectionStyle,R.FontStyle,N.SizeStyle].reduce(function(ge,se){return ge[se.keyName]=se,ge},{}),W=(function(ge){Z(se,ge);function se(me,Te){$(this,se);var ae=X(this,(se.__proto__||Object.getPrototypeOf(se)).call(this,me,Te));return ae.quill.root.addEventListener("paste",ae.onPaste.bind(ae)),ae.container=ae.quill.addContainer("ql-clipboard"),ae.container.setAttribute("contenteditable",!0),ae.container.setAttribute("tabindex",-1),ae.matchers=[],J.concat(ae.options.matchers).forEach(function(xe){var Oe=o(xe,2),Be=Oe[0],ct=Oe[1];!Te.matchVisual&&ct===Xe||ae.addMatcher(Be,ct)}),ae}return s(se,[{key:"addMatcher",value:function(Te,ae){this.matchers.push([Te,ae])}},{key:"convert",value:function(Te){if(typeof Te=="string")return this.container.innerHTML=Te.replace(/\>\r?\n +\</g,"><"),this.convert();var ae=this.quill.getFormat(this.quill.selection.savedRange.index);if(ae[T.default.blotName]){var xe=this.container.innerText;return this.container.innerHTML="",new h.default().insert(xe,H({},T.default.blotName,ae[T.default.blotName]))}var Oe=this.prepareMatching(),Be=o(Oe,2),ct=Be[0],be=Be[1],he=ne(this.container,ct,be);return te(he,`
132
+ `)&&he.ops[he.ops.length-1].attributes==null&&(he=he.compose(new h.default().retain(he.length()-1).delete(1))),K.log("convert",this.container.innerHTML,he),this.container.innerHTML="",he}},{key:"dangerouslyPasteHTML",value:function(Te,ae){var xe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:b.default.sources.API;if(typeof Te=="string")this.quill.setContents(this.convert(Te),ae),this.quill.setSelection(0,b.default.sources.SILENT);else{var Oe=this.convert(ae);this.quill.updateContents(new h.default().retain(Te).concat(Oe),xe),this.quill.setSelection(Te+Oe.length(),b.default.sources.SILENT)}}},{key:"onPaste",value:function(Te){var ae=this;if(!(Te.defaultPrevented||!this.quill.isEnabled())){var xe=this.quill.getSelection(),Oe=new h.default().retain(xe.index),Be=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(b.default.sources.SILENT),setTimeout(function(){Oe=Oe.concat(ae.convert()).delete(xe.length),ae.quill.updateContents(Oe,b.default.sources.USER),ae.quill.setSelection(Oe.length()-xe.length,b.default.sources.SILENT),ae.quill.scrollingContainer.scrollTop=Be,ae.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var Te=this,ae=[],xe=[];return this.matchers.forEach(function(Oe){var Be=o(Oe,2),ct=Be[0],be=Be[1];switch(ct){case Node.TEXT_NODE:xe.push(be);break;case Node.ELEMENT_NODE:ae.push(be);break;default:[].forEach.call(Te.container.querySelectorAll(ct),function(he){he[q]=he[q]||[],he[q].push(be)});break}}),[ae,xe]}}]),se})(P.default);W.DEFAULTS={matchers:[],matchVisual:!0};function V(ge,se,me){return(typeof se>"u"?"undefined":a(se))==="object"?Object.keys(se).reduce(function(Te,ae){return V(Te,ae,se[ae])},ge):ge.reduce(function(Te,ae){return ae.attributes&&ae.attributes[se]?Te.push(ae):Te.insert(ae.insert,(0,f.default)({},H({},se,me),ae.attributes))},new h.default)}function ee(ge){if(ge.nodeType!==Node.ELEMENT_NODE)return{};var se="__ql-computed-style";return ge[se]||(ge[se]=window.getComputedStyle(ge))}function te(ge,se){for(var me="",Te=ge.ops.length-1;Te>=0&&me.length<se.length;--Te){var ae=ge.ops[Te];if(typeof ae.insert!="string")break;me=ae.insert+me}return me.slice(-1*se.length)===se}function Q(ge){if(ge.childNodes.length===0)return!1;var se=ee(ge);return["block","list-item"].indexOf(se.display)>-1}function ne(ge,se,me){return ge.nodeType===ge.TEXT_NODE?me.reduce(function(Te,ae){return ae(ge,Te)},new h.default):ge.nodeType===ge.ELEMENT_NODE?[].reduce.call(ge.childNodes||[],function(Te,ae){var xe=ne(ae,se,me);return ae.nodeType===ge.ELEMENT_NODE&&(xe=se.reduce(function(Oe,Be){return Be(ae,Oe)},xe),xe=(ae[q]||[]).reduce(function(Oe,Be){return Be(ae,Oe)},xe)),Te.concat(xe)},new h.default):new h.default}function ue(ge,se,me){return V(me,ge,!0)}function oe(ge,se){var me=y.default.Attributor.Attribute.keys(ge),Te=y.default.Attributor.Class.keys(ge),ae=y.default.Attributor.Style.keys(ge),xe={};return me.concat(Te).concat(ae).forEach(function(Oe){var Be=y.default.query(Oe,y.default.Scope.ATTRIBUTE);Be!=null&&(xe[Be.attrName]=Be.value(ge),xe[Be.attrName])||(Be=U[Oe],Be!=null&&(Be.attrName===Oe||Be.keyName===Oe)&&(xe[Be.attrName]=Be.value(ge)||void 0),Be=D[Oe],Be!=null&&(Be.attrName===Oe||Be.keyName===Oe)&&(Be=D[Oe],xe[Be.attrName]=Be.value(ge)||void 0))}),Object.keys(xe).length>0&&(se=V(se,xe)),se}function de(ge,se){var me=y.default.query(ge);if(me==null)return se;if(me.prototype instanceof y.default.Embed){var Te={},ae=me.value(ge);ae!=null&&(Te[me.blotName]=ae,se=new h.default().insert(Te,me.formats(ge)))}else typeof me.formats=="function"&&(se=V(se,me.blotName,me.formats(ge)));return se}function Ee(ge,se){return te(se,`
133
+ `)||se.insert(`
134
+ `),se}function Fe(){return new h.default}function Le(ge,se){var me=y.default.query(ge);if(me==null||me.blotName!=="list-item"||!te(se,`
135
+ `))return se;for(var Te=-1,ae=ge.parentNode;!ae.classList.contains("ql-clipboard");)(y.default.query(ae)||{}).blotName==="list"&&(Te+=1),ae=ae.parentNode;return Te<=0?se:se.compose(new h.default().retain(se.length()-1).retain(1,{indent:Te}))}function $e(ge,se){return te(se,`
136
+ `)||(Q(ge)||se.length()>0&&ge.nextSibling&&Q(ge.nextSibling))&&se.insert(`
137
+ `),se}function Xe(ge,se){if(Q(ge)&&ge.nextElementSibling!=null&&!te(se,`
138
+
139
+ `)){var me=ge.offsetHeight+parseFloat(ee(ge).marginTop)+parseFloat(ee(ge).marginBottom);ge.nextElementSibling.offsetTop>ge.offsetTop+me*1.5&&se.insert(`
140
+ `)}return se}function dt(ge,se){var me={},Te=ge.style||{};return Te.fontStyle&&ee(ge).fontStyle==="italic"&&(me.italic=!0),Te.fontWeight&&(ee(ge).fontWeight.startsWith("bold")||parseInt(ee(ge).fontWeight)>=700)&&(me.bold=!0),Object.keys(me).length>0&&(se=V(se,me)),parseFloat(Te.textIndent||0)>0&&(se=new h.default().insert(" ").concat(se)),se}function ke(ge,se){var me=ge.data;if(ge.parentNode.tagName==="O:P")return se.insert(me.trim());if(me.trim().length===0&&ge.parentNode.classList.contains("ql-clipboard"))return se;if(!ee(ge.parentNode).whiteSpace.startsWith("pre")){var Te=function(xe,Oe){return Oe=Oe.replace(/[^\u00a0]/g,""),Oe.length<1&&xe?" ":Oe};me=me.replace(/\r\n/g," ").replace(/\n/g," "),me=me.replace(/\s\s+/g,Te.bind(Te,!0)),(ge.previousSibling==null&&Q(ge.parentNode)||ge.previousSibling!=null&&Q(ge.previousSibling))&&(me=me.replace(/^\s+/,Te.bind(Te,!1))),(ge.nextSibling==null&&Q(ge.parentNode)||ge.nextSibling!=null&&Q(ge.nextSibling))&&(me=me.replace(/\s+$/,Te.bind(Te,!1)))}return se.insert(me)}n.default=W,n.matchAttributor=oe,n.matchBlot=de,n.matchNewline=$e,n.matchSpacing=Xe,n.matchText=ke}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(b,x){for(var k=0;k<x.length;k++){var S=x[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,x,k){return x&&v(b.prototype,x),k&&v(b,k),b}})(),o=function v(b,x,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,x);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,x,k)}else{if("value"in S)return S.value;var _=S.get;return _===void 0?void 0:_.call(k)}},s=i(6),u=f(s);function f(v){return v&&v.__esModule?v:{default:v}}function d(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function h(v,b){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:v}function p(v,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);v.prototype=Object.create(b&&b.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(v,b):v.__proto__=b)}var y=(function(v){p(b,v);function b(){return d(this,b),h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return a(b,[{key:"optimize",value:function(k){o(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"optimize",this).call(this,k),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return o(b.__proto__||Object.getPrototypeOf(b),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),b})(u.default);y.blotName="bold",y.tagName=["STRONG","B"],n.default=y}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.addControls=n.default=void 0;var a=(function(){function N(F,H){var $=[],X=!0,Z=!1,K=void 0;try{for(var q=F[Symbol.iterator](),J;!(X=(J=q.next()).done)&&($.push(J.value),!(H&&$.length===H));X=!0);}catch(U){Z=!0,K=U}finally{try{!X&&q.return&&q.return()}finally{if(Z)throw K}}return $}return function(F,H){if(Array.isArray(F))return F;if(Symbol.iterator in Object(F))return N(F,H);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function N(F,H){for(var $=0;$<H.length;$++){var X=H[$];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(F,X.key,X)}}return function(F,H,$){return H&&N(F.prototype,H),$&&N(F,$),F}})(),s=i(2),u=k(s),f=i(0),d=k(f),h=i(5),p=k(h),y=i(10),v=k(y),b=i(9),x=k(b);function k(N){return N&&N.__esModule?N:{default:N}}function S(N,F,H){return F in N?Object.defineProperty(N,F,{value:H,enumerable:!0,configurable:!0,writable:!0}):N[F]=H,N}function P(N,F){if(!(N instanceof F))throw new TypeError("Cannot call a class as a function")}function _(N,F){if(!N)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F&&(typeof F=="object"||typeof F=="function")?F:N}function E(N,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof F);N.prototype=Object.create(F&&F.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),F&&(Object.setPrototypeOf?Object.setPrototypeOf(N,F):N.__proto__=F)}var A=(0,v.default)("quill:toolbar"),T=(function(N){E(F,N);function F(H,$){P(this,F);var X=_(this,(F.__proto__||Object.getPrototypeOf(F)).call(this,H,$));if(Array.isArray(X.options.container)){var Z=document.createElement("div");L(Z,X.options.container),H.container.parentNode.insertBefore(Z,H.container),X.container=Z}else typeof X.options.container=="string"?X.container=document.querySelector(X.options.container):X.container=X.options.container;if(!(X.container instanceof HTMLElement)){var K;return K=A.error("Container required for toolbar",X.options),_(X,K)}return X.container.classList.add("ql-toolbar"),X.controls=[],X.handlers={},Object.keys(X.options.handlers).forEach(function(q){X.addHandler(q,X.options.handlers[q])}),[].forEach.call(X.container.querySelectorAll("button, select"),function(q){X.attach(q)}),X.quill.on(p.default.events.EDITOR_CHANGE,function(q,J){q===p.default.events.SELECTION_CHANGE&&X.update(J)}),X.quill.on(p.default.events.SCROLL_OPTIMIZE,function(){var q=X.quill.selection.getRange(),J=a(q,1),U=J[0];X.update(U)}),X}return o(F,[{key:"addHandler",value:function($,X){this.handlers[$]=X}},{key:"attach",value:function($){var X=this,Z=[].find.call($.classList,function(q){return q.indexOf("ql-")===0});if(Z){if(Z=Z.slice(3),$.tagName==="BUTTON"&&$.setAttribute("type","button"),this.handlers[Z]==null){if(this.quill.scroll.whitelist!=null&&this.quill.scroll.whitelist[Z]==null){A.warn("ignoring attaching to disabled format",Z,$);return}if(d.default.query(Z)==null){A.warn("ignoring attaching to nonexistent format",Z,$);return}}var K=$.tagName==="SELECT"?"change":"click";$.addEventListener(K,function(q){var J=void 0;if($.tagName==="SELECT"){if($.selectedIndex<0)return;var U=$.options[$.selectedIndex];U.hasAttribute("selected")?J=!1:J=U.value||!1}else $.classList.contains("ql-active")?J=!1:J=$.value||!$.hasAttribute("value"),q.preventDefault();X.quill.focus();var D=X.quill.selection.getRange(),W=a(D,1),V=W[0];if(X.handlers[Z]!=null)X.handlers[Z].call(X,J);else if(d.default.query(Z).prototype instanceof d.default.Embed){if(J=prompt("Enter "+Z),!J)return;X.quill.updateContents(new u.default().retain(V.index).delete(V.length).insert(S({},Z,J)),p.default.sources.USER)}else X.quill.format(Z,J,p.default.sources.USER);X.update(V)}),this.controls.push([Z,$])}}},{key:"update",value:function($){var X=$==null?{}:this.quill.getFormat($);this.controls.forEach(function(Z){var K=a(Z,2),q=K[0],J=K[1];if(J.tagName==="SELECT"){var U=void 0;if($==null)U=null;else if(X[q]==null)U=J.querySelector("option[selected]");else if(!Array.isArray(X[q])){var D=X[q];typeof D=="string"&&(D=D.replace(/\"/g,'\\"')),U=J.querySelector('option[value="'+D+'"]')}U==null?(J.value="",J.selectedIndex=-1):U.selected=!0}else if($==null)J.classList.remove("ql-active");else if(J.hasAttribute("value")){var W=X[q]===J.getAttribute("value")||X[q]!=null&&X[q].toString()===J.getAttribute("value")||X[q]==null&&!J.getAttribute("value");J.classList.toggle("ql-active",W)}else J.classList.toggle("ql-active",X[q]!=null)})}}]),F})(x.default);T.DEFAULTS={};function I(N,F,H){var $=document.createElement("button");$.setAttribute("type","button"),$.classList.add("ql-"+F),H!=null&&($.value=H),N.appendChild($)}function L(N,F){Array.isArray(F[0])||(F=[F]),F.forEach(function(H){var $=document.createElement("span");$.classList.add("ql-formats"),H.forEach(function(X){if(typeof X=="string")I($,X);else{var Z=Object.keys(X)[0],K=X[Z];Array.isArray(K)?R($,Z,K):I($,Z,K)}}),N.appendChild($)})}function R(N,F,H){var $=document.createElement("select");$.classList.add("ql-"+F),H.forEach(function(X){var Z=document.createElement("option");X!==!1?Z.setAttribute("value",X):Z.setAttribute("selected","selected"),$.appendChild(Z)}),N.appendChild($)}T.DEFAULTS={container:null,handlers:{clean:function(){var F=this,H=this.quill.getSelection();if(H!=null)if(H.length==0){var $=this.quill.getFormat();Object.keys($).forEach(function(X){d.default.query(X,d.default.Scope.INLINE)!=null&&F.quill.format(X,!1)})}else this.quill.removeFormat(H,p.default.sources.USER)},direction:function(F){var H=this.quill.getFormat().align;F==="rtl"&&H==null?this.quill.format("align","right",p.default.sources.USER):!F&&H==="right"&&this.quill.format("align",!1,p.default.sources.USER),this.quill.format("direction",F,p.default.sources.USER)},indent:function(F){var H=this.quill.getSelection(),$=this.quill.getFormat(H),X=parseInt($.indent||0);if(F==="+1"||F==="-1"){var Z=F==="+1"?1:-1;$.direction==="rtl"&&(Z*=-1),this.quill.format("indent",X+Z,p.default.sources.USER)}},link:function(F){F===!0&&(F=prompt("Enter link URL:")),this.quill.format("link",F,p.default.sources.USER)},list:function(F){var H=this.quill.getSelection(),$=this.quill.getFormat(H);F==="check"?$.list==="checked"||$.list==="unchecked"?this.quill.format("list",!1,p.default.sources.USER):this.quill.format("list","unchecked",p.default.sources.USER):this.quill.format("list",F,p.default.sources.USER)}}},n.default=T,n.addControls=L}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(b,x){for(var k=0;k<x.length;k++){var S=x[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,x,k){return x&&v(b.prototype,x),k&&v(b,k),b}})(),o=function v(b,x,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,x);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,x,k)}else{if("value"in S)return S.value;var _=S.get;return _===void 0?void 0:_.call(k)}},s=i(28),u=f(s);function f(v){return v&&v.__esModule?v:{default:v}}function d(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function h(v,b){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:v}function p(v,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);v.prototype=Object.create(b&&b.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(v,b):v.__proto__=b)}var y=(function(v){p(b,v);function b(x,k){d(this,b);var S=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x));return S.label.innerHTML=k,S.container.classList.add("ql-color-picker"),[].slice.call(S.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(P){P.classList.add("ql-primary")}),S}return a(b,[{key:"buildItem",value:function(k){var S=o(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"buildItem",this).call(this,k);return S.style.backgroundColor=k.getAttribute("value")||"",S}},{key:"selectItem",value:function(k,S){o(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"selectItem",this).call(this,k,S);var P=this.label.querySelector(".ql-color-label"),_=k&&k.getAttribute("data-value")||"";P&&(P.tagName==="line"?P.style.stroke=_:P.style.fill=_)}}]),b})(u.default);n.default=y}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(b,x){for(var k=0;k<x.length;k++){var S=x[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,x,k){return x&&v(b.prototype,x),k&&v(b,k),b}})(),o=function v(b,x,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,x);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,x,k)}else{if("value"in S)return S.value;var _=S.get;return _===void 0?void 0:_.call(k)}},s=i(28),u=f(s);function f(v){return v&&v.__esModule?v:{default:v}}function d(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function h(v,b){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:v}function p(v,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);v.prototype=Object.create(b&&b.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(v,b):v.__proto__=b)}var y=(function(v){p(b,v);function b(x,k){d(this,b);var S=h(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x));return S.container.classList.add("ql-icon-picker"),[].forEach.call(S.container.querySelectorAll(".ql-picker-item"),function(P){P.innerHTML=k[P.getAttribute("data-value")||""]}),S.defaultItem=S.container.querySelector(".ql-selected"),S.selectItem(S.defaultItem),S}return a(b,[{key:"selectItem",value:function(k,S){o(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"selectItem",this).call(this,k,S),k=k||this.defaultItem,this.label.innerHTML=k.innerHTML}}]),b})(u.default);n.default=y}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function u(f,d){for(var h=0;h<d.length;h++){var p=d[h];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(f,p.key,p)}}return function(f,d,h){return d&&u(f.prototype,d),h&&u(f,h),f}})();function o(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}var s=(function(){function u(f,d){var h=this;o(this,u),this.quill=f,this.boundsContainer=d||document.body,this.root=f.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){h.root.style.marginTop=-1*h.quill.root.scrollTop+"px"}),this.hide()}return a(u,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(d){var h=d.left+d.width/2-this.root.offsetWidth/2,p=d.bottom+this.quill.root.scrollTop;this.root.style.left=h+"px",this.root.style.top=p+"px",this.root.classList.remove("ql-flip");var y=this.boundsContainer.getBoundingClientRect(),v=this.root.getBoundingClientRect(),b=0;if(v.right>y.right&&(b=y.right-v.right,this.root.style.left=h+b+"px"),v.left<y.left&&(b=y.left-v.left,this.root.style.left=h+b+"px"),v.bottom>y.bottom){var x=v.bottom-v.top,k=d.bottom-d.top+x;this.root.style.top=p-k+"px",this.root.classList.add("ql-flip")}return b}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),u})();n.default=s}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function R(N,F){var H=[],$=!0,X=!1,Z=void 0;try{for(var K=N[Symbol.iterator](),q;!($=(q=K.next()).done)&&(H.push(q.value),!(F&&H.length===F));$=!0);}catch(J){X=!0,Z=J}finally{try{!$&&K.return&&K.return()}finally{if(X)throw Z}}return H}return function(N,F){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return R(N,F);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=function R(N,F,H){N===null&&(N=Function.prototype);var $=Object.getOwnPropertyDescriptor(N,F);if($===void 0){var X=Object.getPrototypeOf(N);return X===null?void 0:R(X,F,H)}else{if("value"in $)return $.value;var Z=$.get;return Z===void 0?void 0:Z.call(H)}},s=(function(){function R(N,F){for(var H=0;H<F.length;H++){var $=F[H];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(N,$.key,$)}}return function(N,F,H){return F&&R(N.prototype,F),H&&R(N,H),N}})(),u=i(3),f=P(u),d=i(8),h=P(d),p=i(43),y=P(p),v=i(27),b=P(v),x=i(15),k=i(41),S=P(k);function P(R){return R&&R.__esModule?R:{default:R}}function _(R,N){if(!(R instanceof N))throw new TypeError("Cannot call a class as a function")}function E(R,N){if(!R)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return N&&(typeof N=="object"||typeof N=="function")?N:R}function A(R,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);R.prototype=Object.create(N&&N.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(R,N):R.__proto__=N)}var T=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],I=(function(R){A(N,R);function N(F,H){_(this,N),H.modules.toolbar!=null&&H.modules.toolbar.container==null&&(H.modules.toolbar.container=T);var $=E(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,F,H));return $.quill.container.classList.add("ql-snow"),$}return s(N,[{key:"extendToolbar",value:function(H){H.container.classList.add("ql-snow"),this.buildButtons([].slice.call(H.container.querySelectorAll("button")),S.default),this.buildPickers([].slice.call(H.container.querySelectorAll("select")),S.default),this.tooltip=new L(this.quill,this.options.bounds),H.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function($,X){H.handlers.link.call(H,!X.format.link)})}}]),N})(y.default);I.DEFAULTS=(0,f.default)(!0,{},y.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(N){if(N){var F=this.quill.getSelection();if(F==null||F.length==0)return;var H=this.quill.getText(F);/^\S+@\S+\.\S+$/.test(H)&&H.indexOf("mailto:")!==0&&(H="mailto:"+H);var $=this.quill.theme.tooltip;$.edit("link",H)}else this.quill.format("link",!1)}}}}});var L=(function(R){A(N,R);function N(F,H){_(this,N);var $=E(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,F,H));return $.preview=$.root.querySelector("a.ql-preview"),$}return s(N,[{key:"listen",value:function(){var H=this;o(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function($){H.root.classList.contains("ql-editing")?H.save():H.edit("link",H.preview.textContent),$.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function($){if(H.linkRange!=null){var X=H.linkRange;H.restoreFocus(),H.quill.formatText(X,"link",!1,h.default.sources.USER),delete H.linkRange}$.preventDefault(),H.hide()}),this.quill.on(h.default.events.SELECTION_CHANGE,function($,X,Z){if($!=null){if($.length===0&&Z===h.default.sources.USER){var K=H.quill.scroll.descendant(b.default,$.index),q=a(K,2),J=q[0],U=q[1];if(J!=null){H.linkRange=new x.Range($.index-U,J.length());var D=b.default.formats(J.domNode);H.preview.textContent=D,H.preview.setAttribute("href",D),H.show(),H.position(H.quill.getBounds(H.linkRange));return}}else delete H.linkRange;H.hide()}})}},{key:"show",value:function(){o(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),N})(p.BaseTooltip);L.TEMPLATE=['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""),n.default=I}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(29),o=ae(a),s=i(36),u=i(38),f=i(64),d=i(65),h=ae(d),p=i(66),y=ae(p),v=i(67),b=ae(v),x=i(37),k=i(26),S=i(39),P=i(40),_=i(56),E=ae(_),A=i(68),T=ae(A),I=i(27),L=ae(I),R=i(69),N=ae(R),F=i(70),H=ae(F),$=i(71),X=ae($),Z=i(72),K=ae(Z),q=i(73),J=ae(q),U=i(13),D=ae(U),W=i(74),V=ae(W),ee=i(75),te=ae(ee),Q=i(57),ne=ae(Q),ue=i(41),oe=ae(ue),de=i(28),Ee=ae(de),Fe=i(59),Le=ae(Fe),$e=i(60),Xe=ae($e),dt=i(61),ke=ae(dt),ge=i(108),se=ae(ge),me=i(62),Te=ae(me);function ae(xe){return xe&&xe.__esModule?xe:{default:xe}}o.default.register({"attributors/attribute/direction":u.DirectionAttribute,"attributors/class/align":s.AlignClass,"attributors/class/background":x.BackgroundClass,"attributors/class/color":k.ColorClass,"attributors/class/direction":u.DirectionClass,"attributors/class/font":S.FontClass,"attributors/class/size":P.SizeClass,"attributors/style/align":s.AlignStyle,"attributors/style/background":x.BackgroundStyle,"attributors/style/color":k.ColorStyle,"attributors/style/direction":u.DirectionStyle,"attributors/style/font":S.FontStyle,"attributors/style/size":P.SizeStyle},!0),o.default.register({"formats/align":s.AlignClass,"formats/direction":u.DirectionClass,"formats/indent":f.IndentClass,"formats/background":x.BackgroundStyle,"formats/color":k.ColorStyle,"formats/font":S.FontClass,"formats/size":P.SizeClass,"formats/blockquote":h.default,"formats/code-block":D.default,"formats/header":y.default,"formats/list":b.default,"formats/bold":E.default,"formats/code":U.Code,"formats/italic":T.default,"formats/link":L.default,"formats/script":N.default,"formats/strike":H.default,"formats/underline":X.default,"formats/image":K.default,"formats/video":J.default,"formats/list/item":v.ListItem,"modules/formula":V.default,"modules/syntax":te.default,"modules/toolbar":ne.default,"themes/bubble":se.default,"themes/snow":Te.default,"ui/icons":oe.default,"ui/picker":Ee.default,"ui/icon-picker":Xe.default,"ui/color-picker":Le.default,"ui/tooltip":ke.default},!0),n.default=o.default}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.IndentClass=void 0;var a=(function(){function b(x,k){for(var S=0;S<k.length;S++){var P=k[S];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(x,P.key,P)}}return function(x,k,S){return k&&b(x.prototype,k),S&&b(x,S),x}})(),o=function b(x,k,S){x===null&&(x=Function.prototype);var P=Object.getOwnPropertyDescriptor(x,k);if(P===void 0){var _=Object.getPrototypeOf(x);return _===null?void 0:b(_,k,S)}else{if("value"in P)return P.value;var E=P.get;return E===void 0?void 0:E.call(S)}},s=i(0),u=f(s);function f(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function h(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function p(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var y=(function(b){p(x,b);function x(){return d(this,x),h(this,(x.__proto__||Object.getPrototypeOf(x)).apply(this,arguments))}return a(x,[{key:"add",value:function(S,P){if(P==="+1"||P==="-1"){var _=this.value(S)||0;P=P==="+1"?_+1:_-1}return P===0?(this.remove(S),!0):o(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"add",this).call(this,S,P)}},{key:"canAdd",value:function(S,P){return o(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"canAdd",this).call(this,S,P)||o(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"canAdd",this).call(this,S,parseInt(P))}},{key:"value",value:function(S){return parseInt(o(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"value",this).call(this,S))||void 0}}]),x})(u.default.Attributor.Class),v=new y("indent","ql-indent",{scope:u.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});n.IndentClass=v}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(4),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}function u(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function f(p,y){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:p}function d(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(p,y):p.__proto__=y)}var h=(function(p){d(y,p);function y(){return u(this,y),f(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);h.blotName="blockquote",h.tagName="blockquote",n.default=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function y(v,b){for(var x=0;x<b.length;x++){var k=b[x];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(v,k.key,k)}}return function(v,b,x){return b&&y(v.prototype,b),x&&y(v,x),v}})(),o=i(4),s=u(o);function u(y){return y&&y.__esModule?y:{default:y}}function f(y,v){if(!(y instanceof v))throw new TypeError("Cannot call a class as a function")}function d(y,v){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:y}function h(y,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);y.prototype=Object.create(v&&v.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(y,v):y.__proto__=v)}var p=(function(y){h(v,y);function v(){return f(this,v),d(this,(v.__proto__||Object.getPrototypeOf(v)).apply(this,arguments))}return a(v,null,[{key:"formats",value:function(x){return this.tagName.indexOf(x.tagName)+1}}]),v})(s.default);p.blotName="header",p.tagName=["H1","H2","H3","H4","H5","H6"],n.default=p}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.ListItem=void 0;var a=(function(){function _(E,A){for(var T=0;T<A.length;T++){var I=A[T];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(E,I.key,I)}}return function(E,A,T){return A&&_(E.prototype,A),T&&_(E,T),E}})(),o=function _(E,A,T){E===null&&(E=Function.prototype);var I=Object.getOwnPropertyDescriptor(E,A);if(I===void 0){var L=Object.getPrototypeOf(E);return L===null?void 0:_(L,A,T)}else{if("value"in I)return I.value;var R=I.get;return R===void 0?void 0:R.call(T)}},s=i(0),u=y(s),f=i(4),d=y(f),h=i(25),p=y(h);function y(_){return _&&_.__esModule?_:{default:_}}function v(_,E,A){return E in _?Object.defineProperty(_,E,{value:A,enumerable:!0,configurable:!0,writable:!0}):_[E]=A,_}function b(_,E){if(!(_ instanceof E))throw new TypeError("Cannot call a class as a function")}function x(_,E){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E&&(typeof E=="object"||typeof E=="function")?E:_}function k(_,E){if(typeof E!="function"&&E!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof E);_.prototype=Object.create(E&&E.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),E&&(Object.setPrototypeOf?Object.setPrototypeOf(_,E):_.__proto__=E)}var S=(function(_){k(E,_);function E(){return b(this,E),x(this,(E.__proto__||Object.getPrototypeOf(E)).apply(this,arguments))}return a(E,[{key:"format",value:function(T,I){T===P.blotName&&!I?this.replaceWith(u.default.create(this.statics.scope)):o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"format",this).call(this,T,I)}},{key:"remove",value:function(){this.prev==null&&this.next==null?this.parent.remove():o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(T,I){return this.parent.isolate(this.offset(this.parent),this.length()),T===this.parent.statics.blotName?(this.parent.replaceWith(T,I),this):(this.parent.unwrap(),o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"replaceWith",this).call(this,T,I))}}],[{key:"formats",value:function(T){return T.tagName===this.tagName?void 0:o(E.__proto__||Object.getPrototypeOf(E),"formats",this).call(this,T)}}]),E})(d.default);S.blotName="list-item",S.tagName="LI";var P=(function(_){k(E,_),a(E,null,[{key:"create",value:function(T){var I=T==="ordered"?"OL":"UL",L=o(E.__proto__||Object.getPrototypeOf(E),"create",this).call(this,I);return(T==="checked"||T==="unchecked")&&L.setAttribute("data-checked",T==="checked"),L}},{key:"formats",value:function(T){if(T.tagName==="OL")return"ordered";if(T.tagName==="UL")return T.hasAttribute("data-checked")?T.getAttribute("data-checked")==="true"?"checked":"unchecked":"bullet"}}]);function E(A){b(this,E);var T=x(this,(E.__proto__||Object.getPrototypeOf(E)).call(this,A)),I=function(R){if(R.target.parentNode===A){var N=T.statics.formats(A),F=u.default.find(R.target);N==="checked"?F.format("list","unchecked"):N==="unchecked"&&F.format("list","checked")}};return A.addEventListener("touchstart",I),A.addEventListener("mousedown",I),T}return a(E,[{key:"format",value:function(T,I){this.children.length>0&&this.children.tail.format(T,I)}},{key:"formats",value:function(){return v({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(T,I){if(T instanceof S)o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"insertBefore",this).call(this,T,I);else{var L=I==null?this.length():I.offset(this),R=this.split(L);R.parent.insertBefore(T,R)}}},{key:"optimize",value:function(T){o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"optimize",this).call(this,T);var I=this.next;I!=null&&I.prev===this&&I.statics.blotName===this.statics.blotName&&I.domNode.tagName===this.domNode.tagName&&I.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(I.moveChildren(this),I.remove())}},{key:"replace",value:function(T){if(T.statics.blotName!==this.statics.blotName){var I=u.default.create(this.statics.defaultChild);T.moveChildren(I),this.appendChild(I)}o(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"replace",this).call(this,T)}}]),E})(p.default);P.blotName="list",P.scope=u.default.Scope.BLOCK_BLOT,P.tagName=["OL","UL"],P.defaultChild="list-item",P.allowedChildren=[S],n.ListItem=S,n.default=P}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(56),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}function u(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function f(p,y){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:p}function d(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(p,y):p.__proto__=y)}var h=(function(p){d(y,p);function y(){return u(this,y),f(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);h.blotName="italic",h.tagName=["EM","I"],n.default=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(b,x){for(var k=0;k<x.length;k++){var S=x[k];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(b,S.key,S)}}return function(b,x,k){return x&&v(b.prototype,x),k&&v(b,k),b}})(),o=function v(b,x,k){b===null&&(b=Function.prototype);var S=Object.getOwnPropertyDescriptor(b,x);if(S===void 0){var P=Object.getPrototypeOf(b);return P===null?void 0:v(P,x,k)}else{if("value"in S)return S.value;var _=S.get;return _===void 0?void 0:_.call(k)}},s=i(6),u=f(s);function f(v){return v&&v.__esModule?v:{default:v}}function d(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function h(v,b){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:v}function p(v,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);v.prototype=Object.create(b&&b.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(v,b):v.__proto__=b)}var y=(function(v){p(b,v);function b(){return d(this,b),h(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return a(b,null,[{key:"create",value:function(k){return k==="super"?document.createElement("sup"):k==="sub"?document.createElement("sub"):o(b.__proto__||Object.getPrototypeOf(b),"create",this).call(this,k)}},{key:"formats",value:function(k){if(k.tagName==="SUB")return"sub";if(k.tagName==="SUP")return"super"}}]),b})(u.default);y.blotName="script",y.tagName=["SUB","SUP"],n.default=y}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(6),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}function u(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function f(p,y){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:p}function d(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(p,y):p.__proto__=y)}var h=(function(p){d(y,p);function y(){return u(this,y),f(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);h.blotName="strike",h.tagName="S",n.default=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(6),o=s(a);function s(p){return p&&p.__esModule?p:{default:p}}function u(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")}function f(p,y){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:p}function d(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);p.prototype=Object.create(y&&y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(p,y):p.__proto__=y)}var h=(function(p){d(y,p);function y(){return u(this,y),f(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);h.blotName="underline",h.tagName="U",n.default=h}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(k,S){for(var P=0;P<S.length;P++){var _=S[P];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}return function(k,S,P){return S&&x(k.prototype,S),P&&x(k,P),k}})(),o=function x(k,S,P){k===null&&(k=Function.prototype);var _=Object.getOwnPropertyDescriptor(k,S);if(_===void 0){var E=Object.getPrototypeOf(k);return E===null?void 0:x(E,S,P)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(P)}},s=i(0),u=d(s),f=i(27);function d(x){return x&&x.__esModule?x:{default:x}}function h(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}function p(x,k){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:x}function y(x,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);x.prototype=Object.create(k&&k.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(x,k):x.__proto__=k)}var v=["alt","height","width"],b=(function(x){y(k,x);function k(){return h(this,k),p(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}return a(k,[{key:"format",value:function(P,_){v.indexOf(P)>-1?_?this.domNode.setAttribute(P,_):this.domNode.removeAttribute(P):o(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"format",this).call(this,P,_)}}],[{key:"create",value:function(P){var _=o(k.__proto__||Object.getPrototypeOf(k),"create",this).call(this,P);return typeof P=="string"&&_.setAttribute("src",this.sanitize(P)),_}},{key:"formats",value:function(P){return v.reduce(function(_,E){return P.hasAttribute(E)&&(_[E]=P.getAttribute(E)),_},{})}},{key:"match",value:function(P){return/\.(jpe?g|gif|png)$/.test(P)||/^data:image\/.+;base64/.test(P)}},{key:"sanitize",value:function(P){return(0,f.sanitize)(P,["http","https","data"])?P:"//:0"}},{key:"value",value:function(P){return P.getAttribute("src")}}]),k})(u.default.Embed);b.blotName="image",b.tagName="IMG",n.default=b}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(k,S){for(var P=0;P<S.length;P++){var _=S[P];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}return function(k,S,P){return S&&x(k.prototype,S),P&&x(k,P),k}})(),o=function x(k,S,P){k===null&&(k=Function.prototype);var _=Object.getOwnPropertyDescriptor(k,S);if(_===void 0){var E=Object.getPrototypeOf(k);return E===null?void 0:x(E,S,P)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(P)}},s=i(4),u=i(27),f=d(u);function d(x){return x&&x.__esModule?x:{default:x}}function h(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}function p(x,k){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:x}function y(x,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);x.prototype=Object.create(k&&k.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(x,k):x.__proto__=k)}var v=["height","width"],b=(function(x){y(k,x);function k(){return h(this,k),p(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}return a(k,[{key:"format",value:function(P,_){v.indexOf(P)>-1?_?this.domNode.setAttribute(P,_):this.domNode.removeAttribute(P):o(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"format",this).call(this,P,_)}}],[{key:"create",value:function(P){var _=o(k.__proto__||Object.getPrototypeOf(k),"create",this).call(this,P);return _.setAttribute("frameborder","0"),_.setAttribute("allowfullscreen",!0),_.setAttribute("src",this.sanitize(P)),_}},{key:"formats",value:function(P){return v.reduce(function(_,E){return P.hasAttribute(E)&&(_[E]=P.getAttribute(E)),_},{})}},{key:"sanitize",value:function(P){return f.default.sanitize(P)}},{key:"value",value:function(P){return P.getAttribute("src")}}]),k})(s.BlockEmbed);b.blotName="video",b.className="ql-video",b.tagName="IFRAME",n.default=b}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.FormulaBlot=void 0;var a=(function(){function P(_,E){for(var A=0;A<E.length;A++){var T=E[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}return function(_,E,A){return E&&P(_.prototype,E),A&&P(_,A),_}})(),o=function P(_,E,A){_===null&&(_=Function.prototype);var T=Object.getOwnPropertyDescriptor(_,E);if(T===void 0){var I=Object.getPrototypeOf(_);return I===null?void 0:P(I,E,A)}else{if("value"in T)return T.value;var L=T.get;return L===void 0?void 0:L.call(A)}},s=i(35),u=y(s),f=i(5),d=y(f),h=i(9),p=y(h);function y(P){return P&&P.__esModule?P:{default:P}}function v(P,_){if(!(P instanceof _))throw new TypeError("Cannot call a class as a function")}function b(P,_){if(!P)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:P}function x(P,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);P.prototype=Object.create(_&&_.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(P,_):P.__proto__=_)}var k=(function(P){x(_,P);function _(){return v(this,_),b(this,(_.__proto__||Object.getPrototypeOf(_)).apply(this,arguments))}return a(_,null,[{key:"create",value:function(A){var T=o(_.__proto__||Object.getPrototypeOf(_),"create",this).call(this,A);return typeof A=="string"&&(window.katex.render(A,T,{throwOnError:!1,errorColor:"#f00"}),T.setAttribute("data-value",A)),T}},{key:"value",value:function(A){return A.getAttribute("data-value")}}]),_})(u.default);k.blotName="formula",k.className="ql-formula",k.tagName="SPAN";var S=(function(P){x(_,P),a(_,null,[{key:"register",value:function(){d.default.register(k,!0)}}]);function _(){v(this,_);var E=b(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));if(window.katex==null)throw new Error("Formula module requires KaTeX.");return E}return _})(p.default);n.FormulaBlot=k,n.default=S}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.CodeToken=n.CodeBlock=void 0;var a=(function(){function A(T,I){for(var L=0;L<I.length;L++){var R=I[L];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}return function(T,I,L){return I&&A(T.prototype,I),L&&A(T,L),T}})(),o=function A(T,I,L){T===null&&(T=Function.prototype);var R=Object.getOwnPropertyDescriptor(T,I);if(R===void 0){var N=Object.getPrototypeOf(T);return N===null?void 0:A(N,I,L)}else{if("value"in R)return R.value;var F=R.get;return F===void 0?void 0:F.call(L)}},s=i(0),u=b(s),f=i(5),d=b(f),h=i(9),p=b(h),y=i(13),v=b(y);function b(A){return A&&A.__esModule?A:{default:A}}function x(A,T){if(!(A instanceof T))throw new TypeError("Cannot call a class as a function")}function k(A,T){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T&&(typeof T=="object"||typeof T=="function")?T:A}function S(A,T){if(typeof T!="function"&&T!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof T);A.prototype=Object.create(T&&T.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),T&&(Object.setPrototypeOf?Object.setPrototypeOf(A,T):A.__proto__=T)}var P=(function(A){S(T,A);function T(){return x(this,T),k(this,(T.__proto__||Object.getPrototypeOf(T)).apply(this,arguments))}return a(T,[{key:"replaceWith",value:function(L){this.domNode.textContent=this.domNode.textContent,this.attach(),o(T.prototype.__proto__||Object.getPrototypeOf(T.prototype),"replaceWith",this).call(this,L)}},{key:"highlight",value:function(L){var R=this.domNode.textContent;this.cachedText!==R&&((R.trim().length>0||this.cachedText==null)&&(this.domNode.innerHTML=L(R),this.domNode.normalize(),this.attach()),this.cachedText=R)}}]),T})(v.default);P.className="ql-syntax";var _=new u.default.Attributor.Class("token","hljs",{scope:u.default.Scope.INLINE}),E=(function(A){S(T,A),a(T,null,[{key:"register",value:function(){d.default.register(_,!0),d.default.register(P,!0)}}]);function T(I,L){x(this,T);var R=k(this,(T.__proto__||Object.getPrototypeOf(T)).call(this,I,L));if(typeof R.options.highlight!="function")throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var N=null;return R.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(N),N=setTimeout(function(){R.highlight(),N=null},R.options.interval)}),R.highlight(),R}return a(T,[{key:"highlight",value:function(){var L=this;if(!this.quill.selection.composing){this.quill.update(d.default.sources.USER);var R=this.quill.getSelection();this.quill.scroll.descendants(P).forEach(function(N){N.highlight(L.options.highlight)}),this.quill.update(d.default.sources.SILENT),R!=null&&this.quill.setSelection(R,d.default.sources.SILENT)}}}]),T})(p.default);E.DEFAULTS={highlight:(function(){return window.hljs==null?null:function(A){var T=window.hljs.highlightAuto(A);return T.value}})(),interval:1e3},n.CodeBlock=P,n.CodeToken=_,n.default=E}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <g class="ql-fill ql-color-label"> <polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>'}),(function(r,n){r.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>'}),(function(r,n){r.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>'}),(function(r,n){r.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class="ql-even ql-stroke" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class="ql-even ql-stroke" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class="ql-stroke ql-thin" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class="ql-stroke ql-thin" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'}),(function(r,n){r.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BubbleTooltip=void 0;var a=function T(I,L,R){I===null&&(I=Function.prototype);var N=Object.getOwnPropertyDescriptor(I,L);if(N===void 0){var F=Object.getPrototypeOf(I);return F===null?void 0:T(F,L,R)}else{if("value"in N)return N.value;var H=N.get;return H===void 0?void 0:H.call(R)}},o=(function(){function T(I,L){for(var R=0;R<L.length;R++){var N=L[R];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(I,N.key,N)}}return function(I,L,R){return L&&T(I.prototype,L),R&&T(I,R),I}})(),s=i(3),u=x(s),f=i(8),d=x(f),h=i(43),p=x(h),y=i(15),v=i(41),b=x(v);function x(T){return T&&T.__esModule?T:{default:T}}function k(T,I){if(!(T instanceof I))throw new TypeError("Cannot call a class as a function")}function S(T,I){if(!T)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:T}function P(T,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);T.prototype=Object.create(I&&I.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(T,I):T.__proto__=I)}var _=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],E=(function(T){P(I,T);function I(L,R){k(this,I),R.modules.toolbar!=null&&R.modules.toolbar.container==null&&(R.modules.toolbar.container=_);var N=S(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,L,R));return N.quill.container.classList.add("ql-bubble"),N}return o(I,[{key:"extendToolbar",value:function(R){this.tooltip=new A(this.quill,this.options.bounds),this.tooltip.root.appendChild(R.container),this.buildButtons([].slice.call(R.container.querySelectorAll("button")),b.default),this.buildPickers([].slice.call(R.container.querySelectorAll("select")),b.default)}}]),I})(p.default);E.DEFAULTS=(0,u.default)(!0,{},p.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(I){I?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var A=(function(T){P(I,T);function I(L,R){k(this,I);var N=S(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,L,R));return N.quill.on(d.default.events.EDITOR_CHANGE,function(F,H,$,X){if(F===d.default.events.SELECTION_CHANGE)if(H!=null&&H.length>0&&X===d.default.sources.USER){N.show(),N.root.style.left="0px",N.root.style.width="",N.root.style.width=N.root.offsetWidth+"px";var Z=N.quill.getLines(H.index,H.length);if(Z.length===1)N.position(N.quill.getBounds(H));else{var K=Z[Z.length-1],q=N.quill.getIndex(K),J=Math.min(K.length()-1,H.index+H.length-q),U=N.quill.getBounds(new y.Range(q,J));N.position(U)}}else document.activeElement!==N.textbox&&N.quill.hasFocus()&&N.hide()}),N}return o(I,[{key:"listen",value:function(){var R=this;a(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){R.root.classList.remove("ql-editing")}),this.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!R.root.classList.contains("ql-hidden")){var N=R.quill.getSelection();N!=null&&R.position(R.quill.getBounds(N))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(R){var N=a(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"position",this).call(this,R),F=this.root.querySelector(".ql-tooltip-arrow");if(F.style.marginLeft="",N===0)return N;F.style.marginLeft=-1*N-F.offsetWidth/2+"px"}}]),I})(h.BaseTooltip);A.TEMPLATE=['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""),n.BubbleTooltip=A,n.default=E}),(function(r,n,i){r.exports=i(63)})]).default})})(wg)),wg.exports}var kA=SA();const Rk=Ec(kA);var xg={exports:{}},ac={},Gh={exports:{}};var _A=Gh.exports,B3;function PA(){return B3||(B3=1,(function(t,e){(function(r){var n=e&&!e.nodeType&&e,i=t&&!t.nodeType&&t,a=typeof Tg=="object"&&Tg;(a.global===a||a.window===a||a.self===a)&&(r=a);var o,s=2147483647,u=36,f=1,d=26,h=38,p=700,y=72,v=128,b="-",x=/^xn--/,k=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,P={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=u-f,E=Math.floor,A=String.fromCharCode,T;function I(U){throw new RangeError(P[U])}function L(U,D){for(var W=U.length,V=[];W--;)V[W]=D(U[W]);return V}function R(U,D){var W=U.split("@"),V="";W.length>1&&(V=W[0]+"@",U=W[1]),U=U.replace(S,".");var ee=U.split("."),te=L(ee,D).join(".");return V+te}function N(U){for(var D=[],W=0,V=U.length,ee,te;W<V;)ee=U.charCodeAt(W++),ee>=55296&&ee<=56319&&W<V?(te=U.charCodeAt(W++),(te&64512)==56320?D.push(((ee&1023)<<10)+(te&1023)+65536):(D.push(ee),W--)):D.push(ee);return D}function F(U){return L(U,function(D){var W="";return D>65535&&(D-=65536,W+=A(D>>>10&1023|55296),D=56320|D&1023),W+=A(D),W}).join("")}function H(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:u}function $(U,D){return U+22+75*(U<26)-((D!=0)<<5)}function X(U,D,W){var V=0;for(U=W?E(U/p):U>>1,U+=E(U/D);U>_*d>>1;V+=u)U=E(U/_);return E(V+(_+1)*U/(U+h))}function Z(U){var D=[],W=U.length,V,ee=0,te=v,Q=y,ne,ue,oe,de,Ee,Fe,Le,$e,Xe;for(ne=U.lastIndexOf(b),ne<0&&(ne=0),ue=0;ue<ne;++ue)U.charCodeAt(ue)>=128&&I("not-basic"),D.push(U.charCodeAt(ue));for(oe=ne>0?ne+1:0;oe<W;){for(de=ee,Ee=1,Fe=u;oe>=W&&I("invalid-input"),Le=H(U.charCodeAt(oe++)),(Le>=u||Le>E((s-ee)/Ee))&&I("overflow"),ee+=Le*Ee,$e=Fe<=Q?f:Fe>=Q+d?d:Fe-Q,!(Le<$e);Fe+=u)Xe=u-$e,Ee>E(s/Xe)&&I("overflow"),Ee*=Xe;V=D.length+1,Q=X(ee-de,V,de==0),E(ee/V)>s-te&&I("overflow"),te+=E(ee/V),ee%=V,D.splice(ee++,0,te)}return F(D)}function K(U){var D,W,V,ee,te,Q,ne,ue,oe,de,Ee,Fe=[],Le,$e,Xe,dt;for(U=N(U),Le=U.length,D=v,W=0,te=y,Q=0;Q<Le;++Q)Ee=U[Q],Ee<128&&Fe.push(A(Ee));for(V=ee=Fe.length,ee&&Fe.push(b);V<Le;){for(ne=s,Q=0;Q<Le;++Q)Ee=U[Q],Ee>=D&&Ee<ne&&(ne=Ee);for($e=V+1,ne-D>E((s-W)/$e)&&I("overflow"),W+=(ne-D)*$e,D=ne,Q=0;Q<Le;++Q)if(Ee=U[Q],Ee<D&&++W>s&&I("overflow"),Ee==D){for(ue=W,oe=u;de=oe<=te?f:oe>=te+d?d:oe-te,!(ue<de);oe+=u)dt=ue-de,Xe=u-de,Fe.push(A($(de+dt%Xe,0))),ue=E(dt/Xe);Fe.push(A($(ue,0))),te=X(W,$e,V==ee),W=0,++V}++W,++D}return Fe.join("")}function q(U){return R(U,function(D){return x.test(D)?Z(D.slice(4).toLowerCase()):D})}function J(U){return R(U,function(D){return k.test(D)?"xn--"+K(D):D})}if(o={version:"1.4.1",ucs2:{decode:N,encode:F},decode:Z,encode:K,toASCII:J,toUnicode:q},n&&i)if(t.exports==n)i.exports=o;else for(T in o)o.hasOwnProperty(T)&&(n[T]=o[T]);else r.punycode=o})(_A)})(Gh,Gh.exports)),Gh.exports}var X1,z3;function Ad(){return z3||(z3=1,X1=TypeError),X1}const EA={},TA=Object.freeze(Object.defineProperty({__proto__:null,default:EA},Symbol.toStringTag,{value:"Module"})),CA=j6(TA);var Y1,j3;function w0(){if(j3)return Y1;j3=1;var t=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=t&&e&&typeof e.get=="function"?e.get:null,n=t&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,a=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=i&&a&&typeof a.get=="function"?a.get:null,s=i&&Set.prototype.forEach,u=typeof WeakMap=="function"&&WeakMap.prototype,f=u?WeakMap.prototype.has:null,d=typeof WeakSet=="function"&&WeakSet.prototype,h=d?WeakSet.prototype.has:null,p=typeof WeakRef=="function"&&WeakRef.prototype,y=p?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,b=Object.prototype.toString,x=Function.prototype.toString,k=String.prototype.match,S=String.prototype.slice,P=String.prototype.replace,_=String.prototype.toUpperCase,E=String.prototype.toLowerCase,A=RegExp.prototype.test,T=Array.prototype.concat,I=Array.prototype.join,L=Array.prototype.slice,R=Math.floor,N=typeof BigInt=="function"?BigInt.prototype.valueOf:null,F=Object.getOwnPropertySymbols,H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",X=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===$||!0)?Symbol.toStringTag:null,Z=Object.prototype.propertyIsEnumerable,K=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(ve){return ve.__proto__}:null);function q(ve,Ce){if(ve===1/0||ve===-1/0||ve!==ve||ve&&ve>-1e3&&ve<1e3||A.call(/e/,Ce))return Ce;var Pt=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof ve=="number"){var Ot=ve<0?-R(-ve):R(ve);if(Ot!==ve){var Et=String(Ot),pt=S.call(Ce,Et.length+1);return P.call(Et,Pt,"$&_")+"."+P.call(P.call(pt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(Ce,Pt,"$&_")}var J=CA,U=J.custom,D=$e(U)?U:null,W={__proto__:null,double:'"',single:"'"},V={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Y1=function ve(Ce,Pt,Ot,Et){var pt=Pt||{};if(ke(pt,"quoteStyle")&&!ke(W,pt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ke(pt,"maxStringLength")&&(typeof pt.maxStringLength=="number"?pt.maxStringLength<0&&pt.maxStringLength!==1/0:pt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Bt=ke(pt,"customInspect")?pt.customInspect:!0;if(typeof Bt!="boolean"&&Bt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ke(pt,"indent")&&pt.indent!==null&&pt.indent!==" "&&!(parseInt(pt.indent,10)===pt.indent&&pt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ke(pt,"numericSeparator")&&typeof pt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Br=pt.numericSeparator;if(typeof Ce>"u")return"undefined";if(Ce===null)return"null";if(typeof Ce=="boolean")return Ce?"true":"false";if(typeof Ce=="string")return be(Ce,pt);if(typeof Ce=="number"){if(Ce===0)return 1/0/Ce>0?"0":"-0";var Yt=String(Ce);return Br?q(Ce,Yt):Yt}if(typeof Ce=="bigint"){var dr=String(Ce)+"n";return Br?q(Ce,dr):dr}var on=typeof pt.depth>"u"?5:pt.depth;if(typeof Ot>"u"&&(Ot=0),Ot>=on&&on>0&&typeof Ce=="object")return ne(Ce)?"[Array]":"[Object]";var Vr=at(pt,Ot);if(typeof Et>"u")Et=[];else if(me(Et,Ce)>=0)return"[Circular]";function yr(_i,La,Fc){if(La&&(Et=L.call(Et),Et.push(La)),Fc){var _u={depth:pt.depth};return ke(pt,"quoteStyle")&&(_u.quoteStyle=pt.quoteStyle),ve(_i,_u,Ot+1,Et)}return ve(_i,pt,Ot+1,Et)}if(typeof Ce=="function"&&!oe(Ce)){var Hi=se(Ce),Rn=ht(Ce,yr);return"[Function"+(Hi?": "+Hi:" (anonymous)")+"]"+(Rn.length>0?" { "+I.call(Rn,", ")+" }":"")}if($e(Ce)){var Da=$?P.call(String(Ce),/^(Symbol\(.*\))_[^)]*$/,"$1"):H.call(Ce);return typeof Ce=="object"&&!$?Ve(Da):Da}if(ct(Ce)){for(var ai="<"+E.call(String(Ce.nodeName)),ca=Ce.attributes||[],Wn=0;Wn<ca.length;Wn++)ai+=" "+ca[Wn].name+"="+ee(te(ca[Wn].value),"double",pt);return ai+=">",Ce.childNodes&&Ce.childNodes.length&&(ai+="..."),ai+="</"+E.call(String(Ce.nodeName))+">",ai}if(ne(Ce)){if(Ce.length===0)return"[]";var oi=ht(Ce,yr);return Vr&&!Ye(oi)?"["+Ze(oi,Vr)+"]":"[ "+I.call(oi,", ")+" ]"}if(de(Ce)){var $i=ht(Ce,yr);return!("cause"in Error.prototype)&&"cause"in Ce&&!Z.call(Ce,"cause")?"{ ["+String(Ce)+"] "+I.call(T.call("[cause]: "+yr(Ce.cause),$i),", ")+" }":$i.length===0?"["+String(Ce)+"]":"{ ["+String(Ce)+"] "+I.call($i,", ")+" }"}if(typeof Ce=="object"&&Bt){if(D&&typeof Ce[D]=="function"&&J)return J(Ce,{depth:on-Ot});if(Bt!=="symbol"&&typeof Ce.inspect=="function")return Ce.inspect()}if(Te(Ce)){var si=[];return n&&n.call(Ce,function(_i,La){si.push(yr(La,Ce,!0)+" => "+yr(_i,Ce))}),Ie("Map",r.call(Ce),si,Vr)}if(Oe(Ce)){var nl=[];return s&&s.call(Ce,function(_i){nl.push(yr(_i,Ce))}),Ie("Set",o.call(Ce),nl,Vr)}if(ae(Ce))return le("WeakMap");if(Be(Ce))return le("WeakSet");if(xe(Ce))return le("WeakRef");if(Fe(Ce))return Ve(yr(Number(Ce)));if(Xe(Ce))return Ve(yr(N.call(Ce)));if(Le(Ce))return Ve(v.call(Ce));if(Ee(Ce))return Ve(yr(String(Ce)));if(typeof window<"u"&&Ce===window)return"{ [object Window] }";if(typeof globalThis<"u"&&Ce===globalThis||typeof Tg<"u"&&Ce===Tg)return"{ [object globalThis] }";if(!ue(Ce)&&!oe(Ce)){var Na=ht(Ce,yr),Qo=K?K(Ce)===Object.prototype:Ce instanceof Object||Ce.constructor===Object,Gn=Ce instanceof Object?"":"null prototype",Zo=!Qo&&X&&Object(Ce)===Ce&&X in Ce?S.call(ge(Ce),8,-1):Gn?"Object":"",li=Qo||typeof Ce.constructor!="function"?"":Ce.constructor.name?Ce.constructor.name+" ":"",co=li+(Zo||Gn?"["+I.call(T.call([],Zo||[],Gn||[]),": ")+"] ":"");return Na.length===0?co+"{}":Vr?co+"{"+Ze(Na,Vr)+"}":co+"{ "+I.call(Na,", ")+" }"}return String(Ce)};function ee(ve,Ce,Pt){var Ot=Pt.quoteStyle||Ce,Et=W[Ot];return Et+ve+Et}function te(ve){return P.call(String(ve),/"/g,"&quot;")}function Q(ve){return!X||!(typeof ve=="object"&&(X in ve||typeof ve[X]<"u"))}function ne(ve){return ge(ve)==="[object Array]"&&Q(ve)}function ue(ve){return ge(ve)==="[object Date]"&&Q(ve)}function oe(ve){return ge(ve)==="[object RegExp]"&&Q(ve)}function de(ve){return ge(ve)==="[object Error]"&&Q(ve)}function Ee(ve){return ge(ve)==="[object String]"&&Q(ve)}function Fe(ve){return ge(ve)==="[object Number]"&&Q(ve)}function Le(ve){return ge(ve)==="[object Boolean]"&&Q(ve)}function $e(ve){if($)return ve&&typeof ve=="object"&&ve instanceof Symbol;if(typeof ve=="symbol")return!0;if(!ve||typeof ve!="object"||!H)return!1;try{return H.call(ve),!0}catch{}return!1}function Xe(ve){if(!ve||typeof ve!="object"||!N)return!1;try{return N.call(ve),!0}catch{}return!1}var dt=Object.prototype.hasOwnProperty||function(ve){return ve in this};function ke(ve,Ce){return dt.call(ve,Ce)}function ge(ve){return b.call(ve)}function se(ve){if(ve.name)return ve.name;var Ce=k.call(x.call(ve),/^function\s*([\w$]+)/);return Ce?Ce[1]:null}function me(ve,Ce){if(ve.indexOf)return ve.indexOf(Ce);for(var Pt=0,Ot=ve.length;Pt<Ot;Pt++)if(ve[Pt]===Ce)return Pt;return-1}function Te(ve){if(!r||!ve||typeof ve!="object")return!1;try{r.call(ve);try{o.call(ve)}catch{return!0}return ve instanceof Map}catch{}return!1}function ae(ve){if(!f||!ve||typeof ve!="object")return!1;try{f.call(ve,f);try{h.call(ve,h)}catch{return!0}return ve instanceof WeakMap}catch{}return!1}function xe(ve){if(!y||!ve||typeof ve!="object")return!1;try{return y.call(ve),!0}catch{}return!1}function Oe(ve){if(!o||!ve||typeof ve!="object")return!1;try{o.call(ve);try{r.call(ve)}catch{return!0}return ve instanceof Set}catch{}return!1}function Be(ve){if(!h||!ve||typeof ve!="object")return!1;try{h.call(ve,h);try{f.call(ve,f)}catch{return!0}return ve instanceof WeakSet}catch{}return!1}function ct(ve){return!ve||typeof ve!="object"?!1:typeof HTMLElement<"u"&&ve instanceof HTMLElement?!0:typeof ve.nodeName=="string"&&typeof ve.getAttribute=="function"}function be(ve,Ce){if(ve.length>Ce.maxStringLength){var Pt=ve.length-Ce.maxStringLength,Ot="... "+Pt+" more character"+(Pt>1?"s":"");return be(S.call(ve,0,Ce.maxStringLength),Ce)+Ot}var Et=V[Ce.quoteStyle||"single"];Et.lastIndex=0;var pt=P.call(P.call(ve,Et,"\\$1"),/[\x00-\x1f]/g,he);return ee(pt,"single",Ce)}function he(ve){var Ce=ve.charCodeAt(0),Pt={8:"b",9:"t",10:"n",12:"f",13:"r"}[Ce];return Pt?"\\"+Pt:"\\x"+(Ce<16?"0":"")+_.call(Ce.toString(16))}function Ve(ve){return"Object("+ve+")"}function le(ve){return ve+" { ? }"}function Ie(ve,Ce,Pt,Ot){var Et=Ot?Ze(Pt,Ot):I.call(Pt,", ");return ve+" ("+Ce+") {"+Et+"}"}function Ye(ve){for(var Ce=0;Ce<ve.length;Ce++)if(me(ve[Ce],`
141
+ `)>=0)return!1;return!0}function at(ve,Ce){var Pt;if(ve.indent===" ")Pt=" ";else if(typeof ve.indent=="number"&&ve.indent>0)Pt=I.call(Array(ve.indent+1)," ");else return null;return{base:Pt,prev:I.call(Array(Ce+1),Pt)}}function Ze(ve,Ce){if(ve.length===0)return"";var Pt=`
142
+ `+Ce.prev+Ce.base;return Pt+I.call(ve,","+Pt)+`
143
+ `+Ce.prev}function ht(ve,Ce){var Pt=ne(ve),Ot=[];if(Pt){Ot.length=ve.length;for(var Et=0;Et<ve.length;Et++)Ot[Et]=ke(ve,Et)?Ce(ve[Et],ve):""}var pt=typeof F=="function"?F(ve):[],Bt;if($){Bt={};for(var Br=0;Br<pt.length;Br++)Bt["$"+pt[Br]]=pt[Br]}for(var Yt in ve)ke(ve,Yt)&&(Pt&&String(Number(Yt))===Yt&&Yt<ve.length||$&&Bt["$"+Yt]instanceof Symbol||(A.call(/[^\w$]/,Yt)?Ot.push(Ce(Yt,ve)+": "+Ce(ve[Yt],ve)):Ot.push(Yt+": "+Ce(ve[Yt],ve))));if(typeof F=="function")for(var dr=0;dr<pt.length;dr++)Z.call(ve,pt[dr])&&Ot.push("["+Ce(pt[dr])+"]: "+Ce(ve[pt[dr]],ve));return Ot}return Y1}var K1,U3;function OA(){if(U3)return K1;U3=1;var t=w0(),e=Ad(),r=function(s,u,f){for(var d=s,h;(h=d.next)!=null;d=h)if(h.key===u)return d.next=h.next,f||(h.next=s.next,s.next=h),h},n=function(s,u){if(s){var f=r(s,u);return f&&f.value}},i=function(s,u,f){var d=r(s,u);d?d.value=f:s.next={key:u,next:s.next,value:f}},a=function(s,u){return s?!!r(s,u):!1},o=function(s,u){if(s)return r(s,u,!0)};return K1=function(){var u,f={assert:function(d){if(!f.has(d))throw new e("Side channel does not contain "+t(d))},delete:function(d){var h=u&&u.next,p=o(u,d);return p&&h&&h===p&&(u=void 0),!!p},get:function(d){return n(u,d)},has:function(d){return a(u,d)},set:function(d,h){u||(u={next:void 0}),i(u,d,h)}};return f},K1}var Q1,H3;function Mk(){return H3||(H3=1,Q1=Object),Q1}var Z1,$3;function AA(){return $3||($3=1,Z1=Error),Z1}var J1,q3;function IA(){return q3||(q3=1,J1=EvalError),J1}var ey,V3;function RA(){return V3||(V3=1,ey=RangeError),ey}var ty,W3;function MA(){return W3||(W3=1,ty=ReferenceError),ty}var ry,G3;function DA(){return G3||(G3=1,ry=SyntaxError),ry}var ny,X3;function NA(){return X3||(X3=1,ny=URIError),ny}var iy,Y3;function LA(){return Y3||(Y3=1,iy=Math.abs),iy}var ay,K3;function FA(){return K3||(K3=1,ay=Math.floor),ay}var oy,Q3;function BA(){return Q3||(Q3=1,oy=Math.max),oy}var sy,Z3;function zA(){return Z3||(Z3=1,sy=Math.min),sy}var ly,J3;function jA(){return J3||(J3=1,ly=Math.pow),ly}var uy,e4;function UA(){return e4||(e4=1,uy=Math.round),uy}var cy,t4;function HA(){return t4||(t4=1,cy=Number.isNaN||function(e){return e!==e}),cy}var fy,r4;function $A(){if(r4)return fy;r4=1;var t=HA();return fy=function(r){return t(r)||r===0?r:r<0?-1:1},fy}var dy,n4;function qA(){return n4||(n4=1,dy=Object.getOwnPropertyDescriptor),dy}var hy,i4;function Dk(){if(i4)return hy;i4=1;var t=qA();if(t)try{t([],"length")}catch{t=null}return hy=t,hy}var py,a4;function VA(){if(a4)return py;a4=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return py=t,py}var my,o4;function WA(){return o4||(o4=1,my=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,r);if(s.value!==i||s.enumerable!==!0)return!1}return!0}),my}var gy,s4;function GA(){if(s4)return gy;s4=1;var t=typeof Symbol<"u"&&Symbol,e=WA();return gy=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},gy}var yy,l4;function Nk(){return l4||(l4=1,yy=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),yy}var vy,u4;function Lk(){if(u4)return vy;u4=1;var t=Mk();return vy=t.getPrototypeOf||null,vy}var by,c4;function XA(){if(c4)return by;c4=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(u,f){for(var d=[],h=0;h<u.length;h+=1)d[h]=u[h];for(var p=0;p<f.length;p+=1)d[p+u.length]=f[p];return d},a=function(u,f){for(var d=[],h=f,p=0;h<u.length;h+=1,p+=1)d[p]=u[h];return d},o=function(s,u){for(var f="",d=0;d<s.length;d+=1)f+=s[d],d+1<s.length&&(f+=u);return f};return by=function(u){var f=this;if(typeof f!="function"||e.apply(f)!==n)throw new TypeError(t+f);for(var d=a(arguments,1),h,p=function(){if(this instanceof h){var k=f.apply(this,i(d,arguments));return Object(k)===k?k:this}return f.apply(u,i(d,arguments))},y=r(0,f.length-d.length),v=[],b=0;b<y;b++)v[b]="$"+b;if(h=Function("binder","return function ("+o(v,",")+"){ return binder.apply(this,arguments); }")(p),f.prototype){var x=function(){};x.prototype=f.prototype,h.prototype=new x,x.prototype=null}return h},by}var wy,f4;function x0(){if(f4)return wy;f4=1;var t=XA();return wy=Function.prototype.bind||t,wy}var xy,d4;function U2(){return d4||(d4=1,xy=Function.prototype.call),xy}var Sy,h4;function Fk(){return h4||(h4=1,Sy=Function.prototype.apply),Sy}var ky,p4;function YA(){return p4||(p4=1,ky=typeof Reflect<"u"&&Reflect&&Reflect.apply),ky}var _y,m4;function KA(){if(m4)return _y;m4=1;var t=x0(),e=Fk(),r=U2(),n=YA();return _y=n||t.call(r,e),_y}var Py,g4;function Bk(){if(g4)return Py;g4=1;var t=x0(),e=Ad(),r=U2(),n=KA();return Py=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(t,r,a)},Py}var Ey,y4;function QA(){if(y4)return Ey;y4=1;var t=Bk(),e=Dk(),r;try{r=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!r&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return Ey=n&&typeof n.get=="function"?t([n.get]):typeof a=="function"?function(s){return a(s==null?s:i(s))}:!1,Ey}var Ty,v4;function ZA(){if(v4)return Ty;v4=1;var t=Nk(),e=Lk(),r=QA();return Ty=t?function(i){return t(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:r?function(i){return r(i)}:null,Ty}var Cy,b4;function JA(){if(b4)return Cy;b4=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=x0();return Cy=r.call(t,e),Cy}var Oy,w4;function H2(){if(w4)return Oy;w4=1;var t,e=Mk(),r=AA(),n=IA(),i=RA(),a=MA(),o=DA(),s=Ad(),u=NA(),f=LA(),d=FA(),h=BA(),p=zA(),y=jA(),v=UA(),b=$A(),x=Function,k=function(oe){try{return x('"use strict"; return ('+oe+").constructor;")()}catch{}},S=Dk(),P=VA(),_=function(){throw new s},E=S?(function(){try{return arguments.callee,_}catch{try{return S(arguments,"callee").get}catch{return _}}})():_,A=GA()(),T=ZA(),I=Lk(),L=Nk(),R=Fk(),N=U2(),F={},H=typeof Uint8Array>"u"||!T?t:T(Uint8Array),$={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":A&&T?T([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":F,"%AsyncGenerator%":F,"%AsyncGeneratorFunction%":F,"%AsyncIteratorPrototype%":F,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":x,"%GeneratorFunction%":F,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":A&&T?T(T([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!A||!T?t:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!A||!T?t:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":A&&T?T(""[Symbol.iterator]()):t,"%Symbol%":A?Symbol:t,"%SyntaxError%":o,"%ThrowTypeError%":E,"%TypedArray%":H,"%TypeError%":s,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":N,"%Function.prototype.apply%":R,"%Object.defineProperty%":P,"%Object.getPrototypeOf%":I,"%Math.abs%":f,"%Math.floor%":d,"%Math.max%":h,"%Math.min%":p,"%Math.pow%":y,"%Math.round%":v,"%Math.sign%":b,"%Reflect.getPrototypeOf%":L};if(T)try{null.error}catch(oe){var X=T(T(oe));$["%Error.prototype%"]=X}var Z=function oe(de){var Ee;if(de==="%AsyncFunction%")Ee=k("async function () {}");else if(de==="%GeneratorFunction%")Ee=k("function* () {}");else if(de==="%AsyncGeneratorFunction%")Ee=k("async function* () {}");else if(de==="%AsyncGenerator%"){var Fe=oe("%AsyncGeneratorFunction%");Fe&&(Ee=Fe.prototype)}else if(de==="%AsyncIteratorPrototype%"){var Le=oe("%AsyncGenerator%");Le&&T&&(Ee=T(Le.prototype))}return $[de]=Ee,Ee},K={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},q=x0(),J=JA(),U=q.call(N,Array.prototype.concat),D=q.call(R,Array.prototype.splice),W=q.call(N,String.prototype.replace),V=q.call(N,String.prototype.slice),ee=q.call(N,RegExp.prototype.exec),te=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Q=/\\(\\)?/g,ne=function(de){var Ee=V(de,0,1),Fe=V(de,-1);if(Ee==="%"&&Fe!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(Fe==="%"&&Ee!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var Le=[];return W(de,te,function($e,Xe,dt,ke){Le[Le.length]=dt?W(ke,Q,"$1"):Xe||$e}),Le},ue=function(de,Ee){var Fe=de,Le;if(J(K,Fe)&&(Le=K[Fe],Fe="%"+Le[0]+"%"),J($,Fe)){var $e=$[Fe];if($e===F&&($e=Z(Fe)),typeof $e>"u"&&!Ee)throw new s("intrinsic "+de+" exists, but is not available. Please file an issue!");return{alias:Le,name:Fe,value:$e}}throw new o("intrinsic "+de+" does not exist!")};return Oy=function(de,Ee){if(typeof de!="string"||de.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Ee!="boolean")throw new s('"allowMissing" argument must be a boolean');if(ee(/^%?[^%]*%?$/,de)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Fe=ne(de),Le=Fe.length>0?Fe[0]:"",$e=ue("%"+Le+"%",Ee),Xe=$e.name,dt=$e.value,ke=!1,ge=$e.alias;ge&&(Le=ge[0],D(Fe,U([0,1],ge)));for(var se=1,me=!0;se<Fe.length;se+=1){var Te=Fe[se],ae=V(Te,0,1),xe=V(Te,-1);if((ae==='"'||ae==="'"||ae==="`"||xe==='"'||xe==="'"||xe==="`")&&ae!==xe)throw new o("property names with quotes must have matching quotes");if((Te==="constructor"||!me)&&(ke=!0),Le+="."+Te,Xe="%"+Le+"%",J($,Xe))dt=$[Xe];else if(dt!=null){if(!(Te in dt)){if(!Ee)throw new s("base intrinsic for "+de+" exists, but the property is not available.");return}if(S&&se+1>=Fe.length){var Oe=S(dt,Te);me=!!Oe,me&&"get"in Oe&&!("originalValue"in Oe.get)?dt=Oe.get:dt=dt[Te]}else me=J(dt,Te),dt=dt[Te];me&&!ke&&($[Xe]=dt)}}return dt},Oy}var Ay,x4;function zk(){if(x4)return Ay;x4=1;var t=H2(),e=Bk(),r=e([t("%String.prototype.indexOf%")]);return Ay=function(i,a){var o=t(i,!!a);return typeof o=="function"&&r(i,".prototype.")>-1?e([o]):o},Ay}var Iy,S4;function jk(){if(S4)return Iy;S4=1;var t=H2(),e=zk(),r=w0(),n=Ad(),i=t("%Map%",!0),a=e("Map.prototype.get",!0),o=e("Map.prototype.set",!0),s=e("Map.prototype.has",!0),u=e("Map.prototype.delete",!0),f=e("Map.prototype.size",!0);return Iy=!!i&&function(){var h,p={assert:function(y){if(!p.has(y))throw new n("Side channel does not contain "+r(y))},delete:function(y){if(h){var v=u(h,y);return f(h)===0&&(h=void 0),v}return!1},get:function(y){if(h)return a(h,y)},has:function(y){return h?s(h,y):!1},set:function(y,v){h||(h=new i),o(h,y,v)}};return p},Iy}var Ry,k4;function eI(){if(k4)return Ry;k4=1;var t=H2(),e=zk(),r=w0(),n=jk(),i=Ad(),a=t("%WeakMap%",!0),o=e("WeakMap.prototype.get",!0),s=e("WeakMap.prototype.set",!0),u=e("WeakMap.prototype.has",!0),f=e("WeakMap.prototype.delete",!0);return Ry=a?function(){var h,p,y={assert:function(v){if(!y.has(v))throw new i("Side channel does not contain "+r(v))},delete:function(v){if(a&&v&&(typeof v=="object"||typeof v=="function")){if(h)return f(h,v)}else if(n&&p)return p.delete(v);return!1},get:function(v){return a&&v&&(typeof v=="object"||typeof v=="function")&&h?o(h,v):p&&p.get(v)},has:function(v){return a&&v&&(typeof v=="object"||typeof v=="function")&&h?u(h,v):!!p&&p.has(v)},set:function(v,b){a&&v&&(typeof v=="object"||typeof v=="function")?(h||(h=new a),s(h,v,b)):n&&(p||(p=n()),p.set(v,b))}};return y}:n,Ry}var My,_4;function Uk(){if(_4)return My;_4=1;var t=Ad(),e=w0(),r=OA(),n=jk(),i=eI(),a=i||n||r;return My=function(){var s,u={assert:function(f){if(!u.has(f))throw new t("Side channel does not contain "+e(f))},delete:function(f){return!!s&&s.delete(f)},get:function(f){return s&&s.get(f)},has:function(f){return!!s&&s.has(f)},set:function(f,d){s||(s=a()),s.set(f,d)}};return u},My}var Dy,P4;function $2(){if(P4)return Dy;P4=1;var t=String.prototype.replace,e=/%20/g,r={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Dy={default:r.RFC3986,formatters:{RFC1738:function(n){return t.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:r.RFC1738,RFC3986:r.RFC3986},Dy}var Ny,E4;function Hk(){if(E4)return Ny;E4=1;var t=$2(),e=Uk(),r=Object.prototype.hasOwnProperty,n=Array.isArray,i=e(),a=function(T,I){return i.set(T,I),T},o=function(T){return i.has(T)},s=function(T){return i.get(T)},u=function(T,I){i.set(T,I)},f=(function(){for(var A=[],T=0;T<256;++T)A.push("%"+((T<16?"0":"")+T.toString(16)).toUpperCase());return A})(),d=function(T){for(;T.length>1;){var I=T.pop(),L=I.obj[I.prop];if(n(L)){for(var R=[],N=0;N<L.length;++N)typeof L[N]<"u"&&R.push(L[N]);I.obj[I.prop]=R}}},h=function(T,I){for(var L=I&&I.plainObjects?{__proto__:null}:{},R=0;R<T.length;++R)typeof T[R]<"u"&&(L[R]=T[R]);return L},p=function A(T,I,L){if(!I)return T;if(typeof I!="object"&&typeof I!="function"){if(n(T))T.push(I);else if(T&&typeof T=="object")if(o(T)){var R=s(T)+1;T[R]=I,u(T,R)}else(L&&(L.plainObjects||L.allowPrototypes)||!r.call(Object.prototype,I))&&(T[I]=!0);else return[T,I];return T}if(!T||typeof T!="object"){if(o(I)){for(var N=Object.keys(I),F=L&&L.plainObjects?{__proto__:null,0:T}:{0:T},H=0;H<N.length;H++){var $=parseInt(N[H],10);F[$+1]=I[N[H]]}return a(F,s(I)+1)}return[T].concat(I)}var X=T;return n(T)&&!n(I)&&(X=h(T,L)),n(T)&&n(I)?(I.forEach(function(Z,K){if(r.call(T,K)){var q=T[K];q&&typeof q=="object"&&Z&&typeof Z=="object"?T[K]=A(q,Z,L):T.push(Z)}else T[K]=Z}),T):Object.keys(I).reduce(function(Z,K){var q=I[K];return r.call(Z,K)?Z[K]=A(Z[K],q,L):Z[K]=q,Z},X)},y=function(T,I){return Object.keys(I).reduce(function(L,R){return L[R]=I[R],L},T)},v=function(A,T,I){var L=A.replace(/\+/g," ");if(I==="iso-8859-1")return L.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(L)}catch{return L}},b=1024,x=function(T,I,L,R,N){if(T.length===0)return T;var F=T;if(typeof T=="symbol"?F=Symbol.prototype.toString.call(T):typeof T!="string"&&(F=String(T)),L==="iso-8859-1")return escape(F).replace(/%u[0-9a-f]{4}/gi,function(J){return"%26%23"+parseInt(J.slice(2),16)+"%3B"});for(var H="",$=0;$<F.length;$+=b){for(var X=F.length>=b?F.slice($,$+b):F,Z=[],K=0;K<X.length;++K){var q=X.charCodeAt(K);if(q===45||q===46||q===95||q===126||q>=48&&q<=57||q>=65&&q<=90||q>=97&&q<=122||N===t.RFC1738&&(q===40||q===41)){Z[Z.length]=X.charAt(K);continue}if(q<128){Z[Z.length]=f[q];continue}if(q<2048){Z[Z.length]=f[192|q>>6]+f[128|q&63];continue}if(q<55296||q>=57344){Z[Z.length]=f[224|q>>12]+f[128|q>>6&63]+f[128|q&63];continue}K+=1,q=65536+((q&1023)<<10|X.charCodeAt(K)&1023),Z[Z.length]=f[240|q>>18]+f[128|q>>12&63]+f[128|q>>6&63]+f[128|q&63]}H+=Z.join("")}return H},k=function(T){for(var I=[{obj:{o:T},prop:"o"}],L=[],R=0;R<I.length;++R)for(var N=I[R],F=N.obj[N.prop],H=Object.keys(F),$=0;$<H.length;++$){var X=H[$],Z=F[X];typeof Z=="object"&&Z!==null&&L.indexOf(Z)===-1&&(I.push({obj:F,prop:X}),L.push(Z))}return d(I),T},S=function(T){return Object.prototype.toString.call(T)==="[object RegExp]"},P=function(T){return!T||typeof T!="object"?!1:!!(T.constructor&&T.constructor.isBuffer&&T.constructor.isBuffer(T))},_=function(T,I,L,R){if(o(T)){var N=s(T)+1;return T[N]=I,u(T,N),T}var F=[].concat(T,I);return F.length>L?a(h(F,{plainObjects:R}),F.length-1):F},E=function(T,I){if(n(T)){for(var L=[],R=0;R<T.length;R+=1)L.push(I(T[R]));return L}return I(T)};return Ny={arrayToObject:h,assign:y,combine:_,compact:k,decode:v,encode:x,isBuffer:P,isOverflow:o,isRegExp:S,maybeMap:E,merge:p},Ny}var Ly,T4;function tI(){if(T4)return Ly;T4=1;var t=Uk(),e=Hk(),r=$2(),n=Object.prototype.hasOwnProperty,i={brackets:function(x){return x+"[]"},comma:"comma",indices:function(x,k){return x+"["+k+"]"},repeat:function(x){return x}},a=Array.isArray,o=Array.prototype.push,s=function(b,x){o.apply(b,a(x)?x:[x])},u=Date.prototype.toISOString,f=r.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:f,formatter:r.formatters[f],indices:!1,serializeDate:function(x){return u.call(x)},skipNulls:!1,strictNullHandling:!1},h=function(x){return typeof x=="string"||typeof x=="number"||typeof x=="boolean"||typeof x=="symbol"||typeof x=="bigint"},p={},y=function b(x,k,S,P,_,E,A,T,I,L,R,N,F,H,$,X,Z,K){for(var q=x,J=K,U=0,D=!1;(J=J.get(p))!==void 0&&!D;){var W=J.get(x);if(U+=1,typeof W<"u"){if(W===U)throw new RangeError("Cyclic object value");D=!0}typeof J.get(p)>"u"&&(U=0)}if(typeof L=="function"?q=L(k,q):q instanceof Date?q=F(q):S==="comma"&&a(q)&&(q=e.maybeMap(q,function(Xe){return Xe instanceof Date?F(Xe):Xe})),q===null){if(E)return I&&!X?I(k,d.encoder,Z,"key",H):k;q=""}if(h(q)||e.isBuffer(q)){if(I){var V=X?k:I(k,d.encoder,Z,"key",H);return[$(V)+"="+$(I(q,d.encoder,Z,"value",H))]}return[$(k)+"="+$(String(q))]}var ee=[];if(typeof q>"u")return ee;var te;if(S==="comma"&&a(q))X&&I&&(q=e.maybeMap(q,I)),te=[{value:q.length>0?q.join(",")||null:void 0}];else if(a(L))te=L;else{var Q=Object.keys(q);te=R?Q.sort(R):Q}var ne=T?String(k).replace(/\./g,"%2E"):String(k),ue=P&&a(q)&&q.length===1?ne+"[]":ne;if(_&&a(q)&&q.length===0)return ue+"[]";for(var oe=0;oe<te.length;++oe){var de=te[oe],Ee=typeof de=="object"&&de&&typeof de.value<"u"?de.value:q[de];if(!(A&&Ee===null)){var Fe=N&&T?String(de).replace(/\./g,"%2E"):String(de),Le=a(q)?typeof S=="function"?S(ue,Fe):ue:ue+(N?"."+Fe:"["+Fe+"]");K.set(x,U);var $e=t();$e.set(p,K),s(ee,b(Ee,Le,S,P,_,E,A,T,S==="comma"&&X&&a(q)?null:I,L,R,N,F,H,$,X,Z,$e))}}return ee},v=function(x){if(!x)return d;if(typeof x.allowEmptyArrays<"u"&&typeof x.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof x.encodeDotInKeys<"u"&&typeof x.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(x.encoder!==null&&typeof x.encoder<"u"&&typeof x.encoder!="function")throw new TypeError("Encoder has to be a function.");var k=x.charset||d.charset;if(typeof x.charset<"u"&&x.charset!=="utf-8"&&x.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var S=r.default;if(typeof x.format<"u"){if(!n.call(r.formatters,x.format))throw new TypeError("Unknown format option provided.");S=x.format}var P=r.formatters[S],_=d.filter;(typeof x.filter=="function"||a(x.filter))&&(_=x.filter);var E;if(x.arrayFormat in i?E=x.arrayFormat:"indices"in x?E=x.indices?"indices":"repeat":E=d.arrayFormat,"commaRoundTrip"in x&&typeof x.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var A=typeof x.allowDots>"u"?x.encodeDotInKeys===!0?!0:d.allowDots:!!x.allowDots;return{addQueryPrefix:typeof x.addQueryPrefix=="boolean"?x.addQueryPrefix:d.addQueryPrefix,allowDots:A,allowEmptyArrays:typeof x.allowEmptyArrays=="boolean"?!!x.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:E,charset:k,charsetSentinel:typeof x.charsetSentinel=="boolean"?x.charsetSentinel:d.charsetSentinel,commaRoundTrip:!!x.commaRoundTrip,delimiter:typeof x.delimiter>"u"?d.delimiter:x.delimiter,encode:typeof x.encode=="boolean"?x.encode:d.encode,encodeDotInKeys:typeof x.encodeDotInKeys=="boolean"?x.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof x.encoder=="function"?x.encoder:d.encoder,encodeValuesOnly:typeof x.encodeValuesOnly=="boolean"?x.encodeValuesOnly:d.encodeValuesOnly,filter:_,format:S,formatter:P,serializeDate:typeof x.serializeDate=="function"?x.serializeDate:d.serializeDate,skipNulls:typeof x.skipNulls=="boolean"?x.skipNulls:d.skipNulls,sort:typeof x.sort=="function"?x.sort:null,strictNullHandling:typeof x.strictNullHandling=="boolean"?x.strictNullHandling:d.strictNullHandling}};return Ly=function(b,x){var k=b,S=v(x),P,_;typeof S.filter=="function"?(_=S.filter,k=_("",k)):a(S.filter)&&(_=S.filter,P=_);var E=[];if(typeof k!="object"||k===null)return"";var A=i[S.arrayFormat],T=A==="comma"&&S.commaRoundTrip;P||(P=Object.keys(k)),S.sort&&P.sort(S.sort);for(var I=t(),L=0;L<P.length;++L){var R=P[L],N=k[R];S.skipNulls&&N===null||s(E,y(N,R,A,T,S.allowEmptyArrays,S.strictNullHandling,S.skipNulls,S.encodeDotInKeys,S.encode?S.encoder:null,S.filter,S.sort,S.allowDots,S.serializeDate,S.format,S.formatter,S.encodeValuesOnly,S.charset,I))}var F=E.join(S.delimiter),H=S.addQueryPrefix===!0?"?":"";return S.charsetSentinel&&(S.charset==="iso-8859-1"?H+="utf8=%26%2310003%3B&":H+="utf8=%E2%9C%93&"),F.length>0?H+F:""},Ly}var Fy,C4;function rI(){if(C4)return Fy;C4=1;var t=Hk(),e=Object.prototype.hasOwnProperty,r=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:t.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},i=function(y){return y.replace(/&#(\d+);/g,function(v,b){return String.fromCharCode(parseInt(b,10))})},a=function(y,v,b){if(y&&typeof y=="string"&&v.comma&&y.indexOf(",")>-1)return y.split(",");if(v.throwOnLimitExceeded&&b>=v.arrayLimit)throw new RangeError("Array limit exceeded. Only "+v.arrayLimit+" element"+(v.arrayLimit===1?"":"s")+" allowed in an array.");return y},o="utf8=%26%2310003%3B",s="utf8=%E2%9C%93",u=function(v,b){var x={__proto__:null},k=b.ignoreQueryPrefix?v.replace(/^\?/,""):v;k=k.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var S=b.parameterLimit===1/0?void 0:b.parameterLimit,P=k.split(b.delimiter,b.throwOnLimitExceeded?S+1:S);if(b.throwOnLimitExceeded&&P.length>S)throw new RangeError("Parameter limit exceeded. Only "+S+" parameter"+(S===1?"":"s")+" allowed.");var _=-1,E,A=b.charset;if(b.charsetSentinel)for(E=0;E<P.length;++E)P[E].indexOf("utf8=")===0&&(P[E]===s?A="utf-8":P[E]===o&&(A="iso-8859-1"),_=E,E=P.length);for(E=0;E<P.length;++E)if(E!==_){var T=P[E],I=T.indexOf("]="),L=I===-1?T.indexOf("="):I+1,R,N;if(L===-1?(R=b.decoder(T,n.decoder,A,"key"),N=b.strictNullHandling?null:""):(R=b.decoder(T.slice(0,L),n.decoder,A,"key"),R!==null&&(N=t.maybeMap(a(T.slice(L+1),b,r(x[R])?x[R].length:0),function(H){return b.decoder(H,n.decoder,A,"value")}))),N&&b.interpretNumericEntities&&A==="iso-8859-1"&&(N=i(String(N))),T.indexOf("[]=")>-1&&(N=r(N)?[N]:N),R!==null){var F=e.call(x,R);F&&b.duplicates==="combine"?x[R]=t.combine(x[R],N,b.arrayLimit,b.plainObjects):(!F||b.duplicates==="last")&&(x[R]=N)}}return x},f=function(y,v,b,x){var k=0;if(y.length>0&&y[y.length-1]==="[]"){var S=y.slice(0,-1).join("");k=Array.isArray(v)&&v[S]?v[S].length:0}for(var P=x?v:a(v,b,k),_=y.length-1;_>=0;--_){var E,A=y[_];if(A==="[]"&&b.parseArrays)t.isOverflow(P)?E=P:E=b.allowEmptyArrays&&(P===""||b.strictNullHandling&&P===null)?[]:t.combine([],P,b.arrayLimit,b.plainObjects);else{E=b.plainObjects?{__proto__:null}:{};var T=A.charAt(0)==="["&&A.charAt(A.length-1)==="]"?A.slice(1,-1):A,I=b.decodeDotInKeys?T.replace(/%2E/g,"."):T,L=parseInt(I,10);!b.parseArrays&&I===""?E={0:P}:!isNaN(L)&&A!==I&&String(L)===I&&L>=0&&b.parseArrays&&L<=b.arrayLimit?(E=[],E[L]=P):I!=="__proto__"&&(E[I]=P)}P=E}return P},d=function(v,b){var x=b.allowDots?v.replace(/\.([^.[]+)/g,"[$1]"):v;if(b.depth<=0)return!b.plainObjects&&e.call(Object.prototype,x)&&!b.allowPrototypes?void 0:[x];var k=/(\[[^[\]]*])/,S=/(\[[^[\]]*])/g,P=k.exec(x),_=P?x.slice(0,P.index):x,E=[];if(_){if(!b.plainObjects&&e.call(Object.prototype,_)&&!b.allowPrototypes)return;E.push(_)}for(var A=0;(P=S.exec(x))!==null&&A<b.depth;){A+=1;var T=P[1].slice(1,-1);if(!b.plainObjects&&e.call(Object.prototype,T)&&!b.allowPrototypes)return;E.push(P[1])}if(P){if(b.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+b.depth+" and strictDepth is true");E.push("["+x.slice(P.index)+"]")}return E},h=function(v,b,x,k){if(v){var S=d(v,x);if(S)return f(S,b,x,k)}},p=function(v){if(!v)return n;if(typeof v.allowEmptyArrays<"u"&&typeof v.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof v.decodeDotInKeys<"u"&&typeof v.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(v.decoder!==null&&typeof v.decoder<"u"&&typeof v.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof v.charset<"u"&&v.charset!=="utf-8"&&v.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof v.throwOnLimitExceeded<"u"&&typeof v.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var b=typeof v.charset>"u"?n.charset:v.charset,x=typeof v.duplicates>"u"?n.duplicates:v.duplicates;if(x!=="combine"&&x!=="first"&&x!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var k=typeof v.allowDots>"u"?v.decodeDotInKeys===!0?!0:n.allowDots:!!v.allowDots;return{allowDots:k,allowEmptyArrays:typeof v.allowEmptyArrays=="boolean"?!!v.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof v.allowPrototypes=="boolean"?v.allowPrototypes:n.allowPrototypes,allowSparse:typeof v.allowSparse=="boolean"?v.allowSparse:n.allowSparse,arrayLimit:typeof v.arrayLimit=="number"?v.arrayLimit:n.arrayLimit,charset:b,charsetSentinel:typeof v.charsetSentinel=="boolean"?v.charsetSentinel:n.charsetSentinel,comma:typeof v.comma=="boolean"?v.comma:n.comma,decodeDotInKeys:typeof v.decodeDotInKeys=="boolean"?v.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof v.decoder=="function"?v.decoder:n.decoder,delimiter:typeof v.delimiter=="string"||t.isRegExp(v.delimiter)?v.delimiter:n.delimiter,depth:typeof v.depth=="number"||v.depth===!1?+v.depth:n.depth,duplicates:x,ignoreQueryPrefix:v.ignoreQueryPrefix===!0,interpretNumericEntities:typeof v.interpretNumericEntities=="boolean"?v.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof v.parameterLimit=="number"?v.parameterLimit:n.parameterLimit,parseArrays:v.parseArrays!==!1,plainObjects:typeof v.plainObjects=="boolean"?v.plainObjects:n.plainObjects,strictDepth:typeof v.strictDepth=="boolean"?!!v.strictDepth:n.strictDepth,strictNullHandling:typeof v.strictNullHandling=="boolean"?v.strictNullHandling:n.strictNullHandling,throwOnLimitExceeded:typeof v.throwOnLimitExceeded=="boolean"?v.throwOnLimitExceeded:!1}};return Fy=function(y,v){var b=p(v);if(y===""||y===null||typeof y>"u")return b.plainObjects?{__proto__:null}:{};for(var x=typeof y=="string"?u(y,b):y,k=b.plainObjects?{__proto__:null}:{},S=Object.keys(x),P=0;P<S.length;++P){var _=S[P],E=h(_,x[_],b,typeof y=="string");k=t.merge(k,E,b)}return b.allowSparse===!0?k:t.compact(k)},Fy}var By,O4;function nI(){if(O4)return By;O4=1;var t=tI(),e=rI(),r=$2();return By={formats:r,parse:e,stringify:t},By}var A4;function $k(){if(A4)return ac;A4=1;var t=PA();function e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var r=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,i=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,a=["<",">",'"',"`"," ","\r",`
144
+ `," "],o=["{","}","|","\\","^","`"].concat(a),s=["'"].concat(o),u=["%","/","?",";","#"].concat(s),f=["/","?","#"],d=255,h=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=nI();function k(E,A,T){if(E&&typeof E=="object"&&E instanceof e)return E;var I=new e;return I.parse(E,A,T),I}e.prototype.parse=function(E,A,T){if(typeof E!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof E);var I=E.indexOf("?"),L=I!==-1&&I<E.indexOf("#")?"?":"#",R=E.split(L),N=/\\/g;R[0]=R[0].replace(N,"/"),E=R.join(L);var F=E;if(F=F.trim(),!T&&E.split("#").length===1){var H=i.exec(F);if(H)return this.path=F,this.href=F,this.pathname=H[1],H[2]?(this.search=H[2],A?this.query=x.parse(this.search.substr(1)):this.query=this.search.substr(1)):A&&(this.search="",this.query={}),this}var $=r.exec(F);if($){$=$[0];var X=$.toLowerCase();this.protocol=X,F=F.substr($.length)}if(T||$||F.match(/^\/\/[^@/]+@[^@/]+/)){var Z=F.substr(0,2)==="//";Z&&!($&&v[$])&&(F=F.substr(2),this.slashes=!0)}if(!v[$]&&(Z||$&&!b[$])){for(var K=-1,q=0;q<f.length;q++){var J=F.indexOf(f[q]);J!==-1&&(K===-1||J<K)&&(K=J)}var U,D;K===-1?D=F.lastIndexOf("@"):D=F.lastIndexOf("@",K),D!==-1&&(U=F.slice(0,D),F=F.slice(D+1),this.auth=decodeURIComponent(U)),K=-1;for(var q=0;q<u.length;q++){var J=F.indexOf(u[q]);J!==-1&&(K===-1||J<K)&&(K=J)}K===-1&&(K=F.length),this.host=F.slice(0,K),F=F.slice(K),this.parseHost(),this.hostname=this.hostname||"";var W=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!W)for(var V=this.hostname.split(/\./),q=0,ee=V.length;q<ee;q++){var te=V[q];if(te&&!te.match(h)){for(var Q="",ne=0,ue=te.length;ne<ue;ne++)te.charCodeAt(ne)>127?Q+="x":Q+=te[ne];if(!Q.match(h)){var oe=V.slice(0,q),de=V.slice(q+1),Ee=te.match(p);Ee&&(oe.push(Ee[1]),de.unshift(Ee[2])),de.length&&(F="/"+de.join(".")+F),this.hostname=oe.join(".");break}}}this.hostname.length>d?this.hostname="":this.hostname=this.hostname.toLowerCase(),W||(this.hostname=t.toASCII(this.hostname));var Fe=this.port?":"+this.port:"",Le=this.hostname||"";this.host=Le+Fe,this.href+=this.host,W&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),F[0]!=="/"&&(F="/"+F))}if(!y[X])for(var q=0,ee=s.length;q<ee;q++){var $e=s[q];if(F.indexOf($e)!==-1){var Xe=encodeURIComponent($e);Xe===$e&&(Xe=escape($e)),F=F.split($e).join(Xe)}}var dt=F.indexOf("#");dt!==-1&&(this.hash=F.substr(dt),F=F.slice(0,dt));var ke=F.indexOf("?");if(ke!==-1?(this.search=F.substr(ke),this.query=F.substr(ke+1),A&&(this.query=x.parse(this.query)),F=F.slice(0,ke)):A&&(this.search="",this.query={}),F&&(this.pathname=F),b[X]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Fe=this.pathname||"",ge=this.search||"";this.path=Fe+ge}return this.href=this.format(),this};function S(E){return typeof E=="string"&&(E=k(E)),E instanceof e?E.format():e.prototype.format.call(E)}e.prototype.format=function(){var E=this.auth||"";E&&(E=encodeURIComponent(E),E=E.replace(/%3A/i,":"),E+="@");var A=this.protocol||"",T=this.pathname||"",I=this.hash||"",L=!1,R="";this.host?L=E+this.host:this.hostname&&(L=E+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(L+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(R=x.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var N=this.search||R&&"?"+R||"";return A&&A.substr(-1)!==":"&&(A+=":"),this.slashes||(!A||b[A])&&L!==!1?(L="//"+(L||""),T&&T.charAt(0)!=="/"&&(T="/"+T)):L||(L=""),I&&I.charAt(0)!=="#"&&(I="#"+I),N&&N.charAt(0)!=="?"&&(N="?"+N),T=T.replace(/[?#]/g,function(F){return encodeURIComponent(F)}),N=N.replace("#","%23"),A+L+T+N+I};function P(E,A){return k(E,!1,!0).resolve(A)}e.prototype.resolve=function(E){return this.resolveObject(k(E,!1,!0)).format()};function _(E,A){return E?k(E,!1,!0).resolveObject(A):A}return e.prototype.resolveObject=function(E){if(typeof E=="string"){var A=new e;A.parse(E,!1,!0),E=A}for(var T=new e,I=Object.keys(this),L=0;L<I.length;L++){var R=I[L];T[R]=this[R]}if(T.hash=E.hash,E.href==="")return T.href=T.format(),T;if(E.slashes&&!E.protocol){for(var N=Object.keys(E),F=0;F<N.length;F++){var H=N[F];H!=="protocol"&&(T[H]=E[H])}return b[T.protocol]&&T.hostname&&!T.pathname&&(T.pathname="/",T.path=T.pathname),T.href=T.format(),T}if(E.protocol&&E.protocol!==T.protocol){if(!b[E.protocol]){for(var $=Object.keys(E),X=0;X<$.length;X++){var Z=$[X];T[Z]=E[Z]}return T.href=T.format(),T}if(T.protocol=E.protocol,!E.host&&!v[E.protocol]){for(var ee=(E.pathname||"").split("/");ee.length&&!(E.host=ee.shift()););E.host||(E.host=""),E.hostname||(E.hostname=""),ee[0]!==""&&ee.unshift(""),ee.length<2&&ee.unshift(""),T.pathname=ee.join("/")}else T.pathname=E.pathname;if(T.search=E.search,T.query=E.query,T.host=E.host||"",T.auth=E.auth,T.hostname=E.hostname||E.host,T.port=E.port,T.pathname||T.search){var K=T.pathname||"",q=T.search||"";T.path=K+q}return T.slashes=T.slashes||E.slashes,T.href=T.format(),T}var J=T.pathname&&T.pathname.charAt(0)==="/",U=E.host||E.pathname&&E.pathname.charAt(0)==="/",D=U||J||T.host&&E.pathname,W=D,V=T.pathname&&T.pathname.split("/")||[],ee=E.pathname&&E.pathname.split("/")||[],te=T.protocol&&!b[T.protocol];if(te&&(T.hostname="",T.port=null,T.host&&(V[0]===""?V[0]=T.host:V.unshift(T.host)),T.host="",E.protocol&&(E.hostname=null,E.port=null,E.host&&(ee[0]===""?ee[0]=E.host:ee.unshift(E.host)),E.host=null),D=D&&(ee[0]===""||V[0]==="")),U)T.host=E.host||E.host===""?E.host:T.host,T.hostname=E.hostname||E.hostname===""?E.hostname:T.hostname,T.search=E.search,T.query=E.query,V=ee;else if(ee.length)V||(V=[]),V.pop(),V=V.concat(ee),T.search=E.search,T.query=E.query;else if(E.search!=null){if(te){T.host=V.shift(),T.hostname=T.host;var Q=T.host&&T.host.indexOf("@")>0?T.host.split("@"):!1;Q&&(T.auth=Q.shift(),T.hostname=Q.shift(),T.host=T.hostname)}return T.search=E.search,T.query=E.query,(T.pathname!==null||T.search!==null)&&(T.path=(T.pathname?T.pathname:"")+(T.search?T.search:"")),T.href=T.format(),T}if(!V.length)return T.pathname=null,T.search?T.path="/"+T.search:T.path=null,T.href=T.format(),T;for(var ne=V.slice(-1)[0],ue=(T.host||E.host||V.length>1)&&(ne==="."||ne==="..")||ne==="",oe=0,de=V.length;de>=0;de--)ne=V[de],ne==="."?V.splice(de,1):ne===".."?(V.splice(de,1),oe++):oe&&(V.splice(de,1),oe--);if(!D&&!W)for(;oe--;oe)V.unshift("..");D&&V[0]!==""&&(!V[0]||V[0].charAt(0)!=="/")&&V.unshift(""),ue&&V.join("/").substr(-1)!=="/"&&V.push("");var Ee=V[0]===""||V[0]&&V[0].charAt(0)==="/";if(te){T.hostname=Ee?"":V.length?V.shift():"",T.host=T.hostname;var Q=T.host&&T.host.indexOf("@")>0?T.host.split("@"):!1;Q&&(T.auth=Q.shift(),T.hostname=Q.shift(),T.host=T.hostname)}return D=D||T.host&&V.length,D&&!Ee&&V.unshift(""),V.length>0?T.pathname=V.join("/"):(T.pathname=null,T.path=null),(T.pathname!==null||T.search!==null)&&(T.path=(T.pathname?T.pathname:"")+(T.search?T.search:"")),T.auth=E.auth||T.auth,T.slashes=T.slashes||E.slashes,T.href=T.format(),T},e.prototype.parseHost=function(){var E=this.host,A=n.exec(E);A&&(A=A[0],A!==":"&&(this.port=A.substr(1)),E=E.substr(0,E.length-A.length)),E&&(this.hostname=E)},ac.parse=k,ac.resolve=P,ac.resolveObject=_,ac.format=S,ac.Url=e,ac}var Sg={exports:{}},iI=Sg.exports,I4;function aI(){return I4||(I4=1,(function(t){(function(e,r){t.exports?t.exports=r():e.xmlserializer=r()})(iI,function(){var e=function(y){return y.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"")},r=function(y){return y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")},n=function(y){return y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},i=function(y){var v=y.value;return" "+y.name+'="'+r(v)+'"'},a=function(y){var v=y.tagName;return y.namespaceURI==="http://www.w3.org/1999/xhtml"&&(v=v.toLowerCase()),v},o=function(y,v){var b=Array.prototype.map.call(y.attributes||y.attrs,function(x){return x.name}).indexOf("xmlns")>=0;return!b&&(v||y.namespaceURI!==y.parentNode.namespaceURI)?' xmlns="'+y.namespaceURI+'"':""},s=function(y){return Array.prototype.map.call(y.childNodes,function(v){return p(v)}).join("")},u=function(y,v){var b="<"+a(y);return b+=o(y,v),Array.prototype.forEach.call(y.attributes||y.attrs,function(x){b+=i(x)}),y.childNodes.length>0?(b+=">",b+=s(y),b+="</"+a(y)+">"):b+="/>",b},f=function(y){var v=y.nodeValue||y.value||"";return n(v)},d=function(y){return"<!--"+y.data.replace(/-/g,"&#45;")+"-->"},h=function(y){return"<![CDATA["+y.nodeValue+"]]>"},p=function(y,v){var b=v&&v.rootNode;if(y.nodeName==="#document"||y.nodeName==="#document-fragment")return s(y);if(y.tagName)return u(y,b);if(y.nodeName==="#text")return f(y);if(y.nodeName==="#comment")return d(y);if(y.nodeName==="#cdata-section")return h(y)};return{serializeToString:function(y){return e(p(y,{rootNode:!0}))}}})})(Sg)),Sg.exports}var zy={},R4;function oI(){if(R4)return zy;R4=1;var t=function(a){var o=new XMLSerializer;return Array.prototype.map.call(a.childNodes,function(s){return o.serializeToString(s)}).join("")},e=function(a){if(a.documentElement.tagName==="parsererror"&&a.documentElement.namespaceURI==="http://www.mozilla.org/newlayout/xml/parsererror.xml")return a.documentElement;if((a.documentElement.tagName==="xml"||a.documentElement.tagName==="html")&&a.documentElement.childNodes&&a.documentElement.childNodes.length>0&&a.documentElement.childNodes[0].nodeName==="parsererror")return a.documentElement.childNodes[0];if(a.documentElement.tagName==="html"&&a.documentElement.childNodes&&a.documentElement.childNodes.length>0&&a.documentElement.childNodes[0].nodeName==="body"&&a.documentElement.childNodes[0].childNodes&&a.documentElement.childNodes[0].childNodes.length&&a.documentElement.childNodes[0].childNodes[0].nodeName==="parsererror")return a.documentElement.childNodes[0].childNodes[0]},r=[new RegExp(`^<h3[^>]*>This page contains the following errors:</h3><div[^>]*>(.+?)
145
+ ?</div>`),new RegExp(`^(.+)
146
+ `)],n=function(a){var o=t(a),s,u;for(s=0;s<r.length;s++)if(u=r[s].exec(o),u)return u[1]},i=function(a){var o;if(a===null)throw new Error("Parse error");var s=e(a);if(s!==void 0)throw o=n(s)||"Parse error",new Error(o)};return zy.failOnParseError=function(a){return i(a),a},zy}var jy={},Uy={},M4;function S0(){return M4||(M4=1,(function(t){var e=$k();t.getDocumentBaseUrl=function(s){return s.baseURI!=="about:blank"?s.baseURI:null},t.clone=function(s){var u={},f;for(f in s)s.hasOwnProperty(f)&&(u[f]=s[f]);return u},t.cloneArray=function(s){return Array.prototype.slice.apply(s,[0])},t.joinUrl=function(s,u){return s?e.resolve(s,u):u},t.isDataUri=function(s){return/^data:/.test(s)},t.collectAndReportErrors=function(s){var u=[];return Promise.all(s.map(function(f){return f.catch(function(d){u.push(d)})})).then(function(){return u})};var r=null,n=function(s,u){return u===!1||u==="none"||u==="repeated"?((r===null||u!=="repeated")&&(r=Date.now()),s+"?_="+r):s};t.ajax=function(s,u){return new Promise(function(f,d){var h=new window.XMLHttpRequest,p=t.joinUrl(u.baseUrl,s),y,v=function(){d({msg:"Unable to load url",url:p})};y=n(p,u.cache),h.addEventListener("load",function(){h.status===200||h.status===0?f(h.response):v()},!1),h.addEventListener("error",v,!1);try{h.open("GET",y,!0),h.overrideMimeType(u.mimeType),h.send(null)}catch{v()}})},t.binaryAjax=function(s,u){var f=t.clone(u);return f.mimeType="text/plain; charset=x-user-defined",t.ajax(s,f).then(function(d){for(var h="",p=0;p<d.length;p++)h+=String.fromCharCode(d.charCodeAt(p)&255);return h})};var i=function(s){var u=function(f,d){return f.substring(0,d.length)===d};return u(s,"<?xml")||u(s,"<svg")?"image/svg+xml":"image/png"};t.getDataURIForImageURL=function(s,u){return t.binaryAjax(s,u).then(function(f){var d=btoa(f),h=i(f);return"data:"+h+";base64,"+d})};var a=[],o=function(s){return a.indexOf(s)<0&&a.push(s),a.indexOf(s)};t.memoize=function(s,u,f){if(typeof f!="object")throw new Error("cacheBucket is not an object");return function(){var d=Array.prototype.slice.call(arguments),h=u(d),p=o(s),y;return f[p]&&f[p][h]?f[p][h]:(y=s.apply(null,d),f[p]=f[p]||{},f[p][h]=y,y)}}})(Uy)),Uy}var Hy={},D4;function sI(){if(D4)return Hy;D4=1;var t=S0(),e=function(a,o){var s=null;a.hasAttribute("src")?s=a.getAttribute("src"):a.hasAttributeNS("http://www.w3.org/1999/xlink","href")?s=a.getAttributeNS("http://www.w3.org/1999/xlink","href"):a.hasAttribute("href")&&(s=a.getAttribute("href"));var u=t.getDocumentBaseUrl(a.ownerDocument),f=t.clone(o);return!f.baseUrl&&u&&(f.baseUrl=u),t.getDataURIForImageURL(s,f).then(function(d){return d},function(d){throw{resourceType:"image",url:d.url,msg:"Unable to load image "+d.url}})},r=function(a){return a.filter(function(o){var s=null;return o.hasAttribute("src")?s=o.getAttribute("src"):o.hasAttributeNS("http://www.w3.org/1999/xlink","href")?s=o.getAttributeNS("http://www.w3.org/1999/xlink","href"):o.hasAttribute("href")&&(s=o.getAttribute("href")),s!==null&&!t.isDataUri(s)})},n=function(a){return Array.prototype.filter.call(a,function(o){return o.type==="image"})},i=function(a){return Array.prototype.slice.call(a)};return Hy.inline=function(a,o){var s=i(a.getElementsByTagName("img")),u=i(a.getElementsByTagName("image")),f=n(a.getElementsByTagName("input"));s=s.concat(u),s=s.concat(f);var d=r(s);return t.collectAndReportErrors(d.map(function(h){return e(h,o).then(function(p){h.attributes.src?h.attributes.src.value=p:h.attributes["xlink:href"]?h.attributes["xlink:href"].value=p:h.attributes.href&&(h.attributes.href.value=p)})}))},Hy}var $y={},N4;function lI(){if(N4)return $y;N4=1;var t=S0(),e=function(a,o){var s=a.attributes.src.value,u=t.getDocumentBaseUrl(a.ownerDocument),f=t.clone(o);return!f.baseUrl&&u&&(f.baseUrl=u),t.ajax(s,f).catch(function(d){throw{resourceType:"script",url:d.url,msg:"Unable to load script "+d.url}})},r=function(a){return a.replace(/<\//g,"<\\/")},n=function(a,o){a.attributes.removeNamedItem("src"),a.textContent=r(o)},i=function(a){var o=a.getElementsByTagName("script");return Array.prototype.filter.call(o,function(s){return!!s.attributes.src})};return $y.inline=function(a,o){var s=i(a);return t.collectAndReportErrors(s.map(function(u){return e(u,o).then(function(f){n(u,f)})}))},$y}var qy={},Vy={},L4;function q2(){return L4||(L4=1,(function(t){t.unquoteString=function(e){var r=/^"(.*)"$/,n=/^'(.*)'$/;return r.test(e)?e.replace(r,"$1"):n.test(e)?e.replace(n,"$1"):e},t.rulesForCssText=function(e,r){var n=document.implementation.createHTMLDocument(""),i=document.createElement("style"),a;return i.textContent=e,r&&r.nonce&&(i.nonce=r.nonce),n.body.appendChild(i),a=i.sheet.cssRules,Array.prototype.slice.call(a)},t.cssRulesToText=function(e){return e.reduce(function(r,n){return r+n.cssText},"")},t.exchangeRule=function(e,r,n,i){var a=e.indexOf(r);e[a]=t.rulesForCssText(n,i)[0]},t.changeFontFaceRuleSrc=function(e,r,n,i){var a="@font-face { font-family: "+r.style.getPropertyValue("font-family")+"; ";r.style.getPropertyValue("font-style")&&(a+="font-style: "+r.style.getPropertyValue("font-style")+"; "),r.style.getPropertyValue("font-weight")&&(a+="font-weight: "+r.style.getPropertyValue("font-weight")+"; "),r.style.getPropertyValue("unicode-range")&&(a+="unicode-range: "+r.style.getPropertyValue("unicode-range")+"; "),a+="src: "+n+"}",t.exchangeRule(e,r,a,i)}})(Vy)),Vy}var Wy={},F4;function uI(){return F4||(F4=1,(function(t){var e=q2(),r=function(a){var o=/^[\t\r\f\n ]*(.+?)[\t\r\f\n ]*$/;return a.replace(o,"$1")};t.extractCssUrl=function(a){var o=/^url\(("[^"]+"|'[^']+'|[^\)]+)\)/,s;if(!o.test(a))throw new Error("Invalid url");return s=o.exec(a)[1],e.unquoteString(r(s))};var n=function(a){var o=`\\s*(?:"[^"]*"|'[^']*'|[^\\(]+)\\s*`,s="(url\\("+o+"\\)|[^,\\s]+)",u="(?:\\s*"+s+")+",f="^\\s*("+u+")(?:\\s*,\\s*("+u+"))*\\s*$",d=new RegExp(u,"g"),h,p=[],y=function(v){var b=new RegExp(s,"g"),x=[],k;for(k=b.exec(v);k;)x.push(k[1]),k=b.exec(v);return x};if(a.match(new RegExp(f))){for(h=d.exec(a);h;)p.push(y(h[0])),h=d.exec(a);return p}return[]},i=function(a){var o,s;for(o=0;o<a.length;o++)try{return s=t.extractCssUrl(a[o]),{url:s,idx:o}}catch{}};t.parse=function(a){var o=n(a);return o.map(function(s){var u=i(s);return u?{preUrl:s.slice(0,u.idx),url:u.url,postUrl:s.slice(u.idx+1)}:{preUrl:s}})},t.serialize=function(a){var o=a.map(function(s){var u=[].concat(s.preUrl);return s.url&&u.push('url("'+s.url+'")'),s.postUrl&&(u=u.concat(s.postUrl)),u.join(" ")});return o.join(", ")}})(Wy)),Wy}function cg(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Gy={exports:{}},B4;function cI(){return B4||(B4=1,(function(t,e){(function(r){t.exports=r()})(function(){return(function r(n,i,a){function o(f,d){if(!i[f]){if(!n[f]){var h=typeof cg=="function"&&cg;if(!d&&h)return h(f,!0);if(s)return s(f,!0);var p=new Error("Cannot find module '"+f+"'");throw p.code="MODULE_NOT_FOUND",p}var y=i[f]={exports:{}};n[f][0].call(y.exports,function(v){var b=n[f][1][v];return o(b||v)},y,y.exports,r,n,i,a)}return i[f].exports}for(var s=typeof cg=="function"&&cg,u=0;u<a.length;u++)o(a[u]);return o})({1:[function(r,n,i){function a(u,f){function d(){this.constructor=u}d.prototype=f.prototype,u.prototype=new d}function o(u,f,d,h){this.message=u,this.expected=f,this.found=d,this.location=h,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,o)}a(o,Error),o.buildMessage=function(u,f){var d={literal:function(k){return'"'+p(k.text)+'"'},class:function(k){var S="",P;for(P=0;P<k.parts.length;P++)S+=k.parts[P]instanceof Array?y(k.parts[P][0])+"-"+y(k.parts[P][1]):y(k.parts[P]);return"["+(k.inverted?"^":"")+S+"]"},any:function(k){return"any character"},end:function(k){return"end of input"},other:function(k){return k.description}};function h(k){return k.charCodeAt(0).toString(16).toUpperCase()}function p(k){return k.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(S){return"\\x0"+h(S)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(S){return"\\x"+h(S)})}function y(k){return k.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(S){return"\\x0"+h(S)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(S){return"\\x"+h(S)})}function v(k){return d[k.type](k)}function b(k){var S=new Array(k.length),P,_;for(P=0;P<k.length;P++)S[P]=v(k[P]);if(S.sort(),S.length>0){for(P=1,_=1;P<S.length;P++)S[P-1]!==S[P]&&(S[_]=S[P],_++);S.length=_}switch(S.length){case 1:return S[0];case 2:return S[0]+" or "+S[1];default:return S.slice(0,-1).join(", ")+", or "+S[S.length-1]}}function x(k){return k?'"'+p(k)+'"':"end of input"}return"Expected "+b(u)+" but "+x(f)+" found."};function s(u,f){f=f!==void 0?f:{};var d={},h={start:Fe},p=Fe,y="",v=function(){return[]},b=",",x=te(",",!1),k=function(ae,xe){return[ae].concat(xe)},S=function(ae){return[ae]},P=function(ae,xe){return{url:ae,format:xe}},_=function(ae){return{url:ae}},E="url(",A=te("url(",!1),T=")",I=te(")",!1),L=function(ae){return ae},R="format(",N=te("format(",!1),F="local(",H=te("local(",!1),$=function(ae){return{local:ae}},X=/^[^)]/,Z=Q([")"],!0,!1),K=function(ae){return Te.extractValue(ae.join(""))},q=/^[ \t\r\n\f]/,J=Q([" "," ","\r",`
147
+ `,"\f"],!1,!1),U=0,D=[{line:1,column:1}],W=0,V=[],ee;if("startRule"in f){if(!(f.startRule in h))throw new Error(`Can't start parsing from rule "`+f.startRule+'".');p=h[f.startRule]}function te(ae,xe){return{type:"literal",text:ae,ignoreCase:xe}}function Q(ae,xe,Oe){return{type:"class",parts:ae,inverted:xe,ignoreCase:Oe}}function ne(){return{type:"end"}}function ue(ae){var xe=D[ae],Oe;if(xe)return xe;for(Oe=ae-1;!D[Oe];)Oe--;for(xe=D[Oe],xe={line:xe.line,column:xe.column};Oe<ae;)u.charCodeAt(Oe)===10?(xe.line++,xe.column=1):xe.column++,Oe++;return D[ae]=xe,xe}function oe(ae,xe){var Oe=ue(ae),Be=ue(xe);return{start:{offset:ae,line:Oe.line,column:Oe.column},end:{offset:xe,line:Be.line,column:Be.column}}}function de(ae){U<W||(U>W&&(W=U,V=[]),V.push(ae))}function Ee(ae,xe,Oe){return new o(o.buildMessage(ae,xe),ae,xe,Oe)}function Fe(){var ae,xe;return ae=Le(),ae===d&&(ae=U,xe=y,xe!==d&&(xe=v()),ae=xe),ae}function Le(){var ae,xe,Oe,Be,ct,be;if(ae=U,xe=$e(),xe!==d){for(Oe=[],Be=me();Be!==d;)Oe.push(Be),Be=me();if(Oe!==d)if(u.charCodeAt(U)===44?(Be=b,U++):(Be=d,de(x)),Be!==d){for(ct=[],be=me();be!==d;)ct.push(be),be=me();ct!==d?(be=Le(),be!==d?(xe=k(xe,be),ae=xe):(U=ae,ae=d)):(U=ae,ae=d)}else U=ae,ae=d;else U=ae,ae=d}else U=ae,ae=d;return ae===d&&(ae=U,xe=$e(),xe!==d&&(xe=S(xe)),ae=xe),ae}function $e(){var ae;return ae=Xe(),ae===d&&(ae=ge()),ae}function Xe(){var ae,xe,Oe,Be;if(ae=U,xe=dt(),xe!==d){if(Oe=[],Be=me(),Be!==d)for(;Be!==d;)Oe.push(Be),Be=me();else Oe=d;Oe!==d?(Be=ke(),Be!==d?(xe=P(xe,Be),ae=xe):(U=ae,ae=d)):(U=ae,ae=d)}else U=ae,ae=d;return ae===d&&(ae=U,xe=dt(),xe!==d&&(xe=_(xe)),ae=xe),ae}function dt(){var ae,xe,Oe,Be;return ae=U,u.substr(U,4)===E?(xe=E,U+=4):(xe=d,de(A)),xe!==d?(Oe=se(),Oe!==d?(u.charCodeAt(U)===41?(Be=T,U++):(Be=d,de(I)),Be!==d?(xe=L(Oe),ae=xe):(U=ae,ae=d)):(U=ae,ae=d)):(U=ae,ae=d),ae}function ke(){var ae,xe,Oe,Be;return ae=U,u.substr(U,7)===R?(xe=R,U+=7):(xe=d,de(N)),xe!==d?(Oe=se(),Oe!==d?(u.charCodeAt(U)===41?(Be=T,U++):(Be=d,de(I)),Be!==d?(xe=L(Oe),ae=xe):(U=ae,ae=d)):(U=ae,ae=d)):(U=ae,ae=d),ae}function ge(){var ae,xe,Oe,Be;return ae=U,u.substr(U,6)===F?(xe=F,U+=6):(xe=d,de(H)),xe!==d?(Oe=se(),Oe!==d?(u.charCodeAt(U)===41?(Be=T,U++):(Be=d,de(I)),Be!==d?(xe=$(Oe),ae=xe):(U=ae,ae=d)):(U=ae,ae=d)):(U=ae,ae=d),ae}function se(){var ae,xe,Oe;if(ae=U,xe=[],X.test(u.charAt(U))?(Oe=u.charAt(U),U++):(Oe=d,de(Z)),Oe!==d)for(;Oe!==d;)xe.push(Oe),X.test(u.charAt(U))?(Oe=u.charAt(U),U++):(Oe=d,de(Z));else xe=d;return xe!==d&&(xe=K(xe)),ae=xe,ae}function me(){var ae;return q.test(u.charAt(U))?(ae=u.charAt(U),U++):(ae=d,de(J)),ae}var Te=r("../util");if(ee=p(),ee!==d&&U===u.length)return ee;throw ee!==d&&U<u.length&&de(ne()),Ee(V,W<u.length?u.charAt(W):null,W<u.length?oe(W,W+1):oe(W,W))}n.exports={SyntaxError:o,parse:s}},{"../util":3}],2:[function(r,n,i){var a=r("./grammar");i.SyntaxError=function(o,s){this.message=o,this.offset=s},i.parse=function(o){try{return a.parse(o)}catch(s){throw new i.SyntaxError(s.message,s.offset)}},i.serialize=function(o){return o.map(function(s){var u;return s.url?(u='url("'+s.url+'")',s.format&&(u+=' format("'+s.format+'")')):u='local("'+s.local+'")',u}).join(", ")}},{"./grammar":1}],3:[function(r,n,i){var a=function(s){var u=/^[\t\r\f\n ]*(.+?)[\t\r\f\n ]*$/;return s.replace(u,"$1")},o=function(s){var u=/^"(.*)"$/,f=/^'(.*)'$/;return u.test(s)?s.replace(u,"$1"):f.test(s)?s.replace(f,"$1"):s};i.extractValue=function(s){return o(a(s))}},{}]},{},[2])(2)})})(Gy)),Gy.exports}var z4;function fI(){return z4||(z4=1,(function(t){var e=S0(),r=q2(),n=uI(),i=cI(),a=function(S,P,_){S.style.setProperty(P,_,S.style.getPropertyPriority(P))},o=function(S){return S.filter(function(P){return P.type===window.CSSRule.STYLE_RULE&&(P.style.getPropertyValue("background-image")||P.style.getPropertyValue("background"))})},s=function(S){var P=[];return S.forEach(function(_){_.style.getPropertyValue("background-image")?P.push({property:"background-image",value:_.style.getPropertyValue("background-image"),rule:_}):_.style.getPropertyValue("background")&&P.push({property:"background",value:_.style.getPropertyValue("background"),rule:_})}),P},u=function(S){return S.filter(function(P){return P.type===window.CSSRule.FONT_FACE_RULE&&P.style.getPropertyValue("src")})},f=function(S){return S.filter(function(P){return P.type===window.CSSRule.IMPORT_RULE&&P.href})},d=function(S){var P=[];return S.forEach(function(_,E){_.url&&!e.isDataUri(_.url)&&P.push(E)}),P},h=function(S){var P=[];return S.forEach(function(_,E){_.url&&!e.isDataUri(_.url)&&P.push(E)}),P};t.adjustPathsOfCssResources=function(S,P,_){var E=o(P),A=s(E),T=!1;return A.forEach(function(I){var L=n.parse(I.value),R=d(L),N;R.length>0&&(R.forEach(function(F){var H=L[F].url,$=e.joinUrl(S,H);L[F].url=$}),N=n.serialize(L),a(I.rule,I.property,N),T=!0)}),u(P).forEach(function(I){var L=I.style.getPropertyValue("src"),R,N;try{R=i.parse(L)}catch{return}N=h(R),N.length>0&&(N.forEach(function(F){var H=R[F].url,$=e.joinUrl(S,H);R[F].url=$}),r.changeFontFaceRuleSrc(P,I,i.serialize(R,_),_),T=!0)}),f(P).forEach(function(I){var L=I.href,R=e.joinUrl(S,L);r.exchangeRule(P,I,"@import url("+R+");",_),T=!0}),T};var p=function(S,P,_){var E=S.indexOf(P);S.splice(E,1),_.forEach(function(A,T){S.splice(E+T,0,A)})},y=function(S,P,_,E){var A=P.href,T;return A=r.unquoteString(A),T=e.joinUrl(E.baseUrl,A),_.indexOf(T)>=0?(p(S,P,[]),Promise.resolve([])):(_.push(T),e.ajax(A,E).then(function(I){var L=r.rulesForCssText(I,E);return t.loadCSSImportsForRules(L,_,E).then(function(R){return t.adjustPathsOfCssResources(A,L,E),p(S,P,L),R.errors})},function(I){throw{resourceType:"stylesheet",url:I.url,msg:"Unable to load stylesheet "+I.url}}))};t.loadCSSImportsForRules=function(S,P,_){var E=f(S),A=[],T=!1;return Promise.all(E.map(function(I){return y(S,I,P,_).then(function(L){A=A.concat(L),T=!0},function(L){A.push(L)})})).then(function(){return{hasChanges:T,errors:A}})};var v=function(S,P){var _=n.parse(S),E=d(_),A=!1;return e.collectAndReportErrors(E.map(function(T){var I=_[T].url;return e.getDataURIForImageURL(I,P).then(function(L){_[T].url=L,A=!0},function(L){throw{resourceType:"backgroundImage",url:L.url,msg:"Unable to load background-image "+L.url}})})).then(function(T){return{backgroundValue:n.serialize(_),hasChanges:A,errors:T}})},b=function(S,P){var _=o(S),E=s(_),A=[],T=!1;return Promise.all(E.map(function(I){return v(I.value,P).then(function(L){L.hasChanges&&(a(I.rule,I.property,L.backgroundValue),T=!0),A=A.concat(L.errors)})})).then(function(){return{hasChanges:T,errors:A}})},x=function(S,P){var _=!1,E,A;try{E=i.parse(S)}catch{E=[]}return A=h(E),e.collectAndReportErrors(A.map(function(T){var I=E[T],L=I.format||"woff";return e.binaryAjax(I.url,P).then(function(R){var N=btoa(R);I.url="data:font/"+L+";base64,"+N,_=!0},function(R){throw{resourceType:"fontFace",url:R.url,msg:"Unable to load font-face "+R.url}})})).then(function(T){return{srcDeclarationValue:i.serialize(E),hasChanges:_,errors:T}})},k=function(S,P){var _=u(S),E=[],A=!1;return Promise.all(_.map(function(T){var I=T.style.getPropertyValue("src");return x(I,P).then(function(L){L.hasChanges&&(r.changeFontFaceRuleSrc(S,T,L.srcDeclarationValue,P),A=!0),E=E.concat(L.errors)})})).then(function(){return{hasChanges:A,errors:E}})};t.loadAndInlineCSSResourcesForRules=function(S,P){var _=!1,E=[];return Promise.all([b,k].map(function(A){return A(S,P).then(function(T){_=_||T.hasChanges,E=E.concat(T.errors)})})).then(function(){return{hasChanges:_,errors:E}})}})(qy)),qy}var j4;function dI(){return j4||(j4=1,(function(t){var e=S0(),r=sI(),n=lI(),i=fI(),a=q2(),o=function(x){return e.joinUrl(x,".")},s=function(x){var k=x.map(function(S,P){return P===x.length-1&&(S={baseUrl:o(S.baseUrl)}),JSON.stringify(S)});return k},u=function(x,k){return k.cache!==!1&&k.cache!=="none"&&k.cacheBucket?e.memoize(x,s,k.cacheBucket):x},f=function(x,k,S){var P=a.rulesForCssText(x,S);return i.loadCSSImportsForRules(P,k,S).then(function(_){return i.loadAndInlineCSSResourcesForRules(P,S).then(function(E){var A=_.errors.concat(E.errors),T=_.hasChanges||E.hasChanges;return T&&(x=a.cssRulesToText(P)),{hasChanges:T,content:x,errors:A}})})},d=function(x,k,S){var P=x.textContent,_=u(f,k);return _(P,S,k).then(function(E){return E.hasChanges&&(x.childNodes[0].nodeValue=E.content),e.cloneArray(E.errors)})},h=function(x){var k=x.getElementsByTagName("style");return Array.prototype.filter.call(k,function(S){return!S.attributes.type||S.attributes.type.value==="text/css"})};t.loadAndInlineStyles=function(x,k){var S=h(x),P=[],_=[],E;return E=e.clone(k),E.baseUrl=E.baseUrl||e.getDocumentBaseUrl(x),Promise.all(S.map(function(A){return d(A,E,_).then(function(T){P=P.concat(T)})})).then(function(){return P})};var p=function(x,k,S){var P=x.parentNode,_;k=k.trim(),k&&(_=x.ownerDocument.createElement("style"),_.type="text/css",S&&S.nonce&&(_.nonce=S.nonce),_.appendChild(x.ownerDocument.createTextNode(k)),P.insertBefore(_,x)),P.removeChild(x)},y=function(x,k){return e.ajax(x,k).then(function(S){var P=a.rulesForCssText(S,k);return{content:S,cssRules:P}}).then(function(S){var P=i.adjustPathsOfCssResources(x,S.cssRules,k);return{content:S.content,cssRules:S.cssRules,hasChanges:P}}).then(function(S){return i.loadCSSImportsForRules(S.cssRules,[],k).then(function(P){return{content:S.content,cssRules:S.cssRules,hasChanges:S.hasChanges||P.hasChanges,errors:P.errors}})}).then(function(S){return i.loadAndInlineCSSResourcesForRules(S.cssRules,k).then(function(P){return{content:S.content,cssRules:S.cssRules,hasChanges:S.hasChanges||P.hasChanges,errors:S.errors.concat(P.errors)}})}).then(function(S){var P=S.content;return S.hasChanges&&(P=a.cssRulesToText(S.cssRules)),{content:P,errors:S.errors}})},v=function(x,k){var S=x.attributes.href.value,P=e.getDocumentBaseUrl(x.ownerDocument),_=e.clone(k);!_.baseUrl&&P&&(_.baseUrl=P);var E=u(y,k);return E(S,_).then(function(A){return{content:A.content,errors:e.cloneArray(A.errors)}})},b=function(x){var k=x.getElementsByTagName("link");return Array.prototype.filter.call(k,function(S){return S.attributes.rel&&S.attributes.rel.value==="stylesheet"&&(!S.attributes.type||S.attributes.type.value==="text/css")})};t.loadAndInlineCssLinks=function(x,k){var S=b(x),P=[];return Promise.all(S.map(function(_){return v(_,k).then(function(E){p(_,E.content+`
148
+ `,k),P=P.concat(E.errors)},function(E){P.push({resourceType:"stylesheet",url:E.url,msg:"Unable to load stylesheet "+E.url})})})).then(function(){return P})},t.loadAndInlineImages=r.inline,t.loadAndInlineScript=n.inline,t.inlineReferences=function(x,k){var S=[],P=[t.loadAndInlineImages,t.loadAndInlineStyles,t.loadAndInlineCssLinks];return k.inlineScripts!==!1&&P.push(t.loadAndInlineScript),Promise.all(P.map(function(_){return _(x,k).then(function(E){S=S.concat(E)})})).then(function(){return S})}})(jy)),jy}var hI=xg.exports,U4;function pI(){return U4||(U4=1,(function(t){(function(e,r){e===void 0&&window!==void 0&&(e=window),t.exports?t.exports=r($k(),aI(),oI(),dI()):e.rasterizeHTML=r(e.url,e.xmlserializer,e.sanedomparsererror,e.inlineresources)})(hI,function(e,r,n,i){var a=(function(v){var b={},x=[];b.joinUrl=function(P,_){return P?v.resolve(P,_):_},b.getConstantUniqueIdFor=function(P){return x.indexOf(P)<0&&x.push(P),x.indexOf(P)},b.clone=function(P){var _={},E;for(E in P)P.hasOwnProperty(E)&&(_[E]=P[E]);return _};var k=function(P){return typeof P=="object"&&P!==null},S=function(P){return k(P)&&Object.prototype.toString.apply(P).match(/\[object (Canvas|HTMLCanvasElement|OffscreenCanvas)\]/i)};return b.parseOptionalParameters=function(P){var _={canvas:null,options:{}};return P[0]==null||S(P[0])?(_.canvas=P[0]||null,_.options=b.clone(P[1])):_.options=b.clone(P[0]),_},b})(e),o=(function(v){var b={},x=function(k,S,P){var _=k[S];return k[S]=function(){var E=Array.prototype.slice.call(arguments);return P.apply(this,[E,_])},_};return b.baseUrlRespectingXhr=function(k,S){var P=function(){var _=new k;return x(_,"open",function(E,A){var T=E.shift(),I=E.shift(),L=v.joinUrl(S,I);return A.apply(this,[T,L].concat(E))}),_};return P},b.finishNotifyingXhr=function(k){var S=0,P=0,_=!1,E,A=new Promise(function(I){E=function(){var L=S-P;L<=0&&_&&I({totalCount:S})}}),T=function(){var I=new k;return x(I,"send",function(L,R){return S+=1,R.apply(this,arguments)}),I.addEventListener("load",function(){P+=1,E()}),I};return T.waitForRequestsToFinish=function(){return _=!0,E(),A},T},b})(a),s=(function(){var v={},b=function(T){return Array.prototype.slice.call(T)};v.addClassName=function(T,I){T.className+=" "+I},v.addClassNameRecursively=function(T,I){v.addClassName(T,I),T.parentNode!==T.ownerDocument&&v.addClassNameRecursively(T.parentNode,I)};var x=function(T,I){var L=T.parentStyleSheet,R=b(L.cssRules).indexOf(T);L.insertRule(I,R+1),L.deleteRule(R)},k=function(T,I){var L=T.cssText.replace(/^[^\{]+/,""),R=I+" "+L;x(T,R)},S=function(T){return b(T).reduce(function(I,L){return I+L.cssText},"")},P=function(T){T.textContent=S(T.sheet.cssRules)},_=function(T){var I=document.implementation.createHTMLDocument(""),L=document.createElement("style");L.textContent=T.textContent,I.body.appendChild(L),T.sheet=L.sheet},E=function(T){return"((?:^|[^.#:\\w])|(?=\\W))("+T.join("|")+")(?=\\W|$)"},A=function(T,I,L){var R=E(I);b(T.querySelectorAll("style")).forEach(function(N){typeof N.sheet>"u"&&_(N);var F=b(N.sheet.cssRules).filter(function(H){return H.selectorText&&new RegExp(R,"i").test(H.selectorText)});F.length&&(F.forEach(function(H){var $=H.selectorText.replace(new RegExp(R,"gi"),function(X,Z,K){return Z+L(K)});$!==H.selectorText&&k(H,$)}),P(N))})};return v.rewriteCssSelectorWith=function(T,I,L){A(T,[I],function(){return L})},v.lowercaseCssTypeSelectors=function(T,I){A(T,I,function(L){return L.toLowerCase()})},v.findHtmlOnlyNodeNames=function(T){var I=T.ownerDocument.createTreeWalker(T,NodeFilter.SHOW_ELEMENT),L={},R={},N;do N=I.currentNode.tagName.toLowerCase(),I.currentNode.namespaceURI==="http://www.w3.org/1999/xhtml"?L[N]=!0:R[N]=!0;while(I.nextNode());return Object.keys(L).filter(function(F){return!R[F]})},v})(),u=(function(v){var b={},x=function(S){return Array.prototype.slice.call(S)},k={active:!0,hover:!0,focus:!1,target:!1};return b.fakeUserAction=function(S,P,_){var E=S.querySelector(P),A=":"+_,T="rasterizehtml"+_;E&&(k[_]?v.addClassNameRecursively(E,T):v.addClassName(E,T),v.rewriteCssSelectorWith(S,A,"."+T))},b.persistInputValues=function(S){var P=S.querySelectorAll("input"),_=S.querySelectorAll("textarea"),E=function(A){return A.type==="checkbox"||A.type==="radio"};x(P).filter(E).forEach(function(A){A.checked?A.setAttribute("checked",""):A.removeAttribute("checked")}),x(P).filter(function(A){return!E(A)}).forEach(function(A){A.setAttribute("value",A.value)}),x(_).forEach(function(A){A.textContent=A.value})},b.rewriteTagNameSelectorsToLowerCase=function(S){v.lowercaseCssTypeSelectors(S,v.findHtmlOnlyNodeNames(S))},b})(s),f=(function(v,b,x,k){var S={},P=function(K,q,J,U){var D=K.createElement(q);return D.style.visibility="hidden",D.style.width=J+"px",D.style.height=U+"px",D.style.position="absolute",D.style.top=-1e4-U+"px",D.style.left=-1e4-J+"px",K.getElementsByTagName("body")[0].appendChild(D),D},_=function(K){return K>0?new Promise(function(q){setTimeout(q,K)}):Promise.resolve()};S.executeJavascript=function(K,q){return new Promise(function(J){var U=P(k.document,"iframe",q.width,q.height),D=K.outerHTML,W=[],V=q.executeJsTimeout||0,ee=function(){k.document.getElementsByTagName("body")[0].removeChild(U)},te=function(){var oe=U.contentDocument;J({document:oe,errors:W,cleanUp:ee})},Q=U.contentWindow.XMLHttpRequest,ne=b.finishNotifyingXhr(Q),ue=b.baseUrlRespectingXhr(ne,q.baseUrl);U.onload=function(){_(V).then(ne.waitForRequestsToFinish).then(te)},U.contentDocument.open(),U.contentWindow.XMLHttpRequest=ue,U.contentWindow.onerror=function(oe){W.push({resourceType:"scriptExecution",msg:oe})},U.contentDocument.write("<!DOCTYPE html>"),U.contentDocument.write(D),U.contentDocument.close()})};var E=function(K,q,J){var U=K.createElement("iframe");return U.style.width=q+"px",U.style.height=J+"px",U.style.visibility="hidden",U.style.position="absolute",U.style.top=-1e4-J+"px",U.style.left=-1e4-q+"px",U.style.borderWidth=0,U.sandbox="allow-same-origin",U.scrolling="no",U},A=function(K,q,J){var U=Math.floor(K/J),D=Math.floor(q/J);return E(k.document,U,D)},T=function(K,q,J,U){return{width:Math.max(K.width*U,q),height:Math.max(K.height*U,J)}},I=function(K,q){var J=K.querySelector(q);if(J)return J;if(K.ownerDocument.querySelector(q)===K)return K;throw{message:"Clipping selector not found"}},L=function(K,q,J,U,D){var W=Math.max(K.scrollWidth,K.clientWidth),V=Math.max(K.scrollHeight,K.clientHeight),ee,te,Q,ne,ue,oe,de,Ee;return q?(oe=I(K,q),de=oe.getBoundingClientRect(),ee=de.top,te=de.left,Q=de.width,ne=de.height):(ee=0,te=0,Q=W,ne=V),Ee=T({width:Q,height:ne},J,U,D),ue=k.getComputedStyle(K.ownerDocument.documentElement).fontSize,{left:te,top:ee,width:Ee.width,height:Ee.height,viewportWidth:W,viewportHeight:V,rootFontSize:ue}},R=function(K,q){var J=K.tagName;return q.querySelector(J)},N=function(K){var q=K.tagName.toLowerCase();return q==="html"||q==="body"?K.outerHTML:'<body style="margin: 0;">'+K.outerHTML+"</body>"};S.calculateDocumentContentSize=function(K,q){return new Promise(function(J,U){var D=q.zoom||1,W;W=A(q.width,q.height,D),k.document.getElementsByTagName("body")[0].appendChild(W),W.onload=function(){var V=W.contentDocument,ee;try{ee=L(R(K,V),q.clip,q.width,q.height,D),J(ee)}catch(te){U(te)}finally{k.document.getElementsByTagName("body")[0].removeChild(W)}},W.contentDocument.open(),W.contentDocument.write("<!DOCTYPE html>"),W.contentDocument.write(N(K)),W.contentDocument.close()})},S.parseHtmlFragment=function(K){var q=k.document.implementation.createHTMLDocument("");q.documentElement.innerHTML=K;var J=q.querySelector("body").firstChild;if(!J)throw"Invalid source";return J};var F=function(K,q){var J=/<html((?:\s+[^>]*)?)>/im.exec(q),U=k.document.implementation.createHTMLDocument(""),D,W,V,ee;if(J)for(D="<div"+J[1]+"></div>",U.documentElement.innerHTML=D,V=U.querySelector("div"),W=0;W<V.attributes.length;W++)ee=V.attributes[W],K.documentElement.setAttribute(ee.name,ee.value)};S.parseHTML=function(K){var q=k.document.implementation.createHTMLDocument("");return q.documentElement.innerHTML=K,F(q,K),q};var H=function(K){try{return x.failOnParseError(K)}catch(q){throw{message:"Invalid source",originalError:q}}};S.validateXHTML=function(K){var q=new DOMParser,J=q.parseFromString(K,"application/xml");H(J)};var $=null,X=function(K,q){return q==="none"||q==="repeated"?(($===null||q!=="repeated")&&($=Date.now()),K+"?_="+$):K},Z=function(K,q){return new Promise(function(J,U){var D=new window.XMLHttpRequest,W=v.joinUrl(q.baseUrl,K),V=X(W,q.cache),ee=function(te){U({message:"Unable to load page",originalError:te})};D.addEventListener("load",function(){D.status===200||D.status===0?J(D.responseXML):ee(D.statusText)},!1),D.addEventListener("error",function(te){ee(te)},!1);try{D.open("GET",V,!0),D.responseType="document",D.send(null)}catch(te){ee(te)}})};return S.loadDocument=function(K,q){return Z(K,q).then(function(J){return H(J)})},S})(a,o,n,window),d=(function(){var v={},b=function(I,L){return L?URL.createObjectURL(new Blob([I],{type:"image/svg+xml"})):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(I)},x=function(I){I instanceof Blob&&URL.revokeObjectURL(I)},k='<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><foreignObject></foreignObject></svg>',S=function(I){return new Promise(function(L,R){var N=document.createElement("canvas"),F=new Image;F.onload=function(){var H=N.getContext("2d");try{H.drawImage(F,0,0),N.toDataURL("image/png"),L(!0)}catch{L(!1)}},F.onerror=R,F.src=I})},P=function(){var I=b(k,!0);return S(I).then(function(L){return x(I),L?!1:S(b(k,!1)).then(function(R){return R})},function(){return!1})},_=function(){return new Promise(function(I,L){P().then(function(R){I(!R)},function(){L()})})},E,A=function(){return E===void 0&&(E=_()),E},T=function(I){return A().then(function(L){return b(I,L)})};return v.renderSvg=function(I){return new Promise(function(L,R){var N,F,H=function(){F.onload=null,F.onerror=null},$=function(){N&&x(N)};F=new Image,F.onload=function(){H(),$(),L(F)},F.onerror=function(){$(),R()},T(I).then(function(X){N=X,F.src=N},R)})},v})(),h=(function(v,b,x,k){var S={},P=function(R,N){var F=N||1,H={width:R.width,height:R.height,"font-size":R.rootFontSize};return F!==1&&(H.style="transform:scale("+F+"); transform-origin: 0 0;"),H},_=function(R){var N,F,H,$;N=Math.round(R.viewportWidth),F=Math.round(R.viewportHeight),H=-R.left,$=-R.top;var X={x:H,y:$,width:N,height:F};return X},E=function(R){var N=R.style||"";R.style=N+"float: left;"},A=function(R){R.externalResourcesRequired=!0},T=function(){return'<style scoped="">html::-webkit-scrollbar { display: none; }</style>'},I=function(R){var N=Object.keys(R);return N.length?" "+N.map(function(F){return F+'="'+R[F]+'"'}).join(" "):""},L=function(R,N,F){var H=k.serializeToString(R);b.validateXHTML(H);var $=_(N);return E($),A($),'<svg xmlns="http://www.w3.org/2000/svg"'+I(P(N,F))+">"+T()+"<foreignObject"+I($)+">"+H+"</foreignObject></svg>"};return S.getSvgForDocument=function(R,N,F){return x.rewriteTagNameSelectorsToLowerCase(R),L(R,N,F)},S.drawDocumentAsSvg=function(R,N){return["hover","active","focus","target"].forEach(function(F){N[F]&&x.fakeUserAction(R,N[F],F)}),b.calculateDocumentContentSize(R,N).then(function(F){return S.getSvgForDocument(R,F,N.zoom)})},S})(a,f,u,r),p=(function(v,b,x,k,S,P){var _={},E=function(R){return{message:"Error rendering page",originalError:R}},A=function(R){return S.renderSvg(R).then(function(N){return{image:N,svg:R}},function(N){throw E(N)})},T=function(R,N){try{N.getContext("2d").drawImage(R,0,0)}catch(F){throw E(F)}},I=function(R,N,F){return k.drawDocumentAsSvg(R,F).then(A).then(function(H){return N&&T(H.image,N),H})},L=function(R,N){return b.executeJavascript(R,N).then(function(F){var H=F.document;return x.persistInputValues(H),{document:H,errors:F.errors,cleanUp:F.cleanUp}})};return _.rasterize=function(R,N,F){var H;return H=v.clone(F),H.inlineScripts=F.executeJs===!0,P.inlineReferences(R,H).then(function($){return F.executeJs?L(R,F).then(function(X){return{element:X.document.documentElement,errors:$.concat(X.errors),cleanUp:X.cleanUp}}):{element:R,errors:$,cleanUp:function(){}}}).then(function($){return I($.element,N,F).then(function(X){return $.cleanUp(),{image:X.image,svg:X.svg,errors:$.errors}})})},_})(a,f,u,h,d,i),y=(function(v,b,x){var k={},S=function(T,I){var L=300,R=200,N=T?T.width:L,F=T?T.height:R,H=I.width!==void 0?I.width:N,$=I.height!==void 0?I.height:F;return{width:H,height:$}},P=function(T){var I=S(T.canvas,T.options),L;return L=v.clone(T.options),L.width=I.width,L.height=I.height,L};k.drawDocument=function(){var T=arguments[0],I=Array.prototype.slice.call(arguments,1),L=v.parseOptionalParameters(I),R=T.documentElement?T.documentElement:T;return x.rasterize(R,L.canvas,P(L))};var _=function(T,I,L){var R=b.parseHTML(T);return k.drawDocument(R,I,L)};k.drawHTML=function(){var T=arguments[0],I=Array.prototype.slice.call(arguments,1),L=v.parseOptionalParameters(I);return _(T,L.canvas,L.options)};var E=function(T,I,L){var R=document.implementation.createHTMLDocument("");R.replaceChild(T.documentElement,R.documentElement);var N=L?v.clone(L):{};return L.baseUrl||(N.baseUrl=I),{document:R,options:N}},A=function(T,I,L){return b.loadDocument(T,L).then(function(R){var N=E(R,T,L);return k.drawDocument(N.document,I,N.options)})};return k.drawURL=function(){var T=arguments[0],I=Array.prototype.slice.call(arguments,1),L=v.parseOptionalParameters(I);return A(T,L.canvas,L.options)},k})(a,f,p);return y})})(xg)),xg.exports}var mI=pI();function gI(t,e){if(!t.includes("@font-face"))return"";const r=new Set,n=new Set;e&&((e.match(/font-weight:\s*(\d+|bold|normal)/gi)||[]).forEach(f=>{const d=f.split(":")[1].trim();d==="bold"?r.add("700"):d==="normal"?r.add("400"):/^\d+$/.test(d)&&r.add(d)}),(e.match(/font-style:\s*(italic|normal)/gi)||[]).forEach(f=>{f.split(":")[1].trim().toLowerCase()==="italic"&&n.add("italic")}),/<(b|strong)\b/i.test(e)&&r.add("700"),/<(i|em)\b/i.test(e)&&n.add("italic"));const i=ri(e);i&&i.trim()&&r.add("400"),r.size===0&&r.add("400");const a=r,o=n.has("italic"),s=Array.from(new Set(i)).map(f=>f.codePointAt(0)).filter(f=>f!==void 0),u=t.split(/}\s*/).map(f=>f&&f+"}").filter(f=>/@font-face/.test(f)&&(d=>{const h=(d.match(/font-weight:\s*(\d+)/)||[])[1];if(h&&!a.has(h)||/font-style:\s*italic/.test(d)&&!o)return!1;const p=d.match(/unicode-range:\s*([^;]+);/);if(!p)return!0;const y=p[1].split(",").map(v=>{const[b,x=b]=v.replace("U+","").split("-").map(k=>parseInt(k,16));return[b,x]});return s.some(v=>y.some(([b,x])=>v>=b&&v<=x))})(f)).join(`
149
+ `);return u?`<style>${u}</style>`:""}const kp=`
150
+ p {
151
+ margin: 0;
152
+ padding: 0;
153
+ word-wrap: break-word; /* Required for Firefox */
154
+ /* a text may have several spaces, we need to preserve them */
155
+ white-space: pre-wrap;
156
+ }
157
+
158
+ /* Reset default list styles and setup counters */
159
+ ul, ol {
160
+ list-style: none; /* Remove default markers */
161
+ padding-inline-start: 0; /* Reset padding */
162
+ margin: 0;
163
+ display: block; /* Use block instead of inline-block for better text wrapping */
164
+ width: 100%;
165
+ text-decoration: inherit;
166
+ counter-reset: ol-counter; /* Initialize counter for ol */
167
+ }
168
+
169
+ li {
170
+ position: relative; /* Needed for absolute positioning of ::before */
171
+ padding-inline-start: 2.1em; /* Space for the marker (start side) */
172
+ margin: 0; /* Reset default li margins */
173
+ word-wrap: break-word; /* Required for Firefox text wrapping */
174
+ white-space: pre-wrap; /* Preserve spaces and allow wrapping */
175
+ }
176
+
177
+ li::before {
178
+ content: ''; /* Base content */
179
+ position: absolute;
180
+ /* Use logical properties for positioning */
181
+ inset-inline-start: 0; /* Position marker at the start edge (left in LTR, right in RTL) */
182
+ top: 0; /* Adjust vertical alignment */
183
+ /* Prevent letter-spacing from affecting the marker */
184
+ letter-spacing: normal;
185
+ /* Define width to ensure consistent spacing and alignment */
186
+ display: inline-block;
187
+ width: 2em; /* Width for the marker container */
188
+ /* Align multi-digit numbers to the end (right in LTR, left in RTL) */
189
+ text-align: end;
190
+ /* Space between marker and text (using logical property) */
191
+ margin-inline-end: 0.8em; /* Pushes text away from marker (2.5em total = 1.7em width + 0.8em margin)*/
192
+ /* Prevent marker style from inheriting list item styles */
193
+ font-weight: normal;
194
+ font-style: normal;
195
+ }
196
+
197
+ /* Style for bullet points */
198
+ ul > li::before {
199
+ content: '•'; /* Literal bullet character */
200
+ /* Center the bullet within its allocated width */
201
+ text-align: center; /* Override text-align: end for bullets */
202
+ font-size: 1.2em;
203
+ top: 0em; /* Re-adjust vertical alignment for bullet */
204
+ /* Bullets don't need number alignment, width can be tighter */
205
+ width: 2em;
206
+ /* Adjust margin to maintain overall padding */
207
+ margin-inline-end: 1.5em; /* 2.5em total padding = 1em width + 1.5em margin */
208
+ }
209
+
210
+ /* Style for numbers using counter */
211
+ ol > li {
212
+ counter-increment: ol-counter; /* Increment counter for each li in ol */
213
+ }
214
+
215
+ ol > li::before {
216
+ content: counter(ol-counter) "."; /* Display counter value + dot */
217
+ }
218
+
219
+ .ql-indent-1 {
220
+ margin-inline-start: 0.5em;
221
+ }
222
+ .ql-indent-2 {
223
+ margin-inline-start: 1em;
224
+ }
225
+ .ql-indent-3 {
226
+ margin-inline-start: 1.5em;
227
+ }
228
+ `,yI=`
229
+ <style>
230
+ html, body {
231
+ padding: 0;
232
+ margin: 0;
233
+ }
234
+ ${kp}
235
+ </style>
236
+ `;let Gl;const qk=()=>(Gl||(Gl=document.createElement("div"),Gl.id="polotno-hidden-do-not-touch",Gl.style.overflow="hidden",Gl.style.position="relative",document.body.appendChild(Gl),Gl.innerHTML=`<style>#polotno-hidden-do-not-touch {${kp}}</style>`),Gl);navigator.userAgent.includes("Firefox");function vI({html:t}){const e=document.createElement("div");e.innerHTML=t,e.style.display="inline-block",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.zIndex="1000",e.style.whiteSpace="nowrap",e.style.visibility="hidden";const r=qk();r.appendChild(e);const n=e.innerText,i=e.childNodes[0];i.style.whiteSpace="nowrap";const a=n?.split(/\s+/)||[];let o=!1;for(let s=0;s<a.length;s++){const u=a[s];if(i&&(i.textContent=u,o=i.scrollWidth>e.clientWidth,o))break}return r.removeChild(e),o}function H4(t){const e=document.createElement("div");e.innerHTML=t,e.style.display="inline-block",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.zIndex="1000";const r=qk();r.appendChild(e);const n=e.getBoundingClientRect();return r.removeChild(e),{width:n.width,height:n.height}}const bI={},Xy={},Yy=new Map;async function $4({html:t,width:e,height:r,fontFamily:n,padding:i,font:a,pixelRatio:o}){let s="";if(n!=="Arial"&&!a){const v=aC();s=await(async function(b,x){const k=`${b}|${x}`;if(Yy.has(k))return Yy.get(k);const S=`https://fonts.googleapis.com/css?family=${b}:${x}&display=swap`,P=await(await fetch(S)).text();return Yy.set(k,P),P})(n,v)}if(a){const v=a.styles||(a.url?[{src:`url("${a.url}")`}]:(b=>{if(Xy[b])return Xy[b];const x=(function(S){const P=[];for(let _=0;_<document.styleSheets.length;_++){const E=document.styleSheets[_];try{const A=E.cssRules;if(A)for(let T=0;T<A.length;T++){const I=A[T];I instanceof CSSFontFaceRule&&I.style.fontFamily.replace(/['"]/g,"")===S&&P.push(I)}}catch(A){console.warn(`Could not access stylesheet: ${E.href}`,A)}}return P})(b),k=x.filter(S=>S.style.fontFamily.replace(/['"]/g,"")===b).map(S=>({src:S.style.getPropertyValue("src"),fontStyle:S.style.getPropertyValue("font-style")||"normal",fontWeight:S.style.getPropertyValue("font-weight")||"normal"}));return Xy[b]=k,k})(n));s="",v.forEach(b=>{s+=`
237
+ @font-face {
238
+ font-family: '${n}';
239
+ src: ${b.src};
240
+ font-style: ${b.fontStyle||"normal"};
241
+ font-weight: ${b.fontWeight||"normal"};
242
+ }
243
+ `})}let u="";s&&(u=gI(s,t)),t+=u+yI;const f=e+2*i,d=r+2*i,h=document.createElement("canvas"),p=await mI.drawHTML(`<div style="padding: ${i}px;" dir="auto">${t}</div>`,h,{width:f,height:d,cacheBucket:bI});j2(h,f*o,d*o);const y=h.getContext("2d");return y?.drawImage(p.image,0,0,f,d,0,0,h.width,h.height),h}let wI={data:""},xI=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||wI,SI=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,kI=/\/\*[^]*?\*\/|\s\s+|\n/g,Jl=(t,e)=>{let r="",n="",i="";for(let a in t){let o=t[a];a[0]=="@"?a[1]=="i"?r=a+" "+o+";":n+=a[1]=="f"?Jl(o,a):a+"{"+Jl(o,a[1]=="k"?"":e)+"}":typeof o=="object"?n+=Jl(o,e?e.replace(/([^,])+/g,s=>a.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,s):s?s+" "+u:u)):a):o!=null&&(a=a.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=Jl.p?Jl.p(a,o):a+":"+o+";")}return r+(e&&i?e+"{"+i+"}":i)+n},Rh={},Vk=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+Vk(t[r]);return e}return t},_I=(t,e,r,n,i)=>{let a=Vk(t),o=Rh[a]||(Rh[a]=(s=>{let u=0,f=11;for(;u<s.length;)f=101*f+s.charCodeAt(u++)>>>0;return"go"+f})(a));if(!Rh[o]){let s=a!==t?t:(u=>{let f,d=[{}];for(;f=SI.exec(u.replace(kI,""));)f[4]?d.shift():f[3]?d.unshift(d[0][f[3]]=d[0][f[3]]||{}):d[0][f[1]]=f[2];return d[0]})(t);Rh[o]=Jl(i?{["@keyframes "+o]:s}:s,r?"":"."+o)}return((s,u,f)=>{u.data.indexOf(s)==-1&&(u.data=f?s+u.data:u.data+s)})(Rh[o],e,n),o};function V2(t){let e=this||{},r=t.call?t(e.p):t;return _I(r.unshift?r.raw?((n,i,a)=>n.reduce((o,s,u)=>{let f=i[u];if(f&&f.call){let d=f(a),h=d&&d.props&&d.props.className||/^go/.test(d)&&d;f=h?"."+h:d&&typeof d=="object"?d.props?"":Jl(d,""):d===!1?"":d}return o+s+(f??"")},""))(r,[].slice.call(arguments,1),e.p):r.reduce((n,i)=>Object.assign(n,i&&i.call?i(e.p):i),{}):r,xI(e.target),e.g,e.o,e.k)}let Wk,Yv,Kv;V2.bind({g:1});V2.bind({k:1});function PI(t,e,r,n){Jl.p=e,Wk=t,Yv=r,Kv=n}function Id(t,e){let r=this||{};return function(){let n=arguments;function i(a,o){let s=Object.assign({},a),u=s.className||i.className;r.p=Object.assign({theme:Yv&&Yv()},s),r.o=/ *go\d+/.test(u),s.className=V2.apply(r,n)+(u?" "+u:""),e&&(s.ref=o);let f=t;return t[0]&&(f=s.as||t,delete s.as),Kv&&f[0]&&Kv(s),Wk(f,s)}return e?e(i):i}}PI(Y.createElement,void 0,void 0,void 0);function Gk(t,e){if(e===1)return t;const r=_t.Util.colorToRGBA(t);return r?`rgba(${r.r}, ${r.g}, ${r.b}, ${r.a*e})`:t}function q4(t){const e=(t||"").trim();if(e==="<p><br></p>"||e==="<p></p>")return"";if(e.startsWith("<p>")&&e.endsWith("</p>")){const r=e.slice(3,-4);if(!/(<\/?(p|div|h[1-6]|ul|ol|li|table|thead|tbody|tr|td|blockquote)\b)/i.test(r))return r}return t}const oc=Gt({enabled:!1,currentFormat:{},editor:Gt.object({instance:null},{},{deep:!1})}),Xk=Id("div",Y.forwardRef)`
244
+ .ql-editor {
245
+ outline: none;
246
+ }
247
+ .ql-clipboard {
248
+ pointer-events: none;
249
+ opacity: 0;
250
+ }
251
+ ${kp}
252
+ strong {
253
+ font-weight: 700;
254
+ }
255
+ .ql-direction-rtl {
256
+ direction: rtl;
257
+ }
258
+ `;let EI=["bold","color","font","italic","size","strike","underline","indent","list","direction"];const V4=(t,e)=>{var r=t.clipboard.convert("<div class='ql-editor' style='outline: none;'>"+e+"<p><br></p></div>");t.setContents(r),t.history.clear()},TI=({html:t,onBlur:e,onChange:r,element:n,clickCoords:i})=>{var a;const o=Y.useRef(null);Y.useEffect(()=>{if(!o.current)return;const f=(d=o.current,new Rk(d,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1},formats:EI}));var d;Ls(()=>{oc.editor.instance=f}),window.__polotnoQuill=f,f.on("text-change",()=>{f.getSelection()&&Ls(()=>{oc.currentFormat=f.getFormat(f.getSelection())}),setTimeout(()=>{var v;const b=(v=o.current)===null||v===void 0?void 0:v.childNodes[0];if(!b)return;const x=b.innerHTML;r(q4(x))},10)}),V4(f,t),i?AI(f,i):f.setSelection(0,0,"api"),f.on("selection-change",(v,b,x)=>{v&&Ls(()=>{oc.currentFormat=f.getFormat(f.getSelection())})}),o.current.childNodes[0].addEventListener("blur",v=>{const b=v.relatedTarget;if(b?.classList.contains("ql-clipboard"))return;(function(k){return!!k&&!!k.closest(".sketch-picker")})(b)||e()});const h=o.current.childNodes[0],p=v=>{var b,x;const k=f.getSelection();if(!k||k.length===0)return;const S=f.getText(k.index,k.length).replace(/\n$/,""),P=window.getSelection();let _="";if(P&&P.rangeCount>0){const E=P.getRangeAt(0),A=document.createElement("div");A.appendChild(E.cloneContents()),_=A.innerHTML}if((b=v.clipboardData)===null||b===void 0||b.setData("text/plain",S),_){const E='<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><!--StartFragment--><div style="white-space: pre-wrap; word-wrap: break-word;">'+_+"</div><!--EndFragment--></body></html>";(x=v.clipboardData)===null||x===void 0||x.setData("text/html",E)}v.preventDefault()},y=v=>{p(v);const b=f.getSelection();b&&b.length>0&&f.deleteText(b.index,b.length)};return h.addEventListener("copy",p),h.addEventListener("cut",y),()=>{h.removeEventListener("copy",p),h.removeEventListener("cut",y),Ls(()=>{oc.editor.instance=null,oc.currentFormat={}}),delete window.__polotnoQuill}},[]),Y.useEffect(()=>IS(()=>n.text,()=>{var f,d;const h=oc.editor.instance;if(!h)return;const p=h.getSelection(),y=(d=(f=o.current)===null||f===void 0?void 0:f.childNodes)===null||d===void 0?void 0:d[0];q4(y?.innerHTML||"")===n.text||(V4(h,t),p&&(h.setSelection(p.index,p.length),Ls(()=>{oc.currentFormat=h.getFormat(h.getSelection())})))},{fireImmediately:!0}),[]),Y.useEffect(()=>{window.addEventListener("blur",e);const f=d=>{var h;!((h=o.current)===null||h===void 0)&&h.contains(d.target)||e()};return window.addEventListener("touchstart",f),()=>{window.removeEventListener("blur",e),window.removeEventListener("touchstart",f)}},[]);const s={color:n.fill};n.fill.indexOf("gradient")>=0&&(s.backgroundColor=n.fill,s.backgroundImage=n.fill,s.backgroundSize="100% 100%",s.backgroundRepeat="repeat",s.webkitBackgroundClip="text",s.MozBackgroundClip="text",s.WebkitTextFillColor="transparent",s.MozTextFillColor="transparent");const u=Ek(n);return Y.createElement(Xk,{ref:o,style:Object.assign(Object.assign({},s),{fontSize:n.fontSize,fontWeight:n.fontWeight,textTransform:n.textTransform,width:n.a.width,fontFamily:'"'+n.fontFamily+'"',lineHeight:n.lineHeight,letterSpacing:n.letterSpacing*n.fontSize+"px",textAlign:n.align,opacity:Math.max(n.a.opacity,.2),textShadow:n.shadowEnabled?`${n.shadowOffsetX}px ${n.shadowOffsetY}px ${n.shadowBlur}px ${Gk(n.shadowColor,(a=n.shadowOpacity)!==null&&a!==void 0?a:1)}`:void 0,caretColor:u}),dir:vp(ri(n.text))})};function CI(t){return!(function(e){const r=e.getContext("2d").getImageData(0,0,e.width,e.height).data;for(let n=0;n<r.length;n+=4)if(r[n+3]!==0)return!0;return!1})(t)}const W4=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),OI=Sr(({element:t,store:e})=>{var r;const n=Y.useRef(null),[i,a]=Y.useState(),[o,s]=Y.useState(!1),[u,f]=Y.useState(!1),d=Y.useRef(t.height),h=e.selectedShapes.indexOf(t)>=0&&t.selectable,p=Vg(h),y=t.fontSize/3,{textVerticalResizeEnabled:v}=lr,b=lr.autoDeleteEmptyText,x=Vg(t.fontFamily),[k]=Tk(e,t.fontFamily),S=t._editModeEnabled;Bp(n);const P=k?t.fontFamily:x!==t.fontFamily?x:"Arial",_=Go(t).fill,E=F1(t,{fontFamily:P,color:_}),A=F1(t,{fontFamily:P,color:_,forEditor:!0});let{width:T,height:I}=(function(V,ee,te){return Y.useMemo(()=>H4(V),[V,ee.width,te])})(E,t,k);Y.useEffect(()=>{if(!k)return;if(!t.height)return void e.history.ignore(()=>{t.set({height:I})});const{textOverflow:V}=lr;if(V!=="change-font-size"||o)V==="resize"&&(v&&t.height<I&&!o&&e.history.ignore(()=>{t.set({height:I})}),v||t.height===I||e.history.ignore(()=>{t.set({height:I})}));else{const ee=(te=>{let Q=te.fontSize;for(let ne=1;ne<50;ne++){const ue=F1(Object.assign(Object.assign({},te.toJSON()),{fontSize:Q}),{fontFamily:te.fontFamily}),{height:oe}=H4(ue);if(!(te.height&&oe>te.height||!lr.textSplitAllowed&&!te.curveEnabled&&vI({html:ue})))break;Q-=.5}return Q})(t);ee!==t.fontSize?e.history.ignore(()=>{t.set({fontSize:ee})}):t.height!==I&&(v&&t.height<I?e.history.ignore(()=>{t.set({height:I})}):v||e.history.ignore(()=>{t.set({height:I})}))}});const L=Y.useMemo(()=>{const V={lastArgs:null,lastResult:null};return async function(ee){return V.lastArgs&&V.lastResult&&(te=V.lastArgs,Q=ee,JSON.stringify(te)===JSON.stringify(Q))||(V.lastResult=await $4(ee),V.lastArgs=Object.assign({},ee)),V.lastResult;var te,Q}},[]),R=Y.useRef(0),N=Y.useRef(null);Y.useEffect(()=>{o||S||(async()=>{R.current++;const V=R.current;let ee=Ws(`text ${t.id} ${V}`);N.current&&N.current(),N.current=ee,f(!0);let te=null;const Q=W4?5:1;for(let ne=0;ne<Q;ne++){const ue=ne>0?L:$4;try{if(te=await ue({skipCache:ne>0,html:E,width:t.width||1,height:t.height||I||1,fontFamily:P,padding:y,pixelRatio:e._elementsPixelRatio,font:e.fonts.find(oe=>oe.fontFamily===P)||M2.find(oe=>oe.fontFamily===P)}),V!==R.current)return;if(W4&&CI(te)){await new Promise(oe=>setTimeout(oe,50*(ne+1)));continue}break}catch(oe){console.error(oe),Od(`Error rendering rich text with id ${t.id}`);break}}te?a(te):ee?(ee(),ee=null):console.error("Finish function is called twice!"),f(!1)})()},[E,o,I,S,P,t.height,e._elementsPixelRatio,k]);const[F,H]=Xv(u,300),[$]=Xv(o,300,!0),X=$||F;Y.useEffect(()=>{var V;if(!X)return io(()=>{const ee=n.current;Fi(ee,t)});(V=n.current)===null||V===void 0||V.clearCache()},[i,X,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]),Y.useEffect(()=>{i&&!u&&N.current&&(N.current(),N.current=null)},[i,u]),Y.useLayoutEffect(()=>{if(!k||!t.curveEnabled)return;const V=new _t.TextPath({data:_c(t.a.width,t.a.height,t.curvePower,t.a.fontSize),text:ri(t.text),letterSpacing:t.letterSpacing*t.a.fontSize,fontSize:t.a.fontSize,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontStyle:t.fontStyle,align:"center",textBaseline:"middle",fill:t.fill}),ee=V.getSelfRect().width;if(ee){const te=ee-t.a.width,Q=t.a.rotation*Math.PI/180,ne=-te/2*Math.cos(Q),ue=-te/2*Math.sin(Q);t.set({width:ee,x:t.a.x+ne,y:t.a.y+ue})}V.destroy()},[k,t.curveEnabled,t.curvePower,t.text,t.fontSize,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing]),Y.useEffect(()=>()=>{N.current&&N.current()},[]),Y.useEffect(()=>{p&&!h&&b&&ri(t.text)===""&&t.removable&&!t.placeholder&&e.deleteElements([t.id])},[b,t.placeholder,t.removable,t.text,h,p]);let Z=0;t.verticalAlign==="middle"&&(Z=(t.height-I)/2),t.verticalAlign==="bottom"&&(Z=t.height-I);const K=Ck({fontLoaded:k,fontFamily:t.fontFamily,fontSize:t.fontSize,lineHeight:t.lineHeight}),q=wu(),J=_c(t.a.width,I,t.curvePower,t.fontSize),U=Y.useRef(null),D=Y.useRef(null),W=S&&t.strokeWidth>0&&!t.curveEnabled;return Y.createElement(Y.Fragment,null,Y.createElement(ur,{x:t.a.x,y:t.a.y,offsetX:t.backgroundPadding*(t.fontSize*K*.5),offsetY:t.backgroundPadding*(t.fontSize*K*.5),rotation:t.a.rotation,hideInExport:!t.showInExport,listening:!1,visible:t.backgroundEnabled,opacity:t.backgroundOpacity*t.a.opacity,fill:t.backgroundColor,width:t.a.width+t.backgroundPadding*(t.fontSize*K),height:t.a.height+t.backgroundPadding*(t.fontSize*K),cornerRadius:t.backgroundCornerRadius*(t.fontSize*K*.5)}),Y.createElement(gp,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,data:J,stroke:"red",strokeWidth:1,visible:!1}),Y.createElement(ur,{ref:n,name:"element",x:t.a.x,y:t.a.y,listening:t.selectable,rotation:t.a.rotation,width:t.a.width,height:t.a.height,visible:!X,draggable:q?t.draggable&&h:t.draggable,preventDefault:!q||h,opacity:S?0:t.a.opacity,hideInExport:!t.showInExport,onDragMove:V=>{t.set({x:V.target.x(),y:V.target.y()})},onDragEnd:V=>{t.set({x:V.target.x(),y:V.target.y()})},id:t.id,onDblClick:V=>{t.contentEditable&&(D.current={x:V.evt.clientX,y:V.evt.clientY},t.toggleEditMode(!0))},onDblTap:V=>{var ee;if(t.contentEditable){const te=(ee=V.evt.changedTouches)===null||ee===void 0?void 0:ee[0];D.current=te?{x:te.clientX,y:te.clientY}:null,t.toggleEditMode(!0)}},onTransformStart:V=>{s(!0),d.current=t.height},onTransform:V=>{var ee;const te=V.target,Q=((ee=te.getStage())===null||ee===void 0?void 0:ee.findOne("Transformer")).getActiveAnchor(),ne=Q==="middle-left"||Q==="middle-right",ue=Q==="top-center"||Q==="bottom-center",oe=te.scaleX();if(ne){const de=te.scaleX(),Ee=te.width()*de,Fe=t.fontSize;let Le=Ee;if(Ee<Fe&&(Le=Fe,U.current&&te.position(U.current)),te.width(Le),te.scaleX(1),lr.textVerticalResizeEnabled){const $e=Math.max(I,d.current);t.set({height:$e})}t.set({width:te.width(),x:te.x(),y:te.y()})}else if(ue){const de=lr.textOverflow==="resize",Ee=typeof t.lineHeight=="number"?t.lineHeight:1;let Fe=de?I:Ee*t.fontSize;const Le=Math.max(Fe,V.target.height()*V.target.scaleY());te.scaleY(1),t.set({x:te.x(),y:te.y(),height:Le,rotation:te.rotation()})}else te.scaleX(1),te.scaleY(1),t.set({fontSize:t.fontSize*oe,letterSpacing:t.letterSpacing,width:te.width()*oe,x:te.x(),y:te.y(),rotation:te.rotation(),height:te.height()*oe});U.current=V.target.position()},onTransformEnd:V=>{s(!1),f(!0);const ee=V.target.scaleX();V.target.scaleX(1),V.target.scaleY(1),t.set({fontSize:t.fontSize*ee,width:V.target.width()*ee,x:V.target.x(),y:V.target.y(),rotation:V.target.rotation(),shadowBlur:t.shadowBlur*ee,shadowOffsetX:t.shadowOffsetX*ee,shadowOffsetY:t.shadowOffsetY*ee,strokeWidth:t.strokeWidth*ee})}}),Y.createElement(zo,{ref:n,image:i,x:t.a.x,y:t.a.y,offsetX:y,offsetY:y-Z,listening:!1,rotation:t.a.rotation,width:t.a.width+2*y,height:(t.a.width+2*y)*(i?.height/i?.width||1),visible:!X&&!S,opacity:t.a.opacity,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,hideInExport:!t.showInExport,editModeEnabled:t._editModeEnabled||o||X}),(X||W)&&Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,offsetY:-Z},Y.createElement(jg,{divProps:{style:{pointerEvents:"none"}}},Y.createElement(Xk,{dangerouslySetInnerHTML:{__html:E},style:{pointerEvents:"none",opacity:t.a.opacity,textShadow:t.shadowEnabled?`${t.shadowOffsetX}px ${t.shadowOffsetY}px ${t.shadowBlur}px ${Gk(t.shadowColor,(r=t.shadowOpacity)!==null&&r!==void 0?r:1)}`:void 0}}))),S&&Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,offsetY:-Z},Y.createElement(jg,null,Y.createElement(TI,{html:A,element:t,onChange:V=>{const ee=Pk({oldText:ri(t.text),newText:ri(V),element:t});t.set({text:V,fontSize:ee})},onBlur:V=>{t.toggleEditMode(!1),H(!0)},clickCoords:D.current}))))});function AI(t,e){if(!t||!e)return;const{x:r,y:n}=e;try{let i=null;if(document.caretRangeFromPoint)i=document.caretRangeFromPoint(r,n);else if(document.caretPositionFromPoint){const a=document.caretPositionFromPoint(r,n);a&&(i=document.createRange(),i.setStart(a.offsetNode,a.offset))}if(i){const a=Rk.find(i.startContainer,!0);if(a){const o=a.offset(t.scroll)+i.startOffset;return void t.setSelection(o,0,"api")}}}catch{}t.setSelection(0,0,"api")}function W2(t){return t/180*Math.PI}function fg(t,e,r,n,i){const a=Math.sqrt(r*r+n*n);return i+=Math.atan2(n,r),{x:t+a*Math.cos(i),y:e+a*Math.sin(i)}}function Rd(t){const{x:e,y:r,width:n,height:i}=t,a=W2(t.rotation),o=fg(e,r,0,0,a),s=fg(e,r,n,0,a),u=fg(e,r,n,i,a),f=fg(e,r,0,i,a),d=Math.min(o.x,s.x,u.x,f.x),h=Math.min(o.y,s.y,u.y,f.y),p=Math.max(o.x,s.x,u.x,f.x),y=Math.max(o.y,s.y,u.y,f.y);return{x:d,y:h,width:p-d,height:y-h,minX:d,minY:h,maxX:p,maxY:y}}function k0(t){const e=t.map(o=>Rd(o)),r=Math.min(...e.map(o=>o.minX)),n=Math.min(...e.map(o=>o.minY)),i=Math.max(...e.map(o=>o.maxX)),a=Math.max(...e.map(o=>o.maxY));return{x:r,y:n,width:i-r,height:a-n,minX:r,minY:n,maxX:i,maxY:a}}function II(t){const e=W2(t.rotation||0);return{x:t.x+t.width/2*Math.cos(e)+t.height/2*Math.sin(-e),y:t.y+t.height/2*Math.cos(e)+t.width/2*Math.sin(e)}}function RI(t,e,r){const n=W2(e),i=r.x+(t.x-r.x)*Math.cos(n)-(t.y-r.y)*Math.sin(n),a=r.y+(t.x-r.x)*Math.sin(n)+(t.y-r.y)*Math.cos(n);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:i,y:a})}function MI(t,e){return RI(t,e,II(t))}const Si={stroke:"rgb(0, 161, 255)",strokeWidth:1,dash:[4,6]},DI=({stroke:t,strokeWidth:e,dash:r})=>{t!==void 0&&(Si.stroke=t),e!==void 0&&(Si.strokeWidth=e),r!==void 0&&(Si.dash=r)};let G4=({targetKonvaNodes:t,guideKonvaNode:e,distance:r,snapDirection:n})=>r<5;function Qv(t,e){var r=[],n=[];t.vertical.forEach(f=>{e.vertical.forEach(d=>{var h=Math.abs(f.offset-d.guide);G4({targetKonvaNodes:d.nodes,guideKonvaNode:f.node,distance:h,snapDirection:f.snap})&&r.push({lineGuide:f.offset,diff:h,snap:d.snap,offset:d.offset})})}),t.horizontal.forEach(f=>{e.horizontal.forEach(d=>{var h=Math.abs(f.offset-d.guide);G4({targetKonvaNodes:d.nodes,guideKonvaNode:f.node,distance:h,snapDirection:f.snap})&&n.push({lineGuide:f.offset,diff:h,snap:d.snap,offset:d.offset})})});var i=[];const a=r.sort((f,d)=>f.diff-d.diff),o=n.sort((f,d)=>f.diff-d.diff);var s=a[0],u=o[0];return s&&a.filter(f=>Math.abs(f.diff-s.diff)<.1).forEach(f=>{i.push(Object.assign({orientation:"V"},f))}),u&&o.filter(f=>Math.abs(f.diff-u.diff)<.1).forEach(f=>{i.push(Object.assign({orientation:"H"},f))}),i}const Yk=()=>{if(_t.DD._dragElements.size===0)return;const t=[..._t.DD._dragElements.entries()],e=t.find(([r,n])=>n.node instanceof _t.Transformer);e&&(t.splice(t.indexOf(e),1),t.unshift(e),_t.DD._dragElements.clear(),t.forEach(([r,n])=>{_t.DD._dragElements.set(r,n)}))};function NI(t,e,r){const n=Y.useRef(null);DI(r);const i=d=>d.hasName("element")||d.hasName("page-background")||!n.current&&d.hasName("elements-area");function a(d){var h;const p=(h=t.current)===null||h===void 0?void 0:h.getStage(),y=[],v=[];return p.find(i).forEach(b=>{if(!(d.indexOf(b)>=0)){var x=b.getClientRect({skipShadow:!0,skipStroke:!0});y.push({offset:x.x,node:b,snap:"start"},{offset:x.x+x.width,node:b,snap:"end"},{offset:x.x+x.width/2,node:b,snap:"center"}),v.push({offset:x.y,node:b,snap:"start"},{offset:x.y+x.height,node:b,snap:"end"},{offset:x.y+x.height/2,node:b,snap:"center"})}}),{vertical:y,horizontal:v}}function o(d){var h;const p=(h=t.current)===null||h===void 0?void 0:h.getLayer(),y=p?.children.find(v=>v.name()==="line-guides");d.forEach(v=>{if(v.orientation==="H"){var b=new _t.Line({x:-p.getStage().x(),y:-p.getStage().y(),points:[-6e3,v.lineGuide,6e3,v.lineGuide],stroke:Si.stroke,strokeWidth:Si.strokeWidth,name:"guid-line",dash:Si.dash});y?.add(b),p.batchDraw()}else v.orientation==="V"&&(b=new _t.Line({x:-p.getStage().x(),y:-p.getStage().y(),points:[v.lineGuide,-6e3,v.lineGuide,6e3],stroke:Si.stroke,strokeWidth:Si.strokeWidth,name:"guid-line",dash:Si.dash}),y?.add(b))})}const s=d=>{const h=d.target.getLayer().children.find(P=>P.name()==="line-guides");h?.destroyChildren();var p=a(d.target.nodes()),y=(function(P){const _=P.__getNodeRect(),E=Rd(Object.assign(Object.assign({},_),{rotation:_t.Util.radToDeg(_.rotation)})),A=P.getAbsolutePosition();return{vertical:[{guide:E.x,offset:A.x-E.x,snap:"start",nodes:P.nodes()},{guide:E.x+E.width/2,offset:A.x-E.x-E.width/2,snap:"center",nodes:P.nodes()},{guide:E.x+E.width,offset:A.x-E.x-E.width,snap:"end",nodes:P.nodes()}],horizontal:[{guide:E.y,offset:A.y-E.y,snap:"start",nodes:P.nodes()},{guide:E.y+E.height/2,offset:A.y-E.y-E.height/2,snap:"center",nodes:P.nodes()},{guide:E.y+E.height,offset:A.y-E.y-E.height,snap:"end",nodes:P.nodes()}]}})(d.target),v=Qv(p,y);if(!v.length)return;o(v);const b=d.target.getAbsolutePosition(),x=(d.target.nodes().map(P=>P.getAbsolutePosition()),Object.assign({},b));v.forEach(P=>{switch(P.snap){case"start":case"center":case"end":switch(P.orientation){case"V":x.x=P.lineGuide+P.offset;break;case"H":x.y=P.lineGuide+P.offset}}});const k=x.x-b.x,S=x.y-b.y;d.evt.ctrlKey||d.evt.metaKey||d.target.nodes().forEach(P=>{const _=P.getAbsolutePosition();P.setAbsolutePosition({x:_.x+k,y:_.y+S})})},u=(d,h,p)=>{var y;const v=t.current,b=v.getLayer().children.find(I=>I.name()==="line-guides");if(b?.destroyChildren(),v.getActiveAnchor()==="rotater")return h;const x=v.getActiveAnchor(),k=LI[x],S=(y=v.findOne(`.${k}`))===null||y===void 0?void 0:y.getAbsolutePosition();if(!S)return h;const P={x:d.x-S.x,y:d.y-S.y},_=(function(I,L){const R=Y4(I,L)/Y4(L,L);return{x:R*L.x,y:R*L.y}})({x:h.x-d.x,y:h.y-d.y},P);if(Math.sqrt(Math.pow(_.x,2)+Math.pow(_.y,2))>5)return h;const E={x:d.x+_.x,y:d.y+_.y};var A=Qv(a(v.nodes()),{vertical:[{guide:E.x,offset:0,snap:"start",nodes:v.nodes()}],horizontal:[{guide:E.y,offset:0,snap:"start",nodes:v.nodes()}]});if(!A.length||(o(A),p.ctrlKey||p.metaKey))return h;const T=[];if(A.forEach(I=>{const L=(function(R,N,F){if(F.orientation==="V"){const H=F.lineGuide;if(Math.abs(N.x-R.x)<1e-4)return null;const $=(N.y-R.y)/(N.x-R.x);return{x:H,y:$*H+(R.y-$*R.x)}}{const H=F.lineGuide;if(Math.abs(N.y-R.y)<1e-4)return null;const $=(N.y-R.y)/(N.x-R.x);return{x:(H-R.y)/$+R.x,y:H}}})(E,S,{orientation:I.orientation,lineGuide:I.lineGuide});L&&T.push(L)}),T.length>0){let I=T[0],L=Math.sqrt(Math.pow(E.x-I.x,2)+Math.pow(E.y-I.y,2));if(T.forEach(R=>{const N=Math.sqrt(Math.pow(E.x-R.x,2)+Math.pow(E.y-R.y,2));N<L&&(L=N,I=R)}),L<10)return I}return E},f=d=>{if(!d.target)return;const h=d.target.getLayer(),p=h.children.find(y=>y.name()==="line-guides");p?.destroyChildren(),h.batchDraw()};Y.useEffect(()=>{t.current&&(t.current.anchorDragBoundFunc(u),t.current.on("dragstart",d=>{setTimeout(()=>{Yk()})}),t.current.on("dragmove",s),t.current.on("dragend",f),t.current.on("transformend",f),t.current.on("transform",d=>{var h,p;d.evt.ctrlKey||d.evt.metaKey?(h=t.current)===null||h===void 0||h.rotationSnapTolerance(0):(p=t.current)===null||p===void 0||p.rotationSnapTolerance(5)}))},[])}function X4(t,e,r){const n=o=>o.hasName("element")||o.hasName("line-anchor")||o.hasName("page-background")||o.hasName("elements-area"),i=o=>{const s=o.target.getLayer().children.find(v=>v.name()==="line-guides");s?.destroyChildren();var u,f=Qv((function(v){var b;const x=(b=t.current)===null||b===void 0?void 0:b.getStage();var k=[],S=[];return x.find(n).forEach(P=>{if(!(v.indexOf(P)>=0)){var _=P.getClientRect({skipShadow:!0,skipStroke:!0});P.hasName("line-anchor")&&(_={x:P.absolutePosition().x,y:P.absolutePosition().y,width:0,height:0}),k.push({offset:_.x,node:P,snap:"start"},{offset:_.x+_.width,node:P,snap:"end"},{offset:_.x+_.width/2,node:P,snap:"center"}),S.push({offset:_.y,node:P,snap:"start"},{offset:_.y+_.height,node:P,snap:"end"},{offset:_.y+_.height/2,node:P,snap:"center"})}}),{vertical:k,horizontal:S}})([o.target,...e.map(v=>v.current)]),{vertical:[{guide:(u=o.target).absolutePosition().x,offset:0,snap:"center",nodes:[u]}],horizontal:[{guide:u.absolutePosition().y,offset:0,snap:"center",nodes:[u]}]});if(!f.length)return;(function(v){var b;const x=(b=t.current)===null||b===void 0?void 0:b.getLayer(),k=x?.children.find(S=>S.name()==="line-guides");v.forEach(S=>{if(S.orientation==="H"){var P=new _t.Line({x:-x.getStage().x(),y:-x.getStage().y(),points:[-6e3,S.lineGuide,6e3,S.lineGuide],stroke:Si.stroke,strokeWidth:Si.strokeWidth,name:"guid-line",dash:Si.dash});k?.add(P),x.batchDraw()}else S.orientation==="V"&&(P=new _t.Line({x:-x.getStage().x(),y:-x.getStage().y(),points:[S.lineGuide,-6e3,S.lineGuide,6e3],stroke:Si.stroke,strokeWidth:Si.strokeWidth,name:"guid-line",dash:Si.dash}),k?.add(P))})})(f);const d=o.target.getAbsolutePosition(),h=Object.assign({},d);f.forEach(v=>{switch(v.snap){case"start":case"center":case"end":switch(v.orientation){case"V":h.x=v.lineGuide+v.offset;break;case"H":h.y=v.lineGuide+v.offset}}});const p=h.x-d.x,y=h.y-d.y;if(!o.evt.ctrlKey&&!o.evt.metaKey){const v=o.target.getAbsolutePosition();o.target.absolutePosition({x:v.x+p,y:v.y+y})}},a=o=>{if(!o.target)return;const s=o.target.getLayer(),u=s.children.find(f=>f.name()==="line-guides");u?.destroyChildren(),s.batchDraw()};Y.useEffect(()=>{t.current&&(t.current.on("dragmove",i),t.current.on("dragend",a))},r)}function Y4(t,e){return t.x*e.x+t.y*e.y}const LI={"top-left":"bottom-right","top-center":"bottom-center","top-right":"bottom-left","middle-right":"middle-left","bottom-right":"top-left","bottom-center":"top-center","bottom-left":"top-right","middle-left":"middle-right"};function FI(t){const{x:e,y:r,width:n,height:i,rotation:a}=t.a,o=a*Math.PI/180,s={x:e+i/2*Math.cos(o+Math.PI/2),y:r+i/2*Math.sin(o+Math.PI/2)};return{middleLeft:s,middleRight:{x:s.x+n*Math.cos(o),y:s.y+n*Math.sin(o)}}}function K4(t,e,r){const n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),i=Math.atan2(e.y-t.y,e.x-t.x),a=180*i/Math.PI;return{x:t.x+Math.cos(i-Math.PI/2)*r/2,y:t.y+Math.sin(i-Math.PI/2)*r/2,width:n,height:r,rotation:a}}const Q4=(t,e)=>{const r=zs.anchorSize||10;return{offsetX:r/2/t,offsetY:r/2/t,width:r/t,height:r/t,cornerRadius:(zs.anchorCornerRadius||0)/t,fill:zs.anchorFill||"white",stroke:zs.anchorStroke||"rgb(0, 161, 255)",strokeWidth:zs.anchorStrokeWidth||2,strokeScaleEnabled:!1,draggable:!0,dragDistance:0,onMouseEnter:n=>{n.target.getStage().container().style.cursor="crosshair"},onMouseLeave:n=>{n.target.getStage().container().style.cursor=""},onDragStart:n=>{e.history.startTransaction()},onDragEnd:n=>{e.history.endTransaction()}}},Z4=Sr(({element:t,type:e})=>{const r=Go(t,t.a.color,"fill"),n=Go(t,t.a.color,"stroke"),i=Object.assign(Object.assign(Object.assign({strokeWidth:t.height,lineCap:"round",lineJoin:"round"},n),r),{opacity:t.a.opacity,hideInExport:!t.showInExport});return Y.createElement(Y.Fragment,null,e==="arrow"&&Y.createElement(js,Object.assign({points:[3*t.height,2*-t.height,0,0,3*t.height,2*t.height]},i)),e==="triangle"&&Y.createElement(js,Object.assign({points:[3*t.height,2*-t.height,0,0,3*t.height,2*t.height],closed:!0},i)),e==="bar"&&Y.createElement(js,Object.assign({points:[0,2*-t.height,0,2*t.height],closed:!0},i)),e==="square"&&Y.createElement(js,Object.assign({points:[0,2*-t.height,4*t.height,2*-t.height,4*t.height,2*t.height,0,2*t.height],closed:!0},i)),e==="circle"&&Y.createElement(IT,Object.assign({x:2*t.height,y:0,radius:2*t.height},i)))}),BI=Sr(({element:t,store:e})=>{const r=Y.useRef(null),n=Y.useRef(null),i=Y.useRef(null),a=t.selectable||e.role==="admin",o=wu(),s=e.selectedElements.indexOf(t)>=0&&e.selectedElements.length===1,u=e.selectedShapes.indexOf(t)>=0&&t.selectable,{middleLeft:f,middleRight:d}=FI(t);X4(n,[r],[s]),X4(i,[r],[s]);const h=Go(t,t.a.color,"stroke");return Y.createElement(Y.Fragment,null,Y.createElement(js,Object.assign({ref:r,name:"element",id:t.id,x:t.a.x,y:t.a.y,points:[0,0,t.a.width,0],offsetY:-t.a.height/2,strokeWidth:t.a.height,hitStrokeWidth:Math.max(t.a.height,20),dash:t.dash.map(p=>p*t.a.height)},h,{rotation:t.a.rotation,opacity:t.animated("opacity"),shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,listening:a,draggable:o?t.draggable&&u:t.draggable,preventDefault:!o||u,hideInExport:!t.showInExport,onDragMove:p=>{t.set({x:p.target.x(),y:p.target.y()})},onDragEnd:p=>{t.set({x:p.target.x(),y:p.target.y()})},onTransform:p=>{const y=p.target.scaleX();p.target.scaleX(1),p.target.scaleY(1),t.set({height:t.height*y,width:t.width*y,x:p.target.x(),y:p.target.y(),rotation:p.target.rotation()})}})),Y.createElement(Jt,{x:f.x,y:f.y,rotation:t.rotation,hideInExport:!t.showInExport,onClick:p=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("click",p)},onTap:p=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("tap",p)}},Y.createElement(Z4,{element:t,type:t.startHead})),Y.createElement(Jt,{x:d.x,y:d.y,rotation:t.rotation+180,onClick:p=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("click",p)},onTap:p=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("tap",p)}},Y.createElement(Z4,{element:t,type:t.endHead})),s&&t.resizable&&Y.createElement(R2,{selector:".page-abs-container",enabled:!0},Y.createElement(Jt,{visible:s},Y.createElement(ur,Object.assign({x:f.x,y:f.y,ref:n,name:"line-anchor"},Q4(e.scale,e),{onDragMove:p=>{const y=K4(p.target.position(),d,t.height);t.set({x:y.x,y:y.y,width:y.width,rotation:y.rotation})}})),Y.createElement(ur,Object.assign({x:d.x,y:d.y,ref:i,name:"line-anchor"},Q4(e.scale,e),{onDragMove:p=>{const y=K4(f,p.target.position(),t.height);t.set({x:y.x,y:y.y,width:y.width,rotation:y.rotation})}})))))});function pe(t){if(!t)throw new Error("Assertion failed.")}const Kk=t=>{const e=(t%360+360)%360;if(e===0||e===90||e===180||e===270)return e;throw new Error(`Invalid rotation ${t}.`)},ni=t=>t&&t[t.length-1],hL=t=>t>=0&&t<2**32;class Dr{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){const e=Math.floor(this.pos/8),r=this.bytes[e]??0,n=7-(this.pos&7),i=(r&1<<n)>>n;return this.pos++,i}readBits(e){if(e===1)return this.readBit();let r=0;for(let n=0;n<e;n++)r<<=1,r|=this.readBit();return r}writeBits(e,r){const n=this.pos+e;for(let i=this.pos;i<n;i++){const a=Math.floor(i/8);let o=this.bytes[a];const s=7-(i&7);o&=~(1<<s),o|=(r&1<<n-i-1)>>n-i-1<<s,this.bytes[a]=o}this.pos=n}readAlignedByte(){if(this.pos%8!==0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,r=this.bytes[e]??0;return this.pos+=8,r}skipBits(e){this.pos+=e}getBitsLeft(){return this.bytes.length*8-this.pos}clone(){const e=new Dr(this.bytes);return e.pos=this.pos,e}}const tt=t=>{let e=0;for(;t.readBits(1)===0&&e<32;)e++;if(e>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<e)-1+t.readBits(e)},Us=t=>{const e=tt(t);return(e&1)===0?-(e>>1):e+1>>1},lu=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),Fr=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),Ra=new TextDecoder,pL=new TextEncoder,G2=t=>Object.fromEntries(Object.entries(t).map(([e,r])=>[r,e])),X2={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},Wg=G2(X2),Y2={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Gg=G2(Y2),K2={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Xg=G2(K2),mL=t=>!!t&&!!t.primaries&&!!t.transfer&&!!t.matrix&&t.fullRange!==void 0,_0=t=>t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||ArrayBuffer.isView(t);class Up{constructor(){this.currentPromise=Promise.resolve(),this.pending=0}async acquire(){let e;const r=new Promise(i=>{let a=!1;e=()=>{a||(i(),this.pending--,a=!0)}}),n=this.currentPromise;return this.currentPromise=r,this.pending++,await n,e}}const J4=t=>[...t].map(e=>e.toString(16).padStart(2,"0")).join(""),ex=t=>(t=t>>1&1431655765|(t&1431655765)<<1,t=t>>2&858993459|(t&858993459)<<2,t=t>>4&252645135|(t&252645135)<<4,t=t>>8&16711935|(t&16711935)<<8,t=t>>16&65535|(t&65535)<<16,t>>>0),Hp=(t,e,r)=>{let n=0,i=t.length-1,a=-1;for(;n<=i;){const o=n+i>>1,s=r(t[o]);s===e?(a=o,i=o-1):s<e?n=o+1:i=o-1}return a},or=(t,e,r)=>{let n=0,i=t.length-1,a=-1;for(;n<=i;){const o=n+(i-n+1)/2|0;r(t[o])<=e?(a=o,n=o+1):i=o-1}return a},tx=(t,e,r)=>{const n=or(t,r(e),r);t.splice(n+1,0,e)},ta=()=>{let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},Qk=(t,e)=>{for(let r=t.length-1;r>=0;r--)if(e(t[r]))return t[r]},Q2=(t,e)=>{for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1},zI=async function*(t){Symbol.iterator in t?yield*t[Symbol.iterator]():yield*t[Symbol.asyncIterator]()},jI=t=>{if(!(Symbol.iterator in t)&&!(Symbol.asyncIterator in t))throw new TypeError("Argument must be an iterable or async iterable.")},_p=t=>{throw new Error(`Unexpected value: ${t}`)},P0=(t,e,r)=>{const n=t.getUint8(e),i=t.getUint8(e+1),a=t.getUint8(e+2);return r?n|i<<8|a<<16:n<<16|i<<8|a},UI=(t,e,r)=>P0(t,e,r)<<8>>8,Zk=(t,e,r,n)=>{r=r>>>0,r=r&16777215,n?(t.setUint8(e,r&255),t.setUint8(e+1,r>>>8&255),t.setUint8(e+2,r>>>16&255)):(t.setUint8(e,r>>>16&255),t.setUint8(e+1,r>>>8&255),t.setUint8(e+2,r&255))},gL=(t,e,r,n)=>{r=cd(r,-8388608,8388607),r<0&&(r=r+16777216&16777215),Zk(t,e,r,n)},Yg=(t,e)=>({async next(){const r=await t.next();return r.done?{value:void 0,done:!0}:{value:e(r.value),done:!1}},return(){return t.return()},throw(r){return t.throw(r)},[Symbol.asyncIterator](){return this}}),cd=(t,e,r)=>Math.max(e,Math.min(r,t)),Ia="und",Pp=t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t},Jk=(t,e)=>Math.round(t/e)*e,HI=t=>{let e=0;for(;t;)e++,t>>=1;return e},$I=/^[a-z]{3}$/,e8=t=>$I.test(t),tu=1e6*(1+Number.EPSILON),rx=(t,e)=>{const r={...t,...e};if(t.headers||e.headers){const n=t.headers?nx(t.headers):{},i=e.headers?nx(e.headers):{},a={...n};Object.entries(i).forEach(([o,s])=>{const u=Object.keys(a).find(f=>f.toLowerCase()===o.toLowerCase());u&&delete a[u],a[o]=s}),r.headers=a}return r},nx=t=>{if(t instanceof Headers){const e={};return t.forEach((r,n)=>{e[n]=r}),e}if(Array.isArray(t)){const e={};return t.forEach(([r,n])=>{e[r]=n}),e}return t},ix=async(t,e,r,n,i)=>{let a=0;for(;;)try{return await t(e,r)}catch(o){if(i())throw o;a++;const s=n(a,o,e);if(s===null)throw o;if(console.error("Retrying failed fetch. Error:",o),!Number.isFinite(s)||s<0)throw new TypeError("Retry delay must be a non-negative finite number.");if(s>0&&await new Promise(u=>setTimeout(u,1e3*s)),i())throw o}},yL=(t,e)=>{const r=t<0?-1:1;t=Math.abs(t);let n=0,i=1,a=1,o=0,s=t;for(;;){const u=Math.floor(s),f=u*a+n,d=u*o+i;if(d>e)return{numerator:r*a,denominator:o};if(n=a,i=o,a=f,o=d,s=1/(s-u),!isFinite(s))break}return{numerator:r*a,denominator:o}};class t8{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let Ky=null;const kg=()=>Ky!==null?Ky:Ky=!!(typeof navigator<"u"&&(navigator.vendor?.match(/apple/i)||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)));let Qy=null;const Zv=()=>Qy!==null?Qy:Qy=typeof navigator<"u"&&navigator.userAgent?.includes("Firefox");let Zy=null;const Jv=()=>Zy!==null?Zy:Zy=!!(typeof navigator<"u"&&(navigator.vendor?.includes("Google Inc")||/Chrome/.test(navigator.userAgent)));let Jy=null;const qI=()=>{if(Jy!==null)return Jy;if(typeof navigator>"u")return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Jy=Number(t[1]):null},Vf=(t,e)=>t!==-1?t:e,e2=(t,e,r,n)=>t<=n&&r<=e,vL=function*(t){for(const e in t){const r=t[e];r!==void 0&&(yield{key:e,value:r})}},VI=t=>{const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},r8=()=>{Symbol.dispose??=Symbol("Symbol.dispose")},n8=t=>typeof t=="number"&&!Number.isNaN(t);class sp{constructor(e,r){if(this.data=e,this.mimeType=r,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if(typeof r!="string")throw new TypeError("mimeType must be a string.")}}class i8{constructor(e,r,n,i){if(this.data=e,this.mimeType=r,this.name=n,this.description=i,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if(r!==void 0&&typeof r!="string")throw new TypeError("mimeType, when provided, must be a string.");if(n!==void 0&&typeof n!="string")throw new TypeError("name, when provided, must be a string.");if(i!==void 0&&typeof i!="string")throw new TypeError("description, when provided, must be a string.")}}const bL=t=>{if(!t||typeof t!="object")throw new TypeError("tags must be an object.");if(t.title!==void 0&&typeof t.title!="string")throw new TypeError("tags.title, when provided, must be a string.");if(t.description!==void 0&&typeof t.description!="string")throw new TypeError("tags.description, when provided, must be a string.");if(t.artist!==void 0&&typeof t.artist!="string")throw new TypeError("tags.artist, when provided, must be a string.");if(t.album!==void 0&&typeof t.album!="string")throw new TypeError("tags.album, when provided, must be a string.");if(t.albumArtist!==void 0&&typeof t.albumArtist!="string")throw new TypeError("tags.albumArtist, when provided, must be a string.");if(t.trackNumber!==void 0&&(!Number.isInteger(t.trackNumber)||t.trackNumber<=0))throw new TypeError("tags.trackNumber, when provided, must be a positive integer.");if(t.tracksTotal!==void 0&&(!Number.isInteger(t.tracksTotal)||t.tracksTotal<=0))throw new TypeError("tags.tracksTotal, when provided, must be a positive integer.");if(t.discNumber!==void 0&&(!Number.isInteger(t.discNumber)||t.discNumber<=0))throw new TypeError("tags.discNumber, when provided, must be a positive integer.");if(t.discsTotal!==void 0&&(!Number.isInteger(t.discsTotal)||t.discsTotal<=0))throw new TypeError("tags.discsTotal, when provided, must be a positive integer.");if(t.genre!==void 0&&typeof t.genre!="string")throw new TypeError("tags.genre, when provided, must be a string.");if(t.date!==void 0&&(!(t.date instanceof Date)||Number.isNaN(t.date.getTime())))throw new TypeError("tags.date, when provided, must be a valid Date.");if(t.lyrics!==void 0&&typeof t.lyrics!="string")throw new TypeError("tags.lyrics, when provided, must be a string.");if(t.images!==void 0){if(!Array.isArray(t.images))throw new TypeError("tags.images, when provided, must be an array.");for(const e of t.images){if(!e||typeof e!="object")throw new TypeError("Each image in tags.images must be an object.");if(!(e.data instanceof Uint8Array))throw new TypeError("Each image.data must be a Uint8Array.");if(typeof e.mimeType!="string")throw new TypeError("Each image.mimeType must be a string.");if(!["coverFront","coverBack","unknown"].includes(e.kind))throw new TypeError("Each image.kind must be 'coverFront', 'coverBack', or 'unknown'.")}}if(t.comment!==void 0&&typeof t.comment!="string")throw new TypeError("tags.comment, when provided, must be a string.");if(t.raw!==void 0){if(!t.raw||typeof t.raw!="object")throw new TypeError("tags.raw, when provided, must be an object.");for(const e of Object.values(t.raw))if(e!==null&&typeof e!="string"&&!(e instanceof Uint8Array)&&!(e instanceof sp)&&!(e instanceof i8))throw new TypeError("Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, or null.")}},Su={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1},wL=t=>{if(!t||typeof t!="object")throw new TypeError("disposition must be an object.");if(t.default!==void 0&&typeof t.default!="boolean")throw new TypeError("disposition.default must be a boolean.");if(t.forced!==void 0&&typeof t.forced!="boolean")throw new TypeError("disposition.forced must be a boolean.");if(t.original!==void 0&&typeof t.original!="boolean")throw new TypeError("disposition.original must be a boolean.");if(t.commentary!==void 0&&typeof t.commentary!="boolean")throw new TypeError("disposition.commentary must be a boolean.");if(t.hearingImpaired!==void 0&&typeof t.hearingImpaired!="boolean")throw new TypeError("disposition.hearingImpaired must be a boolean.");if(t.visuallyImpaired!==void 0&&typeof t.visuallyImpaired!="boolean")throw new TypeError("disposition.visuallyImpaired must be a boolean.")};const xL=["avc","hevc","vp9","av1","vp8"],Ys=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],WI=["aac","opus","mp3","vorbis","flac"],SL=[...WI,...Ys],kL=["webvtt"],Kg=[{maxMacroblocks:99,maxBitrate:64e3,maxDpbMbs:396,level:10},{maxMacroblocks:396,maxBitrate:192e3,maxDpbMbs:900,level:11},{maxMacroblocks:396,maxBitrate:384e3,maxDpbMbs:2376,level:12},{maxMacroblocks:396,maxBitrate:768e3,maxDpbMbs:2376,level:13},{maxMacroblocks:396,maxBitrate:2e6,maxDpbMbs:2376,level:20},{maxMacroblocks:792,maxBitrate:4e6,maxDpbMbs:4752,level:21},{maxMacroblocks:1620,maxBitrate:4e6,maxDpbMbs:8100,level:22},{maxMacroblocks:1620,maxBitrate:1e7,maxDpbMbs:8100,level:30},{maxMacroblocks:3600,maxBitrate:14e6,maxDpbMbs:18e3,level:31},{maxMacroblocks:5120,maxBitrate:2e7,maxDpbMbs:20480,level:32},{maxMacroblocks:8192,maxBitrate:2e7,maxDpbMbs:32768,level:40},{maxMacroblocks:8192,maxBitrate:5e7,maxDpbMbs:32768,level:41},{maxMacroblocks:8704,maxBitrate:5e7,maxDpbMbs:34816,level:42},{maxMacroblocks:22080,maxBitrate:135e6,maxDpbMbs:110400,level:50},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:51},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:52},{maxMacroblocks:139264,maxBitrate:24e7,maxDpbMbs:696320,level:60},{maxMacroblocks:139264,maxBitrate:48e7,maxDpbMbs:696320,level:61},{maxMacroblocks:139264,maxBitrate:8e8,maxDpbMbs:696320,level:62}],ax=[{maxPictureSize:36864,maxBitrate:128e3,tier:"L",level:30},{maxPictureSize:122880,maxBitrate:15e5,tier:"L",level:60},{maxPictureSize:245760,maxBitrate:3e6,tier:"L",level:63},{maxPictureSize:552960,maxBitrate:6e6,tier:"L",level:90},{maxPictureSize:983040,maxBitrate:1e7,tier:"L",level:93},{maxPictureSize:2228224,maxBitrate:12e6,tier:"L",level:120},{maxPictureSize:2228224,maxBitrate:3e7,tier:"H",level:120},{maxPictureSize:2228224,maxBitrate:2e7,tier:"L",level:123},{maxPictureSize:2228224,maxBitrate:5e7,tier:"H",level:123},{maxPictureSize:8912896,maxBitrate:25e6,tier:"L",level:150},{maxPictureSize:8912896,maxBitrate:1e8,tier:"H",level:150},{maxPictureSize:8912896,maxBitrate:4e7,tier:"L",level:153},{maxPictureSize:8912896,maxBitrate:16e7,tier:"H",level:153},{maxPictureSize:8912896,maxBitrate:6e7,tier:"L",level:156},{maxPictureSize:8912896,maxBitrate:24e7,tier:"H",level:156},{maxPictureSize:35651584,maxBitrate:6e7,tier:"L",level:180},{maxPictureSize:35651584,maxBitrate:24e7,tier:"H",level:180},{maxPictureSize:35651584,maxBitrate:12e7,tier:"L",level:183},{maxPictureSize:35651584,maxBitrate:48e7,tier:"H",level:183},{maxPictureSize:35651584,maxBitrate:24e7,tier:"L",level:186},{maxPictureSize:35651584,maxBitrate:8e8,tier:"H",level:186}],ru=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],ox=[{maxPictureSize:147456,maxBitrate:15e5,tier:"M",level:0},{maxPictureSize:278784,maxBitrate:3e6,tier:"M",level:1},{maxPictureSize:665856,maxBitrate:6e6,tier:"M",level:4},{maxPictureSize:1065024,maxBitrate:1e7,tier:"M",level:5},{maxPictureSize:2359296,maxBitrate:12e6,tier:"M",level:8},{maxPictureSize:2359296,maxBitrate:3e7,tier:"H",level:8},{maxPictureSize:2359296,maxBitrate:2e7,tier:"M",level:9},{maxPictureSize:2359296,maxBitrate:5e7,tier:"H",level:9},{maxPictureSize:8912896,maxBitrate:3e7,tier:"M",level:12},{maxPictureSize:8912896,maxBitrate:1e8,tier:"H",level:12},{maxPictureSize:8912896,maxBitrate:4e7,tier:"M",level:13},{maxPictureSize:8912896,maxBitrate:16e7,tier:"H",level:13},{maxPictureSize:8912896,maxBitrate:6e7,tier:"M",level:14},{maxPictureSize:8912896,maxBitrate:24e7,tier:"H",level:14},{maxPictureSize:35651584,maxBitrate:6e7,tier:"M",level:15},{maxPictureSize:35651584,maxBitrate:24e7,tier:"H",level:15},{maxPictureSize:35651584,maxBitrate:6e7,tier:"M",level:16},{maxPictureSize:35651584,maxBitrate:24e7,tier:"H",level:16},{maxPictureSize:35651584,maxBitrate:1e8,tier:"M",level:17},{maxPictureSize:35651584,maxBitrate:48e7,tier:"H",level:17},{maxPictureSize:35651584,maxBitrate:16e7,tier:"M",level:18},{maxPictureSize:35651584,maxBitrate:8e8,tier:"H",level:18},{maxPictureSize:35651584,maxBitrate:16e7,tier:"M",level:19},{maxPictureSize:35651584,maxBitrate:8e8,tier:"H",level:19}],sx=".01.01.01.01.00",lx=".0.110.01.01.01.0",_L=(t,e,r,n)=>{if(t==="avc"){const a=Math.ceil(e/16)*Math.ceil(r/16),o=Kg.find(h=>a<=h.maxMacroblocks&&n<=h.maxBitrate)??ni(Kg),s=o?o.level:0,u="64".padStart(2,"0"),f="00",d=s.toString(16).padStart(2,"0");return`avc1.${u}${f}${d}`}else if(t==="hevc"){const s=e*r,u=ax.find(d=>s<=d.maxPictureSize&&n<=d.maxBitrate)??ni(ax);return`hev1.1.6.${u.tier}${u.level}.B0`}else{if(t==="vp8")return"vp8";if(t==="vp9"){const a=e*r;return`vp09.00.${(ru.find(u=>a<=u.maxPictureSize&&n<=u.maxBitrate)??ni(ru)).level.toString().padStart(2,"0")}.08`}else if(t==="av1"){const a=e*r,o=ox.find(f=>a<=f.maxPictureSize&&n<=f.maxBitrate)??ni(ox);return`av01.0.${o.level.toString().padStart(2,"0")}${o.tier}.08`}}throw new TypeError(`Unhandled codec '${t}'.`)},PL=t=>{const e=t.split("."),i=(1<<7)+1,a=Number(e[1]),o=e[2],s=Number(o.slice(0,-1)),u=(a<<5)+s,f=o.slice(-1)==="H"?1:0,h=Number(e[3])===8?0:1,p=0,y=e[4]?Number(e[4]):0,v=e[5]?Number(e[5][0]):1,b=e[5]?Number(e[5][1]):1,x=e[5]?Number(e[5][2]):0,k=(f<<7)+(h<<6)+(p<<5)+(y<<4)+(v<<3)+(b<<2)+x;return[i,u,k,0]},Z2=t=>{const{codec:e,codecDescription:r,colorSpace:n,avcCodecInfo:i,hevcCodecInfo:a,vp9CodecInfo:o,av1CodecInfo:s}=t;if(e==="avc"){if(pe(t.avcType!==null),i){const u=new Uint8Array([i.avcProfileIndication,i.profileCompatibility,i.avcLevelIndication]);return`avc${t.avcType}.${J4(u)}`}if(!r||r.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${t.avcType}.${J4(r.subarray(1,4))}`}else if(e==="hevc"){let u,f,d,h,p,y;if(a)u=a.generalProfileSpace,f=a.generalProfileIdc,d=ex(a.generalProfileCompatibilityFlags),h=a.generalTierFlag,p=a.generalLevelIdc,y=[...a.generalConstraintIndicatorFlags];else{if(!r||r.byteLength<23)throw new TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");const b=Fr(r),x=b.getUint8(1);u=x>>6&3,f=x&31,d=ex(b.getUint32(2)),h=x>>5&1,p=b.getUint8(12),y=[];for(let k=0;k<6;k++)y.push(b.getUint8(6+k))}let v="hev1.";for(v+=["","A","B","C"][u]+f,v+=".",v+=d.toString(16).toUpperCase(),v+=".",v+=h===0?"L":"H",v+=p;y.length>0&&y[y.length-1]===0;)y.pop();return y.length>0&&(v+=".",v+=y.map(b=>b.toString(16).toUpperCase()).join(".")),v}else{if(e==="vp8")return"vp8";if(e==="vp9"){if(!o){const k=t.width*t.height;let S=ni(ru).level;for(const P of ru)if(k<=P.maxPictureSize){S=P.level;break}return`vp09.00.${S.toString().padStart(2,"0")}.08`}const u=o.profile.toString().padStart(2,"0"),f=o.level.toString().padStart(2,"0"),d=o.bitDepth.toString().padStart(2,"0"),h=o.chromaSubsampling.toString().padStart(2,"0"),p=o.colourPrimaries.toString().padStart(2,"0"),y=o.transferCharacteristics.toString().padStart(2,"0"),v=o.matrixCoefficients.toString().padStart(2,"0"),b=o.videoFullRangeFlag.toString().padStart(2,"0");let x=`vp09.${u}.${f}.${d}.${h}`;return x+=`.${p}.${y}.${v}.${b}`,x.endsWith(sx)&&(x=x.slice(0,-sx.length)),x}else if(e==="av1"){if(!s){const P=t.width*t.height;let _=ni(ru).level;for(const E of ru)if(P<=E.maxPictureSize){_=E.level;break}return`av01.0.${_.toString().padStart(2,"0")}M.08`}const u=s.profile,f=s.level.toString().padStart(2,"0"),d=s.tier?"H":"M",h=s.bitDepth.toString().padStart(2,"0"),p=s.monochrome?"1":"0",y=100*s.chromaSubsamplingX+10*s.chromaSubsamplingY+1*(s.chromaSubsamplingX&&s.chromaSubsamplingY?s.chromaSamplePosition:0),v=n?.primaries?X2[n.primaries]:1,b=n?.transfer?Y2[n.transfer]:1,x=n?.matrix?K2[n.matrix]:1,k=n?.fullRange?1:0;let S=`av01.${u}.${f}${d}.${h}`;return S+=`.${p}.${y.toString().padStart(3,"0")}`,S+=`.${v.toString().padStart(2,"0")}`,S+=`.${b.toString().padStart(2,"0")}`,S+=`.${x.toString().padStart(2,"0")}`,S+=`.${k}`,S.endsWith(lx)&&(S=S.slice(0,-lx.length)),S}}throw new TypeError(`Unhandled codec '${e}'.`)},EL=(t,e,r)=>{if(t==="aac")return e>=2&&r<=24e3?"mp4a.40.29":r<=24e3?"mp4a.40.5":"mp4a.40.2";if(t==="mp3")return"mp3";if(t==="opus")return"opus";if(t==="vorbis")return"vorbis";if(t==="flac")return"flac";if(Ys.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},J2=t=>{const{codec:e,codecDescription:r,aacCodecInfo:n}=t;if(e==="aac"){if(!n)throw new TypeError("AAC codec info must be provided.");if(n.isMpeg2)return"mp4a.67";{let i;return n.objectType!==null?i=n.objectType:i=a8(r).objectType,`mp4a.40.${i}`}}else{if(e==="mp3")return"mp3";if(e==="opus")return"opus";if(e==="vorbis")return"vorbis";if(e==="flac")return"flac";if(e&&Ys.includes(e))return e}throw new TypeError(`Unhandled codec '${e}'.`)},kd=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],E0=[-1,1,2,3,4,5,6,8],a8=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Dr(t);let r=e.readBits(5);r===31&&(r=32+e.readBits(6));const n=e.readBits(4);let i=null;n===15?i=e.readBits(24):n<kd.length&&(i=kd[n]);const a=e.readBits(4);let o=null;return a>=1&&a<=7&&(o=E0[a]),{objectType:r,frequencyIndex:n,sampleRate:i,channelConfiguration:a,numberOfChannels:o}},TL=t=>{let e=kd.indexOf(t.sampleRate),r=null;e===-1&&(e=15,r=t.sampleRate);const n=E0.indexOf(t.numberOfChannels);if(n===-1)throw new TypeError(`Unsupported number of channels: ${t.numberOfChannels}`);let i=13;t.objectType>=32&&(i+=6),e===15&&(i+=24);const a=Math.ceil(i/8),o=new Uint8Array(a),s=new Dr(o);return t.objectType<32?s.writeBits(5,t.objectType):(s.writeBits(5,31),s.writeBits(6,t.objectType-32)),s.writeBits(4,e),e===15&&s.writeBits(24,r),s.writeBits(4,n),o},T0=48e3,o8=/^pcm-([usf])(\d+)+(be)?$/,s8=t=>{if(pe(Ys.includes(t)),t==="ulaw")return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if(t==="alaw")return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const e=o8.exec(t);pe(e);let r;e[1]==="u"?r="unsigned":e[1]==="s"?r="signed":r="float";const n=Number(e[2])/8,i=e[3]!=="be",a=t==="pcm-u8"?2**7:0;return{dataType:r,sampleSize:n,littleEndian:i,silentValue:a}},CL=t=>t.startsWith("avc1")||t.startsWith("avc3")?"avc":t.startsWith("hev1")||t.startsWith("hvc1")?"hevc":t==="vp8"?"vp8":t.startsWith("vp09")?"vp9":t.startsWith("av01")?"av1":t.startsWith("mp4a.40")||t==="mp4a.67"?"aac":t==="mp3"||t==="mp4a.69"||t==="mp4a.6B"||t==="mp4a.6b"?"mp3":t==="opus"?"opus":t==="vorbis"?"vorbis":t==="flac"?"flac":t==="ulaw"?"ulaw":t==="alaw"?"alaw":o8.test(t)?t:t==="webvtt"?"webvtt":null,OL=t=>t==="avc"?{avc:{format:"avc"}}:t==="hevc"?{hevc:{format:"hevc"}}:{},AL=t=>t==="aac"?{aac:{format:"aac"}}:t==="opus"?{opus:{format:"opus"}}:{},GI=["avc1","avc3","hev1","hvc1","vp8","vp09","av01"],XI=/^(avc1|avc3)\.[0-9a-fA-F]{6}$/,YI=/^(hev1|hvc1)\.(?:[ABC]?\d+)\.[0-9a-fA-F]{1,8}\.[LH]\d+(?:\.[0-9a-fA-F]{1,2}){0,6}$/,KI=/^vp09(?:\.\d{2}){3}(?:(?:\.\d{2}){5})?$/,QI=/^av01\.\d\.\d{2}[MH]\.\d{2}(?:\.\d\.\d{3}\.\d{2}\.\d{2}\.\d{2}\.\d)?$/,IL=t=>{if(!t)throw new TypeError("Video chunk metadata must be provided.");if(typeof t!="object")throw new TypeError("Video chunk metadata must be an object.");if(!t.decoderConfig)throw new TypeError("Video chunk metadata must include a decoder configuration.");if(typeof t.decoderConfig!="object")throw new TypeError("Video chunk metadata decoder configuration must be an object.");if(typeof t.decoderConfig.codec!="string")throw new TypeError("Video chunk metadata decoder configuration must specify a codec string.");if(!GI.some(e=>t.decoderConfig.codec.startsWith(e)))throw new TypeError("Video chunk metadata decoder configuration codec string must be a valid video codec string as specified in the WebCodecs Codec Registry.");if(!Number.isInteger(t.decoderConfig.codedWidth)||t.decoderConfig.codedWidth<=0)throw new TypeError("Video chunk metadata decoder configuration must specify a valid codedWidth (positive integer).");if(!Number.isInteger(t.decoderConfig.codedHeight)||t.decoderConfig.codedHeight<=0)throw new TypeError("Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).");if(t.decoderConfig.description!==void 0&&!_0(t.decoderConfig.description))throw new TypeError("Video chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.");if(t.decoderConfig.colorSpace!==void 0){const{colorSpace:e}=t.decoderConfig;if(typeof e!="object")throw new TypeError("Video chunk metadata decoder configuration colorSpace, when provided, must be an object.");const r=Object.keys(X2);if(e.primaries!=null&&!r.includes(e.primaries))throw new TypeError(`Video chunk metadata decoder configuration colorSpace primaries, when defined, must be one of ${r.join(", ")}.`);const n=Object.keys(Y2);if(e.transfer!=null&&!n.includes(e.transfer))throw new TypeError(`Video chunk metadata decoder configuration colorSpace transfer, when defined, must be one of ${n.join(", ")}.`);const i=Object.keys(K2);if(e.matrix!=null&&!i.includes(e.matrix))throw new TypeError(`Video chunk metadata decoder configuration colorSpace matrix, when defined, must be one of ${i.join(", ")}.`);if(e.fullRange!=null&&typeof e.fullRange!="boolean")throw new TypeError("Video chunk metadata decoder configuration colorSpace fullRange, when defined, must be a boolean.")}if(t.decoderConfig.codec.startsWith("avc1")||t.decoderConfig.codec.startsWith("avc3")){if(!XI.test(t.decoderConfig.codec))throw new TypeError("Video chunk metadata decoder configuration codec string for AVC must be a valid AVC codec string as specified in Section 3.4 of RFC 6381.")}else if(t.decoderConfig.codec.startsWith("hev1")||t.decoderConfig.codec.startsWith("hvc1")){if(!YI.test(t.decoderConfig.codec))throw new TypeError("Video chunk metadata decoder configuration codec string for HEVC must be a valid HEVC codec string as specified in Section E.3 of ISO 14496-15.")}else if(t.decoderConfig.codec.startsWith("vp8")){if(t.decoderConfig.codec!=="vp8")throw new TypeError('Video chunk metadata decoder configuration codec string for VP8 must be "vp8".')}else if(t.decoderConfig.codec.startsWith("vp09")){if(!KI.test(t.decoderConfig.codec))throw new TypeError('Video chunk metadata decoder configuration codec string for VP9 must be a valid VP9 codec string as specified in Section "Codecs Parameter String" of https://www.webmproject.org/vp9/mp4/.')}else if(t.decoderConfig.codec.startsWith("av01")&&!QI.test(t.decoderConfig.codec))throw new TypeError('Video chunk metadata decoder configuration codec string for AV1 must be a valid AV1 codec string as specified in Section "Codecs Parameter String" of https://aomediacodec.github.io/av1-isobmff/.')},ZI=["mp4a","mp3","opus","vorbis","flac","ulaw","alaw","pcm"],RL=t=>{if(!t)throw new TypeError("Audio chunk metadata must be provided.");if(typeof t!="object")throw new TypeError("Audio chunk metadata must be an object.");if(!t.decoderConfig)throw new TypeError("Audio chunk metadata must include a decoder configuration.");if(typeof t.decoderConfig!="object")throw new TypeError("Audio chunk metadata decoder configuration must be an object.");if(typeof t.decoderConfig.codec!="string")throw new TypeError("Audio chunk metadata decoder configuration must specify a codec string.");if(!ZI.some(e=>t.decoderConfig.codec.startsWith(e)))throw new TypeError("Audio chunk metadata decoder configuration codec string must be a valid audio codec string as specified in the WebCodecs Codec Registry.");if(!Number.isInteger(t.decoderConfig.sampleRate)||t.decoderConfig.sampleRate<=0)throw new TypeError("Audio chunk metadata decoder configuration must specify a valid sampleRate (positive integer).");if(!Number.isInteger(t.decoderConfig.numberOfChannels)||t.decoderConfig.numberOfChannels<=0)throw new TypeError("Audio chunk metadata decoder configuration must specify a valid numberOfChannels (positive integer).");if(t.decoderConfig.description!==void 0&&!_0(t.decoderConfig.description))throw new TypeError("Audio chunk metadata decoder configuration description, when defined, must be an ArrayBuffer or an ArrayBuffer view.");if(t.decoderConfig.codec.startsWith("mp4a")&&t.decoderConfig.codec!=="mp4a.69"&&t.decoderConfig.codec!=="mp4a.6B"&&t.decoderConfig.codec!=="mp4a.6b"){if(!["mp4a.40.2","mp4a.40.02","mp4a.40.5","mp4a.40.05","mp4a.40.29","mp4a.67"].includes(t.decoderConfig.codec))throw new TypeError("Audio chunk metadata decoder configuration codec string for AAC must be a valid AAC codec string as specified in https://www.w3.org/TR/webcodecs-aac-codec-registration/.")}else if(t.decoderConfig.codec.startsWith("mp3")||t.decoderConfig.codec.startsWith("mp4a")){if(t.decoderConfig.codec!=="mp3"&&t.decoderConfig.codec!=="mp4a.69"&&t.decoderConfig.codec!=="mp4a.6B"&&t.decoderConfig.codec!=="mp4a.6b")throw new TypeError('Audio chunk metadata decoder configuration codec string for MP3 must be "mp3", "mp4a.69" or "mp4a.6B".')}else if(t.decoderConfig.codec.startsWith("opus")){if(t.decoderConfig.codec!=="opus")throw new TypeError('Audio chunk metadata decoder configuration codec string for Opus must be "opus".');if(t.decoderConfig.description&&t.decoderConfig.description.byteLength<18)throw new TypeError("Audio chunk metadata decoder configuration description, when specified, is expected to be an Identification Header as specified in Section 5.1 of RFC 7845.")}else if(t.decoderConfig.codec.startsWith("vorbis")){if(t.decoderConfig.codec!=="vorbis")throw new TypeError('Audio chunk metadata decoder configuration codec string for Vorbis must be "vorbis".');if(!t.decoderConfig.description)throw new TypeError("Audio chunk metadata decoder configuration for Vorbis must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-vorbis-codec-registration/.")}else if(t.decoderConfig.codec.startsWith("flac")){if(t.decoderConfig.codec!=="flac")throw new TypeError('Audio chunk metadata decoder configuration codec string for FLAC must be "flac".');if(!t.decoderConfig.description||t.decoderConfig.description.byteLength<42)throw new TypeError("Audio chunk metadata decoder configuration for FLAC must include a description, which is expected to adhere to the format described in https://www.w3.org/TR/webcodecs-flac-codec-registration/.")}else if((t.decoderConfig.codec.startsWith("pcm")||t.decoderConfig.codec.startsWith("ulaw")||t.decoderConfig.codec.startsWith("alaw"))&&!Ys.includes(t.decoderConfig.codec))throw new TypeError(`Audio chunk metadata decoder configuration codec string for PCM must be one of the supported PCM codecs (${Ys.join(", ")}).`)},ML=t=>{if(!t)throw new TypeError("Subtitle metadata must be provided.");if(typeof t!="object")throw new TypeError("Subtitle metadata must be an object.");if(!t.config)throw new TypeError("Subtitle metadata must include a config object.");if(typeof t.config!="object")throw new TypeError("Subtitle metadata config must be an object.");if(typeof t.config.description!="string")throw new TypeError("Subtitle metadata config description must be a string.")};var jo;(function(t){t[t.NON_IDR_SLICE=1]="NON_IDR_SLICE",t[t.SLICE_DPA=2]="SLICE_DPA",t[t.SLICE_DPB=3]="SLICE_DPB",t[t.SLICE_DPC=4]="SLICE_DPC",t[t.IDR=5]="IDR",t[t.SEI=6]="SEI",t[t.SPS=7]="SPS",t[t.PPS=8]="PPS",t[t.AUD=9]="AUD",t[t.SPS_EXT=13]="SPS_EXT"})(jo||(jo={}));var ti;(function(t){t[t.RASL_N=8]="RASL_N",t[t.RASL_R=9]="RASL_R",t[t.BLA_W_LP=16]="BLA_W_LP",t[t.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",t[t.VPS_NUT=32]="VPS_NUT",t[t.SPS_NUT=33]="SPS_NUT",t[t.PPS_NUT=34]="PPS_NUT",t[t.AUD_NUT=35]="AUD_NUT",t[t.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",t[t.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"})(ti||(ti={}));const C0=function*(t){let e=0,r=-1;for(;e<t.length-2;){const n=t.indexOf(0,e);if(n===-1||n>=t.length-2)break;e=n;let i=0;if(e+3<t.length&&t[e+1]===0&&t[e+2]===0&&t[e+3]===1?i=4:t[e+1]===0&&t[e+2]===1&&(i=3),i===0){e++;continue}r!==-1&&e>r&&(yield{offset:r,length:e-r}),r=e+i,e=r}r!==-1&&r<t.length&&(yield{offset:r,length:t.length-r})},l8=function*(t,e){let r=0;const n=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;r+e<=t.length;){let i;e===1?i=n.getUint8(r):e===2?i=n.getUint16(r,!1):e===3?i=P0(n,r,!1):(pe(e===4),i=n.getUint32(r,!1)),r+=e,yield{offset:r,length:i},r+=i}},u8=(t,e)=>{if(e.description){const i=(lu(e.description)[4]&3)+1;return l8(t,i)}else return C0(t)},JI=function*(t){yield*C0(t)},O0=t=>t&31,A0=t=>{const e=[],r=t.length;for(let n=0;n<r;n++)n+2<r&&t[n]===0&&t[n+1]===0&&t[n+2]===3?(e.push(0,0),n+=2):e.push(t[n]);return new Uint8Array(e)},ev=new Uint8Array([0,0,0,1]),eR=t=>{const e=t.reduce((i,a)=>i+ev.byteLength+a.byteLength,0),r=new Uint8Array(e);let n=0;for(const i of t)r.set(ev,n),n+=ev.byteLength,r.set(i,n),n+=i.byteLength;return r},tR=(t,e)=>{const r=t.reduce((a,o)=>a+e+o.byteLength,0),n=new Uint8Array(r);let i=0;for(const a of t){const o=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(e){case 1:o.setUint8(i,a.byteLength);break;case 2:o.setUint16(i,a.byteLength,!1);break;case 3:Zk(o,i,a.byteLength,!1);break;case 4:o.setUint32(i,a.byteLength,!1);break}i+=e,n.set(a,i),i+=a.byteLength}return n},rR=(t,e)=>{if(e.description){const i=(lu(e.description)[4]&3)+1;return tR(t,i)}else return eR(t)},c8=t=>{try{const e=[],r=[],n=[];for(const s of JI(t)){const u=t.subarray(s.offset,s.offset+s.length),f=O0(u[0]);f===jo.SPS?e.push(u):f===jo.PPS?r.push(u):f===jo.SPS_EXT&&n.push(u)}if(e.length===0||r.length===0)return null;const i=e[0],a=eb(i);pe(a!==null);const o=a.profileIdc===100||a.profileIdc===110||a.profileIdc===122||a.profileIdc===144;return{configurationVersion:1,avcProfileIndication:a.profileIdc,profileCompatibility:a.constraintFlags,avcLevelIndication:a.levelIdc,lengthSizeMinusOne:3,sequenceParameterSets:e,pictureParameterSets:r,chromaFormat:o?a.chromaFormatIdc:null,bitDepthLumaMinus8:o?a.bitDepthLumaMinus8:null,bitDepthChromaMinus8:o?a.bitDepthChromaMinus8:null,sequenceParameterSetExt:o?n:null}}catch(e){return console.error("Error building AVC Decoder Configuration Record:",e),null}},DL=t=>{const e=[];e.push(t.configurationVersion),e.push(t.avcProfileIndication),e.push(t.profileCompatibility),e.push(t.avcLevelIndication),e.push(252|t.lengthSizeMinusOne&3),e.push(224|t.sequenceParameterSets.length&31);for(const r of t.sequenceParameterSets){const n=r.byteLength;e.push(n>>8),e.push(n&255);for(let i=0;i<n;i++)e.push(r[i])}e.push(t.pictureParameterSets.length);for(const r of t.pictureParameterSets){const n=r.byteLength;e.push(n>>8),e.push(n&255);for(let i=0;i<n;i++)e.push(r[i])}if(t.avcProfileIndication===100||t.avcProfileIndication===110||t.avcProfileIndication===122||t.avcProfileIndication===144){pe(t.chromaFormat!==null),pe(t.bitDepthLumaMinus8!==null),pe(t.bitDepthChromaMinus8!==null),pe(t.sequenceParameterSetExt!==null),e.push(252|t.chromaFormat&3),e.push(248|t.bitDepthLumaMinus8&7),e.push(248|t.bitDepthChromaMinus8&7),e.push(t.sequenceParameterSetExt.length);for(const r of t.sequenceParameterSetExt){const n=r.byteLength;e.push(n>>8),e.push(n&255);for(let i=0;i<n;i++)e.push(r[i])}}return new Uint8Array(e)},nR=t=>{try{const e=Fr(t);let r=0;const n=e.getUint8(r++),i=e.getUint8(r++),a=e.getUint8(r++),o=e.getUint8(r++),s=e.getUint8(r++)&3,u=e.getUint8(r++)&31,f=[];for(let y=0;y<u;y++){const v=e.getUint16(r,!1);r+=2,f.push(t.subarray(r,r+v)),r+=v}const d=e.getUint8(r++),h=[];for(let y=0;y<d;y++){const v=e.getUint16(r,!1);r+=2,h.push(t.subarray(r,r+v)),r+=v}const p={configurationVersion:n,avcProfileIndication:i,profileCompatibility:a,avcLevelIndication:o,lengthSizeMinusOne:s,sequenceParameterSets:f,pictureParameterSets:h,chromaFormat:null,bitDepthLumaMinus8:null,bitDepthChromaMinus8:null,sequenceParameterSetExt:null};if((i===100||i===110||i===122||i===144)&&r+4<=t.length){const y=e.getUint8(r++)&3,v=e.getUint8(r++)&7,b=e.getUint8(r++)&7,x=e.getUint8(r++);p.chromaFormat=y,p.bitDepthLumaMinus8=v,p.bitDepthChromaMinus8=b;const k=[];for(let S=0;S<x;S++){const P=e.getUint16(r,!1);r+=2,k.push(t.subarray(r,r+P)),r+=P}p.sequenceParameterSetExt=k}return p}catch(e){return console.error("Error deserializing AVC Decoder Configuration Record:",e),null}},eb=t=>{try{const e=new Dr(A0(t));if(e.skipBits(1),e.skipBits(2),e.readBits(5)!==7)return null;const n=e.readAlignedByte(),i=e.readAlignedByte(),a=e.readAlignedByte();tt(e);let o=1,s=0,u=0,f=0;if((n===100||n===110||n===122||n===244||n===44||n===83||n===86||n===118||n===128)&&(o=tt(e),o===3&&(f=e.readBits(1)),s=tt(e),u=tt(e),e.skipBits(1),e.readBits(1))){for(let N=0;N<(o!==3?8:12);N++)if(e.readBits(1)){const H=N<6?16:64;let $=8,X=8;for(let Z=0;Z<H;Z++){if(X!==0){const K=Us(e);X=($+K+256)%256}$=X===0?$:X}}}tt(e);const d=tt(e);if(d===0)tt(e);else if(d===1){e.skipBits(1),Us(e),Us(e);const R=tt(e);for(let N=0;N<R;N++)Us(e)}tt(e),e.skipBits(1);const h=tt(e),p=tt(e),y=16*(h+1),v=16*(p+1);let b=y,x=v;const k=e.readBits(1);if(k||e.skipBits(1),e.skipBits(1),e.readBits(1)){const R=tt(e),N=tt(e),F=tt(e),H=tt(e);let $,X;if((f===0?o:0)===0)$=1,X=2-k;else{const K=o===3?1:2,q=o===1?2:1;$=K,X=q*(2-k)}b-=$*(R+N),x-=X*(F+H)}let P=2,_=2,E=2,A=0,T=null,I=null;if(e.readBits(1)){e.readBits(1)&&e.readBits(8)===255&&(e.skipBits(16),e.skipBits(16)),e.readBits(1)&&e.skipBits(1),e.readBits(1)&&(e.skipBits(3),A=e.readBits(1),e.readBits(1)&&(P=e.readBits(8),_=e.readBits(8),E=e.readBits(8))),e.readBits(1)&&(tt(e),tt(e)),e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.skipBits(1));const X=e.readBits(1);X&&ux(e);const Z=e.readBits(1);Z&&ux(e),(X||Z)&&e.skipBits(1),e.skipBits(1),e.readBits(1)&&(e.skipBits(1),tt(e),tt(e),tt(e),tt(e),T=tt(e),I=tt(e))}if(T===null){pe(I===null);const R=i&16;if((n===44||n===86||n===100||n===110||n===122||n===244)&&R)T=0,I=0;else{const N=h+1,F=p+1,H=(2-k)*F,$=Kg.find(Z=>Z.level>=a)??ni(Kg),X=Math.min(Math.floor($.maxDpbMbs/(N*H)),16);T=X,I=X}}return pe(I!==null),{profileIdc:n,constraintFlags:i,levelIdc:a,frameMbsOnlyFlag:k,chromaFormatIdc:o,bitDepthLumaMinus8:s,bitDepthChromaMinus8:u,codedWidth:y,codedHeight:v,displayWidth:b,displayHeight:x,colourPrimaries:P,matrixCoefficients:E,transferCharacteristics:_,fullRangeFlag:A,numReorderFrames:T,maxDecFrameBuffering:I}}catch(e){return console.error("Error parsing AVC SPS:",e),null}},ux=t=>{const e=tt(t);t.skipBits(4),t.skipBits(4);for(let r=0;r<=e;r++)tt(t),tt(t),t.skipBits(1);t.skipBits(5),t.skipBits(5),t.skipBits(5),t.skipBits(5)},f8=(t,e)=>{if(e.description){const i=(lu(e.description)[21]&3)+1;return l8(t,i)}else return C0(t)},iR=function*(t){yield*C0(t)},Ep=t=>t>>1&63,d8=t=>{try{const e=new Dr(A0(t));e.skipBits(16),e.readBits(4);const r=e.readBits(3),n=e.readBits(1),{general_profile_space:i,general_tier_flag:a,general_profile_idc:o,general_profile_compatibility_flags:s,general_constraint_indicator_flags:u,general_level_idc:f}=aR(e,r);tt(e);const d=tt(e);let h=0;d===3&&(h=e.readBits(1));const p=tt(e),y=tt(e);let v=p,b=y;if(e.readBits(1)){const N=tt(e),F=tt(e),H=tt(e),$=tt(e);let X=1,Z=1;const K=h===0?d:0;K===1?(X=2,Z=2):K===2&&(X=2,Z=1),v-=(N+F)*X,b-=(H+$)*Z}const x=tt(e),k=tt(e);tt(e);const P=e.readBits(1)?0:r;let _=0;for(let N=P;N<=r;N++)tt(e),_=tt(e),tt(e);tt(e),tt(e),tt(e),tt(e),tt(e),tt(e),e.readBits(1)&&e.readBits(1)&&oR(e),e.skipBits(1),e.skipBits(1),e.readBits(1)&&(e.skipBits(4),e.skipBits(4),tt(e),tt(e),e.skipBits(1));const E=tt(e);if(sR(e,E),e.readBits(1)){const N=tt(e);for(let F=0;F<N;F++)tt(e),e.skipBits(1)}e.skipBits(1),e.skipBits(1);let A=2,T=2,I=2,L=0,R=0;if(e.readBits(1)){const N=uR(e,r);A=N.colourPrimaries,T=N.transferCharacteristics,I=N.matrixCoefficients,L=N.fullRangeFlag,R=N.minSpatialSegmentationIdc}return{displayWidth:v,displayHeight:b,colourPrimaries:A,transferCharacteristics:T,matrixCoefficients:I,fullRangeFlag:L,maxDecFrameBuffering:_+1,spsMaxSubLayersMinus1:r,spsTemporalIdNestingFlag:n,generalProfileSpace:i,generalTierFlag:a,generalProfileIdc:o,generalProfileCompatibilityFlags:s,generalConstraintIndicatorFlags:u,generalLevelIdc:f,chromaFormatIdc:d,bitDepthLumaMinus8:x,bitDepthChromaMinus8:k,minSpatialSegmentationIdc:R}}catch(e){return console.error("Error parsing HEVC SPS:",e),null}},h8=t=>{try{const e=[],r=[],n=[],i=[];for(const f of iR(t)){const d=t.subarray(f.offset,f.offset+f.length),h=Ep(d[0]);h===ti.VPS_NUT?e.push(d):h===ti.SPS_NUT?r.push(d):h===ti.PPS_NUT?n.push(d):(h===ti.PREFIX_SEI_NUT||h===ti.SUFFIX_SEI_NUT)&&i.push(d)}if(r.length===0||n.length===0)return null;const a=d8(r[0]);if(!a)return null;let o=0;if(n.length>0){const f=n[0],d=new Dr(A0(f));d.skipBits(16),tt(d),tt(d),d.skipBits(1),d.skipBits(1),d.skipBits(3),d.skipBits(1),d.skipBits(1),tt(d),tt(d),Us(d),d.skipBits(1),d.skipBits(1),d.readBits(1)&&tt(d),Us(d),Us(d),d.skipBits(1),d.skipBits(1),d.skipBits(1),d.skipBits(1);const h=d.readBits(1),p=d.readBits(1);!h&&!p?o=0:h&&!p?o=2:!h&&p?o=3:o=0}const s=[...e.length?[{arrayCompleteness:1,nalUnitType:ti.VPS_NUT,nalUnits:e}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:ti.SPS_NUT,nalUnits:r}]:[],...n.length?[{arrayCompleteness:1,nalUnitType:ti.PPS_NUT,nalUnits:n}]:[],...i.length?[{arrayCompleteness:1,nalUnitType:Ep(i[0][0]),nalUnits:i}]:[]];return{configurationVersion:1,generalProfileSpace:a.generalProfileSpace,generalTierFlag:a.generalTierFlag,generalProfileIdc:a.generalProfileIdc,generalProfileCompatibilityFlags:a.generalProfileCompatibilityFlags,generalConstraintIndicatorFlags:a.generalConstraintIndicatorFlags,generalLevelIdc:a.generalLevelIdc,minSpatialSegmentationIdc:a.minSpatialSegmentationIdc,parallelismType:o,chromaFormatIdc:a.chromaFormatIdc,bitDepthLumaMinus8:a.bitDepthLumaMinus8,bitDepthChromaMinus8:a.bitDepthChromaMinus8,avgFrameRate:0,constantFrameRate:0,numTemporalLayers:a.spsMaxSubLayersMinus1+1,temporalIdNested:a.spsTemporalIdNestingFlag,lengthSizeMinusOne:3,arrays:s}}catch(e){return console.error("Error building HEVC Decoder Configuration Record:",e),null}},aR=(t,e)=>{const r=t.readBits(2),n=t.readBits(1),i=t.readBits(5);let a=0;for(let d=0;d<32;d++)a=a<<1|t.readBits(1);const o=new Uint8Array(6);for(let d=0;d<6;d++)o[d]=t.readBits(8);const s=t.readBits(8),u=[],f=[];for(let d=0;d<e;d++)u.push(t.readBits(1)),f.push(t.readBits(1));if(e>0)for(let d=e;d<8;d++)t.skipBits(2);for(let d=0;d<e;d++)u[d]&&t.skipBits(88),f[d]&&t.skipBits(8);return{general_profile_space:r,general_tier_flag:n,general_profile_idc:i,general_profile_compatibility_flags:a,general_constraint_indicator_flags:o,general_level_idc:s}},oR=t=>{for(let e=0;e<4;e++)for(let r=0;r<(e===3?2:6);r++)if(!t.readBits(1))tt(t);else{const i=Math.min(64,1<<4+(e<<1));e>1&&Us(t);for(let a=0;a<i;a++)Us(t)}},sR=(t,e)=>{const r=[];for(let n=0;n<e;n++)r[n]=lR(t,n,e,r)},lR=(t,e,r,n)=>{let i=0,a=0,o=0;if(e!==0&&(a=t.readBits(1)),a){if(e===r){const u=tt(t);o=e-(u+1)}else o=e-1;t.readBits(1),tt(t);const s=n[o]??0;for(let u=0;u<=s;u++)t.readBits(1)||t.readBits(1);i=n[o]}else{const s=tt(t),u=tt(t);for(let f=0;f<s;f++)tt(t),t.readBits(1);for(let f=0;f<u;f++)tt(t),t.readBits(1);i=s+u}return i},uR=(t,e)=>{let r=2,n=2,i=2,a=0,o=0;return t.readBits(1)&&t.readBits(8)===255&&(t.readBits(16),t.readBits(16)),t.readBits(1)&&t.readBits(1),t.readBits(1)&&(t.readBits(3),a=t.readBits(1),t.readBits(1)&&(r=t.readBits(8),n=t.readBits(8),i=t.readBits(8))),t.readBits(1)&&(tt(t),tt(t)),t.readBits(1),t.readBits(1),t.readBits(1),t.readBits(1)&&(tt(t),tt(t),tt(t),tt(t)),t.readBits(1)&&(t.readBits(32),t.readBits(32),t.readBits(1)&&tt(t),t.readBits(1)&&cR(t,!0,e)),t.readBits(1)&&(t.readBits(1),t.readBits(1),t.readBits(1),o=tt(t),tt(t),tt(t),tt(t),tt(t)),{colourPrimaries:r,transferCharacteristics:n,matrixCoefficients:i,fullRangeFlag:a,minSpatialSegmentationIdc:o}},cR=(t,e,r)=>{let n=!1,i=!1,a=!1;n=t.readBits(1)===1,i=t.readBits(1)===1,(n||i)&&(a=t.readBits(1)===1,a&&(t.readBits(8),t.readBits(5),t.readBits(1),t.readBits(5)),t.readBits(4),t.readBits(4),a&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let o=0;o<=r;o++){const s=t.readBits(1)===1;let u=!0;s||(u=t.readBits(1)===1);let f=!1;u?tt(t):f=t.readBits(1)===1;let d=1;f||(d=tt(t)+1),n&&cx(t,d,a),i&&cx(t,d,a)}},cx=(t,e,r)=>{for(let n=0;n<e;n++)tt(t),tt(t),r&&(tt(t),tt(t)),t.readBits(1)},NL=t=>{const e=[];e.push(t.configurationVersion),e.push((t.generalProfileSpace&3)<<6|(t.generalTierFlag&1)<<5|t.generalProfileIdc&31),e.push(t.generalProfileCompatibilityFlags>>>24&255),e.push(t.generalProfileCompatibilityFlags>>>16&255),e.push(t.generalProfileCompatibilityFlags>>>8&255),e.push(t.generalProfileCompatibilityFlags&255),e.push(...t.generalConstraintIndicatorFlags),e.push(t.generalLevelIdc&255),e.push(240|t.minSpatialSegmentationIdc>>8&15),e.push(t.minSpatialSegmentationIdc&255),e.push(252|t.parallelismType&3),e.push(252|t.chromaFormatIdc&3),e.push(248|t.bitDepthLumaMinus8&7),e.push(248|t.bitDepthChromaMinus8&7),e.push(t.avgFrameRate>>8&255),e.push(t.avgFrameRate&255),e.push((t.constantFrameRate&3)<<6|(t.numTemporalLayers&7)<<3|(t.temporalIdNested&1)<<2|t.lengthSizeMinusOne&3),e.push(t.arrays.length&255);for(const r of t.arrays){e.push((r.arrayCompleteness&1)<<7|0|r.nalUnitType&63),e.push(r.nalUnits.length>>8&255),e.push(r.nalUnits.length&255);for(const n of r.nalUnits){e.push(n.length>>8&255),e.push(n.length&255);for(let i=0;i<n.length;i++)e.push(n[i])}}return new Uint8Array(e)},p8=t=>{const e=new Dr(t);if(e.readBits(2)!==2)return null;const n=e.readBits(1),a=(e.readBits(1)<<1)+n;if(a===3&&e.skipBits(1),e.readBits(1)===1||e.readBits(1)!==0||(e.skipBits(2),e.readBits(24)!==4817730))return null;let f=8;a>=2&&(f=e.readBits(1)?12:10);const d=e.readBits(3);let h=0,p=0;if(d!==7)if(p=e.readBits(1),a===1||a===3){const T=e.readBits(1),I=e.readBits(1);h=!T&&!I?3:T&&!I?2:1,e.skipBits(1)}else h=1;else h=3,p=1;const y=e.readBits(16),v=e.readBits(16),b=y+1,x=v+1,k=b*x;let S=ni(ru).level;for(const A of ru)if(k<=A.maxPictureSize){S=A.level;break}return{profile:a,level:S,bitDepth:f,chromaSubsampling:h,videoFullRangeFlag:p,colourPrimaries:d===2?1:d===1?6:2,transferCharacteristics:d===2?1:d===1?6:2,matrixCoefficients:d===7?0:d===2?1:d===1?6:2}},m8=function*(t){const e=new Dr(t),r=()=>{let n=0;for(let i=0;i<8;i++){const a=e.readAlignedByte();if(n|=(a&127)<<i*7,!(a&128))break;if(i===7&&a&128)return null}return n>=2**32-1?null:n};for(;e.getBitsLeft()>=8;){e.skipBits(1);const n=e.readBits(4),i=e.readBits(1),a=e.readBits(1);e.skipBits(1),i&&e.skipBits(8);let o;if(a){const s=r();if(s===null)return;o=s}else o=Math.floor(e.getBitsLeft()/8);pe(e.pos%8===0),yield{type:n,data:t.subarray(e.pos/8,e.pos/8+o)},e.skipBits(o*8)}},g8=t=>{for(const{type:e,data:r}of m8(t)){if(e!==1)continue;const n=new Dr(r),i=n.readBits(3);n.readBits(1);const a=n.readBits(1);let o=0,s=0,u=0;if(a)o=n.readBits(5);else{if(n.readBits(1)&&(n.skipBits(32),n.skipBits(32),n.readBits(1)))return null;const E=n.readBits(1);E&&(u=n.readBits(5),n.skipBits(32),n.skipBits(5),n.skipBits(5));const A=n.readBits(5);for(let T=0;T<=A;T++){n.skipBits(12);const I=n.readBits(5);if(T===0&&(o=I),I>7){const R=n.readBits(1);T===0&&(s=R)}if(E&&n.readBits(1)){const N=u+1;n.skipBits(N),n.skipBits(N),n.skipBits(1)}n.readBits(1)&&n.skipBits(4)}}const f=n.readBits(4),d=n.readBits(4),h=f+1;n.skipBits(h);const p=d+1;n.skipBits(p);let y=0;if(a?y=0:y=n.readBits(1),y&&(n.skipBits(4),n.skipBits(3)),n.skipBits(1),n.skipBits(1),n.skipBits(1),!a){n.skipBits(1),n.skipBits(1),n.skipBits(1),n.skipBits(1);const _=n.readBits(1);_&&(n.skipBits(1),n.skipBits(1));const E=n.readBits(1);let A=0;E?A=2:A=n.readBits(1),A>0&&(n.readBits(1)||n.skipBits(1)),_&&n.skipBits(3)}n.skipBits(1),n.skipBits(1),n.skipBits(1);const v=n.readBits(1);let b=8;i===2&&v?b=n.readBits(1)?12:10:i<=2&&(b=v?10:8);let x=0;i!==1&&(x=n.readBits(1));let k=1,S=1,P=0;return x||(i===0?(k=1,S=1):i===1?(k=0,S=0):b===12&&(k=n.readBits(1),k&&(S=n.readBits(1))),k&&S&&(P=n.readBits(2))),{profile:i,level:o,tier:s,bitDepth:b,monochrome:x,chromaSubsamplingX:k,chromaSubsamplingY:S,chromaSamplePosition:P}}return null},fR=t=>{const e=Fr(t),r=e.getUint8(9),n=e.getUint16(10,!0),i=e.getUint32(12,!0),a=e.getInt16(16,!0),o=e.getUint8(18);let s=null;return o&&(s=t.subarray(19,21+r)),{outputChannelCount:r,preSkip:n,inputSampleRate:i,outputGain:a,channelMappingFamily:o,channelMappingTable:s}},dR=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960],hR=t=>{const e=t[0]>>3;return{durationInSamples:dR[e]}},pR=t=>{if(t.length<7)throw new Error("Setup header is too short.");if(t[0]!==5)throw new Error("Wrong packet type in Setup header.");if(String.fromCharCode(...t.slice(1,7))!=="vorbis")throw new Error("Invalid packet signature in Setup header.");const r=t.length,n=new Uint8Array(r);for(let h=0;h<r;h++)n[h]=t[r-1-h];const i=new Dr(n);let a=0;for(;i.getBitsLeft()>97;)if(i.readBits(1)===1){a=i.pos;break}if(a===0)throw new Error("Invalid Setup header: framing bit not found.");let o=0,s=!1,u=0;for(;i.getBitsLeft()>=97;){const h=i.pos,p=i.readBits(8),y=i.readBits(16),v=i.readBits(16);if(p>63||y!==0||v!==0){i.pos=h;break}if(i.skipBits(1),o++,o>64)break;i.clone().readBits(6)+1===o&&(s=!0,u=o)}if(!s)throw new Error("Invalid Setup header: mode header not found.");if(u>63)throw new Error(`Unsupported mode count: ${u}.`);const f=u;i.pos=0,i.skipBits(a);const d=Array(f).fill(0);for(let h=f-1;h>=0;h--)i.skipBits(40),d[h]=i.readBits(1);return{modeBlockflags:d}},tb=(t,e,r)=>{switch(t){case"avc":{for(const n of u8(r,e)){const i=r[n.offset],a=O0(i);if(a>=jo.NON_IDR_SLICE&&a<=jo.SLICE_DPC)return"delta";if(a===jo.IDR)return"key";if(a===jo.SEI&&(!Jv()||qI()>=144)){const o=r.subarray(n.offset,n.offset+n.length),s=A0(o);let u=1;do{let f=0;for(;;){const p=s[u++];if(p===void 0||(f+=p,p<255))break}let d=0;for(;;){const p=s[u++];if(p===void 0||(d+=p,p<255))break}if(f===6){const p=new Dr(s);p.pos=8*u;const y=tt(p),v=p.readBits(1);if(y===0&&v===1)return"key"}u+=d}while(u<s.length-1)}}return"delta"}case"hevc":{for(const n of f8(r,e)){const i=Ep(r[n.offset]);if(i<ti.BLA_W_LP)return"delta";if(i<=ti.RSV_IRAP_VCL23)return"key"}return"delta"}case"vp8":return(r[0]&1)===0?"key":"delta";case"vp9":{const n=new Dr(r);if(n.readBits(2)!==2)return null;const i=n.readBits(1);return(n.readBits(1)<<1)+i===3&&n.skipBits(1),n.readBits(1)?null:n.readBits(1)===0?"key":"delta"}case"av1":{let n=!1;for(const{type:i,data:a}of m8(r))if(i===1){const o=new Dr(a);o.skipBits(4),n=!!o.readBits(1)}else if(i===3||i===6||i===7){if(n)return"key";const o=new Dr(a);return o.readBits(1)?null:o.readBits(2)===0?"key":"delta"}return null}default:_p(t),pe(!1)}};var fd;(function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"})(fd||(fd={}));const t2=(t,e)=>{const r=Fr(t);let n=0;const i=r.getUint32(n,!0);n+=4;const a=Ra.decode(t.subarray(n,n+i));n+=i,i>0&&(e.raw??={},e.raw.vendor??=a);const o=r.getUint32(n,!0);n+=4;for(let s=0;s<o;s++){const u=r.getUint32(n,!0);n+=4;const f=Ra.decode(t.subarray(n,n+u));n+=u;const d=f.indexOf("=");if(d===-1)continue;const h=f.slice(0,d).toUpperCase(),p=f.slice(d+1);switch(e.raw??={},e.raw[h]??=p,h){case"TITLE":e.title??=p;break;case"DESCRIPTION":e.description??=p;break;case"ARTIST":e.artist??=p;break;case"ALBUM":e.album??=p;break;case"ALBUMARTIST":e.albumArtist??=p;break;case"COMMENT":e.comment??=p;break;case"LYRICS":e.lyrics??=p;break;case"TRACKNUMBER":{const y=p.split("/"),v=Number.parseInt(y[0],10),b=y[1]&&Number.parseInt(y[1],10);Number.isInteger(v)&&v>0&&(e.trackNumber??=v),b&&Number.isInteger(b)&&b>0&&(e.tracksTotal??=b)}break;case"TRACKTOTAL":{const y=Number.parseInt(p,10);Number.isInteger(y)&&y>0&&(e.tracksTotal??=y)}break;case"DISCNUMBER":{const y=p.split("/"),v=Number.parseInt(y[0],10),b=y[1]&&Number.parseInt(y[1],10);Number.isInteger(v)&&v>0&&(e.discNumber??=v),b&&Number.isInteger(b)&&b>0&&(e.discsTotal??=b)}break;case"DISCTOTAL":{const y=Number.parseInt(p,10);Number.isInteger(y)&&y>0&&(e.discsTotal??=y)}break;case"DATE":{const y=new Date(p);Number.isNaN(y.getTime())||(e.date??=y)}break;case"GENRE":e.genre??=p;break;case"METADATA_BLOCK_PICTURE":{const y=VI(p),v=Fr(y),b=v.getUint32(0,!1),x=v.getUint32(4,!1),k=String.fromCharCode(...y.subarray(8,8+x)),S=v.getUint32(8+x,!1),P=Ra.decode(y.subarray(12+x,12+x+S)),_=v.getUint32(x+S+28),E=y.subarray(x+S+32,x+S+32+_);e.images??=[],e.images.push({data:E,mimeType:k,kind:b===3?"coverFront":b===4?"coverBack":"unknown",name:void 0,description:P||void 0})}break}}};class ku{constructor(e){this.input=e}}const y8=[],v8=[],LL=[],FL=[];const la=new Uint8Array(0);class xn{constructor(e,r,n,i,a=-1,o,s){if(this.data=e,this.type=r,this.timestamp=n,this.duration=i,this.sequenceNumber=a,e===la&&o===void 0)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(o===void 0&&(o=e.byteLength),!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if(r!=="key"&&r!=="delta")throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(a))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(o)||o<0)throw new TypeError("byteLength must be a non-negative integer.");if(s!==void 0&&(typeof s!="object"||!s))throw new TypeError("sideData, when provided, must be an object.");if(s?.alpha!==void 0&&!(s.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(s?.alphaByteLength!==void 0&&(!Number.isInteger(s.alphaByteLength)||s.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=o,this.sideData=s??{},this.sideData.alpha&&this.sideData.alphaByteLength===void 0&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===la}get microsecondTimestamp(){return Math.trunc(tu*this.timestamp)}get microsecondDuration(){return Math.trunc(tu*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if(typeof EncodedVideoChunk>"u")throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if(typeof EncodedAudioChunk>"u")throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,r){if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const n=new Uint8Array(e.byteLength);return e.copyTo(n),new xn(n,e.type,e.timestamp/1e6,(e.duration??0)/1e6,void 0,void 0,r)}clone(e){if(e!==void 0&&(typeof e!="object"||e===null))throw new TypeError("options, when provided, must be an object.");if(e?.data!==void 0&&!(e.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(e?.type!==void 0&&e.type!=="key"&&e.type!=="delta")throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(e?.timestamp!==void 0&&!Number.isFinite(e.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(e?.duration!==void 0&&!Number.isFinite(e.duration))throw new TypeError("options.duration, when provided, must be a number.");if(e?.sequenceNumber!==void 0&&!Number.isFinite(e.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(e?.sideData!==void 0&&(typeof e.sideData!="object"||e.sideData===null))throw new TypeError("options.sideData, when provided, must be an object.");return new xn(e?.data??this.data,e?.type??this.type,e?.timestamp??this.timestamp,e?.duration??this.duration,e?.sequenceNumber??this.sequenceNumber,this.byteLength,e?.sideData??this.sideData)}}const BL=t=>{let n=t,i=4096,a=0,o=12,s=0;for(n<0&&(n=-n,a=128),n+=33,n>8191&&(n=8191);(n&i)!==i&&o>=5;)i>>=1,o--;return s=n>>o-4&15,~(a|o-5<<4|s)&255},mR=t=>{let r=0,n=0,i=~t;i&128&&(i&=-129,r=-1),n=((i&240)>>4)+5;const a=(1<<n|(i&15)<<n-4|1<<n-5)-33;return r===0?a:-a},zL=t=>{let r=2048,n=0,i=11,a=0,o=t;for(o<0&&(o=-o,n=128),o>4095&&(o=4095);(o&r)!==r&&i>=5;)r>>=1,i--;return a=o>>(i===4?1:i-4)&15,(n|i-4<<4|a)^85},gR=t=>{let e=0,r=0,n=t^85;n&128&&(n&=-129,e=-1),r=((n&240)>>4)+4;let i=0;return r!==4?i=1<<r|(n&15)<<r-4|1<<r-5:i=n<<1|1,e===0?i:-i};r8();let fx=-1/0,dx=-1/0,Tp=null;typeof FinalizationRegistry<"u"&&(Tp=new FinalizationRegistry(t=>{const e=Date.now();t.type==="video"?(e-fx>=1e3&&(console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),fx=e),typeof VideoFrame<"u"&&t.data instanceof VideoFrame&&t.data.close()):(e-dx>=1e3&&(console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),dx=e),typeof AudioData<"u"&&t.data instanceof AudioData&&t.data.close())}));const b8=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],yR=new Set(b8);class nu{get displayWidth(){return this.rotation%180===0?this.codedWidth:this.codedHeight}get displayHeight(){return this.rotation%180===0?this.codedHeight:this.codedWidth}get microsecondTimestamp(){return Math.trunc(tu*this.timestamp)}get microsecondDuration(){return Math.trunc(tu*this.duration)}get hasAlpha(){return this.format&&this.format.includes("A")}constructor(e,r){if(this._closed=!1,e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e)){if(!r||typeof r!="object")throw new TypeError("init must be an object.");if(r.format===void 0||!yR.has(r.format))throw new TypeError("init.format must be one of: "+b8.join(", "));if(!Number.isInteger(r.codedWidth)||r.codedWidth<=0)throw new TypeError("init.codedWidth must be a positive integer.");if(!Number.isInteger(r.codedHeight)||r.codedHeight<=0)throw new TypeError("init.codedHeight must be a positive integer.");if(r.rotation!==void 0&&![0,90,180,270].includes(r.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(r.timestamp))throw new TypeError("init.timestamp must be a number.");if(r.duration!==void 0&&(!Number.isFinite(r.duration)||r.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");this._data=lu(e).slice(),this._layout=r.layout??vR(r.format,r.codedWidth,r.codedHeight),this.format=r.format,this.codedWidth=r.codedWidth,this.codedHeight=r.codedHeight,this.rotation=r.rotation??0,this.timestamp=r.timestamp,this.duration=r.duration??0,this.colorSpace=new tv(r.colorSpace)}else if(typeof VideoFrame<"u"&&e instanceof VideoFrame){if(r?.rotation!==void 0&&![0,90,180,270].includes(r.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(r?.timestamp!==void 0&&!Number.isFinite(r?.timestamp))throw new TypeError("init.timestamp, when provided, must be a number.");if(r?.duration!==void 0&&(!Number.isFinite(r.duration)||r.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");this._data=e,this._layout=null,this.format=e.format,this.codedWidth=e.displayWidth,this.codedHeight=e.displayHeight,this.rotation=r?.rotation??0,this.timestamp=r?.timestamp??e.timestamp/1e6,this.duration=r?.duration??(e.duration??0)/1e6,this.colorSpace=new tv(e.colorSpace)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof SVGImageElement<"u"&&e instanceof SVGImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas){if(!r||typeof r!="object")throw new TypeError("init must be an object.");if(r.rotation!==void 0&&![0,90,180,270].includes(r.rotation))throw new TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(r.timestamp))throw new TypeError("init.timestamp must be a number.");if(r.duration!==void 0&&(!Number.isFinite(r.duration)||r.duration<0))throw new TypeError("init.duration, when provided, must be a non-negative number.");if(typeof VideoFrame<"u")return new nu(new VideoFrame(e,{timestamp:Math.trunc(r.timestamp*tu),duration:Math.trunc((r.duration??0)*tu)||void 0}),r);let n=0,i=0;if("naturalWidth"in e?(n=e.naturalWidth,i=e.naturalHeight):"videoWidth"in e?(n=e.videoWidth,i=e.videoHeight):"width"in e&&(n=Number(e.width),i=Number(e.height)),!n||!i)throw new TypeError("Could not determine dimensions.");const a=new OffscreenCanvas(n,i),o=a.getContext("2d",{alpha:Zv(),willReadFrequently:!0});pe(o),o.drawImage(e,0,0),this._data=a,this._layout=null,this.format="RGBX",this.codedWidth=n,this.codedHeight=i,this.rotation=r.rotation??0,this.timestamp=r.timestamp,this.duration=r.duration??0,this.colorSpace=new tv({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw new TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");Tp?.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw new Error("VideoSample is closed.");return pe(this._data!==null),sc(this._data)?new nu(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(pe(this._layout),new nu(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})):new nu(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}close(){this._closed||(Tp?.unregister(this),sc(this._data)?this._data.close():this._data=null,this._closed=!0)}allocationSize(e={}){if(hx(e),this._closed)throw new Error("VideoSample is closed.");if(this.format===null)throw new Error("Cannot get allocation size when format is null. Sorry!");if(pe(this._data!==null),!sc(this._data)&&(e.colorSpace||e.format&&e.format!==this.format||e.layout||e.rect)){const r=this.toVideoFrame(),n=r.allocationSize(e);return r.close(),n}return sc(this._data)?this._data.allocationSize(e):this._data instanceof Uint8Array?this._data.byteLength:this.codedWidth*this.codedHeight*4}async copyTo(e,r={}){if(!_0(e))throw new TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(hx(r),this._closed)throw new Error("VideoSample is closed.");if(this.format===null)throw new Error("Cannot copy video sample data when format is null. Sorry!");if(pe(this._data!==null),!sc(this._data)&&(r.colorSpace||r.format&&r.format!==this.format||r.layout||r.rect)){const n=this.toVideoFrame(),i=await n.copyTo(e,r);return n.close(),i}if(sc(this._data))return this._data.copyTo(e,r);if(this._data instanceof Uint8Array)return pe(this._layout),lu(e).set(this._data),this._layout;{const i=this._data.getContext("2d");pe(i);const a=i.getImageData(0,0,this.codedWidth,this.codedHeight);return lu(e).set(a.data),[{offset:0,stride:4*this.codedWidth}]}}toVideoFrame(){if(this._closed)throw new Error("VideoSample is closed.");return pe(this._data!==null),sc(this._data)?new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0}):this._data instanceof Uint8Array?new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace}):new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(e,r,n,i,a,o,s,u,f){let d=0,h=0,p=this.displayWidth,y=this.displayHeight,v=0,b=0,x=this.displayWidth,k=this.displayHeight;if(o!==void 0?(d=r,h=n,p=i,y=a,v=o,b=s,u!==void 0?(x=u,k=f):(x=p,k=y)):(v=r,b=n,i!==void 0&&(x=i,k=a)),!(typeof CanvasRenderingContext2D<"u"&&e instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&e instanceof OffscreenCanvasRenderingContext2D))throw new TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(d))throw new TypeError("sx must be a number.");if(!Number.isFinite(h))throw new TypeError("sy must be a number.");if(!Number.isFinite(p)||p<0)throw new TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(y)||y<0)throw new TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(v))throw new TypeError("dx must be a number.");if(!Number.isFinite(b))throw new TypeError("dy must be a number.");if(!Number.isFinite(x)||x<0)throw new TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(k)||k<0)throw new TypeError("dHeight must be a non-negative number.");if(this._closed)throw new Error("VideoSample is closed.");({sx:d,sy:h,sWidth:p,sHeight:y}=this._rotateSourceRegion(d,h,p,y,this.rotation));const S=this.toCanvasImageSource();e.save();const P=v+x/2,_=b+k/2;e.translate(P,_),e.rotate(this.rotation*Math.PI/180);const E=this.rotation%180===0?1:x/k;e.scale(1/E,E),e.drawImage(S,d,h,p,y,-x/2,-k/2,x,k),e.restore()}drawWithFit(e,r){if(!(typeof CanvasRenderingContext2D<"u"&&e instanceof CanvasRenderingContext2D||typeof OffscreenCanvasRenderingContext2D<"u"&&e instanceof OffscreenCanvasRenderingContext2D))throw new TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!r||typeof r!="object")throw new TypeError("options must be an object.");if(!["fill","contain","cover"].includes(r.fit))throw new TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(r.rotation!==void 0&&![0,90,180,270].includes(r.rotation))throw new TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");r.crop!==void 0&&x8(r.crop,"options.");const n=e.canvas.width,i=e.canvas.height,a=r.rotation??this.rotation,[o,s]=a%180===0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth];r.crop&&w8(r.crop,o,s);let u,f,d,h;const{sx:p,sy:y,sWidth:v,sHeight:b}=this._rotateSourceRegion(r.crop?.left??0,r.crop?.top??0,r.crop?.width??o,r.crop?.height??s,a);if(r.fit==="fill")u=0,f=0,d=n,h=i;else{const[k,S]=r.crop?[r.crop.width,r.crop.height]:[o,s],P=r.fit==="contain"?Math.min(n/k,i/S):Math.max(n/k,i/S);d=k*P,h=S*P,u=(n-d)/2,f=(i-h)/2}e.save();const x=a%180===0?1:d/h;e.translate(n/2,i/2),e.rotate(a*Math.PI/180),e.scale(1/x,x),e.translate(-n/2,-i/2),e.drawImage(this.toCanvasImageSource(),p,y,v,b,u,f,d,h),e.restore()}_rotateSourceRegion(e,r,n,i,a){return a===90?[e,r,n,i]=[r,this.codedHeight-e-n,i,n]:a===180?[e,r]=[this.codedWidth-e-n,this.codedHeight-r-i]:a===270&&([e,r,n,i]=[this.codedWidth-r-i,e,i,n]),{sx:e,sy:r,sWidth:n,sHeight:i}}toCanvasImageSource(){if(this._closed)throw new Error("VideoSample is closed.");if(pe(this._data!==null),this._data instanceof Uint8Array){const e=this.toVideoFrame();return queueMicrotask(()=>e.close()),e}else return this._data}setRotation(e){if(![0,90,180,270].includes(e))throw new TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=e}setTimestamp(e){if(!Number.isFinite(e))throw new TypeError("newTimestamp must be a number.");this.timestamp=e}setDuration(e){if(!Number.isFinite(e)||e<0)throw new TypeError("newDuration must be a non-negative number.");this.duration=e}[Symbol.dispose](){this.close()}}class tv{constructor(e){this.primaries=e?.primaries??null,this.transfer=e?.transfer??null,this.matrix=e?.matrix??null,this.fullRange=e?.fullRange??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}}const sc=t=>typeof VideoFrame<"u"&&t instanceof VideoFrame,w8=(t,e,r)=>{t.left=Math.min(t.left,e),t.top=Math.min(t.top,r),t.width=Math.min(t.width,e-t.left),t.height=Math.min(t.height,r-t.top),pe(t.width>=0),pe(t.height>=0)},x8=(t,e)=>{if(!t||typeof t!="object")throw new TypeError(e+"crop, when provided, must be an object.");if(!Number.isInteger(t.left)||t.left<0)throw new TypeError(e+"crop.left must be a non-negative integer.");if(!Number.isInteger(t.top)||t.top<0)throw new TypeError(e+"crop.top must be a non-negative integer.");if(!Number.isInteger(t.width)||t.width<0)throw new TypeError(e+"crop.width must be a non-negative integer.");if(!Number.isInteger(t.height)||t.height<0)throw new TypeError(e+"crop.height must be a non-negative integer.")},hx=t=>{if(!t||typeof t!="object")throw new TypeError("options must be an object.");if(t.colorSpace!==void 0&&!["display-p3","srgb"].includes(t.colorSpace))throw new TypeError("options.colorSpace, when provided, must be 'display-p3' or 'srgb'.");if(t.format!==void 0&&typeof t.format!="string")throw new TypeError("options.format, when provided, must be a string.");if(t.layout!==void 0){if(!Array.isArray(t.layout))throw new TypeError("options.layout, when provided, must be an array.");for(const e of t.layout){if(!e||typeof e!="object")throw new TypeError("Each entry in options.layout must be an object.");if(!Number.isInteger(e.offset)||e.offset<0)throw new TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(e.stride)||e.stride<0)throw new TypeError("plane.stride must be a non-negative integer.")}}if(t.rect!==void 0){if(!t.rect||typeof t.rect!="object")throw new TypeError("options.rect, when provided, must be an object.");if(t.rect.x!==void 0&&(!Number.isInteger(t.rect.x)||t.rect.x<0))throw new TypeError("options.rect.x, when provided, must be a non-negative integer.");if(t.rect.y!==void 0&&(!Number.isInteger(t.rect.y)||t.rect.y<0))throw new TypeError("options.rect.y, when provided, must be a non-negative integer.");if(t.rect.width!==void 0&&(!Number.isInteger(t.rect.width)||t.rect.width<0))throw new TypeError("options.rect.width, when provided, must be a non-negative integer.");if(t.rect.height!==void 0&&(!Number.isInteger(t.rect.height)||t.rect.height<0))throw new TypeError("options.rect.height, when provided, must be a non-negative integer.")}},vR=(t,e,r)=>{const n=bR(t),i=[];let a=0;for(const o of n){const s=Math.ceil(e/o.widthDivisor),u=Math.ceil(r/o.heightDivisor),f=s*o.sampleBytes,d=f*u;i.push({offset:a,stride:f}),a+=d}return i},bR=t=>{const e=(r,n,i,a,o)=>{const s=[{sampleBytes:r,widthDivisor:1,heightDivisor:1},{sampleBytes:n,widthDivisor:i,heightDivisor:a},{sampleBytes:n,widthDivisor:i,heightDivisor:a}];return o&&s.push({sampleBytes:r,widthDivisor:1,heightDivisor:1}),s};switch(t){case"I420":return e(1,1,2,2,!1);case"I420P10":case"I420P12":return e(2,2,2,2,!1);case"I420A":return e(1,1,2,2,!0);case"I420AP10":case"I420AP12":return e(2,2,2,2,!0);case"I422":return e(1,1,2,1,!1);case"I422P10":case"I422P12":return e(2,2,2,1,!1);case"I422A":return e(1,1,2,1,!0);case"I422AP10":case"I422AP12":return e(2,2,2,1,!0);case"I444":return e(1,1,1,1,!1);case"I444P10":case"I444P12":return e(2,2,1,1,!1);case"I444A":return e(1,1,1,1,!0);case"I444AP10":case"I444AP12":return e(2,2,1,1,!0);case"NV12":return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case"RGBA":case"RGBX":case"BGRA":case"BGRX":return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:_p(t),pe(!1)}},rv=new Set(["f32","f32-planar","s16","s16-planar","s32","s32-planar","u8","u8-planar"]);class iu{get microsecondTimestamp(){return Math.trunc(tu*this.timestamp)}get microsecondDuration(){return Math.trunc(tu*this.duration)}constructor(e){if(this._closed=!1,Mh(e)){if(e.format===null)throw new TypeError("AudioData with null format is not supported.");this._data=e,this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=e.numberOfFrames,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp/1e6,this.duration=e.numberOfFrames/e.sampleRate}else{if(!e||typeof e!="object")throw new TypeError("Invalid AudioDataInit: must be an object.");if(!rv.has(e.format))throw new TypeError("Invalid AudioDataInit: invalid format.");if(!Number.isFinite(e.sampleRate)||e.sampleRate<=0)throw new TypeError("Invalid AudioDataInit: sampleRate must be > 0.");if(!Number.isInteger(e.numberOfChannels)||e.numberOfChannels===0)throw new TypeError("Invalid AudioDataInit: numberOfChannels must be an integer > 0.");if(!Number.isFinite(e?.timestamp))throw new TypeError("init.timestamp must be a number.");const r=e.data.byteLength/(fc(e.format)*e.numberOfChannels);if(!Number.isInteger(r))throw new TypeError("Invalid AudioDataInit: data size is not a multiple of frame size.");this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=r,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp,this.duration=r/e.sampleRate;let n;if(e.data instanceof ArrayBuffer)n=new Uint8Array(e.data);else if(ArrayBuffer.isView(e.data))n=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);else throw new TypeError("Invalid AudioDataInit: data is not a BufferSource.");const i=this.numberOfFrames*this.numberOfChannels*fc(this.format);if(n.byteLength<i)throw new TypeError("Invalid AudioDataInit: insufficient data size.");this._data=n}Tp?.register(this,{type:"audio",data:this._data},this)}allocationSize(e){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(!Number.isInteger(e.planeIndex)||e.planeIndex<0)throw new TypeError("planeIndex must be a non-negative integer.");if(e.format!==void 0&&!rv.has(e.format))throw new TypeError("Invalid format.");if(e.frameOffset!==void 0&&(!Number.isInteger(e.frameOffset)||e.frameOffset<0))throw new TypeError("frameOffset must be a non-negative integer.");if(e.frameCount!==void 0&&(!Number.isInteger(e.frameCount)||e.frameCount<0))throw new TypeError("frameCount must be a non-negative integer.");if(this._closed)throw new Error("AudioSample is closed.");const r=e.format??this.format,n=e.frameOffset??0;if(n>=this.numberOfFrames)throw new RangeError("frameOffset out of range");const i=e.frameCount!==void 0?e.frameCount:this.numberOfFrames-n;if(i>this.numberOfFrames-n)throw new RangeError("frameCount out of range");const a=fc(r),o=rd(r);if(o&&e.planeIndex>=this.numberOfChannels)throw new RangeError("planeIndex out of range");if(!o&&e.planeIndex!==0)throw new RangeError("planeIndex out of range");return(o?i:i*this.numberOfChannels)*a}copyTo(e,r){if(!_0(e))throw new TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(!r||typeof r!="object")throw new TypeError("options must be an object.");if(!Number.isInteger(r.planeIndex)||r.planeIndex<0)throw new TypeError("planeIndex must be a non-negative integer.");if(r.format!==void 0&&!rv.has(r.format))throw new TypeError("Invalid format.");if(r.frameOffset!==void 0&&(!Number.isInteger(r.frameOffset)||r.frameOffset<0))throw new TypeError("frameOffset must be a non-negative integer.");if(r.frameCount!==void 0&&(!Number.isInteger(r.frameCount)||r.frameCount<0))throw new TypeError("frameCount must be a non-negative integer.");if(this._closed)throw new Error("AudioSample is closed.");const{planeIndex:n,format:i,frameCount:a,frameOffset:o}=r,s=this.format,u=i??this.format;if(!u)throw new Error("Destination format not determined");const f=this.numberOfFrames,d=this.numberOfChannels,h=o??0;if(h>=f)throw new RangeError("frameOffset out of range");const p=a!==void 0?a:f-h;if(p>f-h)throw new RangeError("frameCount out of range");const y=fc(u),v=rd(u);if(v&&n>=d)throw new RangeError("planeIndex out of range");if(!v&&n!==0)throw new RangeError("planeIndex out of range");const x=(v?p:p*d)*y;if(e.byteLength<x)throw new RangeError("Destination buffer is too small");const k=Fr(e),S=k8(u);if(Mh(this._data))kg()&&d>2&&u!==s?wR(this._data,k,s,u,d,n,h,p):this._data.copyTo(e,{planeIndex:n,frameOffset:h,frameCount:p,format:u});else{const P=this._data,_=Fr(P),E=S8(s),A=fc(s),T=rd(s);for(let I=0;I<p;I++)if(v){const L=I*y;let R;T?R=(n*f+(I+h))*A:R=((I+h)*d+n)*A;const N=E(_,R);S(k,L,N)}else for(let L=0;L<d;L++){const N=(I*d+L)*y;let F;T?F=(L*f+(I+h))*A:F=((I+h)*d+L)*A;const H=E(_,F);S(k,N,H)}}}clone(){if(this._closed)throw new Error("AudioSample is closed.");if(Mh(this._data)){const e=new iu(this._data.clone());return e.setTimestamp(this.timestamp),e}else return new iu({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data})}close(){this._closed||(Tp?.unregister(this),Mh(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}toAudioData(){if(this._closed)throw new Error("AudioSample is closed.");if(Mh(this._data)){if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(rd(this.format)){const e=this.allocationSize({planeIndex:0,format:this.format}),r=new ArrayBuffer(e*this.numberOfChannels);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(new Uint8Array(r,n*e,e),{planeIndex:n,format:this.format});return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:r})}else{const e=new ArrayBuffer(this.allocationSize({planeIndex:0,format:this.format}));return this.copyTo(e,{planeIndex:0,format:this.format}),new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:e})}}else return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:this._data.buffer instanceof ArrayBuffer?this._data.buffer:this._data.slice()})}toAudioBuffer(){if(this._closed)throw new Error("AudioSample is closed.");const e=new AudioBuffer({numberOfChannels:this.numberOfChannels,length:this.numberOfFrames,sampleRate:this.sampleRate}),r=new Float32Array(this.allocationSize({planeIndex:0,format:"f32-planar"})/4);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(r,{planeIndex:n,format:"f32-planar"}),e.copyToChannel(r,n);return e}setTimestamp(e){if(!Number.isFinite(e))throw new TypeError("newTimestamp must be a number.");this.timestamp=e}[Symbol.dispose](){this.close()}static*_fromAudioBuffer(e,r){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const n=48e3*5,i=e.numberOfChannels,a=e.sampleRate,o=e.length,s=Math.floor(n/i);let u=0,f=o;for(;f>0;){const d=Math.min(s,f),h=new Float32Array(i*d);for(let p=0;p<i;p++)e.copyFromChannel(h.subarray(p*d,(p+1)*d),p,u);yield new iu({format:"f32-planar",sampleRate:a,numberOfFrames:d,numberOfChannels:i,timestamp:r+u/a,data:h}),u+=d,f-=d}}static fromAudioBuffer(e,r){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const n=48e3*5,i=e.numberOfChannels,a=e.sampleRate,o=e.length,s=Math.floor(n/i);let u=0,f=o;const d=[];for(;f>0;){const h=Math.min(s,f),p=new Float32Array(i*h);for(let v=0;v<i;v++)e.copyFromChannel(p.subarray(v*h,(v+1)*h),v,u);const y=new iu({format:"f32-planar",sampleRate:a,numberOfFrames:h,numberOfChannels:i,timestamp:r+u/a,data:p});d.push(y),u+=h,f-=h}return d}}const fc=t=>{switch(t){case"u8":case"u8-planar":return 1;case"s16":case"s16-planar":return 2;case"s32":case"s32-planar":return 4;case"f32":case"f32-planar":return 4;default:throw new Error("Unknown AudioSampleFormat")}},rd=t=>{switch(t){case"u8-planar":case"s16-planar":case"s32-planar":case"f32-planar":return!0;default:return!1}},S8=t=>{switch(t){case"u8":case"u8-planar":return(e,r)=>(e.getUint8(r)-128)/128;case"s16":case"s16-planar":return(e,r)=>e.getInt16(r,!0)/32768;case"s32":case"s32-planar":return(e,r)=>e.getInt32(r,!0)/2147483648;case"f32":case"f32-planar":return(e,r)=>e.getFloat32(r,!0)}},k8=t=>{switch(t){case"u8":case"u8-planar":return(e,r,n)=>e.setUint8(r,cd((n+1)*127.5,0,255));case"s16":case"s16-planar":return(e,r,n)=>e.setInt16(r,cd(Math.round(n*32767),-32768,32767),!0);case"s32":case"s32-planar":return(e,r,n)=>e.setInt32(r,cd(Math.round(n*2147483647),-2147483648,2147483647),!0);case"f32":case"f32-planar":return(e,r,n)=>e.setFloat32(r,n,!0)}},Mh=t=>typeof AudioData<"u"&&t instanceof AudioData,wR=(t,e,r,n,i,a,o,s)=>{const u=S8(r),f=k8(n),d=fc(r),h=fc(n),p=rd(r);if(rd(n))if(p){const v=new ArrayBuffer(s*d),b=Fr(v);t.copyTo(v,{planeIndex:a,frameOffset:o,frameCount:s,format:r});for(let x=0;x<s;x++){const k=x*d,S=x*h,P=u(b,k);f(e,S,P)}}else{const v=new ArrayBuffer(s*i*d),b=Fr(v);t.copyTo(v,{planeIndex:0,frameOffset:o,frameCount:s,format:r});for(let x=0;x<s;x++){const k=(x*i+a)*d,S=x*h,P=u(b,k);f(e,S,P)}}else if(p){const v=s*d,b=new ArrayBuffer(v),x=Fr(b);for(let k=0;k<i;k++){t.copyTo(b,{planeIndex:k,frameOffset:o,frameCount:s,format:r});for(let S=0;S<s;S++){const P=S*d,_=(S*i+k)*h,E=u(x,P);f(e,_,E)}}}else{const v=new ArrayBuffer(s*i*d),b=Fr(v);t.copyTo(v,{planeIndex:0,frameOffset:o,frameCount:s,format:r});for(let x=0;x<s;x++)for(let k=0;k<i;k++){const S=x*i+k,P=S*d,_=S*h,E=u(b,P);f(e,_,E)}}};const jf=t=>{if(!t||typeof t!="object")throw new TypeError("options must be an object.");if(t.metadataOnly!==void 0&&typeof t.metadataOnly!="boolean")throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(t.verifyKeyPackets!==void 0&&typeof t.verifyKeyPackets!="boolean")throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(t.verifyKeyPackets&&t.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},Vs=t=>{if(!n8(t))throw new TypeError("timestamp must be a number.")},nv=(t,e,r)=>r.verifyKeyPackets?e.then(async n=>{if(!n||n.type==="delta")return n;const i=await t.determinePacketType(n);return i&&(n.type=i),n}):e;class rb{constructor(e){if(!(e instanceof ib))throw new TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(jf(e),this._track.input._disposed)throw new ra;return nv(this._track,this._track._backing.getFirstPacket(e),e)}getPacket(e,r={}){if(Vs(e),jf(r),this._track.input._disposed)throw new ra;return nv(this._track,this._track._backing.getPacket(e,r),r)}getNextPacket(e,r={}){if(!(e instanceof xn))throw new TypeError("packet must be an EncodedPacket.");if(jf(r),this._track.input._disposed)throw new ra;return nv(this._track,this._track._backing.getNextPacket(e,r),r)}async getKeyPacket(e,r={}){if(Vs(e),jf(r),this._track.input._disposed)throw new ra;if(!r.verifyKeyPackets)return this._track._backing.getKeyPacket(e,r);const n=await this._track._backing.getKeyPacket(e,r);return n&&(pe(n.type==="key"),await this._track.determinePacketType(n)==="delta"?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,r):n)}async getNextKeyPacket(e,r={}){if(!(e instanceof xn))throw new TypeError("packet must be an EncodedPacket.");if(jf(r),this._track.input._disposed)throw new ra;if(!r.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,r);const n=await this._track._backing.getNextKeyPacket(e,r);return n&&(pe(n.type==="key"),await this._track.determinePacketType(n)==="delta"?this.getNextKeyPacket(n,r):n)}packets(e,r,n={}){if(e!==void 0&&!(e instanceof xn))throw new TypeError("startPacket must be an EncodedPacket.");if(e!==void 0&&e.isMetadataOnly&&!n?.metadataOnly)throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(r!==void 0&&!(r instanceof xn))throw new TypeError("endPacket must be an EncodedPacket.");if(jf(n),this._track.input._disposed)throw new ra;const i=[];let{promise:a,resolve:o}=ta(),{promise:s,resolve:u}=ta(),f=!1,d=!1,h=null;const p=[],y=()=>Math.max(2,p.length);(async()=>{let b=e??await this.getFirstPacket(n);for(;b&&!d&&!this._track.input._disposed&&!(r&&b.sequenceNumber>=r?.sequenceNumber);){if(i.length>y()){({promise:s,resolve:u}=ta()),await s;continue}i.push(b),o(),{promise:a,resolve:o}=ta(),b=await this.getNextPacket(b,n)}f=!0,o()})().catch(b=>{h||(h=b,o())});const v=this._track;return{async next(){for(;;){if(v.input._disposed)throw new ra;if(d)return{value:void 0,done:!0};if(h)throw h;if(i.length>0){const b=i.shift(),x=performance.now();for(p.push(x);p.length>0&&x-p[0]>=1e3;)p.shift();return u(),{value:b,done:!1}}else{if(f)return{value:void 0,done:!0};await a}}},async return(){return d=!0,u(),o(),{value:void 0,done:!0}},async throw(b){throw b},[Symbol.asyncIterator](){return this}}}}class nb{constructor(e,r){this.onSample=e,this.onError=r}}class _8{mediaSamplesInRange(e=0,r=1/0){Vs(e),Vs(r);const n=[];let i=!1,a=null,{promise:o,resolve:s}=ta(),{promise:u,resolve:f}=ta(),d=!1,h=!1,p=!1,y=null;(async()=>{const x=await this._createDecoder(A=>{if(f(),A.timestamp>=r&&(h=!0),h){A.close();return}a&&(A.timestamp>e?(n.push(a),i=!0):a.close()),A.timestamp>=e&&(n.push(A),i=!0),a=i?null:A,n.length>0&&(s(),{promise:o,resolve:s}=ta())},A=>{y||(y=A,s())}),k=this._createPacketSink(),S=await k.getKeyPacket(e,{verifyKeyPackets:!0})??await k.getFirstPacket();let P=S;const E=k.packets(S??void 0,void 0);for(await E.next();P&&!h&&!this._track.input._disposed;){const A=px(n.length);if(n.length+x.getDecodeQueueSize()>A){({promise:u,resolve:f}=ta()),await u;continue}x.decode(P);const T=await E.next();if(T.done)break;P=T.value}await E.return(),!p&&!this._track.input._disposed&&await x.flush(),x.close(),!i&&a&&n.push(a),d=!0,s()})().catch(x=>{y||(y=x,s())});const v=this._track,b=()=>{a?.close();for(const x of n)x.close()};return{async next(){for(;;){if(v.input._disposed)throw b(),new ra;if(p)return{value:void 0,done:!0};if(y)throw b(),y;if(n.length>0){const x=n.shift();return f(),{value:x,done:!1}}else if(!d)await o;else return{value:void 0,done:!0}}},async return(){return p=!0,h=!0,f(),s(),b(),{value:void 0,done:!0}},async throw(x){throw x},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e){jI(e);const r=zI(e),n=[],i=[];let{promise:a,resolve:o}=ta(),{promise:s,resolve:u}=ta(),f=!1,d=!1,h=null;const p=b=>{i.push(b),o(),{promise:a,resolve:o}=ta()};(async()=>{const b=await this._createDecoder(A=>{if(u(),d){A.close();return}let T=0;for(;n.length>0&&A.timestamp-n[0]>-1e-10;)T++,n.shift();if(T>0)for(let I=0;I<T;I++)p(I<T-1?A.clone():A);else A.close()},A=>{h||(h=A,o())}),x=this._createPacketSink();let k=null,S=null,P=-1;const _=async()=>{pe(S);let A=S;for(b.decode(A);A.sequenceNumber<P;){const T=px(i.length);for(;i.length+b.getDecodeQueueSize()>T&&!d;)({promise:s,resolve:u}=ta()),await s;if(d)break;const I=await x.getNextPacket(A);pe(I),b.decode(I),A=I}P=-1},E=async()=>{await b.flush();for(let A=0;A<n.length;A++)p(null);n.length=0};for await(const A of r){if(Vs(A),d||this._track.input._disposed)break;const T=await x.getPacket(A),I=T&&await x.getKeyPacket(A,{verifyKeyPackets:!0});if(!I){P!==-1&&(await _(),await E()),p(null),k=null;continue}k&&(I.sequenceNumber!==S.sequenceNumber||T.timestamp<k.timestamp)&&(await _(),await E()),n.push(T.timestamp),P=Math.max(T.sequenceNumber,P),k=T,S=I}!d&&!this._track.input._disposed&&(P!==-1&&await _(),await E()),b.close(),f=!0,o()})().catch(b=>{h||(h=b,o())});const y=this._track,v=()=>{for(const b of i)b?.close()};return{async next(){for(;;){if(y.input._disposed)throw v(),new ra;if(d)return{value:void 0,done:!0};if(h)throw v(),h;if(i.length>0){const b=i.shift();return pe(b!==void 0),u(),{value:b,done:!1}}else if(!f)await a;else return{value:void 0,done:!0}}},async return(){return d=!0,u(),o(),v(),{value:void 0,done:!0}},async throw(b){throw b},[Symbol.asyncIterator](){return this}}}}const px=t=>t===0?40:8;class xR extends nb{constructor(e,r,n,i,a,o){super(e,r),this.codec=n,this.decoderConfig=i,this.rotation=a,this.timeResolution=o,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new t8,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.mergerCreationFailed=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1;const s=y8.find(u=>u.supports(n,i));if(s)this.customDecoder=new s,this.customDecoder.codec=n,this.customDecoder.config=i,this.customDecoder.onSample=u=>{if(!(u instanceof nu))throw new TypeError("The argument passed to onSample must be a VideoSample.");this.finalizeAndEmitSample(u)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{const u=d=>{if(this.alphaQueue.length>0){const h=this.alphaQueue.shift();pe(h!==void 0),this.mergeAlpha(d,h)}else this.colorQueue.push(d)};if(n==="avc"&&this.decoderConfig.description&&Jv()){const d=nR(lu(this.decoderConfig.description));if(d&&d.sequenceParameterSets.length>0){const h=eb(d.sequenceParameterSets[0]);h&&h.frameMbsOnlyFlag===0&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:"prefer-software"})}}const f=new Error("Decoding error").stack;this.decoder=new VideoDecoder({output:d=>{try{u(d)}catch(h){this.onError(h)}},error:d=>{d.stack=f,this.onError(d)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(pe(this.decoder),Math.max(this.decoder.decodeQueueSize,this.alphaDecoder?.decodeQueueSize??0))}decode(e){if(this.codec==="hevc"&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}if(this.customDecoder)this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--);else{if(pe(this.decoder),kg()||tx(this.inputTimestamps,e.timestamp,r=>r),Jv()&&this.currentPacketIndex===0&&this.codec==="avc"){const r=[];for(const i of u8(e.data,this.decoderConfig)){const a=O0(e.data[i.offset]);a>=20&&a<=31||r.push(e.data.subarray(i.offset,i.offset+i.length))}const n=rR(r,this.decoderConfig);e=new xn(n,e.type,e.timestamp,e.duration)}this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)}this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha||this.mergerCreationFailed){this.pushNullAlphaFrame();return}if(!this.merger)try{this.merger=new SR}catch(n){console.error("Due to an error, only color data will be decoded.",n),this.mergerCreationFailed=!0,this.decodeAlphaData(e);return}if(!this.alphaDecoder){const n=a=>{if(this.alphaDecoderQueueSize--,this.colorQueue.length>0){const o=this.colorQueue.shift();pe(o!==void 0),this.mergeAlpha(o,a)}else this.alphaQueue.push(a);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){const o=this.colorQueue.shift();pe(o!==void 0),this.mergeAlpha(o,null)}else this.alphaQueue.push(null)},i=new Error("Decoding error").stack;this.alphaDecoder=new VideoDecoder({output:a=>{try{n(a)}catch(o){this.onError(o)}},error:a=>{a.stack=i,this.onError(a)}}),this.alphaDecoder.configure(this.decoderConfig)}const r=tb(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||(this.alphaHadKeyframe=r==="key"),this.alphaHadKeyframe){if(this.codec==="hevc"&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha)){this.pushNullAlphaFrame();return}this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(r??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){this.alphaDecoderQueueSize===0?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){for(const r of f8(e,this.decoderConfig)){const n=Ep(e[r.offset]);if(n===ti.RASL_N||n===ti.RASL_R)return!0}return!1}sampleHandler(e){if(kg()){if(this.sampleQueue.length>0&&e.timestamp>=ni(this.sampleQueue).timestamp){for(const r of this.sampleQueue)this.finalizeAndEmitSample(r);this.sampleQueue.length=0}tx(this.sampleQueue,e,r=>r.timestamp)}else{const r=this.inputTimestamps.shift();pe(r!==void 0),e.setTimestamp(r),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}mergeAlpha(e,r){if(!r){const a=new nu(e);this.sampleHandler(a);return}pe(this.merger),this.merger.update(e,r),e.close(),r.close();const n=new VideoFrame(this.merger.canvas,{timestamp:e.timestamp,duration:e.duration??void 0}),i=new nu(n);this.sampleHandler(i)}async flush(){if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(pe(this.decoder),await Promise.all([this.decoder.flush(),this.alphaDecoder?.flush()]),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),kg()){for(const e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(pe(this.decoder),this.decoder.close(),this.alphaDecoder?.close(),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.merger?.close());for(const e of this.sampleQueue)e.close();this.sampleQueue.length=0}}class SR{w=0;h=0;colorImageData=null;alphaImageData=null;constructor(){typeof OffscreenCanvas<"u"?(this.canvas=new OffscreenCanvas(1,1),this.alphaCanvas=new OffscreenCanvas(1,1)):(this.canvas=document.createElement("canvas"),this.alphaCanvas=document.createElement("canvas"));const e=this.canvas.getContext("2d",{alpha:!0,willReadFrequently:!0}),r=this.alphaCanvas.getContext("2d",{alpha:!0,willReadFrequently:!0});if(!e||!r)throw new Error("Couldn't acquire 2D canvas context.");this.ctx=e,this.alphaCtx=r}update(e,r){const n=e.displayWidth,i=e.displayHeight;(n!==this.w||i!==this.h)&&(this.w=n,this.h=i,this.canvas.width=n,this.canvas.height=i,this.alphaCanvas.width=n,this.alphaCanvas.height=i,this.colorImageData=this.ctx.createImageData(n,i),this.alphaImageData=this.ctx.createImageData(n,i)),this.ctx.drawImage(e,0,0,n,i),this.alphaCtx.drawImage(r,0,0,n,i);const a=this.ctx.getImageData(0,0,n,i,{colorSpace:"srgb"}),o=this.alphaCtx.getImageData(0,0,n,i,{colorSpace:"srgb"}),s=new Uint32Array(a.data.buffer),u=new Uint32Array(o.data.buffer),f=s.length;for(let d=0;d<f;d++)s[d]=s[d]&16777215|(u[d]&255)<<24;this.ctx.putImageData(a,0,0)}close(){this.ctx=null,this.alphaCtx=null,this.colorImageData=null,this.alphaImageData=null}}class kR extends _8{constructor(e){if(!(e instanceof Md))throw new TypeError("videoTrack must be an InputVideoTrack.");super(),this._track=e}async _createDecoder(e,r){if(!await this._track.canDecode())throw new Error("This video track cannot be decoded by this browser. Make sure to check decodability before using a track.");const n=this._track.codec,i=this._track.rotation,a=await this._track.getDecoderConfig(),o=this._track.timeResolution;return pe(n&&a),new xR(e,r,n,a,i,o)}_createPacketSink(){return new rb(this._track)}async getSample(e){Vs(e);for await(const r of this.mediaSamplesAtTimestamps([e]))return r;throw new Error("Internal error: Iterator returned nothing.")}samples(e=0,r=1/0){return this.mediaSamplesInRange(e,r)}samplesAtTimestamps(e){return this.mediaSamplesAtTimestamps(e)}}class _R{constructor(e,r={}){if(this._nextCanvasIndex=0,!(e instanceof Md))throw new TypeError("videoTrack must be an InputVideoTrack.");if(r&&typeof r!="object")throw new TypeError("options must be an object.");if(r.alpha!==void 0&&typeof r.alpha!="boolean")throw new TypeError("options.alpha, when provided, must be a boolean.");if(r.width!==void 0&&(!Number.isInteger(r.width)||r.width<=0))throw new TypeError("options.width, when defined, must be a positive integer.");if(r.height!==void 0&&(!Number.isInteger(r.height)||r.height<=0))throw new TypeError("options.height, when defined, must be a positive integer.");if(r.fit!==void 0&&!["fill","contain","cover"].includes(r.fit))throw new TypeError('options.fit, when provided, must be one of "fill", "contain", or "cover".');if(r.width!==void 0&&r.height!==void 0&&r.fit===void 0)throw new TypeError("When both options.width and options.height are provided, options.fit must also be provided.");if(r.rotation!==void 0&&![0,90,180,270].includes(r.rotation))throw new TypeError("options.rotation, when provided, must be 0, 90, 180 or 270.");if(r.crop!==void 0&&x8(r.crop,"options."),r.poolSize!==void 0&&(typeof r.poolSize!="number"||!Number.isInteger(r.poolSize)||r.poolSize<0))throw new TypeError("poolSize must be a non-negative integer.");const n=r.rotation??e.rotation,[i,a]=n%180===0?[e.codedWidth,e.codedHeight]:[e.codedHeight,e.codedWidth],o=r.crop;o&&w8(o,i,a);let[s,u]=o?[o.width,o.height]:[i,a];const f=s/u;r.width!==void 0&&r.height===void 0?(s=r.width,u=Math.round(s/f)):r.width===void 0&&r.height!==void 0?(u=r.height,s=Math.round(u*f)):r.width!==void 0&&r.height!==void 0&&(s=r.width,u=r.height),this._videoTrack=e,this._alpha=r.alpha??!1,this._width=s,this._height=u,this._rotation=n,this._crop=o,this._fit=r.fit??"fill",this._videoSampleSink=new kR(e),this._canvasPool=Array.from({length:r.poolSize??0},()=>null)}_videoSampleToWrappedCanvas(e){let r=this._canvasPool[this._nextCanvasIndex],n=!1;r||(typeof document<"u"?(r=document.createElement("canvas"),r.width=this._width,r.height=this._height):r=new OffscreenCanvas(this._width,this._height),this._canvasPool.length>0&&(this._canvasPool[this._nextCanvasIndex]=r),n=!0),this._canvasPool.length>0&&(this._nextCanvasIndex=(this._nextCanvasIndex+1)%this._canvasPool.length);const i=r.getContext("2d",{alpha:this._alpha||Zv()});pe(i),i.resetTransform(),n||(!this._alpha&&Zv()?(i.fillStyle="black",i.fillRect(0,0,this._width,this._height)):i.clearRect(0,0,this._width,this._height)),e.drawWithFit(i,{fit:this._fit,rotation:this._rotation,crop:this._crop});const a={canvas:r,timestamp:e.timestamp,duration:e.duration};return e.close(),a}async getCanvas(e){Vs(e);const r=await this._videoSampleSink.getSample(e);return r&&this._videoSampleToWrappedCanvas(r)}canvases(e=0,r=1/0){return Yg(this._videoSampleSink.samples(e,r),n=>this._videoSampleToWrappedCanvas(n))}canvasesAtTimestamps(e){return Yg(this._videoSampleSink.samplesAtTimestamps(e),r=>r&&this._videoSampleToWrappedCanvas(r))}}class PR extends nb{constructor(e,r,n,i){super(e,r),this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new t8,this.customDecoderQueueSize=0,this.currentTimestamp=null;const a=s=>{(this.currentTimestamp===null||Math.abs(s.timestamp-this.currentTimestamp)>=s.duration)&&(this.currentTimestamp=s.timestamp);const u=this.currentTimestamp;if(this.currentTimestamp+=s.duration,s.numberOfFrames===0){s.close();return}const f=i.sampleRate;s.setTimestamp(Math.round(u*f)/f),e(s)},o=v8.find(s=>s.supports(n,i));if(o)this.customDecoder=new o,this.customDecoder.codec=n,this.customDecoder.config=i,this.customDecoder.onSample=s=>{if(!(s instanceof iu))throw new TypeError("The argument passed to onSample must be an AudioSample.");a(s)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{const s=new Error("Decoding error").stack;this.decoder=new AudioDecoder({output:u=>{try{a(new iu(u))}catch(f){this.onError(f)}},error:u=>{u.stack=s,this.onError(u)}}),this.decoder.configure(i)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(pe(this.decoder),this.decoder.decodeQueueSize)}decode(e){this.customDecoder?(this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--)):(pe(this.decoder),this.decoder.decode(e.toEncodedAudioChunk()))}flush(){return this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(pe(this.decoder),this.decoder.flush())}close(){this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(pe(this.decoder),this.decoder.close())}}class ER extends nb{constructor(e,r,n){super(e,r),this.decoderConfig=n,this.currentTimestamp=null,pe(Ys.includes(n.codec)),this.codec=n.codec;const{dataType:i,sampleSize:a,littleEndian:o}=s8(this.codec);switch(this.inputSampleSize=a,a){case 1:i==="unsigned"?this.readInputValue=(s,u)=>s.getUint8(u)-2**7:i==="signed"?this.readInputValue=(s,u)=>s.getInt8(u):i==="ulaw"?this.readInputValue=(s,u)=>mR(s.getUint8(u)):i==="alaw"?this.readInputValue=(s,u)=>gR(s.getUint8(u)):pe(!1);break;case 2:i==="unsigned"?this.readInputValue=(s,u)=>s.getUint16(u,o)-2**15:i==="signed"?this.readInputValue=(s,u)=>s.getInt16(u,o):pe(!1);break;case 3:i==="unsigned"?this.readInputValue=(s,u)=>P0(s,u,o)-2**23:i==="signed"?this.readInputValue=(s,u)=>UI(s,u,o):pe(!1);break;case 4:i==="unsigned"?this.readInputValue=(s,u)=>s.getUint32(u,o)-2**31:i==="signed"?this.readInputValue=(s,u)=>s.getInt32(u,o):i==="float"?this.readInputValue=(s,u)=>s.getFloat32(u,o):pe(!1);break;case 8:i==="float"?this.readInputValue=(s,u)=>s.getFloat64(u,o):pe(!1);break;default:_p(a),pe(!1)}switch(a){case 1:i==="ulaw"||i==="alaw"?(this.outputSampleSize=2,this.outputFormat="s16",this.writeOutputValue=(s,u,f)=>s.setInt16(u,f,!0)):(this.outputSampleSize=1,this.outputFormat="u8",this.writeOutputValue=(s,u,f)=>s.setUint8(u,f+2**7));break;case 2:this.outputSampleSize=2,this.outputFormat="s16",this.writeOutputValue=(s,u,f)=>s.setInt16(u,f,!0);break;case 3:this.outputSampleSize=4,this.outputFormat="s32",this.writeOutputValue=(s,u,f)=>s.setInt32(u,f<<8,!0);break;case 4:this.outputSampleSize=4,i==="float"?(this.outputFormat="f32",this.writeOutputValue=(s,u,f)=>s.setFloat32(u,f,!0)):(this.outputFormat="s32",this.writeOutputValue=(s,u,f)=>s.setInt32(u,f,!0));break;case 8:this.outputSampleSize=4,this.outputFormat="f32",this.writeOutputValue=(s,u,f)=>s.setFloat32(u,f,!0);break;default:_p(a),pe(!1)}}getDecodeQueueSize(){return 0}decode(e){const r=Fr(e.data),n=e.byteLength/this.decoderConfig.numberOfChannels/this.inputSampleSize,i=n*this.decoderConfig.numberOfChannels*this.outputSampleSize,a=new ArrayBuffer(i),o=new DataView(a);for(let d=0;d<n*this.decoderConfig.numberOfChannels;d++){const h=d*this.inputSampleSize,p=d*this.outputSampleSize,y=this.readInputValue(r,h);this.writeOutputValue(o,p,y)}const s=n/this.decoderConfig.sampleRate;(this.currentTimestamp===null||Math.abs(e.timestamp-this.currentTimestamp)>=s)&&(this.currentTimestamp=e.timestamp);const u=this.currentTimestamp;this.currentTimestamp+=s;const f=new iu({format:this.outputFormat,data:a,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:n,timestamp:u});this.onSample(f)}async flush(){}close(){}}class TR extends _8{constructor(e){if(!(e instanceof uo))throw new TypeError("audioTrack must be an InputAudioTrack.");super(),this._track=e}async _createDecoder(e,r){if(!await this._track.canDecode())throw new Error("This audio track cannot be decoded by this browser. Make sure to check decodability before using a track.");const n=this._track.codec,i=await this._track.getDecoderConfig();return pe(n&&i),Ys.includes(i.codec)?new ER(e,r,i):new PR(e,r,n,i)}_createPacketSink(){return new rb(this._track)}async getSample(e){Vs(e);for await(const r of this.mediaSamplesAtTimestamps([e]))return r;throw new Error("Internal error: Iterator returned nothing.")}samples(e=0,r=1/0){return this.mediaSamplesInRange(e,r)}samplesAtTimestamps(e){return this.mediaSamplesAtTimestamps(e)}}class jL{constructor(e){if(!(e instanceof uo))throw new TypeError("audioTrack must be an InputAudioTrack.");this._audioSampleSink=new TR(e)}_audioSampleToWrappedArrayBuffer(e){const r={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),r}async getBuffer(e){Vs(e);const r=await this._audioSampleSink.getSample(e);return r&&this._audioSampleToWrappedArrayBuffer(r)}buffers(e=0,r=1/0){return Yg(this._audioSampleSink.samples(e,r),n=>this._audioSampleToWrappedArrayBuffer(n))}buffersAtTimestamps(e){return Yg(this._audioSampleSink.samplesAtTimestamps(e),r=>r&&this._audioSampleToWrappedArrayBuffer(r))}}class ib{constructor(e,r){this.input=e,this._backing=r}isVideoTrack(){return this instanceof Md}isAudioTrack(){return this instanceof uo}get id(){return this._backing.getId()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(e=1/0){const r=new rb(this);let n=1/0,i=-1/0,a=0,o=0;for await(const s of r.packets(void 0,void 0,{metadataOnly:!0})){if(a>=e&&s.timestamp>=i)break;n=Math.min(n,s.timestamp),i=Math.max(i,s.timestamp+s.duration),a++,o+=s.byteLength}return{packetCount:a,averagePacketRate:a?Number((a/(i-n)).toPrecision(16)):0,averageBitrate:a?Number((8*o/(i-n)).toPrecision(16)):0}}}class Md extends ib{constructor(e,r){super(e,r),this._backing=r}get type(){return"video"}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get displayWidth(){return this._backing.getRotation()%180===0?this._backing.getCodedWidth():this._backing.getCodedHeight()}get displayHeight(){return this._backing.getRotation()%180===0?this._backing.getCodedHeight():this._backing.getCodedWidth()}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const e=await this._backing.getColorSpace();return e.primaries==="bt2020"||e.primaries==="smpte432"||e.transfer==="pg"||e.transfer==="hlg"||e.matrix==="bt2020-ncl"}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){return(await this._backing.getDecoderConfig())?.codec??null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const r=this._backing.getCodec();return pe(r!==null),y8.some(i=>i.supports(r,e))?!0:typeof VideoDecoder>"u"?!1:(await VideoDecoder.isConfigSupported(e)).supported===!0}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof xn))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(this.codec===null)return null;const r=await this.getDecoderConfig();return pe(r),tb(this.codec,r,e.data)}}class uo extends ib{constructor(e,r){super(e,r),this._backing=r}get type(){return"audio"}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){return(await this._backing.getDecoderConfig())?.codec??null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const r=this._backing.getCodec();return pe(r!==null),v8.some(n=>n.supports(r,e))||e.codec.startsWith("pcm-")?!0:typeof AudioDecoder>"u"?!1:(await AudioDecoder.isConfigSupported(e)).supported===!0}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof xn))throw new TypeError("packet must be an EncodedPacket.");return this.codec===null?null:"key"}}const CR=t=>{let r=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isQuickTime?"quicktime":"mp4");if(t.codecStrings.length>0){const n=[...new Set(t.codecStrings)];r+=`; codecs="${n.join(", ")}"`}return r};const Wf=8,Xh=16,Ql=t=>{let e=it(t);const r=Vn(t,4);let n=8;e===1&&(e=Ja(t),n=16);const a=e-n;return a<0?null:{name:r,totalSize:e,headerSize:n,contentSize:a}},lc=t=>mc(t)/65536,iv=t=>mc(t)/1073741824,av=t=>{let e=0;for(let r=0;r<4;r++){e<<=7;const n=kt(t);if(e|=n&127,(n&128)===0)break}return e},No=t=>{let e=$n(t);return t.skip(2),e=Math.min(e,t.remainingLength),Ra.decode(It(t,e))},OR=t=>{const e=Ql(t);if(!e||e.name!=="data"||t.remainingLength<8)return null;const r=it(t);t.skip(4);const n=It(t,e.contentSize-8);switch(r){case 1:return Ra.decode(n);case 2:return new TextDecoder("utf-16be").decode(n);case 13:return new sp(n,"image/jpeg");case 14:return new sp(n,"image/png");case 27:return new sp(n,"image/bmp");default:return n}};class AR extends ku{constructor(e){super(e),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=e._reader}async computeDuration(){const e=await this.getTracks(),r=await Promise.all(e.map(n=>n.computeDuration()));return Math.max(0,...r)}async getTracks(){return await this.readMetadata(),this.tracks.map(e=>e.inputTrack)}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.tracks.map(r=>r.inputTrack.getCodecParameterString()));return CR({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some(r=>r.info?.type==="video"),hasAudio:this.tracks.some(r=>r.info?.type==="audio"),codecStrings:e.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){return this.metadataPromise??=(async()=>{let e=0;for(;;){let r=this.reader.requestSliceRange(e,Wf,Xh);if(r instanceof Promise&&(r=await r),!r)break;const n=e,i=Ql(r);if(!i)break;if(i.name==="ftyp"){const a=Vn(r,4);this.isQuickTime=a==="qt "}else if(i.name==="moov"){let a=this.reader.requestSlice(r.filePos,i.contentSize);if(a instanceof Promise&&(a=await a),!a)break;this.moovSlice=a,this.readContiguousBoxes(this.moovSlice),this.tracks.sort((o,s)=>Number(s.disposition.default)-Number(o.disposition.default));for(const o of this.tracks){const s=o.editListPreviousSegmentDurations/this.movieTimescale;o.editListOffset-=Math.round(s*o.timescale)}break}e=n+i.totalSize}if(this.isFragmented&&this.reader.fileSize!==null){let r=this.reader.requestSlice(this.reader.fileSize-4,4);r instanceof Promise&&(r=await r),pe(r);const n=it(r),i=this.reader.fileSize-n;if(i>=0&&i<=this.reader.fileSize-Xh){let a=this.reader.requestSliceRange(i,Wf,Xh);if(a instanceof Promise&&(a=await a),a){const o=Ql(a);if(o&&o.name==="mfra"){let s=this.reader.requestSlice(a.filePos,o.contentSize);s instanceof Promise&&(s=await s),s&&this.readContiguousBoxes(s)}}}}})()}getSampleTableForTrack(e){if(e.sampleTable)return e.sampleTable;const r={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=r,pe(this.moovSlice);const n=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(n),this.currentTrack=null,e.info?.type==="audio"&&e.info.codec&&Ys.includes(e.info.codec)&&r.sampleCompositionTimeOffsets.length===0){pe(e.info?.type==="audio");const a=s8(e.info.codec),o=[],s=[];for(let u=0;u<r.sampleToChunk.length;u++){const f=r.sampleToChunk[u],d=r.sampleToChunk[u+1],h=(d?d.startChunkIndex:r.chunkOffsets.length)-f.startChunkIndex;for(let p=0;p<h;p++){const y=f.startSampleIndex+p*f.samplesPerChunk,v=y+f.samplesPerChunk,b=or(r.sampleTimingEntries,y,I=>I.startIndex),x=r.sampleTimingEntries[b],k=or(r.sampleTimingEntries,v,I=>I.startIndex),S=r.sampleTimingEntries[k],P=x.startDecodeTimestamp+(y-x.startIndex)*x.delta,E=S.startDecodeTimestamp+(v-S.startIndex)*S.delta-P,A=ni(o);A&&A.delta===E?A.count++:o.push({startIndex:f.startChunkIndex+p,startDecodeTimestamp:P,count:1,delta:E});const T=f.samplesPerChunk*a.sampleSize*e.info.numberOfChannels;s.push(T)}f.startSampleIndex=f.startChunkIndex,f.samplesPerChunk=1}r.sampleTimingEntries=o,r.sampleSizes=s}if(r.sampleCompositionTimeOffsets.length>0){r.presentationTimestamps=[];for(const a of r.sampleTimingEntries)for(let o=0;o<a.count;o++)r.presentationTimestamps.push({presentationTimestamp:a.startDecodeTimestamp+o*a.delta,sampleIndex:a.startIndex+o});for(const a of r.sampleCompositionTimeOffsets)for(let o=0;o<a.count;o++){const s=a.startIndex+o,u=r.presentationTimestamps[s];u&&(u.presentationTimestamp+=a.offset)}r.presentationTimestamps.sort((a,o)=>a.presentationTimestamp-o.presentationTimestamp),r.presentationTimestampIndexMap=Array(r.presentationTimestamps.length).fill(-1);for(let a=0;a<r.presentationTimestamps.length;a++)r.presentationTimestampIndexMap[r.presentationTimestamps[a].sampleIndex]=a}return r}async readFragment(e){if(this.lastReadFragment?.moofOffset===e)return this.lastReadFragment;let r=this.reader.requestSliceRange(e,Wf,Xh);r instanceof Promise&&(r=await r),pe(r);const n=Ql(r);pe(n?.name==="moof");let i=this.reader.requestSlice(e,n.totalSize);i instanceof Promise&&(i=await i),pe(i),this.traverseBox(i);const a=this.lastReadFragment;pe(a&&a.moofOffset===e);for(const[,o]of a.trackData){const s=o.track,{fragmentPositionCache:u}=s;if(!o.startTimestampIsFinal){const d=s.fragmentLookupTable.find(h=>h.moofOffset===a.moofOffset);if(d)ov(o,d.timestamp);else{const h=or(u,a.moofOffset-1,p=>p.moofOffset);if(h!==-1){const p=u[h];ov(o,p.endTimestamp)}}o.startTimestampIsFinal=!0}const f=or(u,o.startTimestamp,d=>d.startTimestamp);(f===-1||u[f].moofOffset!==a.moofOffset)&&u.splice(f+1,0,{moofOffset:a.moofOffset,startTimestamp:o.startTimestamp,endTimestamp:o.endTimestamp})}return a}readContiguousBoxes(e){const r=e.filePos;for(;e.filePos-r<=e.length-Wf&&this.traverseBox(e););}*iterateContiguousBoxes(e){const r=e.filePos;for(;e.filePos-r<=e.length-Wf;){const n=e.filePos,i=Ql(e);if(!i)break;yield{boxInfo:i,slice:e},e.filePos=n+i.totalSize}}traverseBox(e){const r=e.filePos,n=Ql(e);if(!n)return!1;const i=e.filePos,a=r+n.totalSize;switch(n.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":this.readContiguousBoxes(e.slice(i,n.contentSize));break;case"mvhd":{const o=kt(e);e.skip(3),o===1?(e.skip(16),this.movieTimescale=it(e),this.movieDurationInTimescale=Ja(e)):(e.skip(8),this.movieTimescale=it(e),this.movieDurationInTimescale=it(e))}break;case"trak":{const o={id:-1,demuxer:this,inputTrack:null,disposition:{...Su},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:Ia,sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=o,this.readContiguousBoxes(e.slice(i,n.contentSize)),o.id!==-1&&o.timescale!==-1&&o.info!==null){if(o.info.type==="video"&&o.info.width!==-1){const s=o;o.inputTrack=new Md(this.input,new IR(s)),this.tracks.push(o)}else if(o.info.type==="audio"&&o.info.numberOfChannels!==-1){const s=o;o.inputTrack=new uo(this.input,new RR(s)),this.tracks.push(o)}}this.currentTrack=null}break;case"tkhd":{const o=this.currentTrack;if(!o)break;const s=kt(e),f=!!(Kf(e)&1);if(o.disposition.default=f,s===0)e.skip(8),o.id=it(e),e.skip(4),o.durationInMovieTimescale=it(e);else if(s===1)e.skip(16),o.id=it(e),e.skip(4),o.durationInMovieTimescale=Ja(e);else throw new Error(`Incorrect track header version ${s}.`);e.skip(16);const d=[lc(e),lc(e),iv(e),lc(e),lc(e),iv(e),lc(e),lc(e),iv(e)],h=Kk(Jk(LR(d),90));pe(h===0||h===90||h===180||h===270),o.rotation=h}break;case"elst":{const o=this.currentTrack;if(!o)break;const s=kt(e);e.skip(3);let u=!1,f=0;const d=it(e);for(let h=0;h<d;h++){const p=s===1?Ja(e):it(e),y=s===1?KM(e):mc(e),v=lc(e);if(p!==0){if(u){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(y===-1){f+=p;continue}if(v!==1){console.warn("Unsupported edit list entry: media rate must be 1.");break}o.editListPreviousSegmentDurations=f,o.editListOffset=y,u=!0}}}break;case"mdhd":{const o=this.currentTrack;if(!o)break;const s=kt(e);e.skip(3),s===0?(e.skip(8),o.timescale=it(e),o.durationInMediaTimescale=it(e)):s===1&&(e.skip(16),o.timescale=it(e),o.durationInMediaTimescale=Ja(e));let u=$n(e);if(u>0){o.languageCode="";for(let f=0;f<3;f++)o.languageCode=String.fromCharCode(96+(u&31))+o.languageCode,u>>=5;e8(o.languageCode)||(o.languageCode=Ia)}}break;case"hdlr":{const o=this.currentTrack;if(!o)break;e.skip(8);const s=Vn(e,4);s==="vide"?o.info={type:"video",width:-1,height:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:s==="soun"&&(o.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const o=this.currentTrack;if(!o)break;o.sampleTableByteOffset=r,this.readContiguousBoxes(e.slice(i,n.contentSize))}break;case"stsd":{const o=this.currentTrack;if(!o||o.info===null||o.sampleTable)break;const s=kt(e);e.skip(3);const u=it(e);for(let f=0;f<u;f++){const d=e.filePos,h=Ql(e);if(!h)break;o.internalCodecId=h.name;const p=h.name.toLowerCase();if(o.info.type==="video")p==="avc1"||p==="avc3"?(o.info.codec="avc",o.info.avcType=p==="avc1"?1:3):p==="hvc1"||p==="hev1"?o.info.codec="hevc":p==="vp08"?o.info.codec="vp8":p==="vp09"?o.info.codec="vp9":p==="av01"?o.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${h.name}').`),e.skip(24),o.info.width=$n(e),o.info.height=$n(e),e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,d+h.totalSize-e.filePos));else{p==="mp4a"||(p==="opus"?o.info.codec="opus":p==="flac"?o.info.codec="flac":p==="twos"||p==="sowt"||p==="raw "||p==="in24"||p==="in32"||p==="fl32"||p==="fl64"||p==="lpcm"||p==="ipcm"||p==="fpcm"||(p==="ulaw"?o.info.codec="ulaw":p==="alaw"?o.info.codec="alaw":console.warn(`Unsupported audio codec (sample entry type '${h.name}').`))),e.skip(8);const y=$n(e);e.skip(6);let v=$n(e),b=$n(e);e.skip(4);let x=it(e)/65536;if(s===0&&y>0){if(y===1)e.skip(4),b=8*it(e),e.skip(8);else if(y===2){e.skip(4),x=B8(e),v=it(e),e.skip(4),b=it(e);const k=it(e);if(e.skip(8),p==="lpcm"){const S=b+7>>3,P=!!(k&1),_=!!(k&2),E=k&4?-1:0;b>0&&b<=64&&(P?b===32&&(o.info.codec=_?"pcm-f32be":"pcm-f32"):E&1<<S-1?S===1?o.info.codec="pcm-s8":S===2?o.info.codec=_?"pcm-s16be":"pcm-s16":S===3?o.info.codec=_?"pcm-s24be":"pcm-s24":S===4&&(o.info.codec=_?"pcm-s32be":"pcm-s32"):S===1&&(o.info.codec="pcm-u8")),o.info.codec===null&&console.warn("Unsupported PCM format.")}}}o.info.codec==="opus"&&(x=T0),o.info.numberOfChannels=v,o.info.sampleRate=x,p==="twos"?b===8?o.info.codec="pcm-s8":b===16?o.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${b} for codec 'twos'.`),o.info.codec=null):p==="sowt"?b===8?o.info.codec="pcm-s8":b===16?o.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${b} for codec 'sowt'.`),o.info.codec=null):p==="raw "?o.info.codec="pcm-u8":p==="in24"?o.info.codec="pcm-s24be":p==="in32"?o.info.codec="pcm-s32be":p==="fl32"?o.info.codec="pcm-f32be":p==="fl64"?o.info.codec="pcm-f64be":p==="ipcm"?o.info.codec="pcm-s16be":p==="fpcm"&&(o.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,d+h.totalSize-e.filePos))}}}break;case"avcC":{const o=this.currentTrack;if(!o)break;pe(o.info),o.info.codecDescription=It(e,n.contentSize)}break;case"hvcC":{const o=this.currentTrack;if(!o)break;pe(o.info),o.info.codecDescription=It(e,n.contentSize)}break;case"vpcC":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="video"),e.skip(4);const s=kt(e),u=kt(e),f=kt(e),d=f>>4,h=f>>1&7,p=f&1,y=kt(e),v=kt(e),b=kt(e);o.info.vp9CodecInfo={profile:s,level:u,bitDepth:d,chromaSubsampling:h,videoFullRangeFlag:p,colourPrimaries:y,transferCharacteristics:v,matrixCoefficients:b}}break;case"av1C":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="video"),e.skip(1);const s=kt(e),u=s>>5,f=s&31,d=kt(e),h=d>>7,p=d>>6&1,y=d>>5&1,v=d>>4&1,b=d>>3&1,x=d>>2&1,k=d&3,S=u===2&&p?y?12:10:p?10:8;o.info.av1CodecInfo={profile:u,level:f,tier:h,bitDepth:S,monochrome:v,chromaSubsamplingX:b,chromaSubsamplingY:x,chromaSamplePosition:k}}break;case"colr":{const o=this.currentTrack;if(!o||(pe(o.info?.type==="video"),Vn(e,4)!=="nclx"))break;const u=$n(e),f=$n(e),d=$n(e),h=!!(kt(e)&128);o.info.colorSpace={primaries:Wg[u],transfer:Gg[f],matrix:Xg[d],fullRange:h}}break;case"wave":this.readContiguousBoxes(e.slice(i,n.contentSize));break;case"esds":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="audio"),e.skip(4);const s=kt(e);pe(s===3),av(e),e.skip(2);const u=kt(e),f=(u&128)!==0,d=(u&64)!==0,h=(u&32)!==0;if(f&&e.skip(2),d){const x=kt(e);e.skip(x)}h&&e.skip(2);const p=kt(e);pe(p===4);const y=av(e),v=e.filePos,b=kt(e);if(b===64||b===103?(o.info.codec="aac",o.info.aacCodecInfo={isMpeg2:b===103,objectType:null}):b===105||b===107?o.info.codec="mp3":b===221?o.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${b}) - discarding track.`),e.skip(12),y>e.filePos-v){const x=kt(e);pe(x===5);const k=av(e);if(o.info.codecDescription=It(e,k),o.info.codec==="aac"){const S=a8(o.info.codecDescription);S.numberOfChannels!==null&&(o.info.numberOfChannels=S.numberOfChannels),S.sampleRate!==null&&(o.info.sampleRate=S.sampleRate)}}}break;case"enda":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="audio"),$n(e)&255&&(o.info.codec==="pcm-s16be"?o.info.codec="pcm-s16":o.info.codec==="pcm-s24be"?o.info.codec="pcm-s24":o.info.codec==="pcm-s32be"?o.info.codec="pcm-s32":o.info.codec==="pcm-f32be"?o.info.codec="pcm-f32":o.info.codec==="pcm-f64be"&&(o.info.codec="pcm-f64"))}break;case"pcmC":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="audio"),e.skip(4);const u=!!(kt(e)&1),f=kt(e);o.info.codec==="pcm-s16be"?u?f===16?o.info.codec="pcm-s16":f===24?o.info.codec="pcm-s24":f===32?o.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${f}.`),o.info.codec=null):f===16?o.info.codec="pcm-s16be":f===24?o.info.codec="pcm-s24be":f===32?o.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${f}.`),o.info.codec=null):o.info.codec==="pcm-f32be"&&(u?f===32?o.info.codec="pcm-f32":f===64?o.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${f}.`),o.info.codec=null):f===32?o.info.codec="pcm-f32be":f===64?o.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${f}.`),o.info.codec=null));break}case"dOps":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="audio"),e.skip(1);const s=kt(e),u=$n(e),f=it(e),d=l2(e),h=kt(e);let p;h!==0?p=It(e,2+s):p=new Uint8Array(0);const y=new Uint8Array(19+p.byteLength),v=new DataView(y.buffer);v.setUint32(0,1332770163,!1),v.setUint32(4,1214603620,!1),v.setUint8(8,1),v.setUint8(9,s),v.setUint16(10,u,!0),v.setUint32(12,f,!0),v.setInt16(16,d,!0),v.setUint8(18,h),y.set(p,19),o.info.codecDescription=y,o.info.numberOfChannels=s}break;case"dfLa":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="audio"),e.skip(4);const s=127,u=128,f=e.filePos;for(;e.filePos<a;){const v=kt(e),b=Kf(e);if((v&s)===fd.STREAMINFO){e.skip(10);const k=it(e),S=k>>>12,P=(k>>9&7)+1;o.info.sampleRate=S,o.info.numberOfChannels=P,e.skip(20)}else e.skip(b);if(v&u)break}const d=e.filePos;e.filePos=f;const h=It(e,d-f),p=new Uint8Array(4+h.byteLength);new DataView(p.buffer).setUint32(0,1716281667,!1),p.set(h,4),o.info.codecDescription=p}break;case"stts":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=it(e);let u=0,f=0;for(let d=0;d<s;d++){const h=it(e),p=it(e);o.sampleTable.sampleTimingEntries.push({startIndex:u,startDecodeTimestamp:f,count:h,delta:p}),u+=h,f+=h*p}}break;case"ctts":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=it(e);let u=0;for(let f=0;f<s;f++){const d=it(e),h=mc(e);o.sampleTable.sampleCompositionTimeOffsets.push({startIndex:u,count:d,offset:h}),u+=d}}break;case"stsz":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=it(e),u=it(e);if(s===0)for(let f=0;f<u;f++){const d=it(e);o.sampleTable.sampleSizes.push(d)}else o.sampleTable.sampleSizes.push(s)}break;case"stz2":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4),e.skip(3);const s=kt(e),u=it(e),f=It(e,Math.ceil(u*s/8)),d=new Dr(f);for(let h=0;h<u;h++){const p=d.readBits(s);o.sampleTable.sampleSizes.push(p)}}break;case"stss":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4),o.sampleTable.keySampleIndices=[];const s=it(e);for(let u=0;u<s;u++){const f=it(e)-1;o.sampleTable.keySampleIndices.push(f)}o.sampleTable.keySampleIndices[0]!==0&&o.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=it(e);for(let f=0;f<s;f++){const d=it(e)-1,h=it(e),p=it(e);o.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:d,samplesPerChunk:h,sampleDescriptionIndex:p})}let u=0;for(let f=0;f<o.sampleTable.sampleToChunk.length;f++)if(o.sampleTable.sampleToChunk[f].startSampleIndex=u,f<o.sampleTable.sampleToChunk.length-1){const h=o.sampleTable.sampleToChunk[f+1].startChunkIndex-o.sampleTable.sampleToChunk[f].startChunkIndex;u+=h*o.sampleTable.sampleToChunk[f].samplesPerChunk}}break;case"stco":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=it(e);for(let u=0;u<s;u++){const f=it(e);o.sampleTable.chunkOffsets.push(f)}}break;case"co64":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=it(e);for(let u=0;u<s;u++){const f=Ja(e);o.sampleTable.chunkOffsets.push(f)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(i,n.contentSize));break;case"mehd":{const o=kt(e);e.skip(3);const s=o===1?Ja(e):it(e);this.movieDurationInTimescale=s}break;case"trex":{e.skip(4);const o=it(e),s=it(e),u=it(e),f=it(e),d=it(e);this.fragmentTrackDefaults.push({trackId:o,defaultSampleDescriptionIndex:s,defaultSampleDuration:u,defaultSampleSize:f,defaultSampleFlags:d})}break;case"tfra":{const o=kt(e);e.skip(3);const s=it(e),u=this.tracks.find(S=>S.id===s);if(!u)break;const f=it(e),d=(f&48)>>4,h=(f&12)>>2,p=f&3,y=[kt,$n,Kf,it],v=y[d],b=y[h],x=y[p],k=it(e);for(let S=0;S<k;S++){const P=o===1?Ja(e):it(e),_=o===1?Ja(e):it(e);v(e),b(e),x(e),u.fragmentLookupTable.push({timestamp:P,moofOffset:_})}u.fragmentLookupTable.sort((S,P)=>S.timestamp-P.timestamp);for(let S=0;S<u.fragmentLookupTable.length-1;S++){const P=u.fragmentLookupTable[S],_=u.fragmentLookupTable[S+1];P.timestamp===_.timestamp&&(u.fragmentLookupTable.splice(S+1,1),S--)}}break;case"moof":this.currentFragment={moofOffset:r,moofSize:n.totalSize,implicitBaseDataOffset:r,trackData:new Map},this.readContiguousBoxes(e.slice(i,n.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(pe(this.currentFragment),this.readContiguousBoxes(e.slice(i,n.contentSize)),this.currentTrack){const o=this.currentFragment.trackData.get(this.currentTrack.id);if(o){const{currentFragmentState:s}=this.currentTrack;pe(s),s.startTimestamp!==null&&(ov(o,s.startTimestamp),o.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{pe(this.currentFragment),e.skip(1);const o=Kf(e),s=!!(o&1),u=!!(o&2),f=!!(o&8),d=!!(o&16),h=!!(o&32),p=!!(o&65536),y=!!(o&131072),v=it(e),b=this.tracks.find(k=>k.id===v);if(!b)break;const x=this.fragmentTrackDefaults.find(k=>k.trackId===v);this.currentTrack=b,b.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:x?.defaultSampleDescriptionIndex??null,defaultSampleDuration:x?.defaultSampleDuration??null,defaultSampleSize:x?.defaultSampleSize??null,defaultSampleFlags:x?.defaultSampleFlags??null,startTimestamp:null},s?b.currentFragmentState.baseDataOffset=Ja(e):y&&(b.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),u&&(b.currentFragmentState.sampleDescriptionIndex=it(e)),f&&(b.currentFragmentState.defaultSampleDuration=it(e)),d&&(b.currentFragmentState.defaultSampleSize=it(e)),h&&(b.currentFragmentState.defaultSampleFlags=it(e)),p&&(b.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const o=this.currentTrack;if(!o)break;pe(o.currentFragmentState);const s=kt(e);e.skip(3);const u=s===0?it(e):Ja(e);o.currentFragmentState.startTimestamp=u}break;case"trun":{const o=this.currentTrack;if(!o)break;if(pe(this.currentFragment),pe(o.currentFragmentState),this.currentFragment.trackData.has(o.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const s=kt(e),u=Kf(e),f=!!(u&1),d=!!(u&4),h=!!(u&256),p=!!(u&512),y=!!(u&1024),v=!!(u&2048),b=it(e);let x=o.currentFragmentState.baseDataOffset;f&&(x+=mc(e));let k=null;d&&(k=it(e));let S=x;if(b===0){this.currentFragment.implicitBaseDataOffset=S;break}let P=0;const _={track:o,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(o.id,_);for(let T=0;T<b;T++){let I;h?I=it(e):(pe(o.currentFragmentState.defaultSampleDuration!==null),I=o.currentFragmentState.defaultSampleDuration);let L;p?L=it(e):(pe(o.currentFragmentState.defaultSampleSize!==null),L=o.currentFragmentState.defaultSampleSize);let R;y?R=it(e):(pe(o.currentFragmentState.defaultSampleFlags!==null),R=o.currentFragmentState.defaultSampleFlags),T===0&&k!==null&&(R=k);let N=0;v&&(s===0?N=it(e):N=mc(e));const F=!(R&65536);_.samples.push({presentationTimestamp:P+N,duration:I,byteOffset:S,byteSize:L,isKeyFrame:F}),S+=L,P+=I}_.presentationTimestamps=_.samples.map((T,I)=>({presentationTimestamp:T.presentationTimestamp,sampleIndex:I})).sort((T,I)=>T.presentationTimestamp-I.presentationTimestamp);for(let T=0;T<_.presentationTimestamps.length;T++){const I=_.presentationTimestamps[T],L=_.samples[I.sampleIndex];if(_.firstKeyFrameTimestamp===null&&L.isKeyFrame&&(_.firstKeyFrameTimestamp=L.presentationTimestamp),T<_.presentationTimestamps.length-1){const R=_.presentationTimestamps[T+1];L.duration=R.presentationTimestamp-I.presentationTimestamp}}const E=_.samples[_.presentationTimestamps[0].sampleIndex],A=_.samples[ni(_.presentationTimestamps).sampleIndex];_.startTimestamp=E.presentationTimestamp,_.endTimestamp=A.presentationTimestamp+A.duration,this.currentFragment.implicitBaseDataOffset=S}break;case"udta":{const o=this.iterateContiguousBoxes(e.slice(i,n.contentSize));for(const{boxInfo:s,slice:u}of o){if(s.name!=="meta"&&!this.currentTrack){const f=u.filePos;this.metadataTags.raw??={},s.name[0]==="©"?this.metadataTags.raw[s.name]??=No(u):this.metadataTags.raw[s.name]??=It(u,s.contentSize),u.filePos=f}switch(s.name){case"meta":u.skip(-s.headerSize),this.traverseBox(u);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=Ra.decode(It(u,s.contentSize)):this.metadataTags.title??=No(u);break;case"©des":this.currentTrack||(this.metadataTags.description??=No(u));break;case"©ART":this.currentTrack||(this.metadataTags.artist??=No(u));break;case"©alb":this.currentTrack||(this.metadataTags.album??=No(u));break;case"albr":this.currentTrack||(this.metadataTags.albumArtist??=No(u));break;case"©gen":this.currentTrack||(this.metadataTags.genre??=No(u));break;case"©day":if(!this.currentTrack){const f=new Date(No(u));Number.isNaN(f.getTime())||(this.metadataTags.date??=f)}break;case"©cmt":this.currentTrack||(this.metadataTags.comment??=No(u));break;case"©lyr":this.currentTrack||(this.metadataTags.lyrics??=No(u));break}}}break;case"meta":{if(this.currentTrack)break;const s=it(e)!==0;this.currentMetadataKeys=new Map,s?this.readContiguousBoxes(e.slice(i,n.contentSize)):this.readContiguousBoxes(e.slice(i+4,n.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;e.skip(4);const o=it(e);for(let s=0;s<o;s++){const u=it(e);e.skip(4);const f=Ra.decode(It(e,u-8));this.currentMetadataKeys.set(s+1,f)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const o=this.iterateContiguousBoxes(e.slice(i,n.contentSize));for(const{boxInfo:s,slice:u}of o){let f=s.name;const d=(f.charCodeAt(0)<<24)+(f.charCodeAt(1)<<16)+(f.charCodeAt(2)<<8)+f.charCodeAt(3);this.currentMetadataKeys.has(d)&&(f=this.currentMetadataKeys.get(d));const h=OR(u);switch(this.metadataTags.raw??={},this.metadataTags.raw[f]??=h,f){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":typeof h=="string"&&(this.metadataTags.title??=h);break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":typeof h=="string"&&(this.metadataTags.description??=h);break;case"©ART":case"com.apple.quicktime.artist":case"artist":typeof h=="string"&&(this.metadataTags.artist??=h);break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":typeof h=="string"&&(this.metadataTags.album??=h);break;case"aART":case"album_artist":typeof h=="string"&&(this.metadataTags.albumArtist??=h);break;case"©cmt":case"com.apple.quicktime.comment":case"comment":typeof h=="string"&&(this.metadataTags.comment??=h);break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":typeof h=="string"&&(this.metadataTags.genre??=h);break;case"©lyr":case"lyrics":typeof h=="string"&&(this.metadataTags.lyrics??=h);break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if(typeof h=="string"){const p=new Date(h);Number.isNaN(p.getTime())||(this.metadataTags.date??=p)}break;case"covr":case"com.apple.quicktime.artwork":h instanceof sp?(this.metadataTags.images??=[],this.metadataTags.images.push({data:h.data,kind:"coverFront",mimeType:h.mimeType})):h instanceof Uint8Array&&(this.metadataTags.images??=[],this.metadataTags.images.push({data:h,kind:"coverFront",mimeType:"image/*"}));break;case"track":if(typeof h=="string"){const p=h.split("/"),y=Number.parseInt(p[0],10),v=p[1]&&Number.parseInt(p[1],10);Number.isInteger(y)&&y>0&&(this.metadataTags.trackNumber??=y),v&&Number.isInteger(v)&&v>0&&(this.metadataTags.tracksTotal??=v)}break;case"trkn":if(h instanceof Uint8Array&&h.length>=6){const p=Fr(h),y=p.getUint16(2,!1),v=p.getUint16(4,!1);y>0&&(this.metadataTags.trackNumber??=y),v>0&&(this.metadataTags.tracksTotal??=v)}break;case"disc":case"disk":if(h instanceof Uint8Array&&h.length>=6){const p=Fr(h),y=p.getUint16(2,!1),v=p.getUint16(4,!1);y>0&&(this.metadataTags.discNumber??=y),v>0&&(this.metadataTags.discsTotal??=v)}break}}}break}return e.filePos=a,!0}}class P8{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}async getFirstTimestamp(){return(await this.getFirstPacket({metadataOnly:!0}))?.timestamp??0}async getFirstPacket(e){const r=await this.fetchPacketForSampleIndex(0,e);return r||!this.internalTrack.demuxer.isFragmented?r:this.performFragmentedLookup(null,n=>n.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1},-1/0,1/0,e)}mapTimestampIntoTimescale(e){return Pp(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,r){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a=r2(i,n),o=await this.fetchPacketForSampleIndex(a,r);return!mx(i)||!this.internalTrack.demuxer.isFragmented?o:this.performFragmentedLookup(null,s=>{const u=s.trackData.get(this.internalTrack.id);if(!u)return{sampleIndex:-1,correctSampleFound:!1};const f=or(u.presentationTimestamps,n,p=>p.presentationTimestamp),d=f!==-1?u.presentationTimestamps[f].sampleIndex:-1,h=f!==-1&&n<u.endTimestamp;return{sampleIndex:d,correctSampleFound:h}},n,n,r)}async getNextPacket(e,r){const n=this.packetToSampleIndex.get(e);if(n!==void 0)return this.fetchPacketForSampleIndex(n+1,r);const i=this.packetToFragmentLocation.get(e);if(i===void 0)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,a=>{if(a===i.fragment){const o=a.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<o.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(a.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,r)}async getKeyPacket(e,r){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a=MR(i,n),o=await this.fetchPacketForSampleIndex(a,r);return!mx(i)||!this.internalTrack.demuxer.isFragmented?o:this.performFragmentedLookup(null,s=>{const u=s.trackData.get(this.internalTrack.id);if(!u)return{sampleIndex:-1,correctSampleFound:!1};const f=Q2(u.presentationTimestamps,p=>u.samples[p.sampleIndex].isKeyFrame&&p.presentationTimestamp<=n),d=f!==-1?u.presentationTimestamps[f].sampleIndex:-1,h=f!==-1&&n<u.endTimestamp;return{sampleIndex:d,correctSampleFound:h}},n,n,r)}async getNextKeyPacket(e,r){const n=this.packetToSampleIndex.get(e);if(n!==void 0){const a=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),o=NR(a,n);return this.fetchPacketForSampleIndex(o,r)}const i=this.packetToFragmentLocation.get(e);if(i===void 0)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,a=>{if(a===i.fragment){const s=a.trackData.get(this.internalTrack.id).samples.findIndex((u,f)=>u.isKeyFrame&&f>i.sampleIndex);if(s!==-1)return{sampleIndex:s,correctSampleFound:!0}}else{const o=a.trackData.get(this.internalTrack.id);if(o&&o.firstKeyFrameTimestamp!==null){const s=o.samples.findIndex(u=>u.isKeyFrame);return pe(s!==-1),{sampleIndex:s,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}},-1/0,1/0,r)}async fetchPacketForSampleIndex(e,r){if(e===-1)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=DR(n,e);if(!i)return null;let a;if(r.metadataOnly)a=la;else{let f=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);f instanceof Promise&&(f=await f),pe(f),a=It(f,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,u=new xn(a,i.isKeyFrame?"key":"delta",o,s,e,i.sampleSize);return this.packetToSampleIndex.set(u,e),u}async fetchPacketInFragment(e,r,n){if(r===-1)return null;const a=e.trackData.get(this.internalTrack.id).samples[r];pe(a);let o;if(n.metadataOnly)o=la;else{let d=this.internalTrack.demuxer.reader.requestSlice(a.byteOffset,a.byteSize);d instanceof Promise&&(d=await d),pe(d),o=It(d,a.byteSize)}const s=(a.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,u=a.duration/this.internalTrack.timescale,f=new xn(o,a.isKeyFrame?"key":"delta",s,u,e.moofOffset+r,a.byteSize);return this.packetToFragmentLocation.set(f,{fragment:e,sampleIndex:r}),f}async performFragmentedLookup(e,r,n,i,a){const o=this.internalTrack.demuxer;let s=null,u=null,f=-1;if(e){const{sampleIndex:x,correctSampleFound:k}=r(e);if(k)return this.fetchPacketInFragment(e,x,a);x!==-1&&(u=e,f=x)}const d=or(this.internalTrack.fragmentLookupTable,n,x=>x.timestamp),h=d!==-1?this.internalTrack.fragmentLookupTable[d]:null,p=or(this.internalTrack.fragmentPositionCache,n,x=>x.startTimestamp),y=p!==-1?this.internalTrack.fragmentPositionCache[p]:null,v=Math.max(h?.moofOffset??0,y?.moofOffset??0)||null;let b;for(e?v===null||e.moofOffset>=v?(b=e.moofOffset+e.moofSize,s=e):b=v:b=v??0;;){if(s){const P=s.trackData.get(this.internalTrack.id);if(P&&P.startTimestamp>i)break}let x=o.reader.requestSliceRange(b,Wf,Xh);if(x instanceof Promise&&(x=await x),!x)break;const k=b,S=Ql(x);if(!S)break;if(S.name==="moof"){s=await o.readFragment(k);const{sampleIndex:P,correctSampleFound:_}=r(s);if(_)return this.fetchPacketInFragment(s,P,a);P!==-1&&(u=s,f=P)}b=k+S.totalSize}if(h&&(!u||u.moofOffset<h.moofOffset)){const x=this.internalTrack.fragmentLookupTable[d-1];pe(!x||x.timestamp<h.timestamp);const k=x?.timestamp??-1/0;return this.performFragmentedLookup(null,r,k,i,a)}return u?this.fetchPacketInFragment(u,f,a):null}}class IR extends P8{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getRotation(){return this.internalTrack.rotation}async getColorSpace(){return{primaries:this.internalTrack.info.colorSpace?.primaries,transfer:this.internalTrack.info.colorSpace?.transfer,matrix:this.internalTrack.info.colorSpace?.matrix,fullRange:this.internalTrack.info.colorSpace?.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfigPromise??=(async()=>{if(this.internalTrack.info.codec==="vp9"&&!this.internalTrack.info.vp9CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=e&&p8(e.data)}else if(this.internalTrack.info.codec==="av1"&&!this.internalTrack.info.av1CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&g8(e.data)}return{codec:Z2(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:this.internalTrack.info.codecDescription??void 0,colorSpace:this.internalTrack.info.colorSpace??void 0}})():null}}class RR extends P8{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfig??={codec:J2(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}:null}}const r2=(t,e)=>{if(t.presentationTimestamps){const r=or(t.presentationTimestamps,e,n=>n.presentationTimestamp);return r===-1?-1:t.presentationTimestamps[r].sampleIndex}else{const r=or(t.sampleTimingEntries,e,i=>i.startDecodeTimestamp);if(r===-1)return-1;const n=t.sampleTimingEntries[r];return n.startIndex+Math.min(Math.floor((e-n.startDecodeTimestamp)/n.delta),n.count-1)}},MR=(t,e)=>{if(!t.keySampleIndices)return r2(t,e);if(t.presentationTimestamps){const r=or(t.presentationTimestamps,e,n=>n.presentationTimestamp);if(r===-1)return-1;for(let n=r;n>=0;n--){const i=t.presentationTimestamps[n].sampleIndex;if(Hp(t.keySampleIndices,i,o=>o)!==-1)return i}return-1}else{const r=r2(t,e),n=or(t.keySampleIndices,r,i=>i);return t.keySampleIndices[n]??-1}},DR=(t,e)=>{const r=or(t.sampleTimingEntries,e,k=>k.startIndex),n=t.sampleTimingEntries[r];if(!n||n.startIndex+n.count<=e)return null;let a=n.startDecodeTimestamp+(e-n.startIndex)*n.delta;const o=or(t.sampleCompositionTimeOffsets,e,k=>k.startIndex),s=t.sampleCompositionTimeOffsets[o];s&&e-s.startIndex<s.count&&(a+=s.offset);const u=t.sampleSizes[Math.min(e,t.sampleSizes.length-1)],f=or(t.sampleToChunk,e,k=>k.startSampleIndex),d=t.sampleToChunk[f];pe(d);const h=d.startChunkIndex+Math.floor((e-d.startSampleIndex)/d.samplesPerChunk),p=t.chunkOffsets[h],y=d.startSampleIndex+(h-d.startChunkIndex)*d.samplesPerChunk;let v=0,b=p;if(t.sampleSizes.length===1)b+=u*(e-y),v+=u*d.samplesPerChunk;else for(let k=y;k<y+d.samplesPerChunk;k++){const S=t.sampleSizes[k];k<e&&(b+=S),v+=S}let x=n.delta;if(t.presentationTimestamps){const k=t.presentationTimestampIndexMap[e];pe(k!==void 0),k<t.presentationTimestamps.length-1&&(x=t.presentationTimestamps[k+1].presentationTimestamp-a)}return{presentationTimestamp:a,duration:x,sampleOffset:b,sampleSize:u,chunkOffset:p,chunkSize:v,isKeyFrame:t.keySampleIndices?Hp(t.keySampleIndices,e,k=>k)!==-1:!0}},NR=(t,e)=>{if(!t.keySampleIndices)return e+1;const r=or(t.keySampleIndices,e,n=>n);return t.keySampleIndices[r+1]??-1},ov=(t,e)=>{t.startTimestamp+=e,t.endTimestamp+=e;for(const r of t.samples)r.presentationTimestamp+=e;for(const r of t.presentationTimestamps)r.presentationTimestamp+=e},LR=t=>{const[e,,,r]=t,n=Math.hypot(e,r),i=e/n,a=r/n,o=-Math.atan2(a,i)*(180/Math.PI);return Number.isFinite(o)?o:0},mx=t=>t.sampleSizes.length===0;var je;(function(t){t[t.EBML=440786851]="EBML",t[t.EBMLVersion=17030]="EBMLVersion",t[t.EBMLReadVersion=17143]="EBMLReadVersion",t[t.EBMLMaxIDLength=17138]="EBMLMaxIDLength",t[t.EBMLMaxSizeLength=17139]="EBMLMaxSizeLength",t[t.DocType=17026]="DocType",t[t.DocTypeVersion=17031]="DocTypeVersion",t[t.DocTypeReadVersion=17029]="DocTypeReadVersion",t[t.Void=236]="Void",t[t.Segment=408125543]="Segment",t[t.SeekHead=290298740]="SeekHead",t[t.Seek=19899]="Seek",t[t.SeekID=21419]="SeekID",t[t.SeekPosition=21420]="SeekPosition",t[t.Duration=17545]="Duration",t[t.Info=357149030]="Info",t[t.TimestampScale=2807729]="TimestampScale",t[t.MuxingApp=19840]="MuxingApp",t[t.WritingApp=22337]="WritingApp",t[t.Tracks=374648427]="Tracks",t[t.TrackEntry=174]="TrackEntry",t[t.TrackNumber=215]="TrackNumber",t[t.TrackUID=29637]="TrackUID",t[t.TrackType=131]="TrackType",t[t.FlagEnabled=185]="FlagEnabled",t[t.FlagDefault=136]="FlagDefault",t[t.FlagForced=21930]="FlagForced",t[t.FlagOriginal=21934]="FlagOriginal",t[t.FlagHearingImpaired=21931]="FlagHearingImpaired",t[t.FlagVisualImpaired=21932]="FlagVisualImpaired",t[t.FlagCommentary=21935]="FlagCommentary",t[t.FlagLacing=156]="FlagLacing",t[t.Name=21358]="Name",t[t.Language=2274716]="Language",t[t.LanguageBCP47=2274717]="LanguageBCP47",t[t.CodecID=134]="CodecID",t[t.CodecPrivate=25506]="CodecPrivate",t[t.CodecDelay=22186]="CodecDelay",t[t.SeekPreRoll=22203]="SeekPreRoll",t[t.DefaultDuration=2352003]="DefaultDuration",t[t.Video=224]="Video",t[t.PixelWidth=176]="PixelWidth",t[t.PixelHeight=186]="PixelHeight",t[t.AlphaMode=21440]="AlphaMode",t[t.Audio=225]="Audio",t[t.SamplingFrequency=181]="SamplingFrequency",t[t.Channels=159]="Channels",t[t.BitDepth=25188]="BitDepth",t[t.SimpleBlock=163]="SimpleBlock",t[t.BlockGroup=160]="BlockGroup",t[t.Block=161]="Block",t[t.BlockAdditions=30113]="BlockAdditions",t[t.BlockMore=166]="BlockMore",t[t.BlockAdditional=165]="BlockAdditional",t[t.BlockAddID=238]="BlockAddID",t[t.BlockDuration=155]="BlockDuration",t[t.ReferenceBlock=251]="ReferenceBlock",t[t.Cluster=524531317]="Cluster",t[t.Timestamp=231]="Timestamp",t[t.Cues=475249515]="Cues",t[t.CuePoint=187]="CuePoint",t[t.CueTime=179]="CueTime",t[t.CueTrackPositions=183]="CueTrackPositions",t[t.CueTrack=247]="CueTrack",t[t.CueClusterPosition=241]="CueClusterPosition",t[t.Colour=21936]="Colour",t[t.MatrixCoefficients=21937]="MatrixCoefficients",t[t.TransferCharacteristics=21946]="TransferCharacteristics",t[t.Primaries=21947]="Primaries",t[t.Range=21945]="Range",t[t.Projection=30320]="Projection",t[t.ProjectionType=30321]="ProjectionType",t[t.ProjectionPoseRoll=30325]="ProjectionPoseRoll",t[t.Attachments=423732329]="Attachments",t[t.AttachedFile=24999]="AttachedFile",t[t.FileDescription=18046]="FileDescription",t[t.FileName=18030]="FileName",t[t.FileMediaType=18016]="FileMediaType",t[t.FileData=18012]="FileData",t[t.FileUID=18094]="FileUID",t[t.Chapters=272869232]="Chapters",t[t.Tags=307544935]="Tags",t[t.Tag=29555]="Tag",t[t.Targets=25536]="Targets",t[t.TargetTypeValue=26826]="TargetTypeValue",t[t.TargetType=25546]="TargetType",t[t.TagTrackUID=25541]="TagTrackUID",t[t.TagEditionUID=25545]="TagEditionUID",t[t.TagChapterUID=25540]="TagChapterUID",t[t.TagAttachmentUID=25542]="TagAttachmentUID",t[t.SimpleTag=26568]="SimpleTag",t[t.TagName=17827]="TagName",t[t.TagLanguage=17530]="TagLanguage",t[t.TagString=17543]="TagString",t[t.TagBinary=17541]="TagBinary",t[t.ContentEncodings=28032]="ContentEncodings",t[t.ContentEncoding=25152]="ContentEncoding",t[t.ContentEncodingOrder=20529]="ContentEncodingOrder",t[t.ContentEncodingScope=20530]="ContentEncodingScope",t[t.ContentCompression=20532]="ContentCompression",t[t.ContentCompAlgo=16980]="ContentCompAlgo",t[t.ContentCompSettings=16981]="ContentCompSettings",t[t.ContentEncryption=20533]="ContentEncryption"})(je||(je={}));const FR=[je.EBML,je.Segment],Cp=[je.SeekHead,je.Info,je.Cluster,je.Tracks,je.Cues,je.Attachments,je.Chapters,je.Tags],_g=[...FR,...Cp],n2=8,Pa=2,Bs=2*n2,E8=t=>{if(t.remainingLength<1)return null;const e=kt(t);if(t.skip(-1),e===0)return null;let r=1,n=128;for(;(e&n)===0;)r++,n>>=1;return t.remainingLength<r?null:r},Yh=t=>{if(t.remainingLength<1)return null;const e=kt(t);if(e===0)return null;let r=1,n=128;for(;(e&n)===0;)r++,n>>=1;if(t.remainingLength<r-1)return null;let i=e&n-1;for(let a=1;a<r;a++)i*=256,i+=kt(t);return i},Vt=(t,e)=>{if(e<1||e>8)throw new Error("Bad unsigned int size "+e);let r=0;for(let n=0;n<e;n++)r*=256,r+=kt(t);return r},BR=(t,e)=>{if(e<1)throw new Error("Bad unsigned int size "+e);let r=0n;for(let n=0;n<e;n++)r<<=8n,r+=BigInt(kt(t));return r},ab=t=>{const e=E8(t);return e===null||t.remainingLength<e?null:Vt(t,e)},T8=t=>{if(t.remainingLength<1)return null;if(kt(t)===255)return;t.skip(-1);const r=Yh(t);if(r===null)return null;if(r!==72057594037927940)return r},Ds=t=>{pe(t.remainingLength>=Pa);const e=ab(t);if(e===null)return null;const r=T8(t);return r===null?null:{id:e,size:r}},Gf=(t,e)=>{const r=It(t,e);let n=0;for(;n<e&&r[n]!==0;)n+=1;return String.fromCharCode(...r.subarray(0,n))},Dh=(t,e)=>{const r=It(t,e);let n=0;for(;n<e&&r[n]!==0;)n+=1;return Ra.decode(r.subarray(0,n))},sv=(t,e)=>{if(e===0)return 0;if(e!==4&&e!==8)throw new Error("Bad float size "+e);return e===4?ZM(t):B8(t)},i2=async(t,e,r,n)=>{const i=new Set(r);let a=e;for(;n===null||a<n;){let o=t.requestSliceRange(a,Pa,Bs);if(o instanceof Promise&&(o=await o),!o)break;const s=Ds(o);if(!s)break;if(i.has(s.id))return{pos:a,found:!0};Kl(s.size),a=o.filePos+s.size}return{pos:n!==null&&n>a?n:a,found:!1}},C8=async(t,e,r,n)=>{const a=new Set(r);let o=e;for(;o<n;){let s=t.requestSliceRange(o,0,Math.min(65536,n-o));if(s instanceof Promise&&(s=await s),!s||s.length<n2)break;for(let u=0;u<s.length-n2;u++){s.filePos=o;const f=ab(s);if(f!==null&&a.has(f))return o;o++}}return null},Lo={avc:"V_MPEG4/ISO/AVC",hevc:"V_MPEGH/ISO/HEVC",vp8:"V_VP8",vp9:"V_VP9",av1:"V_AV1",aac:"A_AAC",mp3:"A_MPEG/L3",opus:"A_OPUS",vorbis:"A_VORBIS",flac:"A_FLAC"};function Kl(t){if(t===void 0)throw new Error("Undefined element size is used in a place where it is not supported.")}const zR=t=>{let r=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isWebM?"webm":"x-matroska");if(t.codecStrings.length>0){const n=[...new Set(t.codecStrings.filter(Boolean))];r+=`; codecs="${n.join(", ")}"`}return r};var As;(function(t){t[t.None=0]="None",t[t.Xiph=1]="Xiph",t[t.FixedSize=2]="FixedSize",t[t.Ebml=3]="Ebml"})(As||(As={}));var Qg;(function(t){t[t.Block=1]="Block",t[t.Private=2]="Private",t[t.Next=4]="Next"})(Qg||(Qg={}));var lp;(function(t){t[t.Zlib=0]="Zlib",t[t.Bzlib=1]="Bzlib",t[t.lzo1x=2]="lzo1x",t[t.HeaderStripping=3]="HeaderStripping"})(lp||(lp={}));const lv=[{id:je.SeekHead,flag:"seekHeadSeen"},{id:je.Info,flag:"infoSeen"},{id:je.Tracks,flag:"tracksSeen"},{id:je.Cues,flag:"cuesSeen"}],O8=10*2**20;class jR extends ku{constructor(e){super(e),this.readMetadataPromise=null,this.segments=[],this.currentSegment=null,this.currentTrack=null,this.currentCluster=null,this.currentBlock=null,this.currentBlockAdditional=null,this.currentCueTime=null,this.currentDecodingInstruction=null,this.currentTagTargetIsMovie=!0,this.currentSimpleTagName=null,this.currentAttachedFile=null,this.isWebM=!1,this.reader=e._reader}async computeDuration(){const e=await this.getTracks(),r=await Promise.all(e.map(n=>n.computeDuration()));return Math.max(0,...r)}async getTracks(){return await this.readMetadata(),this.segments.flatMap(e=>e.tracks.map(r=>r.inputTrack))}async getMimeType(){await this.readMetadata();const e=await this.getTracks(),r=await Promise.all(e.map(n=>n.getCodecParameterString()));return zR({isWebM:this.isWebM,hasVideo:this.segments.some(n=>n.tracks.some(i=>i.info?.type==="video")),hasAudio:this.segments.some(n=>n.tracks.some(i=>i.info?.type==="audio")),codecStrings:r.filter(Boolean)})}async getMetadataTags(){await this.readMetadata();for(const r of this.segments)r.metadataTagsCollected||(this.reader.fileSize!==null&&await this.loadSegmentMetadata(r),r.metadataTagsCollected=!0);let e={};for(const r of this.segments)e={...e,...r.metadataTags};return e}readMetadata(){return this.readMetadataPromise??=(async()=>{let e=0;for(;;){let r=this.reader.requestSliceRange(e,Pa,Bs);if(r instanceof Promise&&(r=await r),!r)break;const n=Ds(r);if(!n)break;const i=n.id;let a=n.size;const o=r.filePos;if(i===je.EBML){Kl(a);let s=this.reader.requestSlice(o,a);if(s instanceof Promise&&(s=await s),!s)break;this.readContiguousElements(s)}else if(i===je.Segment){if(await this.readSegment(o,a),a===void 0||this.reader.fileSize===null)break}else if(i===je.Cluster){if(this.reader.fileSize===null)break;a===void 0&&(a=(await i2(this.reader,o,_g,this.reader.fileSize)).pos-o);const s=ni(this.segments);s&&(s.elementEndPos=o+a)}Kl(a),e=o+a}})()}async readSegment(e,r){this.currentSegment={seekHeadSeen:!1,infoSeen:!1,tracksSeen:!1,cuesSeen:!1,tagsSeen:!1,attachmentsSeen:!1,timestampScale:-1,timestampFactor:-1,duration:-1,seekEntries:[],tracks:[],cuePoints:[],dataStartPos:e,elementEndPos:r===void 0?null:e+r,clusterSeekStartPos:e,lastReadCluster:null,metadataTags:{},metadataTagsCollected:!1},this.segments.push(this.currentSegment);let n=e;for(;this.currentSegment.elementEndPos===null||n<this.currentSegment.elementEndPos;){let s=this.reader.requestSliceRange(n,Pa,Bs);if(s instanceof Promise&&(s=await s),!s)break;const u=n,f=Ds(s);if(!f||!Cp.includes(f.id)&&f.id!==je.Void){const v=await C8(this.reader,u,Cp,Math.min(this.currentSegment.elementEndPos??1/0,u+O8));if(v){n=v;continue}else break}const{id:d,size:h}=f,p=s.filePos,y=lv.findIndex(v=>v.id===d);if(y!==-1){const v=lv[y].flag;this.currentSegment[v]=!0,Kl(h);let b=this.reader.requestSlice(p,h);b instanceof Promise&&(b=await b),b&&this.readContiguousElements(b)}else if(d===je.Tags||d===je.Attachments){d===je.Tags?this.currentSegment.tagsSeen=!0:this.currentSegment.attachmentsSeen=!0,Kl(h);let v=this.reader.requestSlice(p,h);v instanceof Promise&&(v=await v),v&&this.readContiguousElements(v)}else if(d===je.Cluster){this.currentSegment.clusterSeekStartPos=u;break}if(h===void 0)break;n=p+h}if(this.currentSegment.seekEntries.sort((s,u)=>s.segmentPosition-u.segmentPosition),this.reader.fileSize!==null)for(const s of this.currentSegment.seekEntries){const u=lv.find(v=>v.id===s.id);if(!u||this.currentSegment[u.flag])continue;let f=this.reader.requestSliceRange(e+s.segmentPosition,Pa,Bs);if(f instanceof Promise&&(f=await f),!f)continue;const d=Ds(f);if(!d)continue;const{id:h,size:p}=d;if(h!==u.id)continue;Kl(p),this.currentSegment[u.flag]=!0;let y=this.reader.requestSlice(f.filePos,p);y instanceof Promise&&(y=await y),y&&this.readContiguousElements(y)}this.currentSegment.timestampScale===-1&&(this.currentSegment.timestampScale=1e6,this.currentSegment.timestampFactor=1e9/1e6);for(const s of this.currentSegment.tracks)s.defaultDurationNs!==null&&(s.defaultDuration=this.currentSegment.timestampFactor*s.defaultDurationNs/1e9);this.currentSegment.tracks.sort((s,u)=>Number(u.disposition.default)-Number(s.disposition.default));const i=new Map(this.currentSegment.tracks.map(s=>[s.id,s]));for(const s of this.currentSegment.cuePoints){const u=i.get(s.trackId);u&&u.cuePoints.push(s)}for(const s of this.currentSegment.tracks){s.cuePoints.sort((u,f)=>u.time-f.time);for(let u=0;u<s.cuePoints.length-1;u++){const f=s.cuePoints[u],d=s.cuePoints[u+1];f.time===d.time&&(s.cuePoints.splice(u+1,1),u--)}}let a=null,o=-1/0;for(const s of this.currentSegment.tracks)s.cuePoints.length>o&&(o=s.cuePoints.length,a=s);for(const s of this.currentSegment.tracks)s.cuePoints.length===0&&(s.cuePoints=a.cuePoints);this.currentSegment=null}async readCluster(e,r){if(r.lastReadCluster?.elementStartPos===e)return r.lastReadCluster;let n=this.reader.requestSliceRange(e,Pa,Bs);n instanceof Promise&&(n=await n),pe(n);const i=e,a=Ds(n);pe(a);const o=a.id;pe(o===je.Cluster);let s=a.size;const u=n.filePos;s===void 0&&(s=(await i2(this.reader,u,_g,r.elementEndPos)).pos-u);let f=this.reader.requestSlice(u,s);f instanceof Promise&&(f=await f);const d={segment:r,elementStartPos:i,elementEndPos:u+s,dataStartPos:u,timestamp:-1,trackData:new Map};if(this.currentCluster=d,f){const h=this.readContiguousElements(f,_g);d.elementEndPos=h}for(const[,h]of d.trackData){const p=h.track;pe(h.blocks.length>0);let y=!1;for(let k=0;k<h.blocks.length;k++){const S=h.blocks[k];S.timestamp+=d.timestamp,y||=S.lacing!==As.None}h.presentationTimestamps=h.blocks.map((k,S)=>({timestamp:k.timestamp,blockIndex:S})).sort((k,S)=>k.timestamp-S.timestamp);for(let k=0;k<h.presentationTimestamps.length;k++){const S=h.presentationTimestamps[k],P=h.blocks[S.blockIndex];if(h.firstKeyFrameTimestamp===null&&P.isKeyFrame&&(h.firstKeyFrameTimestamp=P.timestamp),k<h.presentationTimestamps.length-1){const _=h.presentationTimestamps[k+1];P.duration=_.timestamp-P.timestamp}else P.duration===0&&p.defaultDuration!=null&&P.lacing===As.None&&(P.duration=p.defaultDuration)}y&&(this.expandLacedBlocks(h.blocks,p),h.presentationTimestamps=h.blocks.map((k,S)=>({timestamp:k.timestamp,blockIndex:S})).sort((k,S)=>k.timestamp-S.timestamp));const v=h.blocks[h.presentationTimestamps[0].blockIndex],b=h.blocks[ni(h.presentationTimestamps).blockIndex];h.startTimestamp=v.timestamp,h.endTimestamp=b.timestamp+b.duration;const x=or(p.clusterPositionCache,h.startTimestamp,k=>k.startTimestamp);(x===-1||p.clusterPositionCache[x].elementStartPos!==i)&&p.clusterPositionCache.splice(x+1,0,{elementStartPos:d.elementStartPos,startTimestamp:h.startTimestamp})}return r.lastReadCluster=d,d}getTrackDataInCluster(e,r){let n=e.trackData.get(r);if(!n){const i=e.segment.tracks.find(a=>a.id===r);if(!i)return null;n={track:i,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,blocks:[],presentationTimestamps:[]},e.trackData.set(r,n)}return n}expandLacedBlocks(e,r){for(let n=0;n<e.length;n++){const i=e[n];if(i.lacing===As.None)continue;i.decoded||(i.data=this.decodeBlockData(r,i.data),i.decoded=!0);const a=Ks.tempFromBytes(i.data),o=[],s=kt(a)+1;switch(i.lacing){case As.Xiph:{let f=0;for(let d=0;d<s-1;d++){let h=0;for(;a.bufferPos<a.length;){const p=kt(a);if(h+=p,p<255){o.push(h),f+=h;break}}}o.push(a.length-(a.bufferPos+f))}break;case As.FixedSize:{const f=a.length-1,d=Math.floor(f/s);for(let h=0;h<s;h++)o.push(d)}break;case As.Ebml:{const f=Yh(a);pe(f!==null);let d=f;o.push(d);let h=d;for(let p=1;p<s-1;p++){const y=a.bufferPos,v=Yh(a);pe(v!==null);const b=v,k=(1<<(a.bufferPos-y)*7-1)-1,S=b-k;d+=S,o.push(d),h+=d}o.push(a.length-(a.bufferPos+h))}break;default:pe(!1)}pe(o.length===s),e.splice(n,1);const u=i.duration||s*(r.defaultDuration??0);for(let f=0;f<s;f++){const d=o[f],h=It(a,d),p=i.timestamp+u*f/s,y=u/s;e.splice(n+f,0,{timestamp:p,duration:y,isKeyFrame:i.isKeyFrame,data:h,lacing:As.None,decoded:!0,mainAdditional:i.mainAdditional})}n+=s,n--}}async loadSegmentMetadata(e){for(const r of e.seekEntries){if(!(r.id===je.Tags&&!e.tagsSeen)){if(!(r.id===je.Attachments&&!e.attachmentsSeen))continue}let n=this.reader.requestSliceRange(e.dataStartPos+r.segmentPosition,Pa,Bs);if(n instanceof Promise&&(n=await n),!n)continue;const i=Ds(n);if(!i||i.id!==r.id)continue;const{size:a}=i;Kl(a),pe(!this.currentSegment),this.currentSegment=e;let o=this.reader.requestSlice(n.filePos,a);o instanceof Promise&&(o=await o),o&&this.readContiguousElements(o),this.currentSegment=null,r.id===je.Tags?e.tagsSeen=!0:r.id===je.Attachments&&(e.attachmentsSeen=!0)}}readContiguousElements(e,r){for(;e.remainingLength>=Pa;){const n=e.filePos;if(!this.traverseElement(e,r))return n}return e.filePos}traverseElement(e,r){const n=Ds(e);if(!n||r&&r.includes(n.id))return!1;const{id:i,size:a}=n,o=e.filePos;switch(Kl(a),i){case je.DocType:this.isWebM=Gf(e,a)==="webm";break;case je.Seek:{if(!this.currentSegment)break;const s={id:-1,segmentPosition:-1};this.currentSegment.seekEntries.push(s),this.readContiguousElements(e.slice(o,a)),(s.id===-1||s.segmentPosition===-1)&&this.currentSegment.seekEntries.pop()}break;case je.SeekID:{const s=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!s)break;s.id=Vt(e,a)}break;case je.SeekPosition:{const s=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!s)break;s.segmentPosition=Vt(e,a)}break;case je.TimestampScale:{if(!this.currentSegment)break;this.currentSegment.timestampScale=Vt(e,a),this.currentSegment.timestampFactor=1e9/this.currentSegment.timestampScale}break;case je.Duration:{if(!this.currentSegment)break;this.currentSegment.duration=sv(e,a)}break;case je.TrackEntry:{if(!this.currentSegment||(this.currentTrack={id:-1,segment:this.currentSegment,demuxer:this,clusterPositionCache:[],cuePoints:[],disposition:{...Su},inputTrack:null,codecId:null,codecPrivate:null,defaultDuration:null,defaultDurationNs:null,name:null,languageCode:Ia,decodingInstructions:[],info:null},this.readContiguousElements(e.slice(o,a)),!this.currentTrack))break;if(this.currentTrack.decodingInstructions.some(s=>s.data?.type!=="decompress"||s.scope!==Qg.Block||s.data.algorithm!==lp.HeaderStripping)&&(console.warn(`Track #${this.currentTrack.id} has an unsupported content encoding; dropping.`),this.currentTrack=null),this.currentTrack&&this.currentTrack.id!==-1&&this.currentTrack.codecId&&this.currentTrack.info){const s=this.currentTrack.codecId.indexOf("/"),u=s===-1?this.currentTrack.codecId:this.currentTrack.codecId.slice(0,s);if(this.currentTrack.info.type==="video"&&this.currentTrack.info.width!==-1&&this.currentTrack.info.height!==-1){this.currentTrack.codecId===Lo.avc?(this.currentTrack.info.codec="avc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===Lo.hevc?(this.currentTrack.info.codec="hevc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):u===Lo.vp8?this.currentTrack.info.codec="vp8":u===Lo.vp9?this.currentTrack.info.codec="vp9":u===Lo.av1&&(this.currentTrack.info.codec="av1");const f=this.currentTrack,d=new Md(this.input,new UR(f));this.currentTrack.inputTrack=d,this.currentSegment.tracks.push(this.currentTrack)}else if(this.currentTrack.info.type==="audio"&&this.currentTrack.info.numberOfChannels!==-1&&this.currentTrack.info.sampleRate!==-1){u===Lo.aac?(this.currentTrack.info.codec="aac",this.currentTrack.info.aacCodecInfo={isMpeg2:this.currentTrack.codecId.includes("MPEG2"),objectType:null},this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===Lo.mp3?this.currentTrack.info.codec="mp3":u===Lo.opus?(this.currentTrack.info.codec="opus",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate,this.currentTrack.info.sampleRate=T0):u===Lo.vorbis?(this.currentTrack.info.codec="vorbis",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):u===Lo.flac?(this.currentTrack.info.codec="flac",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId==="A_PCM/INT/LIT"?this.currentTrack.info.bitDepth===8?this.currentTrack.info.codec="pcm-u8":this.currentTrack.info.bitDepth===16?this.currentTrack.info.codec="pcm-s16":this.currentTrack.info.bitDepth===24?this.currentTrack.info.codec="pcm-s24":this.currentTrack.info.bitDepth===32&&(this.currentTrack.info.codec="pcm-s32"):this.currentTrack.codecId==="A_PCM/INT/BIG"?this.currentTrack.info.bitDepth===8?this.currentTrack.info.codec="pcm-u8":this.currentTrack.info.bitDepth===16?this.currentTrack.info.codec="pcm-s16be":this.currentTrack.info.bitDepth===24?this.currentTrack.info.codec="pcm-s24be":this.currentTrack.info.bitDepth===32&&(this.currentTrack.info.codec="pcm-s32be"):this.currentTrack.codecId==="A_PCM/FLOAT/IEEE"&&(this.currentTrack.info.bitDepth===32?this.currentTrack.info.codec="pcm-f32":this.currentTrack.info.bitDepth===64&&(this.currentTrack.info.codec="pcm-f64"));const f=this.currentTrack,d=new uo(this.input,new HR(f));this.currentTrack.inputTrack=d,this.currentSegment.tracks.push(this.currentTrack)}}this.currentTrack=null}break;case je.TrackNumber:{if(!this.currentTrack)break;this.currentTrack.id=Vt(e,a)}break;case je.TrackType:{if(!this.currentTrack)break;const s=Vt(e,a);s===1?this.currentTrack.info={type:"video",width:-1,height:-1,rotation:0,codec:null,codecDescription:null,colorSpace:null,alphaMode:!1}:s===2&&(this.currentTrack.info={type:"audio",numberOfChannels:-1,sampleRate:-1,bitDepth:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case je.FlagEnabled:{if(!this.currentTrack)break;Vt(e,a)||(this.currentTrack=null)}break;case je.FlagDefault:{if(!this.currentTrack)break;this.currentTrack.disposition.default=!!Vt(e,a)}break;case je.FlagForced:{if(!this.currentTrack)break;this.currentTrack.disposition.forced=!!Vt(e,a)}break;case je.FlagOriginal:{if(!this.currentTrack)break;this.currentTrack.disposition.original=!!Vt(e,a)}break;case je.FlagHearingImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.hearingImpaired=!!Vt(e,a)}break;case je.FlagVisualImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.visuallyImpaired=!!Vt(e,a)}break;case je.FlagCommentary:{if(!this.currentTrack)break;this.currentTrack.disposition.commentary=!!Vt(e,a)}break;case je.CodecID:{if(!this.currentTrack)break;this.currentTrack.codecId=Gf(e,a)}break;case je.CodecPrivate:{if(!this.currentTrack)break;this.currentTrack.codecPrivate=It(e,a)}break;case je.DefaultDuration:{if(!this.currentTrack)break;this.currentTrack.defaultDurationNs=Vt(e,a)}break;case je.Name:{if(!this.currentTrack)break;this.currentTrack.name=Dh(e,a)}break;case je.Language:{if(!this.currentTrack||this.currentTrack.languageCode!==Ia)break;this.currentTrack.languageCode=Gf(e,a),e8(this.currentTrack.languageCode)||(this.currentTrack.languageCode=Ia)}break;case je.LanguageBCP47:{if(!this.currentTrack)break;const u=Gf(e,a).split("-")[0];u?this.currentTrack.languageCode=u:this.currentTrack.languageCode=Ia}break;case je.Video:{if(this.currentTrack?.info?.type!=="video")break;this.readContiguousElements(e.slice(o,a))}break;case je.PixelWidth:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.width=Vt(e,a)}break;case je.PixelHeight:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.height=Vt(e,a)}break;case je.AlphaMode:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.alphaMode=Vt(e,a)===1}break;case je.Colour:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.colorSpace={},this.readContiguousElements(e.slice(o,a))}break;case je.MatrixCoefficients:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=Vt(e,a),u=Xg[s]??null;this.currentTrack.info.colorSpace.matrix=u}break;case je.Range:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;this.currentTrack.info.colorSpace.fullRange=Vt(e,a)===2}break;case je.TransferCharacteristics:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=Vt(e,a),u=Gg[s]??null;this.currentTrack.info.colorSpace.transfer=u}break;case je.Primaries:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=Vt(e,a),u=Wg[s]??null;this.currentTrack.info.colorSpace.primaries=u}break;case je.Projection:{if(this.currentTrack?.info?.type!=="video")break;this.readContiguousElements(e.slice(o,a))}break;case je.ProjectionPoseRoll:{if(this.currentTrack?.info?.type!=="video")break;const u=-sv(e,a);try{this.currentTrack.info.rotation=Kk(u)}catch{}}break;case je.Audio:{if(this.currentTrack?.info?.type!=="audio")break;this.readContiguousElements(e.slice(o,a))}break;case je.SamplingFrequency:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.sampleRate=sv(e,a)}break;case je.Channels:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.numberOfChannels=Vt(e,a)}break;case je.BitDepth:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.bitDepth=Vt(e,a)}break;case je.CuePoint:{if(!this.currentSegment)break;this.readContiguousElements(e.slice(o,a)),this.currentCueTime=null}break;case je.CueTime:this.currentCueTime=Vt(e,a);break;case je.CueTrackPositions:{if(this.currentCueTime===null)break;pe(this.currentSegment);const s={time:this.currentCueTime,trackId:-1,clusterPosition:-1};this.currentSegment.cuePoints.push(s),this.readContiguousElements(e.slice(o,a)),(s.trackId===-1||s.clusterPosition===-1)&&this.currentSegment.cuePoints.pop()}break;case je.CueTrack:{const s=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!s)break;s.trackId=Vt(e,a)}break;case je.CueClusterPosition:{const s=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!s)break;pe(this.currentSegment),s.clusterPosition=this.currentSegment.dataStartPos+Vt(e,a)}break;case je.Timestamp:{if(!this.currentCluster)break;this.currentCluster.timestamp=Vt(e,a)}break;case je.SimpleBlock:{if(!this.currentCluster)break;const s=Yh(e);if(s===null)break;const u=this.getTrackDataInCluster(this.currentCluster,s);if(!u)break;const f=l2(e),d=kt(e),h=d>>1&3;let p=!!(d&128);u.track.info?.type==="audio"&&u.track.info.codec&&(p=!0);const y=It(e,a-(e.filePos-o)),v=u.track.decodingInstructions.length>0;u.blocks.push({timestamp:f,duration:0,isKeyFrame:p,data:y,lacing:h,decoded:!v,mainAdditional:null})}break;case je.BlockGroup:{if(!this.currentCluster)break;this.readContiguousElements(e.slice(o,a)),this.currentBlock=null}break;case je.Block:{if(!this.currentCluster)break;const s=Yh(e);if(s===null)break;const u=this.getTrackDataInCluster(this.currentCluster,s);if(!u)break;const f=l2(e),h=kt(e)>>1&3,p=It(e,a-(e.filePos-o)),y=u.track.decodingInstructions.length>0;this.currentBlock={timestamp:f,duration:0,isKeyFrame:!0,data:p,lacing:h,decoded:!y,mainAdditional:null},u.blocks.push(this.currentBlock)}break;case je.BlockAdditions:this.readContiguousElements(e.slice(o,a));break;case je.BlockMore:{if(!this.currentBlock)break;this.currentBlockAdditional={addId:1,data:null},this.readContiguousElements(e.slice(o,a)),this.currentBlockAdditional.data&&this.currentBlockAdditional.addId===1&&(this.currentBlock.mainAdditional=this.currentBlockAdditional.data),this.currentBlockAdditional=null}break;case je.BlockAdditional:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.data=It(e,a)}break;case je.BlockAddID:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.addId=Vt(e,a)}break;case je.BlockDuration:{if(!this.currentBlock)break;this.currentBlock.duration=Vt(e,a)}break;case je.ReferenceBlock:{if(!this.currentBlock)break;this.currentBlock.isKeyFrame=!1}break;case je.Tag:this.currentTagTargetIsMovie=!0,this.readContiguousElements(e.slice(o,a));break;case je.Targets:this.readContiguousElements(e.slice(o,a));break;case je.TargetTypeValue:Vt(e,a)!==50&&(this.currentTagTargetIsMovie=!1);break;case je.TagTrackUID:case je.TagEditionUID:case je.TagChapterUID:case je.TagAttachmentUID:this.currentTagTargetIsMovie=!1;break;case je.SimpleTag:{if(!this.currentTagTargetIsMovie)break;this.currentSimpleTagName=null,this.readContiguousElements(e.slice(o,a))}break;case je.TagName:this.currentSimpleTagName=Dh(e,a);break;case je.TagString:{if(!this.currentSimpleTagName)break;const s=Dh(e,a);this.processTagValue(this.currentSimpleTagName,s)}break;case je.TagBinary:{if(!this.currentSimpleTagName)break;const s=It(e,a);this.processTagValue(this.currentSimpleTagName,s)}break;case je.AttachedFile:{if(!this.currentSegment)break;this.currentAttachedFile={fileUid:null,fileName:null,fileMediaType:null,fileData:null,fileDescription:null},this.readContiguousElements(e.slice(o,a));const s=this.currentSegment.metadataTags;if(this.currentAttachedFile.fileUid&&this.currentAttachedFile.fileData&&(s.raw??={},s.raw[this.currentAttachedFile.fileUid.toString()]=new i8(this.currentAttachedFile.fileData,this.currentAttachedFile.fileMediaType??void 0,this.currentAttachedFile.fileName??void 0,this.currentAttachedFile.fileDescription??void 0)),this.currentAttachedFile.fileMediaType?.startsWith("image/")&&this.currentAttachedFile.fileData){const u=this.currentAttachedFile.fileName;let f="unknown";if(u){const d=u.toLowerCase();d.startsWith("cover.")?f="coverFront":d.startsWith("back.")&&(f="coverBack")}s.images??=[],s.images.push({data:this.currentAttachedFile.fileData,mimeType:this.currentAttachedFile.fileMediaType,kind:f,name:this.currentAttachedFile.fileName??void 0,description:this.currentAttachedFile.fileDescription??void 0})}this.currentAttachedFile=null}break;case je.FileUID:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileUid=BR(e,a)}break;case je.FileName:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileName=Dh(e,a)}break;case je.FileMediaType:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileMediaType=Gf(e,a)}break;case je.FileData:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileData=It(e,a)}break;case je.FileDescription:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileDescription=Dh(e,a)}break;case je.ContentEncodings:{if(!this.currentTrack)break;this.readContiguousElements(e.slice(o,a)),this.currentTrack.decodingInstructions.sort((s,u)=>u.order-s.order)}break;case je.ContentEncoding:this.currentDecodingInstruction={order:0,scope:Qg.Block,data:null},this.readContiguousElements(e.slice(o,a)),this.currentDecodingInstruction.data&&this.currentTrack.decodingInstructions.push(this.currentDecodingInstruction),this.currentDecodingInstruction=null;break;case je.ContentEncodingOrder:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.order=Vt(e,a)}break;case je.ContentEncodingScope:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.scope=Vt(e,a)}break;case je.ContentCompression:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decompress",algorithm:lp.Zlib,settings:null},this.readContiguousElements(e.slice(o,a))}break;case je.ContentCompAlgo:{if(this.currentDecodingInstruction?.data?.type!=="decompress")break;this.currentDecodingInstruction.data.algorithm=Vt(e,a)}break;case je.ContentCompSettings:{if(this.currentDecodingInstruction?.data?.type!=="decompress")break;this.currentDecodingInstruction.data.settings=It(e,a)}break;case je.ContentEncryption:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decrypt"}}break}return e.filePos=o+a,!0}decodeBlockData(e,r){pe(e.decodingInstructions.length>0);let n=r;for(const i of e.decodingInstructions)switch(pe(i.data),i.data.type){case"decompress":switch(i.data.algorithm){case lp.HeaderStripping:if(i.data.settings&&i.data.settings.length>0){const a=i.data.settings,o=new Uint8Array(a.length+n.length);o.set(a,0),o.set(n,a.length),n=o}break}break}return n}processTagValue(e,r){if(!this.currentSegment?.metadataTags)return;const n=this.currentSegment.metadataTags;if(n.raw??={},n.raw[e]??=r,typeof r=="string")switch(e.toLowerCase()){case"title":n.title??=r;break;case"description":n.description??=r;break;case"artist":n.artist??=r;break;case"album":n.album??=r;break;case"album_artist":n.albumArtist??=r;break;case"genre":n.genre??=r;break;case"comment":n.comment??=r;break;case"lyrics":n.lyrics??=r;break;case"date":{const i=new Date(r);Number.isNaN(i.getTime())||(n.date??=i)}break;case"track_number":case"part_number":{const i=r.split("/"),a=Number.parseInt(i[0],10),o=i[1]&&Number.parseInt(i[1],10);Number.isInteger(a)&&a>0&&(n.trackNumber??=a),o&&Number.isInteger(o)&&o>0&&(n.tracksTotal??=o)}break;case"disc_number":case"disc":{const i=r.split("/"),a=Number.parseInt(i[0],10),o=i[1]&&Number.parseInt(i[1],10);Number.isInteger(a)&&a>0&&(n.discNumber??=a),o&&Number.isInteger(o)&&o>0&&(n.discsTotal??=o)}break}}}class A8{constructor(e){this.internalTrack=e,this.packetToClusterLocation=new WeakMap}getId(){return this.internalTrack.id}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.codecId}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}async getFirstTimestamp(){return(await this.getFirstPacket({metadataOnly:!0}))?.timestamp??0}getTimeResolution(){return this.internalTrack.segment.timestampFactor}getDisposition(){return this.internalTrack.disposition}async getFirstPacket(e){return this.performClusterLookup(null,r=>r.trackData.get(this.internalTrack.id)?{blockIndex:0,correctBlockFound:!0}:{blockIndex:-1,correctBlockFound:!1},-1/0,1/0,e)}intoTimescale(e){return Pp(e*this.internalTrack.segment.timestampFactor)}async getPacket(e,r){const n=this.intoTimescale(e);return this.performClusterLookup(null,i=>{const a=i.trackData.get(this.internalTrack.id);if(!a)return{blockIndex:-1,correctBlockFound:!1};const o=or(a.presentationTimestamps,n,f=>f.timestamp),s=o!==-1?a.presentationTimestamps[o].blockIndex:-1,u=o!==-1&&n<a.endTimestamp;return{blockIndex:s,correctBlockFound:u}},n,n,r)}async getNextPacket(e,r){const n=this.packetToClusterLocation.get(e);if(n===void 0)throw new Error("Packet was not created from this track.");return this.performClusterLookup(n.cluster,i=>{if(i===n.cluster){const a=i.trackData.get(this.internalTrack.id);if(n.blockIndex+1<a.blocks.length)return{blockIndex:n.blockIndex+1,correctBlockFound:!0}}else if(i.trackData.get(this.internalTrack.id))return{blockIndex:0,correctBlockFound:!0};return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,r)}async getKeyPacket(e,r){const n=this.intoTimescale(e);return this.performClusterLookup(null,i=>{const a=i.trackData.get(this.internalTrack.id);if(!a)return{blockIndex:-1,correctBlockFound:!1};const o=Q2(a.presentationTimestamps,f=>a.blocks[f.blockIndex].isKeyFrame&&f.timestamp<=n),s=o!==-1?a.presentationTimestamps[o].blockIndex:-1,u=o!==-1&&n<a.endTimestamp;return{blockIndex:s,correctBlockFound:u}},n,n,r)}async getNextKeyPacket(e,r){const n=this.packetToClusterLocation.get(e);if(n===void 0)throw new Error("Packet was not created from this track.");return this.performClusterLookup(n.cluster,i=>{if(i===n.cluster){const o=i.trackData.get(this.internalTrack.id).blocks.findIndex((s,u)=>s.isKeyFrame&&u>n.blockIndex);if(o!==-1)return{blockIndex:o,correctBlockFound:!0}}else{const a=i.trackData.get(this.internalTrack.id);if(a&&a.firstKeyFrameTimestamp!==null){const o=a.blocks.findIndex(s=>s.isKeyFrame);return pe(o!==-1),{blockIndex:o,correctBlockFound:!0}}}return{blockIndex:-1,correctBlockFound:!1}},-1/0,1/0,r)}async fetchPacketInCluster(e,r,n){if(r===-1)return null;const a=e.trackData.get(this.internalTrack.id).blocks[r];pe(a),a.decoded||(a.data=this.internalTrack.demuxer.decodeBlockData(this.internalTrack,a.data),a.decoded=!0);const o=n.metadataOnly?la:a.data,s=a.timestamp/this.internalTrack.segment.timestampFactor,u=a.duration/this.internalTrack.segment.timestampFactor,f={};a.mainAdditional&&this.internalTrack.info?.type==="video"&&this.internalTrack.info.alphaMode&&(f.alpha=n.metadataOnly?la:a.mainAdditional,f.alphaByteLength=a.mainAdditional.byteLength);const d=new xn(o,a.isKeyFrame?"key":"delta",s,u,e.dataStartPos+r,a.data.byteLength,f);return this.packetToClusterLocation.set(d,{cluster:e,blockIndex:r}),d}async performClusterLookup(e,r,n,i,a){const{demuxer:o,segment:s}=this.internalTrack;let u=null,f=null,d=-1;if(e){const{blockIndex:k,correctBlockFound:S}=r(e);if(S)return this.fetchPacketInCluster(e,k,a);k!==-1&&(f=e,d=k)}const h=or(this.internalTrack.cuePoints,n,k=>k.time),p=h!==-1?this.internalTrack.cuePoints[h]:null,y=or(this.internalTrack.clusterPositionCache,n,k=>k.startTimestamp),v=y!==-1?this.internalTrack.clusterPositionCache[y]:null,b=Math.max(p?.clusterPosition??0,v?.elementStartPos??0)||null;let x;for(e?b===null||e.elementStartPos>=b?(x=e.elementEndPos,u=e):x=b:x=b??s.clusterSeekStartPos;s.elementEndPos===null||x<=s.elementEndPos-Pa;){if(u){const I=u.trackData.get(this.internalTrack.id);if(I&&I.startTimestamp>i)break}let k=o.reader.requestSliceRange(x,Pa,Bs);if(k instanceof Promise&&(k=await k),!k)break;const S=x,P=Ds(k);if(!P||!Cp.includes(P.id)&&P.id!==je.Void){const I=await C8(o.reader,S,Cp,Math.min(s.elementEndPos??1/0,S+O8));if(I){x=I;continue}else break}const _=P.id;let E=P.size;const A=k.filePos;if(_===je.Cluster){u=await o.readCluster(S,s),E=u.elementEndPos-A;const{blockIndex:I,correctBlockFound:L}=r(u);if(L)return this.fetchPacketInCluster(u,I,a);I!==-1&&(f=u,d=I)}E===void 0&&(pe(_!==je.Cluster),E=(await i2(o.reader,A,_g,s.elementEndPos)).pos-A);const T=A+E;if(s.elementEndPos===null){let I=o.reader.requestSliceRange(T,Pa,Bs);if(I instanceof Promise&&(I=await I),!I)break;if(ab(I)===je.Segment){s.elementEndPos=T;break}}x=T}if(p&&(!f||f.elementStartPos<p.clusterPosition)){const k=this.internalTrack.cuePoints[h-1];pe(!k||k.time<p.time);const S=k?.time??-1/0;return this.performClusterLookup(null,r,S,i,a)}return f?this.fetchPacketInCluster(f,d,a):null}}class UR extends A8{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getRotation(){return this.internalTrack.info.rotation}async getColorSpace(){return{primaries:this.internalTrack.info.colorSpace?.primaries,transfer:this.internalTrack.info.colorSpace?.transfer,matrix:this.internalTrack.info.colorSpace?.matrix,fullRange:this.internalTrack.info.colorSpace?.fullRange}}async canBeTransparent(){return this.internalTrack.info.alphaMode}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfigPromise??=(async()=>{let e=null;return(this.internalTrack.info.codec==="vp9"||this.internalTrack.info.codec==="av1"||this.internalTrack.info.codec==="avc"&&!this.internalTrack.info.codecDescription||this.internalTrack.info.codec==="hevc"&&!this.internalTrack.info.codecDescription)&&(e=await this.getFirstPacket({})),{codec:Z2({width:this.internalTrack.info.width,height:this.internalTrack.info.height,codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,colorSpace:this.internalTrack.info.colorSpace,avcType:1,avcCodecInfo:this.internalTrack.info.codec==="avc"&&e?c8(e.data):null,hevcCodecInfo:this.internalTrack.info.codec==="hevc"&&e?h8(e.data):null,vp9CodecInfo:this.internalTrack.info.codec==="vp9"&&e?p8(e.data):null,av1CodecInfo:this.internalTrack.info.codec==="av1"&&e?g8(e.data):null}),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,description:this.internalTrack.info.codecDescription??void 0,colorSpace:this.internalTrack.info.colorSpace??void 0}})():null}}class HR extends A8{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){return this.internalTrack.info.codec?this.decoderConfig??={codec:J2({codec:this.internalTrack.info.codec,codecDescription:this.internalTrack.info.codecDescription,aacCodecInfo:this.internalTrack.info.aacCodecInfo}),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}:null}}const up=4,$R=[44100,48e3,32e3],qR=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1,-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1,-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1,-1,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],VR=1483304551,WR=1231971951,GR=(t,e,r,n,i)=>e===0?0:e===1?Math.floor(144*r/(n<<t))+i:e===2?Math.floor(144*r/n)+i:(Math.floor(12*r/n)+i)*4,XR=(t,e)=>t===3?e===3?21:36:e===3?13:21,ob=(t,e)=>{const r=t>>>24,n=t>>>16&255,i=t>>>8&255,a=t&255;if(r!==255&&n!==255&&i!==255&&a!==255)return{header:null,bytesAdvanced:4};if(r!==255)return{header:null,bytesAdvanced:1};if((n&224)!==224)return{header:null,bytesAdvanced:1};let o=0,s=0;n&16?o=n&8?0:1:(o=1,s=1);const u=n>>3&3,f=n>>1&3,d=i>>4&15,h=(i>>2&3)%3,p=i>>1&1,y=a>>6&3,v=a>>4&3,b=a>>3&1,x=a>>2&1,k=a&3,S=qR[o*16*4+f*16+d];if(S===-1)return{header:null,bytesAdvanced:1};const P=S*1e3,_=$R[h]>>o+s,E=GR(o,f,P,_,p);if(e!==null&&e<E)return{header:null,bytesAdvanced:1};let A;return u===3?A=f===3?384:1152:f===3?A=384:f===2?A=1152:A=576,{header:{totalSize:E,mpegVersionId:u,layer:f,bitrate:P,frequencyIndex:h,sampleRate:_,channel:y,modeExtension:v,copyright:b,original:x,emphasis:k,audioSamplesInFrame:A},bytesAdvanced:1}},a2=t=>{let e=2130706432,r=0;for(;e!==0;)r>>=1,r|=t&e,e>>=8;return r};var nd;(function(t){t[t.Unsynchronisation=128]="Unsynchronisation",t[t.ExtendedHeader=64]="ExtendedHeader",t[t.ExperimentalIndicator=32]="ExperimentalIndicator",t[t.Footer=16]="Footer"})(nd||(nd={}));var id;(function(t){t[t.ISO_8859_1=0]="ISO_8859_1",t[t.UTF_16_WITH_BOM=1]="UTF_16_WITH_BOM",t[t.UTF_16_BE_NO_BOM=2]="UTF_16_BE_NO_BOM",t[t.UTF_8=3]="UTF_8"})(id||(id={}));const Pg=128,Zg=10,ad=["Blues","Classic rock","Country","Dance","Disco","Funk","Grunge","Hip-hop","Jazz","Metal","New age","Oldies","Other","Pop","Rhythm and blues","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death metal","Pranks","Soundtrack","Euro-techno","Ambient","Trip-hop","Vocal","Jazz & funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound clip","Gospel","Noise","Alternative rock","Bass","Soul","Punk","Space","Meditative","Instrumental pop","Instrumental rock","Ethnic","Gothic","Darkwave","Techno-industrial","Electronic","Pop-folk","Eurodance","Dream","Southern rock","Comedy","Cult","Gangsta","Top 40","Christian rap","Pop/funk","Jungle music","Native US","Cabaret","New wave","Psychedelic","Rave","Showtunes","Trailer","Lo-fi","Tribal","Acid punk","Acid jazz","Polka","Retro","Musical","Rock 'n' roll","Hard rock","Folk","Folk rock","National folk","Swing","Fast fusion","Bebop","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic rock","Progressive rock","Psychedelic rock","Symphonic rock","Slow rock","Big band","Chorus","Easy listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber music","Sonata","Symphony","Booty bass","Primus","Porn groove","Satire","Slow jam","Club","Tango","Samba","Folklore","Ballad","Power ballad","Rhythmic Soul","Freestyle","Duet","Punk rock","Drum solo","A cappella","Euro-house","Dance hall","Goa music","Drum & bass","Club-house","Hardcore techno","Terror","Indie","Britpop","Negerpunk","Polsk punk","Beat","Christian gangsta rap","Heavy metal","Black metal","Crossover","Contemporary Christian","Christian rock","Merengue","Salsa","Thrash metal","Anime","Jpop","Synthpop","Christmas","Art rock","Baroque","Bhangra","Big beat","Breakbeat","Chillout","Downtempo","Dub","EBM","Eclectic","Electro","Electroclash","Emo","Experimental","Garage","Global","IDM","Illbient","Industro-Goth","Jam Band","Krautrock","Leftfield","Lounge","Math rock","New romantic","Nu-breakz","Post-punk","Post-rock","Psytrance","Shoegaze","Space rock","Trop rock","World music","Neoclassical","Audiobook","Audio theatre","Neue Deutsche Welle","Podcast","Indie rock","G-Funk","Dubstep","Garage rock","Psybient"],YR=(t,e)=>{const r=t.filePos;e.raw??={},e.raw.TAG??=It(t,Pg-3),t.filePos=r;const n=Uf(t,30);n&&(e.title??=n);const i=Uf(t,30);i&&(e.artist??=i);const a=Uf(t,30);a&&(e.album??=a);const o=Uf(t,4),s=Number.parseInt(o,10);Number.isInteger(s)&&s>0&&(e.date??=new Date(s,0,1));const u=It(t,30);let f;if(u[28]===0&&u[29]!==0){const h=u[29];h>0&&(e.trackNumber??=h),t.skip(-30),f=Uf(t,28),t.skip(2)}else t.skip(-30),f=Uf(t,30);f&&(e.comment??=f);const d=kt(t);d<ad.length&&(e.genre??=ad[d])},Uf=(t,e)=>{const r=It(t,e),n=Vf(r.indexOf(0),r.length),i=r.subarray(0,n);let a="";for(let o=0;o<i.length;o++)a+=String.fromCharCode(i[o]);return a.trimEnd()},Jg=t=>{const e=t.filePos,r=Vn(t,3),n=kt(t),i=kt(t),a=kt(t),o=it(t);if(r!=="ID3"||n===255||i===255||(o&2155905152)!==0)return t.filePos=e,null;const s=a2(o);return{majorVersion:n,revision:i,flags:a,size:s}},I8=(t,e,r)=>{if(![2,3,4].includes(e.majorVersion)){console.warn(`Unsupported ID3v2 major version: ${e.majorVersion}`);return}const n=It(t,e.size),i=new KR(e,n);if(e.flags&nd.Footer&&i.removeFooter(),e.flags&nd.Unsynchronisation&&e.majorVersion===3&&i.ununsynchronizeAll(),e.flags&nd.ExtendedHeader){const a=i.readU32();e.majorVersion===3?i.pos+=a:i.pos+=a-4}for(;i.pos<=i.bytes.length-i.frameHeaderSize();){const a=i.readId3V2Frame();if(!a)break;const o=i.pos,s=i.pos+a.size;let u=!1,f=!1,d=!1;if(e.majorVersion===3?(u=!!(a.flags&64),f=!!(a.flags&128)):e.majorVersion===4&&(u=!!(a.flags&4),f=!!(a.flags&8),d=!!(a.flags&2)||!!(e.flags&nd.Unsynchronisation)),u){console.warn(`Skipping encrypted ID3v2 frame ${a.id}`),i.pos=s;continue}if(f){console.warn(`Skipping compressed ID3v2 frame ${a.id}`),i.pos=s;continue}switch(d&&i.ununsynchronizeRegion(i.pos,s),r.raw??={},a.id[0]==="T"?r.raw[a.id]??=i.readId3V2EncodingAndText(s):r.raw[a.id]??=i.readBytes(a.size),i.pos=o,a.id){case"TIT2":case"TT2":r.title??=i.readId3V2EncodingAndText(s);break;case"TIT3":case"TT3":r.description??=i.readId3V2EncodingAndText(s);break;case"TPE1":case"TP1":r.artist??=i.readId3V2EncodingAndText(s);break;case"TALB":case"TAL":r.album??=i.readId3V2EncodingAndText(s);break;case"TPE2":case"TP2":r.albumArtist??=i.readId3V2EncodingAndText(s);break;case"TRCK":case"TRK":{const p=i.readId3V2EncodingAndText(s).split("/"),y=Number.parseInt(p[0],10),v=p[1]&&Number.parseInt(p[1],10);Number.isInteger(y)&&y>0&&(r.trackNumber??=y),v&&Number.isInteger(v)&&v>0&&(r.tracksTotal??=v)}break;case"TPOS":case"TPA":{const p=i.readId3V2EncodingAndText(s).split("/"),y=Number.parseInt(p[0],10),v=p[1]&&Number.parseInt(p[1],10);Number.isInteger(y)&&y>0&&(r.discNumber??=y),v&&Number.isInteger(v)&&v>0&&(r.discsTotal??=v)}break;case"TCON":case"TCO":{const h=i.readId3V2EncodingAndText(s);let p=/^\((\d+)\)/.exec(h);if(p){const y=Number.parseInt(p[1]);if(ad[y]!==void 0){r.genre??=ad[y];break}}if(p=/^\d+$/.exec(h),p){const y=Number.parseInt(p[0]);if(ad[y]!==void 0){r.genre??=ad[y];break}}r.genre??=h}break;case"TDRC":case"TDAT":{const h=i.readId3V2EncodingAndText(s),p=new Date(h);Number.isNaN(p.getTime())||(r.date??=p)}break;case"TYER":case"TYE":{const h=i.readId3V2EncodingAndText(s),p=Number.parseInt(h,10);Number.isInteger(p)&&(r.date??=new Date(p,0,1))}break;case"USLT":case"ULT":{const h=i.readU8();i.pos+=3,i.readId3V2Text(h,s),r.lyrics??=i.readId3V2Text(h,s)}break;case"COMM":case"COM":{const h=i.readU8();i.pos+=3,i.readId3V2Text(h,s),r.comment??=i.readId3V2Text(h,s)}break;case"APIC":case"PIC":{const h=i.readId3V2TextEncoding();let p;if(e.majorVersion===2){const x=i.readAscii(3);p=x==="PNG"?"image/png":x==="JPG"?"image/jpeg":"image/*"}else p=i.readId3V2Text(h,s);const y=i.readU8(),v=i.readId3V2Text(h,s).trimEnd(),b=s-i.pos;if(b>=0){const x=i.readBytes(b);r.images||(r.images=[]),r.images.push({data:x,mimeType:p,kind:y===3?"coverFront":y===4?"coverBack":"unknown",description:v})}}break;default:i.pos+=a.size;break}i.pos=s}};class KR{constructor(e,r){this.header=e,this.bytes=r,this.pos=0,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength)}frameHeaderSize(){return this.header.majorVersion===2?6:10}ununsynchronizeAll(){const e=[];for(let r=0;r<this.bytes.length;r++){const n=this.bytes[r];e.push(n),n===255&&r!==this.bytes.length-1&&this.bytes[r]===0&&r++}this.bytes=new Uint8Array(e),this.view=new DataView(this.bytes.buffer)}ununsynchronizeRegion(e,r){const n=[];for(let o=e;o<r;o++){const s=this.bytes[o];n.push(s),s===255&&o!==r-1&&this.bytes[o+1]===0&&o++}const i=this.bytes.subarray(0,e),a=this.bytes.subarray(r);this.bytes=new Uint8Array(i.length+n.length+a.length),this.bytes.set(i,0),this.bytes.set(n,i.length),this.bytes.set(a,i.length+n.length),this.view=new DataView(this.bytes.buffer)}removeFooter(){this.bytes=this.bytes.subarray(0,this.bytes.length-Zg),this.view=new DataView(this.bytes.buffer)}readBytes(e){const r=this.bytes.subarray(this.pos,this.pos+e);return this.pos+=e,r}readU8(){const e=this.view.getUint8(this.pos);return this.pos+=1,e}readU16(){const e=this.view.getUint16(this.pos,!1);return this.pos+=2,e}readU24(){const e=this.view.getUint16(this.pos,!1),r=this.view.getUint8(this.pos+1);return this.pos+=3,e*256+r}readU32(){const e=this.view.getUint32(this.pos,!1);return this.pos+=4,e}readAscii(e){let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(this.view.getUint8(this.pos+n));return this.pos+=e,r}readId3V2Frame(){if(this.header.majorVersion===2){const e=this.readAscii(3);if(e==="\0\0\0")return null;const r=this.readU24();return{id:e,size:r,flags:0}}else{const e=this.readAscii(4);if(e==="\0\0\0\0")return null;const r=this.readU32();let n=this.header.majorVersion===4?a2(r):r;const i=this.readU16(),a=this.pos,o=s=>{const u=this.pos+s;if(u>this.bytes.length)return!1;if(u<=this.bytes.length-this.frameHeaderSize()){this.pos+=s;const f=this.readAscii(4);if(f!=="\0\0\0\0"&&!/[0-9A-Z]{4}/.test(f))return!1}return!0};if(!o(n)){const s=this.header.majorVersion===4?r:a2(r);o(s)&&(n=s)}return this.pos=a,{id:e,size:n,flags:i}}}readId3V2TextEncoding(){const e=this.readU8();if(e>3)throw new Error(`Unsupported text encoding: ${e}`);return e}readId3V2Text(e,r){const n=this.pos,i=this.readBytes(r-this.pos);switch(e){case id.ISO_8859_1:{let a="";for(let o=0;o<i.length;o++){const s=i[o];if(s===0){this.pos=n+o+1;break}a+=String.fromCharCode(s)}return a}case id.UTF_16_WITH_BOM:if(i[0]===255&&i[1]===254){const a=new TextDecoder("utf-16le"),o=Vf(i.findIndex((s,u)=>s===0&&i[u+1]===0&&u%2===0),i.length);return this.pos=n+Math.min(o+2,i.length),a.decode(i.subarray(2,o))}else if(i[0]===254&&i[1]===255){const a=new TextDecoder("utf-16be"),o=Vf(i.findIndex((s,u)=>s===0&&i[u+1]===0&&u%2===0),i.length);return this.pos=n+Math.min(o+2,i.length),a.decode(i.subarray(2,o))}else{const a=Vf(i.findIndex(o=>o===0),i.length);return this.pos=n+Math.min(a+1,i.length),Ra.decode(i.subarray(0,a))}case id.UTF_16_BE_NO_BOM:{const a=new TextDecoder("utf-16be"),o=Vf(i.findIndex((s,u)=>s===0&&i[u+1]===0&&u%2===0),i.length);return this.pos=n+Math.min(o+2,i.length),a.decode(i.subarray(0,o))}case id.UTF_8:{const a=Vf(i.findIndex(o=>o===0),i.length);return this.pos=n+Math.min(a+1,i.length),Ra.decode(i.subarray(0,a))}}}readId3V2EncodingAndText(e){if(this.pos>=e)return"";const r=this.readId3V2TextEncoding();return this.readId3V2Text(r,e)}}const o2=async(t,e,r)=>{let n=e;for(;r===null||n<r;){let i=t.requestSlice(n,up);if(i instanceof Promise&&(i=await i),!i)break;const a=it(i),o=ob(a,t.fileSize!==null?t.fileSize-n:null);if(o.header)return{header:o.header,startPos:n};n+=o.bytesAdvanced}return null};class QR extends ku{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.metadataTags=null,this.tracks=[],this.readingMutex=new Up,this.lastSampleLoaded=!1,this.lastLoadedPos=0,this.nextTimestampInSamples=0,this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{for(;!this.firstFrameHeader&&!this.lastSampleLoaded;)await this.advanceReader();if(!this.firstFrameHeader)throw new Error("No valid MP3 frame found.");this.tracks=[new uo(this.input,new ZR(this))]})()}async advanceReader(){if(this.lastLoadedPos===0)for(;;){let s=this.reader.requestSlice(this.lastLoadedPos,Zg);if(s instanceof Promise&&(s=await s),!s){this.lastSampleLoaded=!0;return}const u=Jg(s);if(!u)break;this.lastLoadedPos=s.filePos+u.size}const e=await o2(this.reader,this.lastLoadedPos,this.reader.fileSize);if(!e){this.lastSampleLoaded=!0;return}const r=e.header;this.lastLoadedPos=e.startPos+r.totalSize-1;const n=XR(r.mpegVersionId,r.channel);let i=this.reader.requestSlice(e.startPos+n,4);if(i instanceof Promise&&(i=await i),i){const s=it(i);if(s===VR||s===WR)return}this.firstFrameHeader||(this.firstFrameHeader=r),r.sampleRate!==this.firstFrameHeader.sampleRate&&console.warn(`MP3 changed sample rate mid-file: ${this.firstFrameHeader.sampleRate} Hz to ${r.sampleRate} Hz. Might be a bug, so please report this file.`);const a=r.audioSamplesInFrame/this.firstFrameHeader.sampleRate,o={timestamp:this.nextTimestampInSamples/this.firstFrameHeader.sampleRate,duration:a,dataStart:e.startPos,dataSize:r.totalSize};this.loadedSamples.push(o),this.nextTimestampInSamples+=r.audioSamplesInFrame}async getMimeType(){return"audio/mpeg"}async getTracks(){return await this.readMetadata(),this.tracks}async computeDuration(){await this.readMetadata();const e=this.tracks[0];return pe(e),e.computeDuration()}async getMetadataTags(){const e=await this.readingMutex.acquire();try{if(await this.readMetadata(),this.metadataTags)return this.metadataTags;this.metadataTags={};let r=0,n=!1;for(;;){let i=this.reader.requestSlice(r,Zg);if(i instanceof Promise&&(i=await i),!i)break;const a=Jg(i);if(!a)break;n=!0;let o=this.reader.requestSlice(i.filePos,a.size);if(o instanceof Promise&&(o=await o),!o)break;I8(o,a,this.metadataTags),r=i.filePos+a.size}if(!n&&this.reader.fileSize!==null&&this.reader.fileSize>=Pg){let i=this.reader.requestSlice(this.reader.fileSize-Pg,Pg);i instanceof Promise&&(i=await i),pe(i),Vn(i,3)==="TAG"&&YR(i,this.metadataTags)}return this.metadataTags}finally{e()}}}class ZR{constructor(e){this.demuxer=e}getId(){return 1}async getFirstTimestamp(){return 0}getTimeResolution(){return pe(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate/this.demuxer.firstFrameHeader.audioSamplesInFrame}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return null}getLanguageCode(){return Ia}getCodec(){return"mp3"}getInternalCodecId(){return null}getNumberOfChannels(){return pe(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.channel===3?1:2}getSampleRate(){return pe(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.sampleRate}getDisposition(){return{...Su}}async getDecoderConfig(){return pe(this.demuxer.firstFrameHeader),{codec:"mp3",numberOfChannels:this.demuxer.firstFrameHeader.channel===3?1:2,sampleRate:this.demuxer.firstFrameHeader.sampleRate}}async getPacketAtIndex(e,r){if(e===-1)return null;const n=this.demuxer.loadedSamples[e];if(!n)return null;let i;if(r.metadataOnly)i=la;else{let a=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(a instanceof Promise&&(a=await a),!a)return null;i=It(a,n.dataSize)}return new xn(i,"key",n.timestamp,n.duration,e,n.dataSize)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getNextPacket(e,r){const n=await this.demuxer.readingMutex.acquire();try{const i=Hp(this.demuxer.loadedSamples,e.timestamp,o=>o.timestamp);if(i===-1)throw new Error("Packet was not created from this track.");const a=i+1;for(;a>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(a,r)}finally{n()}}async getPacket(e,r){const n=await this.demuxer.readingMutex.acquire();try{for(;;){const i=or(this.demuxer.loadedSamples,e,a=>a.timestamp);if(i===-1&&this.demuxer.loadedSamples.length>0)return null;if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(i,r);if(i>=0&&i+1<this.demuxer.loadedSamples.length)return this.getPacketAtIndex(i,r);await this.demuxer.advanceReader()}}finally{n()}}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}}const R8=1399285583,JR=79764919,M8=new Uint32Array(256);for(let t=0;t<256;t++){let e=t<<24;for(let r=0;r<8;r++)e=e&2147483648?e<<1^JR:e<<1;M8[t]=e>>>0&4294967295}const eM=t=>{const e=Fr(t),r=e.getUint32(22,!0);e.setUint32(22,0,!0);let n=0;for(let i=0;i<t.length;i++){const a=t[i];n=(n<<8^M8[n>>>24^a])>>>0}return e.setUint32(22,r,!0),n},tM=(t,e,r)=>{let n=0,i=null;if(t.length>0)if(e.codec==="vorbis"){pe(e.vorbisInfo);const a=e.vorbisInfo.modeBlockflags.length,s=(1<<HI(a-1))-1<<1,u=(t[0]&s)>>1;if(u>=e.vorbisInfo.modeBlockflags.length)throw new Error("Invalid mode number.");let f=r;const d=e.vorbisInfo.modeBlockflags[u];if(i=e.vorbisInfo.blocksizes[d],d===1){const h=(s|1)+1,p=t[0]&h?1:0;f=e.vorbisInfo.blocksizes[p]}n=f!==null?f+i>>2:0}else e.codec==="opus"&&(n=hR(t).durationInSamples);return{durationInSamples:n,vorbisBlockSize:i}},rM=t=>{let e="audio/ogg";if(t.codecStrings){const r=[...new Set(t.codecStrings)];e+=`; codecs="${r.join(", ")}"`}return e};const pc=27,dd=282,nM=dd+65025,cp=t=>{const e=t.filePos;if(ld(t)!==R8)return null;t.skip(1);const n=kt(t),i=QM(t),a=ld(t),o=ld(t),s=ld(t),u=kt(t),f=new Uint8Array(u);for(let y=0;y<u;y++)f[y]=kt(t);const d=27+u,h=f.reduce((y,v)=>y+v,0),p=d+h;return{headerStartPos:e,totalSize:p,dataStartPos:e+d,dataSize:h,headerType:n,granulePosition:i,serialNumber:a,sequenceNumber:o,checksum:s,lacingValues:f}},iM=(t,e)=>{for(;t.filePos<e-3;){const r=ld(t),n=r&255,i=r>>>8&255,a=r>>>16&255,o=r>>>24&255,s=79;if(!(n!==s&&i!==s&&a!==s&&o!==s)){if(t.skip(-4),r===R8)return!0;t.skip(1)}}return!1};class aM extends ku{constructor(e){super(e),this.metadataPromise=null,this.bitstreams=[],this.tracks=[],this.metadataTags={},this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{let e=0;for(;;){let r=this.reader.requestSliceRange(e,pc,dd);if(r instanceof Promise&&(r=await r),!r)break;const n=cp(r);if(!n||!!!(n.headerType&2))break;this.bitstreams.push({serialNumber:n.serialNumber,bosPage:n,description:null,numberOfChannels:-1,sampleRate:-1,codecInfo:{codec:null,vorbisInfo:null,opusInfo:null},lastMetadataPacket:null}),e=n.headerStartPos+n.totalSize}for(const r of this.bitstreams){const n=await this.readPacket(r.bosPage,0);n&&(n.data.byteLength>=7&&n.data[0]===1&&n.data[1]===118&&n.data[2]===111&&n.data[3]===114&&n.data[4]===98&&n.data[5]===105&&n.data[6]===115?await this.readVorbisMetadata(n,r):n.data.byteLength>=8&&n.data[0]===79&&n.data[1]===112&&n.data[2]===117&&n.data[3]===115&&n.data[4]===72&&n.data[5]===101&&n.data[6]===97&&n.data[7]===100&&await this.readOpusMetadata(n,r),r.codecInfo.codec!==null&&this.tracks.push(new uo(this.input,new oM(r,this))))}})()}async readVorbisMetadata(e,r){let n=await this.findNextPacketStart(e);if(!n)return;const i=await this.readPacket(n.startPage,n.startSegmentIndex);if(!i||(n=await this.findNextPacketStart(i),!n))return;const a=await this.readPacket(n.startPage,n.startSegmentIndex);if(!a||i.data[0]!==3||a.data[0]!==5)return;const o=[],s=h=>{for(;o.push(Math.min(255,h)),!(h<255);)h-=255};s(e.data.length),s(i.data.length);const u=new Uint8Array(1+o.length+e.data.length+i.data.length+a.data.length);u[0]=2,u.set(o,1),u.set(e.data,1+o.length),u.set(i.data,1+o.length+e.data.length),u.set(a.data,1+o.length+e.data.length+i.data.length),r.codecInfo.codec="vorbis",r.description=u,r.lastMetadataPacket=a;const f=Fr(e.data);r.numberOfChannels=f.getUint8(11),r.sampleRate=f.getUint32(12,!0);const d=f.getUint8(28);r.codecInfo.vorbisInfo={blocksizes:[1<<(d&15),1<<(d>>4)],modeBlockflags:pR(a.data).modeBlockflags},t2(i.data.subarray(7),this.metadataTags)}async readOpusMetadata(e,r){const n=await this.findNextPacketStart(e);if(!n)return;const i=await this.readPacket(n.startPage,n.startSegmentIndex);if(!i)return;r.codecInfo.codec="opus",r.description=e.data,r.lastMetadataPacket=i;const a=fR(e.data);r.numberOfChannels=a.outputChannelCount,r.sampleRate=T0,r.codecInfo.opusInfo={preSkip:a.preSkip},t2(i.data.subarray(8),this.metadataTags)}async readPacket(e,r){pe(r<e.lacingValues.length);let n=0;for(let h=0;h<r;h++)n+=e.lacingValues[h];let i=e,a=n,o=r;const s=[];e:for(;;){let h=this.reader.requestSlice(i.dataStartPos,i.dataSize);h instanceof Promise&&(h=await h),pe(h);const p=It(h,i.dataSize);for(;;){if(o===i.lacingValues.length){s.push(p.subarray(n,a));break}const v=i.lacingValues[o];if(a+=v,v<255){s.push(p.subarray(n,a));break e}o++}let y=i.headerStartPos+i.totalSize;for(;;){let v=this.reader.requestSliceRange(y,pc,dd);if(v instanceof Promise&&(v=await v),!v)return null;const b=cp(v);if(!b)return null;if(i=b,i.serialNumber===e.serialNumber)break;y=i.headerStartPos+i.totalSize}n=0,a=0,o=0}const u=s.reduce((h,p)=>h+p.length,0);if(u===0)return null;const f=new Uint8Array(u);let d=0;for(let h=0;h<s.length;h++){const p=s[h];f.set(p,d),d+=p.length}return{data:f,endPage:i,endSegmentIndex:o}}async findNextPacketStart(e){if(e.endSegmentIndex<e.endPage.lacingValues.length-1)return{startPage:e.endPage,startSegmentIndex:e.endSegmentIndex+1};if(!!(e.endPage.headerType&4))return null;let n=e.endPage.headerStartPos+e.endPage.totalSize;for(;;){let i=this.reader.requestSliceRange(n,pc,dd);if(i instanceof Promise&&(i=await i),!i)return null;const a=cp(i);if(!a)return null;if(a.serialNumber===e.endPage.serialNumber)return{startPage:a,startSegmentIndex:0};n=a.headerStartPos+a.totalSize}}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.tracks.map(r=>r.getCodecParameterString()));return rM({codecStrings:e.filter(Boolean)})}async getTracks(){return await this.readMetadata(),this.tracks}async computeDuration(){const e=await this.getTracks(),r=await Promise.all(e.map(n=>n.computeDuration()));return Math.max(0,...r)}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}}class oM{constructor(e,r){this.bitstream=e,this.demuxer=r,this.encodedPacketToMetadata=new WeakMap,this.sequentialScanCache=[],this.sequentialScanMutex=new Up,this.internalSampleRate=e.codecInfo.codec==="opus"?T0:e.sampleRate}getId(){return this.bitstream.serialNumber}getNumberOfChannels(){return this.bitstream.numberOfChannels}getSampleRate(){return this.bitstream.sampleRate}getTimeResolution(){return this.bitstream.sampleRate}getCodec(){return this.bitstream.codecInfo.codec}getInternalCodecId(){return null}async getDecoderConfig(){return pe(this.bitstream.codecInfo.codec),{codec:this.bitstream.codecInfo.codec,numberOfChannels:this.bitstream.numberOfChannels,sampleRate:this.bitstream.sampleRate,description:this.bitstream.description??void 0}}getName(){return null}getLanguageCode(){return Ia}getDisposition(){return{...Su}}async getFirstTimestamp(){return 0}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}granulePositionToTimestampInSamples(e){return this.bitstream.codecInfo.codec==="opus"?(pe(this.bitstream.codecInfo.opusInfo),e-this.bitstream.codecInfo.opusInfo.preSkip):e}createEncodedPacketFromOggPacket(e,r,n){if(!e)return null;const{durationInSamples:i,vorbisBlockSize:a}=tM(e.data,this.bitstream.codecInfo,r.vorbisLastBlocksize),o=new xn(n.metadataOnly?la:e.data,"key",Math.max(0,r.timestampInSamples)/this.internalSampleRate,i/this.internalSampleRate,e.endPage.headerStartPos+e.endSegmentIndex,e.data.byteLength);return this.encodedPacketToMetadata.set(o,{packet:e,timestampInSamples:r.timestampInSamples,durationInSamples:i,vorbisLastBlockSize:r.vorbisLastBlocksize,vorbisBlockSize:a}),o}async getFirstPacket(e){pe(this.bitstream.lastMetadataPacket);const r=await this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket);if(!r)return null;let n=0;this.bitstream.codecInfo.codec==="opus"&&(pe(this.bitstream.codecInfo.opusInfo),n-=this.bitstream.codecInfo.opusInfo.preSkip);const i=await this.demuxer.readPacket(r.startPage,r.startSegmentIndex);return this.createEncodedPacketFromOggPacket(i,{timestampInSamples:n,vorbisLastBlocksize:null},e)}async getNextPacket(e,r){const n=this.encodedPacketToMetadata.get(e);if(!n)throw new Error("Packet was not created from this track.");const i=await this.demuxer.findNextPacketStart(n.packet);if(!i)return null;const a=n.timestampInSamples+n.durationInSamples,o=await this.demuxer.readPacket(i.startPage,i.startSegmentIndex);return this.createEncodedPacketFromOggPacket(o,{timestampInSamples:a,vorbisLastBlocksize:n.vorbisBlockSize},r)}async getPacket(e,r){if(this.demuxer.reader.fileSize===null)return this.getPacketSequential(e,r);const n=Pp(e*this.internalSampleRate);if(n===0)return this.getFirstPacket(r);if(n<0)return null;pe(this.bitstream.lastMetadataPacket);const i=await this.demuxer.findNextPacketStart(this.bitstream.lastMetadataPacket);if(!i)return null;let a=i.startPage,o=this.demuxer.reader.fileSize;const s=[a];e:for(;a.headerStartPos+a.totalSize<o;){const S=a.headerStartPos,P=Math.floor((S+o)/2);let _=P;for(;;){const E=Math.min(_+nM,o-pc);let A=this.demuxer.reader.requestSlice(_,E-_);if(A instanceof Promise&&(A=await A),pe(A),!iM(A,E)){o=P+pc;continue e}let I=this.demuxer.reader.requestSliceRange(A.filePos,pc,dd);I instanceof Promise&&(I=await I),pe(I);const L=cp(I);pe(L);let R=!1;if(L.serialNumber===this.bitstream.serialNumber)R=!0;else{let F=this.demuxer.reader.requestSlice(L.headerStartPos,L.totalSize);F instanceof Promise&&(F=await F),pe(F);const H=It(F,L.totalSize);R=eM(H)===L.checksum}if(!R){_=L.headerStartPos+4;continue}if(R&&L.serialNumber!==this.bitstream.serialNumber){_=L.headerStartPos+L.totalSize;continue}if(L.granulePosition===-1){_=L.headerStartPos+L.totalSize;continue}this.granulePositionToTimestampInSamples(L.granulePosition)>n?o=L.headerStartPos:(a=L,s.push(L));continue e}}let u=i.startPage;for(const S of s){if(S.granulePosition===a.granulePosition)break;(!u||S.headerStartPos>u.headerStartPos)&&(u=S)}let f=u;const d=[f];for(;!(f.serialNumber===this.bitstream.serialNumber&&f.granulePosition===a.granulePosition);){const S=f.headerStartPos+f.totalSize;let P=this.demuxer.reader.requestSliceRange(S,pc,dd);P instanceof Promise&&(P=await P),pe(P);const _=cp(P);pe(_),f=_,f.serialNumber===this.bitstream.serialNumber&&d.push(f)}pe(f.granulePosition!==-1);let h=null,p,y,v=f,b=0;if(f.headerStartPos===i.startPage.headerStartPos)p=this.granulePositionToTimestampInSamples(0),y=!0,h=0;else{p=0,y=!1;for(let _=f.lacingValues.length-1;_>=0;_--)if(f.lacingValues[_]<255){h=_+1;break}if(h===null)throw new Error("Invalid page with granule position: no packets end on this page.");b=h-1;const S={data:la,endPage:v,endSegmentIndex:b};if(await this.demuxer.findNextPacketStart(S)){const _=yx(d,f,h);pe(_);const E=gx(d,_.page,_.segmentIndex);E&&(f=E.page,h=E.segmentIndex)}else for(;;){const _=yx(d,f,h);if(!_)break;const E=gx(d,_.page,_.segmentIndex);if(!E)break;if(f=E.page,h=E.segmentIndex,_.page.headerStartPos!==v.headerStartPos){v=_.page,b=_.segmentIndex;break}}}let x=null,k=null;for(;f!==null;){pe(h!==null);const S=await this.demuxer.readPacket(f,h);if(!S)break;if(!(f.headerStartPos===i.startPage.headerStartPos&&h<i.startSegmentIndex)){let E=this.createEncodedPacketFromOggPacket(S,{timestampInSamples:p,vorbisLastBlocksize:k?.vorbisBlockSize??null},r);pe(E);let A=this.encodedPacketToMetadata.get(E);if(pe(A),!y&&S.endPage.headerStartPos===v.headerStartPos&&S.endSegmentIndex===b?(p=this.granulePositionToTimestampInSamples(f.granulePosition),y=!0,E=this.createEncodedPacketFromOggPacket(S,{timestampInSamples:p-A.durationInSamples,vorbisLastBlocksize:k?.vorbisBlockSize??null},r),pe(E),A=this.encodedPacketToMetadata.get(E),pe(A)):p+=A.durationInSamples,x=E,k=A,y&&(Math.max(p,0)>n||Math.max(A.timestampInSamples,0)===n))break}const _=await this.demuxer.findNextPacketStart(S);if(!_)break;f=_.startPage,h=_.startSegmentIndex}return x}async getPacketSequential(e,r){const n=await this.sequentialScanMutex.acquire();try{const i=Pp(e*this.internalSampleRate);e=i/this.internalSampleRate;const a=or(this.sequentialScanCache,i,u=>u.timestampInSamples);let o;if(a!==-1){const u=this.sequentialScanCache[a];o=this.createEncodedPacketFromOggPacket(u.packet,{timestampInSamples:u.timestampInSamples,vorbisLastBlocksize:u.vorbisLastBlockSize},r)}else o=await this.getFirstPacket(r);let s=0;for(;o&&o.timestamp<e;){const u=await this.getNextPacket(o,r);if(!u||u.timestamp>e)break;if(o=u,s++,s===100){s=0;const f=this.encodedPacketToMetadata.get(o);pe(f),this.sequentialScanCache.length>0&&pe(ni(this.sequentialScanCache).timestampInSamples<=f.timestampInSamples),this.sequentialScanCache.push(f)}}return o}finally{n()}}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}}const gx=(t,e,r)=>{let n=e,i=r;e:for(;;){for(i--,i;i>=0;i--)if(n.lacingValues[i]<255){i++;break e}if(pe(i===-1),!(n.headerType&1)){i=0;break}const o=Qk(t,s=>s.headerStartPos<n.headerStartPos);if(!o)return null;n=o,i=n.lacingValues.length}if(pe(i!==-1),i===n.lacingValues.length){const a=t[t.indexOf(n)+1];pe(a),n=a,i=0}return{page:n,segmentIndex:i}},yx=(t,e,r)=>{if(r>0)return{page:e,segmentIndex:r-1};const n=Qk(t,i=>i.headerStartPos<e.headerStartPos);return n?{page:n,segmentIndex:n.lacingValues.length-1}:null};var Is;(function(t){t[t.PCM=1]="PCM",t[t.IEEE_FLOAT=3]="IEEE_FLOAT",t[t.ALAW=6]="ALAW",t[t.MULAW=7]="MULAW",t[t.EXTENSIBLE=65534]="EXTENSIBLE"})(Is||(Is={}));class sM extends ku{constructor(e){super(e),this.metadataPromise=null,this.dataStart=-1,this.dataSize=-1,this.audioInfo=null,this.tracks=[],this.lastKnownPacketIndex=0,this.metadataTags={},this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{let e=this.reader.requestSlice(0,12);e instanceof Promise&&(e=await e),pe(e);const r=Vn(e,4),n=r!=="RIFX",i=r==="RF64",a=au(e,n);let o=i?this.reader.fileSize:Math.min(a+8,this.reader.fileSize??1/0);if(Vn(e,4)!=="WAVE")throw new Error("Invalid WAVE file - wrong format");let u=0,f=null,d=e.filePos;for(;o===null||d<o;){let p=this.reader.requestSlice(d,8);if(p instanceof Promise&&(p=await p),!p)break;const y=Vn(p,4),v=au(p,n),b=p.filePos;if(i&&u===0&&y!=="ds64")throw new Error('Invalid RF64 file: First chunk must be "ds64".');if(y==="fmt ")await this.parseFmtChunk(b,v,n);else if(y==="data"){if(f??=v,this.dataStart=p.filePos,this.dataSize=Math.min(f,(o??1/0)-this.dataStart),this.reader.fileSize===null)break}else if(y==="ds64"){let x=this.reader.requestSlice(b,v);if(x instanceof Promise&&(x=await x),!x)break;const k=bx(x,n);f=bx(x,n),o=Math.min(k+8,this.reader.fileSize??1/0)}else y==="LIST"?await this.parseListChunk(b,v,n):(y==="ID3 "||y==="id3 ")&&await this.parseId3Chunk(b,v);d=b+v+(v&1),u++}if(!this.audioInfo)throw new Error('Invalid WAVE file - missing "fmt " chunk');if(this.dataStart===-1)throw new Error('Invalid WAVE file - missing "data" chunk');const h=this.audioInfo.blockSizeInBytes;this.dataSize=Math.floor(this.dataSize/h)*h,this.tracks.push(new uo(this.input,new lM(this)))})()}async parseFmtChunk(e,r,n){let i=this.reader.requestSlice(e,r);if(i instanceof Promise&&(i=await i),!i)return;let a=Nh(i,n);const o=Nh(i,n),s=au(i,n);i.skip(4);const u=Nh(i,n);let f;if(r===14?f=8:f=Nh(i,n),r>=18&&a!==357){const d=Nh(i,n),h=r-18;if(Math.min(h,d)>=22&&a===Is.EXTENSIBLE){i.skip(6);const y=It(i,16);a=y[0]|y[1]<<8}}(a===Is.MULAW||a===Is.ALAW)&&(f=8),this.audioInfo={format:a,numberOfChannels:o,sampleRate:s,sampleSizeInBytes:Math.ceil(f/8),blockSizeInBytes:u}}async parseListChunk(e,r,n){let i=this.reader.requestSlice(e,r);if(i instanceof Promise&&(i=await i),!i)return;const a=Vn(i,4);if(a!=="INFO"&&a!=="INF0")return;let o=i.filePos;for(;o<=e+r-8;){i.filePos=o;const s=Vn(i,4),u=au(i,n),f=It(i,u);let d=0;for(let p=0;p<f.length&&f[p]!==0;p++)d++;const h=String.fromCharCode(...f.subarray(0,d));switch(this.metadataTags.raw??={},this.metadataTags.raw[s]=h,s){case"INAM":case"TITL":this.metadataTags.title??=h;break;case"TIT3":this.metadataTags.description??=h;break;case"IART":this.metadataTags.artist??=h;break;case"IPRD":this.metadataTags.album??=h;break;case"IPRT":case"ITRK":case"TRCK":{const p=h.split("/"),y=Number.parseInt(p[0],10),v=p[1]&&Number.parseInt(p[1],10);Number.isInteger(y)&&y>0&&(this.metadataTags.trackNumber??=y),v&&Number.isInteger(v)&&v>0&&(this.metadataTags.tracksTotal??=v)}break;case"ICRD":case"IDIT":{const p=new Date(h);Number.isNaN(p.getTime())||(this.metadataTags.date??=p)}break;case"YEAR":{const p=Number.parseInt(h,10);Number.isInteger(p)&&p>0&&(this.metadataTags.date??=new Date(p,0,1))}break;case"IGNR":case"GENR":this.metadataTags.genre??=h;break;case"ICMT":case"CMNT":case"COMM":this.metadataTags.comment??=h;break}o+=8+u+(u&1)}}async parseId3Chunk(e,r){let n=this.reader.requestSlice(e,r);if(n instanceof Promise&&(n=await n),!n)return;const i=Jg(n);if(i){const a=n.slice(e+10,i.size);I8(a,i,this.metadataTags)}}getCodec(){if(pe(this.audioInfo),this.audioInfo.format===Is.MULAW)return"ulaw";if(this.audioInfo.format===Is.ALAW)return"alaw";if(this.audioInfo.format===Is.PCM){if(this.audioInfo.sampleSizeInBytes===1)return"pcm-u8";if(this.audioInfo.sampleSizeInBytes===2)return"pcm-s16";if(this.audioInfo.sampleSizeInBytes===3)return"pcm-s24";if(this.audioInfo.sampleSizeInBytes===4)return"pcm-s32"}return this.audioInfo.format===Is.IEEE_FLOAT&&this.audioInfo.sampleSizeInBytes===4?"pcm-f32":null}async getMimeType(){return"audio/wav"}async computeDuration(){await this.readMetadata();const e=this.tracks[0];return pe(e),e.computeDuration()}async getTracks(){return await this.readMetadata(),this.tracks}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}}const Hf=2048;class lM{constructor(e){this.demuxer=e}getId(){return 1}getCodec(){return this.demuxer.getCodec()}getInternalCodecId(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.format}async getDecoderConfig(){const e=this.demuxer.getCodec();return e?(pe(this.demuxer.audioInfo),{codec:e,numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate}):null}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getNumberOfChannels(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}getSampleRate(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getTimeResolution(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getName(){return null}getLanguageCode(){return Ia}getDisposition(){return{...Su}}async getFirstTimestamp(){return 0}async getPacketAtIndex(e,r){pe(this.demuxer.audioInfo);const n=e*Hf*this.demuxer.audioInfo.blockSizeInBytes;if(n>=this.demuxer.dataSize)return null;const i=Math.min(Hf*this.demuxer.audioInfo.blockSizeInBytes,this.demuxer.dataSize-n);if(this.demuxer.reader.fileSize===null){let u=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,i);if(u instanceof Promise&&(u=await u),!u)return null}let a;if(r.metadataOnly)a=la;else{let u=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,i);u instanceof Promise&&(u=await u),pe(u),a=It(u,i)}const o=e*Hf/this.demuxer.audioInfo.sampleRate,s=i/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate;return this.demuxer.lastKnownPacketIndex=Math.max(e,o),new xn(a,"key",o,s,e,i)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getPacket(e,r){pe(this.demuxer.audioInfo);const n=Math.floor(Math.min(e*this.demuxer.audioInfo.sampleRate/Hf,(this.demuxer.dataSize-1)/(Hf*this.demuxer.audioInfo.blockSizeInBytes))),i=await this.getPacketAtIndex(n,r);if(i)return i;if(n===0)return null;pe(this.demuxer.reader.fileSize===null);let a=await this.getPacketAtIndex(this.demuxer.lastKnownPacketIndex,r);for(;a;){const o=await this.getNextPacket(a,r);if(!o)break;a=o}return a}getNextPacket(e,r){pe(this.demuxer.audioInfo);const n=Math.round(e.timestamp*this.demuxer.audioInfo.sampleRate/Hf);return this.getPacketAtIndex(n+1,r)}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}}const s2=7,hd=9,Op=t=>{const e=t.filePos,r=It(t,9),n=new Dr(r);if(n.readBits(12)!==4095||(n.skipBits(1),n.readBits(2)!==0))return null;const o=n.readBits(1),s=n.readBits(2)+1,u=n.readBits(4);if(u===15)return null;n.skipBits(1);const f=n.readBits(3);if(f===0)throw new Error("ADTS frames with channel configuration 0 are not supported.");n.skipBits(1),n.skipBits(1),n.skipBits(1),n.skipBits(1);const d=n.readBits(13);n.skipBits(11);const h=n.readBits(2)+1;if(h!==1)throw new Error("ADTS frames with more than one AAC frame are not supported.");let p=null;return o===1?t.filePos-=2:p=n.readBits(16),{objectType:s,samplingFrequencyIndex:u,channelConfiguration:f,frameLength:d,numberOfAacFrames:h,crcCheck:p,startPos:e}};const e0=1024;class uM extends ku{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.tracks=[],this.readingMutex=new Up,this.lastSampleLoaded=!1,this.lastLoadedPos=0,this.nextTimestampInSamples=0,this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{for(;!this.firstFrameHeader&&!this.lastSampleLoaded;)await this.advanceReader();pe(this.firstFrameHeader),this.tracks=[new uo(this.input,new cM(this))]})()}async advanceReader(){let e=this.reader.requestSliceRange(this.lastLoadedPos,s2,hd);if(e instanceof Promise&&(e=await e),!e){this.lastSampleLoaded=!0;return}const r=Op(e);if(!r){this.lastSampleLoaded=!0;return}if(this.reader.fileSize!==null&&r.startPos+r.frameLength>this.reader.fileSize){this.lastSampleLoaded=!0;return}this.firstFrameHeader||(this.firstFrameHeader=r);const n=kd[r.samplingFrequencyIndex];pe(n!==void 0);const i=e0/n,a={timestamp:this.nextTimestampInSamples/n,duration:i,dataStart:r.startPos,dataSize:r.frameLength};this.loadedSamples.push(a),this.nextTimestampInSamples+=e0,this.lastLoadedPos=r.startPos+r.frameLength}async getMimeType(){return"audio/aac"}async getTracks(){return await this.readMetadata(),this.tracks}async computeDuration(){await this.readMetadata();const e=this.tracks[0];return pe(e),e.computeDuration()}async getMetadataTags(){return{}}}class cM{constructor(e){this.demuxer=e}getId(){return 1}async getFirstTimestamp(){return 0}getTimeResolution(){return this.getSampleRate()/e0}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return null}getLanguageCode(){return Ia}getCodec(){return"aac"}getInternalCodecId(){return pe(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.objectType}getNumberOfChannels(){pe(this.demuxer.firstFrameHeader);const e=E0[this.demuxer.firstFrameHeader.channelConfiguration];return pe(e!==void 0),e}getSampleRate(){pe(this.demuxer.firstFrameHeader);const e=kd[this.demuxer.firstFrameHeader.samplingFrequencyIndex];return pe(e!==void 0),e}getDisposition(){return{...Su}}async getDecoderConfig(){return pe(this.demuxer.firstFrameHeader),{codec:`mp4a.40.${this.demuxer.firstFrameHeader.objectType}`,numberOfChannels:this.getNumberOfChannels(),sampleRate:this.getSampleRate()}}async getPacketAtIndex(e,r){if(e===-1)return null;const n=this.demuxer.loadedSamples[e];if(!n)return null;let i;if(r.metadataOnly)i=la;else{let a=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(a instanceof Promise&&(a=await a),!a)return null;i=It(a,n.dataSize)}return new xn(i,"key",n.timestamp,n.duration,e,n.dataSize)}getFirstPacket(e){return this.getPacketAtIndex(0,e)}async getNextPacket(e,r){const n=await this.demuxer.readingMutex.acquire();try{const i=Hp(this.demuxer.loadedSamples,e.timestamp,o=>o.timestamp);if(i===-1)throw new Error("Packet was not created from this track.");const a=i+1;for(;a>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(a,r)}finally{n()}}async getPacket(e,r){const n=await this.demuxer.readingMutex.acquire();try{for(;;){const i=or(this.demuxer.loadedSamples,e,a=>a.timestamp);if(i===-1&&this.demuxer.loadedSamples.length>0)return null;if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(i,r);if(i>=0&&i+1<this.demuxer.loadedSamples.length)return this.getPacketAtIndex(i,r);await this.demuxer.advanceReader()}}finally{n()}}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}}const fM=t=>t===0?null:t===1?192:t>=2&&t<=5?144*2**t:t===6?"uncommon-u8":t===7?"uncommon-u16":t>=8&&t<=15?2**t:null,dM=(t,e)=>{switch(t){case 0:return e;case 1:return 88200;case 2:return 176400;case 3:return 192e3;case 4:return 8e3;case 5:return 16e3;case 6:return 22050;case 7:return 24e3;case 8:return 32e3;case 9:return 44100;case 10:return 48e3;case 11:return 96e3;case 12:return"uncommon-u8";case 13:return"uncommon-u16";case 14:return"uncommon-u16-10";default:return null}},hM=t=>{let e=0;const r=new Dr(It(t,1));for(;r.readBits(1)===1;)e++;if(e===0)return r.readBits(7);const n=[],i=e-1,a=new Dr(It(t,i)),o=8-e-1;for(let u=0;u<o;u++)n.unshift(r.readBits(1));for(let u=0;u<i;u++)for(let f=0;f<8;f++){const d=a.readBits(1);f<2||n.unshift(d)}return n.reduce((u,f,d)=>u|f<<d,0)},pM=(t,e)=>{if(e==="uncommon-u16")return $n(t)+1;if(e==="uncommon-u8")return kt(t)+1;if(typeof e=="number")return e;_p(e),pe(!1)},mM=(t,e)=>e==="uncommon-u16"?$n(t):e==="uncommon-u16-10"?$n(t)*10:e==="uncommon-u8"?kt(t):typeof e=="number"?e:null,gM=t=>{let r=0;for(const n of t){r^=n;for(let i=0;i<8;i++)(r&128)!==0?r=r<<1^7:r<<=1,r&=255}return r};class yM extends ku{constructor(e){super(e),this.loadedSamples=[],this.metadataPromise=null,this.track=null,this.metadataTags={},this.audioInfo=null,this.lastLoadedPos=null,this.blockingBit=null,this.readingMutex=new Up,this.lastSampleLoaded=!1,this.reader=e._reader}async computeDuration(){return await this.readMetadata(),pe(this.track),this.track.computeDuration()}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}async getTracks(){return await this.readMetadata(),pe(this.track),[this.track]}async getMimeType(){return"audio/flac"}async readMetadata(){let e=4;return this.metadataPromise??=(async()=>{for(;this.reader.fileSize===null||e<this.reader.fileSize;){let r=this.reader.requestSlice(e,4);if(r instanceof Promise&&(r=await r),e+=4,r===null)throw new Error(`Metadata block at position ${e} is too small! Corrupted file.`);pe(r);const n=kt(r),i=Kf(r),a=(n&128)!==0;switch(n&127){case fd.STREAMINFO:{let s=this.reader.requestSlice(e,i);if(s instanceof Promise&&(s=await s),pe(s),s===null)throw new Error(`StreamInfo block at position ${e} is too small! Corrupted file.`);const u=It(s,34),f=new Dr(u),d=f.readBits(16),h=f.readBits(16),p=f.readBits(24),y=f.readBits(24),v=f.readBits(20),b=f.readBits(3)+1;f.readBits(5);const x=f.readBits(36);f.skipBits(128);const k=new Uint8Array(42);k.set(new Uint8Array([102,76,97,67]),0),k.set(new Uint8Array([128,0,0,34]),4),k.set(u,8),this.audioInfo={numberOfChannels:b,sampleRate:v,totalSamples:x,minimumBlockSize:d,maximumBlockSize:h,minimumFrameSize:p,maximumFrameSize:y,description:k},this.track=new uo(this.input,new vM(this));break}case fd.VORBIS_COMMENT:{let s=this.reader.requestSlice(e,i);s instanceof Promise&&(s=await s),pe(s),t2(It(s,i),this.metadataTags);break}case fd.PICTURE:{let s=this.reader.requestSlice(e,i);s instanceof Promise&&(s=await s),pe(s);const u=it(s),f=it(s),d=Ra.decode(It(s,f)),h=it(s),p=Ra.decode(It(s,h));s.skip(16);const y=it(s),v=It(s,y);this.metadataTags.images??=[],this.metadataTags.images.push({data:v,mimeType:d,kind:u===3?"coverFront":u===4?"coverBack":"unknown",description:p});break}}if(e+=i,a){this.lastLoadedPos=e;break}}})()}async readNextFlacFrame({startPos:e,isFirstPacket:r}){pe(this.audioInfo);const n=6,a=this.audioInfo.maximumFrameSize+16,o=await this.reader.requestSliceRange(e,this.audioInfo.minimumFrameSize,a);if(!o)return null;const s=this.readFlacFrameHeader({slice:o,isFirstPacket:r});if(!s)return null;for(o.filePos=e+this.audioInfo.minimumFrameSize;;){if(o.filePos>o.end-n)return{num:s.num,blockSize:s.blockSize,sampleRate:s.sampleRate,size:o.end-e,isLastFrame:!0};if(kt(o)===255){const f=o.filePos,d=kt(o),h=this.blockingBit===1?249:248;if(d!==h){o.filePos=f;continue}o.skip(-2);const p=o.filePos-e,y=this.readFlacFrameHeader({slice:o,isFirstPacket:!1});if(!y){o.filePos=f;continue}if(this.blockingBit===0){if(y.num-s.num!==1){o.filePos=f;continue}}else if(y.num-s.num!==s.blockSize){o.filePos=f;continue}return{num:s.num,blockSize:s.blockSize,sampleRate:s.sampleRate,size:p,isLastFrame:!1}}}}readFlacFrameHeader({slice:e,isFirstPacket:r}){const n=e.filePos,i=It(e,4),a=new Dr(i);if(a.readBits(15)!==32764)return null;if(this.blockingBit===null){pe(r);const x=a.readBits(1);this.blockingBit=x}else if(this.blockingBit===1){if(pe(!r),a.readBits(1)!==1)return null}else if(this.blockingBit===0){if(pe(!r),a.readBits(1)!==0)return null}else throw new Error("Invalid blocking bit");const s=fM(a.readBits(4));if(!s)return null;pe(this.audioInfo);const u=dM(a.readBits(4),this.audioInfo.sampleRate);if(!u||(a.readBits(4),a.readBits(3),a.readBits(1)!==0))return null;const d=hM(e),h=pM(e,s),p=mM(e,u);if(p===null||p!==this.audioInfo.sampleRate)return null;const y=e.filePos-n,v=kt(e);e.skip(-y),e.skip(-1);const b=gM(It(e,y));return v!==b?null:{num:d,blockSize:h,sampleRate:p}}async advanceReader(){await this.readMetadata(),pe(this.lastLoadedPos!==null),pe(this.audioInfo);const e=this.lastLoadedPos,r=await this.readNextFlacFrame({startPos:e,isFirstPacket:this.loadedSamples.length===0});if(!r){this.lastSampleLoaded=!0;return}const n=this.loadedSamples[this.loadedSamples.length-1],a={blockOffset:n?n.blockOffset+n.blockSize:0,blockSize:r.blockSize,byteOffset:e,byteSize:r.size};if(this.lastLoadedPos=this.lastLoadedPos+r.size,this.loadedSamples.push(a),r.isLastFrame){this.lastSampleLoaded=!0;return}}}class vM{constructor(e){this.demuxer=e}getId(){return 1}getCodec(){return"flac"}getInternalCodecId(){return null}getNumberOfChannels(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.numberOfChannels}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getSampleRate(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getName(){return null}getLanguageCode(){return Ia}getTimeResolution(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getDisposition(){return{...Su}}async getFirstTimestamp(){return 0}async getDecoderConfig(){return pe(this.demuxer.audioInfo),{codec:"flac",numberOfChannels:this.demuxer.audioInfo.numberOfChannels,sampleRate:this.demuxer.audioInfo.sampleRate,description:this.demuxer.audioInfo.description}}async getPacket(e,r){if(pe(this.demuxer.audioInfo),e<0)throw new Error("Timestamp cannot be negative");const n=await this.demuxer.readingMutex.acquire();try{for(;;){const i=or(this.demuxer.loadedSamples,e,u=>u.blockOffset/this.demuxer.audioInfo.sampleRate);if(i===-1){await this.demuxer.advanceReader();continue}const a=this.demuxer.loadedSamples[i],o=a.blockOffset/this.demuxer.audioInfo.sampleRate,s=a.blockSize/this.demuxer.audioInfo.sampleRate;if(o+s<=e){if(this.demuxer.lastSampleLoaded)return this.getPacketAtIndex(this.demuxer.loadedSamples.length-1,r);await this.demuxer.advanceReader();continue}return this.getPacketAtIndex(i,r)}}finally{n()}}async getNextPacket(e,r){const n=await this.demuxer.readingMutex.acquire();try{const i=e.sequenceNumber+1;if(this.demuxer.lastSampleLoaded&&i>=this.demuxer.loadedSamples.length)return null;for(;i>=this.demuxer.loadedSamples.length&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(i,r)}finally{n()}}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}async getPacketAtIndex(e,r){const n=this.demuxer.loadedSamples[e];if(!n)return null;let i;if(r.metadataOnly)i=la;else{let s=this.demuxer.reader.requestSlice(n.byteOffset,n.byteSize);if(s instanceof Promise&&(s=await s),!s)return null;i=It(s,n.byteSize)}pe(this.demuxer.audioInfo);const a=n.blockOffset/this.demuxer.audioInfo.sampleRate,o=n.blockSize/this.demuxer.audioInfo.sampleRate;return new xn(i,"key",a,o,e,n.byteSize)}async getFirstPacket(e){for(;this.demuxer.loadedSamples.length===0&&!this.demuxer.lastSampleLoaded;)await this.demuxer.advanceReader();return this.getPacketAtIndex(0,e)}}const Rs=9e4,Ji=188,bM=t=>{let e="video/MP2T";const r=[...new Set(t.filter(Boolean))];return r.length>0&&(e+=`; codecs="${r.join(", ")}"`),e};const Xf="No PES packet found where one was expected.";class wM extends ku{constructor(e){super(e),this.metadataPromise=null,this.elementaryStreams=[],this.tracks=[],this.packetOffset=0,this.packetStride=-1,this.sectionEndPositions=[],this.reader=e._reader}async readMetadata(){return this.metadataPromise??=(async()=>{const e=Ji+16+1;let r=this.reader.requestSlice(0,e);r instanceof Promise&&(r=await r),pe(r);const n=It(r,e);if(n[0]===71&&n[Ji]===71)this.packetOffset=0,this.packetStride=Ji;else if(n[0]===71&&n[Ji+16]===71)this.packetOffset=0,this.packetStride=Ji+16;else if(n[4]===71&&n[4+Ji]===71)this.packetOffset=4,this.packetStride=Ji;else throw new Error("Unreachable.");let i=this.packetOffset,a=null,o=!1,s=!1;for(;;){const u=await this.readSection(i,!0,!s);if(!u)break;const f=3,d=32;if(u.pid===0&&!o){const p=new Dr(u.payload),y=p.readAlignedByte();p.skipBits(8*y),p.skipBits(14);const v=p.readBits(10);for(p.skipBits(40);8*(v+f)-p.pos>d;){const b=p.readBits(16);if(p.skipBits(3),b!==0){if(a!==null)throw new Error("Only files with a single program are supported.");a=p.readBits(13)}}if(a===null)throw new Error("Program Association Table must link to a Program Map Table.");o=!0}else if(u.pid===a&&!s){const p=new Dr(u.payload),y=p.readAlignedByte();p.skipBits(8*y),p.skipBits(12);const v=p.readBits(12);p.skipBits(43),p.readBits(13),p.skipBits(6);const b=p.readBits(10);for(p.skipBits(8*b);8*(v+f)-p.pos>d;){const x=p.readBits(8);p.skipBits(3);const k=p.readBits(13);p.skipBits(6);const S=p.readBits(10);p.skipBits(8*S);let P=null;switch(x){case 3:case 4:case 15:P={type:"audio",codec:x===15?"aac":"mp3",aacCodecInfo:null,numberOfChannels:-1,sampleRate:-1};break;case 27:case 36:P={type:"video",codec:x===27?"avc":"hevc",avcCodecInfo:null,hevcCodecInfo:null,colorSpace:{primaries:null,transfer:null,matrix:null,fullRange:null},width:-1,height:-1,reorderSize:-1};break}P&&this.elementaryStreams.push({demuxer:this,pid:k,streamType:x,initialized:!1,firstSection:null,info:P})}s=!0}else{const p=this.elementaryStreams.find(y=>y.pid===u.pid);if(p&&!p.initialized){const y=od(u);if(!y)throw new Error(`Couldn't read first PES packet for Elementary Stream with PID ${p.pid}`);if(p.firstSection=u,p.info.type==="video")if(p.info.codec==="avc"){if(p.info.avcCodecInfo=c8(y.data),!p.info.avcCodecInfo)throw new Error("Invalid AVC video stream; could not extract AVCDecoderConfigurationRecord from first packet.");const v=p.info.avcCodecInfo.sequenceParameterSets[0];pe(v);const b=eb(v);p.info.width=b.displayWidth,p.info.height=b.displayHeight,p.info.colorSpace={primaries:Wg[b.colourPrimaries],transfer:Gg[b.transferCharacteristics],matrix:Xg[b.matrixCoefficients],fullRange:!!b.fullRangeFlag},p.info.reorderSize=b.maxDecFrameBuffering,p.initialized=!0}else if(p.info.codec==="hevc"){if(p.info.hevcCodecInfo=h8(y.data),!p.info.hevcCodecInfo)throw new Error("Invalid HEVC video stream; could not extract HVCDecoderConfigurationRecord from first packet.");const b=p.info.hevcCodecInfo.arrays.find(k=>k.nalUnitType===ti.SPS_NUT).nalUnits[0];pe(b);const x=d8(b);p.info.width=x.displayWidth,p.info.height=x.displayHeight,p.info.colorSpace={primaries:Wg[x.colourPrimaries],transfer:Gg[x.transferCharacteristics],matrix:Xg[x.matrixCoefficients],fullRange:!!x.fullRangeFlag},p.info.reorderSize=x.maxDecFrameBuffering,p.initialized=!0}else throw new Error("Unhandled.");else if(p.info.codec==="aac"){const v=Ks.tempFromBytes(y.data),b=Op(v);if(!b)throw new Error("Invalid AAC audio stream; could not read ADTS frame header from first packet.");p.info.aacCodecInfo={isMpeg2:!1,objectType:b.objectType},p.info.numberOfChannels=E0[b.channelConfiguration],p.info.sampleRate=kd[b.samplingFrequencyIndex],p.initialized=!0}else if(p.info.codec==="mp3"){const v=it(Ks.tempFromBytes(y.data)),b=ob(v,y.data.byteLength);if(!b.header)throw new Error("Invalid MP3 audio stream; could not read frame header from first packet.");p.info.numberOfChannels=b.header.channel===3?1:2,p.info.sampleRate=b.header.sampleRate,p.initialized=!0}else throw new Error("Unhandled.")}}if(s&&this.elementaryStreams.every(p=>p.initialized))break;pe(u.endPos!==null),i=u.endPos}for(const u of this.elementaryStreams)u.info.type==="video"?this.tracks.push(new Md(this.input,new xM(u))):this.tracks.push(new uo(this.input,new SM(u)))})()}async getTracks(){return await this.readMetadata(),this.tracks}async getMetadataTags(){return{}}async computeDuration(){const e=await this.getTracks(),r=await Promise.all(e.map(n=>n.computeDuration()));return Math.max(0,...r)}async getMimeType(){await this.readMetadata();const e=await this.getTracks(),r=await Promise.all(e.map(n=>n.getCodecParameterString()));return bM(r)}async readSection(e,r,n=!1){let i=e,a=e;const o=[];let s=0,u=null,f=!0;for(;;){const h=await this.readPacket(a);if(a+=this.packetStride,!h)break;if(u){if(h.pid!==u.pid){if(n)break;continue}if(h.payloadUnitStartIndicator===1)break}else{if(h.payloadUnitStartIndicator===0)break;u=h}const p=!!(h.adaptationFieldControl&2),y=!!(h.adaptationFieldControl&1);let v=0;if(p&&(v=1+h.body[0]),y&&(v===0?(o.push(h.body),s+=h.body.byteLength):(o.push(h.body.subarray(v)),s+=h.body.byteLength-v)),i=a,!r&&s>=64){f=!1;break}if(Hp(this.sectionEndPositions,i,x=>x)!==-1){f=!1;break}}if(f){const h=or(this.sectionEndPositions,i,p=>p);this.sectionEndPositions.splice(h+1,0,i)}if(!u)return null;let d;if(o.length===1)d=o[0];else{const h=o.reduce((y,v)=>y+v.length,0);d=new Uint8Array(h);let p=0;for(const y of o)d.set(y,p),p+=y.length}return{startPos:e,endPos:r?i:null,pid:u.pid,payload:d}}async readPacketHeader(e){let r=this.reader.requestSlice(e,4);if(r instanceof Promise&&(r=await r),!r)return null;if(kt(r)!==71)throw new Error("Invalid TS packet sync byte. Likely an internal bug, please report this file.");const i=$n(r),a=i>>14&1,o=i&8191,u=kt(r)>>4&3;return{payloadUnitStartIndicator:a,pid:o,adaptationFieldControl:u}}async readPacket(e){let r=this.reader.requestSlice(e,Ji);if(r instanceof Promise&&(r=await r),!r)return null;const n=It(r,Ji);if(n[0]!==71)throw new Error("Invalid TS packet sync byte. Likely an internal bug, please report this file.");const a=(n[1]<<8)+n[2],o=a>>14&1,s=a&8191,f=n[3]>>4&3;return{payloadUnitStartIndicator:o,pid:s,adaptationFieldControl:f,body:n.subarray(4)}}}const Yf=t=>{const e=new Dr(t.payload);if(e.readBits(24)!==1)return null;const n=e.readBits(8);if(e.skipBits(16),n===188||n===190||n===191||n===240||n===241||n===255||n===242||n===248)return null;e.skipBits(8);const i=e.readBits(2);e.skipBits(14);let a=0;if(i===2||i===3)e.skipBits(4),a+=e.readBits(3)*(1<<30),e.skipBits(1),a+=e.readBits(15)*32768,e.skipBits(1),a+=e.readBits(15);else throw new Error("PES packets without PTS are not currently supported. If you think this file should be supported, please report it.");return{sectionStartPos:t.startPos,sectionEndPos:t.endPos,pts:a}},od=t=>{pe(t.endPos!==null);const e=Yf(t);if(!e)return null;const r=new Dr(t.payload);r.skipBits(32);const n=r.readBits(16),i=6;r.skipBits(16);const a=r.readBits(8),o=r.pos+8*a;r.pos=o;const s=o/8;pe(Number.isInteger(s));const u=t.payload.subarray(s,n>0?i+n:t.payload.byteLength);return{...e,data:u}};class D8{constructor(e){this.elementaryStream=e,this.referencePesPackets=[],this.endReferencePesPacketAdded=!1,this.packetBuffers=new WeakMap,this.packetSectionStarts=new WeakMap,this.mutex=new Up}getId(){return this.elementaryStream.pid}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.elementaryStream.streamType}getName(){return null}getLanguageCode(){return Ia}getDisposition(){return Su}getTimeResolution(){return Rs}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}async getFirstTimestamp(){return(await this.getFirstPacket({metadataOnly:!0}))?.timestamp??0}createEncodedPacket(e,r,n){return new xn(n.metadataOnly?la:e.data,this.getPacketType(e.data),e.pts/Rs,Math.max(r/Rs,0),e.sequenceNumber,e.data.byteLength)}maybeInsertReferencePacket(e,r,n){if(n&&this.mutex.pending>0)return;const i=or(this.referencePesPackets,e.pts,a=>a.pts);if(i>=0){const a=this.referencePesPackets[i];if(e.sectionStartPos<=a.sectionStartPos||!r&&e.pts-a.pts<Rs/2)return!1;if(i<this.referencePesPackets.length-1){const o=this.referencePesPackets[i+1];if(o.sectionStartPos<e.sectionStartPos||!r&&o.pts-e.pts<Rs/2)return!1}}return this.referencePesPackets.splice(i+1,0,e),!0}async getFirstPacket(e){const r=this.elementaryStream.firstSection;pe(r);const n=od(r);pe(n);const i=new sd(this,n,!0),a=new dg(this,i),o=await a.readNext();if(!o)return null;const s=this.createEncodedPacket(o.packet,o.duration,e);return this.packetBuffers.set(s,a),this.packetSectionStarts.set(s,o.packet.sectionStartPos),s}async getNextPacket(e,r){let n=this.packetBuffers.get(e);if(n){const d=await n.readNext();if(!d)return null;this.packetBuffers.delete(e);const h=this.createEncodedPacket(d.packet,d.duration,r);return this.packetBuffers.set(h,n),this.packetSectionStarts.set(h,d.packet.sectionStartPos),h}const i=this.packetSectionStarts.get(e);if(i===void 0)throw new Error("Packet was not created from this track.");const o=await this.elementaryStream.demuxer.readSection(i,!0);pe(o);const s=od(o);pe(s);const u=new sd(this,s,!0);n=new dg(this,u);const f=e.sequenceNumber;for(;;){const d=await n.readNext();if(!d)return null;if(d.packet.sequenceNumber>f){const h=this.createEncodedPacket(d.packet,d.duration,r);return this.packetBuffers.set(h,n),this.packetSectionStarts.set(h,d.packet.sectionStartPos),h}}}async getNextKeyPacket(e,r){let n=e;for(;;){if(n=await this.getNextPacket(n,r),!n)return null;if(n.type==="key")return n}}getPacket(e,r){return this.doPacketLookup(e,!1,r)}getKeyPacket(e,r){return this.doPacketLookup(e,!0,r)}async doPacketLookup(e,r,n){const i=Pp(e*Rs),a=this.elementaryStream.demuxer,o=a.reader,s=await this.mutex.acquire();let u;try{if(this.referencePesPackets.length===0){const S=this.elementaryStream.firstSection;pe(S);const P=Yf(S);pe(P),this.maybeInsertReferencePacket(P,!1,!1),pe(this.referencePesPackets.length===1)}let x=or(this.referencePesPackets,i,S=>S.pts);if(x===-1)return null;if(o.fileSize!==null&&x===this.referencePesPackets.length-1&&!this.endReferencePesPacketAdded){let S=o.fileSize-a.packetStride+a.packetOffset,P=await a.readPacketHeader(S);if(!P)return null;for(;P.pid!==this.elementaryStream.pid||P.payloadUnitStartIndicator===0;){S-=a.packetStride;const A=await a.readPacketHeader(S);if(!A)return null;P=A}const _=await a.readSection(S,!1);pe(_);const E=Yf(_);if(!E)throw new Error(Xf);this.maybeInsertReferencePacket(E,!0,!1),this.endReferencePesPacketAdded=!0}for(x=or(this.referencePesPackets,i,S=>S.pts),pe(x!==-1);o.fileSize!==null;){const S=this.referencePesPackets[x],P=this.referencePesPackets[x+1];if(i-S.pts<Rs||!P)break;let E=Jk((S.sectionStartPos+P.sectionStartPos)/2,a.packetStride)+a.packetOffset,A=await a.readPacketHeader(E);for(pe(A);E<P.sectionStartPos&&(A.pid!==this.elementaryStream.pid||A.payloadUnitStartIndicator===0);){E+=a.packetStride;const R=await a.readPacketHeader(E);if(!R)return null;A=R}if(E>=P.sectionStartPos)break;const T=await a.readSection(E,!1);pe(T);const I=Yf(T);if(!I)throw new Error(Xf);if(!this.maybeInsertReferencePacket(I,!1,!1))break;I.pts<=i&&x++}u=this.referencePesPackets[x],pe(u.pts<=i)}finally{s()}s();e:for(;;){let x=u.sectionStartPos+a.packetStride;for(;;){const P=await a.readPacketHeader(x);if(!P)break e;if(P.pid===this.elementaryStream.pid&&P.payloadUnitStartIndicator===1)break;x+=a.packetStride}const k=await a.readSection(x,!1);if(!k)break;const S=Yf(k);if(!S)throw new Error(Xf);if(S.pts>i)break;u=S,o.fileSize===null&&this.maybeInsertReferencePacket(S,!1,!0)}const f=this.getReorderSize();for(let x=0;x<f;x++){let k=u.sectionStartPos-a.packetStride;for(;;){const S=await a.readPacketHeader(k);if(!S)break;if(S.pid===this.elementaryStream.pid&&S.payloadUnitStartIndicator===1){const P=await a.readSection(k,!1);pe(P);const _=Yf(P);if(!_)throw new Error(Xf);u=_;break}k-=a.packetStride}}const d=await a.readSection(u.sectionStartPos,!0);pe(d);const h=od(d);pe(h);const p=new sd(this,h,!0),y=new dg(this,p);for(;!((ni(y.presentationOrderPackets)?.pts??-1/0)>=i||!await y.readNextDecodeOrderPacket()););const v=Q2(y.presentationOrderPackets,x=>x.pts<=i&&(!r||this.getPacketType(x.data)==="key"));if(v!==-1){const x=y.presentationOrderPackets[v],k=v===0?0:x.pts-y.presentationOrderPackets[v-1].pts;for(;y.decodeOrderPackets[0]!==x;)y.decodeOrderPackets.shift();y.lastDuration=k;const S=await y.readNext();pe(S);const P=this.createEncodedPacket(S.packet,S.duration,n);return this.packetBuffers.set(P,y),this.packetSectionStarts.set(P,S.packet.sectionStartPos),P}if(!r)return null;let b=u.sectionStartPos;for(;;){b-=a.packetStride;const x=await a.readPacketHeader(b);if(!x)return null;if(x.pid!==this.elementaryStream.pid||x.payloadUnitStartIndicator!==1)continue;const k=await a.readSection(b,!0);pe(k);const S=od(k);if(!S)throw new Error(Xf);const P=new sd(this,S,!1);if(await this.markNextPacket(P),!P.suppliedPacket||this.getPacketType(P.suppliedPacket.data)!=="key")continue;P.uncapped=!0;const _=new dg(this,P),E=await _.readNext();pe(E);const A=this.createEncodedPacket(E.packet,E.duration,n);return this.packetBuffers.set(A,_),this.packetSectionStarts.set(A,E.packet.sectionStartPos),A}}}class xM extends D8{constructor(e){super(e),this.elementaryStream=e,this.decoderConfig={codec:Z2({width:this.elementaryStream.info.width,height:this.elementaryStream.info.height,codec:this.elementaryStream.info.codec,codecDescription:null,colorSpace:this.elementaryStream.info.colorSpace,avcType:1,avcCodecInfo:this.elementaryStream.info.avcCodecInfo,hevcCodecInfo:this.elementaryStream.info.hevcCodecInfo,vp9CodecInfo:null,av1CodecInfo:null}),codedWidth:this.elementaryStream.info.width,codedHeight:this.elementaryStream.info.height,colorSpace:this.elementaryStream.info.colorSpace}}getCodec(){return this.elementaryStream.info.codec}getCodedWidth(){return this.elementaryStream.info.width}getCodedHeight(){return this.elementaryStream.info.height}getRotation(){return 0}async getColorSpace(){return this.elementaryStream.info.colorSpace}async canBeTransparent(){return!1}async getDecoderConfig(){return this.decoderConfig}getPacketType(e){return tb(this.elementaryStream.info.codec,this.decoderConfig,e)??"key"}getReorderSize(){return this.elementaryStream.info.reorderSize}async markNextPacket(e){pe(!e.suppliedPacket);const r=this.elementaryStream.info.codec,n=1024;if(r!=="avc"&&r!=="hevc")throw new Error("Unhandled.");let i=null;for(;;){let a=e.ensureBuffered(n);if(a instanceof Promise&&(a=await a),a===0)break;const o=e.currentPos,s=e.readBytes(a),u=s.byteLength;let f=0;for(;f<u;){const d=s.indexOf(0,f);if(d===-1||d>=u)break;f=d;const h=o+f;if(f+4>=u){e.seekTo(h);break}const p=s[f+1],y=s[f+2],v=s[f+3];let b=0,x=null;if(p===0&&y===0&&v===1?(b=4,x=s[f+4]):p===0&&y===1&&(b=3,x=v),b===0){f++;continue}const k=h;if(i===null){i=k,f+=b;continue}if(x!==null){const S=r==="avc"?O0(x):Ep(x);if(r==="avc"?S===jo.AUD:S===ti.AUD_NUT){const _=k-i;return e.seekTo(i),e.supplyPacket(_,0)}}f+=b}if(a<n)break}if(i!==null){const a=e.endPos-i;return e.seekTo(i),e.supplyPacket(a,0)}}}class SM extends D8{constructor(e){super(e),this.elementaryStream=e}getCodec(){return this.elementaryStream.info.codec}getNumberOfChannels(){return this.elementaryStream.info.numberOfChannels}getSampleRate(){return this.elementaryStream.info.sampleRate}async getDecoderConfig(){return{codec:J2({codec:this.elementaryStream.info.codec,codecDescription:null,aacCodecInfo:this.elementaryStream.info.aacCodecInfo}),numberOfChannels:this.elementaryStream.info.numberOfChannels,sampleRate:this.elementaryStream.info.sampleRate}}getPacketType(e){return"key"}getReorderSize(){return 1}async markNextPacket(e){pe(!e.suppliedPacket);const r=this.elementaryStream.info.codec,n=128;for(;;){let i=e.ensureBuffered(n);i instanceof Promise&&(i=await i);const a=e.currentPos;for(;e.currentPos-a<i;){const o=e.readU8();if(r==="aac"){if(o!==255)continue;e.skip(-1);const s=e.currentPos;let u=e.ensureBuffered(hd);if(u instanceof Promise&&(u=await u),u<hd)return;const f=e.readBytes(hd),d=Op(Ks.tempFromBytes(f));if(d){e.seekTo(s);let h=e.ensureBuffered(d.frameLength);return h instanceof Promise&&(h=await h),e.supplyPacket(h,Math.round(e0*Rs/this.elementaryStream.info.sampleRate))}else e.seekTo(s+1)}else if(r==="mp3"){if(o!==255)continue;e.skip(-1);const s=e.currentPos;let u=e.ensureBuffered(up);if(u instanceof Promise&&(u=await u),u<up)return;const f=e.readBytes(up),d=Fr(f).getUint32(0),h=ob(d,null);if(h.header){e.seekTo(s);let p=e.ensureBuffered(h.header.totalSize);p instanceof Promise&&(p=await p);const y=h.header.audioSamplesInFrame*Rs/this.elementaryStream.info.sampleRate;return e.supplyPacket(p,Math.round(y))}else e.seekTo(s+1)}else throw new Error("Unhandled.")}if(i<n)break}}}class sd{constructor(e,r,n){this.currentPos=0,this.pesPackets=[],this.currentPesPacketIndex=0,this.currentPesPacketPos=0,this.endPos=0,this.nextPts=0,this.suppliedPacket=null,this.backing=e,this.pid=e.elementaryStream.pid,this.demuxer=e.elementaryStream.demuxer,this.startingPesPacket=r,this.uncapped=n}clone(){const e=new sd(this.backing,this.startingPesPacket,!0);return e.currentPos=this.currentPos,e.pesPackets=[...this.pesPackets],e.currentPesPacketIndex=this.currentPesPacketIndex,e.currentPesPacketPos=this.currentPesPacketPos,e.endPos=this.endPos,e.nextPts=this.nextPts,e}ensureBuffered(e){const r=this.endPos-this.currentPos;return r>=e?e:this.bufferData(e-r).then(()=>Math.min(this.endPos-this.currentPos,e))}getCurrentPesPacket(){const e=this.pesPackets[this.currentPesPacketIndex];return pe(e),e}async bufferData(e){const r=this.endPos+e;for(;this.endPos<r;){let n;if(this.pesPackets.length===0)n=this.startingPesPacket;else{let i=ni(this.pesPackets).sectionEndPos;for(pe(i!==null);;){const s=await this.demuxer.readPacketHeader(i);if(!s)return;if(s.pid===this.pid)break;i+=this.demuxer.packetStride}const a=await this.demuxer.readSection(i,!0);if(!a)return;const o=od(a);if(!o)throw new Error(Xf);n=o}this.pesPackets.push(n),this.endPos+=n.data.byteLength,this.pesPackets.length===1&&(this.nextPts=n.pts)}}readBytes(e){const r=this.getCurrentPesPacket(),n=this.currentPos-this.currentPesPacketPos,i=n+e;if(this.currentPos+=e,i<=r.data.byteLength)return r.data.subarray(n,i);const a=new Uint8Array(e);a.set(r.data.subarray(n));let o=r.data.byteLength-n;for(;;){this.advanceCurrentPacket();const s=this.getCurrentPesPacket(),u=e-o;if(u<=s.data.byteLength){a.set(s.data.subarray(0,u),o);break}a.set(s.data,o),o+=s.data.byteLength}return a}readU8(){let e=this.getCurrentPesPacket();const r=this.currentPos-this.currentPesPacketPos;return this.currentPos++,r<e.data.byteLength?e.data[r]:(this.advanceCurrentPacket(),e=this.getCurrentPesPacket(),e.data[0])}seekTo(e){if(e!==this.currentPos){if(e<this.currentPos)for(;e<this.currentPesPacketPos;){this.currentPesPacketIndex--;const r=this.getCurrentPesPacket();this.currentPesPacketPos-=r.data.byteLength,this.nextPts=r.pts}else for(;;){const r=this.getCurrentPesPacket(),n=this.currentPesPacketPos+r.data.byteLength;if(e<n)break;this.currentPesPacketPos+=r.data.byteLength,this.currentPesPacketIndex++,this.nextPts=this.getCurrentPesPacket().pts}this.currentPos=e}}skip(e){this.seekTo(this.currentPos+e)}advanceCurrentPacket(){this.currentPesPacketPos+=this.getCurrentPesPacket().data.byteLength,this.currentPesPacketIndex++,this.nextPts=this.getCurrentPesPacket().pts}supplyPacket(e,r){const n=this.getCurrentPesPacket();if(!this.uncapped&&n!==this.startingPesPacket){this.suppliedPacket=null;return}this.backing.maybeInsertReferencePacket(n,!1,!0);const i=this.nextPts;this.nextPts+=r;const a=n.sectionStartPos,o=a+(this.currentPos-this.currentPesPacketPos),s=this.readBytes(e);this.suppliedPacket={pts:i,data:s,sequenceNumber:o,sectionStartPos:a},this.pesPackets.splice(0,this.currentPesPacketIndex),this.currentPesPacketIndex=0}}class dg{constructor(e,r){this.decodeOrderPackets=[],this.reorderBuffer=[],this.presentationOrderPackets=[],this.reachedEnd=!1,this.lastDuration=0,this.backing=e,this.context=r,this.reorderSize=e.getReorderSize(),pe(this.reorderSize>=0)}async readNext(){if(this.decodeOrderPackets.length===0&&!await this.readNextDecodeOrderPacket())return null;await this.ensureCurrentPacketHasNext();const e=this.decodeOrderPackets[0],r=this.presentationOrderPackets.indexOf(e);pe(r!==-1);let n;for(r===this.presentationOrderPackets.length-1?n=this.lastDuration:(n=this.presentationOrderPackets[r+1].pts-e.pts,this.lastDuration=n),this.decodeOrderPackets.shift();this.presentationOrderPackets.length>0;){const i=this.presentationOrderPackets[0];if(this.decodeOrderPackets.includes(i))break;this.presentationOrderPackets.shift()}return{packet:e,duration:n}}async readNextDecodeOrderPacket(){if(this.reachedEnd)return!1;let e;return this.context.suppliedPacket?e=this.context.suppliedPacket:(await this.backing.markNextPacket(this.context),e=this.context.suppliedPacket),this.context.suppliedPacket=null,e?(this.decodeOrderPackets.push(e),this.processPacketThroughReorderBuffer(e),!0):(this.reachedEnd=!0,this.flushReorderBuffer(),!1)}async ensureCurrentPacketHasNext(){const e=this.decodeOrderPackets[0];for(pe(e);;){const r=this.presentationOrderPackets.indexOf(e);if(r!==-1&&r<=this.presentationOrderPackets.length-2||!await this.readNextDecodeOrderPacket())break}}processPacketThroughReorderBuffer(e){if(this.reorderBuffer.push(e),this.reorderBuffer.length>=this.reorderSize){let r=0;for(let i=1;i<this.reorderBuffer.length;i++)this.reorderBuffer[i].pts<this.reorderBuffer[r].pts&&(r=i);const n=this.reorderBuffer.splice(r,1)[0];this.presentationOrderPackets.push(n)}}flushReorderBuffer(){this.reorderBuffer.sort((e,r)=>e.pts-r.pts),this.presentationOrderPackets.push(...this.reorderBuffer),this.reorderBuffer.length=0}}class rl{}class N8 extends rl{async _getMajorBrand(e){let r=e._reader.requestSlice(0,12);return r instanceof Promise&&(r=await r),!r||(r.skip(4),Vn(r,4)!=="ftyp")?null:Vn(r,4)}_createDemuxer(e){return new AR(e)}}class kM extends N8{async _canReadInput(e){const r=await this._getMajorBrand(e);return!!r&&r!=="qt "}get name(){return"MP4"}get mimeType(){return"video/mp4"}}class _M extends N8{async _canReadInput(e){return await this._getMajorBrand(e)==="qt "}get name(){return"QuickTime File Format"}get mimeType(){return"video/quicktime"}}class L8 extends rl{async isSupportedEBMLOfDocType(e,r){let n=e._reader.requestSlice(0,Bs);if(n instanceof Promise&&(n=await n),!n)return!1;const i=E8(n);if(i===null||i<1||i>8||Vt(n,i)!==je.EBML)return!1;const o=T8(n);if(typeof o!="number")return!1;let s=e._reader.requestSlice(n.filePos,o);if(s instanceof Promise&&(s=await s),!s)return!1;const u=n.filePos;for(;s.filePos<=u+o-Pa;){const f=Ds(s);if(!f)break;const{id:d,size:h}=f,p=s.filePos;if(h===void 0)return!1;switch(d){case je.EBMLVersion:if(Vt(s,h)!==1)return!1;break;case je.EBMLReadVersion:if(Vt(s,h)!==1)return!1;break;case je.DocType:if(Gf(s,h)!==r)return!1;break;case je.DocTypeVersion:if(Vt(s,h)>4)return!1;break}s.filePos=p+h}return!0}_canReadInput(e){return this.isSupportedEBMLOfDocType(e,"matroska")}_createDemuxer(e){return new jR(e)}get name(){return"Matroska"}get mimeType(){return"video/x-matroska"}}class PM extends L8{_canReadInput(e){return this.isSupportedEBMLOfDocType(e,"webm")}get name(){return"WebM"}get mimeType(){return"video/webm"}}class EM extends rl{async _canReadInput(e){let r=e._reader.requestSlice(0,10);if(r instanceof Promise&&(r=await r),!r)return!1;let n=0,i=!1;for(;;){let f=e._reader.requestSlice(n,Zg);if(f instanceof Promise&&(f=await f),!f)break;const d=Jg(f);if(!d)break;i=!0,n=f.filePos+d.size}const a=await o2(e._reader,n,n+4096);if(!a)return!1;if(i)return!0;n=a.startPos+a.header.totalSize;const o=await o2(e._reader,n,n+up);if(!o)return!1;const s=a.header,u=o.header;return!(s.channel!==u.channel||s.sampleRate!==u.sampleRate)}_createDemuxer(e){return new QR(e)}get name(){return"MP3"}get mimeType(){return"audio/mpeg"}}class TM extends rl{async _canReadInput(e){let r=e._reader.requestSlice(0,12);if(r instanceof Promise&&(r=await r),!r)return!1;const n=Vn(r,4);return n!=="RIFF"&&n!=="RIFX"&&n!=="RF64"?!1:(r.skip(4),Vn(r,4)==="WAVE")}_createDemuxer(e){return new sM(e)}get name(){return"WAVE"}get mimeType(){return"audio/wav"}}class CM extends rl{async _canReadInput(e){let r=e._reader.requestSlice(0,4);return r instanceof Promise&&(r=await r),r?Vn(r,4)==="OggS":!1}_createDemuxer(e){return new aM(e)}get name(){return"Ogg"}get mimeType(){return"application/ogg"}}class OM extends rl{async _canReadInput(e){let r=e._reader.requestSlice(0,4);return r instanceof Promise&&(r=await r),r?Vn(r,4)==="fLaC":!1}get name(){return"FLAC"}get mimeType(){return"audio/flac"}_createDemuxer(e){return new yM(e)}}class AM extends rl{async _canReadInput(e){let r=e._reader.requestSliceRange(0,s2,hd);if(r instanceof Promise&&(r=await r),!r)return!1;const n=Op(r);if(!n||(r=e._reader.requestSliceRange(n.frameLength,s2,hd),r instanceof Promise&&(r=await r),!r))return!1;const i=Op(r);return i?n.objectType===i.objectType&&n.samplingFrequencyIndex===i.samplingFrequencyIndex&&n.channelConfiguration===i.channelConfiguration:!1}_createDemuxer(e){return new uM(e)}get name(){return"ADTS"}get mimeType(){return"audio/aac"}}class IM extends rl{async _canReadInput(e){const r=Ji+16+1;let n=e._reader.requestSlice(0,r);if(n instanceof Promise&&(n=await n),!n)return!1;const i=It(n,r);return i[0]===71&&i[Ji]===71||i[0]===71&&i[Ji+16]===71?!0:i[4]===71&&i[4+Ji]===71}_createDemuxer(e){return new wM(e)}get name(){return"MPEG Transport Stream"}get mimeType(){return"video/MP2T"}}const RM=new kM,MM=new _M,DM=new L8,NM=new PM,LM=new EM,FM=new TM,BM=new CM,zM=new AM,jM=new OM,UM=new IM,HM=[RM,MM,DM,NM,FM,BM,jM,LM,zM,UM];class sb{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){if(this._disposed)throw new ra;return this._sizePromise??=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new ra;const e=await this.getSizeOrNull();if(e===null)throw new Error("Cannot determine the size of an unsized source.");return e}}class vx extends sb{constructor(e){if(!(e instanceof ArrayBuffer)&&!(typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("buffer must be an ArrayBuffer, SharedArrayBuffer, or ArrayBufferView.");super(),this._onreadCalled=!1,this._bytes=lu(e),this._view=Fr(e)}_retrieveSize(){return this._bytes.byteLength}_read(){return this._onreadCalled||(this.onread?.(0,this._bytes.byteLength),this._onreadCalled=!0),{bytes:this._bytes,view:this._view,offset:0}}_dispose(){}}const F8=.5*2**20,$M=((t,e,r)=>{if(e instanceof Error&&(e.message.includes("Failed to fetch")||e.message.includes("Load failed")||e.message.includes("NetworkError when attempting to fetch resource"))){let i=null;try{typeof window<"u"&&typeof window.location<"u"&&(i=new URL(r instanceof Request?r.url:r,window.location.href).origin)}catch{}if((typeof navigator<"u"&&typeof navigator.onLine=="boolean"?navigator.onLine:!0)&&i!==null&&i!==window.location.origin)return console.warn("Request will not be retried because a CORS error was suspected due to different origins. You can modify this behavior by providing your own function for the 'getRetryDelay' option."),null}return Math.min(2**(t-2),16)});class qM extends sb{constructor(e,r={}){if(typeof e!="string"&&!(e instanceof URL)&&!(typeof Request<"u"&&e instanceof Request))throw new TypeError("url must be a string, URL or Request.");if(!r||typeof r!="object")throw new TypeError("options must be an object.");if(r.requestInit!==void 0&&(!r.requestInit||typeof r.requestInit!="object"))throw new TypeError("options.requestInit, when provided, must be an object.");if(r.getRetryDelay!==void 0&&typeof r.getRetryDelay!="function")throw new TypeError("options.getRetryDelay, when provided, must be a function.");if(r.maxCacheSize!==void 0&&(!n8(r.maxCacheSize)||r.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(r.fetchFn!==void 0&&typeof r.fetchFn!="function")throw new TypeError("options.fetchFn, when provided, must be a function.");super(),this._existingResponses=new WeakMap,this._url=e,this._options=r,this._getRetryDelay=r.getRetryDelay??$M,this._orchestrator=new WM({maxCacheSize:r.maxCacheSize??64*2**20,maxWorkerCount:2,runWorker:this._runWorker.bind(this),prefetchProfile:VM.network})}async _retrieveSize(){const e=new AbortController,r=await ix(this._options.fetchFn??fetch,this._url,rx(this._options.requestInit??{},{headers:{Range:"bytes=0-"},signal:e.signal}),this._getRetryDelay,()=>this._disposed);if(!r.ok)throw new Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);let n,i;if(r.status===206)i=this._getTotalLengthFromRangeResponse(r),n=this._orchestrator.createWorker(0,Math.min(i,F8));else{const a=r.headers.get("Content-Length");if(a)i=Number(a),n=this._orchestrator.createWorker(0,i),this._orchestrator.options.maxCacheSize=1/0,console.warn("HTTP server did not respond with 206 Partial Content, meaning the entire remote resource now has to be downloaded. For efficient media file streaming across a network, please make sure your server supports range requests.");else throw new Error(`HTTP response (status ${r.status}) must surface Content-Length header.`)}return this._orchestrator.fileSize=i,this._existingResponses.set(n,{response:r,abortController:e}),this._orchestrator.runWorker(n),i}_read(e,r){return this._orchestrator.read(e,r)}async _runWorker(e){for(;;){const r=this._existingResponses.get(e);this._existingResponses.delete(e);let n=r?.abortController,i=r?.response;if(n||(n=new AbortController,i=await ix(this._options.fetchFn??fetch,this._url,rx(this._options.requestInit??{},{headers:{Range:`bytes=${e.currentPos}-`},signal:n.signal}),this._getRetryDelay,()=>this._disposed)),pe(i),!i.ok)throw new Error(`Error fetching ${String(this._url)}: ${i.status} ${i.statusText}`);if(e.currentPos>0&&i.status!==206)throw new Error("HTTP server did not respond with 206 Partial Content to a range request. To enable efficient media file streaming across a network, please make sure your server supports range requests.");if(!i.body)throw new Error("Missing HTTP response body stream. The used fetch function must provide the response body as a ReadableStream.");const a=i.body.getReader();for(;;){if(e.currentPos>=e.targetPos||e.aborted){n.abort(),e.running=!1;return}let o;try{o=await a.read()}catch(f){if(this._disposed)throw f;const d=this._getRetryDelay(1,f,this._url);if(d!==null){console.error("Error while reading response stream. Attempting to resume.",f),await new Promise(h=>setTimeout(h,1e3*d));break}else throw f}if(e.aborted)continue;const{done:s,value:u}=o;if(s){if(e.currentPos>=e.targetPos){this._orchestrator.forgetWorker(e),e.running=!1;return}break}this.onread?.(e.currentPos,e.currentPos+u.length),this._orchestrator.supplyWorkerData(e,u)}}}_getTotalLengthFromRangeResponse(e){const r=e.headers.get("Content-Range");if(r){const i=/\/(\d+)/.exec(r);if(i)return Number(i[1])}const n=e.headers.get("Content-Length");if(n)return Number(n);throw new Error("Partial HTTP response (status 206) must surface either Content-Range or Content-Length header.")}_dispose(){this._orchestrator.dispose()}}const VM={network:(t,e,r)=>{t=Math.max(0,Math.floor((t-65536)/65536)*65536);for(const i of r){const o=Math.max((i.startPos+i.targetPos)/2,i.targetPos-8388608);if(e2(t,e,o,i.targetPos)){const s=i.targetPos-i.startPos,u=Math.ceil((s+1)/8388608)*8388608,f=2**Math.ceil(Math.log2(s+1)),d=Math.min(f,u);e=Math.max(e,i.startPos+d)}}return e=Math.max(e,t+F8),{start:t,end:e}}};class WM{constructor(e){this.options=e,this.fileSize=null,this.nextAge=0,this.workers=[],this.cache=[],this.currentCacheSize=0,this.disposed=!1}read(e,r){pe(this.fileSize!==null);const n=this.options.prefetchProfile(e,r,this.workers),i=Math.max(n.start,0),a=Math.min(n.end,this.fileSize);pe(i<=e&&r<=a);let o=null;const s=or(this.cache,e,S=>S.start),u=s!==-1?this.cache[s]:null;u&&u.start<=e&&r<=u.end&&(u.age=this.nextAge++,o={bytes:u.bytes,view:u.view,offset:u.start});const f=or(this.cache,i,S=>S.start),d=o?null:new Uint8Array(r-e);let h=0,p=i;const y=[];if(f!==-1){for(let S=f;S<this.cache.length;S++){const P=this.cache[S];if(P.start>=a)break;if(P.end<=i)continue;const _=Math.max(i,P.start),E=Math.min(a,P.end);if(pe(_<=E),p<_&&y.push({start:p,end:_}),p=E,d){const A=Math.max(e,P.start),T=Math.min(r,P.end);if(A<T){const I=A-e;d.set(P.bytes.subarray(A-P.start,T-P.start),I),I===h&&(h=T-e)}}P.age=this.nextAge++}p<a&&y.push({start:p,end:a})}else y.push({start:i,end:a});if(d&&h>=d.length&&(o={bytes:d,view:Fr(d),offset:e}),y.length===0)return pe(o),o;const{promise:v,resolve:b,reject:x}=ta(),k=[];for(const S of y){const P=Math.max(e,S.start),_=Math.min(r,S.end);P===S.start&&_===S.end?k.push(S):P<_&&k.push({start:P,end:_})}for(const S of y){const P=d&&{start:e,bytes:d,holes:k,resolve:b,reject:x};let _=!1;for(const E of this.workers)if(e2(S.start-131072,S.start,E.currentPos,E.targetPos)){E.targetPos=Math.max(E.targetPos,S.end),_=!0,P&&!E.pendingSlices.includes(P)&&E.pendingSlices.push(P),E.running||this.runWorker(E);break}if(!_){const E=this.createWorker(S.start,S.end);P&&(E.pendingSlices=[P]),this.runWorker(E)}}return o||(pe(d),o=v.then(S=>({bytes:S,view:Fr(S),offset:e}))),o}createWorker(e,r){const n={startPos:e,currentPos:e,targetPos:r,running:!1,aborted:this.disposed,pendingSlices:[],age:this.nextAge++};for(this.workers.push(n);this.workers.length>this.options.maxWorkerCount;){let i=0,a=this.workers[0];for(let o=1;o<this.workers.length;o++){const s=this.workers[o];s.age<a.age&&(i=o,a=s)}if(a.running&&a.pendingSlices.length>0)break;a.aborted=!0,this.workers.splice(i,1)}return n}runWorker(e){pe(!e.running),pe(e.currentPos<e.targetPos),e.running=!0,e.age=this.nextAge++,this.options.runWorker(e).catch(r=>{if(e.running=!1,e.pendingSlices.length>0)e.pendingSlices.forEach(n=>n.reject(r)),e.pendingSlices.length=0;else throw r})}supplyWorkerData(e,r){pe(!e.aborted);const n=e.currentPos,i=n+r.length;this.insertIntoCache({start:n,end:i,bytes:r,view:Fr(r),age:this.nextAge++}),e.currentPos+=r.length,e.targetPos=Math.max(e.targetPos,e.currentPos);for(let a=0;a<e.pendingSlices.length;a++){const o=e.pendingSlices[a],s=Math.max(n,o.start),u=Math.min(i,o.start+o.bytes.length);s<u&&o.bytes.set(r.subarray(s-n,u-n),s-o.start);for(let f=0;f<o.holes.length;f++){const d=o.holes[f];n<=d.start&&i>d.start&&(d.start=i),d.end<=d.start&&(o.holes.splice(f,1),f--)}o.holes.length===0&&(o.resolve(o.bytes),e.pendingSlices.splice(a,1),a--)}for(let a=0;a<this.workers.length;a++){const o=this.workers[a];e===o||o.running||e2(n,i,o.currentPos,o.targetPos)&&(this.workers.splice(a,1),a--)}}forgetWorker(e){const r=this.workers.indexOf(e);pe(r!==-1),this.workers.splice(r,1)}insertIntoCache(e){if(this.options.maxCacheSize===0)return;let r=or(this.cache,e.start,n=>n.start)+1;if(r>0){const n=this.cache[r-1];if(n.end>=e.end)return;if(n.end>e.start){const i=new Uint8Array(e.end-n.start);i.set(n.bytes,0),i.set(e.bytes,e.start-n.start),this.currentCacheSize+=e.end-n.end,n.bytes=i,n.view=Fr(i),n.end=e.end,r--,e=n}else this.cache.splice(r,0,e),this.currentCacheSize+=e.bytes.length}else this.cache.splice(r,0,e),this.currentCacheSize+=e.bytes.length;for(let n=r+1;n<this.cache.length;n++){const i=this.cache[n];if(e.end<=i.start)break;if(e.end>=i.end){this.cache.splice(n,1),this.currentCacheSize-=i.bytes.length,n--;continue}const a=new Uint8Array(i.end-e.start);a.set(e.bytes,0),a.set(i.bytes,i.start-e.start),this.currentCacheSize-=e.end-i.start,e.bytes=a,e.view=Fr(a),e.end=i.end,this.cache.splice(n,1);break}for(;this.currentCacheSize>this.options.maxCacheSize;){let n=0,i=this.cache[0];for(let a=1;a<this.cache.length;a++){const o=this.cache[a];o.age<i.age&&(n=a,i=o)}if(this.currentCacheSize-i.bytes.length<=this.options.maxCacheSize)break;this.cache.splice(n,1),this.currentCacheSize-=i.bytes.length}}dispose(){for(const e of this.workers)e.aborted=!0;this.workers.length=0,this.cache.length=0,this.disposed=!0}}r8();class GM{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||typeof e!="object")throw new TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some(r=>!(r instanceof rl)))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof sb))throw new TypeError("options.source must be a Source.");if(e.source._disposed)throw new Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new XM(e.source)}_getDemuxer(){return this._demuxerPromise??=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const e of this._formats)if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),pe(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const e=await this.getTracks();if(e.length===0)return 0;const r=await Promise.all(e.map(n=>n.getFirstTimestamp()));return Math.min(...r)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter(r=>r.isVideoTrack())}async getAudioTracks(){return(await this.getTracks()).filter(r=>r.isAudioTrack())}async getPrimaryVideoTrack(){return(await this.getTracks()).find(r=>r.isVideoTrack())??null}async getPrimaryAudioTrack(){return(await this.getTracks()).find(r=>r.isAudioTrack())??null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class ra extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}class XM{constructor(e){this.source=e}requestSlice(e,r){if(this.source._disposed)throw new ra;if(e<0||this.fileSize!==null&&e+r>this.fileSize)return null;const n=e+r,i=this.source._read(e,n);return i instanceof Promise?i.then(a=>a?new Ks(a.bytes,a.view,a.offset,e,n):null):i?new Ks(i.bytes,i.view,i.offset,e,n):null}requestSliceRange(e,r,n){if(this.source._disposed)throw new ra;if(e<0)return null;if(this.fileSize!==null)return this.requestSlice(e,cd(this.fileSize-e,r,n));{const i=this.requestSlice(e,n),a=o=>{if(o)return o;const s=f=>(pe(f!==null),this.requestSlice(e,cd(f-e,r,n))),u=this.source._retrieveSize();return u instanceof Promise?u.then(s):s(u)};return i instanceof Promise?i.then(a):a(i)}}}class Ks{constructor(e,r,n,i,a){this.bytes=e,this.view=r,this.offset=n,this.start=i,this.end=a,this.bufferPos=i-n}static tempFromBytes(e){return new Ks(e,Fr(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,r=this.end-e){if(e<this.start||e+r>this.end)throw new RangeError("Slicing outside of original slice.");return new Ks(this.bytes,this.view,this.offset,e,e+r)}}const Ui=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},It=(t,e)=>{Ui(t,e);const r=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,r},kt=t=>(Ui(t,1),t.view.getUint8(t.bufferPos++)),Nh=(t,e)=>{Ui(t,2);const r=t.view.getUint16(t.bufferPos,e);return t.bufferPos+=2,r},$n=t=>{Ui(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},Kf=t=>{Ui(t,3);const e=P0(t.view,t.bufferPos,!1);return t.bufferPos+=3,e},l2=t=>{Ui(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},au=(t,e)=>{Ui(t,4);const r=t.view.getUint32(t.bufferPos,e);return t.bufferPos+=4,r},it=t=>{Ui(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},ld=t=>{Ui(t,4);const e=t.view.getUint32(t.bufferPos,!0);return t.bufferPos+=4,e},mc=t=>{Ui(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},YM=t=>{Ui(t,4);const e=t.view.getInt32(t.bufferPos,!0);return t.bufferPos+=4,e},bx=(t,e)=>{let r,n;return e?(r=au(t,!0),n=au(t,!0)):(n=au(t,!1),r=au(t,!1)),n*4294967296+r},Ja=t=>{const e=it(t),r=it(t);return e*4294967296+r},KM=t=>{const e=mc(t),r=it(t);return e*4294967296+r},QM=t=>{const e=ld(t);return YM(t)*4294967296+e},ZM=t=>{Ui(t,4);const e=t.view.getFloat32(t.bufferPos,!1);return t.bufferPos+=4,e},B8=t=>{Ui(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},Vn=(t,e)=>{Ui(t,e);let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t.bytes[t.bufferPos++]);return r},$f=.05,JM=(t,e,r)=>{const[n,i]=Y.useState({input:null,videoSink:null,duration:0,isReady:!1,error:null});Y.useRef(n).current=n;const a=Y.useRef(0),o=Y.useRef(null),s=Y.useRef(null),u=Y.useRef(null),f=Y.useRef(null),d=Y.useRef(null),h=Y.useRef(null),p=Y.useRef(!1),y=Y.useRef(null),v=Y.useRef([]),b=Y.useRef(null),x=Y.useRef(!1),[,k]=Y.useReducer(S=>S+1,0);return Y.useEffect(()=>{if(!r)return;let S=!0;const P=++a.current;let _=null;return(async()=>{try{if(!S||P!==a.current)return;_=Ws(`mediabunny init ${t.id}`);const E=await(async function(N){if((function(F){return F.startsWith("data:")})(N)){const F=(function(H){const $=H.indexOf(",");if($===-1)throw new Error("Invalid data URL format");const X=H.slice($+1),Z=atob(X),K=new Uint8Array(Z.length);for(let q=0;q<Z.length;q++)K[q]=Z.charCodeAt(q);return K.buffer})(N);return new vx(F)}if((function(F){return F.startsWith("file://")})(N))try{const F=await fetch(N),H=await F.arrayBuffer();return new vx(H)}catch(F){throw new Error(`Failed to load file URL: ${N}. File URLs may not be supported in this environment. Error: ${F}`)}return new qM(N)})(t.src);if(!S||P!==a.current)return void(_&&(_(),_=null));const A=new GM({source:E,formats:HM}),T=await A.computeDuration(),I=await A.getPrimaryVideoTrack();if(!I)throw new Error("No video track found");if(I.codec===null)throw new Error("Unsupported video codec");if(!await I.canDecode())throw new Error("Unable to decode the video track");const L=await I.canBeTransparent(),R=new _R(I,{poolSize:5,fit:"contain",alpha:L});if(!S||P!==a.current)return A.dispose(),void(_&&(_(),_=null));_&&(_(),_=null),i(N=>Object.assign(Object.assign({},N),{input:A,videoSink:R,duration:T,isReady:!0,error:null}))}catch(E){if(console.error("Failed to initialize mediabunny:",E),_&&(_(),_=null),S&&P===a.current){const A=`Failed to initialize mediabunny for video ${t.id}: ${E}`;Od(A),i(T=>Object.assign(Object.assign({},T),{error:String(E),isReady:!1}))}}})(),()=>{S=!1,_&&(_(),_=null)}},[t.src,r]),Y.useEffect(()=>()=>{s.current&&(s.current.return(),s.current=null),o.current&&(o.current(),o.current=null),u.current=null,f.current=null,d.current=null,p.current=!1,y.current=null,v.current=[],b.current=null,x.current=!1,i({input:null,videoSink:null,duration:0,isReady:!1,error:null})},[r]),Y.useEffect(()=>{if(!r||!n.isReady||!n.videoSink)return;const S=++a.current,P=typeof t.src=="string"?t.src.slice(0,120):String(t.src),_=(H,$={},X="debug")=>{let Z="";try{Z=JSON.stringify(Object.assign(Object.assign({},$),{timeCalc:h.current}))}catch(q){Z=`[unserializable extras: ${String(q)}]`}const K=`mediabunny event=${H} elementId=${t.id} targetTime=${d.current} duration=${n.duration} lastFrameTimestamp=${f.current} hasIterator=${!!s.current} prefetchSize=${v.current.length} srcHint=${P} extras=${Z}`;X==="error"?console.error(K):X==="warn"?console.warn(K):console.debug(K)},E=H=>{const $=n.duration||0;if(!$||!Number.isFinite($))return H;const X=$>$f?$-$f:$;return Math.max(0,Math.min(H,X))},A=H=>{const $=n.duration||0;return!(!$||!Number.isFinite($))&&$-H<=.050001000000000004},T=H=>{let $=u.current;$&&$.width===H.canvas.width&&$.height===H.canvas.height||($||($=document.createElement("canvas"),u.current=$),$.width=H.canvas.width,$.height=H.canvas.height);const X=$.getContext("2d");X&&(X.clearRect(0,0,$.width,$.height),X.drawImage(H.canvas,0,0)),f.current=H.timestamp},I=H=>{const $=s.current;$&&(x.current||(x.current=!0,b.current=(async()=>{try{for(;v.current.length<4&&H===a.current;){const X=await $.next();if(H!==a.current)return;if(X.done||!X.value)break;v.current.push({timestamp:X.value.timestamp,frame:X.value})}}catch{}finally{x.current=!1,b.current=null}})()))},L=H=>{const $=v.current;for(let X=0;X<$.length;X++)if(Math.abs($[X].timestamp-H)<$f){const Z=$[X];return v.current=$.slice(X+1),Z}return null},R=()=>{v.current=[]},N=async(H,$,X=0)=>{const Z=E(H),K=(q=>{const J=f.current;return J===null||q<J-$f||q>J+.5})(Z)?"seek":"iterate";try{const q=n.videoSink,J=f.current;if(J!==null&&Math.abs(J-Z)<$f)return void(d.current=H);const U=L(Z);if(U)return T(U.frame),d.current=H,I($),void k();if(b.current){await b.current;const D=L(Z);if(D)return T(D.frame),d.current=H,I($),void k()}if(R(),K==="seek"){s.current&&(await s.current.return(),s.current=null);const D=q.canvases(Z);s.current=D;const W=await D.next();if($!==a.current)return void(s.current&&(await s.current.return(),s.current=null));if(W.done||!W.value){if(A(Z)||_("iterator_exhausted",{mode:K,requestedTargetTime:H,clampedTargetTime:Z},"warn"),$===a.current&&!A(Z))try{s.current&&(await s.current.return(),s.current=null),R();const V=q.canvases(Z);s.current=V;const ee=await V.next();!ee.done&&ee.value&&(T(ee.value),I($),d.current=H,k())}catch{}return}T(W.value),I($)}else{const D=s.current;if(!D)return;let W=!1;for(;$===a.current;){const V=await D.next();if($!==a.current)break;if(V.done||!V.value){if(A(Z)||_("iterator_exhausted",{mode:K,requestedTargetTime:H,clampedTargetTime:Z},"warn"),!W&&!A(Z)){W=!0;try{s.current&&(await s.current.return(),s.current=null),R();const te=q.canvases(Z);s.current=te;const Q=await te.next();if($!==a.current||Q.done||!Q.value)break;T(Q.value),I($);break}catch{break}}break}const ee=V.value;if(T(ee),Math.abs(ee.timestamp-Z)<$f){I($);break}if(ee.timestamp>Z){I($);break}}}d.current=H,k()}catch(q){const J=q instanceof Error?{name:q.name,message:q.message,stack:q.stack}:{message:String(q)},U=q instanceof Error?`${q.name}: ${q.message}`:String(q),D=U.includes("Unsupported configuration")||U.includes("isConfigSupported")||U.includes("OperationError");if(_("frame_process_failed",{mode:K,requestedTargetTime:H,clampedTargetTime:Z,unsupportedConfigAttempt:X,isUnsupportedConfig:D,error:J},"error"),D&&X<1)try{s.current&&(await s.current.return(),s.current=null),R(),b.current=null,x.current=!1,f.current=null,await N(H,$,X+1)}catch{}}},F=io(()=>{const H=n.videoSink,$=n.duration;if(!H||!$)return;const X=t.startTime*$*1e3,Z=$*(t.endTime-t.startTime)*1e3,K=((e.currentTime||t.page.startTime)-t.page.startTime)%Z+X,q=K/1e3,J=E(q);h.current={pageStartTime:t.page.startTime,storeCurrentTime:e.currentTime,offsetMs:X,durationMs:Z,restMs:K,targetTime:q,clampedTargetTime:J,startTime:t.startTime,endTime:t.endTime,videoDuration:$},((U,D)=>{p.current?y.current=U:(p.current=!0,o.current||(o.current=Ws(`mediabunny video frame ${t.id}`)),(async()=>{let W=U;for(;W!==null&&D===a.current;)await N(W,D),W=y.current,y.current=null;o.current&&(o.current(),o.current=null),p.current=!1})())})(J,S)});return()=>{F(),a.current++,o.current&&(o.current(),o.current=null)}},[r,n.isReady,n.videoSink,n.duration,e,t]),r&&n.isReady?u.current:null};function pd(){return document.createElement("canvas")}const z8=new window.Image;z8.src=tl(`
259
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
260
+ <path opacity="0.6" d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" fill="white"/>
261
+ <path d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
262
+ </svg>
263
+ `);const j8=new window.Image;j8.src=tl(`
264
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
265
+ <path opacity="0.6" d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" fill="white"/>
266
+ <path opacity="0.6" d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" fill="white"/>
267
+ <path d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
268
+ <path d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
269
+ </svg>
270
+ `);const U8=(t,e,r,n,i=0,a=!1)=>{const o=Math.floor(Math.max(t.width*n,1)),s=Math.floor(Math.max(t.height*n,1)),u=Math.min(i*n,o/2,s/2),f=Math.max(t.width/r.width,t.height/r.height)*n,d=t.page._exportingOrRendering&&lr.imageDownScalingEnabled&&f<1&&!a,h=e instanceof HTMLVideoElement?e.videoWidth:e?.width,p=e instanceof HTMLVideoElement?e.videoHeight:e?.height,y=r.x===0&&r.y===0&&r.width===h&&r.height===p,v=Y.useMemo(()=>{if(e&&h&&p)return y&&u===0&&!d?void 0:pd()},[e,u,d,y,h,p]),b=()=>{if(!v||!e)return;v.width=o,v.height=s;const x=v.getContext("2d");if(!x)return;u&&(x.beginPath(),x.moveTo(u,0),x.lineTo(o-u,0),x.arc(o-u,u,u,3*Math.PI/2,0,!1),x.lineTo(o,s-u),x.arc(o-u,s-u,u,0,Math.PI/2,!1),x.lineTo(u,s),x.arc(u,s-u,u,Math.PI/2,Math.PI,!1),x.lineTo(0,u),x.arc(u,u,u,Math.PI,3*Math.PI/2,!1),x.clip());const k=d?(function(P,_){var E,A;const T=pd(),I=P instanceof HTMLVideoElement?P.videoWidth:P.width,L=P instanceof HTMLVideoElement?P.videoHeight:P.height;T.width=I,T.height=L,(E=T.getContext("2d"))===null||E===void 0||E.drawImage(P,0,0,T.width,T.height);const R=(function(N,F,H,$,X,Z,K){for(var q=new ImageData(F,H),J=new Int32Array(N.data.buffer),U=N.width,D=new Int32Array(q.data.buffer),W=q.width,V=F/Z,ee=H/K,te=Math.round(1/V),Q=Math.round(1/ee),ne=te*Q,ue=0;ue<q.height;ue++)for(var oe=0;oe<W;oe++){for(var de=0+Math.round(oe/V)+(0+Math.round(ue/ee))*U,Ee=0,Fe=0,Le=0,$e=0,Xe=0;Xe<Q;Xe++)for(var dt=0;dt<te;dt++){var ke=J[de+dt+Xe*U];Ee+=ke<<24>>>24,Fe+=ke<<16>>>24,Le+=ke<<8>>>24,$e+=ke>>>24}Ee=Math.round(Ee/ne),Fe=Math.round(Fe/ne),Le=Math.round(Le/ne),$e=Math.round($e/ne),D[oe+ue*W]=$e<<24|Le<<16|Fe<<8|Ee}return q})(T.getContext("2d").getImageData(0,0,T.width,T.height),Math.floor(T.width*_),Math.floor(T.height*_),0,0,T.width,T.height);return T.width=Math.floor(T.width*_),T.height=Math.floor(T.height*_),(A=T.getContext("2d"))===null||A===void 0||A.putImageData(R,0,0),T})(e,f):e,S=d?{x:Math.floor(r.x*f),y:Math.floor(r.y*f),width:Math.floor(r.width*f),height:Math.floor(r.height*f)}:r;x.drawImage(k,S.x,S.y,S.width,S.height,0,0,v.width,v.height)};return Y.useLayoutEffect(()=>{b()},[v,t.width,t.height,r.x,r.y,r.width,r.height,i,n,a,t.page._exportingOrRendering,d]),Y.useEffect(()=>()=>{v&&v.nodeName==="CANVAS"&&_t.Util.releaseCanvas(v)},[v]),[v||e,b]},eD=pd(),tD=Sr(({element:t})=>{const e=Math.min(30,t.width/4,t.height/4),r=Y.useRef(null);return Y.useEffect(()=>{const n=r.current;if(!n)return;const i=new _t.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}}),Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},Y.createElement(ur,{width:t.width,height:t.height,fill:"rgba(124, 173, 212, 0.8)"}),Y.createElement(A2,{ref:r,x:t.width/2,y:t.height/2,fill:"white",outerRadius:Math.abs(e),innerRadius:Math.max(1,e-5),angle:270}))}),rD=Sr(({element:t})=>{const e=Math.max(10,Math.min(30,t.width/25));return Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},Y.createElement(ur,{width:t.width,height:t.height,fill:"rgba(223, 102, 102, 0.8)"}),Y.createElement(qo,{text:"Can not load the video...",fontSize:e,width:t.width,height:t.height,align:"center",fill:"white",verticalAlign:"middle",padding:5}))});let nD=function(t,e,r){const n=Y.useRef("loading"),i=Y.useRef(null),[a,o]=Y.useState(0),s=Y.useRef(),u=Y.useRef(),f=Y.useRef();return s.current===t&&u.current===e&&f.current===r||(n.current="loading",i.current=void 0,s.current=t,u.current=e,f.current=r),Y.useLayoutEffect(function(){if(t){var d=document.createElement("video");return d.addEventListener("canplay",h),d.addEventListener("error",p),d.crossOrigin=e,d.src=t,d.load(),function(){d.removeEventListener("canplay",h),d.removeEventListener("error",p)}}function h(){n.current="loaded",i.current=d,i.current.currentTime=0,o(Math.random()),i.current.removeEventListener("canplay",h)}function p(y){var v;const b=d.readyState===4,x=d.buffered&&d.buffered.length>0&&d.buffered.end(d.buffered.length-1)/d.duration*100>=100;if(b&&x)return;const k=y.message||((v=d.error)===null||v===void 0?void 0:v.message)||"Unknown error",S=new Error("Video failed to load: "+k);console.error(S),n.current="failed",i.current=void 0,o(Math.random())}},[t,e,r]),[i.current,n.current]};function wx(t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}const xx=(t,e,r)=>{const n=Y.useRef(),i=()=>{var a;(a=n.current)===null||a===void 0||a.call(n),n.current=void 0};Y.useEffect(()=>i,[]),Y.useLayoutEffect(()=>{const a=e.slice(0,200),o=`video with id ${r} url: ${a}`;t!=="loading"||n.current||(n.current=Ws(o)),t!=="loading"&&i(),t==="failed"&&Od(o)},[t])},iD=Sr(({element:t,store:e})=>{var r;const[n,i]=Y.useState(!1),a=Y.useRef(null),o=Y.useRef(null),s=e.selectedShapes.indexOf(t)>=0&&t.selectable,[u,f]=Y.useState(!1),[d,h]=nD(t.src,"anonymous"),[p,y]=Y.useState(!1),v=e.activePage===t.page,b=t.page._exportingOrRendering&&h==="loaded",x=JM(t,e,b);xx(h,t.src,t.id),d&&(d.playsInline=!0);const k=((se,me,Te)=>{const ae=Y.useMemo(()=>{var xe,Oe;const{flipX:Be,flipY:ct}=se,be=se.type==="svg"||se.src.indexOf("data:image/svg+xml")>=0||se.src.indexOf(".svg")>=0,he=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(!(Be||ct||he&&be))return me;if(!me)return null;const Ve=me instanceof HTMLVideoElement?me.videoWidth:me?.width,le=me instanceof HTMLVideoElement?me.videoHeight:me?.height;if(!Ve||!le)return null;const Ie=pd();let Ye=1;se.type==="svg"&&(Ye=Math.max(se.width/Ve*Te,se.height/le*Te)),Ie.width=Math.max(Ve*Ye,1),Ie.height=Math.max(le*Ye,1);let at=Be?-Ie.width:0,Ze=ct?-Ie.height:0;return(xe=Ie.getContext("2d"))===null||xe===void 0||xe.scale(Be?-1:1,ct?-1:1),(Oe=Ie.getContext("2d"))===null||Oe===void 0||Oe.drawImage(me,at,Ze,Ie.width,Ie.height),Ie},[se.flipX,se.flipY,me,se.width,se.height,Te]);return Y.useEffect(()=>()=>{ae&&ae.nodeName==="CANVAS"&&_t.Util.releaseCanvas(ae)},[ae]),ae})(t,d,e._elementsPixelRatio),S=b&&x||k||eD;Y.useEffect(()=>{d&&e.history.ignore(()=>{t.set({duration:1e3*d.duration})})},[d]),Y.useEffect(()=>{var se;if(!d)return;const me=e.animatedElementsIds,Te=(!me.length||me.includes(t.id))&&e.isPlaying,ae=v&&(Te||u);if(!ae)return void d.pause();ae&&(d.currentTime=t.startTime*d.duration,d.play());const xe=new _t.Animation(()=>{te.current()},(se=a.current)===null||se===void 0?void 0:se.getLayer());xe.start();const Oe=()=>{f(!1),d.currentTime=t.startTime*d.duration},Be=()=>{d.currentTime>=t.endTime*d.duration&&(d.pause(),d.currentTime=t.startTime*d.duration,f(!1))};return d.addEventListener("ended",Oe),d.addEventListener("timeupdate",Be),()=>{d.pause(),xe.stop(),d.removeEventListener("ended",Oe),d.removeEventListener("timeupdate",Be)}},[d,u,e.isPlaying,v]),Y.useEffect(()=>{d&&(d.volume=t.volume)},[d,t.volume]);const P=Y.useRef();Y.useEffect(()=>{const se=io(()=>{var me,Te;if(d){if(b&&x)return ee(),void e.currentTime;const ae=e.animatedElementsIds;if(ae.length&&!ae.includes(t.id))return;const xe=e.currentTime>=t.page.startTime&&e.currentTime<t.page.startTime+t.page.duration,Oe=t.startTime*d.duration*1e3,Be=d.duration*(t.endTime-t.startTime)*1e3;let ct=((e.currentTime||t.page.startTime)-t.page.startTime)%Be+Oe;if(xe||(ct=0),Math.abs(1e3*d.currentTime-ct)>500||!e.isPlaying){const be=ct/1e3;be!==d.currentTime&&(d.currentTime=be),!wx(d)&&!e.isPlaying&&!P.current&&(P.current=Ws(`video ${t.id}`))}te.current(),(Te=(me=a.current)===null||me===void 0?void 0:me.getLayer())===null||Te===void 0||Te.batchDraw()}});return()=>{se(),P.current&&(P.current(),P.current=null)}},[e,d,b,x]),Y.useEffect(()=>{var se;if(!d)return;if(b)return(se=P.current)===null||se===void 0||se.call(P),void(P.current=null);const me=()=>{var ae,xe;!wx(d)&&t.page._exportingOrRendering||P.current&&(te.current(),(xe=(ae=a.current)===null||ae===void 0?void 0:ae.getLayer())===null||xe===void 0||xe.batchDraw(),P.current(),P.current=null)};let Te;return t.page._exportingOrRendering&&(Te=setInterval(me,20)),d.addEventListener("timeupdate",me),d.addEventListener("canplay",me),()=>{clearInterval(Te),d.removeEventListener("timeupdate",me),d.removeEventListener("canplay",me)}},[t.page._exportingOrRendering,d,t.id,Ws,b]);let{cropX:_,cropY:E,cropWidth:A,cropHeight:T}=t;h!=="loaded"&&(_=E=0,A=T=1);const I=(L=S)instanceof HTMLVideoElement?L.videoWidth:L?.width||0;var L;const R=(se=>se instanceof HTMLVideoElement?se.videoHeight:se?.height||0)(S),N=I*A,F=R*T,H=t.width/t.height;let $,X;const Z=N/F,K=t.type==="svg";K?($=N,X=F):H>=Z?($=N,X=N/H):($=F*H,X=F);const q={x:I*_,y:R*E,width:$,height:X},J=(r=t.cornerRadius)!==null&&r!==void 0?r:0,[U,D]=U8(t,S,q,e._elementsPixelRatio,J,!0);let[W,V]=((se,me,Te,ae)=>{const xe=(Ve=>{const[le,Ie]=Y.useState(Ve);return Y.useEffect(()=>{(async()=>{const Ye=await(async function(at){if(!(at.indexOf("data:image/svg+xml")>=0||at.indexOf(".svg")>=0))return at;const Ze=await jp(at),ht=B2(Ze);return tl(ht)})(Ve);Ye!==le&&Ie(Ye)})()},[Ve]),le})(se.clipSrc||""),[Oe,Be]=I2(xe,"anonymous"),ct=se.clipSrc?Be:"loaded";xx(ct,se.clipSrc,se.id);const be=Y.useMemo(()=>{if(me&&Oe)return pd()},[me,Oe]);function he(){var Ve;if(!Oe)return;const le=me instanceof HTMLVideoElement?me.videoWidth:me?.width,Ie=me instanceof HTMLVideoElement?me.videoHeight:me?.height;if(!me||!le||!Ie||!Oe||!Oe.width||!Oe.height||!be)return;const Ye=pd(),at=Math.max(se.width/Oe.width*Te,se.height/Oe.height*Te);Ye.width=Oe.width*at,Ye.height=Oe.height*at,(Ve=Ye.getContext("2d"))===null||Ve===void 0||Ve.drawImage(Oe,0,0,Ye.width,Ye.height),be.width=Math.max(le,1),be.height=Math.max(Ie,1);const Ze=be.getContext("2d");Ze&&(Ze.save(),Ze.drawImage(Ye,0,0,le,Ie),_t.Util.releaseCanvas(Ye),Ze.globalCompositeOperation="source-in",Ze.drawImage(me,0,0,be.width,be.height),Ze.restore())}return Y.useLayoutEffect(()=>{he()},[be,me,Oe,se.width,se.height,Te,...ae]),[se.clipSrc&&Oe?be:me,he]})(t,U,e._elementsPixelRatio,[q,J,e._elementsPixelRatio]);function ee(){var se,me;D(),V(),(me=(se=a.current)===null||se===void 0?void 0:se.getLayer())===null||me===void 0||me.batchDraw()}Y.useEffect(()=>{ee()});const te=Y.useRef(ee);te.current=ee;const Q=Math.max(t.width/$,t.height/X);Y.useEffect(()=>{var se;if(!t._cropModeEnabled)return;const me=(se=a.current)===null||se===void 0?void 0:se.getStage();function Te(xe){t._cropModeEnabled&&xe.target!==o.current&&t.toggleCropMode(!1)}function ae(xe){t._cropModeEnabled&&xe.target.parentNode!==me.content&&t.toggleCropMode(!1)}return document.body.addEventListener("click",ae),me?.on("click",Te),me?.on("tap",Te),()=>{document.body.removeEventListener("click",ae),document.body.removeEventListener("touchstart",ae),me?.off("click",Te),me?.off("click",Te)}},[t._cropModeEnabled]),Y.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled)return Fi(a.current,t),io(()=>{Fi(a.current,t)},{delay:100})},[S,n,A,T,t._cropModeEnabled]),Y.useLayoutEffect(()=>{var se;n||t._cropModeEnabled?(se=a.current)===null||se===void 0||se.clearCache():Fi(a.current,t)},[n,t.width,t.height,t._cropModeEnabled]),Y.useEffect(()=>{Fi(a.current,t)},[t.shadowEnabled,t.shadowBlur,t.cornerRadius,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]);const ne=Y.useRef(null),ue=Y.useRef(null),oe=Y.useRef(null);Y.useLayoutEffect(()=>{t._cropModeEnabled&&(ue.current.nodes([ne.current]),oe.current.nodes([o.current]))},[t._cropModeEnabled]);const de=se=>{Math.round(se.target.x())>0&&(se.target.x(0),se.target.scaleX(1)),Math.round(se.target.y())>0&&(se.target.y(0),se.target.scaleY(1));const me=se.target.width()*se.target.scaleX(),Te=se.target.height()*se.target.scaleY(),ae=Math.min(1,$/me),xe=Math.min(1,X/Te),Oe=1-ae,Be=Math.min(Oe,Math.max(0,Math.round(-se.target.x())/me)),ct=1-xe,be=Math.min(ct,Math.max(0,Math.round(-se.target.y())/Te));se.target.setAttrs({x:-Be*I,y:-be*R,scaleX:1,scaleY:1}),t.set({cropX:Be,cropY:be,cropWidth:ae,cropHeight:xe})},Ee=()=>{t.type!=="svg"&&t.contentEditable&&setTimeout(()=>{t.toggleCropMode(!0)})},Fe=h==="loading",Le=h==="failed",$e=!Fe&&!Le,Xe=Y.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),dt=$e?t.a.opacity:0;Bp(a,dt);const ke=t.selectable||e.role==="admin",ge=wu();return Y.createElement(Y.Fragment,null,Y.createElement(Jt,{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},Fe&&Y.createElement(tD,{element:t}),Le&&Y.createElement(rD,{element:t}),Y.createElement(zo,{ref:a,name:"element",id:t.id,image:W,x:t.a.x,y:t.a.y,width:t.a.width||1,height:t.a.height||1,rotation:t.a.rotation,opacity:dt,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,customCrop:q,listening:ke,draggable:ge?t.draggable&&s:t.draggable,preventDefault:!ge||s,hideInExport:!t.showInExport,onDragMove:se=>{t.set({x:se.target.x(),y:se.target.y()})},onDragEnd:se=>{t.set({x:se.target.x(),y:se.target.y()})},onDblClick:Ee,onDblTap:Ee,onTransformStart:()=>{i(!0),Xe.current={cropX:t.cropX,cropY:t.cropY,cropWidth:t.cropWidth,cropHeight:t.cropHeight}},onTransform:se=>{var me;const Te=se.currentTarget,ae=Math.abs(Te.scaleX()-1)<1e-7?1:Te.scaleX(),xe=Math.abs(Te.scaleY()-1)<1e-7?1:Te.scaleY();Te.scaleX(1),Te.scaleY(1);const Oe=(me=se.target.getStage())===null||me===void 0?void 0:me.findOne("Transformer"),Be=1-$/I,ct=Math.min(Be,Math.max(0,t.cropX)),be=1-X/R,he=Math.min(be,Math.max(0,t.cropY)),Ve=Oe.getActiveAnchor(),le=!(Ve.indexOf("middle")>=0||Ve.indexOf("center")>=0),Ie=!le&&ae<1&&Xe.current.cropHeight>X/R;let Ye=le?t.cropWidth:t.cropWidth*ae;Ie&&(Ye=t.cropWidth);const at=!le&&xe<1&&Xe.current.cropWidth>$/I;let Ze=le?t.cropHeight:t.cropHeight*xe;at&&(Ze=t.cropHeight),K&&(Ye=t.cropWidth,Ze=t.cropHeight),t.set({cropX:ct,cropY:he,x:Te.x(),y:Te.y(),width:Te.width()*ae,height:Te.height()*xe,rotation:se.target.rotation(),cropWidth:Math.min(Ye,1-ct),cropHeight:Math.min(Ze,1-he)})},onTransformEnd:se=>{const me=se.currentTarget;t.set({width:me.width(),height:me.height(),x:me.x(),y:me.y(),rotation:se.target.rotation(),cropWidth:$/I,cropHeight:X/R}),i(!1)}}),Y.createElement(ur,{x:t.a.x,y:t.a.y,width:Math.max(t.a.width-t.borderSize,0),height:Math.max(t.a.height-t.borderSize,0),opacity:dt,offsetX:-t.borderSize/2,offsetY:-t.borderSize/2,stroke:t.borderColor,strokeWidth:t.borderSize,listening:!1,visible:!!t.borderSize,rotation:t.rotation,cornerRadius:Math.max(0,J-t.borderSize),hideInExport:!t.showInExport}),!e.isPlaying&&Y.createElement(zo,{image:u?(p||ge)&&j8:z8,x:t.a.x,y:t.a.y,offsetX:-t.a.width/2+15/e.scale,offsetY:-t.a.height/2+15/e.scale,rotation:t.a.rotation,width:30/e.scale,height:30/e.scale,hideInExport:!0,onClick:()=>f(!u),onTap:()=>f(!u)}),t._cropModeEnabled&&Y.createElement(R2,{selector:".page-abs-container",enabled:!0},Y.createElement(ur,{x:-window.innerWidth/e.scale,y:-window.innerWidth/e.scale,width:window.innerWidth/e.scale*3,height:window.innerWidth/e.scale*3,fill:"rgba(0,0,0,0.3)"}),Y.createElement(zo,{listening:!1,image:W,x:t.a.x,y:t.a.y,width:t.a.width,height:t.a.height,rotation:t.a.rotation,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur}),Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,scaleX:Q,scaleY:Q},Y.createElement(zo,{image:S,ref:o,width:I,height:R,opacity:.4,draggable:!0,x:-t.cropX*I,y:-t.cropY*R,onDragMove:de,onTransform:de}),Y.createElement(yp,{ref:oe,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(se,me)=>me.width<5||me.height<5?se:me,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),Y.createElement(ur,{width:$,height:X,ref:ne,listening:!1,onTransform:se=>{se.target.x()<-t.cropX*I-1e-9&&(se.target.x(-t.cropX*I),se.target.scaleX(1)),se.target.y()<-t.cropY*R-1e-9&&(se.target.y(-t.cropY*R),se.target.scaleY(1));const me=Math.min(1,Math.max(0,t.cropX+se.target.x()/I)),Te=Math.min(1,Math.max(0,se.target.y()/R+t.cropY)),ae=se.target.width()*se.target.scaleX(),xe=se.target.height()*se.target.scaleY(),Oe=Math.min(1-me,ae/I),Be=Math.min(1-Te,xe/R),ct=se.target.getAbsolutePosition(se.target.getParent().getParent());se.target.scale({x:1,y:1}),se.target.position({x:0,y:0}),t.set({x:ct.x,y:ct.y,cropX:me,cropY:Te,cropWidth:Oe,cropHeight:Be,width:Math.min(ae*Q,I*(1-me)*Q),height:Math.min(xe*Q,R*(1-Te)*Q)})}}),Y.createElement(yp,{ref:ue,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(se,me)=>me.width<5||me.height<5?se:me,keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2,visible:t.resizable})))))}),lb=({width:t,height:e,cornerRadius:r})=>{if(r>0){const n=Math.min(r,t/2,e/2);return`M 0 ${n} A ${n} ${n} 0 0 1 ${n} 0 L ${t-n} 0 A ${n} ${n} 0 0 1 ${t} ${n} L ${t} ${e-n} A ${n} ${n} 0 0 1 ${t-n} ${e} L ${n} ${e} A ${n} ${n} 0 0 1 0 ${e-n} Z`}return`M 0 0 L ${t} 0 L ${t} ${e} L 0 ${e} Z`},aD=({width:t,height:e})=>`M ${t/2} 0 L ${t} ${e} L 0 ${e} Z`,oD=({width:t,height:e})=>`M 0 0 L ${t} 0 L 0 ${e} Z`,sD=({width:t,height:e})=>`M ${t/2} ${e/2} m -${t/2}, 0 a ${t/2},${e/2} 0 1,0 ${t},0 a ${t/2},${e/2} 0 1,0 -${t},0`;function lD({width:t,height:e}){const r=t/2,n=e/2,i=t/2,a=e/2,o=i/2,s=a/2;let u="",f=Math.PI/5;for(let d=0;d<10;d++){const h=d%2==0?a:s,p=r+(d%2==0?i:o)*Math.sin(d*f),y=n-h*Math.cos(d*f);d===0?u=`M ${p} ${y}`:u+=` L ${p} ${y}`}return u+" Z"}function uD({width:t,height:e}){const r=t/2,n=e/2;return`M ${r} 0 L ${t} ${n} L ${r} ${e} L 0 ${n} Z`}function cD({width:t,height:e}){const r=t/2,n=e/2,i=t/2,a=e/2;let o="",s=2*Math.PI/5;for(let u=0;u<5;u++){const f=a,d=r+i*Math.sin(u*s),h=n-f*Math.cos(u*s);u===0?o=`M ${d} ${h}`:o+=` L ${d} ${h}`}return o+" Z"}function fD({width:t,height:e}){const r=t/2,n=e/2,i=t/2,a=e/2;let o="",s=2*Math.PI/6;for(let u=0;u<6;u++){const f=a,d=r+i*Math.sin(u*s),h=n-f*Math.cos(u*s);u===0?o=`M ${d} ${h}`:o+=` L ${d} ${h}`}return o+" Z"}function lt({path:t,aspectRatio:e,width:r,height:n}){return{path:t,scaleX:r/e.width,scaleY:n/e.height}}function dD({width:t,height:e}){const r=.1*Math.min(t,e),n=.2*t,i=.2*e,a=.5*t;let o=`M ${r},0`;return o+=" H "+(t-r),o+=` A ${r},${r} 0 0 1 ${t},${r}`,o+=" V "+(e-r-i),o+=` A ${r},${r} 0 0 1 ${t-r},${e-i}`,o+=` H ${a+n/2}`,o+=` L ${a},${e}`,o+=` L ${a-n/2},${e-i}`,o+=` H ${r}`,o+=` A ${r},${r} 0 0 1 0,${e-r-i}`,o+=` V ${r}`,o+=` A ${r},${r} 0 0 1 ${r},0`,o+=" Z",o}function hD({width:t,height:e}){const r=.3*t,n=.3*e,i=t/2,a=e/2,o=i-r/2,s=i+r/2,u=a-n/2,f=a+n/2;let d=`M ${o},0 `;return d+=`H ${s} `,d+=`V ${u} `,d+=`H ${t} `,d+=`V ${f} `,d+=`H ${s} `,d+=`V ${e} `,d+=`H ${o} `,d+=`V ${f} `,d+="H 0 ",d+=`V ${u} `,d+=`H ${o} `,d+="V 0 ",d+="Z",d}const pD={rect:lb,circle:sD,star:lD,triangle:aD,rightTriangle:oD,diamond:uD,pentagon:cD,hexagon:fD,speechBubble:dD,cross:hD,arc:({width:t,height:e})=>lt({path:"M234 117C234 85.97 221.673 56.21 199.731 34.269C177.79 12.327 148.03 0 117 0C85.97 0 56.2103 12.327 34.2685 34.268C12.3268 56.21 0 85.97 0 117H117H234Z",aspectRatio:{width:234,height:117},width:t,height:e}),cloud:({width:t,height:e})=>lt({path:"M216.41 57.006C216.961 54.084 217.249 51.069 217.249 47.986C217.249 21.4841 195.972 0 169.725 0C153.666 0 139.467 8.043 130.865 20.3575C122.606 13.3566 111.954 9.1402 100.327 9.1402C74.3322 9.1402 53.2123 30.2136 52.8094 56.364H52.8035C23.6407 56.364 0 80.235 0 109.682C0 139.129 23.6407 163 52.8035 163H208.197C237.359 163 261 139.129 261 109.682C261 83.056 241.672 60.99 216.41 57.006Z",aspectRatio:{width:261,height:163},width:t,height:e}),rightArrow:({width:t,height:e})=>{const r=.6*t;return`M 0 ${e/4} L ${r} ${e/4} L ${r} 0 L ${t} ${e/2} L ${r} ${e} L ${r} ${.75*e} L 0 ${.75*e} Z`},leftArrow:({width:t,height:e})=>{const r=.4*t;return`M ${t} ${e/4} L ${r} ${e/4} L ${r} 0 L 0 ${e/2} L ${r} ${e} L ${r} ${.75*e} L ${t} ${.75*e} Z`},downArrow:({width:t,height:e})=>{const r=.6*e;return`M ${t/4} 0 L ${t/4} ${r} L 0 ${r} L ${t/2} ${e} L ${t} ${r} L ${.75*t} ${r} L ${.75*t} 0 Z`},upArrow:({width:t,height:e})=>{const r=.4*e;return`M ${t/4} ${e} L ${t/4} ${r} L 0 ${r} L ${t/2} 0 L ${t} ${r} L ${.75*t} ${r} L ${.75*t} ${e} Z`},asterisk1:({width:t,height:e})=>lt({path:"M45.5265 218.498C51.5466 222.87 58.5359 224.98 65.4742 224.98C75.916 224.98 86.221 220.2 92.853 211.217C92.872 211.198 92.89 211.178 92.907 211.157C92.923 211.136 92.939 211.115 92.954 211.094L92.977 211.061C92.993 211.039 93.008 211.017 93.023 210.996L116.491 178.725L139.959 210.996C139.982 211.031 140.006 211.058 140.029 211.088C140.04 211.102 140.05 211.116 140.061 211.132C151.115 226.188 172.355 229.505 187.473 218.515C202.608 207.526 205.992 186.278 195.074 171.104L195.05 171.066C195.03 171.034 195.014 171.01 194.989 170.985L171.572 138.696L209.512 126.346C227.334 120.545 237.129 101.305 231.33 83.476C225.532 65.648 206.315 55.8493 188.476 61.6334L150.537 73.933L150.52 34.0064C150.502 15.2594 135.248 0 116.508 0C97.768 0 82.514 15.2594 82.497 34.0234L82.463 73.916L44.5233 61.6163C44.5083 61.6163 44.49 61.613 44.4716 61.6078C44.4477 61.6014 44.4232 61.5918 44.4041 61.5823C26.5992 55.8664 7.45076 65.665 1.66886 83.46C-4.11314 101.254 5.61427 120.426 23.3511 126.278C23.3675 126.283 23.3822 126.289 23.3963 126.295L23.4588 126.319L23.4873 126.329L61.4098 138.679L37.9929 170.968C37.9844 170.985 37.9718 171.002 37.9591 171.019C37.9462 171.036 37.9336 171.053 37.9251 171.07C26.9903 186.244 30.3915 207.509 45.5265 218.498Z",aspectRatio:{width:233,height:225},width:t,height:e}),asterisk2:({width:t,height:e})=>lt({path:"M46.0556 112L0 85.388L33.9456 26.6121L80.028 53.1781L80.054 0H147.946L147.972 53.1781L194.054 26.6121L228 85.388L181.944 112L228 138.612L194.054 197.388L147.972 170.822L147.946 224H80.054L80.028 170.822L33.9456 197.388L0 138.612L46.0556 112Z",aspectRatio:{width:228,height:224},width:t,height:e}),bookmark:({width:t,height:e})=>lt({path:"M0 0H199V238L99.5 142.8L0 238V0Z",aspectRatio:{width:199,height:238},width:t,height:e}),butterfly:({width:t,height:e})=>lt({path:"M94.5 100.713C91.935 150.916 50.703 190.909 0 191.493V0C50.703 0.5845 91.935 40.5767 94.5 90.78C97.031 41.2385 137.217 1.6407 187 0.0438004V191.45C137.217 189.853 97.031 150.255 94.5 100.713Z",aspectRatio:{width:187,height:192},width:t,height:e}),cylinder:({width:t,height:e})=>lt({path:"M169 36.8497V218.15C169 238.502 131.168 255 84.5 255C37.832 255 0 238.502 0 218.15V36.8497C0 16.4982 37.832 0 84.5 0C131.168 0 169 16.4982 169 36.8497Z",aspectRatio:{width:169,height:255},width:t,height:e}),diamond2:({width:t,height:e})=>lt({path:"M0 55.5L124 185L248 55.5L189.307 0H58.6933L0 55.5Z",aspectRatio:{width:248,height:185},width:t,height:e}),door:({width:t,height:e})=>lt({path:"M140 69.697C140 31.2044 108.66 0 70 0C31.34 0 0 31.2044 0 69.697V207H140V69.697Z",aspectRatio:{width:140,height:207},width:t,height:e}),drop1:({width:t,height:e})=>lt({path:"M167 150.687C167 196.328 129.407 234 83.139 234C37.593 234 0 196.328 0 150.687C0 100.7 51.329 36.9474 83.139 0C114.948 39.1207 167 98.526 167 150.687Z",aspectRatio:{width:167,height:234},width:t,height:e}),drop2:({width:t,height:e})=>lt({path:"M73 239C53.64 239 35.071 231.315 21.3812 217.634C7.691 203.954 0 185.4 0 166.054C0 136.091 13.8696 113.633 30.768 86.27C43.912 64.9877 58.888 40.7377 70.597 7.6816C71.281 5.7496 72.989 0 72.989 0C72.989 0 72.993 0.0124998 73 0.0363998C73.007 0.0124998 73.011 0 73.011 0C73.011 0 74.719 5.7496 75.403 7.6816C87.112 40.7377 102.088 64.9877 115.232 86.27C132.13 113.633 146 136.091 146 166.054C146 185.4 138.309 203.954 124.619 217.634C111.025 231.218 92.225 239 73 239Z",aspectRatio:{width:146,height:239},width:t,height:e}),explosion:({width:t,height:e})=>lt({path:"M165.802 184.465L118.997 260L125.343 182.079L34.9058 219.45L99.164 159.817L0 163.792L78.538 134.373L0 74.7401L86.471 89.052V0L118.997 89.052L165.802 10.3364L149.143 97.798L217.368 29.419L165.802 112.905L245.927 81.101L165.802 143.914H261L165.802 184.465Z",aspectRatio:{width:261,height:260},width:t,height:e}),flag:({width:t,height:e})=>lt({path:"M0 142.161C0 142.161 51.9956 118.626 103 137.469C159.992 158.525 206 141.31 206 141.31V11.1373C206 11.1373 160 28.3218 103.016 7.28273C52 -11.553 0 12.0974 0 12.0974V142.161Z",aspectRatio:{width:206,height:148},width:t,height:e}),flower:({width:t,height:e})=>lt({path:"M135.351 66.1893C196.683 -5.00591 256.536 100.304 164.908 117.361C256.536 135.16 195.944 239.728 135.351 168.532C166.386 257.526 45.9394 256.785 76.975 168.532C15.643 239.728 -44.2109 135.16 47.4173 117.361C-44.9498 100.304 15.643 -4.26431 76.975 66.1893C45.2005 -22.0631 166.386 -22.0631 135.351 66.1893ZM105.793 104.012C113.183 104.012 119.833 109.945 119.833 117.361C119.833 124.777 113.183 131.452 105.793 131.452C98.404 131.452 92.492 124.777 92.492 117.361C92.492 109.945 98.404 104.012 105.793 104.012Z",aspectRatio:{width:212,height:235},width:t,height:e}),frame:({width:t,height:e})=>lt({path:"M0 0H240L200 88L240 176H0L40 88L0 0Z",aspectRatio:{width:240,height:176},width:t,height:e}),heart1:({width:t,height:e})=>lt({path:"M215.886 56.157C215.886 24.729 191.112 0 160.584 0C135.933 0 115.08 16.983 107.937 39.93C100.788 16.986 79.935 0.591 55.284 0.591C24.75 0.591 0 24.615 0 56.055C0 71.919 6.321 83.127 16.494 95.121L107.988 189.447L199.377 95.121C209.559 83.127 215.886 72.009 215.886 56.157Z",aspectRatio:{width:216,height:190},width:t,height:e}),home:({width:t,height:e})=>lt({path:"M0 62.143L95.5 0L191 62.143V195H0V62.143Z",aspectRatio:{width:191,height:195},width:t,height:e}),home2:({width:t,height:e})=>lt({path:"M206 94.076L103 0L0 94.076H31.2377V189H175.607V94.076H206Z",aspectRatio:{width:206,height:189},width:t,height:e}),hourglass:({width:t,height:e})=>lt({path:"M0.392782 0H187.607C193.014 43.3688 140.804 53.797 140.804 97.5C140.804 141.203 193.014 151.631 187.607 195H0.392782C-5.01452 151.631 47.196 141.203 47.196 97.5C47.196 53.797 -5.01452 43.3688 0.392782 0Z",aspectRatio:{width:188,height:195},width:t,height:e}),house:({width:t,height:e})=>lt({path:"M0 92.367L95 0L190 92.367V223H0V92.367Z",aspectRatio:{width:190,height:223},width:t,height:e}),keyhole:({width:t,height:e})=>lt({path:"M115 57.0494C115 25.5387 89.416 0 57.863 0C26.311 0 0.726898 25.5414 0.726898 57.0494C0.726898 78.652 12.759 97.451 30.505 107.136L0 219H114.845L84.448 107.524C102.608 97.962 115 78.959 115 57.0494Z",aspectRatio:{width:115,height:219},width:t,height:e}),kiss:({width:t,height:e})=>lt({path:"M124.5 17.1468C80.036 -36.5162 0 52.9218 0 52.9218C0 52.9218 44.4643 120 124.5 120C204.536 120 249 52.9218 249 52.9218C249 52.9218 168.964 -36.5162 124.5 17.1468Z",aspectRatio:{width:249,height:120},width:t,height:e}),leaf:({width:t,height:e})=>lt({path:"M204.414 0.0151567C204.414 0.0151567 206.837 93.9509 150.394 150.394C93.9507 206.837 0.0151569 204.413 0.0151569 204.413C0.0151569 204.413 -2.40835 110.478 54.0347 54.0349C110.478 -2.40834 204.414 0.0151567 204.414 0.0151567Z",aspectRatio:{width:205,height:205},width:t,height:e}),lightning1:({width:t,height:e})=>lt({path:"M111.5 0L0 142H51.433L31.5 253L143 111H91.567L111.5 0Z",aspectRatio:{width:143,height:253},width:t,height:e}),lightning2:({width:t,height:e})=>lt({path:"M126 0H43L0 120.531H36L6 227L110 80.354H73L126 0Z",aspectRatio:{width:126,height:227},width:t,height:e}),magnet:({width:t,height:e})=>lt({path:"M88.402 0H0V67.669H88.402C105.271 67.669 118.957 81.308 118.957 98C118.957 114.689 105.271 128.331 88.402 128.331H0V196H88.402C142.747 196 187 152.072 187 98C187 43.9279 142.747 0 88.402 0Z",aspectRatio:{width:187,height:196},width:t,height:e}),mithosis:({width:t,height:e})=>lt({path:"M150.996 136.45C137.141 128.926 117.559 128.7 103.532 135.896C93.843 140.867 82.875 143.67 71.2577 143.67C31.9033 143.67 0 111.508 0 71.835C0 32.161 31.9033 0 71.2577 0C83.467 0 94.959 3.0955 105.004 8.5504C118.859 16.0745 138.441 16.3 152.467 9.1038C162.157 4.1328 173.125 1.3303 184.742 1.3303C224.097 1.3303 256 33.492 256 73.165C256 112.839 224.097 145 184.742 145C172.533 145 161.041 141.905 150.996 136.45Z",aspectRatio:{width:256,height:145},width:t,height:e}),orangeRicky:({width:t,height:e})=>lt({path:"M69 0H0V69V138V207H69H138V138H69V69V0Z",aspectRatio:{width:138,height:207},width:t,height:e}),party:({width:t,height:e})=>lt({path:"M134.622 0L144.682 68.2539L174.415 5.9977L163.91 74.1846L210.671 23.4578L180.535 85.519L240.169 50.8289L193.079 101.25L260.29 85.679L200.43 119.98L269.245 124.911L201.934 140.044L266.237 165.04L197.456 159.661L251.535 202.5L187.396 177.086L226.445 233.962L172.646 190.771L193.197 256.631L154.518 199.501L154.743 268.492L134.622 202.5L114.501 268.492L114.727 199.501L76.0482 256.631L96.5985 190.771L42.7992 233.962L81.8489 177.086L17.7091 202.5L71.7885 159.661L3.0072 165.04L67.3112 140.044L0 124.911L68.8149 119.98L8.9545 85.679L76.1658 101.25L29.0753 50.8289L88.7105 85.519L58.5743 23.4578L105.335 74.1846L94.8305 5.9977L124.562 68.2539L134.622 0Z",aspectRatio:{width:270,height:269},width:t,height:e}),pillow:({width:t,height:e})=>lt({path:"M176 0.00169945C157.812 16.9062 125.203 28.174 88.001 28.174C50.798 28.174 18.1881 16.9054 0 0V258.421C18.1882 241.516 50.798 230.248 88 230.248C125.202 230.248 157.812 241.516 176 258.421V0.00169945Z",aspectRatio:{width:176,height:259},width:t,height:e}),polygon:({width:t,height:e})=>lt({path:"M110 0L219.119 63V189L110 252L0.880798 189V63L110 0Z",aspectRatio:{width:220,height:252},width:t,height:e}),rainbow:({width:t,height:e})=>lt({path:"M186.907 141H282C282 63.128 218.872 0 141 0C63.1278 0 0 63.128 0 141H95.093C95.093 115.646 115.646 95.093 141 95.093C166.354 95.093 186.907 115.646 186.907 141Z",aspectRatio:{width:282,height:141},width:t,height:e}),rhodeIsland:({width:t,height:e})=>lt({path:"M69 0H0V69V138H69V207H138V138V69H69V0Z",aspectRatio:{width:138,height:207},width:t,height:e}),shell:({width:t,height:e})=>lt({path:"M109 0C169.199 0 218 48.743 218 108.87C185.392 108.87 158.958 135.273 158.958 167.842C158.958 179.736 158.958 191 158.958 191H59.042C59.042 191 59.042 179.736 59.042 167.842C59.042 135.273 32.6077 108.87 0 108.87C0 48.743 48.8007 0 109 0Z",aspectRatio:{width:218,height:191},width:t,height:e}),shield1:({width:t,height:e})=>lt({path:"M203.184 30.7277C142.457 30.7277 102.853 0 102.853 0C102.853 0 63.249 30.7277 3.05098 30.7277C3.05098 30.7277 -3.81372 128.209 3.05098 162.115C9.38758 193.902 102.853 249 102.853 249C102.853 249 196.319 193.902 203.184 162.115C209.52 128.738 203.184 30.7277 203.184 30.7277Z",aspectRatio:{width:206,height:249},width:t,height:e}),shield2:({width:t,height:e})=>lt({path:"M0 12.9585C64.624 -4.3195 136.376 -4.3195 201 12.9585C201 51.0564 201 89.154 201 127.252C201 184.396 100.498 240 100.498 240C100.498 240 0 184.406 0 127.252C0 89.154 0 51.0564 0 12.9585Z",aspectRatio:{width:201,height:240},width:t,height:e}),skewedRectangle:({width:t,height:e})=>lt({path:"M85.9799 0H290L204.02 141H0L85.9799 0Z",aspectRatio:{width:290,height:141},width:t,height:e}),softFlower:({width:t,height:e})=>lt({path:"M109 0C80.073 0 56.6234 23.4498 56.6234 52.3766C56.6234 54.722 54.722 56.6234 52.3766 56.6234C23.4498 56.6234 0 80.073 0 109C0 137.927 23.4498 161.377 52.3766 161.377C54.722 161.377 56.6234 163.278 56.6234 165.623C56.6234 194.55 80.073 218 109 218C137.927 218 161.377 194.55 161.377 165.623C161.377 163.278 163.278 161.377 165.623 161.377C194.55 161.377 218 137.927 218 109C218 80.073 194.55 56.6234 165.623 56.6234C163.278 56.6234 161.377 54.722 161.377 52.3766C161.377 23.4498 137.927 0 109 0Z",aspectRatio:{width:218,height:218},width:t,height:e}),softStar:({width:t,height:e})=>lt({path:"M130.424 3.17662C130.927 -1.05888 137.073 -1.05888 137.576 3.17662L141.792 38.7086C147.236 84.59 183.41 120.764 229.291 126.208L264.823 130.424C269.059 130.927 269.059 137.073 264.823 137.576L229.291 141.792C183.41 147.236 147.236 183.41 141.792 229.291L137.576 264.823C137.073 269.059 130.927 269.059 130.424 264.823L126.208 229.291C120.764 183.41 84.59 147.236 38.7086 141.792L3.17662 137.576C-1.05888 137.073 -1.05888 130.927 3.17662 130.424L38.7086 126.208C84.59 120.764 120.764 84.59 126.208 38.7086L130.424 3.17662Z",aspectRatio:{width:268,height:268},width:t,height:e}),stairs1:({width:t,height:e})=>lt({path:"M0 0H67.667V67.667H135.333V135.333H203V203H0V0Z",aspectRatio:{width:203,height:203},width:t,height:e}),stairs2:({width:t,height:e})=>lt({path:"M50 0H0V200H200V150H150V100H100V50H50V0Z",aspectRatio:{width:200,height:200},width:t,height:e}),teewee:({width:t,height:e})=>lt({path:"M69 0H138V69H207V138H138H69H0V69H69V0Z",aspectRatio:{width:207,height:138},width:t,height:e}),blob1:({width:t,height:e})=>lt({path:"M172.979 19.611C191.285 33.0858 204.505 54.442 210.861 78.5949C217.471 103.002 217.471 130.46 205.776 151.816C194.335 173.427 171.454 189.444 147.047 196.054C122.639 202.919 96.7069 200.631 75.3506 190.715C54.2486 180.546 37.7229 163.003 23.4855 142.155C9.5022 121.307 -2.19289 97.4087 0.349524 74.7813C3.14617 52.1538 19.9261 30.7976 40.2654 17.8313C60.6046 4.61077 84.5033 -0.474048 108.148 0.0344341C131.538 0.542916 154.928 6.13621 172.979 19.611Z",aspectRatio:{width:216,height:200},width:t,height:e}),blob10:({width:t,height:e})=>lt({path:"M188.684 8.95173C205.601 24.3309 200.988 63.0866 191.453 99.3816C182.225 135.677 168.076 169.511 146.238 175.355C124.399 181.507 94.871 159.668 66.5733 143.059C37.9679 126.449 10.5929 115.068 2.59569 95.0754C-5.4015 75.0824 5.97912 46.1694 24.4342 30.4826C42.8893 14.7958 68.4188 12.0276 100.715 6.79864C132.704 1.5697 171.767 -6.42749 188.684 8.95173Z",aspectRatio:{width:200,height:177},width:t,height:e}),blob11:({width:t,height:e})=>lt({path:"M137.368 29.4923C148.97 46.7605 146.542 72.1231 148.161 99.1046C149.779 126.086 155.715 154.956 144.113 174.383C132.781 193.81 103.911 203.793 80.4369 198.666C56.963 193.27 38.6156 173.034 28.3626 153.607C17.8398 134.181 15.4115 115.833 9.47555 91.5498C3.53961 67.2664 -5.63411 37.3169 4.61887 20.0488C15.1417 2.51078 45.0911 -1.80626 72.8821 0.622074C100.673 2.78059 126.036 12.2241 137.368 29.4923Z",aspectRatio:{width:152,height:200},width:t,height:e}),blob12:({width:t,height:e})=>lt({path:"M158.391 17.923C172.491 28.5703 180.261 48.1384 187.743 70.5842C194.937 93.3177 202.419 118.641 194.649 138.785C187.167 158.928 164.146 173.317 138.535 184.54C112.923 196.05 84.4347 204.108 58.8235 197.777C33.2123 191.446 10.191 170.439 2.99688 146.267C-4.48504 121.807 3.57241 94.181 10.4788 68.282C17.0974 42.0953 22.565 17.6352 37.8166 7.27563C53.0682 -3.37171 78.1038 0.081487 100.837 2.67138C123.859 5.26127 144.29 7.27563 158.391 17.923Z",aspectRatio:{width:198,height:200},width:t,height:e}),blob13:({width:t,height:e})=>lt({path:"M149.668 1.37595C170.663 5.22017 193.728 17.3442 198.755 34.7911C204.078 52.2379 191.363 75.3032 178.943 93.9329C166.819 112.563 154.99 126.757 140.501 145.386C126.011 164.312 108.86 187.673 92.5957 186.194C76.3317 185.011 60.9549 159.285 45.8737 140.655C30.4968 122.321 15.7114 110.788 7.43151 95.1157C-0.848339 79.4432 -2.32688 59.0392 3.5873 41.5924C9.50148 23.8498 23.1041 8.76868 38.7767 3.44592C54.745 -1.87685 73.3746 2.55879 91.7086 2.26308C110.338 2.26308 128.968 -2.17256 149.668 1.37595Z",aspectRatio:{width:200,height:187},width:t,height:e}),blob14:({width:t,height:e})=>lt({path:"M137.838 28.6426C150.711 40.5617 165.014 46.5213 178.363 58.2021C191.474 69.8828 203.87 87.0464 198.864 99.6807C193.858 112.315 171.689 120.42 157.862 135.676C144.275 151.171 139.269 173.579 126.873 182.161C114.477 190.505 94.9294 185.022 76.8123 178.109C58.4568 171.196 41.5316 163.091 28.1822 150.456C14.5943 137.822 4.58225 120.42 1.24488 101.826C-2.09248 83.2322 1.00651 62.9697 13.8792 52.4809C26.7519 41.992 49.1598 41.0385 65.6083 30.788C82.0567 20.5376 92.0688 0.990158 103.034 0.0366268C113.762 -0.916905 125.204 16.9618 137.838 28.6426Z",aspectRatio:{width:200,height:187},width:t,height:e}),blob15:({width:t,height:e})=>lt({path:"M185.203 1.52939C197.679 7.62217 200 32.2835 200 51.7223C200 71.1612 197.389 85.3777 197.679 100.175C198.259 114.681 201.741 129.768 198.259 143.114C194.778 156.46 184.623 168.356 171.567 173.868C158.801 179.671 143.134 179.091 130.368 174.739C117.312 170.387 106.867 162.263 86.8482 160.812C66.539 159.362 36.9454 164.294 18.9572 155.3C0.968966 146.306 -5.41395 123.095 5.03083 105.977C15.4756 88.5692 42.4579 77.5442 55.5139 59.5559C68.2798 41.8578 67.1192 17.4867 76.9837 9.6531C86.5581 2.10965 107.158 11.3939 128.627 9.6531C150.097 8.20244 172.728 -4.27327 185.203 1.52939Z",aspectRatio:{width:200,height:179},width:t,height:e}),blob16:({width:t,height:e})=>lt({path:"M158.441 55.3221C167.253 80.2399 160.264 105.462 147.501 134.938C134.738 164.717 116.81 199.055 97.0576 199.967C77.3057 201.182 55.7305 168.668 34.4592 133.722C13.1879 99.0802 -7.77953 62.3112 2.85612 36.4818C13.4918 10.6523 56.0344 -3.93369 90.0685 0.928322C123.799 6.09421 149.324 30.7081 158.441 55.3221Z",aspectRatio:{width:163,height:200},width:t,height:e}),blob17:({width:t,height:e})=>lt({path:"M168.917 36.7587C178.871 53.2457 175.138 76.5764 172.961 106.129C170.472 135.37 169.85 170.832 150.563 187.63C131.276 204.739 93.3252 203.495 65.0173 187.63C36.7095 172.077 18.0449 142.213 7.77943 107.373C-2.79714 72.2213 -4.35252 32.7147 14.312 14.0502C32.9765 -4.3033 72.1721 -1.50361 103.591 4.7179C135.32 10.6283 158.962 20.2717 168.917 36.7587Z",aspectRatio:{width:176,height:200},width:t,height:e}),blob18:({width:t,height:e})=>lt({path:"M178.188 21.1464C193.012 36.3069 196.381 62.9219 198.739 88.1893C200.76 113.12 201.771 136.366 190.316 149.168C178.862 162.307 155.279 164.665 135.065 167.697C115.188 170.73 99.0168 174.098 72.4018 177.131C46.1237 180.163 9.40176 182.521 1.65309 168.371C-6.09559 154.221 15.4659 123.564 23.5515 92.9059C31.6371 62.2481 26.2467 31.2534 38.3751 15.4192C50.1665 -0.0781831 79.8136 -1.08888 107.776 0.595609C136.076 1.9432 163.028 5.64909 178.188 21.1464Z",aspectRatio:{width:200,height:180},width:t,height:e}),blob19:({width:t,height:e})=>lt({path:"M148.621 13.3857C171.945 24.3818 194.937 41.3756 192.938 60.702C190.605 80.3615 163.282 101.687 149.953 123.346C136.958 145.005 137.958 166.664 128.295 174.661C118.631 182.325 98.3054 175.994 73.6476 181.991C48.9899 187.989 20.0004 205.983 11.0036 197.986C1.67366 189.989 12.6697 156.001 12.3365 131.343C12.0033 106.685 0.340809 91.0243 0.00759636 75.0301C-0.325616 59.0359 10.3372 42.3753 25.3318 28.7135C39.9931 15.0518 58.9863 4.05578 80.3119 1.05687C101.638 -2.27526 124.962 2.38972 148.621 13.3857Z",aspectRatio:{width:194,height:200},width:t,height:e}),blob2:({width:t,height:e})=>lt({path:"M140.464 18.6393C156.081 28.3718 169.887 39.9149 178.714 54.853C187.541 69.5649 191.389 87.6717 189.578 104.421C187.768 121.396 180.525 137.239 172.377 153.535C164.455 169.832 155.854 186.58 142.048 194.276C128.241 201.971 109.456 200.613 92.4804 197.671C75.2789 194.502 60.1144 189.749 45.1762 182.733C30.4644 175.716 16.2052 166.21 8.28346 153.083C0.361703 139.729 -1.44898 122.527 1.04072 106.91C3.30408 91.2931 9.64147 76.8076 15.9789 60.5114C22.0899 44.2153 28.201 26.1084 40.6495 14.7916C53.0979 3.24849 71.8838 -1.27823 89.7643 0.306124C107.871 1.66414 124.846 9.13322 140.464 18.6393Z",aspectRatio:{width:191,height:200},width:t,height:e}),blob20:({width:t,height:e})=>lt({path:"M150.035 13.2464C157.376 24.9386 153.026 48.323 157.92 65.7254C163.087 83.1277 177.498 94.2761 182.392 108.415C187.287 122.555 182.392 139.957 173.147 156.272C163.63 172.587 149.763 187.814 132.089 195.155C114.414 202.225 93.2053 201.137 73.6276 194.611C54.3219 188.357 36.9196 176.937 25.7712 161.438C14.8947 145.667 10.5441 126.09 5.92163 105.696C1.57105 85.0311 -3.05145 63.5501 2.65869 45.0601C8.64075 26.5701 24.6835 11.0711 43.1735 4.54524C61.6635 -1.98064 82.6007 0.194657 102.722 1.01039C122.844 1.82613 142.421 1.55421 150.035 13.2464Z",aspectRatio:{width:185,height:200},width:t,height:e}),blob21:({width:t,height:e})=>lt({path:"M152.611 0.184799C172.596 -0.723643 197.73 1.39606 199.85 13.8114C201.969 26.2268 181.075 48.9379 174.716 68.0151C168.357 87.0924 176.533 102.536 174.11 114.649C171.991 127.064 159.575 136.148 146.252 139.782C132.928 143.719 118.696 141.902 105.977 139.176C93.562 136.451 82.6606 132.212 63.2805 131.909C43.9004 131.606 16.0416 135.24 5.44306 125.853C-5.15543 116.465 1.50648 94.0572 10.2881 76.4939C18.7669 59.2335 29.6682 46.8182 38.7526 35.3112C48.1398 23.5015 56.3158 12.903 66.9143 8.36078C77.5128 4.12138 91.1394 6.24108 104.766 5.63546C118.696 4.72701 132.928 1.09324 152.611 0.184799Z",aspectRatio:{width:200,height:143},width:t,height:e}),blob22:({width:t,height:e})=>lt({path:"M195.507 15.5715C206.818 33.1668 193.622 69.3001 190.166 101.663C186.71 134.34 193.308 163.561 181.996 178.014C170.685 192.153 141.464 191.525 114.443 189.326C87.1072 187.44 62.2852 183.67 40.6052 169.531C19.2395 155.077 1.6441 130.255 0.0730908 103.862C-1.18372 77.4694 13.898 49.5054 35.2638 31.91C56.6296 14.0004 84.5936 6.45958 116.328 2.37494C148.063 -1.70969 184.196 -2.3381 195.507 15.5715Z",aspectRatio:{width:200,height:191},width:t,height:e}),blob23:({width:t,height:e})=>lt({path:"M135.742 9.14189C157.815 19.2326 179.258 38.4681 176.105 56.7576C172.951 74.7317 145.202 92.0751 127.858 109.734C110.83 127.077 104.523 145.052 87.4953 164.918C70.4672 184.468 42.7177 206.227 27.5816 198.343C12.4455 190.46 9.60747 153.566 6.45411 126.762C2.98542 100.274 -0.798607 84.1917 0.147399 67.1636C0.77807 50.4508 6.76944 32.4767 19.0675 20.8093C31.0503 9.14189 49.6551 3.78119 70.4672 1.2585C90.964 -1.26418 113.668 -0.633508 135.742 9.14189Z",aspectRatio:{width:177,height:200},width:t,height:e}),blob24:({width:t,height:e})=>lt({path:"M165.663 24.3715C171.555 44.4059 158.003 76.2254 151.816 96.2598C145.923 116.294 147.691 124.544 148.28 135.445C148.575 146.346 147.396 159.309 140.62 170.8C133.549 181.996 120.88 191.424 104.381 196.432C87.8821 201.441 67.553 202.03 54.8841 192.602C41.9207 183.469 36.6174 164.023 25.1271 143.105C13.3421 122.187 -4.33535 99.7953 0.967891 85.0641C6.27113 70.6275 34.2604 63.8511 56.0626 48.5307C77.5702 33.5048 92.8907 9.93489 113.22 2.56928C133.843 -4.79633 159.77 4.04241 165.663 24.3715Z",aspectRatio:{width:168,height:200},width:t,height:e}),blob25:({width:t,height:e})=>lt({path:"M180.115 1.256C192.651 2.1962 189.83 34.163 190.771 58.2947C191.711 82.4265 196.098 98.4099 198.606 117.214C201.113 136.018 201.426 157.642 189.204 165.791C177.294 173.626 153.163 167.671 135.299 163.91C117.749 159.836 106.466 157.956 85.7818 162.97C65.0974 168.298 35.3244 180.521 18.7143 174.253C1.79068 167.985 -1.97012 142.913 0.850478 120.975C3.67107 99.0367 13.0731 79.6059 18.4009 54.8473C23.7287 30.0888 24.9823 -0.310996 40.0254 0.00240332C54.7552 0.00240332 82.9612 31.029 111.167 31.029C139.373 31.029 167.579 0.315802 180.115 1.256Z",aspectRatio:{width:200,height:176},width:t,height:e}),blob26:({width:t,height:e})=>lt({path:"M142.571 0.586925C159.976 3.39414 176.258 15.1844 184.96 30.9048C193.662 46.6253 194.224 66.8372 189.171 83.6805C183.837 100.805 172.327 114.56 163.064 129.157C153.8 143.755 146.501 158.914 134.43 173.231C122.359 187.828 105.516 201.303 89.5146 199.899C73.2327 198.776 58.0738 182.775 42.9148 169.862C28.0366 157.23 13.7198 147.685 6.42103 134.491C-0.877729 121.297 -1.15845 103.892 1.64876 88.4528C4.45598 72.7324 10.0704 58.6963 18.4921 47.4674C27.1944 36.2386 38.4233 27.8169 50.4943 22.2025C62.846 16.3073 75.7592 13.5001 91.1989 8.72785C106.919 4.23631 125.166 -1.93957 142.571 0.586925Z",aspectRatio:{width:193,height:200},width:t,height:e}),blob27:({width:t,height:e})=>lt({path:"M112.602 54.9337C129.225 71.8646 155.391 78.9448 158.777 89.719C162.471 100.493 143.693 114.654 127.07 135.586C110.447 156.519 96.2866 184.224 71.0442 194.998C46.1096 205.465 10.4008 199.308 2.0893 178.375C-6.22223 157.443 12.5557 121.734 18.4045 92.1817C24.5612 62.6296 17.7889 38.9263 26.4082 21.9954C34.7197 5.06454 58.423 -5.40183 73.5069 2.9097C88.8986 10.9134 95.9788 38.0028 112.602 54.9337Z",aspectRatio:{width:160,height:200},width:t,height:e}),blob28:({width:t,height:e})=>lt({path:"M125.281 68.5835C142.15 82.9923 165.344 90.021 181.862 108.998C198.028 127.624 207.516 158.902 192.405 166.634C177.293 174.716 137.581 159.605 112.629 156.442C87.326 152.928 77.1344 161.713 59.9142 165.579C43.0453 169.445 19.1478 168.391 11.7677 157.496C4.73907 146.25 14.2278 124.813 11.4163 94.2382C8.2534 63.6634 -6.85825 23.9514 3.68476 8.48836C14.2278 -7.32615 50.4254 1.10826 73.9715 16.2199C97.5175 31.683 108.412 54.1747 125.281 68.5835Z",aspectRatio:{width:200,height:169},width:t,height:e}),blob29:({width:t,height:e})=>lt({path:"M162.987 10.2348C169.16 25.1809 154.864 58.6471 147.066 79.4417C139.268 100.236 138.293 108.359 134.719 114.532C131.47 120.706 125.297 124.93 119.448 143.45C113.6 161.97 107.426 194.461 98.004 199.335C88.5814 204.209 75.5849 181.14 55.7651 167.494C35.6203 153.522 8.65241 148.648 1.8292 135.327C-4.994 122.33 8.65241 100.561 20.0244 82.041C31.3964 63.5208 40.1691 48.2498 53.4906 35.5782C66.8122 22.9065 84.0326 13.159 106.452 6.33584C128.871 -0.812285 156.489 -4.71127 162.987 10.2348Z",aspectRatio:{width:165,height:200},width:t,height:e}),blob3:({width:t,height:e})=>lt({path:"M158.095 64.2637C176.543 95.19 192.277 129.1 181.697 155.686C171.117 182.001 133.951 201.533 99.4982 199.905C64.7739 198.549 33.0338 176.032 15.4004 145.377C-2.23296 114.994 -5.75963 76.2002 10.2461 46.6303C26.2518 17.0605 61.5185 -3.557 89.732 0.512241C118.217 4.58149 139.377 33.0662 158.095 64.2637Z",aspectRatio:{width:186,height:200},width:t,height:e}),blob30:({width:t,height:e})=>lt({path:"M146.076 34.4585C157.052 54.582 155.833 80.1936 164.675 100.622C173.212 121.355 191.201 136.905 189.372 149.711C187.542 162.212 165.285 171.969 146.99 175.018C129.001 178.372 114.671 174.713 103.39 175.018C92.1083 175.018 83.876 178.982 66.8015 186.299C49.7271 193.617 23.8105 204.288 14.3586 198.19C4.90665 191.787 11.6145 168.615 10.3949 147.882C8.87037 127.148 -0.581561 108.549 0.0282404 89.3407C0.638042 70.1319 11.6145 50.6182 28.384 32.934C44.8487 15.5546 67.4113 0.309578 89.974 0.00467694C112.537 -0.300224 135.099 14.335 146.076 34.4585Z",aspectRatio:{width:190,height:200},width:t,height:e}),blob31:({width:t,height:e})=>lt({path:"M134.218 44.0392C153.568 36.4264 184.97 26.9105 195.755 33.2544C206.222 39.9156 195.755 62.1194 181.481 76.3933C166.89 90.35 148.175 96.0596 145.638 116.36C143.1 136.661 156.74 171.235 151.664 183.923C146.589 196.928 123.434 187.413 105.036 178.531C86.6388 169.967 73.3165 161.72 52.0643 158.548C30.812 155.058 1.62986 156.644 0.0438693 145.225C-1.22492 133.806 25.4197 109.382 29.2261 86.8609C32.7152 64.3398 13.6834 44.0392 11.7802 26.9105C9.877 9.46461 24.7853 -4.80928 42.5484 1.53467C59.9942 7.87863 79.9777 34.5232 93.6172 45.308C107.257 56.4099 114.869 51.3347 134.218 44.0392Z",aspectRatio:{width:200,height:191},width:t,height:e}),blob32:({width:t,height:e})=>lt({path:"M200 100.339C200 149.831 145.763 197.966 95.5932 197.966C45.7627 197.966 0 149.831 0 100.339C0 50.8475 45.7627 0 95.5932 0C145.763 0 200 50.8475 200 100.339Z",aspectRatio:{width:200,height:198},width:t,height:e}),blob4:({width:t,height:e})=>lt({path:"M183.427 38.712C198.21 63.2519 196.141 95.1833 189.341 126.523C182.836 157.863 171.305 188.908 150.609 197.482C130.208 205.76 100.642 192.16 69.8936 177.968C39.4405 164.072 7.80478 150.176 1.30024 128.593C-5.2043 107.01 13.718 77.7393 35.3012 51.7211C56.5888 25.9986 81.1287 3.23272 108.921 0.276112C137.009 -2.38484 168.349 14.4678 183.427 38.712Z",aspectRatio:{width:195,height:200},width:t,height:e}),blob5:({width:t,height:e})=>lt({path:"M166.251 30.6913C183.816 48.5185 195.875 71.8512 199.021 98.8542C202.429 125.595 197.186 155.744 179.359 169.115C161.794 182.223 131.645 178.815 103.331 176.979C75.0171 175.144 48.8006 174.882 29.6625 161.512C10.7866 148.141 -0.748681 121.925 0.0378149 96.2326C0.824311 70.8025 14.1947 46.159 33.0706 28.3318C52.2087 10.5045 76.8522 -0.5064 100.971 0.0179307C125.091 0.804426 148.423 12.864 166.251 30.6913Z",aspectRatio:{width:200,height:179},width:t,height:e}),blob6:({width:t,height:e})=>lt({path:"M149.146 50.5452C161.911 68.0278 171.901 81.9028 176.619 97.9979C181.336 114.37 180.781 133.241 173.011 149.891C165.519 166.541 151.366 180.693 133.051 189.851C114.736 199.008 92.2586 202.893 71.446 197.621C50.6334 192.348 30.9308 177.918 18.1658 158.216C5.12323 138.791 -0.981801 113.815 0.128204 87.7304C1.51571 61.6453 10.6733 34.1726 29.2658 17.5226C48.1359 1.14999 76.996 -4.40004 98.9186 3.6475C120.841 11.695 136.381 32.7851 149.146 50.5452Z",aspectRatio:{width:180,height:200},width:t,height:e}),blob7:({width:t,height:e})=>lt({path:"M158.662 41.8295C178.593 57.8305 204.138 64.5677 213.402 79.7266C222.666 94.6047 215.367 118.466 203.015 135.028C190.383 151.871 172.698 161.977 156.416 168.434C140.134 174.89 124.975 177.697 104.483 185.277C83.9903 192.856 58.1642 205.208 44.9704 197.629C31.4959 190.33 31.2152 163.1 21.9514 138.116C12.9684 112.851 -4.71688 90.1132 1.17822 75.5158C7.35404 61.1991 36.8295 55.5847 58.7256 40.1452C80.9024 24.7056 95.4998 -0.278374 109.816 0.00234533C124.414 0.283064 138.45 25.8285 158.662 41.8295Z",aspectRatio:{width:218,height:200},width:t,height:e}),blob8:({width:t,height:e})=>lt({path:"M153.53 11.0108C168.179 18.1858 181.931 29.5461 192.993 44.4939C203.755 59.4417 212.425 78.2759 210.631 96.5122C209.136 114.748 197.477 132.088 182.529 142.252C167.581 152.716 148.747 156.004 128.717 168.262C108.687 180.22 87.1622 201.147 69.8228 199.951C52.7823 198.456 39.6283 174.54 32.4533 153.015C25.2784 131.49 24.0826 112.357 16.6087 91.131C9.13477 70.2041 -4.31825 46.8855 1.36191 31.9377C7.04207 16.691 31.8554 9.51607 52.7823 5.33069C73.4103 0.846349 90.4507 -0.648433 106.594 0.248435C123.037 1.1453 138.882 4.13486 153.53 11.0108Z",aspectRatio:{width:211,height:200},width:t,height:e}),blob9:({width:t,height:e})=>lt({path:"M140.289 20.2182C156.96 27.7956 176.661 32.0895 189.29 43.9608C201.667 55.5796 206.718 75.0283 202.424 91.6987C198.131 108.622 184.491 122.766 175.651 140.952C166.81 158.885 162.769 180.607 150.393 191.216C138.016 201.824 117.052 201.572 98.866 197.025C80.6802 192.479 65.2727 183.891 48.3497 175.808C31.4268 167.726 13.2409 160.148 5.1583 146.761C-2.67172 133.122 -0.398493 113.673 4.14797 96.7504C8.69444 80.08 15.5141 65.6828 23.3442 52.296C31.4268 38.6566 40.5197 25.775 52.6436 15.6717C65.0201 5.82101 80.6802 -1.50385 95.3299 0.264221C109.98 1.77971 123.619 12.6407 140.289 20.2182Z",aspectRatio:{width:204,height:200},width:t,height:e})};function H8(t){return pD[t]||lb}function $8(t){const{subType:e}=t,r=H8(e);return r?(function(n,i){const{width:a,height:o,fill:s,stroke:u,strokeWidth:f,dash:d}=n,h=(d||[]).map(x=>x*f);let p=i(n),y=1,v=1;typeof p!="string"&&(y=p.scaleX,v=p.scaleY,p=p.path);const b=`clip-${n.id||Math.random()}`;return`
271
+ <svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${o}">
272
+ <defs>
273
+ <clipPath id="${b}">
274
+ <path d="${p}" />
275
+ </clipPath>
276
+ </defs>
277
+
278
+ <!-- Path for the fill -->
279
+ <path d="${p}" fill="${s}" transform="scale(${y}, ${v})"/>
280
+
281
+ <!-- Path for the stroke, clipped by the star path -->
282
+ <path d="${p}" fill="none" stroke="${u}" stroke-width="${2*f}" clip-path="url(#${b})" transform="scale(${y}, ${v})" stroke-dasharray="${h.join(" ")}"/>
283
+ </svg>
284
+ `})(t,r):(console.error(`Polotno error: Can not convert ${t.subType} figure to svg.`),lb(t))}const uv={},mD=Sr(({element:t,store:e})=>{const r=Y.useRef(null),n=t.selectable||e.role==="admin",i=wu(),a=e.selectedShapes.indexOf(t)>=0&&t.selectable,o=Math.min(t.strokeWidth,t.width/2,t.height/2),s=Math.max(0,Math.min(t.width/2,t.height/2,t.cornerRadius)),u=Go(t,t.a.fill,"fill"),f=Object.assign(Object.assign({width:t.a.width,height:t.a.height},u),{cornerRadius:s,opacity:t.animated("opacity"),shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,preventDefault:!i||a,hideInExport:!t.showInExport}),d=Go(t,t.stroke,"stroke"),h=Object.assign(Object.assign({visible:o>0,x:o/2,y:o/2,width:t.a.width-o,height:t.a.height-o},d),{strokeWidth:o,cornerRadius:Math.max(0,s-o),dash:t.dash.map(b=>b*o),opacity:t.animated("opacity"),hideInExport:!t.showInExport,listening:!1}),p=(y=t.subType,uv[y]||(uv[y]=(v=H8(y),Sr(({element:b,fillProps:x,strokeProps:k})=>{let S=v({width:b.a.width,height:b.a.height,cornerRadius:b.cornerRadius}),P=1,_=1;typeof S!="string"&&(P=S.scaleX,_=S.scaleY,S=S.path);const E=Y.useRef(null);return Y.createElement(Y.Fragment,null,Y.createElement(ur,{width:b.width,height:b.height,fill:"transparent"}),Y.createElement(gp,Object.assign({},x,{ref:E,data:S,scaleX:P,scaleY:_})),Y.createElement(Jt,{clipFunc:A=>{const T=E.current;if(T){var I=T.dataArray;A.beginPath();for(var L=0;L<I.length;L++){var R=I[L].command,N=I[L].points;switch(R){case"L":A.lineTo(N[0],N[1]);break;case"M":A.moveTo(N[0],N[1]);break;case"C":A.bezierCurveTo(N[0],N[1],N[2],N[3],N[4],N[5]);break;case"Q":A.quadraticCurveTo(N[0],N[1],N[2],N[3]);break;case"A":var F=N[0],H=N[1],$=N[2],X=N[3],Z=N[4],K=N[5],q=N[6],J=N[7],U=$>X?$:X,D=$>X?1:$/X,W=$>X?X/$:1;A.translate(F,H),A.rotate(q),A.scale(D,W),A.arc(0,0,U,Z,Z+K,1-J),A.scale(1/D,1/W),A.rotate(-q),A.translate(-F,-H);break;case"z":A.closePath()}}}},scaleX:P,scaleY:_},Y.createElement(gp,Object.assign({},k,{x:0,y:0,data:S,strokeWidth:2*k.strokeWidth,dash:k.dash.map(A=>A)}))))}))),uv[y]||Jt);var y,v;return Y.createElement(Y.Fragment,null,Y.createElement(Jt,{ref:r,id:t.id,x:t.a.x,y:t.a.y,rotation:t.a.rotation,opacity:t.a.opacity,listening:n,draggable:i?t.draggable&&a:t.draggable,name:"element",onDragMove:b=>{t.set({x:b.target.x(),y:b.target.y()})},onDragEnd:b=>{t.set({x:b.target.x(),y:b.target.y()})},onTransform:b=>{const x=b.target.scale();b.target.scaleX(1),b.target.scaleY(1),t.set({width:t.width*x.x,height:t.height*x.y,x:b.target.x(),y:b.target.y(),rotation:b.target.rotation()})}},Y.createElement(p,{element:t,fillProps:f,strokeProps:h})))});var Ts={},cv={},Cs={},Sx;function q8(){if(Sx)return Cs;Sx=1,Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.loop=Cs.conditional=Cs.parse=void 0;var t=function n(i,a){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:o;if(Array.isArray(a))a.forEach(function(f){return n(i,f,o,s)});else if(typeof a=="function")a(i,o,s,n);else{var u=Object.keys(a)[0];Array.isArray(a[u])?(s[u]={},n(i,a[u],o,s[u])):s[u]=a[u](i,o,s,n)}return o};Cs.parse=t;var e=function(i,a){return function(o,s,u,f){a(o,s,u)&&f(o,i,s,u)}};Cs.conditional=e;var r=function(i,a){return function(o,s,u,f){for(var d=[],h=o.pos;a(o,s,u);){var p={};if(f(o,i,s,p),o.pos===h)break;h=o.pos,d.push(p)}return d}};return Cs.loop=r,Cs}var nn={},kx;function V8(){if(kx)return nn;kx=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.readBits=nn.readArray=nn.readUnsigned=nn.readString=nn.peekBytes=nn.readBytes=nn.peekByte=nn.readByte=nn.buildStream=void 0;var t=function(h){return{data:h,pos:0}};nn.buildStream=t;var e=function(){return function(h){return h.data[h.pos++]}};nn.readByte=e;var r=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(p){return p.data[p.pos+h]}};nn.peekByte=r;var n=function(h){return function(p){return p.data.subarray(p.pos,p.pos+=h)}};nn.readBytes=n;var i=function(h){return function(p){return p.data.subarray(p.pos,p.pos+h)}};nn.peekBytes=i;var a=function(h){return function(p){return Array.from(n(h)(p)).map(function(y){return String.fromCharCode(y)}).join("")}};nn.readString=a;var o=function(h){return function(p){var y=n(2)(p);return h?(y[1]<<8)+y[0]:(y[0]<<8)+y[1]}};nn.readUnsigned=o;var s=function(h,p){return function(y,v,b){for(var x=typeof p=="function"?p(y,v,b):p,k=n(h),S=new Array(x),P=0;P<x;P++)S[P]=k(y);return S}};nn.readArray=s;var u=function(h,p,y){for(var v=0,b=0;b<y;b++)v+=h[p+b]&&Math.pow(2,y-b-1);return v},f=function(h){return function(p){for(var y=e()(p),v=new Array(8),b=0;b<8;b++)v[7-b]=!!(y&1<<b);return Object.keys(h).reduce(function(x,k){var S=h[k];return S.length?x[k]=u(v,S.index,S.length):x[k]=v[S.index],x},{})}};return nn.readBits=f,nn}var _x;function gD(){return _x||(_x=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=q8(),r=V8(),n={blocks:function(p){for(var y=0,v=[],b=p.data.length,x=0,k=(0,r.readByte)()(p);k!==y&&k;k=(0,r.readByte)()(p)){if(p.pos+k>=b){var S=b-p.pos;v.push((0,r.readBytes)(S)(p)),x+=S;break}v.push((0,r.readBytes)(k)(p)),x+=k}for(var P=new Uint8Array(x),_=0,E=0;E<v.length;E++)P.set(v[E],_),_+=v[E].length;return P}},i=(0,e.conditional)({gce:[{codes:(0,r.readBytes)(2)},{byteSize:(0,r.readByte)()},{extras:(0,r.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,r.readUnsigned)(!0)},{transparentColorIndex:(0,r.readByte)()},{terminator:(0,r.readByte)()}]},function(h){var p=(0,r.peekBytes)(2)(h);return p[0]===33&&p[1]===249}),a=(0,e.conditional)({image:[{code:(0,r.readByte)()},{descriptor:[{left:(0,r.readUnsigned)(!0)},{top:(0,r.readUnsigned)(!0)},{width:(0,r.readUnsigned)(!0)},{height:(0,r.readUnsigned)(!0)},{lct:(0,r.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,e.conditional)({lct:(0,r.readArray)(3,function(h,p,y){return Math.pow(2,y.descriptor.lct.size+1)})},function(h,p,y){return y.descriptor.lct.exists}),{data:[{minCodeSize:(0,r.readByte)()},n]}]},function(h){return(0,r.peekByte)()(h)===44}),o=(0,e.conditional)({text:[{codes:(0,r.readBytes)(2)},{blockSize:(0,r.readByte)()},{preData:function(p,y,v){return(0,r.readBytes)(v.text.blockSize)(p)}},n]},function(h){var p=(0,r.peekBytes)(2)(h);return p[0]===33&&p[1]===1}),s=(0,e.conditional)({application:[{codes:(0,r.readBytes)(2)},{blockSize:(0,r.readByte)()},{id:function(p,y,v){return(0,r.readString)(v.blockSize)(p)}},n]},function(h){var p=(0,r.peekBytes)(2)(h);return p[0]===33&&p[1]===255}),u=(0,e.conditional)({comment:[{codes:(0,r.readBytes)(2)},n]},function(h){var p=(0,r.peekBytes)(2)(h);return p[0]===33&&p[1]===254}),f=[{header:[{signature:(0,r.readString)(3)},{version:(0,r.readString)(3)}]},{lsd:[{width:(0,r.readUnsigned)(!0)},{height:(0,r.readUnsigned)(!0)},{gct:(0,r.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,r.readByte)()},{pixelAspectRatio:(0,r.readByte)()}]},(0,e.conditional)({gct:(0,r.readArray)(3,function(h,p){return Math.pow(2,p.lsd.gct.size+1)})},function(h,p){return p.lsd.gct.exists}),{frames:(0,e.loop)([i,s,u,a,o],function(h){var p=(0,r.peekByte)()(h);return p===33||p===44})}],d=f;t.default=d})(cv)),cv}var Lh={},Px;function yD(){if(Px)return Lh;Px=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.deinterlace=void 0;var t=function(r,n){for(var i=new Array(r.length),a=r.length/n,o=function(y,v){var b=r.slice(v*n,(v+1)*n);i.splice.apply(i,[y*n,n].concat(b))},s=[0,4,2,1],u=[8,8,4,2],f=0,d=0;d<4;d++)for(var h=s[d];h<a;h+=u[d])o(h,f),f++;return i};return Lh.deinterlace=t,Lh}var Fh={},Ex;function vD(){if(Ex)return Fh;Ex=1,Object.defineProperty(Fh,"__esModule",{value:!0}),Fh.lzw=void 0;var t=function(r,n,i){var a=4096,o=-1,s=i,u,f,d,h,p,y,v,T,b,x,A,k,I,L,N,R,S=new Array(i),P=new Array(a),_=new Array(a),E=new Array(a+1);for(k=r,f=1<<k,p=f+1,u=f+2,v=o,h=k+1,d=(1<<h)-1,b=0;b<f;b++)P[b]=0,_[b]=b;var A,T,I,L,R,N;for(A=T=I=L=R=N=0,x=0;x<s;){if(L===0){if(T<h){A+=n[N]<<T,T+=8,N++;continue}if(b=A&d,A>>=h,T-=h,b>u||b==p)break;if(b==f){h=k+1,d=(1<<h)-1,u=f+2,v=o;continue}if(v==o){E[L++]=_[b],v=b,I=b;continue}for(y=b,b==u&&(E[L++]=I,b=v);b>f;)E[L++]=_[b],b=P[b];I=_[b]&255,E[L++]=I,u<a&&(P[u]=v,_[u]=I,u++,(u&d)===0&&u<a&&(h++,d+=u)),v=y}L--,S[R++]=E[L],x++}for(x=R;x<s;x++)S[x]=0;return S};return Fh.lzw=t,Fh}var Tx;function bD(){if(Tx)return Ts;Tx=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.decompressFrames=Ts.decompressFrame=Ts.parseGIF=void 0;var t=a(gD()),e=q8(),r=V8(),n=yD(),i=vD();function a(d){return d&&d.__esModule?d:{default:d}}var o=function(h){var p=new Uint8Array(h);return(0,e.parse)((0,r.buildStream)(p),t.default)};Ts.parseGIF=o;var s=function(h){for(var p=h.pixels.length,y=new Uint8ClampedArray(p*4),v=0;v<p;v++){var b=v*4,x=h.pixels[v],k=h.colorTable[x]||[0,0,0];y[b]=k[0],y[b+1]=k[1],y[b+2]=k[2],y[b+3]=x!==h.transparentIndex?255:0}return y},u=function(h,p,y){if(!h.image){console.warn("gif frame does not have associated image.");return}var v=h.image,b=v.descriptor.width*v.descriptor.height,x=(0,i.lzw)(v.data.minCodeSize,v.data.blocks,b);v.descriptor.lct.interlaced&&(x=(0,n.deinterlace)(x,v.descriptor.width));var k={pixels:x,dims:{top:h.image.descriptor.top,left:h.image.descriptor.left,width:h.image.descriptor.width,height:h.image.descriptor.height}};return v.descriptor.lct&&v.descriptor.lct.exists?k.colorTable=v.lct:k.colorTable=p,h.gce&&(k.delay=(h.gce.delay||10)*10,k.disposalType=h.gce.extras.disposal,h.gce.extras.transparentColorGiven&&(k.transparentIndex=h.gce.transparentColorIndex)),y&&(k.patch=s(k)),k};Ts.decompressFrame=u;var f=function(h,p){return h.frames.filter(function(y){return y.image}).map(function(y){return u(y,h.gct,p)})};return Ts.decompressFrames=f,Ts}var Cx=bD();function fv(t,e,r){const n=e.getContext("2d"),i=r.getContext("2d");if(!n||!i)return;t.disposalType===2&&n.clearRect(0,0,e.width,e.height),r.width=t.width,r.height=t.height;const a=i.createImageData(t.width,t.height);a.data.set(t.patch),i.putImageData(a,0,0),n.drawImage(r,t.left,t.top)}const wD=Sr(({element:t})=>{const e=Math.min(30,t.width/4,t.height/4),r=Y.useRef(null);return Y.useEffect(()=>{const n=r.current;if(!n)return;const i=new _t.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}},[]),Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},Y.createElement(ur,{width:t.width,height:t.height,fill:"rgba(124, 173, 212, 0.8)"}),Y.createElement(A2,{ref:r,x:t.width/2,y:t.height/2,fill:"white",outerRadius:Math.abs(e),innerRadius:Math.max(1,e-5),angle:270}))}),xD=Sr(({element:t})=>{const e=Math.max(10,Math.min(30,t.width/22));return Y.createElement(Jt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},Y.createElement(ur,{width:t.width,height:t.height,fill:"rgba(223, 102, 102, 0.8)"}),Y.createElement(qo,{text:"Cannot load the GIF...",fontSize:e,width:t.width,height:t.height,align:"center",fill:"white",verticalAlign:"middle",padding:5}))}),SD=Sr(({element:t,store:e})=>{var r;const[n,i]=Y.useState(!1),a=e.selectedShapes.indexOf(t)>=0&&t.selectable,o=Y.useRef(null),s=Y.useRef(),[u,f,d,h]=(function(L){const[R,N]=Y.useState([]),[F,H]=Y.useState(0),[$,X]=Y.useState("loading"),[Z,K]=Y.useState({width:0,height:0});return Y.useEffect(()=>{(async()=>{try{const q=await fetch(L),J=await q.arrayBuffer(),U=Cx.parseGIF(J),D=Cx.decompressFrames(U,!0),W=U.lsd.width,V=U.lsd.height;K({width:W,height:V});const ee=D.map(Q=>({patch:new Uint8ClampedArray(Q.patch),delay:Q.delay,width:Q.dims.width,height:Q.dims.height,left:Q.dims.left,top:Q.dims.top,disposalType:Q.disposalType})),te=ee.reduce((Q,ne)=>Q+ne.delay,0);N(ee),H(te),X("loaded")}catch(q){console.error("Failed to load GIF:",q),X("failed")}})()},[L]),[R,F,Z,$]})(t.src);op(h,t.src,t.id),Y.useEffect(()=>(s.current=document.createElement("canvas"),()=>{s.current&&_t.Util.releaseCanvas(s.current)}),[]),Y.useEffect(()=>{if(h==="loaded"&&s.current&&(s.current.width=d.width,s.current.height=d.height,u.length>0)){const L=s.current.getContext("2d");if(L){L.clearRect(0,0,d.width,d.height);const R=document.createElement("canvas");fv(u[0],s.current,R)}}},[d,h,u]),Y.useEffect(()=>{if(!u.length||!s.current)return;const L=s.current;L.width=d.width,L.height=d.height;const R=document.createElement("canvas"),N=L.getContext("2d");N&&N.clearRect(0,0,L.width,L.height);let F=-1;fv(u[0],L,R),P(),F=0;const H=$=>{const X=(Z=>{const K=Z%f;let q=0;for(let J=0;J<u.length;J++)if(q+=u[J].delay,q>K)return J;return 0})($);X!==F&&(fv(u[X],L,R),P(),o.current.getLayer().draw(),F=X)};if(e.isPlaying||t.page._exportingOrRendering)return io(()=>{H(e.currentTime-t.page.startTime)});{const $=window.setInterval(()=>{H(e.currentTime||performance.now())},16);return()=>{clearInterval($)}}},[e.isPlaying,u,f,t.page._exportingOrRendering]),Y.useEffect(()=>{f&&e.history.ignore(()=>{t.set({duration:f})})},[f]);let{cropX:p,cropY:y,cropWidth:v,cropHeight:b}=t;h!=="loaded"&&(p=y=0,v=b=1);const x={x:d.width*p,y:d.height*y,width:d.width*v,height:d.height*b},k=(r=t.cornerRadius)!==null&&r!==void 0?r:0,[S,P]=U8(t,s.current,x,e._elementsPixelRatio,k,n||t._cropModeEnabled);Y.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled&&o.current)return Fi(o.current,t),io(()=>{Fi(o.current,t)},{delay:100})},[s.current,n,v,b,t._cropModeEnabled,d.width,d.height]);const _=h==="loading",E=h==="failed",A=_||E?0:t.a.opacity;Bp(o,A);const T=t.selectable||e.role==="admin",I=wu();return Y.createElement(Y.Fragment,null,_&&Y.createElement(wD,{element:t}),E&&Y.createElement(xD,{element:t}),Y.createElement(zo,{ref:o,name:"element",id:t.id,image:S,x:t.a.x,y:t.a.y,width:t.a.width||1,height:t.a.height||1,rotation:t.a.rotation,opacity:A,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,customCrop:x,listening:T,draggable:I?t.draggable&&a:t.draggable,preventDefault:!I||a,hideInExport:!t.showInExport,onDragMove:L=>{t.set({x:L.target.x(),y:L.target.y()})},onDragEnd:L=>{t.set({x:L.target.x(),y:L.target.y()})},onTransformStart:()=>i(!0),onTransform:L=>{const R=L.currentTarget,N=Math.abs(R.scaleX()-1)<1e-7?1:R.scaleX(),F=Math.abs(R.scaleY()-1)<1e-7?1:R.scaleY();R.scaleX(1),R.scaleY(1),t.set({x:R.x(),y:R.y(),width:R.width()*N,height:R.height()*F,rotation:R.rotation()})},onTransformEnd:()=>i(!1)}),Y.createElement(ur,{x:t.a.x,y:t.a.y,width:Math.max(t.a.width-t.borderSize,0),height:Math.max(t.a.height-t.borderSize,0),opacity:A,offsetX:-t.borderSize/2,offsetY:-t.borderSize/2,stroke:t.borderColor,strokeWidth:t.borderSize,listening:!1,visible:!!t.borderSize,rotation:t.rotation,cornerRadius:Math.max(0,k-t.borderSize),hideInExport:!t.showInExport}))}),kD={stroke:"rgb(0, 161, 255)",strokeWidth:2},_D=Sr(({element:t})=>Y.createElement(ur,Object.assign({name:"highlighter",x:t.a.x,y:t.a.y,rotation:t.a.rotation,width:t.a.width,height:t.a.height,listening:!1,strokeScaleEnabled:!1},kD)));let Aa=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");const fp=function(t,e){if(t===e)return!0;if(typeof t=="object"&&t!=null&&typeof e=="object"&&e!=null){if(Object.keys(t).length!=Object.keys(e).length)return!1;for(var r in t)if(!e.hasOwnProperty(r)||!fp(t[r],e[r]))return!1;return!0}return!1};Object.assign(ut);const PD=ut.model("UndoManager",{history:ut.array(ut.frozen()),undoIdx:-1,targetPath:""}).views(t=>({get canUndo(){return t.undoIdx>0},get canRedo(){return t.undoIdx<t.history.length-1}})).actions(t=>{let e,r,n=!1,i=null,a=0,o=0;const s=()=>o>0;function u(){const h=Fo(e);return{pages:h.pages,width:h.width,height:h.height,custom:h.custom,audios:h.audios}}function f(h){const p=e.pages.map(x=>x.id),y=h.pages.map(x=>x.id),v=!fp(p,y),b=!fp(e.custom,h.custom);v?Gv(e.pages,h.pages):e.pages.forEach((x,k)=>{Gv(x,h.pages[k])}),b&&e.set({custom:h.custom}),e.setSize(h.width,h.height)}const d={startTransaction(){o++},endTransaction(h){o--,h||d.requestAddState(u())},async ignore(h,p=!1,y=!1){y&&await new Promise(S=>setTimeout(S,10)),a&&d.addUndoState();let v=s();d.startTransaction();let b=o;try{await h()}catch(S){setTimeout(()=>{throw S})}const x=b!==o,k=!x;d.endTransaction(k),p||v||d.replaceState(),x||(clearTimeout(a),a=0)},async transaction(h){await d.ignore(h,!0),d.addUndoState()},requestAddState(h){i=h,a||s()||(n?n=!1:a=setTimeout(()=>{a=0,clearTimeout(a),s()||d.addUndoState()},100))},addUndoState(){if(n)return void(n=!1);const h=t.history[t.undoIdx];!fp(i,h)&&(clearTimeout(a),a=0,t.history.splice(t.undoIdx+1),t.history.push(i),t.undoIdx=t.history.length-1)},afterCreate(){if(e=_C(t,".."),!e)throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");r=Q5(e,()=>{d.requestAddState(u())}),t.history.length===0&&d.requestAddState(u())},clear(){clearTimeout(a),a=0,t.history.splice(0,t.history.length),t.undoIdx=-1,d.addUndoState()},beforeDestroy(){r()},undo(){a&&d.addUndoState(),s()?f(t.history[t.undoIdx]):t.canUndo?(t.undoIdx--,n=!0,f(t.history[t.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){a&&d.addUndoState(),t.canRedo?(t.undoIdx++,n=!0,f(t.history[t.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){t.history[t.undoIdx]=u()}};return d});async function hg(t,e){const r=await(await fetch(t)).blob(),n=document.createElement("a"),i=URL.createObjectURL(r);n.href=i,n.download=e,document.body.appendChild(n),n.click(),setTimeout(function(){document.body.removeChild(n),window.URL.revokeObjectURL(i)},0)}let Bh=null;function ED(){var t;return!((t=window.jspdf)===null||t===void 0)&&t.jsPDF?Promise.resolve(window.jspdf.jsPDF):Bh||(typeof window.__polotnoLoadJspdf=="function"?(Bh=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),Bh):(Bh=new Promise(e=>{var r=document.createElement("script");r.onload=function(){e(window.jspdf.jsPDF)},r.src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/3.0.1/jspdf.umd.min.js",document.head.appendChild(r)}),Bh))}function TD(){return window.GIF?Promise.resolve(window.GIF):new Promise(t=>{var e=document.createElement("script");e.onload=function(){t(window.GIF)},e.src="https://cdnjs.cloudflare.com/ajax/libs/gif.js/0.2.0/gif.js",document.head.appendChild(e)})}async function CD({width:t,height:e}){return new(await TD())({workers:4,width:t,height:e,workerScript:URL.createObjectURL(new Blob([`// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js
285
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var NeuQuant=require("./TypedNeuQuant.js");var LZWEncoder=require("./LZWEncoder.js");function ByteArray(){this.page=-1;this.pages=[];this.newPage()}ByteArray.pageSize=4096;ByteArray.charMap={};for(var i=0;i<256;i++)ByteArray.charMap[i]=String.fromCharCode(i);ByteArray.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(ByteArray.pageSize);this.cursor=0};ByteArray.prototype.getData=function(){var rv="";for(var p=0;p<this.pages.length;p++){for(var i=0;i<ByteArray.pageSize;i++){rv+=ByteArray.charMap[this.pages[p][i]]}}return rv};ByteArray.prototype.writeByte=function(val){if(this.cursor>=ByteArray.pageSize)this.newPage();this.pages[this.page][this.cursor++]=val};ByteArray.prototype.writeUTFBytes=function(string){for(var l=string.length,i=0;i<l;i++)this.writeByte(string.charCodeAt(i))};ByteArray.prototype.writeBytes=function(array,offset,length){for(var l=length||array.length,i=offset||0;i<l;i++)this.writeByte(array[i])};function GIFEncoder(width,height){this.width=~~width;this.height=~~height;this.transparent=null;this.transIndex=0;this.repeat=-1;this.delay=0;this.image=null;this.pixels=null;this.indexedPixels=null;this.colorDepth=null;this.colorTab=null;this.neuQuant=null;this.usedEntry=new Array;this.palSize=7;this.dispose=-1;this.firstFrame=true;this.sample=10;this.dither=false;this.globalPalette=false;this.out=new ByteArray}GIFEncoder.prototype.setDelay=function(milliseconds){this.delay=Math.round(milliseconds/10)};GIFEncoder.prototype.setFrameRate=function(fps){this.delay=Math.round(100/fps)};GIFEncoder.prototype.setDispose=function(disposalCode){if(disposalCode>=0)this.dispose=disposalCode};GIFEncoder.prototype.setRepeat=function(repeat){this.repeat=repeat};GIFEncoder.prototype.setTransparent=function(color){this.transparent=color};GIFEncoder.prototype.addFrame=function(imageData){this.image=imageData;this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null;this.getImagePixels();this.analyzePixels();if(this.globalPalette===true)this.globalPalette=this.colorTab;if(this.firstFrame){this.writeLSD();this.writePalette();if(this.repeat>=0){this.writeNetscapeExt()}}this.writeGraphicCtrlExt();this.writeImageDesc();if(!this.firstFrame&&!this.globalPalette)this.writePalette();this.writePixels();this.firstFrame=false};GIFEncoder.prototype.finish=function(){this.out.writeByte(59)};GIFEncoder.prototype.setQuality=function(quality){if(quality<1)quality=1;this.sample=quality};GIFEncoder.prototype.setDither=function(dither){if(dither===true)dither="FloydSteinberg";this.dither=dither};GIFEncoder.prototype.setGlobalPalette=function(palette){this.globalPalette=palette};GIFEncoder.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};GIFEncoder.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};GIFEncoder.prototype.analyzePixels=function(){if(!this.colorTab){this.neuQuant=new NeuQuant(this.pixels,this.sample);this.neuQuant.buildColormap();this.colorTab=this.neuQuant.getColormap()}if(this.dither){this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null)}else{this.indexPixels()}this.pixels=null;this.colorDepth=8;this.palSize=7;if(this.transparent!==null){this.transIndex=this.findClosest(this.transparent,true)}};GIFEncoder.prototype.indexPixels=function(imgq){var nPix=this.pixels.length/3;this.indexedPixels=new Uint8Array(nPix);var k=0;for(var j=0;j<nPix;j++){var index=this.findClosestRGB(this.pixels[k++]&255,this.pixels[k++]&255,this.pixels[k++]&255);this.usedEntry[index]=true;this.indexedPixels[j]=index}};GIFEncoder.prototype.ditherPixels=function(kernel,serpentine){var kernels={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[2/8,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!kernel||!kernels[kernel]){throw"Unknown dithering kernel: "+kernel}var ds=kernels[kernel];var index=0,height=this.height,width=this.width,data=this.pixels;var direction=serpentine?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var y=0;y<height;y++){if(serpentine)direction=direction*-1;for(var x=direction==1?0:width-1,xend=direction==1?width:0;x!==xend;x+=direction){index=y*width+x;var idx=index*3;var r1=data[idx];var g1=data[idx+1];var b1=data[idx+2];idx=this.findClosestRGB(r1,g1,b1);this.usedEntry[idx]=true;this.indexedPixels[index]=idx;idx*=3;var r2=this.colorTab[idx];var g2=this.colorTab[idx+1];var b2=this.colorTab[idx+2];var er=r1-r2;var eg=g1-g2;var eb=b1-b2;for(var i=direction==1?0:ds.length-1,end=direction==1?ds.length:0;i!==end;i+=direction){var x1=ds[i][1];var y1=ds[i][2];if(x1+x>=0&&x1+x<width&&y1+y>=0&&y1+y<height){var d=ds[i][0];idx=index+x1+y1*width;idx*=3;data[idx]=Math.max(0,Math.min(255,data[idx]+er*d));data[idx+1]=Math.max(0,Math.min(255,data[idx+1]+eg*d));data[idx+2]=Math.max(0,Math.min(255,data[idx+2]+eb*d))}}}}};GIFEncoder.prototype.findClosest=function(c,used){return this.findClosestRGB((c&16711680)>>16,(c&65280)>>8,c&255,used)};GIFEncoder.prototype.findClosestRGB=function(r,g,b,used){if(this.colorTab===null)return-1;if(this.neuQuant&&!used){return this.neuQuant.lookupRGB(r,g,b)}var c=b|g<<8|r<<16;var minpos=0;var dmin=256*256*256;var len=this.colorTab.length;for(var i=0,index=0;i<len;index++){var dr=r-(this.colorTab[i++]&255);var dg=g-(this.colorTab[i++]&255);var db=b-(this.colorTab[i++]&255);var d=dr*dr+dg*dg+db*db;if((!used||this.usedEntry[index])&&d<dmin){dmin=d;minpos=index}}return minpos};GIFEncoder.prototype.getImagePixels=function(){var w=this.width;var h=this.height;this.pixels=new Uint8Array(w*h*3);var data=this.image;var srcPos=0;var count=0;for(var i=0;i<h;i++){for(var j=0;j<w;j++){this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];srcPos++}}};GIFEncoder.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33);this.out.writeByte(249);this.out.writeByte(4);var transp,disp;if(this.transparent===null){transp=0;disp=0}else{transp=1;disp=2}if(this.dispose>=0){disp=dispose&7}disp<<=2;this.out.writeByte(0|disp|0|transp);this.writeShort(this.delay);this.out.writeByte(this.transIndex);this.out.writeByte(0)};GIFEncoder.prototype.writeImageDesc=function(){this.out.writeByte(44);this.writeShort(0);this.writeShort(0);this.writeShort(this.width);this.writeShort(this.height);if(this.firstFrame||this.globalPalette){this.out.writeByte(0)}else{this.out.writeByte(128|0|0|0|this.palSize)}};GIFEncoder.prototype.writeLSD=function(){this.writeShort(this.width);this.writeShort(this.height);this.out.writeByte(128|112|0|this.palSize);this.out.writeByte(0);this.out.writeByte(0)};GIFEncoder.prototype.writeNetscapeExt=function(){this.out.writeByte(33);this.out.writeByte(255);this.out.writeByte(11);this.out.writeUTFBytes("NETSCAPE2.0");this.out.writeByte(3);this.out.writeByte(1);this.writeShort(this.repeat);this.out.writeByte(0)};GIFEncoder.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);var n=3*256-this.colorTab.length;for(var i=0;i<n;i++)this.out.writeByte(0)};GIFEncoder.prototype.writeShort=function(pValue){this.out.writeByte(pValue&255);this.out.writeByte(pValue>>8&255)};GIFEncoder.prototype.writePixels=function(){var enc=new LZWEncoder(this.width,this.height,this.indexedPixels,this.colorDepth);enc.encode(this.out)};GIFEncoder.prototype.stream=function(){return this.out};module.exports=GIFEncoder},{"./LZWEncoder.js":2,"./TypedNeuQuant.js":3}],2:[function(require,module,exports){var EOF=-1;var BITS=12;var HSIZE=5003;var masks=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function LZWEncoder(width,height,pixels,colorDepth){var initCodeSize=Math.max(2,colorDepth);var accum=new Uint8Array(256);var htab=new Int32Array(HSIZE);var codetab=new Int32Array(HSIZE);var cur_accum,cur_bits=0;var a_count;var free_ent=0;var maxcode;var clear_flg=false;var g_init_bits,ClearCode,EOFCode;function char_out(c,outs){accum[a_count++]=c;if(a_count>=254)flush_char(outs)}function cl_block(outs){cl_hash(HSIZE);free_ent=ClearCode+2;clear_flg=true;output(ClearCode,outs)}function cl_hash(hsize){for(var i=0;i<hsize;++i)htab[i]=-1}function compress(init_bits,outs){var fcode,c,i,ent,disp,hsize_reg,hshift;g_init_bits=init_bits;clear_flg=false;n_bits=g_init_bits;maxcode=MAXCODE(n_bits);ClearCode=1<<init_bits-1;EOFCode=ClearCode+1;free_ent=ClearCode+2;a_count=0;ent=nextPixel();hshift=0;for(fcode=HSIZE;fcode<65536;fcode*=2)++hshift;hshift=8-hshift;hsize_reg=HSIZE;cl_hash(hsize_reg);output(ClearCode,outs);outer_loop:while((c=nextPixel())!=EOF){fcode=(c<<BITS)+ent;i=c<<hshift^ent;if(htab[i]===fcode){ent=codetab[i];continue}else if(htab[i]>=0){disp=hsize_reg-i;if(i===0)disp=1;do{if((i-=disp)<0)i+=hsize_reg;if(htab[i]===fcode){ent=codetab[i];continue outer_loop}}while(htab[i]>=0)}output(ent,outs);ent=c;if(free_ent<1<<BITS){codetab[i]=free_ent++;htab[i]=fcode}else{cl_block(outs)}}output(ent,outs);output(EOFCode,outs)}function encode(outs){outs.writeByte(initCodeSize);remaining=width*height;curPixel=0;compress(initCodeSize+1,outs);outs.writeByte(0)}function flush_char(outs){if(a_count>0){outs.writeByte(a_count);outs.writeBytes(accum,0,a_count);a_count=0}}function MAXCODE(n_bits){return(1<<n_bits)-1}function nextPixel(){if(remaining===0)return EOF;--remaining;var pix=pixels[curPixel++];return pix&255}function output(code,outs){cur_accum&=masks[cur_bits];if(cur_bits>0)cur_accum|=code<<cur_bits;else cur_accum=code;cur_bits+=n_bits;while(cur_bits>=8){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}if(free_ent>maxcode||clear_flg){if(clear_flg){maxcode=MAXCODE(n_bits=g_init_bits);clear_flg=false}else{++n_bits;if(n_bits==BITS)maxcode=1<<BITS;else maxcode=MAXCODE(n_bits)}}if(code==EOFCode){while(cur_bits>0){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}flush_char(outs)}}this.encode=encode}module.exports=LZWEncoder},{}],3:[function(require,module,exports){var ncycles=100;var netsize=256;var maxnetpos=netsize-1;var netbiasshift=4;var intbiasshift=16;var intbias=1<<intbiasshift;var gammashift=10;var gamma=1<<gammashift;var betashift=10;var beta=intbias>>betashift;var betagamma=intbias<<gammashift-betashift;var initrad=netsize>>3;var radiusbiasshift=6;var radiusbias=1<<radiusbiasshift;var initradius=initrad*radiusbias;var radiusdec=30;var alphabiasshift=10;var initalpha=1<<alphabiasshift;var alphadec;var radbiasshift=8;var radbias=1<<radbiasshift;var alpharadbshift=alphabiasshift+radbiasshift;var alpharadbias=1<<alpharadbshift;var prime1=499;var prime2=491;var prime3=487;var prime4=503;var minpicturebytes=3*prime4;function NeuQuant(pixels,samplefac){var network;var netindex;var bias;var freq;var radpower;function init(){network=[];netindex=new Int32Array(256);bias=new Int32Array(netsize);freq=new Int32Array(netsize);radpower=new Int32Array(netsize>>3);var i,v;for(i=0;i<netsize;i++){v=(i<<netbiasshift+8)/netsize;network[i]=new Float64Array([v,v,v,0]);freq[i]=intbias/netsize;bias[i]=0}}function unbiasnet(){for(var i=0;i<netsize;i++){network[i][0]>>=netbiasshift;network[i][1]>>=netbiasshift;network[i][2]>>=netbiasshift;network[i][3]=i}}function altersingle(alpha,i,b,g,r){network[i][0]-=alpha*(network[i][0]-b)/initalpha;network[i][1]-=alpha*(network[i][1]-g)/initalpha;network[i][2]-=alpha*(network[i][2]-r)/initalpha}function alterneigh(radius,i,b,g,r){var lo=Math.abs(i-radius);var hi=Math.min(i+radius,netsize);var j=i+1;var k=i-1;var m=1;var p,a;while(j<hi||k>lo){a=radpower[m++];if(j<hi){p=network[j++];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}if(k>lo){p=network[k--];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}}}function contest(b,g,r){var bestd=~(1<<31);var bestbiasd=bestd;var bestpos=-1;var bestbiaspos=bestpos;var i,n,dist,biasdist,betafreq;for(i=0;i<netsize;i++){n=network[i];dist=Math.abs(n[0]-b)+Math.abs(n[1]-g)+Math.abs(n[2]-r);if(dist<bestd){bestd=dist;bestpos=i}biasdist=dist-(bias[i]>>intbiasshift-netbiasshift);if(biasdist<bestbiasd){bestbiasd=biasdist;bestbiaspos=i}betafreq=freq[i]>>betashift;freq[i]-=betafreq;bias[i]+=betafreq<<gammashift}freq[bestpos]+=beta;bias[bestpos]-=betagamma;return bestbiaspos}function inxbuild(){var i,j,p,q,smallpos,smallval,previouscol=0,startpos=0;for(i=0;i<netsize;i++){p=network[i];smallpos=i;smallval=p[1];for(j=i+1;j<netsize;j++){q=network[j];if(q[1]<smallval){smallpos=j;smallval=q[1]}}q=network[smallpos];if(i!=smallpos){j=q[0];q[0]=p[0];p[0]=j;j=q[1];q[1]=p[1];p[1]=j;j=q[2];q[2]=p[2];p[2]=j;j=q[3];q[3]=p[3];p[3]=j}if(smallval!=previouscol){netindex[previouscol]=startpos+i>>1;for(j=previouscol+1;j<smallval;j++)netindex[j]=i;previouscol=smallval;startpos=i}}netindex[previouscol]=startpos+maxnetpos>>1;for(j=previouscol+1;j<256;j++)netindex[j]=maxnetpos}function inxsearch(b,g,r){var a,p,dist;var bestd=1e3;var best=-1;var i=netindex[g];var j=i-1;while(i<netsize||j>=0){if(i<netsize){p=network[i];dist=p[1]-g;if(dist>=bestd)i=netsize;else{i++;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}if(j>=0){p=network[j];dist=g-p[1];if(dist>=bestd)j=-1;else{j--;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}}return best}function learn(){var i;var lengthcount=pixels.length;var alphadec=30+(samplefac-1)/3;var samplepixels=lengthcount/(3*samplefac);var delta=~~(samplepixels/ncycles);var alpha=initalpha;var radius=initradius;var rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(i=0;i<rad;i++)radpower[i]=alpha*((rad*rad-i*i)*radbias/(rad*rad));var step;if(lengthcount<minpicturebytes){samplefac=1;step=3}else if(lengthcount%prime1!==0){step=3*prime1}else if(lengthcount%prime2!==0){step=3*prime2}else if(lengthcount%prime3!==0){step=3*prime3}else{step=3*prime4}var b,g,r,j;var pix=0;i=0;while(i<samplepixels){b=(pixels[pix]&255)<<netbiasshift;g=(pixels[pix+1]&255)<<netbiasshift;r=(pixels[pix+2]&255)<<netbiasshift;j=contest(b,g,r);altersingle(alpha,j,b,g,r);if(rad!==0)alterneigh(rad,j,b,g,r);pix+=step;if(pix>=lengthcount)pix-=lengthcount;i++;if(delta===0)delta=1;if(i%delta===0){alpha-=alpha/alphadec;radius-=radius/radiusdec;rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(j=0;j<rad;j++)radpower[j]=alpha*((rad*rad-j*j)*radbias/(rad*rad))}}}function buildColormap(){init();learn();unbiasnet();inxbuild()}this.buildColormap=buildColormap;function getColormap(){var map=[];var index=[];for(var i=0;i<netsize;i++)index[network[i][3]]=i;var k=0;for(var l=0;l<netsize;l++){var j=index[l];map[k++]=network[j][0];map[k++]=network[j][1];map[k++]=network[j][2]}return map}this.getColormap=getColormap;this.lookupRGB=inxsearch}module.exports=NeuQuant},{}],4:[function(require,module,exports){var GIFEncoder,renderFrame;GIFEncoder=require("./GIFEncoder.js");renderFrame=function(frame){var encoder,page,stream,transfer;encoder=new GIFEncoder(frame.width,frame.height);if(frame.index===0){encoder.writeHeader()}else{encoder.firstFrame=false}encoder.setTransparent(frame.transparent);encoder.setRepeat(frame.repeat);encoder.setDelay(frame.delay);encoder.setQuality(frame.quality);encoder.setDither(frame.dither);encoder.setGlobalPalette(frame.globalPalette);encoder.addFrame(frame.data);if(frame.last){encoder.finish()}if(frame.globalPalette===true){frame.globalPalette=encoder.getGlobalPalette()}stream=encoder.stream();frame.data=stream.pages;frame.cursor=stream.cursor;frame.pageSize=stream.constructor.pageSize;if(frame.canTransfer){transfer=function(){var i,len,ref,results;ref=frame.data;results=[];for(i=0,len=ref.length;i<len;i++){page=ref[i];results.push(page.buffer)}return results}();return self.postMessage(frame,transfer)}else{return self.postMessage(frame)}};self.onmessage=function(event){return renderFrame(event.data)}},{"./GIFEncoder.js":1}]},{},[4]);
286
+ `],{type:"application/javascript"}))})}const OD="https://api.polotno.com",AD=()=>OD+"/api",W8=Gt({value:!1}),G8=Gt({value:"v1"}),ID=()=>G8.value,RD=()=>W8.value,MD=Ft(()=>{W8.value=!0});let Kh=typeof window<"u"?window.location.origin:"";const DD=typeof navigator<"u"&&navigator.userAgent.indexOf("Headless")>-1,ND=typeof navigator<"u"&&navigator.userAgent.indexOf("Electron")>-1;Kh==="file://"&&DD&&(Kh="headless"),Kh==="file://"&&ND&&(Kh="electron");const LD=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${Kh}" here: https://polotno.com/cabinet`;let FD=fetch;async function BD(t){for(let e=0;e<5;e++)try{const r=await FD(AD()+"/validate-key",{method:"POST",body:JSON.stringify({key:t,site:location.host,skdVersion:"2.36.0"})});if(Ls(()=>{G8.value=r.headers.get("x-api-version")||""}),!t)return console.warn("Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.com/cabinet"),!1;if(r.status!==200){await new Promise(i=>setTimeout(i,3e3));continue}const n=await r.json();return n.is_valid||console.warn("Polotno API key is not valid. Please get new API key here: https://polotno.com/cabinet"),n.is_paid||console.log("%cPolotno Free Version. For development usage only. https://polotno.com/","background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),n.is_domain_valid||console.log(LD,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),W5(n.remove_background_enabled),n.is_paid||!1}catch{await new Promise(n=>setTimeout(n,3e3))}return console.error("Can not validate Polotno API key. Please report to anton@polotno.com immediately."),!0}async function zD(t,e){await BD(t)&&!e||MD()}const dv=[112,72,89,115],jD=(()=>{const t=new Uint32Array(256);for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r>>>0}return t})(),Ox=()=>typeof globalThis<"u"?globalThis.Buffer:void 0,Ax=(t,e,r)=>{t[e]=r>>>24&255,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=255&r},UD=(t,e,r)=>{const n=t.indexOf(","),i=(o=>{if(typeof atob=="function"){const u=atob(o),f=new Uint8Array(u.length);for(let d=0;d<u.length;d++)f[d]=u.charCodeAt(d);return f}const s=Ox();if(s)return new Uint8Array(s.from(o,"base64"));throw new Error("No base64 decoder available")})(n>=0?t.slice(n+1):t),a=e==="image/png"?((o,s)=>{const u=(p=>{const y=new Uint8Array(9),v=new DataView(y.buffer);v.setUint32(0,p,!1),v.setUint32(4,p,!1),y[8]=1;const b=new Uint8Array(8+y.length+4);Ax(b,0,y.length),b.set(dv,4),b.set(y,8);const x=new Uint8Array(4+y.length);return x.set(dv,0),x.set(y,4),Ax(b,8+y.length,(k=>{let S=4294967295;for(let P=0;P<k.length;P++)S=jD[255&(S^k[P])]^S>>>8;return(4294967295^S)>>>0})(x)),b})(Math.round(s/.0254)),f=((p,y)=>{let v=8;for(;v+8<=p.length;){const b=p[v]<<24|p[v+1]<<16|p[v+2]<<8|p[v+3],x=v+4,k=p.subarray(x,x+4),S=8+b+4;if(y.every((P,_)=>k[_]===P))return{offset:v,totalLength:S};v+=S}return null})(o,dv);if(f){const p=new Uint8Array(o.length-f.totalLength+u.length);return p.set(o.slice(0,f.offset),0),p.set(u,f.offset),p.set(o.slice(f.offset+f.totalLength),f.offset+u.length),p}const d=16+(o[8]<<24|o[9]<<16|o[10]<<8|o[11])+4;if(d>o.length)return o;const h=new Uint8Array(o.length+u.length);return h.set(o.slice(0,d),0),h.set(u,d),h.set(o.slice(d),d+u.length),h})(i,r):((o,s)=>{const u=(h=>{let p=2;for(;p+4<h.length;){if(h[p]!==255)return-1;const y=h[p+1];if(y===216||y===217){p+=2;continue}const v=h[p+2]<<8|h[p+3];if(v<2)return-1;if(y===224&&h[p+4]===74&&h[p+5]===70&&h[p+6]===73&&h[p+7]===70&&h[p+8]===0)return p;const b=p+2+v;if(b<=p||b>h.length)return-1;p=b}return-1})(o);if(u>=0){const h=new Uint8Array(o),p=u+11;return h[p]=1,h[p+1]=s>>8&255,h[p+2]=255&s,h[p+3]=s>>8&255,h[p+4]=255&s,h}const f=(h=>{const p=new Uint8Array(18);return p[0]=255,p[1]=224,p[2]=0,p[3]=16,p[4]=74,p[5]=70,p[6]=73,p[7]=70,p[8]=0,p[9]=1,p[10]=1,p[11]=1,p[12]=h>>8&255,p[13]=255&h,p[14]=h>>8&255,p[15]=255&h,p})(s),d=new Uint8Array(o.length+f.length);return d.set(o.subarray(0,2),0),d.set(f,2),d.set(o.subarray(2),2+f.length),d})(i,r);return`data:${e};base64,${(o=>{if(typeof btoa=="function"){let u="";for(let f=0;f<o.length;f++)u+=String.fromCharCode(o[f]);return btoa(u)}const s=Ox();if(s)return s.from(o).toString("base64");throw new Error("No base64 encoder available")})(a)}`},I0=({px:t,unit:e="px",dpi:r})=>{switch(e){case"pt":default:return t;case"mm":return t/(r/25.4);case"cm":return t/(r/2.54);case"in":return t/r}},Ix=({px:t,precious:e=2,dpi:r=72,unit:n="px"})=>parseFloat(I0({px:t,dpi:r,unit:n}).toFixed(e)),Rx=({unitVal:t,dpi:e,unit:r})=>t/I0({px:1,unit:r,dpi:e}),HD=t=>{const e=parseFloat(I0(t).toFixed(1));switch(t.unit){case"pt":return`${Math.round(e)}pt`;case"mm":return`${e}mm`;case"cm":return`${e}cm`;case"in":return`${e}in`;default:return`${Math.round(e)}px`}};async function $D(t){for(let e=0;e<30;e++){const r=await t();if(r)return r;await new Promise(n=>setTimeout(n,50))}}function $p(t){return new Promise((e,r)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{r(i)},n.crossOrigin="anonymous",n.src=t})}async function qD(t,e){const r=await $p(t),n=document.createElement("canvas");n.width=2*r.width,n.height=2*r.height,n.getContext("2d").drawImage(r,0,0,n.width,n.height);const i=document.createElement("canvas");i.width=e.width,i.height=e.height;const a=i.getContext("2d");let{cropX:o,cropY:s}=e;const u=n.width*e.cropWidth,f=n.height*e.cropHeight,d=e.width/e.height;let h,p;const y=u/f;return e.type==="svg"?(h=u,p=f):d>=y?(h=u,p=u/d):(h=f*d,p=f),a.drawImage(n,o*n.width,s*n.height,h,p,0,0,i.width,i.height),i.toDataURL("image/png")}function X8(t,e){const{width:r,height:n}=t,i=r/n;let a,o;i>=e.width/e.height?(a=e.width,o=e.width/i):(a=e.height*i,o=e.height);const s=(e.width-a)/2,u=(e.height-o)/2;return{cropX:s/e.width,cropY:u/e.height,cropWidth:a/e.width,cropHeight:o/e.height}}var ea;(function(t){t.sepia="sepia",t.grayscale="grayscale",t.natural="natural",t.warm="warm",t.cold="cold",t.temperature="temperature",t.contrast="contrast",t.shadows="shadows",t.white="white",t.black="black",t.vibrance="vibrance",t.saturation="saturation"})(ea||(ea={}));function Y8(t,e){let r={filter:"",html:void 0};switch(t){case ea.warm:{const n=Math.max(0,Math.min(1,e??.5)),i=1+.3*n,a=1+.15*n,o=1;return r.filter="url(#warm-filter)",r.html=`
287
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
288
+ <filter id="warm-filter" color-interpolation-filters="sRGB">
289
+ <feColorMatrix type="matrix" values="
290
+ ${i} 0 0 0 0
291
+ 0 ${a} 0 0 0
292
+ 0 0 ${o} 0 0
293
+ 0 0 0 1 0" />
294
+ </filter>
295
+ </svg>`,r}case ea.cold:{const n=Math.max(0,Math.min(1,e??.5)),i=1-.15*n,a=1-.1*n,o=1+.15*n;return r.filter="url(#cold-filter)",r.html=`
296
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
297
+ <filter id="cold-filter" color-interpolation-filters="sRGB">
298
+ <feColorMatrix type="matrix" values="
299
+ ${i} 0 0 0 0
300
+ 0 ${a} 0 0 0
301
+ 0 0 ${o} 0 0
302
+ 0 0 0 1 0" />
303
+ </filter>
304
+ </svg>`,r}case"natural":{const n=Math.max(0,Math.min(1,e??.5)),i=1+.1*n,a=1+.3*n,o=1+.2*n;return r.filter=`saturate(${a}) brightness(${i}) contrast(${o})`,r}case ea.temperature:{const n=Math.max(-1,Math.min(1,e??0)),i=1+.15*n,a=1,o=1-.15*n;return r.filter="url(#temperature-filter)",r.html=`
305
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
306
+ <filter id="temperature-filter" color-interpolation-filters="sRGB">
307
+ <feColorMatrix type="matrix" values="
308
+ ${i} 0 0 0 0
309
+ 0 ${a} 0 0 0
310
+ 0 0 ${o} 0 0
311
+ 0 0 0 1 0" />
312
+ </filter>
313
+ </svg>
314
+ `,r}case ea.contrast:{const n=100*Math.max(-1,Math.min(1,e??0)),i=259*(n+255)/(255*(259-n)),a=.5*(1-i);return r.filter="url(#contrast-filter)",r.html=`
315
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
316
+ <filter id="contrast-filter" color-interpolation-filters="sRGB">
317
+ <feComponentTransfer>
318
+ <feFuncR type="linear" slope="${i}" intercept="${a}" />
319
+ <feFuncG type="linear" slope="${i}" intercept="${a}" />
320
+ <feFuncB type="linear" slope="${i}" intercept="${a}" />
321
+ </feComponentTransfer>
322
+ </filter>
323
+ </svg>
324
+ `,r}case ea.shadows:{const n=Math.max(-1,Math.min(1,e??0)),i=Math.min(Math.max(1-.6*n,.4),2.5);return r.filter="url(#shadows-filter)",r.html=`
325
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
326
+ <filter id="shadows-filter" color-interpolation-filters="sRGB">
327
+ <feComponentTransfer>
328
+ <feFuncR type="gamma" amplitude="1" exponent="${i}" offset="0" />
329
+ <feFuncG type="gamma" amplitude="1" exponent="${i}" offset="0" />
330
+ <feFuncB type="gamma" amplitude="1" exponent="${i}" offset="0" />
331
+ </feComponentTransfer>
332
+ </filter>
333
+ </svg>
334
+ `,r}case ea.white:case ea.black:return null;case ea.vibrance:{const n=Math.max(-1,Math.min(1,e??0)),i=.299,a=.587,o=.114;let s;s=n>=0?1+1.5*n:1+n;const u=1-s,f=u*i+s,d=u*a,h=u*o,p=u*i,y=u*a+s,v=u*o,b=u*i,x=u*a,k=u*o+s;return r.filter="url(#vibrance-filter)",r.html=`
335
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
336
+ <filter id="vibrance-filter" color-interpolation-filters="sRGB">
337
+ <feColorMatrix type="matrix" values="
338
+ ${f} ${d} ${h} 0 0
339
+ ${p} ${y} ${v} 0 0
340
+ ${b} ${x} ${k} 0 0
341
+ 0 0 0 1 0" />
342
+ </filter>
343
+ </svg>
344
+ `,r}case ea.saturation:{const o=1+Math.max(-1,Math.min(1,e??0)),s=1-o,u=s*.2126+o,f=s*.7152,d=s*.0722,h=s*.2126,p=s*.7152+o,y=s*.0722,v=s*.2126,b=s*.7152,x=s*.0722+o;return r.filter="url(#saturation-filter)",r.html=`
345
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
346
+ <filter id="saturation-filter" color-interpolation-filters="sRGB">
347
+ <feColorMatrix type="matrix" values="
348
+ ${u} ${f} ${d} 0 0
349
+ ${h} ${p} ${y} 0 0
350
+ ${v} ${b} ${x} 0 0
351
+ 0 0 0 1 0" />
352
+ </filter>
353
+ </svg>
354
+ `,r}default:return null}}async function VD(t){return new Promise((e,r)=>{const n=document.createElement("video");n.crossOrigin="anonymous",n.src=t,n.addEventListener("loadedmetadata",()=>{const{videoWidth:i,videoHeight:a}=n;e({width:i,height:a})}),n.addEventListener("error",i=>{const a=t.slice(0,100);r(new Error(`Failed to load video: ${a}`))})})}var WD=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};const ir=(t,e,...r)=>({type:t,props:e,children:r||[]});function K8(t){return an(t),t}function GD(t){var e=new DOMParser().parseFromString(t,"image/svg+xml");return e.documentElement.setAttribute("preserveAspectRatio","none"),new XMLSerializer().serializeToString(e)}const Eg=async({element:t,page:e,store:r})=>{let{src:n}=t;if(t.type==="svg"){let R=await jp(n);R=GD(R),n=Object.keys(t.colorsReplace).length?z2(R,new Map(Object.entries(t.colorsReplace))):tl(R)}let i="";t.flipX&&(i+="scaleX(-1)"),t.flipY&&(i+="scaleY(-1)"),i||(i="none");const a={};if(t.type==="svg"&&t.maskSrc){const R=await R3(n);a["mask-image"]=`url(${R})`,a["mask-size"]="100% 100%",a["mask-position"]="0 0",a["mask-repeat"]="no-repeat",a["-webkit-mask-image"]=`url(${R})`,a["-webkit-mask-size"]="100% 100%",a["-webkit-mask-position"]="0 0",a["-webkit-mask-repeat"]="no-repeat",n=t.maskSrc}else if(t.clipSrc){const R=t.clipSrc,N=await R3(R);a["mask-image"]=`url(${N})`,a["mask-size"]="100% 100%",a["mask-position"]="0 0",a["mask-repeat"]="no-repeat",a["-webkit-mask-image"]=`url(${N})`,a["-webkit-mask-size"]="100% 100%",a["-webkit-mask-position"]="0 0",a["-webkit-mask-repeat"]="no-repeat"}const o=await $p(n),s=o.width*t.cropWidth,u=o.height*t.cropHeight,f=t.width/t.height;let d,h;const p=s/u,y=t.type==="svg"||t.stretchEnabled;y?(d=s,h=u):f>=p?(d=s,h=s/f):(d=u*f,h=u);const v=d/o.width,b=h/o.height,x=d/h>t.width/t.height?t.height/h:t.width/d,k=y?t.width/d:x,S=y?t.height/h:x,P=d*k/v,_=h*S/b;let E=t.cropX*k*o.width,A=t.cropY*S*o.height;t.flipX&&(E=(1-t.cropX-t.cropWidth)*k*o.width),t.flipY&&(A=(1-t.cropY-t.cropHeight)*S*o.height);const T=t.borderSize&&an(t.borderColor),I=T?Math.max(0,t.cornerRadius-t.borderSize):t.cornerRadius,L=ir("div",{style:Object.assign(Object.assign({},a),{width:"100%",height:"100%",borderRadius:I+"px",border:t.borderSize&&!T?`${t.borderSize}px solid ${t.borderColor}`:"none",backgroundRepeat:"no-repeat",backgroundImage:`url(${n})`,transform:i,backgroundSize:`${Math.round(P)}px ${Math.round(_)}px`,backgroundPositionX:-Math.round(E)+"px",backgroundPositionY:-Math.round(A)+"px"})});return T?ir("div",{style:{width:"100%",height:"100%",borderRadius:t.cornerRadius+"px",background:K8(t.borderColor),padding:t.borderSize+"px",boxSizing:"border-box"}},L):L},Mx=({element:t,type:e})=>{const r={"stroke-width":t.height,stroke:t.color,"line-cap":"round","stroke-linejoin":"round",opacity:t.opacity};return e==="arrow"||e==="triangle"?ir("polyline",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},r)):e==="bar"?ir("polyline",Object.assign({points:`0,${2*-t.height} 0,${2*t.height}`},r)):e==="circle"?ir("circle",Object.assign({r:t.height},r)):e==="square"?ir("polyline",Object.assign({points:`${-t.height},${-t.height} ${-t.height},${t.height} ${t.height},${t.height} ${t.height},${-t.height}`},r)):null},XD={image:Eg,svg:Eg,text:async({element:t,page:e,store:r})=>{const n=an(t.fill),i=an(t.stroke);if(t.curveEnabled){const x=_c(t.width,t.height,t.curvePower,t.fontSize),k=ri(t.text).replace(/\n/g," ");let S=`
355
+ <svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" style="display: block;">
356
+ <defs>
357
+ <path id="curve-${t.id}" d="${x}" fill="none" />`;if(n){const A=`curve-fill-grad-${t.id}`;S+=ed(t.fill,A)}if(i&&t.strokeWidth){const A=`curve-stroke-grad-${t.id}`;S+=ed(t.stroke,A)}S+=`</defs>
358
+ <text
359
+ font-family="'${t.fontFamily}'"
360
+ font-size="${t.fontSize}"
361
+ font-weight="${t.fontWeight}"
362
+ font-style="${t.fontStyle}"
363
+ fill="${n?`url(#curve-fill-grad-${t.id})`:t.fill}"
364
+ text-anchor="middle"
365
+ dominant-baseline="central"
366
+ letter-spacing="${t.letterSpacing*t.fontSize}px"${t.textDecoration?` text-decoration="${t.textDecoration}"`:""}${t.strokeWidth?` stroke="${i?`url(#curve-stroke-grad-${t.id})`:t.stroke}" stroke-width="${t.strokeWidth}" paint-order="stroke fill"`:""}>
367
+ <textPath href="#curve-${t.id}" startOffset="50%">
368
+ ${k}
369
+ </textPath>
370
+ </text>
371
+ </svg>`;const P=t.backgroundPadding*(t.fontSize*t.lineHeight),_=t.backgroundEnabled&&ir("div",{style:{position:"absolute",top:-P/2+"px",left:-P/2+"px",width:t.width+P+"px",height:t.height+P+"px",backgroundColor:t.backgroundColor,opacity:t.backgroundOpacity,borderRadius:t.backgroundCornerRadius*(t.fontSize*t.lineHeight*.5)+"px"}}),E=ir("div",{style:{width:"100%",height:"100%",position:"absolute",top:0,left:0},innerHTML:S});return ir("div",{style:{position:"relative",width:"100%",height:"100%"}},_,E)}const a=x=>({backgroundImage:x,backgroundSize:"100% 100%",backgroundRepeat:"repeat",WebkitBackgroundClip:"text",MozBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",MozTextFillColor:"transparent",color:"transparent"});let o={top:0,left:0};n&&(o=Object.assign(Object.assign({},o),a(t.fill)));const s=t.backgroundPadding*(t.fontSize*t.lineHeight),u=ir("div",{style:{position:"absolute",top:-s/2+"px",left:-s/2+"px",display:t.backgroundEnabled?"block":"none",width:t.width+s+"px",height:t.height+s+"px",backgroundColor:t.backgroundColor,opacity:t.backgroundOpacity,borderRadius:t.backgroundCornerRadius*(t.fontSize*t.lineHeight*.5)+"px"}});t.verticalAlign==="middle"?(o.top="50%",o.transform="translateY(-50%)"):t.verticalAlign==="bottom"&&(o.bottom=0);const f=/<[a-z][\s\S]*>/i.test(t.text),d=f?t.text:t.text.split(`
372
+ `).join("<br />");if(t.strokeWidth&&(i||n&&!i)){const x=Object.assign({position:"absolute",width:t.width+"px",whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:t.fontSize+"px",textAlign:t.align,fontFamily:`'${t.fontFamily}'`,textDecoration:t.textDecoration||"none",textDecorationColor:t.textDecoration?t.fill:void 0,textTransform:t.textTransform||"none",lineHeight:t.lineHeight,letterSpacing:t.letterSpacing*t.fontSize+"px",fontStyle:t.fontStyle,fontWeight:t.fontWeight},o),k=i?Object.assign(Object.assign(Object.assign({},x),a(t.stroke)),{WebkitTextStroke:`${t.strokeWidth}px transparent`}):Object.assign(Object.assign({},x),{color:"transparent",WebkitTextStroke:`${t.strokeWidth}px ${t.stroke}`}),S=n?Object.assign(Object.assign({},x),a(t.fill)):Object.assign(Object.assign({},x),{color:t.fill}),P="el-"+t.id,_=f?`<style>#${P} {${kp}}</style>`:"",E=ir("div",{style:Object.assign(Object.assign({},k),{position:"absolute",top:0,left:0,pointerEvents:"none"}),"aria-hidden":"true",innerHTML:f?`${_}${d}`:d}),A=ir("div",Object.assign(Object.assign({style:Object.assign(Object.assign({},S),{position:"relative"})},f?{id:P}:{}),{innerHTML:f?`${_}${d}`:d}));return ir("div",{style:{position:"relative",width:"100%",height:"100%"}},u,ir("div",{style:{position:"relative",width:t.width+"px"}},E,A))}const h=Object.assign(Object.assign({},o),{position:"absolute",width:t.width+"px",color:t.fill,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:t.fontSize+"px",textAlign:t.align,fontFamily:`'${t.fontFamily}'`,textDecoration:t.textDecoration||"none",textDecorationColor:t.textDecoration?t.fill:void 0,textTransform:t.textTransform||"none",lineHeight:t.lineHeight,letterSpacing:t.letterSpacing*t.fontSize+"px",fontStyle:t.fontStyle,fontWeight:t.fontWeight,WebkitTextStroke:t.strokeWidth?`${t.strokeWidth}px ${t.stroke}`:void 0,paintOrder:t.strokeWidth?"stroke fill":void 0}),p="el-"+t.id,y=f?{id:p}:{},v=`<style>#${p} {${kp}}</style>`,b=ir("div",Object.assign(Object.assign({style:h},y),{innerHTML:f?`${v}${d}`:d}));return ir("div",{style:{position:"relative",width:"100%",height:"100%"}},u,b)},line:async({element:t,page:e,store:r})=>ir("svg",{style:{width:"100%",height:"100%",contain:"layout style size",overflow:"visible"}},ir("rect",{x:0,y:0,width:t.width,height:t.height,fill:t.color}),ir("g",{transform:`translate(0 ${t.height/2})`},Mx({element:t,type:t.startHead})),ir("g",{transform:`translate(${t.width} ${t.height/2}) rotate(180)`},Mx({element:t,type:t.endHead}))),figure:async({element:t,page:e,store:r,elementHook:n})=>{let i=$8(t);if(t.strokeWidth&&an(t.stroke)){const o=`figure-stroke-grad-${t.id}`,s=ed(t.stroke,o);i=i.replace(new RegExp(`stroke="${t.stroke.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"`,"g"),`stroke="url(#${o})"`),i=i.replace("</defs>",`${s}</defs>`)}if(an(t.fill)){const o=`figure-fill-grad-${t.id}`,s=ed(t.fill,o);i=i.replace(new RegExp(`fill="${t.fill.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"`,"g"),`fill="url(#${o})"`),i=i.replace("</defs>",`${s}</defs>`)}const a=ir("div",{innerHTML:i});return n&&n({dom:a,element:t})||a},group:async({element:t,page:e,store:r,elementHook:n})=>{const i=await Promise.all(t.children.map(o=>Q8({element:o,page:e,store:r,elementHook:n}))),a=ir("div",{style:{transformOrigin:"top left",opacity:t.opacity}},...i);return n&&n({dom:a,element:t})||a},video:async({element:t,page:e,store:r,elementHook:n})=>{const{cropX:i,cropY:a,cropWidth:o,cropHeight:s}=t,u=await VD(t.src),f=u.width*o,d=u.height*s,h=t.width/t.height;let p,y;h>=f/d?(p=f,y=f/h):(p=d*h,y=d);const v=p/o,b=y/s,x=i*u.width,k=a*u.height,S=Math.max(t.width/u.width,t.height/u.height),P={position:"absolute",width:`${Math.round(v*S)}px`,height:`${Math.round(b*S)}px`,left:-Math.round(x*S)+"px",top:-Math.round(k*S)+"px",objectFit:"fill"},_=`video-${t.id}`,E=t.borderSize&&an(t.borderColor),A=E?Math.max(0,t.cornerRadius-t.borderSize):t.cornerRadius,T=ir("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",borderRadius:A+"px",border:t.borderSize&&!E?`${t.borderSize}px solid ${t.borderColor}`:"none"}},ir("video",{id:_,src:t.src,style:P,controls:!0,playsInline:!0,muted:!0,volume:t.volume}));if(E){const I=ir("div",{style:{width:"100%",height:"100%",borderRadius:t.cornerRadius+"px",background:K8(t.borderColor),padding:t.borderSize+"px",boxSizing:"border-box"}},T);return n&&n({dom:I,element:t})||I}return n&&n({dom:T,element:t})||T},gif:Eg};async function Q8({element:t,page:e,store:r,elementHook:n}){var i;let a=await XD[t.type];if(a||(a=()=>ir("div",{}),console.error(`HTML export does not support ${t.type} type...`)),!t.visible)return null;const o=await a({element:t,page:e,store:r}),s=[],u=[];if(t.blurEnabled&&s.push(`blur(${t.blurRadius/2}px)`),t.brightnessEnabled&&s.push(`brightness(${100*t.brightness+100}%)`),t.sepiaEnabled&&s.push("sepia()"),t.grayscaleEnabled&&s.push("grayscale()"),t.filters)for(const[d,h]of Object.entries(t.filters)){const p=Y8(ea[d],h.intensity);p&&(s.push(p.filter),p.html&&u.push(p.html))}if(t.shadowEnabled){const d=(function(h,p){if(p===1)return h;const y=_t.Util.colorToRGBA(h);return y?`rgba(${y.r}, ${y.g}, ${y.b}, ${y.a*p})`:h})(t.shadowColor,(i=t.shadowOpacity)!==null&&i!==void 0?i:1);s.push(`drop-shadow(${t.shadowOffsetX}px ${t.shadowOffsetY}px ${t.shadowBlur/2}px ${d})`)}const f=ir("div",{id:t.id,style:{position:"absolute",left:t.x+"px",top:t.y+"px",width:t.width+"px",height:t.height+"px",transform:`rotate(${t.rotation}deg)`,transformOrigin:"top left",opacity:t.opacity,display:t.visible&&t.showInExport?"block":"none",filter:s.join(" ")||"none"}},o,...u);return n&&n({dom:f,element:t})||f}async function YD({json:t,elementHook:e}){const r=await Promise.all(t.pages.map(a=>(async function({page:o,store:s,elementHook:u}){const f=await Promise.all(o.children.map(y=>Q8({element:y,page:o,store:s,elementHook:u}))),d=o.width==="auto"?s.width:o.width,h=o.height==="auto"?s.height:o.height;let p={};if(o.background.indexOf("url")>=0||o.background.indexOf("http")>=0||o.background.indexOf(".jpg")>=0||o.background.indexOf(".png")>=0||o.background.indexOf(".jpeg")>=0){const{width:y,height:v}=await $p(o.background),b=await Eg({element:Object.assign({x:0,y:0,width:d,height:h,src:o.background,cornerRadius:0},X8({width:d,height:h},{width:y,height:v})),page:o,store:s});f.unshift(b)}else p=Object.assign(Object.assign({},p),{backgroundColor:o.background});return ir("div",{className:"page",id:o.id,style:Object.assign(Object.assign({},p),{width:d+"px",height:h+"px",overflow:"hidden",position:"relative"})},...f)})({page:a,store:t,elementHook:e}))),n=[];Mr({children:t.pages},a=>{a.type==="text"&&n.indexOf(a.fontFamily)===-1&&n.push(a.fontFamily)});const i=n.map(a=>{const o=t.fonts.find(s=>s.fontFamily===a);if(o){const s=(o.styles||(o.url?[{src:`url("${o.url}")`}]:[])).map(u=>`
373
+ @font-face {
374
+ font-family: '${o.fontFamily}';
375
+ src: ${u.src};
376
+ font-style: ${u.fontStyle||"normal"};
377
+ font-weight: ${u.fontWeight||"normal"};
378
+ font-display: swap;
379
+ }`).join(`
380
+ `);return ir("style",{},s)}return ir("link",{href:q5(a),rel:"stylesheet"})});return ir("div",{className:"design"},...i,...r)}const Z8=({dom:t})=>{if(typeof t=="string")return t;if(!t)return"";const e=t.props,{innerHTML:r}=e,n=WD(e,["innerHTML"]),i=Object.keys(n).map(a=>a==="style"&&typeof n[a]=="object"?`style="${Object.keys(n[a]).filter(o=>n[a][o]!=null).map(o=>`${o.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}: ${n[a][o]}`).join("; ")}"`:((o,s)=>typeof s=="object"?`${o}="${Object.keys(s).map(u=>`${u.replace(/-([a-z])/g,f=>f[1].toUpperCase())}:${s[u]};`).join(" ")}"`:`${o}="${s}"`)(a,n[a])).join(" ");return`<${t.type} ${i}>${r||t.children.map(a=>Z8({dom:a})).join("")}</${t.type}>`};async function KD({json:t,elementHook:e}){const r=await YD({json:t,elementHook:e});return Z8({dom:r})}var QD=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};const J8=(t,e)=>{if(t.children)for(const r of t.children){if(e(r)===!0)break;J8(r,e)}},bt=(t,e,...r)=>({type:t,props:e,children:r||[]});function cc(t,e){if(!an(t))return null;const{stops:r,rotation:n}=Fp(t),i=n*Math.PI/180,a=.5-.5*Math.sin(i),o=.5+.5*Math.cos(i),s=.5+.5*Math.sin(i),u=.5-.5*Math.cos(i),f=r.map(({offset:d,color:h})=>bt("stop",{offset:100*d+"%","stop-color":h}));return bt("linearGradient",{id:e,x1:100*a+"%",y1:100*o+"%",x2:100*s+"%",y2:100*u+"%"},...f)}const hv=async t=>{try{const e=await fetch(t);if(typeof Buffer<"u"){const r=await e.arrayBuffer(),n=Buffer.from(r).toString("base64");return`data:${e.headers.get("content-type")||"image/png"};base64,${n}`}{const r=await e.blob();return new Promise((n,i)=>{const a=new FileReader;a.onloadend=()=>n(a.result),a.onerror=i,a.readAsDataURL(r)})}}catch(e){return console.error("Error converting URL to data URL:",e),t}},pv=async({element:t,page:e,store:r})=>{let{src:n}=t;if(t.type==="svg"){const V=await jp(n);n=z2(V,new Map(Object.entries(t.colorsReplace)))}else n=await hv(n);let i,a,o,s,u="";if(t.flipX||t.flipY){const V=t.flipX?-1:1,ee=t.flipY?-1:1,te=t.width/2,Q=t.height/2;u=`translate(${te}, ${Q}) scale(${V}, ${ee}) translate(${-te}, ${-Q})`}t.clipSrc&&(i=`clip-img-mask-${t.id}`,a=await hv(t.clipSrc)),t.maskSrc&&(o=`mask-img-${t.id}`,s=await hv(t.maskSrc));const f=await $p(n),d=f.width*t.cropWidth,h=f.height*t.cropHeight,p=t.width/t.height;let y,v;const b=d/h,x=typeof t.stretchEnabled=="boolean"&&t.stretchEnabled||t.type==="svg";x?(y=d,v=h):p>=b?(y=d,v=d/p):(y=h*p,v=h);const k=y/f.width,S=v/f.height,P=y/v>t.width/t.height?t.height/v:t.width/y,_=x?t.width/y:P,E=x?t.height/v:P,A=y*_/k,T=v*E/S;let I=t.cropX*f.width*_,L=t.cropY*f.height*E;t.flipX&&(I=(1-t.cropX-t.cropWidth)*f.width*_),t.flipY&&(L=(1-t.cropY-t.cropHeight)*f.height*E);const R=`clip-${t.id}`,N=t.cornerRadius||0,F=n.replace(/&/g,"&amp;"),H={x:-I,y:-L,width:A,height:T,preserveAspectRatio:"none","clip-path":`url(#${R})`},$=[bt("clipPath",{id:R},bt("rect",{x:0,y:0,width:t.width,height:t.height,rx:N||void 0,ry:N||void 0}))];i&&a&&$.push(bt("mask",{id:i,maskUnits:"userSpaceOnUse","mask-type":"alpha"},bt("image",{href:a.replace(/&/g,"&amp;"),x:0,y:0,width:t.width,height:t.height,preserveAspectRatio:"none"}))),o&&$.push(bt("mask",{id:o,maskUnits:"userSpaceOnUse","mask-type":"alpha"},bt("image",Object.assign({href:F},H))));let X=F;const Z={};o&&s&&(X=s.replace(/&/g,"&amp;"),Z.mask=`url(#${o})`);const K={};i&&(K.mask=`url(#${i})`);const q=t.borderSize||0,J=q>0&&an(t.borderColor),U=J?`border-grad-${t.id}`:null;if(J){const V=cc(t.borderColor,U);V&&$.push(V)}const D=q>0?bt("rect",{x:q/2,y:q/2,width:Math.max(0,t.width-q),height:Math.max(0,t.height-q),fill:"none",stroke:J?`url(#${U})`:t.borderColor,"stroke-width":q,rx:Math.max(0,N-q)||void 0,ry:Math.max(0,N-q)||void 0}):null,W=bt("g",{},bt("defs",{},...$),bt("image",Object.assign(Object.assign({href:X},H),Z)),D);return bt("g",K,u?bt("g",{transform:u},W):W)},Dx=({element:t,type:e})=>{const r={"stroke-width":t.height,stroke:t.color,"line-cap":"round","stroke-linejoin":"round",fill:t.color};return e==="arrow"?bt("polyline",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},r)):e==="triangle"?bt("polygon",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},r)):e==="bar"?bt("polyline",Object.assign({points:`0,${2*-t.height} 0,${2*t.height}`},r)):e==="circle"?bt("circle",Object.assign({cx:2*t.height,cy:0,r:2*t.height},r)):e==="square"?bt("polygon",Object.assign({points:`0,${2*-t.height} ${4*t.height},${2*-t.height} ${4*t.height},${2*t.height} 0,${2*t.height}`},r)):null},ZD={image:pv,svg:pv,text:async({element:t,page:e,store:r})=>{const n=an(t.fill),i=an(t.stroke);if(t.curveEnabled){const P=_c(t.width,t.height,t.curvePower,t.fontSize),_=`curve-path-${t.id}`,E=ri(t.text).replace(/\n/g," "),A=t.backgroundPadding*(t.fontSize*t.lineHeight*.5),T=t.backgroundEnabled?bt("rect",{x:-A,y:-A,width:t.width+2*A,height:t.height+2*A,fill:t.backgroundColor,opacity:t.backgroundOpacity,rx:t.backgroundCornerRadius*(t.fontSize*t.lineHeight*.5),ry:t.backgroundCornerRadius*(t.fontSize*t.lineHeight*.5)}):null,I=[bt("path",{id:_,d:P,fill:"none"})],L=t.strokeWidth&&(i||n&&!i);if(n){const R=`curve-fill-grad-${t.id}`,N=cc(t.fill,R);N&&I.push(N)}if(i&&t.strokeWidth){const R=`curve-stroke-grad-${t.id}`,N=cc(t.stroke,R);N&&I.push(N)}if(L){const R={"font-size":t.fontSize+"px","text-anchor":"middle","dominant-baseline":"central","font-family":t.fontFamily,"font-style":t.fontStyle,"font-weight":t.fontWeight,"text-decoration":t.textDecoration||void 0,"letter-spacing":t.letterSpacing*t.fontSize+"px"},N=i?`url(#curve-stroke-grad-${t.id})`:t.stroke,F=bt("text",Object.assign(Object.assign({},R),{fill:N,"stroke-width":t.strokeWidth,stroke:N}),bt("textPath",{href:`#${_}`,startOffset:"50%",innerHTML:E})),H=n?`url(#curve-fill-grad-${t.id})`:t.fill,$=bt("text",Object.assign(Object.assign({},R),{fill:H}),bt("textPath",{href:`#${_}`,startOffset:"50%",innerHTML:E}));return bt("g",{},T,bt("defs",{},...I),F,$)}return bt("g",{},T,bt("defs",{},...I),bt("text",{fill:n?`url(#curve-fill-grad-${t.id})`:t.fill,"font-size":t.fontSize+"px","text-anchor":"middle","dominant-baseline":"central","font-family":t.fontFamily,"font-style":t.fontStyle,"font-weight":t.fontWeight,"text-decoration":t.textDecoration||void 0,"letter-spacing":t.letterSpacing*t.fontSize+"px","stroke-width":t.strokeWidth||void 0,stroke:t.strokeWidth?i?`url(#curve-stroke-grad-${t.id})`:t.stroke:void 0,"paint-order":t.strokeWidth?"stroke fill":void 0},bt("textPath",{href:`#${_}`,startOffset:"50%",innerHTML:E})))}const a=(P,_,E,A,T,I=0)=>{const L=document.createElement("canvas").getContext("2d");return L.font=`${T} ${A} ${_}px ${E}`,L.measureText(P).width+Math.max(0,(P?P.length:0)-1)*I*_},o=(P,_,E,A,T,I,L=0)=>{const R=[];return P.split(`
381
+ `).forEach(N=>{const F=N.split(" ");let H="";for(let $=0;$<F.length;$++){const X=H+F[$]+" ";a(X,E,A,T,I,L)>_+.5&&$>0?(R.push(H.trim()),H=F[$]+" "):H=X}R.push(H.trim())}),R};let s=ri(t.text);t.textTransform=="uppercase"&&(s=s.toUpperCase());let u=t.fontSize,f=[];for(;;){f=o(s,t.width,u,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing);const P=Math.max(...f.map(E=>a(E,u,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing))),_=f.length*u*t.lineHeight;if(P<=t.width&&_<=t.height||(u-=1,u<4))break}const d=u*t.lineHeight,h=f.length*d;let p=u;t.verticalAlign==="middle"?p=(t.height-h)/2+u:t.verticalAlign==="bottom"&&(p=t.height-h+u);const y=t.align==="center"?"middle":t.align==="right"?"end":"start",v=f.map((P,_)=>bt("tspan",{x:t.align==="center"?t.width/2:t.align==="right"?t.width:0,dy:_===0?0:d,innerHTML:P})),b=t.backgroundPadding*(u*t.lineHeight*.5),x=t.backgroundEnabled?bt("rect",{x:-b,y:-b,width:t.width+2*b,height:t.height+2*b,fill:t.backgroundColor,opacity:t.backgroundOpacity,rx:t.backgroundCornerRadius*(u*t.lineHeight*.5),ry:t.backgroundCornerRadius*(u*t.lineHeight*.5)}):null,k=[],S=t.strokeWidth&&(i||n&&!i);if(n){const P=`text-fill-grad-${t.id}`,_=cc(t.fill,P);_&&k.push(_)}if(i&&t.strokeWidth){const P=`text-stroke-grad-${t.id}`,_=cc(t.stroke,P);_&&k.push(_)}if(S){const P={y:p,"font-size":u+"px","text-anchor":y,"font-family":t.fontFamily,"font-style":t.fontStyle,"font-weight":t.fontWeight,"text-decoration":t.textDecoration,"line-height":t.lineHeight,"letter-spacing":t.letterSpacing*u+"px"},_=i?`url(#text-stroke-grad-${t.id})`:t.stroke,E=bt("text",Object.assign(Object.assign({},P),{fill:_,"stroke-width":t.strokeWidth,stroke:_}),...v.map(I=>bt("tspan",I.props,I.props.innerHTML))),A=n?`url(#text-fill-grad-${t.id})`:t.fill,T=bt("text",Object.assign(Object.assign({},P),{fill:A}),...v.map(I=>bt("tspan",I.props,I.props.innerHTML)));return bt("g",{},x,k.length>0?bt("defs",{},...k):null,E,T)}return bt("g",{},x,k.length>0?bt("defs",{},...k):null,bt("text",{fill:n?`url(#text-fill-grad-${t.id})`:t.fill,y:p,"font-size":u+"px","text-anchor":y,"font-family":t.fontFamily,"font-style":t.fontStyle,"font-weight":t.fontWeight,"text-decoration":t.textDecoration,"line-height":t.lineHeight,"letter-spacing":t.letterSpacing*u+"px","stroke-width":t.strokeWidth||void 0,stroke:t.strokeWidth?t.stroke:void 0,"paint-order":t.strokeWidth?"stroke fill":void 0},...v))},line:async({element:t,page:e,store:r})=>bt("g",{},bt("line",{x1:0,y1:t.height/2,x2:t.width,y2:t.height/2,stroke:t.color,"stroke-width":t.height,"stroke-dasharray":t.dash&&t.dash.length?t.dash.map(n=>n*t.height).join(" "):void 0}),bt("g",{transform:`translate(0 ${t.height/2})`},Dx({element:t,type:t.startHead})),bt("g",{transform:`translate(${t.width} ${t.height/2}) rotate(180)`},Dx({element:t,type:t.endHead}))),figure:async({element:t,page:e,store:r,elementHook:n})=>{let i=(function(s){let u=s.replace(/<svg[^>]*>/,"");return u=u.replace(/<\/svg>/,""),u})($8(t));const a=[];if(t.strokeWidth&&an(t.stroke)){const s=`figure-stroke-grad-${t.id}`,u=cc(t.stroke,s);if(u){a.push(u);const f=t.stroke.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i=i.replace(new RegExp(`stroke="${f}"`,"g"),`stroke="url(#${s})"`)}}if(an(t.fill)){const s=`figure-fill-grad-${t.id}`,u=cc(t.fill,s);if(u){a.push(u);const f=t.fill.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i=i.replace(new RegExp(`fill="${f}"`,"g"),`fill="url(#${s})"`)}}if(a.length>0){const s=bt("g",{},bt("defs",{},...a),bt("g",{innerHTML:i}));return n&&n({dom:s,element:t})||s}const o=bt("g",{innerHTML:i});return n&&n({dom:o,element:t})||o},group:async({element:t,page:e,store:r,elementHook:n})=>{const i=await Promise.all(t.children.map(o=>e6({element:o,page:e,store:r,elementHook:n}))),a=bt("g",{style:{"transform-origin":"top left"}},...i);return n&&n({dom:a,element:t})||a},gif:pv};async function e6({element:t,page:e,store:r,elementHook:n}){var i;let a=await ZD[t.type];a||(a=()=>bt("g",{}),console.error(`SVG export does not support ${t.type} type...`));const o=await a({element:t,page:e,store:r}),s=[],u=[];if(t.blurEnabled&&s.push(`blur(${t.blurRadius/2}px)`),t.brightnessEnabled&&s.push(`brightness(${100*t.brightness+100}%)`),t.sepiaEnabled&&s.push("sepia()"),t.grayscaleEnabled&&s.push("grayscale()"),t.shadowEnabled&&s.push(`drop-shadow(${t.shadowOffsetX}px ${t.shadowOffsetY}px ${t.shadowBlur}px ${t.shadowColor})`),t.filters)for(const[d,h]of Object.entries(t.filters)){const p=Y8(ea[d],h.intensity);if(p&&(s.push(p.filter),p.html)){const y=p.html.replace(/<svg([^>]*)>/,"<g$1>").replace(/<\/svg>/,"</g>");u.push(y)}}const f=bt("g",{className:"element",id:t.id,transform:t.type!=="group"?`translate(${t.x}, ${t.y}) rotate(${t.rotation})`:void 0,display:(i=t.visible)===null||i===void 0||i?void 0:"none",opacity:t.opacity,style:{"transform-origin":"top left",filter:s.join(" ")}},o,...u);return n&&n({dom:f,element:t})||f}async function Nx(t){try{const e=await fetch(t),r=e.headers.get("content-type")||"font/ttf",n=await e.arrayBuffer();return`data:${r};base64,${typeof Buffer<"u"?Buffer.from(n).toString("base64"):(function(i){const a=new Uint8Array(i);let o="";for(let s=0;s<a.length;s+=32768){const u=a.subarray(s,s+32768);o+=String.fromCharCode(...u)}if(typeof btoa<"u")return btoa(o);if(typeof Buffer<"u")return Buffer.from(a).toString("base64");throw new Error("No base64 encoder available in this environment")})(n)}`}catch(e){return console.error("Error embedding font:",e),t}}async function JD({json:t,elementHook:e,fontEmbedding:r="inline"}){const n=[];J8({children:t.pages},o=>{o.type==="text"&&n.indexOf(o.fontFamily)===-1&&n.push(o.fontFamily)});const i=r==="inline"?await(async function(o,s){return await Promise.all(o.map(async u=>{var f,d;if(u==="Arial")return null;const h=s.find(p=>p.fontFamily===u);if(h){const p=await Nx(h.url);return bt("style",{},`@font-face { font-family: ${u}; src: url(${p}); }`)}{const p=`https://fonts.googleapis.com/css?family=${u}:bi,normal,i,b`;try{const y=await fetch(p),v=await y.text(),b=(d=(f=v.match(/url\((.*?)\)/g))===null||f===void 0?void 0:f.map(k=>k.replace(/url\((.*?)\)/,"$1")))===null||d===void 0?void 0:d.filter(k=>k.startsWith("https"));if(!b?.length)throw new Error("No font URLs found");const x=await Promise.all(b.map(async k=>{const S=await Nx(k),P=v.match(/font-style:\s*(.*?);/),_=v.match(/font-weight:\s*(.*?);/),E=P?P[1]:"normal",A=_?_[1]:"normal";return`@font-face {
382
+ font-family: ${u};
383
+ font-style: ${E};
384
+ font-weight: ${A};
385
+ src: url(${S});
386
+ }`}));return bt("style",{},x.join(`
387
+ `))}catch(y){return console.error("Error embedding Google Font:",y),bt("defs",{},bt("style",{type:"text/css",innerHTML:`@import url('${p}');`.replace(/&/g,"&amp;")}))}}}))})(n,t.fonts):[],a=await Promise.all(t.pages.map(o=>(async function({page:s,store:u,elementHook:f}){const d=await Promise.all(s.children.map(y=>e6({element:y,page:s,store:u,elementHook:f}))),h=s.background.indexOf("url")>=0||s.background.indexOf("http")>=0||s.background.indexOf(".jpg")>=0||s.background.indexOf(".png")>=0||s.background.indexOf(".jpeg")>=0;let p;if(h){const y=await $p(s.background);p=await qD(s.background,Object.assign({width:u.width,height:u.height,x:0,y:0},X8({width:u.width,height:u.height},{width:y.width,height:y.height})))}return bt("g",{className:"page",style:{}},h?bt("image",{"xlink:href":p,x:0,y:0,width:u.width,height:u.height,preserveAspectRatio:"none"}):bt("rect",{x:0,y:0,width:u.width,height:u.height,fill:h?void 0:s.background}),...d)})({page:o,store:t,elementHook:e})));return bt("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:`0 0 ${t.width} ${t.height}`,width:t.width,height:t.height},...i,...a)}const t6=({dom:t,nestLevel:e=0})=>{if(typeof t=="string")return t;if(!t)return"";const r=t.props,{innerHTML:n}=r,i=QD(r,["innerHTML"]),a=Object.keys(i).map(s=>((u,f)=>typeof f=="object"?`${u}="${Object.keys(f).map(d=>`${d}:${f[d]};`).join(" ")}"`:f==null||f===""?"":`${u}="${f}"`)(s,i[s])).filter(s=>s&&s.trim().length>0).join(" "),o=" ".repeat(e);return`${o}<${t.type}${a?" "+a:""}>${n||`
388
+ `+t.children.map(s=>t6({dom:s,nestLevel:e+1})).join("")}${o}</${t.type}>
389
+ `};async function eN({json:t,elementHook:e,fontEmbedding:r="inline"}){const n=await JD({json:t,elementHook:e,fontEmbedding:r});return t6({dom:n})}const dp=ut.model("Page",{id:ut.identifier,children:ut.array(ut.late(()=>u6)),width:ut.optional(ut.union(ut.number,ut.literal("auto")),"auto"),height:ut.optional(ut.union(ut.number,ut.literal("auto")),"auto"),background:"white",bleed:0,custom:ut.frozen(),duration:5e3,_exporting:!1,_rendering:!1,_forceMount:!1}).postProcessSnapshot(t=>{const e=Object.assign({},t),r={};for(var n in e)n[0]!=="_"&&(r[n]=t[n]);return r}).views(t=>({get store(){return uc(t,wc)}})).views(t=>({get startTime(){let e=0;for(const r of t.store.pages){if(r.id===t.id)return e;e+=r.duration}return e},get _exportingOrRendering(){return t._exporting||t._rendering}})).views(t=>({get computedWidth(){return t.width==="auto"?t.store.width:t.width},get computedHeight(){return t.height==="auto"?t.store.height:t.height}})).actions(t=>({toJSON:()=>JSON.parse(JSON.stringify(Fo(t))),_forEachElementUp(e,r){const n=e.map(i=>({id:i,index:t.children.findIndex(a=>a.id===i)}));n.sort((i,a)=>a.index-i.index);for(const{index:i}of n){if(i==-1)continue;const a=i<t.children.length-1&&t.children[i+1],o=e.indexOf(a?.id)>=0;i===t.children.length-1||o||r(i)}},_forEachElementDown(e,r){const n=e.map(i=>({id:i,index:t.children.findIndex(a=>a.id===i)}));n.sort((i,a)=>i.index-a.index);for(const{index:i}of n){if(i==-1)continue;const a=i>0&&t.children[i-1],o=e.indexOf(a?.id)>=0;i===0||o||r(i)}return!1}})).actions(t=>{const e={clone(r={}){const n=t.toJSON();n.children.forEach(s=>{s.id=Aa(10),Mr(s,u=>{u.id=Aa(10)})});const i=Object.assign(Object.assign(Object.assign({},n),{id:Aa(10)}),r),a=t.store.addPage(i),o=t.store.pages.indexOf(t);return a.setZIndex(o+1),a.select(),a},setZIndex(r){t.store.setPageZIndex(t.id,r)},set(r){Object.assign(t,r)},select(){t.store.selectPage(t.id)},addElement(r,{skipSelect:n=!1}={}){const i=ub[r.type];if(!i)return void console.error("Can not find model with type "+r.type);"children"in r&&Array.isArray(r.children)&&Mr(r,s=>{s.id=s.id||Aa(10)});const a=t.children.reduce((s,u)=>{if(u.type==="group"){const f=u.children.reduce((d,h)=>{var p;const y=(p=h.name)===null||p===void 0?void 0:p.match(new RegExp(`${r.type}-(\\d+)`));if(y){const v=parseInt(y[1],10);return Math.max(d,v||0)}},0);return Math.max(s,f||0)}{const f=u.name.match(new RegExp(`${r.type}-(\\d+)`));if(f){const d=parseInt(f[1],10);return Math.max(s,d||0)}}return s},0),o=i.create(Object.assign({id:Aa(10),name:`${r.type}-${a+1}`},r));return t.children.push(o),o.selectable&&!n&&t.store.selectElements([o.id]),o},canMoveElementsUp(r){let n=!1;return t._forEachElementUp(r,()=>{n=n||!0}),n},moveElementsUp(r){t._forEachElementUp(r,n=>{const i=t.children[n];gc(i),t.children.splice(n+1,0,i)})},canMoveElementsTop:r=>e.canMoveElementsUp(r),moveElementsTop(r){const n=[],i=[];t.children.forEach(a=>{r.indexOf(a.id)>=0?n.push(a):i.push(a)}),t.children.replace(i.concat(n))},canMoveElementsDown(r){let n=!1;return t._forEachElementDown(r,()=>{n=n||!0}),n},moveElementsDown(r){t._forEachElementDown(r,n=>{const i=t.children[n];gc(i),t.children.splice(n-1,0,i)})},canMoveElementsBottom:r=>e.canMoveElementsDown(r),moveElementsBottom(r){const n=[],i=[];t.children.forEach(a=>{r.indexOf(a.id)>=0?n.push(a):i.push(a)}),t.children.replace(n.concat(i))},setElementZIndex(r,n){const i=t.children.find(a=>a.id===r);i&&(gc(i),t.children.remove(i),t.children.splice(n,0,i))},setSize({width:r,height:n,useMagic:i,softChange:a}){if(i){const o=[],s=T=>T.type==="image"&&T.x<1&&T.y<1&&T.width>=t.computedWidth-2&&T.height>=t.computedHeight-2;Mr(t,T=>{T.type!=="group"&&(s(T)||o.push(T))});const u=o.length?k0(o):{x:0,y:0,width:t.computedWidth,height:t.computedHeight},f=1/4,d=Math.max(0,Math.min(u.x,t.computedWidth-u.x-u.width)),h=t.computedWidth*f,p=Math.max(0,d-h),y=Math.max(0,Math.min(u.y,t.computedHeight-u.y-u.height)),v=t.computedHeight*f,b=Math.max(0,y-v),x=t.computedWidth-2*p,k=t.computedHeight-2*b,S=r/x,P=n/k,_=Math.min(S,P),E=(r-x*_)/2-p*_,A=(n-k*_)/2-b*_;Mr(t,T=>{T.type!=="group"&&(s(T)?T.set({x:T.x*_,y:T.y*_,width:T.width*S,height:T.height*P,cropX:0,cropY:0,cropWidth:1,cropHeight:1}):(T.set({x:E+T.x*_,y:A+T.y*_,width:T.width*_,height:T.height*_}),T.type==="text"?T.set({fontSize:T.fontSize*_}):T.type==="figure"&&T.set({strokeWidth:T.strokeWidth*_})))})}a||(t.width=r),a||(t.height=n)}};return e}).actions(t=>({moveElementUp(e){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),t.moveElementsUp([e])},moveElementDown(e){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),t.moveElementsDown([e])},moveElementTop(e){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),t.moveElementsTop([e])},moveElementBottom(e){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),t.moveElementsBottom([e])},play(){t.store.play({startTime:t.startTime,endTime:t.startTime+t.duration})}})),Lx=ut.model("Audio",{id:ut.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0,custom:ut.frozen()}).actions(t=>({toJSON:()=>Object.assign({},Fo(t))})).actions(t=>({set(e){Object.assign(t,e)}}));var zh=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};bC("ignore");const tN=ut.model("Font",{fontFamily:ut.string,url:ut.optional(ut.string,""),styles:ut.frozen()}).preProcessSnapshot(t=>Object.assign(Object.assign({},t),{fontFamily:t.fontFamily||t.name})),wc=ut.model("Store",{role:"",pages:ut.array(dp),fonts:ut.array(tN),audios:ut.array(Lx),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:ut.optional(ut.enumeration("UnitType",["pt","mm","cm","in","px"]),"px"),dpi:72,schemaVersion:2,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:ut.frozen(),tool:ut.optional(ut.enumeration("Tool",["selection","draw","pan","text","eraser"]),"selection"),toolOptions:ut.optional(ut.model({brushType:ut.optional(ut.enumeration("BrushType",["brush","highlighter"]),"brush"),strokeWidth:ut.optional(ut.number,5),stroke:ut.optional(ut.string,"#000000"),opacity:ut.optional(ut.number,1)}),{}),selectedElementsIds:ut.array(ut.string),animatedElementsIds:ut.array(ut.string),history:ut.optional(PD,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),_activePageId:"",_selectedPagesIds:ut.array(ut.string),_forceShowCredit:!1,_key:"",_validated:!1}).views(t=>{const e=Tc(()=>{const r={};return Mr({children:t.pages},n=>(r[n.id]=n,!1)),r},{keepAlive:!0});return{get _idsMap(){return e.get()}}}).views(t=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),t.bleedVisible},get selectedElements(){return t.selectedElementsIds.map(e=>{for(const r of t.pages)for(const n of r.children)if(n.id===e)return n}).filter(e=>!!e)},get children(){return t.pages},get selectedShapes(){const e=[];return Mr({children:this.selectedElements},r=>{r.type!=="group"&&e.push(r)}),e},get activePage(){return t.pages.slice().find(e=>e.id===t._activePageId)||(t.pages.length?t.pages[0]:null)},get selectedPages(){return t._selectedPagesIds.map(e=>t.pages.find(r=>r.id===e))},get duration(){let e=0;return t.pages.forEach(r=>{e+=r.duration}),e},get _hasCroppedImages(){return this.find(e=>e.type==="image"&&e._cropModeEnabled)},find(e){let r;return Mr({children:t.pages},n=>{if(!r&&e(n))return r=n,!0}),r},getElementById:e=>t._idsMap[e]})).actions(t=>{let e=0,r=null,n=!1;const i={afterCreate(){t.history.canUndo},setCurrentTime(a){t.currentTime=a},_togglePlaying(a=!t.isPlaying){t.isPlaying=a},play({animatedElementsIds:a=[],startTime:o=0,currentTime:s=0,endTime:u=t.duration,repeat:f=!1}={}){s&&(console.warn("currentTime property of store.play() is deprecated. Please use startTime instead."),o=s),t.animatedElementsIds=a,t.currentTime=o,t.isPlaying=!0,e=Date.now(),r=u,n=f,requestAnimationFrame(()=>i.seek())},checkActivePage(){let a=0;for(const o of t.pages){if(t.currentTime>=o.startTime&&t.currentTime<o.startTime+o.duration){i.selectPage(o.id);break}a+=o.duration}},seek(){if(!t.isPlaying)return;const a=Date.now(),o=a-e;e=a,t.currentTime+=o,i.checkActivePage();const s=r||t.duration;t.isPlaying&&t.currentTime<s?requestAnimationFrame(()=>i.seek()):t.isPlaying&&n?(t.currentTime=0,requestAnimationFrame(()=>i.seek())):i.stop()},stop(){t.isPlaying=!1,t.currentTime=0,t.animatedElementsIds=[],i.checkActivePage()},__(){t._validated||(zD(t._key,t._forceShowCredit),t._validated=!0)},set(a){Object.assign(t,a)},setUnit({unit:a,dpi:o}){t.unit=a||t.unit,t.dpi=o||t.dpi},setRole(a){t.role=a},setTool(a){t.tool=a},setToolOptions(a){Object.assign(t.toolOptions,a)},addPage(a){const o=dp.create(Object.assign({id:Aa(10)},a));return t.pages.push(o),t._activePageId=o.id,o},selectPage(a){t._activePageId=a,t._selectedPagesIds.length===1&&(t._selectedPagesIds=[a])},selectPages(a){t._selectedPagesIds=a,t._selectedPagesIds.length===1&&(t._activePageId=t._selectedPagesIds[0])},selectElements(a){const o=a.map(s=>t.getElementById(s)).sort((s,u)=>s.page.children.indexOf(s)-s.page.children.indexOf(u)).filter(s=>!!s).map(s=>s.id);t.selectedElementsIds=o},toggleBleed(a){t.bleedVisible=a??!t.bleedVisible},toggleRulers(a){t.rulesVisible=a??!t.rulesVisible},toggleDistanceGuides(a){t.distanceGuidesVisible=a??!t.distanceGuidesVisible},openSidePanel(a){t.openedSidePanel!==a&&(t.previousOpenedSidePanel=t.openedSidePanel,t.openedSidePanel=a)},setScale(a){t.scale=a},_setScaleToFit(a){t.scaleToFit=a},setElementsPixelRatio(a){t._elementsPixelRatio=a},setSize(a,o,s){t.pages.forEach(u=>{u.setSize({width:a,height:o,useMagic:s,softChange:!0})}),t.width=a,t.height=o},setPageZIndex(a,o){const s=t.pages.find(u=>u.id===a);s&&(gc(s),t.pages.remove(s),t.pages.splice(o,0,s))},deletePages(a){const o=t.pages.indexOf(t.activePage);a.forEach(f=>{const d=t.pages.find(h=>h.id===f);B1(d)});const s=Math.min(t.pages.length-1,o),u=t.pages[s];u&&(t._activePageId=u.id),t.selectedElementsIds=t.selectedElementsIds.filter(f=>t.getElementById(f))},groupElements(a,o={}){const s=a.map(h=>t.getElementById(h)),u=s[0].page;if(s.forEach(h=>{h&&gc(h)}),!s.length)return;const f=u.children.reduce((h,p)=>{if(p.type==="group"){const y=p.name.match(/group-(\d+)/);if(y){const v=parseInt(y[1],10);return Math.max(h,v)}}return h},0),d=Object.assign({id:Aa(10),name:`group-${f+1}`,children:s,type:"group"},o);return u.children.push(d),t.selectedElementsIds=[d.id],u.children.find(h=>h.id===d.id)},ungroupElements(a){const o=a.map(u=>t.getElementById(u)),s=[];o.forEach(u=>{if(u&&u.type==="group"){const f=u.page,d=f.children.indexOf(u);u.children.forEach(h=>{s.push(h.id)}),u.children.forEach(h=>{gc(h),f.children.push(h)}),f.children.splice(d,1)}}),t.selectedElementsIds=s},deleteElements(a){const o=[];t.find(s=>(a.includes(s.id)&&o.push(s),!1)),o.forEach(s=>{B1(s)}),t.selectedElementsIds=t.selectedElementsIds.filter(s=>t.getElementById(s))},on(a,o){if(a==="change"){let s=i.toJSON();return Q5(t,u=>{const f=i.toJSON();!fp(s,f)&&(s=f,o(f))})}},async _toCanvas({pixelRatio:a,ignoreBackground:o,pageId:s,mimeType:u,includeBleed:f,_skipTimeout:d,quickMode:h=!1,_exportCanvases:p}={}){var y;const v=a||1;s=s||((y=t.pages[0])===null||y===void 0?void 0:y.id);const b=t.pages.find(q=>q.id===s);if(!b)throw new Error(`No page for export with id ${s}`);const x=t._elementsPixelRatio;v>t._elementsPixelRatio&&i.setElementsPixelRatio(v),h?b?.set({_forceMount:!0}):b?.set({_exporting:!0});const k=await $D(()=>{const q=_t.stages.filter(J=>J.getAttr("pageId")===s);return q.length===0?null:q});if(!k)throw b?.set({_forceMount:!1,_exporting:!1}),i.setElementsPixelRatio(x),new Error(`Export is failed. Can not find stage for page ${s}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);k.length>1&&console.error(`Polotno error: Detected several canvas elements for page "${s}" in the document. This is not supported and will lead to incorrect export. Make sure to use unique ids for all pages and make sure you unmount <Workspace /> when it is not needed.`);const S=k[0];await i.waitLoading({_skipTimeout:d});const P=S.findOne(".page-container");if(!P)throw i.setElementsPixelRatio(x),b?.set({_forceMount:!1,_exporting:!1}),new Error("Export is failed. Canvas was unmounted.");const _=S.position();S.position({x:0,y:0}),S.find("Transformer").forEach(q=>{q.setAttr("oldVisible",q.visible()),q.visible(!1)}),P.find(".page-background").forEach(q=>q.shadowEnabled(!1)),P.find(".page-background").forEach(q=>q.strokeEnabled(!1)),P.find(".highlighter").forEach(q=>q.visible(!1));const E=P.findOne(".page-background-group"),A=E.clip();E.clip({x:null,y:null,width:null,height:null});const T=P.findOne(".elements-container"),I=T.clip();T.clip({x:null,y:null,width:null,height:null});const L=P.find(q=>!q.visible()&&q.getAttr("editModeEnabled")&&!q.getAttr("hideInExport"));L.forEach(q=>{q.setAttr("oldVisible",q.visible()),q.show()});const R=P.find(q=>q.getAttr("hideInExport"));R.forEach(q=>{q.setAttr("oldVisible",q.visible()),q.hide()}),o&&P.find(".page-background").forEach(q=>q.hide());const N=f?b.bleed:0;let F=N;!t.bleedVisible&&f||(t.bleedVisible||f?t.bleedVisible&&f?F=0:t.bleedVisible&&!f&&(F=-b.bleed):F=0);const H=b.computedWidth+2*N,$=b.computedHeight+2*N,X=P.scale();P.scale({x:1,y:1});const Z=pA(P,{x:P.x()-F,y:P.y()-F,width:H,height:$,pixelRatio:v,sceneCanvas:p?.sceneCanvas,bufferCanvas:p?.bufferCanvas});P.scale(X);const K=Z._canvas;if(u==="image/jpeg"){const q=K.getContext("2d");q.save(),q.globalCompositeOperation="destination-over",q.fillStyle="white",q.fillRect(0,0,K.width,K.height),q.restore()}return o&&P.find(".page-background").forEach(q=>q.show()),R.forEach(q=>{q.visible(q.getAttr("oldVisible"))}),L.forEach(q=>{q.visible(q.getAttr("oldVisible"))}),P.find(".page-background").forEach(q=>q.shadowEnabled(!0)),P.find(".page-background").forEach(q=>q.strokeEnabled(!0)),S.find("Transformer").forEach(q=>{q.visible(q.getAttr("oldVisible"))}),P.find(".highlighter").forEach(q=>q.visible(!0)),E.clip(A),T.clip(I),S.position(_),b?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),i.setElementsPixelRatio(x),K},async toDataURL(a={}){var{mimeType:o,quality:s,dpi:u,dpiMetadata:f="auto"}=a,d=zh(a,["mimeType","quality","dpi","dpiMetadata"]);const h=await i._toCanvas(Object.assign({mimeType:o},d)),p=o||"image/png",y=h.toDataURL(p,s);_t.Util.releaseCanvas(h);const v=u??t.dpi;return p!=="image/png"&&p!=="image/jpeg"||f==="never"||f==="auto"&&v===72?y:UD(y,p,v)},async toBlob(a={}){var{mimeType:o,quality:s}=a,u=zh(a,["mimeType","quality"]);const f=await i._toCanvas(Object.assign({mimeType:o},u)),d=await new Promise(h=>{f.toBlob(h,o,s)});return _t.Util.releaseCanvas(f),d},async saveAsImage(a={}){var{fileName:o}=a,s=zh(a,["fileName"]);const u=(s.mimeType||"image/png").split("/")[1];hg(await i.toDataURL(s),o||"polotno."+u)},async _toPDF(a){const o=a.dpi||t.dpi,s=a.parallel||1,u=a.unit||(t.unit==="px"?"mm":t.unit),f=a.pixelRatio||1,d=a.pageIds||t.pages.map(T=>T.id),h=t.pages.filter(T=>d.includes(T.id)),p=await ED(),y=T=>I0({px:T,unit:u,dpi:o}),v=a.cropMarkSize||0,b=y(v),x=h[0]||{},k=a.includeBleed?x.bleed:0,S=y(x.computedWidth+2*k+2*b),P=y(x.computedHeight+2*k+2*b);var _=new p({unit:u,orientation:S>P?"landscape":"portrait",format:[S,P],compress:!0,putOnlyUsedFonts:!0});_.deletePage(1);const E=((T,I)=>{const L=[];for(let R=0;R<T.length;R+=I)L.push(T.slice(R,R+I));return L})(h,s);let A=0;for(const T of E){const I=T.map(async L=>{const R=a.includeBleed?L.bleed:0,N=L.computedWidth+2*R+2*v,F=L.computedHeight+2*R+2*v,H=y(N),$=y(F);let X=0,Z=f;for(;X<10;){X+=1,X===2&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const K=await i.toDataURL(Object.assign(Object.assign({},a),{pageId:L.id,pixelRatio:Z}));if(K.length>20)return a.onProgress&&a.onProgress(++A/d.length*.9),{url:K,width:H,height:$,widthPx:N,heightPx:F};Z*=.8}});(await Promise.all(I)).filter(L=>L!==void 0).forEach(({url:L,width:R,height:N,widthPx:F,heightPx:H})=>{_.addPage([R,N],R>N?"landscape":"portrait");const $=_.getCurrentPageInfo();var X;switch(u){case"pt":X=1;break;case"mm":X=72/25.4;break;case"cm":X=72/2.54;break;case"in":X=72;break;case"px":X=.75;break;default:throw"Invalid unit: "+u}if($.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:R*X,topRightY:N*X},$.pageContext.artBox={bottomLeftX:y(v+k)*X,bottomLeftY:y(v+k)*X,topRightX:y(F-v-k)*X,topRightY:y(H-v-k)*X},$.pageContext.bleedBox={bottomLeftX:y(v+k)*X,bottomLeftY:y(v+k)*X,topRightX:y(F-v-k)*X,topRightY:y(H-v-k)*X},b){_.setLineWidth(y(1));const Z=b+y(k);_.line(Z,0,Z,b),_.line(0,Z,b,Z),_.line(R-Z,0,R-Z,b),_.line(R,Z,R-b,Z),_.line(0,N-Z,b,N-Z),_.line(Z,N,Z,N-b),_.line(R,N-Z,R-b,N-Z),_.line(R-Z,N,R-Z,N-b)}_.addImage(L,b,b,R-2*b,N-2*b,void 0,"FAST")})}return _},toPDFDataURL:async a=>(await i._toPDF(Object.assign({mimeType:"image/jpeg"},a))).output("datauristring"),async toGIFDataURL(a={}){const o=a.pixelRatio||1,s=await CD({width:t.width*o,height:t.height*o}),u=1e3/(a.fps||10),f=t.duration/u;for(let d=0;d<f-1;d++){const h=d*u||1;i.setCurrentTime(h);let p=0,y="";for(const b of t.pages)if(p+=b.duration,b.set({_rendering:p>h}),p>h){y=b.id;break}const v=await i._toCanvas({pixelRatio:o,pageId:y,_skipTimeout:!0});s.addFrame(v.getContext("2d"),{delay:u,copy:!0})}for(const d of t.pages)d.set({_rendering:!1});return i.stop(),s.render(),new Promise(d=>{s.on("finished",function(h){(function(p,y){var v=new FileReader;v.onload=function(b){y(b.target.result)},v.readAsDataURL(p)})(h,d)})})},async saveAsGIF(a={}){var{fileName:o}=a,s=zh(a,["fileName"]);const u=await i.toGIFDataURL(s);hg(u,o||"polotno.gif")},async toHTML({elementHook:a}={}){const o=i.toJSON();return KD({json:o,elementHook:a})},async saveAsHTML({fileName:a,elementHook:o}={}){const s=await i.toHTML({elementHook:o}),u="data:text/html;base64,"+window.btoa(unescape(encodeURIComponent(s)));hg(u,a||"polotno.html")},async toSVG({elementHook:a,pageId:o,fontEmbedding:s="inline"}={fontEmbedding:"inline"}){var u;const f=i.toJSON();o=o||((u=f.pages[0])===null||u===void 0?void 0:u.id);const d=f.pages.find(h=>h.id===o);return eN({json:Object.assign(Object.assign({},f),{pages:d?[d]:[]}),elementHook:a,fontEmbedding:s})},async saveAsSVG({fileName:a,elementHook:o,pageId:s,fontEmbedding:u="inline"}={}){const f=await i.toSVG({elementHook:o,pageId:s,fontEmbedding:u}),d="data:text/svg;base64,"+window.btoa(unescape(encodeURIComponent(f)));hg(d,a||"polotno.svg")},async saveAsPDF(a={}){var{fileName:o}=a,s=zh(a,["fileName"]);(await i._toPDF(Object.assign({mimeType:"image/jpeg"},s))).save(o||"polotno.pdf")},async waitLoading({_skipTimeout:a=!1}={}){a||await new Promise(o=>setTimeout(o,50)),await tC()},toJSON:()=>({width:t.width,height:t.height,fonts:Fo(t.fonts),pages:Fo(t.pages),audios:Fo(t.audios),unit:t.unit,dpi:t.dpi,custom:t.custom,schemaVersion:t.schemaVersion}),loadJSON(a,o=!1){var s;const u=JSON.parse(JSON.stringify(a)),f=u.schemaVersion||0;f<1&&lr.htmlRenderEnabled&&Mr({children:u.pages},y=>{if(y.type==="text"){const b=y.letterSpacing*16;y.letterSpacing=b/y.fontSize}}),f<2&&Mr({children:u.pages},y=>{y.filters&&Object.keys(y.filters).forEach(v=>{if(["warm","cold","natural"].includes(v))return;const b=y.filters[v];b&&typeof b.intensity=="number"&&(b.intensity=b.intensity/100)})}),delete u.schemaVersion;const d=t.activePage?t.pages.indexOf(t.activePage):0;let h=(s=u.pages[d]||u.pages[0])===null||s===void 0?void 0:s.id;u._activePageId=h;const p=Object.assign({},Fo(t));Object.assign(p,u),p.history=o?Fo(t.history):{history:[],undoIdx:-1,targetPath:""},Gv(t,p)},clear({keepHistory:a=!1}={}){const o=t.pages.map(s=>s.id);i.deletePages(o),t.custom=null,a||t.history.clear()},addFont(a){i.removeFont(a.fontFamily),t.fonts.push(a)},removeFont(a){t.fonts.filter(o=>o.fontFamily===a).forEach(o=>B1(o))},addAudio(a){const o=Lx.create(Object.assign({id:Aa(10)},a));t.audios.push(o)},removeAudio(a){const o=t.audios.find(s=>s.id===a);o&&t.audios.remove(o)},async loadFont(a,o=""){const s=t.fonts.find(f=>f.fontFamily===a)||M2.find(f=>f.fontFamily===a);let u=[{fontStyle:"normal",fontWeight:"normal"},{fontStyle:"normal",fontWeight:"bold"}];return s?(s.styles&&(u=s.styles.map(f=>({fontStyle:f.fontStyle||"normal",fontWeight:f.fontWeight||"normal"}))),sC(s)):oC(a),Promise.all(u.map(f=>iC(a,f.fontStyle,f.fontWeight,o)))},validate:a=>wc.validate(a,[{path:"",type:wc}]).map(o=>({path:"store"+o.context.map(s=>s.path).join("."),message:o.message}))};return i});function rN({key:t,showCredit:e}={key:"",showCredit:!1}){return wc.create({_forceShowCredit:e,_key:t})}const r6=ut.model("Node",{id:ut.identifier,type:"none",name:"",opacity:1,custom:ut.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(t=>{for(var e in t)t[e]===null&&(t[e]=void 0);return t}).postProcessSnapshot(t=>{const e=Object.assign({},t),r={};for(var n in e)n[0]!=="_"&&(r[n]=t[n]);return r}).views(t=>({get page(){return uc(t,dp)},get store(){return uc(t,wc)},get top(){let e=t;for(;;){if(!ug(e,ud))return e;e=uc(e,ud)}},get parent(){if(ug(t,ud)){const e=uc(t,ud);return e&&e.children&&e.children.length,e}if(ug(t,dp)){const e=uc(t,dp);return e&&e.children&&e.children.length,e}if(ug(t,wc)){const e=uc(t,wc);return e&&e.pages&&e.pages.length,e}return null},get zIndex(){return t.parent.children.indexOf(t)}})).actions(t=>({toJSON:()=>Object.assign({},Fo(t))})).actions(t=>({clone(e={},{skipSelect:r=!1}={}){const n=JSON.parse(JSON.stringify(t.toJSON()));return e.id=e.id||Aa(10),Mr(n,i=>{i.id=Aa(10)}),Object.assign(n,e),t.page.addElement(n,{skipSelect:r})},set(e){Object.assign(t,e)},moveUp(){t.page.moveElementsUp([t.id])},moveTop(){t.page.moveElementsTop([t.id])},moveDown(){t.page.moveElementsDown([t.id])},moveBottom(){t.page.moveElementsBottom([t.id])},setZIndex(e){t.parent.setElementZIndex(t.id,e)},beforeDestroy(){}})),Fx={right:{from:{x:-200},to:{x:0}},left:{from:{x:200},to:{x:0}},up:{from:{y:200},to:{y:0}},down:{from:{y:-200},to:{y:0}},"bottom-right":{from:{x:-200,y:-200},to:{x:0,y:0}},"bottom-left":{from:{x:200,y:-200},to:{x:0,y:0}},"top-right":{from:{x:-200,y:200},to:{x:0,y:0}},"top-left":{from:{x:200,y:200},to:{x:0,y:0}}},Bx={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},nN={none:()=>({}),fade:({dTime:t,element:e,animation:r})=>{const n=t/r.duration;return r.type==="enter"?{opacity:n*e.opacity}:{opacity:(1-n)*e.opacity}},rotate:({dTime:t,element:e,animation:r})=>{const n=t/r.duration*360;return MI({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation},n)},blink:({dTime:t,element:e,animation:r})=>{const n=r.duration,i=t%n/(n/2),a=i<=1?i:2-i;return{opacity:e.opacity*a}},bounce:({dTime:t,element:e,animation:r})=>{var n;const i=r.duration,a=i/2,o=(n=r.data.strength)!==null&&n!==void 0?n:1,s={},u={x:e.x+e.width/3*o,y:e.y+e.height/3*o,width:e.width/3*o,height:e.height/3*o,fontSize:e.fontSize/3*o},f={x:e.x,y:e.y,width:e.width,height:e.height,fontSize:e.fontSize},d=t%i/a,h=d<=1?d:2-d;for(let p in u){const y=u[p],v=f[p]-y;s[p]=y+h*v}return s},move:({dTime:t,element:e,animation:r})=>{var n;const i=Fx[r.data.direction]||Fx.right,a=(n=r.data.strength)!==null&&n!==void 0?n:1,o={};for(var s in i.from){let u=i.from[s],f=i.to[s];r.type==="exit"&&(u=i.to[s],f=-i.from[s]),u*=a,f*=a;const d=e[s]+u,h=e[s]+f-d;o[s]=d+t/r.duration*h}return o},zoom:({dTime:t,element:e,animation:r})=>{var n;const i={},a=1+(((r.data.direction||"in")==="in"?.75:1.25)-1)*((n=r.data.strength)!==null&&n!==void 0?n:1),o=e.rotation*Math.PI/180,s=Math.cos(o),u=Math.sin(o),f=e.width*(1-a),d=e.height*(1-a),h=(f*s-d*u)/2,p=(f*u+d*s)/2,y={x:e.x+h,y:e.y+p,width:e.width*a,height:e.height*a,fontSize:e.fontSize*a},v={x:e.x,y:e.y,width:e.width,height:e.height,fontSize:e.fontSize};for(var b in y){let x=y[b],k=v[b];if(r.type==="exit"){const P=x;x=k,k=P}const S=k-x;i[b]=x+t/r.duration*S}return i},cameraZoom:({dTime:t,element:e,animation:r})=>{var n,i,a;const o={},s=r.data.direction||"right",u=Bx[s]||Bx.right,f=(n=r.data.movementStrength)!==null&&n!==void 0?n:.1,d=(i=r.data.shakeStrength)!==null&&i!==void 0?i:.015;a=r.data.zoomStrength;const h=t/r.duration,p=d*(1-h),y=Math.sin(12*h)*p*.7+Math.sin(8*h)*p*.3;r.type==="exit"&&Math.max(e.cropWidth||1,e.cropHeight||1),r.type;const v=1-Math.pow(1-h,2),b=e.cropX||0,x=e.cropY||0,k=e.cropWidth||1,S=e.cropHeight||1,P=k,_=S;let E,A,T=0,I=0;if(u.cropX){const L=u.cropX>0?1-(b+k):b;T=Math.min(L,Math.abs(f))*u.cropX}if(u.cropY){const L=u.cropY>0?1-(x+S):x;I=Math.min(L,Math.abs(f))*u.cropY}return r.type==="enter"?(E=u.cropX?b+T*(1-v):b,A=u.cropY?x+I*(1-v):x):(E=u.cropX?b+T*v:b,A=u.cropY?x+I*v:x),o.cropX=Math.max(0,Math.min(1-P,E+y*P)),o.cropY=Math.max(0,Math.min(1-_,A+y*_)),o.cropWidth=P,o.cropHeight=_,o}},mv=({element:t,dTime:e,animation:r})=>{const n=nN[r.name];return n?n({element:t,dTime:e,animation:r}):(console.error("Can not find animation type: "+r.name),{})},iN=ut.model("Animation",{delay:0,duration:500,enabled:!0,type:ut.enumeration("Type",["enter","exit","loop"]),name:"none",data:ut.frozen({})}),gv=(t,e)=>{const r={};for(const n in e)if(typeof t[n]=="number"&&typeof e[n]=="number"){const i=e[n]-t[n];i!==0&&(r[n]=i)}return r},aN=ut.model("ShapeFilter",{intensity:1}),zx=["temperature","contrast","highlights","shadows","white","black","saturation","vibrance"],qp=r6.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:ut.array(iN),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:ut.map(aN),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(t=>{const e=Object.assign(Object.assign({},t),{x:"x"in t&&t.x||0,y:"y"in t&&t.y||0,filters:"filters"in t?Array.isArray(t.filters)?{}:t.filters:void 0});return"width"in t&&(e.width=e.width||1),"height"in t&&(e.height=e.height||1),"locked"in t&&t.locked&&(e.draggable=!1,e.contentEditable=!1,e.styleEditable=!1,e.resizable=!1,e.removable=!1),e}).views(t=>{const e=["x","y","width","height","rotation","opacity","color","fontSize","cropX","cropY","cropWidth","cropHeight"],r=t,n={};for(const u of e)u in t&&(n[u]=r[u]);const i=Gt(n),a=Ft(()=>{for(const u in i)i[u]=r[u]}),o=Ft(u=>{Object.assign(i,u)}),s=Ft(u=>{for(const f in u)typeof i[f]=="number"&&(i[f]=i[f]+u[f])});return{get locked(){return!(t.draggable||t.contentEditable||t.styleEditable||t.resizable)},get a(){const{currentTime:u}=t.store;if(a(),u===0)return i;const f=u-t.page.startTime;if(f>t.page.duration||f<0)return i;const d=t.store.animatedElementsIds;if(d.length&&!d.includes(t.id))return i;const h=t.animations.find(x=>x.type==="enter"),p=h?.enabled&&f<h.delay;p&&o({opacity:0});const y=h?.enabled&&f>=h.delay&&f<=h.delay+h.duration;if(y){const x=f-h.delay,k=mv({element:t,animation:h,dTime:x}),S=gv(t,k);s(S)}const v=t.animations.find(x=>x.type==="exit");if(!p&&!y&&v?.enabled&&f>=t.page.duration-v.duration-v.delay&&f<=t.page.duration-v.delay){const x=f-(t.page.duration-v.duration-v.delay),k=mv({element:t,animation:v,dTime:x}),S=gv(t,k);s(S)}v?.enabled&&f>=t.page.duration-v.delay&&o({opacity:0});const b=t.animations.find(x=>x.type==="loop");if(b?.enabled){const x=mv({element:t,animation:b,dTime:f}),k=gv(t,x);s(k)}return i},animated(u){return this.a[u]}}}).actions(t=>({setAnimation(e,r){const n=t.animations.find(i=>i.type===e);n?Object.assign(n,r):t.animations.push(Object.assign({type:e},r))},setFilter(e,r){zx.includes(e)||t.filters.forEach((n,i)=>{zx.includes(i.toString())||t.filters.delete(i.toString())}),r==null?t.filters.delete(e):t.filters.set(e,{intensity:r})}})),n6=qp.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",textTransform:"none",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:ut.optional(ut.union(ut.number,ut.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:"#7ED321",backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5,curveEnabled:!1,curvePower:.5}).preProcessSnapshot(t=>Object.assign({},t)).actions(t=>({toggleEditMode(e){t._editModeEnabled=e??!t._editModeEnabled,t._editModeEnabled?t.store.history.startTransaction():t.store.history.endTransaction()}})),R0=qp.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,keepRatio:!1,stretchEnabled:!1}).extend(t=>{const e=Gt.box(!1);let r=!1;return{views:{get _cropModeEnabled(){return e.get()}},actions:{toggleCropMode(n){const i=n??!e.get();e.set(i),i&&!r?(t.store.history.startTransaction(),r=!0):!i&&r&&(t.store.history.endTransaction(),r=!1)},beforeDestroy(){r&&(t.store.history.endTransaction(),r=!1)}}}}),i6=R0.named("Video").props({type:"video",duration:0,startTime:0,endTime:1,volume:1}),a6=qp.named("Line").props({type:"line",width:400,height:10,color:"black",dash:ut.array(ut.number),startHead:"",endHead:""}).actions(t=>({})),o6=qp.named("SVG").props({type:"svg",src:"",maskSrc:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,stretchEnabled:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:ut.map(ut.string)}).preProcessSnapshot(t=>Object.assign(Object.assign({},t),{src:t.src||t.svgSource,colorsReplace:Array.isArray(t.colorsReplace)?{}:t.colorsReplace})).actions(t=>({replaceColor(e,r){t.colorsReplace.set(e,r)}})),s6=qp.named("Figure").props({type:"figure",subType:"rect",fill:"rgb(0, 161, 255)",dash:ut.array(ut.number),strokeWidth:0,stroke:"rgba(98, 197, 255, 1)",cornerRadius:0}),l6=R0.named("Gif").props({type:"gif",duration:0,keepRatio:!0});var oN=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};const Mr=(t,e)=>{if(t.children)for(const r of t.children){if(e(r)===!0)break;Mr(r,e)}},sN=[...new Array(20)].map((t,e)=>ut.late(()=>lN[e])),u6=ut.union({dispatcher:t=>{const e=ub[t.type];if(!e)throw new Error(`Unknown element type: "${t.type}"`);return e}},o6,n6,R0,a6,i6,s6,l6,ut.late(()=>ud),...sN),ud=r6.named("Group").props({type:"group",children:ut.array(u6)}).views(t=>({get draggable(){let e=!0;return Mr(t,r=>{r.draggable||(e=!1)}),e},get resizable(){let e=!0;return Mr(t,r=>{r.resizable||(e=!1)}),e},get contentEditable(){let e=!0;return Mr(t,r=>{r.contentEditable||(e=!1)}),e},get styleEditable(){let e=!0;return Mr(t,r=>{r.styleEditable||(e=!1)}),e},get locked(){let e=!0;return Mr(t,r=>{r.locked||(e=!1)}),e}})).actions(t=>({set(e){var{draggable:r,contentEditable:n,styleEditable:i,resizable:a}=e,o=oN(e,["draggable","contentEditable","styleEditable","resizable"]);r!==void 0&&Mr(t,s=>{s.set({draggable:r})}),n!==void 0&&Mr(t,s=>{s.set({contentEditable:n})}),i!==void 0&&Mr(t,s=>{s.set({styleEditable:i})}),a!==void 0&&Mr(t,s=>{s.set({resizable:a})}),Object.assign(t,o)},addElement(e,{skipSelect:r=!1}={}){const n=ub[e.type];if(!n)return void console.error("Can not find model with type "+e.type);e.children&&e.children.forEach(a=>{a.id=a.id||Aa(10)});const i=n.create(Object.assign({id:Aa(10)},e));return t.children.push(i),i.selectable&&!r&&t.store.selectElements([i.id]),i},setElementZIndex(e,r){const n=t.children.find(i=>i.id===e);n&&(gc(n),t.children.remove(n),t.children.splice(r,0,n))},setAnimation(e,r){Mr(t,n=>{n.setAnimation(e,r)})}})),lN=[],ub={svg:o6,text:n6,image:R0,group:ud,line:a6,video:i6,figure:s6,gif:l6},uN={text:nA,image:L3,svg:L3,line:BI,video:iD,figure:mD,group:Sr(t=>{const{element:e,store:r}=t,{children:n}=e,i=e.selectable||r.role==="admin";return Y.createElement(Jt,{opacity:e.opacity,listening:i,hideInExport:!e.showInExport,id:e.id},n.map(a=>Y.createElement(c6,Object.assign({},t,{key:a.id,store:r,element:a}))))}),gif:SD},cN=(t,e)=>{const r=[];Mr(t,d=>{d.type!=="group"&&r.push(d.a)});const n=[];r.forEach(d=>{const h=[{x:0,y:0},{x:0+d.width,y:0},{x:0+d.width,y:0+d.height},{x:0,y:0+d.height}],p=new _t.Transform;p.translate(d.x,d.y),p.rotate(_t.Util.degToRad(d.rotation)),h.forEach(y=>{const v=p.point(y);n.push(v)})});const i=new _t.Transform;i.rotate(-_t.Util.degToRad(e));let a=1/0,o=1/0,s=-1/0,u=-1/0;n.forEach(d=>{const h=i.point(d);a=Math.min(a,h.x),o=Math.min(o,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),i.invert();const f=i.point({x:a,y:o});return{x:f.x,y:f.y,width:s-a,height:u-o,rotation:e}},c6=Sr(t=>{var e;const{element:r,store:n}=t,[i,a]=Y.useState(!1),o=n.selectedElements.indexOf(r)>=0&&r.selectable,s=((e=r.parent)===null||e===void 0?void 0:e.type)==="group",u=(h=>{const[p,y]=Y.useState(null);return Y.useEffect(()=>{const v=setTimeout(()=>{const b=h.page.id,x=_t.stages.find(k=>k.getAttr("pageId")===b);x||console.error("No stage is found for element",h.id),y(x)});return()=>clearTimeout(v)},[h.id]),p})(r),f=u?.findOne("Transformer");Y.useEffect(()=>{if(u){const h=y=>{const v=y.target.findAncestor(".element",!0),b=n.getElementById(v?.id()),x=b?.top,k=x?.id;a(k===r.id)};u.on("mouseover",h);const p=()=>{a(!1)};return u.on("mouseleave",p),()=>{u.off("mouseover",h),u.off("mouseleave",p)}}},[u]);let d=uN[t.element.type];return t.element.type==="text"&&lr.htmlRenderEnabled&&(d=OI),t.element.visible?d?Y.createElement(Jt,{name:"element-container"},Y.createElement(d,Object.assign({},t)),i&&!o&&!s&&Y.createElement(_D,{element:r.type==="group"?{a:cN(r,f?.rotation()||0)}:r})):(console.error("Can not find component for "+t.element.type),null):null});function fN(t,e=.5){if(t.length<3)return t;const r=[];r.push(t[0]);for(let n=0;n<t.length-1;n++){const i=t[Math.max(0,n-1)],a=t[n],o=t[n+1],s=t[Math.min(t.length-1,n+2)],u=10;for(let f=0;f<u;f++){const d=f/u,h=d*d,p=h*d,y=.5*(2*a.x+(-i.x+o.x)*d+(2*i.x-5*a.x+4*o.x-s.x)*h+(-i.x+3*a.x-3*o.x+s.x)*p),v=.5*(2*a.y+(-i.y+o.y)*d+(2*i.y-5*a.y+4*o.y-s.y)*h+(-i.y+3*a.y-3*o.y+s.y)*p);r.push({x:y,y:v})}}return r.push(t[t.length-1]),r}function dN(t){if(t.length===0)return"";if(t.length===1){const r=t[0];return`M ${r.x},${r.y} L ${r.x+.1},${r.y}`}let e=`M ${t[0].x},${t[0].y}`;for(let r=1;r<t.length-1;r++){const n=t[r],i=t[r+1],a=(n.x+i.x)/2,o=(n.y+i.y)/2;e+=` Q ${n.x},${n.y} ${a},${o}`}if(t.length>1){const r=t[t.length-1];e+=` L ${r.x},${r.y}`}return e}function hN(t){if(t.length===0)return{x:0,y:0,width:0,height:0};let e=t[0].x,r=t[0].y,n=t[0].x,i=t[0].y;for(const a of t)e=Math.min(e,a.x),r=Math.min(r,a.y),n=Math.max(n,a.x),i=Math.max(i,a.y);return{x:e,y:r,width:n-e,height:i-r}}function pN(t,e){if(t.length===0)throw new Error("Cannot create SVG from empty path");const r=fN(t),n=hN(r),i=e.strokeWidth,a=n.x-i,o=n.y-i,s=n.width+2*i,u=n.height+2*i,f=`
390
+ <svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${u}" viewBox="0 0 ${s} ${u}">
391
+ <path
392
+ d="${dN(r.map(d=>({x:d.x-a,y:d.y-o})))}"
393
+ stroke="${e.stroke}"
394
+ stroke-width="${e.strokeWidth}"
395
+ stroke-linecap="round"
396
+ stroke-linejoin="round"
397
+ fill="none"
398
+ />
399
+ </svg>
400
+ `.trim();return{src:tl(f),x:a,y:o,width:s,height:u}}const mN=Sr(({store:t,page:e,width:r,height:n,scale:i,xPadding:a,yPadding:o,bleed:s})=>{const[u,f]=Y.useState(!1),[d,h]=Y.useState([]),p=Y.useRef(null),y=t.tool==="draw",{strokeWidth:v,stroke:b,opacity:x,brushType:k}=t.toolOptions,S=Y.useCallback(A=>{if(!y||(f(!0),A.cancelBubble=!0,!A.target.getStage()))return;const T=p.current.getRelativePointerPosition();T&&h([{x:T.x,y:T.y}])},[y,i,a,o,s]),P=Y.useCallback(A=>{if(!y||!u||(A.cancelBubble=!0,!A.target.getStage()))return;const T=p.current.getRelativePointerPosition();T&&h(I=>[...I,{x:T.x,y:T.y}])},[y,u,i,a,o,s]),_=Y.useCallback(()=>{if(y&&u){if(f(!1),d.length>=1)try{const A=pN(d,{stroke:b,strokeWidth:v,smooth:!0}),T=t.selectedElementsIds.slice();t.history.transaction(()=>{e.addElement({type:"svg",x:A.x,y:A.y,width:A.width,height:A.height,src:A.src,opacity:x},{skipSelect:!0})}),t.selectElements(T)}catch(A){console.error("Error creating path SVG:",A)}h([])}},[y,u,d,b,v,x,e,t.history,t]),E=Y.useMemo(()=>d.flatMap(A=>[A.x,A.y]),[d]);return Y.useEffect(()=>{if(y&&p.current){const A=p.current.getStage();if(!A)return;const T=v*i;if(T>100||T<4)A.container().style.cursor="crosshair";else{const I=T/2,L=T/2,R=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="${T}" height="${T}" viewBox="0 0 ${T} ${T}">
401
+ <circle cx="${L}" cy="${L}" r="${I-1}" fill="${b}" opacity="${x}" stroke="white" stroke-width="1"/>
402
+ <circle cx="${L}" cy="${L}" r="${I-1}" fill="none" stroke="black" stroke-width="1" opacity="0.3"/>
403
+ </svg>`)}`;A.container().style.cursor=`url("${R}") ${L} ${L}, crosshair`}return()=>{A.container()&&(A.container().style.cursor="")}}},[y,b,v,x,i]),y?Y.createElement(Jt,{ref:p,listening:y,x:a+s*i,y:o+s*i,scaleX:i,scaleY:i},Y.createElement(ur,{x:-(a+s*i)/i,y:-(o+s*i)/i,width:r/i,height:n/i,fill:"transparent",onMouseDown:S,onMouseMove:P,onMouseUp:_,onTouchStart:S,onTouchMove:P,onTouchEnd:_}),d.length>0&&Y.createElement(js,{points:E,stroke:b,strokeWidth:v,lineCap:"round",lineJoin:"round",opacity:x,tension:.5,listening:!1})):null});function gN(t,e,r="scale"){const n=e.width/e.height;let i,a;n>=t.width/t.height?(i=t.width,a=t.width/n):(i=t.height*n,a=t.height);let o=0,s=0;return r==="left-top"?(o=0,s=0):r==="left-middle"?(o=0,s=(t.height-a)/2):r==="left-bottom"?(o=0,s=t.height-a):r==="center-top"?(o=(t.width-i)/2,s=0):r==="center-middle"?(o=(t.width-i)/2,s=(t.height-a)/2):r==="center-bottom"?(o=(t.width-i)/2,s=t.height-a):r==="right-top"?(o=t.width-i,s=0):r==="right-middle"?(o=t.width-i,s=(t.height-a)/2):r==="right-bottom"?(o=t.width-i,s=t.height-a):r==="scale"?(o=0,s=0,i=t.width,a=t.height):console.error(new Error("Unknown clip position property - "+r)),{cropX:o,cropY:s,cropWidth:i,cropHeight:a}}var f6=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};const jx=_t.DD._drag;window.removeEventListener("mousemove",jx),_t.DD._drag=function(t){Ls(()=>{jx.call(this,t)})},window.addEventListener("mousemove",_t.DD._drag);const u2=new _t.Group,ou=20;u2.add(new _t.Rect({width:ou,height:ou,fill:"white"})),u2.add(new _t.Path({scaleX:ou/24,scaleY:ou/24,data:"M4.98313549,11.0001422 C5.49589839,10.9914935 5.92501998,11.3703506 5.99116425,11.8666444 L5.99985778,11.9831355 L6.00348884,12.2068855 C6.11245031,15.4321748 8.76323537,17.9999971 11.9999971,17.9999971 C12.1869612,17.9999971 12.3726725,17.9914753 12.5567465,17.9745765 L12.2928932,17.7071068 C11.9023689,17.3165825 11.9023689,16.6834175 12.2928932,16.2928932 C12.6834175,15.9023689 13.3165825,15.9023689 13.7071068,16.2928932 L15.7071068,18.2928932 C16.0976311,18.6834175 16.0976311,19.3165825 15.7071068,19.7071068 L13.7071068,21.7071068 C13.3165825,22.0976311 12.6834175,22.0976311 12.2928932,21.7071068 C11.9023689,21.3165825 11.9023689,20.6834175 12.2928932,20.2928932 L12.6111505,19.9769552 C12.4086045,19.9922816 12.2047796,19.9999971 11.9999971,19.9999971 C7.7687005,19.9999971 4.28886152,16.7094374 4.01666425,12.5105203 L4.00420123,12.2575143 L4.00014222,12.0168645 C3.9908282,11.4646583 4.43092928,11.0094562 4.98313549,11.0001422 Z M11.7071068,2.29289322 C12.0675907,2.65337718 12.0953203,3.22060824 11.7902954,3.61289944 L11.7071068,3.70710678 L11.3891629,4.0230186 C11.5916051,4.00770767 11.7953244,4 12,4 C16.418278,4 20,7.581722 20,12 C20,12.5522847 19.5522847,13 19,13 C18.4477153,13 18,12.5522847 18,12 C18,8.6862915 15.3137085,6 12,6 C11.8129339,6 11.6271216,6.00853145 11.4429483,6.02544919 L11.7071068,6.29289322 C12.0976311,6.68341751 12.0976311,7.31658249 11.7071068,7.70710678 C11.3466228,8.06759074 10.7793918,8.09532028 10.3871006,7.79029539 L10.2928932,7.70710678 L8.29289322,5.70710678 C7.93240926,5.34662282 7.90467972,4.77939176 8.20970461,4.38710056 L8.29289322,4.29289322 L10.2928932,2.29289322 C10.6834175,1.90236893 11.3165825,1.90236893 11.7071068,2.29289322 Z",fill:"black"}));const yN=u2.toCanvas({pixelRatio:2,width:ou,height:ou}),zs={enabledAnchors:["top-left","top-center","top-right","middle-left","bottom-left","bottom-right","bottom-center","middle-right"],borderEnabled:!0,rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,flipEnabled:!1,anchorStrokeWidth:2,borderStrokeWidth:2,rotateAnchorOffset:30,anchorStyleFunc:t=>{t.hasName("rotater")&&t.setAttrs({width:20,height:20,cornerRadius:20/2,offsetX:20/2,offsetY:20/2,fillPatternImage:yN,fillPatternScaleX:20/ou/2,fillPatternScaleY:20/ou/2,fillPriority:"pattern",fillPatternRepeat:"no-repeat"})}},pg={text:{enabledAnchors:["top-left","top-right","middle-left","bottom-left","bottom-right","middle-right"]},svg:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},gif:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},line:{enabledAnchors:[],borderEnabled:!1,rotateEnabled:!1},image:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},many:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},group:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]}},vN=t=>Y.createElement(ur,Object.assign({},t,{preventDefault:!1})),bN=t=>{var{url:e}=t,r=f6(t,["url"]);const[n,i]=I2(e,"anonymous"),a=n?gN(n,{width:r.width,height:r.height},"center-middle"):{};return op(i,e,"page background"),Y.createElement(zo,Object.assign({image:n},r,a))},wN=t=>{const e=Go({fill:t.fill,a:{width:t.width,height:t.height}});return Y.createElement(ur,Object.assign({},t,e))},xN=t=>{const{background:e,scale:r,borderColor:n}=t,i=f6(t,["background","scale","borderColor"]),a=Y.useMemo(()=>!!_t.Util.colorToRGBA(e)||an(e),[e]),o=Y.useMemo(()=>{const s=document.createElement("canvas"),u=30;s.width=60,s.height=60;const f=s.getContext("2d");return f&&(f.fillStyle="black",f.fillRect(u,0,u,u),f.fillRect(0,u,u,u)),s},[]);return Y.createElement(Y.Fragment,null,Y.createElement(ur,Object.assign({fillPatternImage:o},i,{opacity:.1,hideInExport:!0})),a?Y.createElement(wN,Object.assign({fill:e},i)):Y.createElement(bN,Object.assign({url:e},i)))},SN=Sr(({selection:t,fill:e="rgba(0, 161, 255, 0.3)",stroke:r="rgb(0, 161, 255)",strokeWidth:n=1})=>t.visible?Y.createElement(ur,{name:"selection",x:Math.min(t.x1,t.x2),y:Math.min(t.y1,t.y2),width:Math.abs(t.x1-t.x2),height:Math.abs(t.y1-t.y2),fill:e,stroke:r,strokeWidth:n}):null);function kN(t){let e=180*t/Math.PI;return e%=360,e>180?e-=360:e<-180&&(e+=360),Math.round(e)}const _N=Sr(({x:t,y:e,width:r,height:n,rotation:i,anchor:a,store:o,tagFill:s,textFill:u})=>{const f=Rd({x:t,y:e,width:r,height:n,rotation:_t.Util.radToDeg(i)});if(a===void 0)return null;const d=(n/2+70)*Math.cos(i-Math.PI/2),h=(n/2+70)*Math.sin(i-Math.PI/2),p=Ix({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:o.unit==="px"?0:1})+" x "+Ix({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:o.unit==="px"?0:1})+(o.unit==="px"?"":" "+o.unit);return Y.createElement(Y.Fragment,null,Y.createElement(Bg,{x:(f.minX+f.maxX)/2+d,y:(f.minY+f.maxY)/2+h,offsetX:14,offsetY:14,visible:a==="rotater"},Y.createElement(zg,{cornerRadius:5,fill:s||"rgb(0, 161, 255)"}),Y.createElement(qo,{align:"center",verticalAlign:"middle",fill:u||"white",padding:8,text:kN(i).toString()+"°"})),Y.createElement(Bg,{x:(f.minX+f.maxX)/2,y:f.maxY+20,visible:a!=="rotater"},Y.createElement(zg,{cornerRadius:5,fill:s||"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),Y.createElement(qo,{align:"center",verticalAlign:"middle",fill:u||"white",padding:8,text:p})))}),PN=Sr(({elements:t,store:e})=>{const r=t.filter(i=>i.alwaysOnTop),n=t.filter(i=>!i.alwaysOnTop).concat(r);return Y.createElement(Y.Fragment,null,n.map(i=>Y.createElement(c6,{key:i.id,store:e,element:i,onClick:()=>{console.warn("Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.")}})))}),EN=({store:t})=>{const[e,r]=Y.useState(!1),[n,i]=Y.useState({x:0,y:0});return{open:Y.useCallback(o=>{r(!0),i(o)},[]),close:Y.useCallback(()=>{r(!1)},[]),props:{isOpen:e,offset:n,setIsOpen:r}}},TN=atob("UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4="),Ux=atob("cmVk"),CN=atob("djAuOS4y"),ON=t=>Y.createElement(Y.Fragment,null,Y.createElement(Bg,{fill:Ux,height:200},Y.createElement(zg,{fill:Ux}),Y.createElement(qo,Object.assign({},t,{fill:"white",text:TN,height:void 0,padding:10,fontSize:20})))),AN=Sr(({store:t,page:e,width:r,height:n,pageControlsEnabled:i,backColor:a,pageBorderColor:o,activePageBorderColor:s,components:u,bleedColor:f,altCloneEnabled:d,viewportSize:h,selectionRectFill:p,selectionRectStroke:y,selectionRectStrokeWidth:v,snapGuideStroke:b,snapGuideStrokeWidth:x,snapGuideDash:k,transformLabelFill:S,transformLabelTextFill:P,distanceGuideStroke:_,distanceLabelFill:E,distanceLabelTextFill:A,layout:T="vertical",tooltipSafeArea:I,transformerSafeArea:L})=>{const R=t.bleedVisible?e.bleed:0,N=e.computedWidth+2*R,F=e.computedHeight+2*R,H=(r-N*t.scale)/2,$=(n-F*t.scale)/2,X=Y.useRef(null),Z=Y.useRef(null),K=Y.useRef(null),q=i==null||i,[J,U]=Y.useState(null),[D,W]=Y.useState({}),[V,ee]=Y.useState(0),te=EN({store:t}),Q=t.selectedElements.find(be=>be._cropModeEnabled),ne=t.selectedElements.find(be=>be.curveEnabled),ue=t.selectedShapes.filter(be=>!be.resizable).length>0,oe=t.selectedShapes.filter(be=>!be.draggable).length>0,de=t.selectedElements.filter(be=>!be.visible).length>0;Y.useLayoutEffect(()=>{var be,he,Ve;if(!X.current)return;const le=X.current.getStage(),Ie=t.selectedShapes.map(Ze=>Ze._cropModeEnabled?null:le.findOne("#"+Ze.id)).filter(Ze=>Ze),Ye=t.selectedElements.length===1,at=Ye&&((be=t.selectedElements[0])===null||be===void 0?void 0:be.type)||"many";pg[at]?(X.current.setAttrs(Object.assign(Object.assign({},zs),pg[at])),at!=="svg"&&at!=="image"&&at!=="gif"||t.selectedElements[0].keepRatio||X.current.setAttrs({enabledAnchors:zs.enabledAnchors}),at==="text"&&lr.textVerticalResizeEnabled&&X.current.setAttrs({enabledAnchors:(he=pg.text.enabledAnchors)===null||he===void 0?void 0:he.concat(["bottom-center"])}),at==="text"&&Ye&&t.selectedElements[0].curveEnabled&&X.current.setAttrs({enabledAnchors:pg.many.enabledAnchors})):X.current.setAttrs(zs),ue&&X.current.enabledAnchors([]),oe&&X.current.rotateEnabled(!1),Ie.find(Ze=>Ze?.isDragging())&&Ie.forEach(Ze=>{Ze.isDragging()||Ze==null||Ze.startDrag()}),X.current.nodes(Ie),Yk(),(Ve=X.current.getLayer())===null||Ve===void 0||Ve.batchDraw()},[t.selectedShapes,Q,ue,de,oe,ne]);const Ee=()=>{const be=X.current;if(!be)return;if(!be.isTransforming())return void W({});if(!be.nodes().length||!be.isTransforming())return;const he=be.__getNodeRect(),Ve=be?.getActiveAnchor(),le=be.getStage();W({anchor:Ve,x:he.x-le.x(),y:he.y-le.y(),rotation:he.rotation,width:he.width,height:he.height})},Fe=Y.useCallback(()=>{var be;if(!((be=X.current)===null||be===void 0)&&be.isTransforming())return;const he=X.current;if(!he||!he.nodes().length)return void ee(0);const Ve=he.getClientRect();if(!he.getStage())return;const le=(function(Ie,Ye,at,Ze=0){const ht=Ie.x+Ie.width/2,ve=Ie.y+Ie.height/2,Ce=Ie.width/2,Pt=Ie.height/2,Ot=Ze*Math.PI/180,Et=Bt=>{const Br=Bt*Math.PI/180,Yt=(Bt%360+360)%360;let dr;dr=Yt===0||Yt===180?Pt:Ce;const on=Math.sin(Br)*(dr+at),Vr=-Math.cos(Br)*(dr+at),yr=on*Math.cos(Ot)-Vr*Math.sin(Ot),Hi=on*Math.sin(Ot)+Vr*Math.cos(Ot);return{x:ht+yr,y:ve+Hi}},pt=Bt=>Bt.x>=Ye.left&&Bt.x<=Ye.right&&Bt.y>=Ye.top&&Bt.y<=Ye.bottom;if(pt(Et(0)))return 0;for(const Bt of[180,270,90])if(pt(Et(Bt)))return Bt;return 0})(Ve,{top:L?.top||0,bottom:n-(L?.bottom||0),left:L?.left||0,right:r-(L?.right||0)},zs.rotateAnchorOffset||30,he.rotation());ee(le)},[L,r,n]);Y.useEffect(()=>{var be;(be=X.current)===null||be===void 0||be.update(),Ee(),Fe()},[t.scale,Fe]),Y.useEffect(()=>{Fe()},[t.selectedShapes,Fe]);const Le=iP(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),$e=Y.useRef(!1),Xe=wu(),dt=Ft(be=>{var he,Ve,le,Ie;if(Xe)return;$e.current=!1;const Ye=be.target.findAncestor(".elements-container"),at=be.target.findAncestor("Transformer"),Ze=be.target.findAncestor(".page-abs-container");if(Ye||at||Ze)return;const ht=(he=be.target.getStage())===null||he===void 0?void 0:he.getPointerPosition();ht.x-=(Ve=be.target.getStage())===null||Ve===void 0?void 0:Ve.x(),ht.y-=(le=be.target.getStage())===null||le===void 0?void 0:le.y(),ht&&(Le.visible=!0,Le.x1=ht.x,Le.y1=ht.y,Le.x2=ht.x,Le.y2=ht.y,((Ie=be.target.getStage())===null||Ie===void 0?void 0:Ie.getPointersPositions().length)>=2&&(Le.visible=!1))});(({stageRef:be,containerRef:he,viewportSize:Ve})=>{Y.useEffect(()=>{var le;const Ie=(le=he.current)===null||le===void 0?void 0:le.closest(".polotno-workspace-inner");function Ye(){var at;if(!be.current)return;const Ze=(at=he.current)===null||at===void 0?void 0:at.getBoundingClientRect(),ht=Ie?.getBoundingClientRect(),ve=Math.max(0,ht.left-Ze.left-100),Ce=Math.max(0,ht.top-Ze.top-100);be.current.position({x:-ve,y:-Ce}),be.current.container().style.transform=`translate(${ve}px, ${Ce}px)`}return Ye(),Ie.addEventListener("scroll",Ye),()=>{Ie.removeEventListener("scroll",Ye)}},[Ve.width,Ve.height])})({stageRef:Z,containerRef:K,viewportSize:h}),Y.useEffect(()=>{const be=Ft(Ve=>{var le,Ie,Ye,at;if(!Le.visible)return;console.log("continueSelection"),(le=Z.current)===null||le===void 0||le.setPointersPositions(Ve);let Ze=(Ie=Z.current)===null||Ie===void 0?void 0:Ie.getPointerPosition();Ze?(Ze.x-=(Ye=Z.current)===null||Ye===void 0?void 0:Ye.x(),Ze.y-=(at=Z.current)===null||at===void 0?void 0:at.y()):Ze={x:Le.x2,y:Le.y2},Le.x2=Ze.x,Le.y2=Ze.y}),he=Ft(()=>{if(!Le.visible||!Z.current)return;const Ve=Z.current.findOne(".selection"),le=Ve?Ve.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(le.width&&le.height){const Ie=[];Z.current.find(".element").forEach(at=>{const Ze=at.getClientRect(),ht=t.getElementById(at.id()),ve=ht?.draggable,Ce=ht?.selectable;_t.Util.haveIntersection(le,Ze)&&ve&&Ce&&Ie.push(ht.top.id)});const Ye=[...new Set(Ie)];$e.current=!0,t.selectElements(Ye)}Le.visible=!1});return window.addEventListener("mousemove",be),window.addEventListener("touchmove",be),window.addEventListener("mouseup",he,{capture:!0}),window.addEventListener("touchend",he,{capture:!0}),()=>{window.removeEventListener("mousemove",be),window.removeEventListener("touchmove",be),window.removeEventListener("mouseup",he),window.removeEventListener("touchend",he)}},[]);const ke=Y.useCallback(be=>{if(!t.selectedElements[0]||be&&t.selectedElementsIds.includes(be))return;const he=k0(t.selectedShapes),Ve=be?t.getElementById(be):{x:0,y:0,width:e.computedWidth,height:e.computedHeight,rotation:0},le=Rd(Ve),Ie=[];he.minX>le.maxX&&Ie.push({distance:he.minX-le.maxX,box1:he,box2:le,points:[{x:he.minX,y:he.minY+he.height/2},{x:le.maxX,y:he.minY+he.height/2},{x:le.maxX,y:le.minY+le.height/2}]}),he.maxX<le.minX&&Ie.push({distance:le.minX-he.maxX,box1:he,box2:le,points:[{x:he.maxX,y:he.minY+he.height/2},{x:le.minX,y:he.minY+he.height/2},{x:le.minX,y:le.minY+le.height/2}]}),he.minY>le.maxY&&Ie.push({box1:he,box2:le,distance:he.minY-le.maxY,points:[{x:he.minX+he.width/2,y:he.minY},{x:he.minX+he.width/2,y:le.maxY},{x:le.minX+le.width/2,y:le.maxY}]}),he.maxY<le.minY&&Ie.push({box1:he,box2:le,distance:le.minY-he.maxY,points:[{x:he.minX+he.width/2,y:he.maxY},{x:he.minX+he.width/2,y:le.minY},{x:le.minX+le.width/2,y:le.minY}]});const Ye=he.minX>=le.minX&&he.maxX<=le.maxX&&he.minY>=le.minY&&he.maxY<=le.maxY;if(Ye&&(Ie.push({distance:he.minX-le.minX,box1:he,box2:le,points:[{x:he.minX,y:he.minY+he.height/2},{x:le.minX,y:he.minY+he.height/2},{x:le.minX,y:le.minY+le.height/2}]}),Ie.push({distance:le.maxX-he.maxX,box1:he,box2:le,points:[{x:he.maxX,y:he.minY+he.height/2},{x:le.maxX,y:he.minY+he.height/2},{x:le.maxX,y:le.minY+le.height/2}]}),Ie.push({box1:he,box2:le,distance:he.minY-le.minY,points:[{x:he.minX+he.width/2,y:he.minY},{x:he.minX+he.width/2,y:le.minY},{x:le.minX+le.width/2,y:le.minY}]}),Ie.push({box1:he,box2:le,distance:le.maxY-he.maxY,points:[{x:he.minX+he.width/2,y:he.maxY},{x:he.minX+he.width/2,y:le.maxY},{x:le.minX+le.width/2,y:le.maxY}]})),Ie.length===0&&!Ye){const at=he.minX<le.maxX&&he.maxX>le.minX,Ze=he.minY<le.maxY&&he.maxY>le.minY;if(at&&Ze){const ht=(Math.max(he.minY,le.minY)+Math.min(he.maxY,le.maxY))/2,ve=(Math.max(he.minX,le.minX)+Math.min(he.maxX,le.maxX))/2;he.minX<le.minX?Ie.push({distance:le.minX-he.minX,box1:he,box2:le,points:[{x:he.minX,y:ht},{x:le.minX,y:ht},{x:le.minX,y:ht}]}):Ie.push({distance:he.minX-le.minX,box1:he,box2:le,points:[{x:he.minX,y:ht},{x:le.minX,y:ht},{x:le.minX,y:ht}]}),he.maxX>le.maxX?Ie.push({distance:he.maxX-le.maxX,box1:he,box2:le,points:[{x:le.maxX,y:ht},{x:he.maxX,y:ht},{x:le.maxX,y:ht}]}):Ie.push({distance:le.maxX-he.maxX,box1:he,box2:le,points:[{x:he.maxX,y:ht},{x:le.maxX,y:ht},{x:le.maxX,y:ht}]}),he.minY<le.minY?Ie.push({box1:he,box2:le,distance:le.minY-he.minY,points:[{x:ve,y:he.minY},{x:ve,y:le.minY},{x:ve,y:le.minY}]}):Ie.push({box1:he,box2:le,distance:he.minY-le.minY,points:[{x:ve,y:he.minY},{x:ve,y:le.minY},{x:ve,y:le.minY}]}),he.maxY>le.maxY?Ie.push({box1:he,box2:le,distance:he.maxY-le.maxY,points:[{x:ve,y:le.maxY},{x:ve,y:he.maxY},{x:ve,y:le.maxY}]}):Ie.push({box1:he,box2:le,distance:le.maxY-he.maxY,points:[{x:ve,y:he.maxY},{x:ve,y:le.maxY},{x:ve,y:le.maxY}]})}}JSON.stringify(J)!==JSON.stringify(Ie)&&U(Ie)},[t,e]);Y.useEffect(()=>{t.distanceGuidesVisible?ke():J&&U(null)},[t.distanceGuidesVisible,ke,t.selectedShapes.map(be=>`${be.x},${be.y},${be.width},${be.height},${be.rotation}`).join("|")]);const ge=Y.useRef(!1);Y.useEffect(()=>{var be;let he;const Ve=(be=K.current)===null||be===void 0?void 0:be.closest(".polotno-workspace-inner"),le=()=>{ge.current=!0,clearTimeout(he),he=setTimeout(()=>{ge.current=!1},300)};return Ve.addEventListener("scroll",le),()=>{clearTimeout(he),Ve.removeEventListener("scroll",le)}},[]);const se=be=>{if(t.activePage!==e&&e.select(),ge.current||$e.current)return;const he=be.evt.ctrlKey||be.evt.metaKey||be.evt.shiftKey,Ve=be.target.findAncestor(".elements-container"),le=be.target.findAncestor(".page-abs-container"),Ie=be.target.findAncestor("Transformer");if(!(he||Ve||Ie||le||Le.visible))return void t.selectElements([]);const Ye=be.target.findAncestor(".element-container",!0),at=Ye?.findOne(".element")||be.target.findAncestor(".element",!0),Ze=t.getElementById(at?.id()),ht=Ze?.top,ve=ht?.id,Ce=t.selectedElementsIds.indexOf(ve)>=0,Pt=be.target.findAncestor(".page-container",!0);ve&&he&&!Ce?t.selectElements(t.selectedElementsIds.concat([ve])):ve&&he&&Ce?t.selectElements(t.selectedElementsIds.filter(Ot=>Ot!==ve)):!ve||he||Ce?Pt?t.selectPages([e.id]):t.selectPages([]):t.selectElements([ve])};NI(X,t,{stroke:b,strokeWidth:x,dash:k});const me=t.activePage===e,Te=t._selectedPagesIds.includes(e.id),ae=u?.PageControls,xe=u?.Tooltip,Oe=u?.ContextMenu,Be=1/t.scale,ct=0/t.scale;return Y.createElement("div",{ref:K,onDragOver:be=>be.preventDefault(),onDrop:be=>{if(be.preventDefault(),!Z.current)return;Z.current.setPointersPositions(be),Z.current.findOne(".elements-container").getRelativePointerPosition();const he=Z.current.getPointerPosition(),Ve=Z.current.getAllIntersections(he).map(Ie=>Ie.findAncestor(".element",!0)).filter(Boolean);[...new Set(Ve.reverse())].map(Ie=>t.getElementById(Ie.id()))[0]},style:{position:"relative",width:r+"px",height:n+"px",overflow:"hidden",flexShrink:0},className:"polotno-page-container"+(me?" active-page":"")},Y.createElement(MT,{ref:Z,width:Math.min(r,h.width+200),height:Math.min(h.height+200,n),onClick:se,onTap:se,onContextMenu:be=>{be.evt.preventDefault();const he=be.target.findAncestor(".element",!0),Ve=t.getElementById(he?.id()),le=Ve?.top,Ie=le?.id;Ie?t.selectedElementsIds.indexOf(Ie)>=0||t.selectElements([Ie]):t.selectElements([]),te.open({x:be.evt.clientX,y:be.evt.clientY})},onMouseDown:dt,onMouseMove:be=>{if(!t.distanceGuidesVisible&&!be.evt.altKey)return void(J&&U(null));const he=be.target.findAncestor(".element",!0),Ve=he?.id();ke(Ve)},onDragStart:be=>{var he;const Ve=be.target.findAncestor(".element",!0);if(Ve){const le=t.getElementById(Ve?.id()),Ie=le?.top,Ye=Ie?.id;!(t.selectedElementsIds.indexOf(Ye)>=0)&&Ye&&(t.selectElements([Ye]),be.target.stopDrag(),be.target.startDrag(be),(he=X.current)===null||he===void 0||he.startDrag(be))}J&&U(null)},pageId:e.id,style:{position:"absolute",overflow:"hidden",top:0,left:0}},Y.createElement(AT,null,Y.createElement(vN,{width:r,height:n,fill:a}),Y.createElement(Jt,{x:H,y:$,scaleX:t.scale,scaleY:t.scale,name:"page-container"},Y.createElement(Jt,{name:"page-container-2"},Y.createElement(Jt,{name:"page-background-group",x:R,y:R},Y.createElement(xN,{x:-e.bleed,y:-e.bleed,width:e.computedWidth+2*e.bleed,height:e.computedHeight+2*e.bleed,background:e.background,name:"page-background",preventDefault:!1,scale:t.scale})),Y.createElement(Jt,{x:R,y:R,name:"elements-container",listening:!t.isPlaying},Y.createElement(ur,{name:"elements-area",width:e.computedWidth,height:e.computedHeight,listening:!1}),Y.createElement(PN,{elements:e.children,store:t})),Y.createElement(ur,{stroke:f,name:"bleed",strokeWidth:e.bleed,x:e.bleed/2,y:e.bleed/2,width:e.computedWidth+e.bleed,height:e.computedHeight+e.bleed,listening:!1,visible:e.bleed>0&&t.bleedVisible,hideInExport:!0}),ID()===CN&&Y.createElement(ON,{name:"hit-detection",x:-Be/2-ct,y:-Be/2-ct,width:N+Be+2*ct,height:F+Be+2*ct}))),Y.createElement(js,{name:"workspace-background",points:[0,0,r,0,r,n,0,n,0,0,H,$,H,n-$,r-H,n-$,r-H,$,H,$],listening:!1,closed:!0,fill:a}),Y.createElement(Jt,{x:H,y:$,scaleX:t.scale,scaleY:t.scale},Y.createElement(ur,{name:"page-highlight",hideInExport:!0,x:-Be/2-ct,y:-Be/2-ct,width:N+Be+2*ct,height:F+Be+2*ct,stroke:Te?s:o,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})),Y.createElement(Jt,{x:H+R*t.scale,y:$+R*t.scale,scaleX:t.scale,scaleY:t.scale,name:"page-abs-container"},Y.createElement(yp,{ref:X,rotateAnchorAngle:V,onDragStart:be=>{var he;!((he=be.evt)===null||he===void 0)&&he.altKey&&d&&t.selectedElements.forEach(Ve=>{const le=Ve.clone({},{skipSelect:!0}),Ie=e.children.indexOf(Ve);e.setElementZIndex(le.id,Ie)}),t.history.startTransaction()},onDragEnd:()=>{t.history.endTransaction(),Fe()},onTransformStart:()=>{t.history.startTransaction(),U(null)},boundBoxFunc:(be,he)=>{const Ve=Math.abs(he.width)<1||Math.abs(he.height)<1,le=Math.abs(be.width)<1||Math.abs(be.height)<1;return Ve&&!le?be:he},onTransform:be=>{const he=X.current.nodes(),Ve=he[he.length-1];be.target===Ve&&setTimeout(()=>{Ee()},0)},onTransformEnd:be=>{W({}),t.history.endTransaction(),Fe()},visible:!t.isPlaying}),J&&J.map(({points:be,distance:he,box1:Ve,box2:le},Ie)=>Y.createElement(Jt,{name:"distances-container",hideInExport:!0,key:Ie,listening:!1},Y.createElement(ur,Object.assign({},Ve,{stroke:_,strokeWidth:1,strokeScaleEnabled:!1})),Y.createElement(ur,Object.assign({},le,{stroke:_,strokeWidth:1,strokeScaleEnabled:!1})),Y.createElement(js,{points:[be[0].x,be[0].y,be[1].x,be[1].y],stroke:_,strokeWidth:1,strokeScaleEnabled:!1}),Y.createElement(js,{points:[be[1].x,be[1].y,be[2].x,be[2].y],stroke:_,strokeWidth:1,strokeScaleEnabled:!1}),Y.createElement(Bg,{x:(be[0].x+be[1].x)/2,y:(be[0].y+be[1].y)/2,offsetY:-10,scaleX:1/t.scale,scaleY:1/t.scale},Y.createElement(zg,{cornerRadius:5,fill:E,pointerDirection:"down"}),Y.createElement(qo,{align:"center",verticalAlign:"middle",fill:A,padding:5,text:HD({unit:t.unit,dpi:t.dpi,px:he})})))),e._rendering&&Y.createElement(Jt,null,Y.createElement(ur,{width:N,height:F,fill:"rgba(255,255,255,0.9)"}),Y.createElement(qo,{text:"Rendering...",fontSize:60,width:N,height:F,align:"center",verticalAlign:"middle"})),xe&&Y.createElement(xe,{components:u,store:t,page:e,stageRef:Z,tooltipSafeArea:I}),Oe&&Y.createElement(jg,null,Y.createElement(Oe,Object.assign({components:u,store:t},te.props)))),Y.createElement(mN,{store:t,page:e,width:r,height:n,scale:t.scale,xPadding:H,yPadding:$,bleed:R}),Y.createElement(_N,Object.assign({},D,{store:t,tagFill:S,textFill:P})),Y.createElement(SN,{selection:Le,fill:p,stroke:y,strokeWidth:v}),RD()&&Y.createElement(qo,{text:"Powered by polotno.com",fontSize:14,fill:"rgba(0,0,0,0.6)",x:r-170,y:n-18,onMouseEnter:be=>{be.target.getStage().container().style.cursor="pointer"},onMouseLeave:be=>{be.target.getStage().container().style.cursor=""},onTouchStart:be=>{be.cancelBubble=!0},onMouseDown:be=>{be.cancelBubble=!0},onClick:()=>{window.open("https://polotno.com")},onTap:()=>{window.open("https://polotno.com")}}),Y.createElement(Jt,{name:"line-guides"}))),q&&ae&&Y.createElement(ae,{store:t,page:e,xPadding:H,yPadding:$,layout:T}))}),IN=Id("div",Y.forwardRef)`
404
+ position: absolute;
405
+ top: 0;
406
+ left: 0;
407
+ pointer-events: none;
408
+ `,Hx=Id("div",Y.forwardRef)`
409
+ height: 14px;
410
+ position: sticky;
411
+ font-size: 8px;
412
+ line-height: 14px;
413
+ top: 0;
414
+ left: 0;
415
+ color: grey;
416
+ border-bottom: 1px solid grey;
417
+ background-color: #e8e8e8;
418
+ overflow: hidden;
419
+ `,$x=Id("div",Y.forwardRef)`
420
+ left: 0;
421
+ width: 14px;
422
+ position: sticky;
423
+ font-size: 8px;
424
+ line-height: 14px;
425
+ color: grey;
426
+ border-right: 1px solid grey;
427
+ background-color: #e8e8e8;
428
+ overflow: hidden;
429
+ `,qx=Id("div",Y.forwardRef)`
430
+ position: absolute;
431
+ border-left: 1px solid grey;
432
+ padding-left: 2px;
433
+ `,Vx=Id("div",Y.forwardRef)`
434
+ position: absolute;
435
+ left: 14px;
436
+ border-left: 1px solid grey;
437
+ padding-left: 2px;
438
+ transform: rotate(90deg);
439
+ transform-origin: left top;
440
+ overflow: hidden;
441
+ `,RN=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],MN=Sr(({store:t,width:e,height:r,pageSizes:n,layout:i="vertical",renderOnlyActivePage:a})=>{const o=Y.useRef(null);if(!t.activePage)return null;const s=i==="horizontal",u=t.activePage,f=(t.bleedVisible&&u.bleed,u.computedWidth*t.scale),d=u.computedHeight*t.scale,h=(e-f)/2,p=(r-d)/2,y=(v=P=>Rx({unitVal:P,dpi:t.dpi,unit:t.unit})*t.scale,RN.find(P=>v(P)>30)||1e4);var v;const b=Rx({unitVal:y,dpi:t.dpi,unit:t.unit})*t.scale,x=Math.round(f/b)+1,k=Math.round(d/b)+1,S=k0(t.selectedShapes);return Y.createElement(IN,{ref:o,className:"polotno-rulers",style:{display:"flex",flexDirection:"column"}},s?Y.createElement(Y.Fragment,null,Y.createElement("div",{style:{display:"flex",flexDirection:"row",position:"sticky",top:0,zIndex:1}},Y.createElement("div",{style:{width:"14px",height:"14px",flexShrink:0,backgroundColor:"#e8e8e8",borderRight:"1px solid grey",borderBottom:"1px solid grey",position:"sticky",left:0,zIndex:2}}),(a?[t.activePage]:t.pages).map((P,_)=>{var E;if(!P)return null;const A=n?n[_]:e,T=(A-P.computedWidth*t.scale)/2;return Y.createElement(Hx,{key:P.id,style:{width:A+"px",flexShrink:0,position:"relative"},className:"polotno-x-ruler"},[...Array(x)].map((I,L)=>Y.createElement(qx,{key:L,style:{left:T+L*b+"px",width:b+"px"}},t.unit==="px"||y>=1?Math.round(y*L):(y*L).toFixed(1))),((E=t.selectedShapes[0])===null||E===void 0?void 0:E.page)===P&&Y.createElement("div",{style:{position:"absolute",left:T+S.x*t.scale+"px",height:"14px",width:S.width*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))})),Y.createElement($x,{style:{height:r+"px",position:"sticky",left:0,marginTop:"-14px"},className:"polotno-y-ruler"},[...Array(k)].map((P,_)=>Y.createElement(Vx,{key:_,style:{top:p+_*b+"px",width:b+"px"}},t.unit==="px"||y>=1?Math.round(y*_):(y*_).toFixed(1))),!!t.selectedShapes.length&&Y.createElement("div",{style:{position:"absolute",top:p+S.y*t.scale+"px",width:"14px",height:S.height*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))):Y.createElement(Y.Fragment,null,Y.createElement(Hx,{style:{width:e+"px"},className:"polotno-x-ruler"},[...Array(x)].map((P,_)=>Y.createElement(qx,{key:_,style:{left:h+_*b+"px",width:b+"px"}},t.unit==="px"||y>=1?Math.round(y*_):(y*_).toFixed(1))),!!t.selectedShapes.length&&Y.createElement("div",{style:{position:"absolute",left:h+S.x*t.scale+"px",height:"14px",width:S.width*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}})),(a?[t.activePage]:t.pages).map((P,_)=>{var E;if(!P)return null;const A=n?n[_]:r,T=(A-P.computedHeight*t.scale)/2,I=_===0?14:0;return Y.createElement($x,{key:P.id,style:{height:A-I+"px"},className:"polotno-y-ruler"},[...Array(k)].map((L,R)=>Y.createElement(Vx,{key:R,style:{top:T+R*b-I+"px",width:b+"px"}},t.unit==="px"||y>=1?Math.round(y*R):(y*R).toFixed(1))),((E=t.selectedShapes[0])===null||E===void 0?void 0:E.page)===P&&Y.createElement("div",{style:{position:"absolute",top:T+S.y*t.scale-I+"px",width:"14px",height:S.height*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))})))}),DN=Sr(({audio:t,store:e})=>{const[r]=(function(n){const[i,a]=Y.useState(null),[o,s]=Y.useState("loading");return Y.useEffect(()=>{const u=new Audio(n),f=()=>{s("loaded"),a(u)},d=()=>{s("failed"),a(null)};return u.addEventListener("canplay",f),u.addEventListener("error",d),()=>{u.removeEventListener("canplay",f),u.removeEventListener("error",d)}},[n]),[i,o]})(t.src);return Y.useEffect(()=>{r&&e.history.ignore(()=>{t.set({duration:1e3*r.duration})})},[r,t,e.history]),Y.useEffect(()=>{if(!r)return;const n=()=>{r.currentTime=t.startTime*t.duration/1e3},i=()=>{const o=t.endTime*t.duration/1e3;r.currentTime>=o&&(r.pause(),r.currentTime=t.startTime*t.duration/1e3)};r.addEventListener("ended",n),r.addEventListener("timeupdate",i);const a=io(()=>{const o=e.animatedElementsIds;if(o.length&&!o.includes(t.id))return;const s=e.currentTime-t.delay,u=t.duration*(t.endTime-t.startTime),f=s>=0&&s<u;if(!e.isPlaying||e.animatedElementsIds.length!==0||!f)return void r.pause();r.volume=t.volume,r.paused&&r.play();const d=s%u/1e3+t.startTime*t.duration/1e3,h=r.currentTime;Math.abs(h-d)>.5&&d!==h&&(r.currentTime=d)});return()=>{r.pause(),r.removeEventListener("ended",n),r.removeEventListener("timeupdate",i),a()}},[e.isPlaying,t.startTime,t.endTime,t.volume,r]),null});let d6={data:[],pageId:""};const t0="polotno_clipboard",cb=(t,e)=>{d6={data:JSON.parse(JSON.stringify(t)),pageId:e||""};try{localStorage.setItem(t0,JSON.stringify(t)),localStorage.setItem(t0+"_page",e||"")}catch{}},NN=()=>{try{const t=localStorage.getItem(t0),e=localStorage.getItem(t0+"_page");if(t)return{data:JSON.parse(t),pageId:e}}catch{}return d6},LN=t=>{var e;t.selectedElements.length!==0&&cb(t.selectedElements.map(r=>r.toJSON()),(e=t.activePage)===null||e===void 0?void 0:e.id)},FN=t=>{var e;cb(t.selectedElements.map(n=>n.toJSON()),(e=t.activePage)===null||e===void 0?void 0:e.id);let r=t.selectedElements.filter(n=>n.removable).map(n=>n.id);t.deleteElements(r)},BN=t=>{t.history.transaction(()=>{var e,r;let n=0,i=0;const{data:a,pageId:o}=NN();if(o===((e=t.activePage)===null||e===void 0?void 0:e.id))n=t.width/20,i=t.height/20;else{const u=[];Mr({children:a},d=>{d.type!=="group"&&u.push(d)});const f=k0(u);f.maxX>t.width&&(n=-f.minX),f.maxY>t.height&&(i=-f.minY)}const s=[];Mr({children:a},u=>{delete u.id,u.type!=="group"&&(u.x+=n,u.y+=i)}),a.forEach(u=>{var f;const d=(f=t.activePage)===null||f===void 0?void 0:f.addElement(u);d&&s.push(d.id)}),cb(a,(r=t.activePage)===null||r===void 0?void 0:r.id),t.selectElements(s)})};function zN(t,e){const r=[];t.forEach(n=>{if(n.removable===!1)return;const i=n.clone();n.type==="group"?i.children.forEach(a=>{a.set({x:a.x+50,y:a.y+50})}):i.set({x:n.x+50,y:n.y+50}),r.push(i.id)}),e.selectElements(r)}const ii=t=>{if(t.type!=="group")return Rd(t);let e=1/0,r=1/0,n=-1/0,i=-1/0;return t.children.forEach(a=>{const o=ii(a);e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x+o.width),i=Math.max(i,o.y+o.height)}),{x:e,y:r,width:n-e,height:i-r}},Lc=(t,e,r)=>{if(t.type!=="group"){const n=Rd(t),i=e-n.x,a=r-n.y;t.set({x:t.x+i,y:t.y+a})}else{const n=e-ii(t).x,i=r-ii(t).y;t.children.forEach(a=>{const o=ii(a);Lc(a,o.x+n,o.y+i)})}};function jN(t){var e;let r=(e=t.activePage)===null||e===void 0?void 0:e.computedWidth;t.selectedElements.forEach(n=>{r=Math.min(r,ii(n).x)}),t.selectedElements.length===1&&(r=0),t.selectedElements.forEach(n=>{const i=ii(n);Lc(n,i.x-i.x+r,i.y)})}function UN(t){var e;let r=0;t.selectedElements.forEach(n=>{const i=ii(n);r=Math.max(r,i.x+i.width)}),t.selectedElements.length===1&&(r=(e=t.activePage)===null||e===void 0?void 0:e.computedWidth),t.selectedElements.forEach(n=>{const i=ii(n);Lc(n,r-i.width,i.y)})}function HN(t){var e;let r=(e=t.activePage)===null||e===void 0?void 0:e.computedHeight;t.selectedElements.forEach(n=>{r=Math.min(r,ii(n).y)}),t.selectedElements.length===1&&(r=0),t.selectedElements.forEach(n=>{const i=ii(n);Lc(n,i.x,i.y-i.y+r)})}function $N(t){var e,r;let n=(e=t.activePage)===null||e===void 0?void 0:e.computedHeight,i=0;t.selectedElements.forEach(o=>{const s=ii(o);n=Math.min(n,s.y),i=Math.max(i,s.y+s.height)});let a=(i+n)/2;t.selectedElements.length===1&&(a=((r=t.activePage)===null||r===void 0?void 0:r.computedHeight)/2),t.selectedElements.forEach(o=>{const s=ii(o);Lc(o,s.x,a-s.height/2)})}function qN(t){var e;let r=0;t.selectedElements.forEach(n=>{const i=ii(n);r=Math.max(r,i.y+i.height)}),t.selectedElements.length===1&&(r=(e=t.activePage)===null||e===void 0?void 0:e.computedHeight),t.selectedElements.forEach(n=>{const i=ii(n);Lc(n,i.x,r-i.height)})}function VN(t){var e,r;let n=(e=t.activePage)===null||e===void 0?void 0:e.computedWidth,i=0;t.selectedElements.forEach(o=>{const s=ii(o);n=Math.min(n,s.x),i=Math.max(i,s.x+s.width)});let a=(i+n)/2;t.selectedElements.length===1&&(a=((r=t.activePage)===null||r===void 0?void 0:r.computedWidth)/2),t.selectedElements.forEach(o=>{const s=ii(o);Lc(o,a-s.width/2,s.y)})}const yv="rgba(191, 191, 191, 100)";function WN(t,e){var r,n,i,a;if(((r=document.activeElement)===null||r===void 0?void 0:r.tagName)==="INPUT"||((n=document.activeElement)===null||n===void 0?void 0:n.tagName)==="TEXTAREA"||((i=document.activeElement)===null||i===void 0?void 0:i.contentEditable)==="true")return;const o=document.querySelector(".polotno-workspace-container");if(document.activeElement!==o&&!o?.contains(document.activeElement)){const h=window.getSelection();if(h&&h.toString().length>0)return}const s=e.selectedElements.filter(h=>h.removable).map(h=>h.id);t.keyCode!==46&&t.keyCode!==8||e.deleteElements(s);const u=t.ctrlKey||t.metaKey,f=t.shiftKey,d=t.altKey;if(t.key==="Escape"&&e.tool==="draw")return t.preventDefault(),void e.setTool("selection");if(!u||f||t.key.toLowerCase()!=="z"&&t.key.toLowerCase()!=="y"||(t.preventDefault(),e.history.undo()),u&&f&&(t.key.toLowerCase()==="z"||t.key.toLowerCase()==="y")&&(t.preventDefault(),e.history.redo()),u&&t.code==="KeyA"){t.preventDefault();const h=(a=e.activePage)===null||a===void 0?void 0:a.children.filter(y=>y.selectable),p=h?.map(y=>y.id)||[];e.selectElements(p)}if(u&&t.code==="KeyC"&&(t.preventDefault(),LN(e)),u&&t.code==="KeyX"&&(t.preventDefault(),FN(e)),u&&t.code==="KeyV"&&(t.preventDefault(),BN(e)),t.code==="ArrowDown"&&(t.preventDefault(),e.selectedShapes.forEach(h=>{h.draggable&&h.set({y:h.y+1})})),t.code==="ArrowUp"&&(t.preventDefault(),e.selectedShapes.forEach(h=>{h.draggable&&h.set({y:h.y-1})})),t.code==="ArrowLeft"&&(t.preventDefault(),e.selectedShapes.forEach(h=>{h.draggable&&h.set({x:h.x-1})})),t.code==="ArrowRight"&&(t.preventDefault(),e.selectedShapes.forEach(h=>{h.draggable&&h.set({x:h.x+1})})),u&&t.code==="KeyG"){t.preventDefault();const h=e.selectedElements[0];if(h&&h.type==="group"){const p=h;e.ungroupElements([p.id])}else e.groupElements(e.selectedElements.map(p=>p.id))}if(u&&t.code==="KeyD"&&(t.preventDefault(),zN(e.selectedElements,e)),t.code==="KeyT"&&!u){t.preventDefault();const h=30,p=e.width/2,y=e.width/2-p/2,v=e.height/2-h/2,b=2160,x=(e.width+e.height)/b;e.activePage.addElement({type:"text",x:y,y:v,width:p,fontSize:h*x,text:"Sample Text",fontFamily:"Roboto"})}if(t.code==="KeyR"&&!u){t.preventDefault();const h={type:"figure",x:e.width/4,y:e.height/4,width:300,height:300,fill:yv,stroke:"#0c0c0c",strokeWidth:0,subType:"rect"};e.activePage.addElement(h)}if(t.code==="KeyL"&&!u){t.preventDefault();const h=e.activePage.computedWidth/3,p={type:"line",x:e.activePage.computedWidth/2-h/2,y:e.activePage.computedHeight/2,width:h,color:yv};e.activePage.addElement(p)}if(t.code==="KeyO"&&!u){t.preventDefault(),t.preventDefault();const h={type:"figure",x:e.width/4,y:e.height/4,width:300,height:300,fill:yv,stroke:"#0c0c0c",strokeWidth:0,subType:"circle"};e.activePage.addElement(h)}u&&t.code==="Equal"&&(t.preventDefault(),e.setScale(e.scale+.1)),u&&t.code==="Minus"&&(t.preventDefault(),e.setScale(e.scale-.1)),d&&(t.code==="KeyA"&&(t.preventDefault(),jN(e)),t.code==="KeyD"&&(t.preventDefault(),UN(e)),t.code==="KeyS"&&(t.preventDefault(),qN(e)),t.code==="KeyW"&&(t.preventDefault(),HN(e)),t.code==="KeyV"&&(t.preventDefault(),$N(e)),t.code==="KeyH"&&(t.preventDefault(),VN(e))),t.code==="BracketRight"&&(t.preventDefault(),u?e.activePage.moveElementsUp(e.selectedElementsIds):e.activePage.moveElementsTop(e.selectedElementsIds)),t.code==="BracketLeft"&&(t.preventDefault(),u?e.activePage.moveElementsDown(e.selectedElementsIds):e.activePage.moveElementsBottom(e.selectedElementsIds))}const c2=Gt({toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",curvedText:"Curved text",curvePower:"Power",temperature:"Temperature",saturation:"Saturation",contrast:"Contrast",shadows:"Shadows",white:"White",black:"Black",vibrance:"Vibrance",textBackground:"Background",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",textStroke:"Text Stroke",shadow:"Shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",uppercase:"Uppercase",position:"Position",layering:"Layering",toForward:"To Front",up:"Forward",down:"Backward",toBottom:"To back",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",strength:"Strength",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",strokeSettings:"Stroke settings",spacing:"Spacing",volume:"Volume",lineStyle:"Line style",lineStartHead:"Line start",lineEndHead:"Line end",textDirection:"Text direction",fontSize:"Font size",fontFamily:"Font family",textAlign:"Text align",verticalAlign:"Vertical align",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",listFormat:"List",colorPicker:{solid:"Solid",linear:"Linear",angle:"Angle"},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",lines:"Lines",draw:"Draw",upload:"Upload",uploadImage:"Add file",uploadTip:"Upload your assets",background:"Background",resize:"Resize",layers:"Layers",animate:"Animate",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",clipImage:"Mask image",width:"Width",height:"Height",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio",duplicateAudio:"Duplicate audio",muteAudio:"Mute",unmuteAudio:"Unmute",volume:"Volume"},contextMenu:{duplicate:"Duplicate",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}}),r0=t=>t&&typeof t=="object";function h6(t,e){Object.keys(e).forEach(r=>{const n=t[r],i=e[r];r0(i)&&r0(n)?h6(n,i):t[r]=i})}function p6(t,e,r=""){Object.keys(e).forEach(n=>{const i=e[n],a=r?`${r}.${n}`:n;r0(i)?r0(t[n])?p6(t[n],i,a):console.warn(`Missing nested translation object at '${a}'`):t[n]===void 0&&console.warn(`Missing translation '${a}'`)})}Ft((t,{validate:e=!1}={})=>{e&&p6(t,c2),h6(c2,t)});const Wx={},Gx=t=>{const e=(function(i,a){var o,s=a.split("."),u=i;for(o=0;o<s.length;++o){if(u[s[o]]==null)return;u=u[s[o]]}return u})(c2,t);if(e!==void 0)return e;Wx[t]||(Wx[t]=!0,console.warn(`Missing translation '${t}'`));const r=t.split("."),n=r[r.length-1]||" ";return n.charAt(0).toUpperCase()+n.slice(1)},Xx=(t,e,r)=>Math.max(e,Math.min(r,t)),Yx=(t,e)=>Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)),GN=({store:t})=>Y.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"}},Y.createElement("p",null,Gx("workspace.noPages")),Y.createElement("button",{onClick:()=>{t.addPage()}},Gx("workspace.addPage"))),XN=({width:t,height:e,xPadding:r,yPadding:n,backgroundColor:i})=>Y.createElement("div",{style:{width:t+"px",height:e+"px",backgroundColor:i,paddingLeft:r+"px",paddingRight:r+"px",paddingTop:n+"px",paddingBottom:n+"px",flexShrink:0}},Y.createElement("div",{style:{width:" 100%",height:"100%",backgroundColor:"white"}})),YN=[4,6],KN=Sr(({store:t,layout:e="vertical",pageControlsEnabled:r,backgroundColor:n,pageBorderColor:i,activePageBorderColor:a,bleedColor:o,snapGuideStroke:s,snapGuideStrokeWidth:u,snapGuideDash:f,selectionRectFill:d,selectionRectStroke:h,selectionRectStrokeWidth:p,transformLabelFill:y,transformLabelTextFill:v,distanceGuideStroke:b,distanceLabelFill:x,distanceLabelTextFill:k,components:S,onKeyDown:P,paddingX:_,paddingY:E,pageGap:A,altCloneEnabled:T=!0,visiblePagesOffset:I,renderOnlyActivePage:L,tooltipSafeArea:R})=>{var N;const F=e==="horizontal",H=_??20,$=E??55,[X,Z]=Y.useState({width:100,height:100}),K=Y.useRef(X),q=Y.useRef(null),J=Y.useRef(null),U=Y.useRef(0),D=t.bleedVisible?Math.max(0,...t.pages.map(le=>le.bleed)):0,W=Math.max(...t.pages.map(le=>le.computedWidth)),V=Math.max(...t.pages.map(le=>le.computedHeight)),ee=((N=t.activePage)===null||N===void 0?void 0:N.computedHeight)||0,te=W+2*D,Q=(L?ee:V)+2*D,ne=async({skipTimeout:le}={skipTimeout:!1})=>{if(le||await new Promise(pt=>setTimeout(pt,50)),q.current===null)return;const Ie=q.current.getBoundingClientRect();Ie.width!==0&&Ie.height!==0||(console.warn(`Polotno warning: <Workspace /> component can not automatically detect its size.
442
+ Width or height of parent elements is equal 0.
443
+ Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
444
+ For simpler debugging here is the log of the parent element:`),console.log(q.current));const Ye=J.current.clientWidth||Ie.width,at={width:Ye,height:Ie.height};(K.current.width!==at.width||K.current.height!==at.height)&&(Z(at),K.current=at);const Ze=(Ye-2*H)/te,ht=t.pages.length>1?3.1:2,ve=(Ie.height-$*ht)/Q,Ce=t.pages.length>1?3.1:2,Pt=(Ye-H*Ce)/te,Ot=(Ie.height-2*$)/Q,Et=t.pages.length?Math.max(Math.min(F?Pt:Ze,F?Ot:ve),.01):1;t.scaleToFit!==Et&&(t.setScale(Et),t._setScaleToFit(Et))};Y.useLayoutEffect(()=>{ne({skipTimeout:!0})},[]),Y.useEffect(()=>{ne()},[te,Q,E,_]),Y.useLayoutEffect(()=>{ne({skipTimeout:!0})},[t.openedSidePanel]),Y.useEffect(()=>{t.__()},[]),Y.useEffect(()=>{const le=q.current;if(window.ResizeObserver){const Ie=new ResizeObserver(()=>{ne({skipTimeout:!0})});return Ie.observe(le),()=>Ie.unobserve(le)}{const Ie=setInterval(()=>{ne({skipTimeout:!0})},100);return()=>clearInterval(Ie)}},[te,Q]);const ue=L?1:t.pages.length;let oe,de;if(F){const le=te*t.scale*ue;oe=Math.max(H,(X.width-le)/ue/2),de=Math.max($,(X.height-Q*t.scale)/2)}else{oe=Math.max(H,(X.width-te*t.scale)/2);const le=Q*t.scale*ue;de=Math.max($,(X.height-le)/ue/2)}Y.useEffect(()=>{const le=Ie=>{(P||WN)(Ie,t)};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[]),Y.useEffect(()=>{const le=Ye=>{if(Ye.ctrlKey||Ye.metaKey){Ye.preventDefault();const at=Math.max(5,t.scaleToFit);let Ze=Math.min(.1,t.scaleToFit);F&&te>0&&Number.isFinite(te)&&(Ze=Math.max(Ze,300/te)),Ze=Math.max(Ze,.01);const ht=.03,ve=Xx(Ye.deltaY<0?t.scale*(1+ht):t.scale/(1+ht),Ze,at);return void t.setScale(ve)}},Ie=J.current;return Ie?.addEventListener("wheel",le),()=>Ie?.removeEventListener("wheel",le)},[F,te,t]),Y.useEffect(()=>{const le=J.current;if(!le)return;const Ie=Ze=>{Ze.touches.length===2&&(U.current=Yx(Ze.touches[0],Ze.touches[1]))},Ye=Ze=>{if(Ze.touches.length===2&&U.current>0){Ze.preventDefault();const ht=Yx(Ze.touches[0],Ze.touches[1]),ve=ht/U.current,Ce=Math.max(5,t.scaleToFit);let Pt=Math.min(.1,t.scaleToFit);F&&te>0&&Number.isFinite(te)&&(Pt=Math.max(Pt,300/te)),Pt=Math.max(Pt,.01);const Ot=t.scale,Et=Xx(Ot*ve,Pt,Ce),pt=Et/Ot,Bt=le.getBoundingClientRect(),Br=(Ze.touches[0].clientX+Ze.touches[1].clientX)/2-Bt.left,Yt=(Ze.touches[0].clientY+Ze.touches[1].clientY)/2-Bt.top,dr=le.scrollLeft+Br,on=le.scrollTop+Yt;Xe.current=!0,t.setScale(Et),le.scrollLeft=dr*pt-Br,le.scrollTop=on*pt-Yt,U.current=ht}},at=()=>{U.current=0};return le.addEventListener("touchstart",Ie,{passive:!0}),le.addEventListener("touchmove",Ye,{passive:!1}),le.addEventListener("touchend",at,{passive:!0}),()=>{le.removeEventListener("touchstart",Ie),le.removeEventListener("touchmove",Ye),le.removeEventListener("touchend",at)}},[F,te,t]);const Ee=A!==void 0,Fe=Y.useMemo(()=>t.pages.map(le=>{if(F){const Ie=(le.computedWidth+2*D)*t.scale;return Ee?Ie+A:Ie+2*oe}{const Ie=(le.computedHeight+2*D)*t.scale;return Ee?Ie+A:Ie+2*de}}),[t.pages,t.scale,D,oe,de,A,F,Ee]),Le=Y.useMemo(()=>{const le=[];let Ie=Ee?F?oe:de:0;for(let Ye=0;Ye<Fe.length;Ye++)le.push(Ie),Ie+=Fe[Ye];return le},[Fe,Ee,F,oe,de]),$e=Y.useMemo(()=>{const le=Fe.reduce((Ie,Ye)=>Ie+Ye,0);return Ee?le+(F?2*oe:2*de):le},[Fe,Ee,F,oe,de]),Xe=Y.useRef(!1),[,dt]=Y.useReducer(le=>le+1,0);((le,Ie,Ye,at,Ze,ht)=>{const ve=Y.useRef(Ie),Ce=Y.useRef(0),Pt=Y.useRef(!1),Ot=Y.useRef(at.pages.length);Pt.current=Ot.current!==at.pages.length,Ot.current=at.pages.length,Y.useEffect(()=>{const Et=le.current,pt=Bt=>{Ce.current=ht?Et.scrollLeft:Et.scrollTop};return Et.addEventListener("scroll",pt),()=>{Et.removeEventListener("scroll",pt)}},[ht]),Y.useLayoutEffect(()=>{if(!le.current||Pt.current)return;const Et=le.current,pt=ht?Et.offsetWidth:Et.offsetHeight,Bt=(Ce.current+pt/2)/ve.current;Ze.current=!0;const Br=Bt*Ie-pt/2;ht?Et.scrollLeft=Br:Et.scrollTop=Br,ve.current=Ie},[Ye,Ie,ht])})(J,$e,t.scale,t,Xe,F);const{handleScroll:ke}=((le,Ie,Ye,at,Ze,ht,ve,Ce,Pt)=>{const Ot=Y.useRef(!1),Et=Y.useRef(null),pt=Y.useRef(!1),Bt=Ce==="horizontal";Y.useEffect(()=>{const Yt=le.current,dr=()=>{ht.current};return Yt.addEventListener("scroll",dr),()=>{Yt.removeEventListener("scroll",dr)}},[]);const Br=at.pages.indexOf(at.activePage);return Y.useLayoutEffect(()=>{if(ve||!at.activePage||!le.current||Ot.current)return;const Yt=le.current,dr=at.pages.indexOf(at.activePage),on=Ie[dr]||0,Vr=Bt?Yt.scrollLeft:Yt.scrollTop,yr=Ye[dr]||Ye[0]||0;let Hi=()=>{};return(Math.abs(on-Vr)>.5*yr||pt.current)&&(pt.current=!0,Hi=(({element:Rn,scrollTop:Da,scrollLeft:ai,duration:ca=300,onFinish:Wn=()=>{}})=>{const oi=Da!==void 0,$i=oi?Rn.scrollTop:Rn.scrollLeft,si=oi?Da:ai,nl=si-$i;let Na=0,Qo=!1;if(ca===0)return oi?Rn.scrollTop=si:Rn.scrollLeft=si,()=>{};const Gn=()=>{if(Qo)return;Na+=20;const li=Zo(Na,$i,nl,ca);oi?Rn.scrollTop=li:Rn.scrollLeft=li,Na<ca?setTimeout(Gn,20):Wn()},Zo=(li,co,_i,La)=>(li/=La/2)<1?_i/2*li*li+co:-_i/2*(--li*(li-2)-1)+co;return Gn(),()=>{Qo=!0}})(Object.assign(Object.assign({element:Yt},Bt?{scrollLeft:on}:{scrollTop:on}),{onFinish:()=>{pt.current=!1,Pt?.()},duration:at.isPlaying?0:300}))),Hi},[at.activePage,Br,at.isPlaying,ve,Ce,Ie,Ye]),{handleScroll:Yt=>{if(ve||pt.current)return;Ot.current=!0,clearTimeout(Et.current),Et.current=setTimeout(()=>{Ot.current=!1},300);const dr=(Bt?Yt.currentTarget.scrollLeft:Yt.currentTarget.scrollTop)+(Bt?Ze.width:Ze.height)/3;let on=0;for(let yr=Ie.length-1;yr>=0;yr--)if(dr>=Ie[yr]){on=yr;break}const Vr=at.pages[on];Vr&&at.activePage!==Vr&&Vr.select()}}})(J,Le,Fe,t,X,Xe,L,e,dt),ge=X.width>=te*t.scale+2*oe,se=X.height>=Q*t.scale+2*de,me=n||"rgba(232, 232, 232, 0.9)",Te=S?.NoPages||GN,ae=F?X.width:X.height,xe=J.current?F?J.current.scrollLeft:J.current.scrollTop:0,Oe=le=>{for(let Ie=Le.length-1;Ie>=0;Ie--)if(le>=Le[Ie])return Ie;return 0},Be=Math.max(0,Oe(xe)),ct=Math.min(t.pages.length-1,Oe(xe+ae)),be=I??1,he=Math.max(0,Be-be),Ve=Math.min(t.pages.length-1,ct+be);return Y.createElement("div",{ref:q,style:{width:"100%",height:"100%",position:"relative",outline:"none",flex:1,backgroundColor:me,overflow:"hidden"},tabIndex:0,className:"polotno-workspace-container"},Y.createElement("div",{ref:J,onScroll:ke,style:Object.assign({position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",flexDirection:F?"row":"column",overflow:"auto",overflowX:F?"auto":ge?"hidden":"auto",overflowY:F&&se?"hidden":"auto"},Ee&&{paddingTop:F?0:de,paddingBottom:F?0:de,paddingLeft:F?oe:0,paddingRight:F?oe:0,boxSizing:"border-box"}),className:"polotno-workspace-inner"},t.pages.map((le,Ie)=>{const Ye=le===t.activePage;if(L&&!Ye&&!le._exportingOrRendering&&!le._forceMount)return null;const at=Ye||Ie>=he&&Ie<=Ve||le._exportingOrRendering||le._forceMount,Ze=F?Fe[Ie]:te*t.scale+2*oe,ht=F?Q*t.scale+2*de:Fe[Ie];if(!at)return Y.createElement("div",{key:le.id,style:{flexShrink:0}},Y.createElement(XN,{width:Ze,height:ht,backgroundColor:me,xPadding:oe,yPadding:de}));const ve=Y.createElement(AN,{key:le.id,page:le,xPadding:oe,yPadding:de,width:Ze,height:ht,store:t,pageControlsEnabled:r,backColor:me,pageBorderColor:i||"lightgrey",activePageBorderColor:a||"rgb(0, 161, 255)",altCloneEnabled:T,bleedColor:o||"rgba(255, 0, 0, 0.1)",selectionRectFill:d,selectionRectStroke:h,selectionRectStrokeWidth:p,snapGuideStroke:s||"rgb(0, 161, 255)",snapGuideStrokeWidth:u||1,snapGuideDash:f||YN,transformLabelFill:y,transformLabelTextFill:v,distanceGuideStroke:b||"rgb(0, 161, 255)",distanceLabelFill:x||"rgb(0, 161, 255)",distanceLabelTextFill:k||"white",components:S,viewportSize:X,layout:e,tooltipSafeArea:R});return(le._exportingOrRendering||le._forceMount)&&!Ye&&L?Y.createElement("div",{style:{display:"none",flexShrink:0},key:le.id},ve):ve}),t.rulesVisible&&Y.createElement(MN,{store:t,xPadding:oe,yPadding:de,width:te*t.scale+2*oe,height:Q*t.scale+2*de,pageSizes:Fe,layout:e,renderOnlyActivePage:L}),t.pages.length===0&&Y.createElement(Te,{store:t}),t.audios.map(le=>Y.createElement(DN,{key:le.id,audio:le,store:t}))))});Je.prototype._requestDraw=()=>{};KT(!1);G5("change-font-size");const QN=new URLSearchParams(location.search).get("key"),m6=rN({key:QN});window.store=m6;let vv=null;window.__polotnoLoadJspdf=async()=>(vv||(vv=Kx(()=>import("./jspdf.es.min-BuG4Ttcb.js").then(t=>t.j),[],import.meta.url)),await vv);let bv=null;window.__polotnoLoadVideoExport=async()=>(bv||(bv=Kx(()=>import("./index-CBBKKHN5.js"),[],import.meta.url)),await bv);window.config={addGlobalFont:nC,setRichTextEnabled:fC,setTextVerticalResizeEnabled:cC,setTextOverflow:G5,onLoadError:rC,setAssetLoadTimeout:ZT,setFontLoadTimeout:JT,unstable_setTextSplitAllowed:hC};const ZN=Zx.createRoot(document.getElementById("root"));ZN.render(Y.createElement(KN,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:m6,components:{PageControls:()=>null,Tooltip:()=>null}}));export{iu as $,Up as A,tR as B,X2 as C,s2 as D,hd as E,Ks as F,Xh as G,Wf as H,SL as I,LL as J,Zv as K,FL as L,K2 as M,WI as N,CL as O,Ys as P,OL as Q,sp as R,kL as S,Y2 as T,Ia as U,xL as V,_L as W,AL as X,EL as Y,nu as Z,Kx as _,pe as a,t8 as a0,xn as a1,a8 as a2,cd as a3,Zk as a4,gL as a5,BL as a6,zL as a7,bL as a8,e8 as a9,wL as aa,dL as ab,jL as ac,GM as ad,HM as ae,qM as af,vx as ag,Tg as ah,Ec as ai,_p as b,mL as c,lu as d,fR as e,ta as f,PL as g,CR as h,hL as i,c8 as j,vL as k,ni as l,h8 as m,NL as n,yL as o,s8 as p,RL as q,Op as r,DL as s,pL as t,kd as u,IL as v,E0 as w,TL as x,ML as y,C0 as z};