polotno-node 2.15.11 → 2.15.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-CwJhoZtW.js +444 -0
- package/dist/assets/{index-9Tuh7mWU.js → index-DVjWS8zZ.js} +1 -1
- package/dist/assets/{index.es-6USixNFT.js → index.es-CK3IAecu.js} +1 -1
- package/dist/assets/{jspdf.es.min-CvVM72Fp.js → jspdf.es.min-kqX7i2XY.js} +24 -24
- package/dist/index.html +1 -1
- package/package.json +7 -7
- package/dist/assets/index-zk6jORf_.js +0 -444
|
@@ -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 U6="modulepreload",H6=function(t,e){return new URL(t,e).href},$b={},Jx=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const o=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),u=s?.nonce||s?.getAttribute("nonce");i=d(r.map(f=>{if(f=H6(f,n),f in $b)return;$b[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(n)for(let v=o.length-1;v>=0;v--){const b=o[v];if(b.href===f&&(!p||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${h}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":U6,p||(y.as="script"),y.crossOrigin="",y.href=f,u&&y.setAttribute("nonce",u),document.head.appendChild(y),p)return new Promise((v,b)=>{y.addEventListener("load",v),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}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 Ig=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function $6(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 m1={exports:{}},Vt={};var qb;function q6(){if(qb)return Vt;qb=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"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.iterator;function h(L){return L===null||typeof L!="object"?null:(L=p&&L[p]||L["@@iterator"],typeof L=="function"?L:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function x(L,W,V){this.props=L,this.context=W,this.refs=b,this.updater=V||y}x.prototype.isReactComponent={},x.prototype.setState=function(L,W){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,W,"setState")},x.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=x.prototype;function S(L,W,V){this.props=L,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(L,W,V){var ee,re={},K=null,ne=null;if(W!=null)for(ee in W.ref!==void 0&&(ne=W.ref),W.key!==void 0&&(K=""+W.key),W)E.call(W,ee)&&!T.hasOwnProperty(ee)&&(re[ee]=W[ee]);var le=arguments.length-2;if(le===1)re.children=V;else if(1<le){for(var ae=Array(le),ue=0;ue<le;ue++)ae[ue]=arguments[ue+2];re.children=ae}if(L&&L.defaultProps)for(ee in le=L.defaultProps,le)re[ee]===void 0&&(re[ee]=le[ee]);return{$$typeof:t,type:L,key:K,ref:ne,props:re,_owner:A.current}}function M(L,W){return{$$typeof:t,type:L.type,key:W,ref:L.ref,props:L.props,_owner:L._owner}}function R(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function N(L){var W={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(V){return W[V]})}var B=/\/+/g;function H(L,W){return typeof L=="object"&&L!==null&&L.key!=null?N(""+L.key):W.toString(36)}function $(L,W,V,ee,re){var K=typeof L;(K==="undefined"||K==="boolean")&&(L=null);var ne=!1;if(L===null)ne=!0;else switch(K){case"string":case"number":ne=!0;break;case"object":switch(L.$$typeof){case t:case e:ne=!0}}if(ne)return ne=L,re=re(ne),L=ee===""?"."+H(ne,0):ee,_(re)?(V="",L!=null&&(V=L.replace(B,"$&/")+"/"),$(re,W,V,"",function(ue){return ue})):re!=null&&(R(re)&&(re=M(re,V+(!re.key||ne&&ne.key===re.key?"":(""+re.key).replace(B,"$&/")+"/")+L)),W.push(re)),1;if(ne=0,ee=ee===""?".":ee+":",_(L))for(var le=0;le<L.length;le++){K=L[le];var ae=ee+H(K,le);ne+=$(K,W,V,ae,re)}else if(ae=h(L),typeof ae=="function")for(L=ae.call(L),le=0;!(K=L.next()).done;)K=K.value,ae=ee+H(K,le++),ne+=$(K,W,V,ae,re);else if(K==="object")throw W=String(L),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.");return ne}function G(L,W,V){if(L==null)return L;var ee=[],re=0;return $(L,ee,"","",function(K){return W.call(V,K,re++)}),ee}function Z(L){if(L._status===-1){var W=L._result;W=W(),W.then(function(V){(L._status===0||L._status===-1)&&(L._status=1,L._result=V)},function(V){(L._status===0||L._status===-1)&&(L._status=2,L._result=V)}),L._status===-1&&(L._status=0,L._result=W)}if(L._status===1)return L._result.default;throw L._result}var J={current:null},q={transition:null},Q={ReactCurrentDispatcher:J,ReactCurrentBatchConfig:q,ReactCurrentOwner:A};function U(){throw Error("act(...) is not supported in production builds of React.")}return Vt.Children={map:G,forEach:function(L,W,V){G(L,function(){W.apply(this,arguments)},V)},count:function(L){var W=0;return G(L,function(){W++}),W},toArray:function(L){return G(L,function(W){return W})||[]},only:function(L){if(!R(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},Vt.Component=x,Vt.Fragment=r,Vt.Profiler=i,Vt.PureComponent=S,Vt.StrictMode=n,Vt.Suspense=u,Vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Vt.act=U,Vt.cloneElement=function(L,W,V){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var ee=v({},L.props),re=L.key,K=L.ref,ne=L._owner;if(W!=null){if(W.ref!==void 0&&(K=W.ref,ne=A.current),W.key!==void 0&&(re=""+W.key),L.type&&L.type.defaultProps)var le=L.type.defaultProps;for(ae in W)E.call(W,ae)&&!T.hasOwnProperty(ae)&&(ee[ae]=W[ae]===void 0&&le!==void 0?le[ae]:W[ae])}var ae=arguments.length-2;if(ae===1)ee.children=V;else if(1<ae){le=Array(ae);for(var ue=0;ue<ae;ue++)le[ue]=arguments[ue+2];ee.children=le}return{$$typeof:t,type:L.type,key:re,ref:K,props:ee,_owner:ne}},Vt.createContext=function(L){return L={$$typeof:o,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:a,_context:L},L.Consumer=L},Vt.createElement=I,Vt.createFactory=function(L){var W=I.bind(null,L);return W.type=L,W},Vt.createRef=function(){return{current:null}},Vt.forwardRef=function(L){return{$$typeof:s,render:L}},Vt.isValidElement=R,Vt.lazy=function(L){return{$$typeof:f,_payload:{_status:-1,_result:L},_init:Z}},Vt.memo=function(L,W){return{$$typeof:d,type:L,compare:W===void 0?null:W}},Vt.startTransition=function(L){var W=q.transition;q.transition={};try{L()}finally{q.transition=W}},Vt.unstable_act=U,Vt.useCallback=function(L,W){return J.current.useCallback(L,W)},Vt.useContext=function(L){return J.current.useContext(L)},Vt.useDebugValue=function(){},Vt.useDeferredValue=function(L){return J.current.useDeferredValue(L)},Vt.useEffect=function(L,W){return J.current.useEffect(L,W)},Vt.useId=function(){return J.current.useId()},Vt.useImperativeHandle=function(L,W,V){return J.current.useImperativeHandle(L,W,V)},Vt.useInsertionEffect=function(L,W){return J.current.useInsertionEffect(L,W)},Vt.useLayoutEffect=function(L,W){return J.current.useLayoutEffect(L,W)},Vt.useMemo=function(L,W){return J.current.useMemo(L,W)},Vt.useReducer=function(L,W,V){return J.current.useReducer(L,W,V)},Vt.useRef=function(L){return J.current.useRef(L)},Vt.useState=function(L){return J.current.useState(L)},Vt.useSyncExternalStore=function(L,W,V){return J.current.useSyncExternalStore(L,W,V)},Vt.useTransition=function(){return J.current.useTransition()},Vt.version="18.3.1",Vt}var Vb;function Mp(){return Vb||(Vb=1,m1.exports=q6()),m1.exports}var Xr=Mp();const X=Oc(Xr);var Km={},g1={exports:{}},Li={},y1={exports:{}},v1={};var Wb;function V6(){return Wb||(Wb=1,(function(t){function e(q,Q){var U=q.length;q.push(Q);e:for(;0<U;){var L=U-1>>>1,W=q[L];if(0<i(W,Q))q[L]=Q,q[U]=W,U=L;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var Q=q[0],U=q.pop();if(U!==Q){q[0]=U;e:for(var L=0,W=q.length,V=W>>>1;L<V;){var ee=2*(L+1)-1,re=q[ee],K=ee+1,ne=q[K];if(0>i(re,U))K<W&&0>i(ne,re)?(q[L]=ne,q[K]=U,L=K):(q[L]=re,q[ee]=U,L=ee);else if(K<W&&0>i(ne,U))q[L]=ne,q[K]=U,L=K;else break e}}return Q}function i(q,Q){var U=q.sortIndex-Q.sortIndex;return U!==0?U:q.id-Q.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=[],d=[],f=1,p=null,h=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 Q=r(d);Q!==null;){if(Q.callback===null)n(d);else if(Q.startTime<=q)n(d),Q.sortIndex=Q.expirationTime,e(u,Q);else break;Q=r(d)}}function _(q){if(b=!1,P(q),!v)if(r(u)!==null)v=!0,Z(E);else{var Q=r(d);Q!==null&&J(_,Q.startTime-q)}}function E(q,Q){v=!1,b&&(b=!1,k(I),I=-1),y=!0;var U=h;try{for(P(Q),p=r(u);p!==null&&(!(p.expirationTime>Q)||q&&!N());){var L=p.callback;if(typeof L=="function"){p.callback=null,h=p.priorityLevel;var W=L(p.expirationTime<=Q);Q=t.unstable_now(),typeof W=="function"?p.callback=W:p===r(u)&&n(u),P(Q)}else n(u);p=r(u)}if(p!==null)var V=!0;else{var ee=r(d);ee!==null&&J(_,ee.startTime-Q),V=!1}return V}finally{p=null,h=U,y=!1}}var A=!1,T=null,I=-1,M=5,R=-1;function N(){return!(t.unstable_now()-R<M)}function B(){if(T!==null){var q=t.unstable_now();R=q;var Q=!0;try{Q=T(!0,q)}finally{Q?H():(A=!1,T=null)}}else A=!1}var H;if(typeof S=="function")H=function(){S(B)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,G=$.port2;$.port1.onmessage=B,H=function(){G.postMessage(null)}}else H=function(){x(B,0)};function Z(q){T=q,A||(A=!0,H())}function J(q,Q){I=x(function(){q(t.unstable_now())},Q)}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"):M=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return r(u)},t.unstable_next=function(q){switch(h){case 1:case 2:case 3:var Q=3;break;default:Q=h}var U=h;h=Q;try{return q()}finally{h=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(q,Q){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var U=h;h=q;try{return Q()}finally{h=U}},t.unstable_scheduleCallback=function(q,Q,U){var L=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?L+U:L):U=L,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:f++,callback:Q,priorityLevel:q,startTime:U,expirationTime:W,sortIndex:-1},U>L?(q.sortIndex=U,e(d,q),r(u)===null&&q===r(d)&&(b?(k(I),I=-1):b=!0,J(_,U-L))):(q.sortIndex=W,e(u,q),v||y||(v=!0,Z(E))),q},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(q){var Q=h;return function(){var U=h;h=Q;try{return q.apply(this,arguments)}finally{h=U}}}})(v1)),v1}var Gb;function p2(){return Gb||(Gb=1,y1.exports=V6()),y1.exports}var Xb;function W6(){if(Xb)return Li;Xb=1;var t=Mp(),e=p2();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,d=/^[: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]*$/,f={},p={};function h(l){return u.call(p,l)?!0:u.call(f,l)?!1:d.test(l)?p[l]=!0:(f[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,F,j,te){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=O,this.attributeNamespace=F,this.mustUseProperty=w,this.propertyName=l,this.type=c,this.sanitizeURL=j,this.removeEmptyString=te}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 F=x.hasOwnProperty(c)?x[c]:null;(F!==null?F.type!==0:O||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(v(c,w,F,O)&&(w=null),O||F===null?h(c)&&(w===null?l.removeAttribute(c):l.setAttribute(c,""+w)):F.mustUseProperty?l[F.propertyName]=w===null?F.type===3?!1:"":w:(c=F.attributeName,O=F.attributeNamespace,w===null?l.removeAttribute(c):(F=F.type,w=F===3||F===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"),M=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),N=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),q=Symbol.iterator;function Q(l){return l===null||typeof l!="object"?null:(l=q&&l[q]||l["@@iterator"],typeof l=="function"?l:null)}var U=Object.assign,L;function W(l){if(L===void 0)try{throw Error()}catch(w){var c=w.stack.trim().match(/\n( *(at )?)/);L=c&&c[1]||""}return`
|
|
2
|
+
`+L+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 F=De.stack.split(`
|
|
3
|
+
`),j=O.stack.split(`
|
|
4
|
+
`),te=F.length-1,ce=j.length-1;1<=te&&0<=ce&&F[te]!==j[ce];)ce--;for(;1<=te&&0<=ce;te--,ce--)if(F[te]!==j[ce]){if(te!==1||ce!==1)do if(te--,ce--,0>ce||F[te]!==j[ce]){var ge=`
|
|
5
|
+
`+F[te].replace(" at new "," at ");return l.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",l.displayName)),ge}while(1<=te&&0<=ce);break}}}finally{V=!1,Error.prepareStackTrace=w}return(l=l?l.displayName||l.name:"")?W(l):""}function re(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 K(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 M: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 B:var c=l.render;return l=l.displayName,l||(l=c.displayName||c.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case G:return c=l.displayName||null,c!==null?c:K(l.type)||"Memo";case Z:c=l._payload,l=l._init;try{return K(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 K(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 le(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ae(l){var c=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function ue(l){var c=ae(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 F=w.get,j=w.set;return Object.defineProperty(l,c,{configurable:!0,get:function(){return F.call(this)},set:function(te){O=""+te,j.call(this,te)}}),Object.defineProperty(l,c,{enumerable:w.enumerable}),{getValue:function(){return O},setValue:function(te){O=""+te},stopTracking:function(){l._valueTracker=null,delete l[c]}}}}function ye(l){l._valueTracker||(l._valueTracker=ue(l))}function Ie(l){if(!l)return!1;var c=l._valueTracker;if(!c)return!0;var w=c.getValue(),O="";return l&&(O=ae(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 Ue(l,c){var w=c.checked;return U({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:w??l._wrapperState.initialChecked})}function $e(l,c){var w=c.defaultValue==null?"":c.defaultValue,O=c.checked!=null?c.checked:c.defaultChecked;w=le(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 rt(l,c){c=c.checked,c!=null&&P(l,"checked",c,!1)}function Se(l,c){rt(l,c);var w=le(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,le(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(l.defaultChecked=!!c.defaultChecked)}function de(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 he=Array.isArray;function Ce(l,c,w,O){if(l=l.options,c){c={};for(var F=0;F<w.length;F++)c["$"+w[F]]=!0;for(w=0;w<l.length;w++)F=c.hasOwnProperty("$"+l[w].value),l[w].selected!==F&&(l[w].selected=F),F&&O&&(l[w].defaultSelected=!0)}else{for(w=""+le(w),c=null,F=0;F<l.length;F++){if(l[F].value===w){l[F].selected=!0,O&&(l[F].defaultSelected=!0);return}c!==null||l[F].disabled||(c=l[F])}c!==null&&(c.selected=!0)}}function oe(l,c){if(c.dangerouslySetInnerHTML!=null)throw Error(r(91));return U({},c,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function ke(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(he(w)){if(1<w.length)throw Error(r(93));w=w[0]}c=w}c==null&&(c=""),w=c}l._wrapperState={initialValue:le(w)}}function Oe(l,c){var w=le(c.value),O=le(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 dt(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 nt(l,c){return l==null||l==="http://www.w3.org/1999/xhtml"?dt(c):l==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var xe,me=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,w,O,F){MSApp.execUnsafeLocalFunction(function(){return l(c,w,O,F)})}:l})(function(l,c){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=c;else{for(xe=xe||document.createElement("div"),xe.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=xe.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;c.firstChild;)l.appendChild(c.firstChild)}});function je(l,c){if(c){var w=l.firstChild;if(w&&w===l.lastChild&&w.nodeType===3){w.nodeValue=c;return}}l.textContent=c}var ve={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},qe=["Webkit","ms","Moz","O"];Object.keys(ve).forEach(function(l){qe.forEach(function(c){c=c+l.charAt(0).toUpperCase()+l.substring(1),ve[c]=ve[l]})});function ht(l,c,w){return c==null||typeof c=="boolean"||c===""?"":w||typeof c!="number"||c===0||ve.hasOwnProperty(l)&&ve[l]?(""+c).trim():c+"px"}function gt(l,c){l=l.style;for(var w in c)if(c.hasOwnProperty(w)){var O=w.indexOf("--")===0,F=ht(w,c[w],O);w==="float"&&(w="cssFloat"),O?l.setProperty(w,F):l[w]=F}}var At=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 be(l,c){if(c){if(At[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 _e(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 ze=null;function Ye(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var xt=null,ot=null,It=null;function Ft(l){if(l=qu(l)){if(typeof xt!="function")throw Error(r(280));var c=l.stateNode;c&&(c=pn(c),xt(l.stateNode,l.type,c))}}function Ht(l){ot?It?It.push(l):It=[l]:ot=l}function wr(){if(ot){var l=ot,c=It;if(It=ot=null,Ft(l),c)for(l=0;l<c.length;l++)Ft(c[l])}}function Tr(l,c){return l(c)}function mr(){}var zt=!1;function Cr(l,c,w){if(zt)return l(c,w);zt=!0;try{return Tr(l,c,w)}finally{zt=!1,(ot!==null||It!==null)&&(mr(),wr())}}function qr(l,c){var w=l.stateNode;if(w===null)return null;var O=pn(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 Zn=!1;if(s)try{var Or={};Object.defineProperty(Or,"passive",{get:function(){Zn=!0}}),window.addEventListener("test",Or,Or),window.removeEventListener("test",Or,Or)}catch{Zn=!1}function Tn(l,c,w,O,F,j,te,ce,ge){var De=Array.prototype.slice.call(arguments,3);try{c.apply(w,De)}catch(We){this.onError(We)}}var Vr=!1,Jn=null,Fn=!1,Ti=null,Vi={onError:function(l){Vr=!0,Jn=l}};function po(l,c,w,O,F,j,te,ce,ge){Vr=!1,Jn=null,Tn.apply(Vi,arguments)}function al(l,c,w,O,F,j,te,ce,ge){if(po.apply(this,arguments),Vr){if(Vr){var De=Jn;Vr=!1,Jn=null}else throw Error(r(198));Fn||(Fn=!0,Ti=De)}}function Bn(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 ns(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 Ba(l){if(Bn(l)!==l)throw Error(r(188))}function mo(l){var c=l.alternate;if(!c){if(c=Bn(l),c===null)throw Error(r(188));return c!==l?null:l}for(var w=l,O=c;;){var F=w.return;if(F===null)break;var j=F.alternate;if(j===null){if(O=F.return,O!==null){w=O;continue}break}if(F.child===j.child){for(j=F.child;j;){if(j===w)return Ba(F),l;if(j===O)return Ba(F),c;j=j.sibling}throw Error(r(188))}if(w.return!==O.return)w=F,O=j;else{for(var te=!1,ce=F.child;ce;){if(ce===w){te=!0,w=F,O=j;break}if(ce===O){te=!0,O=F,w=j;break}ce=ce.sibling}if(!te){for(ce=j.child;ce;){if(ce===w){te=!0,w=j,O=F;break}if(ce===O){te=!0,O=j,w=F;break}ce=ce.sibling}if(!te)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 fi(l){return l=mo(l),l!==null?za(l):null}function za(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var c=za(l);if(c!==null)return c;l=l.sibling}return null}var go=e.unstable_scheduleCallback,yo=e.unstable_cancelCallback,jc=e.unstable_shouldYield,Fd=e.unstable_requestPaint,rr=e.unstable_now,ol=e.unstable_getCurrentPriorityLevel,da=e.unstable_ImmediatePriority,sl=e.unstable_UserBlockingPriority,ll=e.unstable_NormalPriority,F0=e.unstable_LowPriority,Uc=e.unstable_IdlePriority,ja=null,yn=null;function xr(l){if(yn&&typeof yn.onCommitFiberRoot=="function")try{yn.onCommitFiberRoot(ja,l,void 0,(l.current.flags&128)===128)}catch{}}var $t=Math.clz32?Math.clz32:ei,vo=Math.log,Cn=Math.LN2;function ei(l){return l>>>=0,l===0?32:31-(vo(l)/Cn|0)|0}var ha=64,Ua=4194304;function fn(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 is(l,c){var w=l.pendingLanes;if(w===0)return 0;var O=0,F=l.suspendedLanes,j=l.pingedLanes,te=w&268435455;if(te!==0){var ce=te&~F;ce!==0?O=fn(ce):(j&=te,j!==0&&(O=fn(j)))}else te=w&~F,te!==0?O=fn(te):j!==0&&(O=fn(j));if(O===0)return 0;if(c!==0&&c!==O&&(c&F)===0&&(F=O&-O,j=c&-c,F>=j||F===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-$t(c),F=1<<w,O|=l[w],c&=~F;return O}function Xp(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 Yp(l,c){for(var w=l.suspendedLanes,O=l.pingedLanes,F=l.expirationTimes,j=l.pendingLanes;0<j;){var te=31-$t(j),ce=1<<te,ge=F[te];ge===-1?((ce&w)===0||(ce&O)!==0)&&(F[te]=Xp(ce,c)):ge<=c&&(l.expiredLanes|=ce),j&=~ce}}function ul(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Bd(){var l=ha;return ha<<=1,(ha&4194240)===0&&(ha=64),l}function di(l){for(var c=[],w=0;31>w;w++)c.push(l);return c}function Cu(l,c,w){l.pendingLanes|=c,c!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,c=31-$t(c),l[c]=w}function B0(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 F=31-$t(w),j=1<<F;c[F]=0,O[F]=-1,l[F]=-1,w&=~j}}function zd(l,c){var w=l.entangledLanes|=c;for(l=l.entanglements;w;){var O=31-$t(w),F=1<<O;F&c|l[O]&c&&(l[O]|=c),w&=~F}}var Jt=0;function Ou(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var cl,fl,Kp,Qp,Hc,$c=!1,dl=[],Ci=null,bo=null,pa=null,qt=new Map,hl=new Map,ma=[],Zp="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 Jp(l,c){switch(l){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":bo=null;break;case"mouseover":case"mouseout":pa=null;break;case"pointerover":case"pointerout":qt.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":hl.delete(c.pointerId)}}function Au(l,c,w,O,F,j){return l===null||l.nativeEvent!==j?(l={blockedOn:c,domEventName:w,eventSystemFlags:O,nativeEvent:j,targetContainers:[F]},c!==null&&(c=qu(c),c!==null&&fl(c)),l):(l.eventSystemFlags|=O,c=l.targetContainers,F!==null&&c.indexOf(F)===-1&&c.push(F),l)}function dn(l,c,w,O,F){switch(c){case"focusin":return Ci=Au(Ci,l,c,w,O,F),!0;case"dragenter":return bo=Au(bo,l,c,w,O,F),!0;case"mouseover":return pa=Au(pa,l,c,w,O,F),!0;case"pointerover":var j=F.pointerId;return qt.set(j,Au(qt.get(j)||null,l,c,w,O,F)),!0;case"gotpointercapture":return j=F.pointerId,hl.set(j,Au(hl.get(j)||null,l,c,w,O,F)),!0}return!1}function qc(l){var c=Oo(l.target);if(c!==null){var w=Bn(c);if(w!==null){if(c=w.tag,c===13){if(c=ns(w),c!==null){l.blockedOn=c,Hc(l.priority,function(){Kp(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 Vc(l){if(l.blockedOn!==null)return!1;for(var c=l.targetContainers;0<c.length;){var w=Xc(l.domEventName,l.eventSystemFlags,c[0],l.nativeEvent);if(w===null){w=l.nativeEvent;var O=new w.constructor(w.type,w);ze=O,w.target.dispatchEvent(O),ze=null}else return c=qu(w),c!==null&&fl(c),l.blockedOn=w,!1;c.shift()}return!0}function Wc(l,c,w){Vc(l)&&w.delete(c)}function z0(){$c=!1,Ci!==null&&Vc(Ci)&&(Ci=null),bo!==null&&Vc(bo)&&(bo=null),pa!==null&&Vc(pa)&&(pa=null),qt.forEach(Wc),hl.forEach(Wc)}function wo(l,c){l.blockedOn===c&&(l.blockedOn=null,$c||($c=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,z0)))}function ti(l){function c(F){return wo(F,l)}if(0<dl.length){wo(dl[0],l);for(var w=1;w<dl.length;w++){var O=dl[w];O.blockedOn===l&&(O.blockedOn=null)}}for(Ci!==null&&wo(Ci,l),bo!==null&&wo(bo,l),pa!==null&&wo(pa,l),qt.forEach(c),hl.forEach(c),w=0;w<ma.length;w++)O=ma[w],O.blockedOn===l&&(O.blockedOn=null);for(;0<ma.length&&(w=ma[0],w.blockedOn===null);)qc(w),w.blockedOn===null&&ma.shift()}var pl=_.ReactCurrentBatchConfig,Gc=!0;function Wi(l,c,w,O){var F=Jt,j=pl.transition;pl.transition=null;try{Jt=1,ml(l,c,w,O)}finally{Jt=F,pl.transition=j}}function Ha(l,c,w,O){var F=Jt,j=pl.transition;pl.transition=null;try{Jt=4,ml(l,c,w,O)}finally{Jt=F,pl.transition=j}}function ml(l,c,w,O){if(Gc){var F=Xc(l,c,w,O);if(F===null)ff(l,c,O,gl,w),Jp(l,O);else if(dn(F,l,c,w,O))O.stopPropagation();else if(Jp(l,O),c&4&&-1<Zp.indexOf(l)){for(;F!==null;){var j=qu(F);if(j!==null&&cl(j),j=Xc(l,c,w,O),j===null&&ff(l,c,O,gl,w),j===F)break;F=j}F!==null&&O.stopPropagation()}else ff(l,c,O,null,w)}}var gl=null;function Xc(l,c,w,O){if(gl=null,l=Ye(O),l=Oo(l),l!==null)if(c=Bn(l),c===null)l=null;else if(w=c.tag,w===13){if(l=ns(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 gl=l,null}function em(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(ol()){case da:return 1;case sl:return 4;case ll:case F0:return 16;case Uc:return 536870912;default:return 16}default:return 16}}var vn=null,xo=null,$a=null;function Iu(){if($a)return $a;var l,c=xo,w=c.length,O,F="value"in vn?vn.value:vn.textContent,j=F.length;for(l=0;l<w&&c[l]===F[l];l++);var te=w-l;for(O=1;O<=te&&c[w-O]===F[j-O];O++);return $a=F.slice(l,1<O?1-O:void 0)}function as(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 zn(){return!0}function hi(){return!1}function tn(l){function c(w,O,F,j,te){this._reactName=w,this._targetInst=F,this.type=O,this.nativeEvent=j,this.target=te,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)?zn:hi,this.isPropagationStopped=hi,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=zn)},stopPropagation:function(){var w=this.nativeEvent;w&&(w.stopPropagation?w.stopPropagation():typeof w.cancelBubble!="unknown"&&(w.cancelBubble=!0),this.isPropagationStopped=zn)},persist:function(){},isPersistent:zn}),c}var ri={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gi=tn(ri),Xi=U({},ri,{view:0,detail:0}),tm=tn(Xi),Ru,Mu,bn,jn=U({},Xi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ss,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!==bn&&(bn&&l.type==="mousemove"?(Ru=l.screenX-bn.screenX,Mu=l.screenY-bn.screenY):Mu=Ru=0,bn=l),Ru)},movementY:function(l){return"movementY"in l?l.movementY:Mu}}),Sr=tn(jn),Du=U({},jn,{dataTransfer:0}),Yi=tn(Du),rm=U({},Xi,{relatedTarget:0}),Yc=tn(rm),jd=U({},ri,{animationName:0,elapsedTime:0,pseudoElement:0}),Ud=tn(jd),nm=U({},ri,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),Kc=tn(nm),im=U({},ri,{data:0}),os=tn(im),Hd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},j0={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"},Qc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function U0(l){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(l):(l=Qc[l])?!!c[l]:!1}function ss(){return U0}var Zc=U({},Xi,{key:function(l){if(l.key){var c=Hd[l.key]||l.key;if(c!=="Unidentified")return c}return l.type==="keypress"?(l=as(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?j0[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ss,charCode:function(l){return l.type==="keypress"?as(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?as(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),am=tn(Zc),om=U({},jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ls=tn(om),sm=U({},Xi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ss}),Jc=tn(sm),ef=U({},ri,{propertyName:0,elapsedTime:0,pseudoElement:0}),yl=tn(ef),$d=U({},jn,{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}),qd=tn($d),lm=[9,13,27,32],Nu=s&&"CompositionEvent"in window,us=null;s&&"documentMode"in document&&(us=document.documentMode);var vl=s&&"TextEvent"in window&&!us,pi=s&&(!Nu||us&&8<us&&11>=us),So=" ",tf=!1;function Vd(l,c){switch(l){case"keyup":return lm.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ki(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var mi=!1;function Wd(l,c){switch(l){case"compositionend":return Ki(c);case"keypress":return c.which!==32?null:(tf=!0,So);case"textInput":return l=c.data,l===So&&tf?null:l;default:return null}}function um(l,c){if(mi)return l==="compositionend"||!Nu&&Vd(l,c)?(l=Iu(),$a=xo=vn=null,mi=!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 pi&&c.locale!=="ko"?null:c.data;default:return null}}var qa={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 Va(l){var c=l&&l.nodeName&&l.nodeName.toLowerCase();return c==="input"?!!qa[l.type]:c==="textarea"}function Lu(l,c,w,O){Ht(O),c=df(c,"onChange"),0<c.length&&(w=new Gi("onChange","change",null,w,O),l.push({event:w,listeners:c}))}var bl=null,ko=null;function cm(l){nh(l,0)}function _o(l){var c=nn(l);if(Ie(c))return l}function Oi(l,c){if(l==="change")return c}var wl=!1;if(s){var Po;if(s){var Ai="oninput"in document;if(!Ai){var rf=document.createElement("div");rf.setAttribute("oninput","return;"),Ai=typeof rf.oninput=="function"}Po=Ai}else Po=!1;wl=Po&&(!document.documentMode||9<document.documentMode)}function cs(){bl&&(bl.detachEvent("onpropertychange",Gd),ko=bl=null)}function Gd(l){if(l.propertyName==="value"&&_o(ko)){var c=[];Lu(c,ko,l,Ye(l)),Cr(cm,c)}}function Xd(l,c,w){l==="focusin"?(cs(),bl=c,ko=w,bl.attachEvent("onpropertychange",Gd)):l==="focusout"&&cs()}function Br(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return _o(ko)}function nf(l,c){if(l==="click")return _o(c)}function Yd(l,c){if(l==="input"||l==="change")return _o(c)}function Kd(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var ni=typeof Object.is=="function"?Object.is:Kd;function fs(l,c){if(ni(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 F=w[O];if(!u.call(c,F)||!ni(l[F],c[F]))return!1}return!0}function Eo(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Ar(l,c){var w=Eo(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=Eo(w)}}function Qr(l,c){return l&&c?l===c?!0:l&&l.nodeType===3?!1:c&&c.nodeType===3?Qr(l,c.parentNode):"contains"in l?l.contains(c):l.compareDocumentPosition?!!(l.compareDocumentPosition(c)&16):!1:!1}function rn(){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 xl(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 Fu(l){var c=rn(),w=l.focusedElem,O=l.selectionRange;if(c!==w&&w&&w.ownerDocument&&Qr(w.ownerDocument.documentElement,w)){if(O!==null&&xl(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 F=w.textContent.length,j=Math.min(O.start,F);O=O.end===void 0?j:Math.min(O.end,F),!l.extend&&j>O&&(F=O,O=j,j=F),F=Ar(w,j);var te=Ar(w,O);F&&te&&(l.rangeCount!==1||l.anchorNode!==F.node||l.anchorOffset!==F.offset||l.focusNode!==te.node||l.focusOffset!==te.offset)&&(c=c.createRange(),c.setStart(F.node,F.offset),l.removeAllRanges(),j>O?(l.addRange(c),l.extend(te.node,te.offset)):(c.setEnd(te.node,te.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 Bu=s&&"documentMode"in document&&11>=document.documentMode,Sl=null,hn=null,ds=null,zu=!1;function af(l,c,w){var O=w.window===w?w.document:w.nodeType===9?w:w.ownerDocument;zu||Sl==null||Sl!==Le(O)||(O=Sl,"selectionStart"in O&&xl(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}),ds&&fs(ds,O)||(ds=O,O=df(hn,"onSelect"),0<O.length&&(c=new Gi("onSelect","select",null,c,w),l.push({event:c,listeners:O}),c.target=Sl)))}function gi(l,c){var w={};return w[l.toLowerCase()]=c.toLowerCase(),w["Webkit"+l]="webkit"+c,w["Moz"+l]="moz"+c,w}var wn={animationend:gi("Animation","AnimationEnd"),animationiteration:gi("Animation","AnimationIteration"),animationstart:gi("Animation","AnimationStart"),transitionend:gi("Transition","TransitionEnd")},hs={},of={};s&&(of=document.createElement("div").style,"AnimationEvent"in window||(delete wn.animationend.animation,delete wn.animationiteration.animation,delete wn.animationstart.animation),"TransitionEvent"in window||delete wn.transitionend.transition);function kl(l){if(hs[l])return hs[l];if(!wn[l])return l;var c=wn[l],w;for(w in c)if(c.hasOwnProperty(w)&&w in of)return hs[l]=c[w];return l}var Qd=kl("animationend"),Zd=kl("animationiteration"),Jd=kl("animationstart"),eh=kl("transitionend"),th=new Map,rh="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 Wa(l,c){th.set(l,c),a(c,[l])}for(var sf=0;sf<rh.length;sf++){var ps=rh[sf],fm=ps.toLowerCase(),lf=ps[0].toUpperCase()+ps.slice(1);Wa(fm,"on"+lf)}Wa(Qd,"onAnimationEnd"),Wa(Zd,"onAnimationIteration"),Wa(Jd,"onAnimationStart"),Wa("dblclick","onDoubleClick"),Wa("focusin","onFocus"),Wa("focusout","onBlur"),Wa(eh,"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 To="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(" "),dm=new Set("cancel close invalid load scroll toggle".split(" ").concat(To));function uf(l,c,w){var O=l.type||"unknown-event";l.currentTarget=w,al(O,c,void 0,l),l.currentTarget=null}function nh(l,c){c=(c&4)!==0;for(var w=0;w<l.length;w++){var O=l[w],F=O.event;O=O.listeners;e:{var j=void 0;if(c)for(var te=O.length-1;0<=te;te--){var ce=O[te],ge=ce.instance,De=ce.currentTarget;if(ce=ce.listener,ge!==j&&F.isPropagationStopped())break e;uf(F,ce,De),j=ge}else for(te=0;te<O.length;te++){if(ce=O[te],ge=ce.instance,De=ce.currentTarget,ce=ce.listener,ge!==j&&F.isPropagationStopped())break e;uf(F,ce,De),j=ge}}}if(Fn)throw l=Ti,Fn=!1,Ti=null,l}function gr(l,c){var w=c[pf];w===void 0&&(w=c[pf]=new Set);var O=l+"__bubble";w.has(O)||(ih(c,l,2,!1),w.add(O))}function cf(l,c,w){var O=0;c&&(O|=4),ih(w,l,O,c)}var ju="_reactListening"+Math.random().toString(36).slice(2);function ms(l){if(!l[ju]){l[ju]=!0,n.forEach(function(w){w!=="selectionchange"&&(dm.has(w)||cf(w,!1,l),cf(w,!0,l))});var c=l.nodeType===9?l:l.ownerDocument;c===null||c[ju]||(c[ju]=!0,cf("selectionchange",!1,c))}}function ih(l,c,w,O){switch(em(c)){case 1:var F=Wi;break;case 4:F=Ha;break;default:F=ml}w=F.bind(null,c,w,l),F=void 0,!Zn||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(F=!0),O?F!==void 0?l.addEventListener(c,w,{capture:!0,passive:F}):l.addEventListener(c,w,!0):F!==void 0?l.addEventListener(c,w,{passive:F}):l.addEventListener(c,w,!1)}function ff(l,c,w,O,F){var j=O;if((c&1)===0&&(c&2)===0&&O!==null)e:for(;;){if(O===null)return;var te=O.tag;if(te===3||te===4){var ce=O.stateNode.containerInfo;if(ce===F||ce.nodeType===8&&ce.parentNode===F)break;if(te===4)for(te=O.return;te!==null;){var ge=te.tag;if((ge===3||ge===4)&&(ge=te.stateNode.containerInfo,ge===F||ge.nodeType===8&&ge.parentNode===F))return;te=te.return}for(;ce!==null;){if(te=Oo(ce),te===null)return;if(ge=te.tag,ge===5||ge===6){O=j=te;continue e}ce=ce.parentNode}}O=O.return}Cr(function(){var De=j,We=Ye(w),Xe=[];e:{var Ve=th.get(l);if(Ve!==void 0){var pt=Gi,vt=l;switch(l){case"keypress":if(as(w)===0)break e;case"keydown":case"keyup":pt=am;break;case"focusin":vt="focus",pt=Yc;break;case"focusout":vt="blur",pt=Yc;break;case"beforeblur":case"afterblur":pt=Yc;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":pt=Sr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pt=Yi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pt=Jc;break;case Qd:case Zd:case Jd:pt=Ud;break;case eh:pt=yl;break;case"scroll":pt=tm;break;case"wheel":pt=qd;break;case"copy":case"cut":case"paste":pt=Kc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pt=ls}var bt=(c&4)!==0,ln=!bt&&l==="scroll",Ae=bt?Ve!==null?Ve+"Capture":null:Ve;bt=[];for(var we=De,Re;we!==null;){Re=we;var Qe=Re.stateNode;if(Re.tag===5&&Qe!==null&&(Re=Qe,Ae!==null&&(Qe=qr(we,Ae),Qe!=null&&bt.push(_l(we,Qe,Re)))),ln)break;we=we.return}0<bt.length&&(Ve=new pt(Ve,vt,null,w,We),Xe.push({event:Ve,listeners:bt}))}}if((c&7)===0){e:{if(Ve=l==="mouseover"||l==="pointerover",pt=l==="mouseout"||l==="pointerout",Ve&&w!==ze&&(vt=w.relatedTarget||w.fromElement)&&(Oo(vt)||vt[ya]))break e;if((pt||Ve)&&(Ve=We.window===We?We:(Ve=We.ownerDocument)?Ve.defaultView||Ve.parentWindow:window,pt?(vt=w.relatedTarget||w.toElement,pt=De,vt=vt?Oo(vt):null,vt!==null&&(ln=Bn(vt),vt!==ln||vt.tag!==5&&vt.tag!==6)&&(vt=null)):(pt=null,vt=De),pt!==vt)){if(bt=Sr,Qe="onMouseLeave",Ae="onMouseEnter",we="mouse",(l==="pointerout"||l==="pointerover")&&(bt=ls,Qe="onPointerLeave",Ae="onPointerEnter",we="pointer"),ln=pt==null?Ve:nn(pt),Re=vt==null?Ve:nn(vt),Ve=new bt(Qe,we+"leave",pt,w,We),Ve.target=ln,Ve.relatedTarget=Re,Qe=null,Oo(We)===De&&(bt=new bt(Ae,we+"enter",vt,w,We),bt.target=Re,bt.relatedTarget=ln,Qe=bt),ln=Qe,pt&&vt)t:{for(bt=pt,Ae=vt,we=0,Re=bt;Re;Re=gs(Re))we++;for(Re=0,Qe=Ae;Qe;Qe=gs(Qe))Re++;for(;0<we-Re;)bt=gs(bt),we--;for(;0<Re-we;)Ae=gs(Ae),Re--;for(;we--;){if(bt===Ae||Ae!==null&&bt===Ae.alternate)break t;bt=gs(bt),Ae=gs(Ae)}bt=null}else bt=null;pt!==null&&hm(Xe,Ve,pt,bt,!1),vt!==null&&ln!==null&&hm(Xe,ln,vt,bt,!0)}}e:{if(Ve=De?nn(De):window,pt=Ve.nodeName&&Ve.nodeName.toLowerCase(),pt==="select"||pt==="input"&&Ve.type==="file")var St=Oi;else if(Va(Ve))if(wl)St=Yd;else{St=Br;var Tt=Xd}else(pt=Ve.nodeName)&&pt.toLowerCase()==="input"&&(Ve.type==="checkbox"||Ve.type==="radio")&&(St=nf);if(St&&(St=St(l,De))){Lu(Xe,St,w,We);break e}Tt&&Tt(l,Ve,De),l==="focusout"&&(Tt=Ve._wrapperState)&&Tt.controlled&&Ve.type==="number"&&se(Ve,"number",Ve.value)}switch(Tt=De?nn(De):window,l){case"focusin":(Va(Tt)||Tt.contentEditable==="true")&&(Sl=Tt,hn=De,ds=null);break;case"focusout":ds=hn=Sl=null;break;case"mousedown":zu=!0;break;case"contextmenu":case"mouseup":case"dragend":zu=!1,af(Xe,w,We);break;case"selectionchange":if(Bu)break;case"keydown":case"keyup":af(Xe,w,We)}var Ct;if(Nu)e:{switch(l){case"compositionstart":var Mt="onCompositionStart";break e;case"compositionend":Mt="onCompositionEnd";break e;case"compositionupdate":Mt="onCompositionUpdate";break e}Mt=void 0}else mi?Vd(l,w)&&(Mt="onCompositionEnd"):l==="keydown"&&w.keyCode===229&&(Mt="onCompositionStart");Mt&&(pi&&w.locale!=="ko"&&(mi||Mt!=="onCompositionStart"?Mt==="onCompositionEnd"&&mi&&(Ct=Iu()):(vn=We,xo="value"in vn?vn.value:vn.textContent,mi=!0)),Tt=df(De,Mt),0<Tt.length&&(Mt=new os(Mt,l,null,w,We),Xe.push({event:Mt,listeners:Tt}),Ct?Mt.data=Ct:(Ct=Ki(w),Ct!==null&&(Mt.data=Ct)))),(Ct=vl?Wd(l,w):um(l,w))&&(De=df(De,"onBeforeInput"),0<De.length&&(We=new os("onBeforeInput","beforeinput",null,w,We),Xe.push({event:We,listeners:De}),We.data=Ct))}nh(Xe,c)})}function _l(l,c,w){return{instance:l,listener:c,currentTarget:w}}function df(l,c){for(var w=c+"Capture",O=[];l!==null;){var F=l,j=F.stateNode;F.tag===5&&j!==null&&(F=j,j=qr(l,w),j!=null&&O.unshift(_l(l,j,F)),j=qr(l,c),j!=null&&O.push(_l(l,j,F))),l=l.return}return O}function gs(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function hm(l,c,w,O,F){for(var j=c._reactName,te=[];w!==null&&w!==O;){var ce=w,ge=ce.alternate,De=ce.stateNode;if(ge!==null&&ge===O)break;ce.tag===5&&De!==null&&(ce=De,F?(ge=qr(w,j),ge!=null&&te.unshift(_l(w,ge,ce))):F||(ge=qr(w,j),ge!=null&&te.push(_l(w,ge,ce)))),w=w.return}te.length!==0&&l.push({event:c,listeners:te})}var H0=/\r\n?/g,pm=/\u0000|\uFFFD/g;function ah(l){return(typeof l=="string"?l:""+l).replace(H0,`
|
|
6
|
+
`).replace(pm,"")}function Uu(l,c,w){if(c=ah(c),ah(l)!==c&&w)throw Error(r(425))}function ys(){}var oh=null,sh=null;function lh(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 yi=typeof setTimeout=="function"?setTimeout:void 0,uh=typeof clearTimeout=="function"?clearTimeout:void 0,Hu=typeof Promise=="function"?Promise:void 0,mm=typeof queueMicrotask=="function"?queueMicrotask:typeof Hu<"u"?function(l){return Hu.resolve(null).then(l).catch(gm)}:yi;function gm(l){setTimeout(function(){throw l})}function hf(l,c){var w=c,O=0;do{var F=w.nextSibling;if(l.removeChild(w),F&&F.nodeType===8)if(w=F.data,w==="/$"){if(O===0){l.removeChild(F),ti(c);return}O--}else w!=="$"&&w!=="$?"&&w!=="$!"||O++;w=F}while(w);ti(c)}function ga(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 vs(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 Co=Math.random().toString(36).slice(2),Ii="__reactFiber$"+Co,$u="__reactProps$"+Co,ya="__reactContainer$"+Co,pf="__reactEvents$"+Co,ym="__reactListeners$"+Co,vm="__reactHandles$"+Co;function Oo(l){var c=l[Ii];if(c)return c;for(var w=l.parentNode;w;){if(c=w[ya]||w[Ii]){if(w=c.alternate,c.child!==null||w!==null&&w.child!==null)for(l=vs(l);l!==null;){if(w=l[Ii])return w;l=vs(l)}return c}l=w,w=l.parentNode}return null}function qu(l){return l=l[Ii]||l[ya],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function nn(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(r(33))}function pn(l){return l[$u]||null}var mf=[],bs=-1;function Ga(l){return{current:l}}function yr(l){0>bs||(l.current=mf[bs],mf[bs]=null,bs--)}function hr(l,c){bs++,mf[bs]=l.current,l.current=c}var va={},xn=Ga(va),On=Ga(!1),Ao=va;function ws(l,c){var w=l.type.contextTypes;if(!w)return va;var O=l.stateNode;if(O&&O.__reactInternalMemoizedUnmaskedChildContext===c)return O.__reactInternalMemoizedMaskedChildContext;var F={},j;for(j in w)F[j]=c[j];return O&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=c,l.__reactInternalMemoizedMaskedChildContext=F),F}function An(l){return l=l.childContextTypes,l!=null}function Pl(){yr(On),yr(xn)}function ch(l,c,w){if(xn.current!==va)throw Error(r(168));hr(xn,c),hr(On,w)}function gf(l,c,w){var O=l.stateNode;if(c=c.childContextTypes,typeof O.getChildContext!="function")return w;O=O.getChildContext();for(var F in O)if(!(F in c))throw Error(r(108,ne(l)||"Unknown",F));return U({},w,O)}function xs(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||va,Ao=xn.current,hr(xn,l),hr(On,On.current),!0}function bm(l,c,w){var O=l.stateNode;if(!O)throw Error(r(169));w?(l=gf(l,c,Ao),O.__reactInternalMemoizedMergedChildContext=l,yr(On),yr(xn),hr(xn,l)):yr(On),hr(On,w)}var ba=null,El=!1,yf=!1;function Vu(l){ba===null?ba=[l]:ba.push(l)}function Xa(l){El=!0,Vu(l)}function Io(){if(!yf&&ba!==null){yf=!0;var l=0,c=Jt;try{var w=ba;for(Jt=1;l<w.length;l++){var O=w[l];do O=O(!0);while(O!==null)}ba=null,El=!1}catch(F){throw ba!==null&&(ba=ba.slice(l+1)),go(da,Io),F}finally{Jt=c,yf=!1}}return null}var Un=[],Ss=0,Ro=null,Mo=0,Hn=[],$n=0,Do=null,vi=1,Ir="";function ks(l,c){Un[Ss++]=Mo,Un[Ss++]=Ro,Ro=l,Mo=c}function wm(l,c,w){Hn[$n++]=vi,Hn[$n++]=Ir,Hn[$n++]=Do,Do=l;var O=vi;l=Ir;var F=32-$t(O)-1;O&=~(1<<F),w+=1;var j=32-$t(c)+F;if(30<j){var te=F-F%5;j=(O&(1<<te)-1).toString(32),O>>=te,F-=te,vi=1<<32-$t(c)+F|w<<F|O,Ir=j+l}else vi=1<<j|w<<F|O,Ir=l}function Tl(l){l.return!==null&&(ks(l,1),wm(l,1,0))}function mn(l){for(;l===Ro;)Ro=Un[--Ss],Un[Ss]=null,Mo=Un[--Ss],Un[Ss]=null;for(;l===Do;)Do=Hn[--$n],Hn[$n]=null,Ir=Hn[--$n],Hn[$n]=null,vi=Hn[--$n],Hn[$n]=null}var bi=null,it=null,or=!1,wi=null;function fh(l,c){var w=Ea(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 xm(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,bi=l,it=ga(c.firstChild),!0):!1;case 6:return c=l.pendingProps===""||c.nodeType!==3?null:c,c!==null?(l.stateNode=c,bi=l,it=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(w=Do!==null?{id:vi,overflow:Ir}:null,l.memoizedState={dehydrated:c,treeContext:w,retryLane:1073741824},w=Ea(18,null,null,0),w.stateNode=c,w.return=l,l.child=w,bi=l,it=null,!0):!1;default:return!1}}function _s(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Cl(l){if(or){var c=it;if(c){var w=c;if(!xm(l,c)){if(_s(l))throw Error(r(418));c=ga(w.nextSibling);var O=bi;c&&xm(l,c)?fh(O,w):(l.flags=l.flags&-4097|2,or=!1,bi=l)}}else{if(_s(l))throw Error(r(418));l.flags=l.flags&-4097|2,or=!1,bi=l}}}function vf(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;bi=l}function Wu(l){if(l!==bi)return!1;if(!or)return vf(l),or=!0,!1;var c;if((c=l.tag!==3)&&!(c=l.tag!==5)&&(c=l.type,c=c!=="head"&&c!=="body"&&!lh(l.type,l.memoizedProps)),c&&(c=it)){if(_s(l))throw dh(),Error(r(418));for(;c;)fh(l,c),c=ga(c.nextSibling)}if(vf(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){it=ga(l.nextSibling);break e}c--}else w!=="$"&&w!=="$!"&&w!=="$?"||c++}l=l.nextSibling}it=null}}else it=bi?ga(l.stateNode.nextSibling):null;return!0}function dh(){for(var l=it;l;)l=ga(l.nextSibling)}function Ps(){it=bi=null,or=!1}function Gu(l){wi===null?wi=[l]:wi.push(l)}var hh=_.ReactCurrentBatchConfig;function Wr(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 F=O,j=""+l;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===j?c.ref:(c=function(te){var ce=F.refs;te===null?delete ce[j]:ce[j]=te},c._stringRef=j,c)}if(typeof l!="string")throw Error(r(284));if(!w._owner)throw Error(r(290,l))}return l}function ii(l,c){throw l=Object.prototype.toString.call(c),Error(r(31,l==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":l))}function Qi(l){var c=l._init;return c(l._payload)}function bf(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 F(Ae,we){return Ae=Xl(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 te(Ae){return l&&Ae.alternate===null&&(Ae.flags|=2),Ae}function ce(Ae,we,Re,Qe){return we===null||we.tag!==6?(we=u1(Re,Ae.mode,Qe),we.return=Ae,we):(we=F(we,Re),we.return=Ae,we)}function ge(Ae,we,Re,Qe){var St=Re.type;return St===T?We(Ae,we,Re.props.children,Qe,Re.key):we!==null&&(we.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===Z&&Qi(St)===we.type)?(Qe=F(we,Re.props),Qe.ref=Wr(Ae,we,Re),Qe.return=Ae,Qe):(Qe=Hm(Re.type,Re.key,Re.props,null,Ae.mode,Qe),Qe.ref=Wr(Ae,we,Re),Qe.return=Ae,Qe)}function De(Ae,we,Re,Qe){return we===null||we.tag!==4||we.stateNode.containerInfo!==Re.containerInfo||we.stateNode.implementation!==Re.implementation?(we=c1(Re,Ae.mode,Qe),we.return=Ae,we):(we=F(we,Re.children||[]),we.return=Ae,we)}function We(Ae,we,Re,Qe,St){return we===null||we.tag!==7?(we=ic(Re,Ae.mode,Qe,St),we.return=Ae,we):(we=F(we,Re),we.return=Ae,we)}function Xe(Ae,we,Re){if(typeof we=="string"&&we!==""||typeof we=="number")return we=u1(""+we,Ae.mode,Re),we.return=Ae,we;if(typeof we=="object"&&we!==null){switch(we.$$typeof){case E:return Re=Hm(we.type,we.key,we.props,null,Ae.mode,Re),Re.ref=Wr(Ae,null,we),Re.return=Ae,Re;case A:return we=c1(we,Ae.mode,Re),we.return=Ae,we;case Z:var Qe=we._init;return Xe(Ae,Qe(we._payload),Re)}if(he(we)||Q(we))return we=ic(we,Ae.mode,Re,null),we.return=Ae,we;ii(Ae,we)}return null}function Ve(Ae,we,Re,Qe){var St=we!==null?we.key:null;if(typeof Re=="string"&&Re!==""||typeof Re=="number")return St!==null?null:ce(Ae,we,""+Re,Qe);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case E:return Re.key===St?ge(Ae,we,Re,Qe):null;case A:return Re.key===St?De(Ae,we,Re,Qe):null;case Z:return St=Re._init,Ve(Ae,we,St(Re._payload),Qe)}if(he(Re)||Q(Re))return St!==null?null:We(Ae,we,Re,Qe,null);ii(Ae,Re)}return null}function pt(Ae,we,Re,Qe,St){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number")return Ae=Ae.get(Re)||null,ce(we,Ae,""+Qe,St);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case E:return Ae=Ae.get(Qe.key===null?Re:Qe.key)||null,ge(we,Ae,Qe,St);case A:return Ae=Ae.get(Qe.key===null?Re:Qe.key)||null,De(we,Ae,Qe,St);case Z:var Tt=Qe._init;return pt(Ae,we,Re,Tt(Qe._payload),St)}if(he(Qe)||Q(Qe))return Ae=Ae.get(Re)||null,We(we,Ae,Qe,St,null);ii(we,Qe)}return null}function vt(Ae,we,Re,Qe){for(var St=null,Tt=null,Ct=we,Mt=we=0,Ln=null;Ct!==null&&Mt<Re.length;Mt++){Ct.index>Mt?(Ln=Ct,Ct=null):Ln=Ct.sibling;var nr=Ve(Ae,Ct,Re[Mt],Qe);if(nr===null){Ct===null&&(Ct=Ln);break}l&&Ct&&nr.alternate===null&&c(Ae,Ct),we=j(nr,we,Mt),Tt===null?St=nr:Tt.sibling=nr,Tt=nr,Ct=Ln}if(Mt===Re.length)return w(Ae,Ct),or&&ks(Ae,Mt),St;if(Ct===null){for(;Mt<Re.length;Mt++)Ct=Xe(Ae,Re[Mt],Qe),Ct!==null&&(we=j(Ct,we,Mt),Tt===null?St=Ct:Tt.sibling=Ct,Tt=Ct);return or&&ks(Ae,Mt),St}for(Ct=O(Ae,Ct);Mt<Re.length;Mt++)Ln=pt(Ct,Ae,Mt,Re[Mt],Qe),Ln!==null&&(l&&Ln.alternate!==null&&Ct.delete(Ln.key===null?Mt:Ln.key),we=j(Ln,we,Mt),Tt===null?St=Ln:Tt.sibling=Ln,Tt=Ln);return l&&Ct.forEach(function(Yl){return c(Ae,Yl)}),or&&ks(Ae,Mt),St}function bt(Ae,we,Re,Qe){var St=Q(Re);if(typeof St!="function")throw Error(r(150));if(Re=St.call(Re),Re==null)throw Error(r(151));for(var Tt=St=null,Ct=we,Mt=we=0,Ln=null,nr=Re.next();Ct!==null&&!nr.done;Mt++,nr=Re.next()){Ct.index>Mt?(Ln=Ct,Ct=null):Ln=Ct.sibling;var Yl=Ve(Ae,Ct,nr.value,Qe);if(Yl===null){Ct===null&&(Ct=Ln);break}l&&Ct&&Yl.alternate===null&&c(Ae,Ct),we=j(Yl,we,Mt),Tt===null?St=Yl:Tt.sibling=Yl,Tt=Yl,Ct=Ln}if(nr.done)return w(Ae,Ct),or&&ks(Ae,Mt),St;if(Ct===null){for(;!nr.done;Mt++,nr=Re.next())nr=Xe(Ae,nr.value,Qe),nr!==null&&(we=j(nr,we,Mt),Tt===null?St=nr:Tt.sibling=nr,Tt=nr);return or&&ks(Ae,Mt),St}for(Ct=O(Ae,Ct);!nr.done;Mt++,nr=Re.next())nr=pt(Ct,Ae,Mt,nr.value,Qe),nr!==null&&(l&&nr.alternate!==null&&Ct.delete(nr.key===null?Mt:nr.key),we=j(nr,we,Mt),Tt===null?St=nr:Tt.sibling=nr,Tt=nr);return l&&Ct.forEach(function(j6){return c(Ae,j6)}),or&&ks(Ae,Mt),St}function ln(Ae,we,Re,Qe){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 St=Re.key,Tt=we;Tt!==null;){if(Tt.key===St){if(St=Re.type,St===T){if(Tt.tag===7){w(Ae,Tt.sibling),we=F(Tt,Re.props.children),we.return=Ae,Ae=we;break e}}else if(Tt.elementType===St||typeof St=="object"&&St!==null&&St.$$typeof===Z&&Qi(St)===Tt.type){w(Ae,Tt.sibling),we=F(Tt,Re.props),we.ref=Wr(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=ic(Re.props.children,Ae.mode,Qe,Re.key),we.return=Ae,Ae=we):(Qe=Hm(Re.type,Re.key,Re.props,null,Ae.mode,Qe),Qe.ref=Wr(Ae,we,Re),Qe.return=Ae,Ae=Qe)}return te(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=F(we,Re.children||[]),we.return=Ae,Ae=we;break e}else{w(Ae,we);break}else c(Ae,we);we=we.sibling}we=c1(Re,Ae.mode,Qe),we.return=Ae,Ae=we}return te(Ae);case Z:return Tt=Re._init,ln(Ae,we,Tt(Re._payload),Qe)}if(he(Re))return vt(Ae,we,Re,Qe);if(Q(Re))return bt(Ae,we,Re,Qe);ii(Ae,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,we!==null&&we.tag===6?(w(Ae,we.sibling),we=F(we,Re),we.return=Ae,Ae=we):(w(Ae,we),we=u1(Re,Ae.mode,Qe),we.return=Ae,Ae=we),te(Ae)):w(Ae,we)}return ln}var Es=bf(!0),Ri=bf(!1),Xu=Ga(null),xi=null,Ol=null,wf=null;function xf(){wf=Ol=xi=null}function Sf(l){var c=Xu.current;yr(Xu),l._currentValue=c}function kf(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 Ya(l,c){xi=l,wf=Ol=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&c)!==0&&(Y=!0),l.firstContext=null)}function qn(l){var c=l._currentValue;if(wf!==l)if(l={context:l,memoizedValue:c,next:null},Ol===null){if(xi===null)throw Error(r(308));Ol=l,xi.dependencies={lanes:0,firstContext:l}}else Ol=Ol.next=l;return c}var wa=null;function Al(l){wa===null?wa=[l]:wa.push(l)}function Yu(l,c,w,O){var F=c.interleaved;return F===null?(w.next=w,Al(c)):(w.next=F.next,F.next=w),c.interleaved=w,Si(l,O)}function Si(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 xa=!1;function Ku(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _f(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 Sa(l,c){return{eventTime:l,lane:c,tag:0,payload:null,callback:null,next:null}}function ka(l,c,w){var O=l.updateQueue;if(O===null)return null;if(O=O.shared,(tr&2)!==0){var F=O.pending;return F===null?c.next=c:(c.next=F.next,F.next=c),O.pending=c,Si(l,w)}return F=O.interleaved,F===null?(c.next=c,Al(O)):(c.next=F.next,F.next=c),O.interleaved=c,Si(l,w)}function Pf(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,zd(l,w)}}function Qu(l,c){var w=l.updateQueue,O=l.alternate;if(O!==null&&(O=O.updateQueue,w===O)){var F=null,j=null;if(w=w.firstBaseUpdate,w!==null){do{var te={eventTime:w.eventTime,lane:w.lane,tag:w.tag,payload:w.payload,callback:w.callback,next:null};j===null?F=j=te:j=j.next=te,w=w.next}while(w!==null);j===null?F=j=c:j=j.next=c}else F=j=c;w={baseState:O.baseState,firstBaseUpdate:F,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 Il(l,c,w,O){var F=l.updateQueue;xa=!1;var j=F.firstBaseUpdate,te=F.lastBaseUpdate,ce=F.shared.pending;if(ce!==null){F.shared.pending=null;var ge=ce,De=ge.next;ge.next=null,te===null?j=De:te.next=De,te=ge;var We=l.alternate;We!==null&&(We=We.updateQueue,ce=We.lastBaseUpdate,ce!==te&&(ce===null?We.firstBaseUpdate=De:ce.next=De,We.lastBaseUpdate=ge))}if(j!==null){var Xe=F.baseState;te=0,We=De=ge=null,ce=j;do{var Ve=ce.lane,pt=ce.eventTime;if((O&Ve)===Ve){We!==null&&(We=We.next={eventTime:pt,lane:0,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null});e:{var vt=l,bt=ce;switch(Ve=c,pt=w,bt.tag){case 1:if(vt=bt.payload,typeof vt=="function"){Xe=vt.call(pt,Xe,Ve);break e}Xe=vt;break e;case 3:vt.flags=vt.flags&-65537|128;case 0:if(vt=bt.payload,Ve=typeof vt=="function"?vt.call(pt,Xe,Ve):vt,Ve==null)break e;Xe=U({},Xe,Ve);break e;case 2:xa=!0}}ce.callback!==null&&ce.lane!==0&&(l.flags|=64,Ve=F.effects,Ve===null?F.effects=[ce]:Ve.push(ce))}else pt={eventTime:pt,lane:Ve,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},We===null?(De=We=pt,ge=Xe):We=We.next=pt,te|=Ve;if(ce=ce.next,ce===null){if(ce=F.shared.pending,ce===null)break;Ve=ce,ce=Ve.next,Ve.next=null,F.lastBaseUpdate=Ve,F.shared.pending=null}}while(!0);if(We===null&&(ge=Xe),F.baseState=ge,F.firstBaseUpdate=De,F.lastBaseUpdate=We,c=F.shared.interleaved,c!==null){F=c;do te|=F.lane,F=F.next;while(F!==c)}else j===null&&(F.shared.lanes=0);ec|=te,l.lanes=te,l.memoizedState=Xe}}function Ur(l,c,w){if(l=c.effects,c.effects=null,l!==null)for(c=0;c<l.length;c++){var O=l[c],F=O.callback;if(F!==null){if(O.callback=null,O=w,typeof F!="function")throw Error(r(191,F));F.call(O)}}}var Lt={},pr=Ga(Lt),Rr=Ga(Lt),Gr=Ga(Lt);function an(l){if(l===Lt)throw Error(r(174));return l}function No(l,c){switch(hr(Gr,c),hr(Rr,l),hr(pr,Lt),l=c.nodeType,l){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:nt(null,"");break;default:l=l===8?c.parentNode:c,c=l.namespaceURI||null,l=l.tagName,c=nt(c,l)}yr(pr),hr(pr,c)}function Mr(){yr(pr),yr(Rr),yr(Gr)}function Rl(l){an(Gr.current);var c=an(pr.current),w=nt(c,l.type);c!==w&&(hr(Rr,l),hr(pr,w))}function Ka(l){Rr.current===l&&(yr(pr),yr(Rr))}var vr=Ga(0);function Ml(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 Ts=[];function In(){for(var l=0;l<Ts.length;l++)Ts[l]._workInProgressVersionPrimary=null;Ts.length=0}var Dl=_.ReactCurrentDispatcher,Zu=_.ReactCurrentBatchConfig,Vn=0,fr=null,Hr=null,Zr=null,Zi=!1,Lo=!1,Mi=0,Ef=0;function Jr(){throw Error(r(321))}function Ju(l,c){if(c===null)return!1;for(var w=0;w<c.length&&w<l.length;w++)if(!ni(l[w],c[w]))return!1;return!0}function Nl(l,c,w,O,F,j){if(Vn=j,fr=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Dl.current=l===null||l.memoizedState===null?q0:zo,l=w(O,F),Lo){j=0;do{if(Lo=!1,Mi=0,25<=j)throw Error(r(301));j+=1,Zr=Hr=null,c.updateQueue=null,Dl.current=If,l=w(O,F)}while(Lo)}if(Dl.current=zl,c=Hr!==null&&Hr.next!==null,Vn=0,Zr=Hr=fr=null,Zi=!1,c)throw Error(r(300));return l}function Ll(){var l=Mi!==0;return Mi=0,l}function kr(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zr===null?fr.memoizedState=Zr=l:Zr=Zr.next=l,Zr}function on(){if(Hr===null){var l=fr.alternate;l=l!==null?l.memoizedState:null}else l=Hr.next;var c=Zr===null?fr.memoizedState:Zr.next;if(c!==null)Zr=c,Hr=l;else{if(l===null)throw Error(r(310));Hr=l,l={memoizedState:Hr.memoizedState,baseState:Hr.baseState,baseQueue:Hr.baseQueue,queue:Hr.queue,next:null},Zr===null?fr.memoizedState=Zr=l:Zr=Zr.next=l}return Zr}function Rn(l,c){return typeof c=="function"?c(l):c}function Mn(l){var c=on(),w=c.queue;if(w===null)throw Error(r(311));w.lastRenderedReducer=l;var O=Hr,F=O.baseQueue,j=w.pending;if(j!==null){if(F!==null){var te=F.next;F.next=j.next,j.next=te}O.baseQueue=F=j,w.pending=null}if(F!==null){j=F.next,O=O.baseState;var ce=te=null,ge=null,De=j;do{var We=De.lane;if((Vn&We)===We)ge!==null&&(ge=ge.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 Xe={lane:We,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null};ge===null?(ce=ge=Xe,te=O):ge=ge.next=Xe,fr.lanes|=We,ec|=We}De=De.next}while(De!==null&&De!==j);ge===null?te=O:ge.next=ce,ni(O,c.memoizedState)||(Y=!0),c.memoizedState=O,c.baseState=te,c.baseQueue=ge,w.lastRenderedState=O}if(l=w.interleaved,l!==null){F=l;do j=F.lane,fr.lanes|=j,ec|=j,F=F.next;while(F!==l)}else F===null&&(w.lanes=0);return[c.memoizedState,w.dispatch]}function Tf(l){var c=on(),w=c.queue;if(w===null)throw Error(r(311));w.lastRenderedReducer=l;var O=w.dispatch,F=w.pending,j=c.memoizedState;if(F!==null){w.pending=null;var te=F=F.next;do j=l(j,te.action),te=te.next;while(te!==F);ni(j,c.memoizedState)||(Y=!0),c.memoizedState=j,c.baseQueue===null&&(c.baseState=j),w.lastRenderedState=j}return[j,O]}function Cf(){}function Of(l,c){var w=fr,O=on(),F=c(),j=!ni(O.memoizedState,F);if(j&&(O.memoizedState=F,Y=!0),O=O.queue,yh(ph.bind(null,w,O,l),[l]),O.getSnapshot!==c||j||Zr!==null&&Zr.memoizedState.tag&1){if(w.flags|=2048,Fl(9,Qa.bind(null,w,O,F,c),void 0,null),Nn===null)throw Error(r(349));(Vn&30)!==0||Sm(w,c,F)}return F}function Sm(l,c,w){l.flags|=16384,l={getSnapshot:c,value:w},c=fr.updateQueue,c===null?(c={lastEffect:null,stores:null},fr.updateQueue=c,c.stores=[l]):(w=c.stores,w===null?c.stores=[l]:w.push(l))}function Qa(l,c,w,O){c.value=w,c.getSnapshot=O,mh(c)&&Af(l)}function ph(l,c,w){return w(function(){mh(c)&&Af(l)})}function mh(l){var c=l.getSnapshot;l=l.value;try{var w=c();return!ni(l,w)}catch{return!0}}function Af(l){var c=Si(l,1);c!==null&&to(c,l,1,-1)}function Fo(l){var c=kr();return typeof l=="function"&&(l=l()),c.memoizedState=c.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:l},c.queue=l,l=l.dispatch=Cm.bind(null,fr,l),[c.memoizedState,l]}function Fl(l,c,w,O){return l={tag:l,create:c,destroy:w,deps:O,next:null},c=fr.updateQueue,c===null?(c={lastEffect:null,stores:null},fr.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 gh(){return on().memoizedState}function Bl(l,c,w,O){var F=kr();fr.flags|=l,F.memoizedState=Fl(1|c,w,void 0,O===void 0?null:O)}function Cs(l,c,w,O){var F=on();O=O===void 0?null:O;var j=void 0;if(Hr!==null){var te=Hr.memoizedState;if(j=te.destroy,O!==null&&Ju(O,te.deps)){F.memoizedState=Fl(c,w,j,O);return}}fr.flags|=l,F.memoizedState=Fl(1|c,w,j,O)}function km(l,c){return Bl(8390656,8,l,c)}function yh(l,c){return Cs(2048,8,l,c)}function vh(l,c){return Cs(4,2,l,c)}function bh(l,c){return Cs(4,4,l,c)}function Bo(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 _m(l,c,w){return w=w!=null?w.concat([l]):null,Cs(4,4,Bo.bind(null,c,l),w)}function Za(){}function wh(l,c){var w=on();c=c===void 0?null:c;var O=w.memoizedState;return O!==null&&c!==null&&Ju(c,O[1])?O[0]:(w.memoizedState=[l,c],l)}function _r(l,c){var w=on();c=c===void 0?null:c;var O=w.memoizedState;return O!==null&&c!==null&&Ju(c,O[1])?O[0]:(l=l(),w.memoizedState=[l,c],l)}function Pm(l,c,w){return(Vn&21)===0?(l.baseState&&(l.baseState=!1,Y=!0),l.memoizedState=w):(ni(w,c)||(w=Bd(),fr.lanes|=w,ec|=w,l.baseState=!0),c)}function Em(l,c){var w=Jt;Jt=w!==0&&4>w?w:4,l(!0);var O=Zu.transition;Zu.transition={};try{l(!1),c()}finally{Jt=w,Zu.transition=O}}function Tm(){return on().memoizedState}function $0(l,c,w){var O=Wl(l);if(w={lane:O,action:w,hasEagerState:!1,eagerState:null,next:null},xh(l))Om(c,w);else if(w=Yu(l,c,w,O),w!==null){var F=_i();to(w,l,O,F),ki(w,c,O)}}function Cm(l,c,w){var O=Wl(l),F={lane:O,action:w,hasEagerState:!1,eagerState:null,next:null};if(xh(l))Om(c,F);else{var j=l.alternate;if(l.lanes===0&&(j===null||j.lanes===0)&&(j=c.lastRenderedReducer,j!==null))try{var te=c.lastRenderedState,ce=j(te,w);if(F.hasEagerState=!0,F.eagerState=ce,ni(ce,te)){var ge=c.interleaved;ge===null?(F.next=F,Al(c)):(F.next=ge.next,ge.next=F),c.interleaved=F;return}}catch{}w=Yu(l,c,F,O),w!==null&&(F=_i(),to(w,l,O,F),ki(w,c,O))}}function xh(l){var c=l.alternate;return l===fr||c!==null&&c===fr}function Om(l,c){Lo=Zi=!0;var w=l.pending;w===null?c.next=c:(c.next=w.next,w.next=c),l.pending=c}function ki(l,c,w){if((w&4194240)!==0){var O=c.lanes;O&=l.pendingLanes,w|=O,c.lanes=w,zd(l,w)}}var zl={readContext:qn,useCallback:Jr,useContext:Jr,useEffect:Jr,useImperativeHandle:Jr,useInsertionEffect:Jr,useLayoutEffect:Jr,useMemo:Jr,useReducer:Jr,useRef:Jr,useState:Jr,useDebugValue:Jr,useDeferredValue:Jr,useTransition:Jr,useMutableSource:Jr,useSyncExternalStore:Jr,useId:Jr,unstable_isNewReconciler:!1},q0={readContext:qn,useCallback:function(l,c){return kr().memoizedState=[l,c===void 0?null:c],l},useContext:qn,useEffect:km,useImperativeHandle:function(l,c,w){return w=w!=null?w.concat([l]):null,Bl(4194308,4,Bo.bind(null,c,l),w)},useLayoutEffect:function(l,c){return Bl(4194308,4,l,c)},useInsertionEffect:function(l,c){return Bl(4,2,l,c)},useMemo:function(l,c){var w=kr();return c=c===void 0?null:c,l=l(),w.memoizedState=[l,c],l},useReducer:function(l,c,w){var O=kr();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=$0.bind(null,fr,l),[O.memoizedState,l]},useRef:function(l){var c=kr();return l={current:l},c.memoizedState=l},useState:Fo,useDebugValue:Za,useDeferredValue:function(l){return kr().memoizedState=l},useTransition:function(){var l=Fo(!1),c=l[0];return l=Em.bind(null,l[1]),kr().memoizedState=l,[c,l]},useMutableSource:function(){},useSyncExternalStore:function(l,c,w){var O=fr,F=kr();if(or){if(w===void 0)throw Error(r(407));w=w()}else{if(w=c(),Nn===null)throw Error(r(349));(Vn&30)!==0||Sm(O,c,w)}F.memoizedState=w;var j={value:w,getSnapshot:c};return F.queue=j,km(ph.bind(null,O,j,l),[l]),O.flags|=2048,Fl(9,Qa.bind(null,O,j,w,c),void 0,null),w},useId:function(){var l=kr(),c=Nn.identifierPrefix;if(or){var w=Ir,O=vi;w=(O&~(1<<32-$t(O)-1)).toString(32)+w,c=":"+c+"R"+w,w=Mi++,0<w&&(c+="H"+w.toString(32)),c+=":"}else w=Ef++,c=":"+c+"r"+w.toString(32)+":";return l.memoizedState=c},unstable_isNewReconciler:!1},zo={readContext:qn,useCallback:wh,useContext:qn,useEffect:yh,useImperativeHandle:_m,useInsertionEffect:vh,useLayoutEffect:bh,useMemo:_r,useReducer:Mn,useRef:gh,useState:function(){return Mn(Rn)},useDebugValue:Za,useDeferredValue:function(l){var c=on();return Pm(c,Hr.memoizedState,l)},useTransition:function(){var l=Mn(Rn)[0],c=on().memoizedState;return[l,c]},useMutableSource:Cf,useSyncExternalStore:Of,useId:Tm,unstable_isNewReconciler:!1},If={readContext:qn,useCallback:wh,useContext:qn,useEffect:yh,useImperativeHandle:_m,useInsertionEffect:vh,useLayoutEffect:bh,useMemo:_r,useReducer:Tf,useRef:gh,useState:function(){return Tf(Rn)},useDebugValue:Za,useDeferredValue:function(l){var c=on();return Hr===null?c.memoizedState=l:Pm(c,Hr.memoizedState,l)},useTransition:function(){var l=Tf(Rn)[0],c=on().memoizedState;return[l,c]},useMutableSource:Cf,useSyncExternalStore:Of,useId:Tm,unstable_isNewReconciler:!1};function Sn(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 jl(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 Ul={isMounted:function(l){return(l=l._reactInternals)?Bn(l)===l:!1},enqueueSetState:function(l,c,w){l=l._reactInternals;var O=_i(),F=Wl(l),j=Sa(O,F);j.payload=c,w!=null&&(j.callback=w),c=ka(l,j,F),c!==null&&(to(c,l,F,O),Pf(c,l,F))},enqueueReplaceState:function(l,c,w){l=l._reactInternals;var O=_i(),F=Wl(l),j=Sa(O,F);j.tag=1,j.payload=c,w!=null&&(j.callback=w),c=ka(l,j,F),c!==null&&(to(c,l,F,O),Pf(c,l,F))},enqueueForceUpdate:function(l,c){l=l._reactInternals;var w=_i(),O=Wl(l),F=Sa(w,O);F.tag=2,c!=null&&(F.callback=c),c=ka(l,F,O),c!==null&&(to(c,l,O,w),Pf(c,l,O))}};function Rf(l,c,w,O,F,j,te){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(O,j,te):c.prototype&&c.prototype.isPureReactComponent?!fs(w,O)||!fs(F,j):!0}function Am(l,c,w){var O=!1,F=va,j=c.contextType;return typeof j=="object"&&j!==null?j=qn(j):(F=An(c)?Ao:xn.current,O=c.contextTypes,j=(O=O!=null)?ws(l,F):va),c=new c(w,j),l.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Ul,l.stateNode=c,c._reactInternals=l,O&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=F,l.__reactInternalMemoizedMaskedChildContext=j),c}function Sh(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&&Ul.enqueueReplaceState(c,c.state,null)}function Mf(l,c,w,O){var F=l.stateNode;F.props=w,F.state=l.memoizedState,F.refs={},Ku(l);var j=c.contextType;typeof j=="object"&&j!==null?F.context=qn(j):(j=An(c)?Ao:xn.current,F.context=ws(l,j)),F.state=l.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(jl(l,c,j,w),F.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof F.getSnapshotBeforeUpdate=="function"||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(c=F.state,typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount(),c!==F.state&&Ul.enqueueReplaceState(F,F.state,null),Il(l,w,F,O),F.state=l.memoizedState),typeof F.componentDidMount=="function"&&(l.flags|=4194308)}function Os(l,c){try{var w="",O=c;do w+=re(O),O=O.return;while(O);var F=w}catch(j){F=`
|
|
7
|
+
Error generating stack: `+j.message+`
|
|
8
|
+
`+j.stack}return{value:l,source:c,stack:F,digest:null}}function Df(l,c,w){return{value:l,source:null,stack:w??null,digest:c??null}}function Hl(l,c){try{console.error(c.value)}catch(w){setTimeout(function(){throw w})}}var V0=typeof WeakMap=="function"?WeakMap:Map;function Im(l,c,w){w=Sa(-1,w),w.tag=3,w.payload={element:null};var O=c.value;return w.callback=function(){Lm||(Lm=!0,t1=O),Hl(l,c)},w}function m(l,c,w){w=Sa(-1,w),w.tag=3;var O=l.type.getDerivedStateFromError;if(typeof O=="function"){var F=c.value;w.payload=function(){return O(F)},w.callback=function(){Hl(l,c)}}var j=l.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(w.callback=function(){Hl(l,c),typeof O!="function"&&(ql===null?ql=new Set([this]):ql.add(this));var te=c.stack;this.componentDidCatch(c.value,{componentStack:te!==null?te:""})}),w}function g(l,c,w){var O=l.pingCache;if(O===null){O=l.pingCache=new V0;var F=new Set;O.set(c,F)}else F=O.get(c),F===void 0&&(F=new Set,O.set(c,F));F.has(w)||(F.add(w),l=O6.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 D(l,c,w,O,F){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=Sa(-1,1),c.tag=2,ka(w,c,1))),w.lanes|=1),l):(l.flags|=65536,l.lanes=F,l)}var z=_.ReactCurrentOwner,Y=!1;function ie(l,c,w,O){c.child=l===null?Ri(c,null,w,O):Es(c,l.child,w,O)}function Pe(l,c,w,O,F){w=w.render;var j=c.ref;return Ya(c,F),O=Nl(l,c,w,O,j,F),w=Ll(),l!==null&&!Y?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~F,Dn(l,c,F)):(or&&w&&Tl(c),c.flags|=1,ie(l,c,O,F),c.child)}function Ne(l,c,w,O,F){if(l===null){var j=w.type;return typeof j=="function"&&!l1(j)&&j.defaultProps===void 0&&w.compare===null&&w.defaultProps===void 0?(c.tag=15,c.type=j,Ke(l,c,j,O,F)):(l=Hm(w.type,null,O,c,c.mode,F),l.ref=c.ref,l.return=c,c.child=l)}if(j=l.child,(l.lanes&F)===0){var te=j.memoizedProps;if(w=w.compare,w=w!==null?w:fs,w(te,O)&&l.ref===c.ref)return Dn(l,c,F)}return c.flags|=1,l=Xl(j,O),l.ref=c.ref,l.return=c,c.child=l}function Ke(l,c,w,O,F){if(l!==null){var j=l.memoizedProps;if(fs(j,O)&&l.ref===c.ref)if(Y=!1,c.pendingProps=O=j,(l.lanes&F)!==0)(l.flags&131072)!==0&&(Y=!0);else return c.lanes=l.lanes,Dn(l,c,F)}return lt(l,c,w,O,F)}function mt(l,c,w){var O=c.pendingProps,F=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},hr(Lf,Ji),Ji|=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,hr(Lf,Ji),Ji|=l,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},O=j!==null?j.baseLanes:w,hr(Lf,Ji),Ji|=O}else j!==null?(O=j.baseLanes|w,c.memoizedState=null):O=w,hr(Lf,Ji),Ji|=O;return ie(l,c,F,w),c.child}function Dt(l,c){var w=c.ref;(l===null&&w!==null||l!==null&&l.ref!==w)&&(c.flags|=512,c.flags|=2097152)}function lt(l,c,w,O,F){var j=An(w)?Ao:xn.current;return j=ws(c,j),Ya(c,F),w=Nl(l,c,w,O,j,F),O=Ll(),l!==null&&!Y?(c.updateQueue=l.updateQueue,c.flags&=-2053,l.lanes&=~F,Dn(l,c,F)):(or&&O&&Tl(c),c.flags|=1,ie(l,c,w,F),c.child)}function br(l,c,w,O,F){if(An(w)){var j=!0;xs(c)}else j=!1;if(Ya(c,F),c.stateNode===null)Gt(l,c),Am(c,w,O),Mf(c,w,O,F),O=!0;else if(l===null){var te=c.stateNode,ce=c.memoizedProps;te.props=ce;var ge=te.context,De=w.contextType;typeof De=="object"&&De!==null?De=qn(De):(De=An(w)?Ao:xn.current,De=ws(c,De));var We=w.getDerivedStateFromProps,Xe=typeof We=="function"||typeof te.getSnapshotBeforeUpdate=="function";Xe||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(ce!==O||ge!==De)&&Sh(c,te,O,De),xa=!1;var Ve=c.memoizedState;te.state=Ve,Il(c,O,te,F),ge=c.memoizedState,ce!==O||Ve!==ge||On.current||xa?(typeof We=="function"&&(jl(c,w,We,O),ge=c.memoizedState),(ce=xa||Rf(c,w,ce,O,Ve,ge,De))?(Xe||typeof te.UNSAFE_componentWillMount!="function"&&typeof te.componentWillMount!="function"||(typeof te.componentWillMount=="function"&&te.componentWillMount(),typeof te.UNSAFE_componentWillMount=="function"&&te.UNSAFE_componentWillMount()),typeof te.componentDidMount=="function"&&(c.flags|=4194308)):(typeof te.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=O,c.memoizedState=ge),te.props=O,te.state=ge,te.context=De,O=ce):(typeof te.componentDidMount=="function"&&(c.flags|=4194308),O=!1)}else{te=c.stateNode,_f(l,c),ce=c.memoizedProps,De=c.type===c.elementType?ce:Sn(c.type,ce),te.props=De,Xe=c.pendingProps,Ve=te.context,ge=w.contextType,typeof ge=="object"&&ge!==null?ge=qn(ge):(ge=An(w)?Ao:xn.current,ge=ws(c,ge));var pt=w.getDerivedStateFromProps;(We=typeof pt=="function"||typeof te.getSnapshotBeforeUpdate=="function")||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(ce!==Xe||Ve!==ge)&&Sh(c,te,O,ge),xa=!1,Ve=c.memoizedState,te.state=Ve,Il(c,O,te,F);var vt=c.memoizedState;ce!==Xe||Ve!==vt||On.current||xa?(typeof pt=="function"&&(jl(c,w,pt,O),vt=c.memoizedState),(De=xa||Rf(c,w,De,O,Ve,vt,ge)||!1)?(We||typeof te.UNSAFE_componentWillUpdate!="function"&&typeof te.componentWillUpdate!="function"||(typeof te.componentWillUpdate=="function"&&te.componentWillUpdate(O,vt,ge),typeof te.UNSAFE_componentWillUpdate=="function"&&te.UNSAFE_componentWillUpdate(O,vt,ge)),typeof te.componentDidUpdate=="function"&&(c.flags|=4),typeof te.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof te.componentDidUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=1024),c.memoizedProps=O,c.memoizedState=vt),te.props=O,te.state=vt,te.context=ge,O=De):(typeof te.componentDidUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||ce===l.memoizedProps&&Ve===l.memoizedState||(c.flags|=1024),O=!1)}return sr(l,c,w,O,j,F)}function sr(l,c,w,O,F,j){Dt(l,c);var te=(c.flags&128)!==0;if(!O&&!te)return F&&bm(c,w,!1),Dn(l,c,j);O=c.stateNode,z.current=c;var ce=te&&typeof w.getDerivedStateFromError!="function"?null:O.render();return c.flags|=1,l!==null&&te?(c.child=Es(c,l.child,null,j),c.child=Es(c,null,ce,j)):ie(l,c,ce,j),c.memoizedState=O.state,F&&bm(c,w,!0),c.child}function Wn(l){var c=l.stateNode;c.pendingContext?ch(l,c.pendingContext,c.pendingContext!==c.context):c.context&&ch(l,c.context,!1),No(l,c.containerInfo)}function _a(l,c,w,O,F){return Ps(),Gu(F),c.flags|=256,ie(l,c,w,O),c.child}var Me={dehydrated:null,treeContext:null,retryLane:0};function Ee(l){return{baseLanes:l,cachePool:null,transitions:null}}function Fe(l,c,w){var O=c.pendingProps,F=vr.current,j=!1,te=(c.flags&128)!==0,ce;if((ce=te)||(ce=l!==null&&l.memoizedState===null?!1:(F&2)!==0),ce?(j=!0,c.flags&=-129):(l===null||l.memoizedState!==null)&&(F|=1),hr(vr,F&1),l===null)return Cl(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):(te=O.children,l=O.fallback,j?(O=c.mode,j=c.child,te={mode:"hidden",children:te},(O&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=te):j=$m(te,O,0,null),l=ic(l,O,w,null),j.return=c,l.return=c,j.sibling=l,c.child=j,c.child.memoizedState=Ee(w),c.memoizedState=Me,l):ut(c,te));if(F=l.memoizedState,F!==null&&(ce=F.dehydrated,ce!==null))return Bt(l,c,te,O,ce,F,w);if(j){j=O.fallback,te=c.mode,F=l.child,ce=F.sibling;var ge={mode:"hidden",children:O.children};return(te&1)===0&&c.child!==F?(O=c.child,O.childLanes=0,O.pendingProps=ge,c.deletions=null):(O=Xl(F,ge),O.subtreeFlags=F.subtreeFlags&14680064),ce!==null?j=Xl(ce,j):(j=ic(j,te,w,null),j.flags|=2),j.return=c,O.return=c,O.sibling=j,c.child=O,O=j,j=c.child,te=l.child.memoizedState,te=te===null?Ee(w):{baseLanes:te.baseLanes|w,cachePool:null,transitions:te.transitions},j.memoizedState=te,j.childLanes=l.childLanes&~w,c.memoizedState=Me,O}return j=l.child,l=j.sibling,O=Xl(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 ut(l,c){return c=$m({mode:"visible",children:c},l.mode,0,null),c.return=l,l.child=c}function _t(l,c,w,O){return O!==null&&Gu(O),Es(c,l.child,null,w),l=ut(c,c.pendingProps.children),l.flags|=2,c.memoizedState=null,l}function Bt(l,c,w,O,F,j,te){if(w)return c.flags&256?(c.flags&=-257,O=Df(Error(r(422))),_t(l,c,te,O)):c.memoizedState!==null?(c.child=l.child,c.flags|=128,null):(j=O.fallback,F=c.mode,O=$m({mode:"visible",children:O.children},F,0,null),j=ic(j,F,te,null),j.flags|=2,O.return=c,j.return=c,O.sibling=j,c.child=O,(c.mode&1)!==0&&Es(c,l.child,null,te),c.child.memoizedState=Ee(te),c.memoizedState=Me,j);if((c.mode&1)===0)return _t(l,c,te,null);if(F.data==="$!"){if(O=F.nextSibling&&F.nextSibling.dataset,O)var ce=O.dgst;return O=ce,j=Error(r(419)),O=Df(j,O,void 0),_t(l,c,te,O)}if(ce=(te&l.childLanes)!==0,Y||ce){if(O=Nn,O!==null){switch(te&-te){case 4:F=2;break;case 16:F=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:F=32;break;case 536870912:F=268435456;break;default:F=0}F=(F&(O.suspendedLanes|te))!==0?0:F,F!==0&&F!==j.retryLane&&(j.retryLane=F,Si(l,F),to(O,l,F,-1))}return s1(),O=Df(Error(r(421))),_t(l,c,te,O)}return F.data==="$?"?(c.flags|=128,c.child=l.child,c=A6.bind(null,l),F._reactRetry=c,null):(l=j.treeContext,it=ga(F.nextSibling),bi=c,or=!0,wi=null,l!==null&&(Hn[$n++]=vi,Hn[$n++]=Ir,Hn[$n++]=Do,vi=l.id,Ir=l.overflow,Do=c),c=ut(c,O.children),c.flags|=4096,c)}function Nt(l,c,w){l.lanes|=c;var O=l.alternate;O!==null&&(O.lanes|=c),kf(l.return,c,w)}function Kt(l,c,w,O,F){var j=l.memoizedState;j===null?l.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:O,tail:w,tailMode:F}:(j.isBackwards=c,j.rendering=null,j.renderingStartTime=0,j.last=O,j.tail=w,j.tailMode=F)}function sn(l,c,w){var O=c.pendingProps,F=O.revealOrder,j=O.tail;if(ie(l,c,O.children,w),O=vr.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&&Nt(l,w,c);else if(l.tag===19)Nt(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(hr(vr,O),(c.mode&1)===0)c.memoizedState=null;else switch(F){case"forwards":for(w=c.child,F=null;w!==null;)l=w.alternate,l!==null&&Ml(l)===null&&(F=w),w=w.sibling;w=F,w===null?(F=c.child,c.child=null):(F=w.sibling,w.sibling=null),Kt(c,!1,F,w,j);break;case"backwards":for(w=null,F=c.child,c.child=null;F!==null;){if(l=F.alternate,l!==null&&Ml(l)===null){c.child=F;break}l=F.sibling,F.sibling=w,w=F,F=l}Kt(c,!0,w,null,j);break;case"together":Kt(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Gt(l,c){(c.mode&1)===0&&l!==null&&(l.alternate=null,c.alternate=null,c.flags|=2)}function Dn(l,c,w){if(l!==null&&(c.dependencies=l.dependencies),ec|=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=Xl(l,l.pendingProps),c.child=w,w.return=c;l.sibling!==null;)l=l.sibling,w=w.sibling=Xl(l,l.pendingProps),w.return=c;w.sibling=null}return c.child}function W0(l,c,w){switch(c.tag){case 3:Wn(c),Ps();break;case 5:Rl(c);break;case 1:An(c.type)&&xs(c);break;case 4:No(c,c.stateNode.containerInfo);break;case 10:var O=c.type._context,F=c.memoizedProps.value;hr(Xu,O._currentValue),O._currentValue=F;break;case 13:if(O=c.memoizedState,O!==null)return O.dehydrated!==null?(hr(vr,vr.current&1),c.flags|=128,null):(w&c.child.childLanes)!==0?Fe(l,c,w):(hr(vr,vr.current&1),l=Dn(l,c,w),l!==null?l.sibling:null);hr(vr,vr.current&1);break;case 19:if(O=(w&c.childLanes)!==0,(l.flags&128)!==0){if(O)return sn(l,c,w);c.flags|=128}if(F=c.memoizedState,F!==null&&(F.rendering=null,F.tail=null,F.lastEffect=null),hr(vr,vr.current),O)break;return null;case 22:case 23:return c.lanes=0,mt(l,c,w)}return Dn(l,c,w)}var pb,G0,mb,gb;pb=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}},G0=function(){},mb=function(l,c,w,O){var F=l.memoizedProps;if(F!==O){l=c.stateNode,an(pr.current);var j=null;switch(w){case"input":F=Ue(l,F),O=Ue(l,O),j=[];break;case"select":F=U({},F,{value:void 0}),O=U({},O,{value:void 0}),j=[];break;case"textarea":F=oe(l,F),O=oe(l,O),j=[];break;default:typeof F.onClick!="function"&&typeof O.onClick=="function"&&(l.onclick=ys)}be(w,O);var te;w=null;for(De in F)if(!O.hasOwnProperty(De)&&F.hasOwnProperty(De)&&F[De]!=null)if(De==="style"){var ce=F[De];for(te in ce)ce.hasOwnProperty(te)&&(w||(w={}),w[te]="")}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 ge=O[De];if(ce=F?.[De],O.hasOwnProperty(De)&&ge!==ce&&(ge!=null||ce!=null))if(De==="style")if(ce){for(te in ce)!ce.hasOwnProperty(te)||ge&&ge.hasOwnProperty(te)||(w||(w={}),w[te]="");for(te in ge)ge.hasOwnProperty(te)&&ce[te]!==ge[te]&&(w||(w={}),w[te]=ge[te])}else w||(j||(j=[]),j.push(De,w)),w=ge;else De==="dangerouslySetInnerHTML"?(ge=ge?ge.__html:void 0,ce=ce?ce.__html:void 0,ge!=null&&ce!==ge&&(j=j||[]).push(De,ge)):De==="children"?typeof ge!="string"&&typeof ge!="number"||(j=j||[]).push(De,""+ge):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(ge!=null&&De==="onScroll"&&gr("scroll",l),j||ce===ge||(j=[])):(j=j||[]).push(De,ge))}w&&(j=j||[]).push("style",w);var De=j;(c.updateQueue=De)&&(c.flags|=4)}},gb=function(l,c,w,O){w!==O&&(c.flags|=4)};function kh(l,c){if(!or)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 ai(l){var c=l.alternate!==null&&l.alternate.child===l.child,w=0,O=0;if(c)for(var F=l.child;F!==null;)w|=F.lanes|F.childLanes,O|=F.subtreeFlags&14680064,O|=F.flags&14680064,F.return=l,F=F.sibling;else for(F=l.child;F!==null;)w|=F.lanes|F.childLanes,O|=F.subtreeFlags,O|=F.flags,F.return=l,F=F.sibling;return l.subtreeFlags|=O,l.childLanes=w,c}function b6(l,c,w){var O=c.pendingProps;switch(mn(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ai(c),null;case 1:return An(c.type)&&Pl(),ai(c),null;case 3:return O=c.stateNode,Mr(),yr(On),yr(xn),In(),O.pendingContext&&(O.context=O.pendingContext,O.pendingContext=null),(l===null||l.child===null)&&(Wu(c)?c.flags|=4:l===null||l.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,wi!==null&&(i1(wi),wi=null))),G0(l,c),ai(c),null;case 5:Ka(c);var F=an(Gr.current);if(w=c.type,l!==null&&c.stateNode!=null)mb(l,c,w,O,F),l.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!O){if(c.stateNode===null)throw Error(r(166));return ai(c),null}if(l=an(pr.current),Wu(c)){O=c.stateNode,w=c.type;var j=c.memoizedProps;switch(O[Ii]=c,O[$u]=j,l=(c.mode&1)!==0,w){case"dialog":gr("cancel",O),gr("close",O);break;case"iframe":case"object":case"embed":gr("load",O);break;case"video":case"audio":for(F=0;F<To.length;F++)gr(To[F],O);break;case"source":gr("error",O);break;case"img":case"image":case"link":gr("error",O),gr("load",O);break;case"details":gr("toggle",O);break;case"input":$e(O,j),gr("invalid",O);break;case"select":O._wrapperState={wasMultiple:!!j.multiple},gr("invalid",O);break;case"textarea":ke(O,j),gr("invalid",O)}be(w,j),F=null;for(var te in j)if(j.hasOwnProperty(te)){var ce=j[te];te==="children"?typeof ce=="string"?O.textContent!==ce&&(j.suppressHydrationWarning!==!0&&Uu(O.textContent,ce,l),F=["children",ce]):typeof ce=="number"&&O.textContent!==""+ce&&(j.suppressHydrationWarning!==!0&&Uu(O.textContent,ce,l),F=["children",""+ce]):i.hasOwnProperty(te)&&ce!=null&&te==="onScroll"&&gr("scroll",O)}switch(w){case"input":ye(O),de(O,j,!0);break;case"textarea":ye(O),Be(O);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(O.onclick=ys)}O=F,c.updateQueue=O,O!==null&&(c.flags|=4)}else{te=F.nodeType===9?F:F.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=dt(w)),l==="http://www.w3.org/1999/xhtml"?w==="script"?(l=te.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof O.is=="string"?l=te.createElement(w,{is:O.is}):(l=te.createElement(w),w==="select"&&(te=l,O.multiple?te.multiple=!0:O.size&&(te.size=O.size))):l=te.createElementNS(l,w),l[Ii]=c,l[$u]=O,pb(l,c,!1,!1),c.stateNode=l;e:{switch(te=_e(w,O),w){case"dialog":gr("cancel",l),gr("close",l),F=O;break;case"iframe":case"object":case"embed":gr("load",l),F=O;break;case"video":case"audio":for(F=0;F<To.length;F++)gr(To[F],l);F=O;break;case"source":gr("error",l),F=O;break;case"img":case"image":case"link":gr("error",l),gr("load",l),F=O;break;case"details":gr("toggle",l),F=O;break;case"input":$e(l,O),F=Ue(l,O),gr("invalid",l);break;case"option":F=O;break;case"select":l._wrapperState={wasMultiple:!!O.multiple},F=U({},O,{value:void 0}),gr("invalid",l);break;case"textarea":ke(l,O),F=oe(l,O),gr("invalid",l);break;default:F=O}be(w,F),ce=F;for(j in ce)if(ce.hasOwnProperty(j)){var ge=ce[j];j==="style"?gt(l,ge):j==="dangerouslySetInnerHTML"?(ge=ge?ge.__html:void 0,ge!=null&&me(l,ge)):j==="children"?typeof ge=="string"?(w!=="textarea"||ge!=="")&&je(l,ge):typeof ge=="number"&&je(l,""+ge):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(i.hasOwnProperty(j)?ge!=null&&j==="onScroll"&&gr("scroll",l):ge!=null&&P(l,j,ge,te))}switch(w){case"input":ye(l),de(l,O,!1);break;case"textarea":ye(l),Be(l);break;case"option":O.value!=null&&l.setAttribute("value",""+le(O.value));break;case"select":l.multiple=!!O.multiple,j=O.value,j!=null?Ce(l,!!O.multiple,j,!1):O.defaultValue!=null&&Ce(l,!!O.multiple,O.defaultValue,!0);break;default:typeof F.onClick=="function"&&(l.onclick=ys)}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 ai(c),null;case 6:if(l&&c.stateNode!=null)gb(l,c,l.memoizedProps,O);else{if(typeof O!="string"&&c.stateNode===null)throw Error(r(166));if(w=an(Gr.current),an(pr.current),Wu(c)){if(O=c.stateNode,w=c.memoizedProps,O[Ii]=c,(j=O.nodeValue!==w)&&(l=bi,l!==null))switch(l.tag){case 3:Uu(O.nodeValue,w,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Uu(O.nodeValue,w,(l.mode&1)!==0)}j&&(c.flags|=4)}else O=(w.nodeType===9?w:w.ownerDocument).createTextNode(O),O[Ii]=c,c.stateNode=O}return ai(c),null;case 13:if(yr(vr),O=c.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(or&&it!==null&&(c.mode&1)!==0&&(c.flags&128)===0)dh(),Ps(),c.flags|=98560,j=!1;else if(j=Wu(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[Ii]=c}else Ps(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;ai(c),j=!1}else wi!==null&&(i1(wi),wi=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||(vr.current&1)!==0?kn===0&&(kn=3):s1())),c.updateQueue!==null&&(c.flags|=4),ai(c),null);case 4:return Mr(),G0(l,c),l===null&&ms(c.stateNode.containerInfo),ai(c),null;case 10:return Sf(c.type._context),ai(c),null;case 17:return An(c.type)&&Pl(),ai(c),null;case 19:if(yr(vr),j=c.memoizedState,j===null)return ai(c),null;if(O=(c.flags&128)!==0,te=j.rendering,te===null)if(O)kh(j,!1);else{if(kn!==0||l!==null&&(l.flags&128)!==0)for(l=c.child;l!==null;){if(te=Ml(l),te!==null){for(c.flags|=128,kh(j,!1),O=te.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,te=j.alternate,te===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=te.childLanes,j.lanes=te.lanes,j.child=te.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=te.memoizedProps,j.memoizedState=te.memoizedState,j.updateQueue=te.updateQueue,j.type=te.type,l=te.dependencies,j.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),w=w.sibling;return hr(vr,vr.current&1|2),c.child}l=l.sibling}j.tail!==null&&rr()>Ff&&(c.flags|=128,O=!0,kh(j,!1),c.lanes=4194304)}else{if(!O)if(l=Ml(te),l!==null){if(c.flags|=128,O=!0,w=l.updateQueue,w!==null&&(c.updateQueue=w,c.flags|=4),kh(j,!0),j.tail===null&&j.tailMode==="hidden"&&!te.alternate&&!or)return ai(c),null}else 2*rr()-j.renderingStartTime>Ff&&w!==1073741824&&(c.flags|=128,O=!0,kh(j,!1),c.lanes=4194304);j.isBackwards?(te.sibling=c.child,c.child=te):(w=j.last,w!==null?w.sibling=te:c.child=te,j.last=te)}return j.tail!==null?(c=j.tail,j.rendering=c,j.tail=c.sibling,j.renderingStartTime=rr(),c.sibling=null,w=vr.current,hr(vr,O?w&1|2:w&1),c):(ai(c),null);case 22:case 23:return o1(),O=c.memoizedState!==null,l!==null&&l.memoizedState!==null!==O&&(c.flags|=8192),O&&(c.mode&1)!==0?(Ji&1073741824)!==0&&(ai(c),c.subtreeFlags&6&&(c.flags|=8192)):ai(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function w6(l,c){switch(mn(c),c.tag){case 1:return An(c.type)&&Pl(),l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 3:return Mr(),yr(On),yr(xn),In(),l=c.flags,(l&65536)!==0&&(l&128)===0?(c.flags=l&-65537|128,c):null;case 5:return Ka(c),null;case 13:if(yr(vr),l=c.memoizedState,l!==null&&l.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Ps()}return l=c.flags,l&65536?(c.flags=l&-65537|128,c):null;case 19:return yr(vr),null;case 4:return Mr(),null;case 10:return Sf(c.type._context),null;case 22:case 23:return o1(),null;case 24:return null;default:return null}}var Rm=!1,oi=!1,x6=typeof WeakSet=="function"?WeakSet:Set,yt=null;function Nf(l,c){var w=l.ref;if(w!==null)if(typeof w=="function")try{w(null)}catch(O){en(l,c,O)}else w.current=null}function X0(l,c,w){try{w()}catch(O){en(l,c,O)}}var yb=!1;function S6(l,c){if(oh=Gc,l=rn(),xl(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 F=O.anchorOffset,j=O.focusNode;O=O.focusOffset;try{w.nodeType,j.nodeType}catch{w=null;break e}var te=0,ce=-1,ge=-1,De=0,We=0,Xe=l,Ve=null;t:for(;;){for(var pt;Xe!==w||F!==0&&Xe.nodeType!==3||(ce=te+F),Xe!==j||O!==0&&Xe.nodeType!==3||(ge=te+O),Xe.nodeType===3&&(te+=Xe.nodeValue.length),(pt=Xe.firstChild)!==null;)Ve=Xe,Xe=pt;for(;;){if(Xe===l)break t;if(Ve===w&&++De===F&&(ce=te),Ve===j&&++We===O&&(ge=te),(pt=Xe.nextSibling)!==null)break;Xe=Ve,Ve=Xe.parentNode}Xe=pt}w=ce===-1||ge===-1?null:{start:ce,end:ge}}else w=null}w=w||{start:0,end:0}}else w=null;for(sh={focusedElem:l,selectionRange:w},Gc=!1,yt=c;yt!==null;)if(c=yt,l=c.child,(c.subtreeFlags&1028)!==0&&l!==null)l.return=c,yt=l;else for(;yt!==null;){c=yt;try{var vt=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(vt!==null){var bt=vt.memoizedProps,ln=vt.memoizedState,Ae=c.stateNode,we=Ae.getSnapshotBeforeUpdate(c.elementType===c.type?bt:Sn(c.type,bt),ln);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(Qe){en(c,c.return,Qe)}if(l=c.sibling,l!==null){l.return=c.return,yt=l;break}yt=c.return}return vt=yb,yb=!1,vt}function _h(l,c,w){var O=c.updateQueue;if(O=O!==null?O.lastEffect:null,O!==null){var F=O=O.next;do{if((F.tag&l)===l){var j=F.destroy;F.destroy=void 0,j!==void 0&&X0(c,w,j)}F=F.next}while(F!==O)}}function Mm(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 Y0(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 vb(l){var c=l.alternate;c!==null&&(l.alternate=null,vb(c)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(c=l.stateNode,c!==null&&(delete c[Ii],delete c[$u],delete c[pf],delete c[ym],delete c[vm])),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 bb(l){return l.tag===5||l.tag===3||l.tag===4}function wb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||bb(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 K0(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=ys));else if(O!==4&&(l=l.child,l!==null))for(K0(l,c,w),l=l.sibling;l!==null;)K0(l,c,w),l=l.sibling}function Q0(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(Q0(l,c,w),l=l.sibling;l!==null;)Q0(l,c,w),l=l.sibling}var Gn=null,Ja=!1;function $l(l,c,w){for(w=w.child;w!==null;)xb(l,c,w),w=w.sibling}function xb(l,c,w){if(yn&&typeof yn.onCommitFiberUnmount=="function")try{yn.onCommitFiberUnmount(ja,w)}catch{}switch(w.tag){case 5:oi||Nf(w,c);case 6:var O=Gn,F=Ja;Gn=null,$l(l,c,w),Gn=O,Ja=F,Gn!==null&&(Ja?(l=Gn,w=w.stateNode,l.nodeType===8?l.parentNode.removeChild(w):l.removeChild(w)):Gn.removeChild(w.stateNode));break;case 18:Gn!==null&&(Ja?(l=Gn,w=w.stateNode,l.nodeType===8?hf(l.parentNode,w):l.nodeType===1&&hf(l,w),ti(l)):hf(Gn,w.stateNode));break;case 4:O=Gn,F=Ja,Gn=w.stateNode.containerInfo,Ja=!0,$l(l,c,w),Gn=O,Ja=F;break;case 0:case 11:case 14:case 15:if(!oi&&(O=w.updateQueue,O!==null&&(O=O.lastEffect,O!==null))){F=O=O.next;do{var j=F,te=j.destroy;j=j.tag,te!==void 0&&((j&2)!==0||(j&4)!==0)&&X0(w,c,te),F=F.next}while(F!==O)}$l(l,c,w);break;case 1:if(!oi&&(Nf(w,c),O=w.stateNode,typeof O.componentWillUnmount=="function"))try{O.props=w.memoizedProps,O.state=w.memoizedState,O.componentWillUnmount()}catch(ce){en(w,c,ce)}$l(l,c,w);break;case 21:$l(l,c,w);break;case 22:w.mode&1?(oi=(O=oi)||w.memoizedState!==null,$l(l,c,w),oi=O):$l(l,c,w);break;default:$l(l,c,w)}}function Sb(l){var c=l.updateQueue;if(c!==null){l.updateQueue=null;var w=l.stateNode;w===null&&(w=l.stateNode=new x6),c.forEach(function(O){var F=I6.bind(null,l,O);w.has(O)||(w.add(O),O.then(F,F))})}}function eo(l,c){var w=c.deletions;if(w!==null)for(var O=0;O<w.length;O++){var F=w[O];try{var j=l,te=c,ce=te;e:for(;ce!==null;){switch(ce.tag){case 5:Gn=ce.stateNode,Ja=!1;break e;case 3:Gn=ce.stateNode.containerInfo,Ja=!0;break e;case 4:Gn=ce.stateNode.containerInfo,Ja=!0;break e}ce=ce.return}if(Gn===null)throw Error(r(160));xb(j,te,F),Gn=null,Ja=!1;var ge=F.alternate;ge!==null&&(ge.return=null),F.return=null}catch(De){en(F,c,De)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)kb(c,l),c=c.sibling}function kb(l,c){var w=l.alternate,O=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(eo(c,l),jo(l),O&4){try{_h(3,l,l.return),Mm(3,l)}catch(bt){en(l,l.return,bt)}try{_h(5,l,l.return)}catch(bt){en(l,l.return,bt)}}break;case 1:eo(c,l),jo(l),O&512&&w!==null&&Nf(w,w.return);break;case 5:if(eo(c,l),jo(l),O&512&&w!==null&&Nf(w,w.return),l.flags&32){var F=l.stateNode;try{je(F,"")}catch(bt){en(l,l.return,bt)}}if(O&4&&(F=l.stateNode,F!=null)){var j=l.memoizedProps,te=w!==null?w.memoizedProps:j,ce=l.type,ge=l.updateQueue;if(l.updateQueue=null,ge!==null)try{ce==="input"&&j.type==="radio"&&j.name!=null&&rt(F,j),_e(ce,te);var De=_e(ce,j);for(te=0;te<ge.length;te+=2){var We=ge[te],Xe=ge[te+1];We==="style"?gt(F,Xe):We==="dangerouslySetInnerHTML"?me(F,Xe):We==="children"?je(F,Xe):P(F,We,Xe,De)}switch(ce){case"input":Se(F,j);break;case"textarea":Oe(F,j);break;case"select":var Ve=F._wrapperState.wasMultiple;F._wrapperState.wasMultiple=!!j.multiple;var pt=j.value;pt!=null?Ce(F,!!j.multiple,pt,!1):Ve!==!!j.multiple&&(j.defaultValue!=null?Ce(F,!!j.multiple,j.defaultValue,!0):Ce(F,!!j.multiple,j.multiple?[]:"",!1))}F[$u]=j}catch(bt){en(l,l.return,bt)}}break;case 6:if(eo(c,l),jo(l),O&4){if(l.stateNode===null)throw Error(r(162));F=l.stateNode,j=l.memoizedProps;try{F.nodeValue=j}catch(bt){en(l,l.return,bt)}}break;case 3:if(eo(c,l),jo(l),O&4&&w!==null&&w.memoizedState.isDehydrated)try{ti(c.containerInfo)}catch(bt){en(l,l.return,bt)}break;case 4:eo(c,l),jo(l);break;case 13:eo(c,l),jo(l),F=l.child,F.flags&8192&&(j=F.memoizedState!==null,F.stateNode.isHidden=j,!j||F.alternate!==null&&F.alternate.memoizedState!==null||(e1=rr())),O&4&&Sb(l);break;case 22:if(We=w!==null&&w.memoizedState!==null,l.mode&1?(oi=(De=oi)||We,eo(c,l),oi=De):eo(c,l),jo(l),O&8192){if(De=l.memoizedState!==null,(l.stateNode.isHidden=De)&&!We&&(l.mode&1)!==0)for(yt=l,We=l.child;We!==null;){for(Xe=yt=We;yt!==null;){switch(Ve=yt,pt=Ve.child,Ve.tag){case 0:case 11:case 14:case 15:_h(4,Ve,Ve.return);break;case 1:Nf(Ve,Ve.return);var vt=Ve.stateNode;if(typeof vt.componentWillUnmount=="function"){O=Ve,w=Ve.return;try{c=O,vt.props=c.memoizedProps,vt.state=c.memoizedState,vt.componentWillUnmount()}catch(bt){en(O,w,bt)}}break;case 5:Nf(Ve,Ve.return);break;case 22:if(Ve.memoizedState!==null){Eb(Xe);continue}}pt!==null?(pt.return=Ve,yt=pt):Eb(Xe)}We=We.sibling}e:for(We=null,Xe=l;;){if(Xe.tag===5){if(We===null){We=Xe;try{F=Xe.stateNode,De?(j=F.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(ce=Xe.stateNode,ge=Xe.memoizedProps.style,te=ge!=null&&ge.hasOwnProperty("display")?ge.display:null,ce.style.display=ht("display",te))}catch(bt){en(l,l.return,bt)}}}else if(Xe.tag===6){if(We===null)try{Xe.stateNode.nodeValue=De?"":Xe.memoizedProps}catch(bt){en(l,l.return,bt)}}else if((Xe.tag!==22&&Xe.tag!==23||Xe.memoizedState===null||Xe===l)&&Xe.child!==null){Xe.child.return=Xe,Xe=Xe.child;continue}if(Xe===l)break e;for(;Xe.sibling===null;){if(Xe.return===null||Xe.return===l)break e;We===Xe&&(We=null),Xe=Xe.return}We===Xe&&(We=null),Xe.sibling.return=Xe.return,Xe=Xe.sibling}}break;case 19:eo(c,l),jo(l),O&4&&Sb(l);break;case 21:break;default:eo(c,l),jo(l)}}function jo(l){var c=l.flags;if(c&2){try{e:{for(var w=l.return;w!==null;){if(bb(w)){var O=w;break e}w=w.return}throw Error(r(160))}switch(O.tag){case 5:var F=O.stateNode;O.flags&32&&(je(F,""),O.flags&=-33);var j=wb(l);Q0(l,j,F);break;case 3:case 4:var te=O.stateNode.containerInfo,ce=wb(l);K0(l,ce,te);break;default:throw Error(r(161))}}catch(ge){en(l,l.return,ge)}l.flags&=-3}c&4096&&(l.flags&=-4097)}function k6(l,c,w){yt=l,_b(l)}function _b(l,c,w){for(var O=(l.mode&1)!==0;yt!==null;){var F=yt,j=F.child;if(F.tag===22&&O){var te=F.memoizedState!==null||Rm;if(!te){var ce=F.alternate,ge=ce!==null&&ce.memoizedState!==null||oi;ce=Rm;var De=oi;if(Rm=te,(oi=ge)&&!De)for(yt=F;yt!==null;)te=yt,ge=te.child,te.tag===22&&te.memoizedState!==null?Tb(F):ge!==null?(ge.return=te,yt=ge):Tb(F);for(;j!==null;)yt=j,_b(j),j=j.sibling;yt=F,Rm=ce,oi=De}Pb(l)}else(F.subtreeFlags&8772)!==0&&j!==null?(j.return=F,yt=j):Pb(l)}}function Pb(l){for(;yt!==null;){var c=yt;if((c.flags&8772)!==0){var w=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:oi||Mm(5,c);break;case 1:var O=c.stateNode;if(c.flags&4&&!oi)if(w===null)O.componentDidMount();else{var F=c.elementType===c.type?w.memoizedProps:Sn(c.type,w.memoizedProps);O.componentDidUpdate(F,w.memoizedState,O.__reactInternalSnapshotBeforeUpdate)}var j=c.updateQueue;j!==null&&Ur(c,j,O);break;case 3:var te=c.updateQueue;if(te!==null){if(w=null,c.child!==null)switch(c.child.tag){case 5:w=c.child.stateNode;break;case 1:w=c.child.stateNode}Ur(c,te,w)}break;case 5:var ce=c.stateNode;if(w===null&&c.flags&4){w=ce;var ge=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":ge.autoFocus&&w.focus();break;case"img":ge.src&&(w.src=ge.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 We=De.memoizedState;if(We!==null){var Xe=We.dehydrated;Xe!==null&&ti(Xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}oi||c.flags&512&&Y0(c)}catch(Ve){en(c,c.return,Ve)}}if(c===l){yt=null;break}if(w=c.sibling,w!==null){w.return=c.return,yt=w;break}yt=c.return}}function Eb(l){for(;yt!==null;){var c=yt;if(c===l){yt=null;break}var w=c.sibling;if(w!==null){w.return=c.return,yt=w;break}yt=c.return}}function Tb(l){for(;yt!==null;){var c=yt;try{switch(c.tag){case 0:case 11:case 15:var w=c.return;try{Mm(4,c)}catch(ge){en(c,w,ge)}break;case 1:var O=c.stateNode;if(typeof O.componentDidMount=="function"){var F=c.return;try{O.componentDidMount()}catch(ge){en(c,F,ge)}}var j=c.return;try{Y0(c)}catch(ge){en(c,j,ge)}break;case 5:var te=c.return;try{Y0(c)}catch(ge){en(c,te,ge)}}}catch(ge){en(c,c.return,ge)}if(c===l){yt=null;break}var ce=c.sibling;if(ce!==null){ce.return=c.return,yt=ce;break}yt=c.return}}var _6=Math.ceil,Dm=_.ReactCurrentDispatcher,Z0=_.ReactCurrentOwner,Pa=_.ReactCurrentBatchConfig,tr=0,Nn=null,gn=null,Xn=0,Ji=0,Lf=Ga(0),kn=0,Ph=null,ec=0,Nm=0,J0=0,Eh=null,Di=null,e1=0,Ff=1/0,As=null,Lm=!1,t1=null,ql=null,Fm=!1,Vl=null,Bm=0,Th=0,r1=null,zm=-1,jm=0;function _i(){return(tr&6)!==0?rr():zm!==-1?zm:zm=rr()}function Wl(l){return(l.mode&1)===0?1:(tr&2)!==0&&Xn!==0?Xn&-Xn:hh.transition!==null?(jm===0&&(jm=Bd()),jm):(l=Jt,l!==0||(l=window.event,l=l===void 0?16:em(l.type)),l)}function to(l,c,w,O){if(50<Th)throw Th=0,r1=null,Error(r(185));Cu(l,w,O),((tr&2)===0||l!==Nn)&&(l===Nn&&((tr&2)===0&&(Nm|=w),kn===4&&Gl(l,Xn)),Ni(l,O),w===1&&tr===0&&(c.mode&1)===0&&(Ff=rr()+500,El&&Io()))}function Ni(l,c){var w=l.callbackNode;Yp(l,c);var O=is(l,l===Nn?Xn:0);if(O===0)w!==null&&yo(w),l.callbackNode=null,l.callbackPriority=0;else if(c=O&-O,l.callbackPriority!==c){if(w!=null&&yo(w),c===1)l.tag===0?Xa(Ob.bind(null,l)):Vu(Ob.bind(null,l)),mm(function(){(tr&6)===0&&Io()}),w=null;else{switch(Ou(O)){case 1:w=da;break;case 4:w=sl;break;case 16:w=ll;break;case 536870912:w=Uc;break;default:w=ll}w=Fb(w,Cb.bind(null,l))}l.callbackPriority=c,l.callbackNode=w}}function Cb(l,c){if(zm=-1,jm=0,(tr&6)!==0)throw Error(r(327));var w=l.callbackNode;if(Bf()&&l.callbackNode!==w)return null;var O=is(l,l===Nn?Xn:0);if(O===0)return null;if((O&30)!==0||(O&l.expiredLanes)!==0||c)c=Um(l,O);else{c=O;var F=tr;tr|=2;var j=Ib();(Nn!==l||Xn!==c)&&(As=null,Ff=rr()+500,rc(l,c));do try{T6();break}catch(ce){Ab(l,ce)}while(!0);xf(),Dm.current=j,tr=F,gn!==null?c=0:(Nn=null,Xn=0,c=kn)}if(c!==0){if(c===2&&(F=ul(l),F!==0&&(O=F,c=n1(l,F))),c===1)throw w=Ph,rc(l,0),Gl(l,O),Ni(l,rr()),w;if(c===6)Gl(l,O);else{if(F=l.current.alternate,(O&30)===0&&!P6(F)&&(c=Um(l,O),c===2&&(j=ul(l),j!==0&&(O=j,c=n1(l,j))),c===1))throw w=Ph,rc(l,0),Gl(l,O),Ni(l,rr()),w;switch(l.finishedWork=F,l.finishedLanes=O,c){case 0:case 1:throw Error(r(345));case 2:nc(l,Di,As);break;case 3:if(Gl(l,O),(O&130023424)===O&&(c=e1+500-rr(),10<c)){if(is(l,0)!==0)break;if(F=l.suspendedLanes,(F&O)!==O){_i(),l.pingedLanes|=l.suspendedLanes&F;break}l.timeoutHandle=yi(nc.bind(null,l,Di,As),c);break}nc(l,Di,As);break;case 4:if(Gl(l,O),(O&4194240)===O)break;for(c=l.eventTimes,F=-1;0<O;){var te=31-$t(O);j=1<<te,te=c[te],te>F&&(F=te),O&=~j}if(O=F,O=rr()-O,O=(120>O?120:480>O?480:1080>O?1080:1920>O?1920:3e3>O?3e3:4320>O?4320:1960*_6(O/1960))-O,10<O){l.timeoutHandle=yi(nc.bind(null,l,Di,As),O);break}nc(l,Di,As);break;case 5:nc(l,Di,As);break;default:throw Error(r(329))}}}return Ni(l,rr()),l.callbackNode===w?Cb.bind(null,l):null}function n1(l,c){var w=Eh;return l.current.memoizedState.isDehydrated&&(rc(l,c).flags|=256),l=Um(l,c),l!==2&&(c=Di,Di=w,c!==null&&i1(c)),l}function i1(l){Di===null?Di=l:Di.push.apply(Di,l)}function P6(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 F=w[O],j=F.getSnapshot;F=F.value;try{if(!ni(j(),F))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 Gl(l,c){for(c&=~J0,c&=~Nm,l.suspendedLanes|=c,l.pingedLanes&=~c,l=l.expirationTimes;0<c;){var w=31-$t(c),O=1<<w;l[w]=-1,c&=~O}}function Ob(l){if((tr&6)!==0)throw Error(r(327));Bf();var c=is(l,0);if((c&1)===0)return Ni(l,rr()),null;var w=Um(l,c);if(l.tag!==0&&w===2){var O=ul(l);O!==0&&(c=O,w=n1(l,O))}if(w===1)throw w=Ph,rc(l,0),Gl(l,c),Ni(l,rr()),w;if(w===6)throw Error(r(345));return l.finishedWork=l.current.alternate,l.finishedLanes=c,nc(l,Di,As),Ni(l,rr()),null}function a1(l,c){var w=tr;tr|=1;try{return l(c)}finally{tr=w,tr===0&&(Ff=rr()+500,El&&Io())}}function tc(l){Vl!==null&&Vl.tag===0&&(tr&6)===0&&Bf();var c=tr;tr|=1;var w=Pa.transition,O=Jt;try{if(Pa.transition=null,Jt=1,l)return l()}finally{Jt=O,Pa.transition=w,tr=c,(tr&6)===0&&Io()}}function o1(){Ji=Lf.current,yr(Lf)}function rc(l,c){l.finishedWork=null,l.finishedLanes=0;var w=l.timeoutHandle;if(w!==-1&&(l.timeoutHandle=-1,uh(w)),gn!==null)for(w=gn.return;w!==null;){var O=w;switch(mn(O),O.tag){case 1:O=O.type.childContextTypes,O!=null&&Pl();break;case 3:Mr(),yr(On),yr(xn),In();break;case 5:Ka(O);break;case 4:Mr();break;case 13:yr(vr);break;case 19:yr(vr);break;case 10:Sf(O.type._context);break;case 22:case 23:o1()}w=w.return}if(Nn=l,gn=l=Xl(l.current,null),Xn=Ji=c,kn=0,Ph=null,J0=Nm=ec=0,Di=Eh=null,wa!==null){for(c=0;c<wa.length;c++)if(w=wa[c],O=w.interleaved,O!==null){w.interleaved=null;var F=O.next,j=w.pending;if(j!==null){var te=j.next;j.next=F,O.next=te}w.pending=O}wa=null}return l}function Ab(l,c){do{var w=gn;try{if(xf(),Dl.current=zl,Zi){for(var O=fr.memoizedState;O!==null;){var F=O.queue;F!==null&&(F.pending=null),O=O.next}Zi=!1}if(Vn=0,Zr=Hr=fr=null,Lo=!1,Mi=0,Z0.current=null,w===null||w.return===null){kn=1,Ph=c,gn=null;break}e:{var j=l,te=w.return,ce=w,ge=c;if(c=Xn,ce.flags|=32768,ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var De=ge,We=ce,Xe=We.tag;if((We.mode&1)===0&&(Xe===0||Xe===11||Xe===15)){var Ve=We.alternate;Ve?(We.updateQueue=Ve.updateQueue,We.memoizedState=Ve.memoizedState,We.lanes=Ve.lanes):(We.updateQueue=null,We.memoizedState=null)}var pt=C(te);if(pt!==null){pt.flags&=-257,D(pt,te,ce,j,c),pt.mode&1&&g(j,De,c),c=pt,ge=De;var vt=c.updateQueue;if(vt===null){var bt=new Set;bt.add(ge),c.updateQueue=bt}else vt.add(ge);break e}else{if((c&1)===0){g(j,De,c),s1();break e}ge=Error(r(426))}}else if(or&&ce.mode&1){var ln=C(te);if(ln!==null){(ln.flags&65536)===0&&(ln.flags|=256),D(ln,te,ce,j,c),Gu(Os(ge,ce));break e}}j=ge=Os(ge,ce),kn!==4&&(kn=2),Eh===null?Eh=[j]:Eh.push(j),j=te;do{switch(j.tag){case 3:j.flags|=65536,c&=-c,j.lanes|=c;var Ae=Im(j,ge,c);Qu(j,Ae);break e;case 1:ce=ge;var we=j.type,Re=j.stateNode;if((j.flags&128)===0&&(typeof we.getDerivedStateFromError=="function"||Re!==null&&typeof Re.componentDidCatch=="function"&&(ql===null||!ql.has(Re)))){j.flags|=65536,c&=-c,j.lanes|=c;var Qe=m(j,ce,c);Qu(j,Qe);break e}}j=j.return}while(j!==null)}Mb(w)}catch(St){c=St,gn===w&&w!==null&&(gn=w=w.return);continue}break}while(!0)}function Ib(){var l=Dm.current;return Dm.current=zl,l===null?zl:l}function s1(){(kn===0||kn===3||kn===2)&&(kn=4),Nn===null||(ec&268435455)===0&&(Nm&268435455)===0||Gl(Nn,Xn)}function Um(l,c){var w=tr;tr|=2;var O=Ib();(Nn!==l||Xn!==c)&&(As=null,rc(l,c));do try{E6();break}catch(F){Ab(l,F)}while(!0);if(xf(),tr=w,Dm.current=O,gn!==null)throw Error(r(261));return Nn=null,Xn=0,kn}function E6(){for(;gn!==null;)Rb(gn)}function T6(){for(;gn!==null&&!jc();)Rb(gn)}function Rb(l){var c=Lb(l.alternate,l,Ji);l.memoizedProps=l.pendingProps,c===null?Mb(l):gn=c,Z0.current=null}function Mb(l){var c=l;do{var w=c.alternate;if(l=c.return,(c.flags&32768)===0){if(w=b6(w,c,Ji),w!==null){gn=w;return}}else{if(w=w6(w,c),w!==null){w.flags&=32767,gn=w;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{kn=6,gn=null;return}}if(c=c.sibling,c!==null){gn=c;return}gn=c=l}while(c!==null);kn===0&&(kn=5)}function nc(l,c,w){var O=Jt,F=Pa.transition;try{Pa.transition=null,Jt=1,C6(l,c,w,O)}finally{Pa.transition=F,Jt=O}return null}function C6(l,c,w,O){do Bf();while(Vl!==null);if((tr&6)!==0)throw Error(r(327));w=l.finishedWork;var F=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(B0(l,j),l===Nn&&(gn=Nn=null,Xn=0),(w.subtreeFlags&2064)===0&&(w.flags&2064)===0||Fm||(Fm=!0,Fb(ll,function(){return Bf(),null})),j=(w.flags&15990)!==0,(w.subtreeFlags&15990)!==0||j){j=Pa.transition,Pa.transition=null;var te=Jt;Jt=1;var ce=tr;tr|=4,Z0.current=null,S6(l,w),kb(w,l),Fu(sh),Gc=!!oh,sh=oh=null,l.current=w,k6(w),Fd(),tr=ce,Jt=te,Pa.transition=j}else l.current=w;if(Fm&&(Fm=!1,Vl=l,Bm=F),j=l.pendingLanes,j===0&&(ql=null),xr(w.stateNode),Ni(l,rr()),c!==null)for(O=l.onRecoverableError,w=0;w<c.length;w++)F=c[w],O(F.value,{componentStack:F.stack,digest:F.digest});if(Lm)throw Lm=!1,l=t1,t1=null,l;return(Bm&1)!==0&&l.tag!==0&&Bf(),j=l.pendingLanes,(j&1)!==0?l===r1?Th++:(Th=0,r1=l):Th=0,Io(),null}function Bf(){if(Vl!==null){var l=Ou(Bm),c=Pa.transition,w=Jt;try{if(Pa.transition=null,Jt=16>l?16:l,Vl===null)var O=!1;else{if(l=Vl,Vl=null,Bm=0,(tr&6)!==0)throw Error(r(331));var F=tr;for(tr|=4,yt=l.current;yt!==null;){var j=yt,te=j.child;if((yt.flags&16)!==0){var ce=j.deletions;if(ce!==null){for(var ge=0;ge<ce.length;ge++){var De=ce[ge];for(yt=De;yt!==null;){var We=yt;switch(We.tag){case 0:case 11:case 15:_h(8,We,j)}var Xe=We.child;if(Xe!==null)Xe.return=We,yt=Xe;else for(;yt!==null;){We=yt;var Ve=We.sibling,pt=We.return;if(vb(We),We===De){yt=null;break}if(Ve!==null){Ve.return=pt,yt=Ve;break}yt=pt}}}var vt=j.alternate;if(vt!==null){var bt=vt.child;if(bt!==null){vt.child=null;do{var ln=bt.sibling;bt.sibling=null,bt=ln}while(bt!==null)}}yt=j}}if((j.subtreeFlags&2064)!==0&&te!==null)te.return=j,yt=te;else e:for(;yt!==null;){if(j=yt,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:_h(9,j,j.return)}var Ae=j.sibling;if(Ae!==null){Ae.return=j.return,yt=Ae;break e}yt=j.return}}var we=l.current;for(yt=we;yt!==null;){te=yt;var Re=te.child;if((te.subtreeFlags&2064)!==0&&Re!==null)Re.return=te,yt=Re;else e:for(te=we;yt!==null;){if(ce=yt,(ce.flags&2048)!==0)try{switch(ce.tag){case 0:case 11:case 15:Mm(9,ce)}}catch(St){en(ce,ce.return,St)}if(ce===te){yt=null;break e}var Qe=ce.sibling;if(Qe!==null){Qe.return=ce.return,yt=Qe;break e}yt=ce.return}}if(tr=F,Io(),yn&&typeof yn.onPostCommitFiberRoot=="function")try{yn.onPostCommitFiberRoot(ja,l)}catch{}O=!0}return O}finally{Jt=w,Pa.transition=c}}return!1}function Db(l,c,w){c=Os(w,c),c=Im(l,c,1),l=ka(l,c,1),c=_i(),l!==null&&(Cu(l,1,c),Ni(l,c))}function en(l,c,w){if(l.tag===3)Db(l,l,w);else for(;c!==null;){if(c.tag===3){Db(c,l,w);break}else if(c.tag===1){var O=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof O.componentDidCatch=="function"&&(ql===null||!ql.has(O))){l=Os(w,l),l=m(c,l,1),c=ka(c,l,1),l=_i(),c!==null&&(Cu(c,1,l),Ni(c,l));break}}c=c.return}}function O6(l,c,w){var O=l.pingCache;O!==null&&O.delete(c),c=_i(),l.pingedLanes|=l.suspendedLanes&w,Nn===l&&(Xn&w)===w&&(kn===4||kn===3&&(Xn&130023424)===Xn&&500>rr()-e1?rc(l,0):J0|=w),Ni(l,c)}function Nb(l,c){c===0&&((l.mode&1)===0?c=1:(c=Ua,Ua<<=1,(Ua&130023424)===0&&(Ua=4194304)));var w=_i();l=Si(l,c),l!==null&&(Cu(l,c,w),Ni(l,w))}function A6(l){var c=l.memoizedState,w=0;c!==null&&(w=c.retryLane),Nb(l,w)}function I6(l,c){var w=0;switch(l.tag){case 13:var O=l.stateNode,F=l.memoizedState;F!==null&&(w=F.retryLane);break;case 19:O=l.stateNode;break;default:throw Error(r(314))}O!==null&&O.delete(c),Nb(l,w)}var Lb;Lb=function(l,c,w){if(l!==null)if(l.memoizedProps!==c.pendingProps||On.current)Y=!0;else{if((l.lanes&w)===0&&(c.flags&128)===0)return Y=!1,W0(l,c,w);Y=(l.flags&131072)!==0}else Y=!1,or&&(c.flags&1048576)!==0&&wm(c,Mo,c.index);switch(c.lanes=0,c.tag){case 2:var O=c.type;Gt(l,c),l=c.pendingProps;var F=ws(c,xn.current);Ya(c,w),F=Nl(null,c,O,l,F,w);var j=Ll();return c.flags|=1,typeof F=="object"&&F!==null&&typeof F.render=="function"&&F.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,An(O)?(j=!0,xs(c)):j=!1,c.memoizedState=F.state!==null&&F.state!==void 0?F.state:null,Ku(c),F.updater=Ul,c.stateNode=F,F._reactInternals=c,Mf(c,O,l,w),c=sr(null,c,O,!0,j,w)):(c.tag=0,or&&j&&Tl(c),ie(null,c,F,w),c=c.child),c;case 16:O=c.elementType;e:{switch(Gt(l,c),l=c.pendingProps,F=O._init,O=F(O._payload),c.type=O,F=c.tag=M6(O),l=Sn(O,l),F){case 0:c=lt(null,c,O,l,w);break e;case 1:c=br(null,c,O,l,w);break e;case 11:c=Pe(null,c,O,l,w);break e;case 14:c=Ne(null,c,O,Sn(O.type,l),w);break e}throw Error(r(306,O,""))}return c;case 0:return O=c.type,F=c.pendingProps,F=c.elementType===O?F:Sn(O,F),lt(l,c,O,F,w);case 1:return O=c.type,F=c.pendingProps,F=c.elementType===O?F:Sn(O,F),br(l,c,O,F,w);case 3:e:{if(Wn(c),l===null)throw Error(r(387));O=c.pendingProps,j=c.memoizedState,F=j.element,_f(l,c),Il(c,O,null,w);var te=c.memoizedState;if(O=te.element,j.isDehydrated)if(j={element:O,isDehydrated:!1,cache:te.cache,pendingSuspenseBoundaries:te.pendingSuspenseBoundaries,transitions:te.transitions},c.updateQueue.baseState=j,c.memoizedState=j,c.flags&256){F=Os(Error(r(423)),c),c=_a(l,c,O,w,F);break e}else if(O!==F){F=Os(Error(r(424)),c),c=_a(l,c,O,w,F);break e}else for(it=ga(c.stateNode.containerInfo.firstChild),bi=c,or=!0,wi=null,w=Ri(c,null,O,w),c.child=w;w;)w.flags=w.flags&-3|4096,w=w.sibling;else{if(Ps(),O===F){c=Dn(l,c,w);break e}ie(l,c,O,w)}c=c.child}return c;case 5:return Rl(c),l===null&&Cl(c),O=c.type,F=c.pendingProps,j=l!==null?l.memoizedProps:null,te=F.children,lh(O,F)?te=null:j!==null&&lh(O,j)&&(c.flags|=32),Dt(l,c),ie(l,c,te,w),c.child;case 6:return l===null&&Cl(c),null;case 13:return Fe(l,c,w);case 4:return No(c,c.stateNode.containerInfo),O=c.pendingProps,l===null?c.child=Es(c,null,O,w):ie(l,c,O,w),c.child;case 11:return O=c.type,F=c.pendingProps,F=c.elementType===O?F:Sn(O,F),Pe(l,c,O,F,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,F=c.pendingProps,j=c.memoizedProps,te=F.value,hr(Xu,O._currentValue),O._currentValue=te,j!==null)if(ni(j.value,te)){if(j.children===F.children&&!On.current){c=Dn(l,c,w);break e}}else for(j=c.child,j!==null&&(j.return=c);j!==null;){var ce=j.dependencies;if(ce!==null){te=j.child;for(var ge=ce.firstContext;ge!==null;){if(ge.context===O){if(j.tag===1){ge=Sa(-1,w&-w),ge.tag=2;var De=j.updateQueue;if(De!==null){De=De.shared;var We=De.pending;We===null?ge.next=ge:(ge.next=We.next,We.next=ge),De.pending=ge}}j.lanes|=w,ge=j.alternate,ge!==null&&(ge.lanes|=w),kf(j.return,w,c),ce.lanes|=w;break}ge=ge.next}}else if(j.tag===10)te=j.type===c.type?null:j.child;else if(j.tag===18){if(te=j.return,te===null)throw Error(r(341));te.lanes|=w,ce=te.alternate,ce!==null&&(ce.lanes|=w),kf(te,w,c),te=j.sibling}else te=j.child;if(te!==null)te.return=j;else for(te=j;te!==null;){if(te===c){te=null;break}if(j=te.sibling,j!==null){j.return=te.return,te=j;break}te=te.return}j=te}ie(l,c,F.children,w),c=c.child}return c;case 9:return F=c.type,O=c.pendingProps.children,Ya(c,w),F=qn(F),O=O(F),c.flags|=1,ie(l,c,O,w),c.child;case 14:return O=c.type,F=Sn(O,c.pendingProps),F=Sn(O.type,F),Ne(l,c,O,F,w);case 15:return Ke(l,c,c.type,c.pendingProps,w);case 17:return O=c.type,F=c.pendingProps,F=c.elementType===O?F:Sn(O,F),Gt(l,c),c.tag=1,An(O)?(l=!0,xs(c)):l=!1,Ya(c,w),Am(c,O,F),Mf(c,O,F,w),sr(null,c,O,!0,l,w);case 19:return sn(l,c,w);case 22:return mt(l,c,w)}throw Error(r(156,c.tag))};function Fb(l,c){return go(l,c)}function R6(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 Ea(l,c,w,O){return new R6(l,c,w,O)}function l1(l){return l=l.prototype,!(!l||!l.isReactComponent)}function M6(l){if(typeof l=="function")return l1(l)?1:0;if(l!=null){if(l=l.$$typeof,l===B)return 11;if(l===G)return 14}return 2}function Xl(l,c){var w=l.alternate;return w===null?(w=Ea(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 Hm(l,c,w,O,F,j){var te=2;if(O=l,typeof l=="function")l1(l)&&(te=1);else if(typeof l=="string")te=5;else e:switch(l){case T:return ic(w.children,F,j,c);case I:te=8,F|=8;break;case M:return l=Ea(12,w,c,F|2),l.elementType=M,l.lanes=j,l;case H:return l=Ea(13,w,c,F),l.elementType=H,l.lanes=j,l;case $:return l=Ea(19,w,c,F),l.elementType=$,l.lanes=j,l;case J:return $m(w,F,j,c);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case R:te=10;break e;case N:te=9;break e;case B:te=11;break e;case G:te=14;break e;case Z:te=16,O=null;break e}throw Error(r(130,l==null?l:typeof l,""))}return c=Ea(te,w,c,F),c.elementType=l,c.type=O,c.lanes=j,c}function ic(l,c,w,O){return l=Ea(7,l,O,c),l.lanes=w,l}function $m(l,c,w,O){return l=Ea(22,l,O,c),l.elementType=J,l.lanes=w,l.stateNode={isHidden:!1},l}function u1(l,c,w){return l=Ea(6,l,null,c),l.lanes=w,l}function c1(l,c,w){return c=Ea(4,l.children!==null?l.children:[],l.key,c),c.lanes=w,c.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},c}function D6(l,c,w,O,F){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=di(0),this.expirationTimes=di(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=di(0),this.identifierPrefix=O,this.onRecoverableError=F,this.mutableSourceEagerHydrationData=null}function f1(l,c,w,O,F,j,te,ce,ge){return l=new D6(l,c,w,ce,ge),c===1?(c=1,j===!0&&(c|=8)):c=0,j=Ea(3,null,null,c),l.current=j,j.stateNode=l,j.memoizedState={element:O,isDehydrated:w,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ku(j),l}function N6(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 Bb(l){if(!l)return va;l=l._reactInternals;e:{if(Bn(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(An(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(An(w))return gf(l,w,c)}return c}function zb(l,c,w,O,F,j,te,ce,ge){return l=f1(w,O,!0,l,F,j,te,ce,ge),l.context=Bb(null),w=l.current,O=_i(),F=Wl(w),j=Sa(O,F),j.callback=c??null,ka(w,j,F),l.current.lanes=F,Cu(l,F,O),Ni(l,O),l}function qm(l,c,w,O){var F=c.current,j=_i(),te=Wl(F);return w=Bb(w),c.context===null?c.context=w:c.pendingContext=w,c=Sa(j,te),c.payload={element:l},O=O===void 0?null:O,O!==null&&(c.callback=O),l=ka(F,c,te),l!==null&&(to(l,F,te,j),Pf(l,F,te)),te}function Vm(l){return l=l.current,l.child?(l.child.tag===5,l.child.stateNode):null}function jb(l,c){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var w=l.retryLane;l.retryLane=w!==0&&w<c?w:c}}function d1(l,c){jb(l,c),(l=l.alternate)&&jb(l,c)}function L6(){return null}var Ub=typeof reportError=="function"?reportError:function(l){console.error(l)};function h1(l){this._internalRoot=l}Wm.prototype.render=h1.prototype.render=function(l){var c=this._internalRoot;if(c===null)throw Error(r(409));qm(l,c,null,null)},Wm.prototype.unmount=h1.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var c=l.containerInfo;tc(function(){qm(null,l,null,null)}),c[ya]=null}};function Wm(l){this._internalRoot=l}Wm.prototype.unstable_scheduleHydration=function(l){if(l){var c=Qp();l={blockedOn:null,target:l,priority:c};for(var w=0;w<ma.length&&c!==0&&c<ma[w].priority;w++);ma.splice(w,0,l),w===0&&qc(l)}};function p1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Gm(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function Hb(){}function F6(l,c,w,O,F){if(F){if(typeof O=="function"){var j=O;O=function(){var De=Vm(te);j.call(De)}}var te=zb(c,O,l,0,null,!1,!1,"",Hb);return l._reactRootContainer=te,l[ya]=te.current,ms(l.nodeType===8?l.parentNode:l),tc(),te}for(;F=l.lastChild;)l.removeChild(F);if(typeof O=="function"){var ce=O;O=function(){var De=Vm(ge);ce.call(De)}}var ge=f1(l,0,!1,null,null,!1,!1,"",Hb);return l._reactRootContainer=ge,l[ya]=ge.current,ms(l.nodeType===8?l.parentNode:l),tc(function(){qm(c,ge,w,O)}),ge}function Xm(l,c,w,O,F){var j=w._reactRootContainer;if(j){var te=j;if(typeof F=="function"){var ce=F;F=function(){var ge=Vm(te);ce.call(ge)}}qm(c,te,l,F)}else te=F6(w,c,l,F,O);return Vm(te)}cl=function(l){switch(l.tag){case 3:var c=l.stateNode;if(c.current.memoizedState.isDehydrated){var w=fn(c.pendingLanes);w!==0&&(zd(c,w|1),Ni(c,rr()),(tr&6)===0&&(Ff=rr()+500,Io()))}break;case 13:tc(function(){var O=Si(l,1);if(O!==null){var F=_i();to(O,l,1,F)}}),d1(l,1)}},fl=function(l){if(l.tag===13){var c=Si(l,134217728);if(c!==null){var w=_i();to(c,l,134217728,w)}d1(l,134217728)}},Kp=function(l){if(l.tag===13){var c=Wl(l),w=Si(l,c);if(w!==null){var O=_i();to(w,l,c,O)}d1(l,c)}},Qp=function(){return Jt},Hc=function(l,c){var w=Jt;try{return Jt=l,c()}finally{Jt=w}},xt=function(l,c,w){switch(c){case"input":if(Se(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 F=pn(O);if(!F)throw Error(r(90));Ie(O),Se(O,F)}}}break;case"textarea":Oe(l,w);break;case"select":c=w.value,c!=null&&Ce(l,!!w.multiple,c,!1)}},Tr=a1,mr=tc;var B6={usingClientEntryPoint:!1,Events:[qu,nn,pn,Ht,wr,a1]},Ch={findFiberByHostInstance:Oo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},z6={bundleType:Ch.bundleType,version:Ch.version,rendererPackageName:Ch.rendererPackageName,rendererConfig:Ch.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=fi(l),l===null?null:l.stateNode},findFiberByHostInstance:Ch.findFiberByHostInstance||L6,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 Ym=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ym.isDisabled&&Ym.supportsFiber)try{ja=Ym.inject(z6),yn=Ym}catch{}}return Li.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B6,Li.createPortal=function(l,c){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p1(c))throw Error(r(200));return N6(l,c,null,w)},Li.createRoot=function(l,c){if(!p1(l))throw Error(r(299));var w=!1,O="",F=Ub;return c!=null&&(c.unstable_strictMode===!0&&(w=!0),c.identifierPrefix!==void 0&&(O=c.identifierPrefix),c.onRecoverableError!==void 0&&(F=c.onRecoverableError)),c=f1(l,1,!1,null,null,w,!1,O,F),l[ya]=c.current,ms(l.nodeType===8?l.parentNode:l),new h1(c)},Li.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=fi(c),l=l===null?null:l.stateNode,l},Li.flushSync=function(l){return tc(l)},Li.hydrate=function(l,c,w){if(!Gm(c))throw Error(r(200));return Xm(null,l,c,!0,w)},Li.hydrateRoot=function(l,c,w){if(!p1(l))throw Error(r(405));var O=w!=null&&w.hydratedSources||null,F=!1,j="",te=Ub;if(w!=null&&(w.unstable_strictMode===!0&&(F=!0),w.identifierPrefix!==void 0&&(j=w.identifierPrefix),w.onRecoverableError!==void 0&&(te=w.onRecoverableError)),c=zb(c,null,l,1,w??null,F,!1,j,te),l[ya]=c.current,ms(l),O)for(l=0;l<O.length;l++)w=O[l],F=w._getVersion,F=F(w._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[w,F]:c.mutableSourceEagerHydrationData.push(w,F);return new Wm(c)},Li.render=function(l,c,w){if(!Gm(c))throw Error(r(200));return Xm(null,l,c,!1,w)},Li.unmountComponentAtNode=function(l){if(!Gm(l))throw Error(r(40));return l._reactRootContainer?(tc(function(){Xm(null,null,l,!1,function(){l._reactRootContainer=null,l[ya]=null})}),!0):!1},Li.unstable_batchedUpdates=a1,Li.unstable_renderSubtreeIntoContainer=function(l,c,w,O){if(!Gm(w))throw Error(r(200));if(l==null||l._reactInternals===void 0)throw Error(r(38));return Xm(l,c,w,!1,O)},Li.version="18.3.1-next-f1338f8080-20240426",Li}var Yb;function eS(){if(Yb)return g1.exports;Yb=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(),g1.exports=W6(),g1.exports}var Kb;function G6(){if(Kb)return Km;Kb=1;var t=eS();return Km.createRoot=t.createRoot,Km.hydrateRoot=t.hydrateRoot,Km}var X6=G6();const tS=Oc(X6);function Ut(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 Y6={};function s0(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Y6}var rS=Object.assign,Rg=Object.getOwnPropertyDescriptor,Go=Object.defineProperty,l0=Object.prototype,Sv=[];Object.freeze(Sv);var m2={};Object.freeze(m2);var K6=typeof Proxy<"u",Q6=Object.toString();function nS(){K6||Ut("Proxy not available")}function iS(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var Jf=function(){};function ua(t){return typeof t=="function"}function _c(t){var e=typeof t;switch(e){case"string":case"symbol":case"number":return!0}return!1}function u0(t){return t!==null&&typeof t=="object"}function hu(t){if(!u0(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()===Q6}function aS(t){var e=t?.constructor;return e?e.name==="GeneratorFunction"||e.displayName==="GeneratorFunction":!1}function c0(t,e,r){Go(t,e,{enumerable:!1,writable:!0,configurable:!0,value:r})}function oS(t,e,r){Go(t,e,{enumerable:!1,writable:!1,configurable:!0,value:r})}function yu(t,e){var r="isMobX"+t;return e.prototype[r]=!0,function(n){return u0(n)&&n[r]===!0}}function Td(t){return t!=null&&Object.prototype.toString.call(t)==="[object Map]"}function Z6(t){var e=Object.getPrototypeOf(t),r=Object.getPrototypeOf(e),n=Object.getPrototypeOf(r);return n===null}function zs(t){return t!=null&&Object.prototype.toString.call(t)==="[object Set]"}var sS=typeof Object.getOwnPropertySymbols<"u";function J6(t){var e=Object.keys(t);if(!sS)return e;var r=Object.getOwnPropertySymbols(t);return r.length?[].concat(e,r.filter(function(n){return l0.propertyIsEnumerable.call(t,n)})):e}var f0=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:sS?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames;function lS(t){return t===null?null:typeof t=="object"?""+t:t}function Vs(t,e){return l0.hasOwnProperty.call(t,e)}var e_=Object.getOwnPropertyDescriptors||function(e){var r={};return f0(e).forEach(function(n){r[n]=Rg(e,n)}),r};function aa(t,e){return!!(t&e)}function oa(t,e,r){return r?t|=e:t&=~e,t}function Qb(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 t_(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,n_(n.key),n)}}function Cd(t,e,r){return e&&t_(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ed(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=i_(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 pu(){return pu=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},pu.apply(null,arguments)}function uS(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,kv(t,e)}function kv(t,e){return kv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},kv(t,e)}function r_(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 n_(t){var e=r_(t,"string");return typeof e=="symbol"?e:e+""}function i_(t,e){if(t){if(typeof t=="string")return Qb(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)?Qb(t,e):void 0}}var qo=Symbol("mobx-stored-annotations");function Xo(t){function e(r,n){if(Np(n))return t.decorate_20223_(r,n);Dp(r,n,t)}return Object.assign(e,t)}function Dp(t,e,r){Vs(t,qo)||c0(t,qo,pu({},t[qo])),f_(r)||(t[qo][e]=r)}function a_(t){return Vs(t,qo)||c0(t,qo,pu({},t[qo])),t[qo]}function Np(t){return typeof t=="object"&&typeof t.kind=="string"}var Ot=Symbol("mobx administration"),vu=(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_=ar.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 ES(this)},e.reportChanged=function(){Bi(),TS(this),zi()},e.toString=function(){return this.name_},Cd(t,[{key:"isBeingObserved",get:function(){return aa(this.flags_,t.isBeingObservedMask_)},set:function(n){this.flags_=oa(this.flags_,t.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return aa(this.flags_,t.isPendingUnobservationMask_)},set:function(n){this.flags_=oa(this.flags_,t.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return aa(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=oa(this.flags_,t.diffValueMask_,n===1)}}])})();vu.isBeingObservedMask_=1;vu.isPendingUnobservationMask_=2;vu.diffValueMask_=4;var g2=yu("Atom",vu);function Mg(t,e,r){e===void 0&&(e=Jf),r===void 0&&(r=Jf);var n=new vu(t);return e!==Jf&&p9(n,e),r!==Jf&&NS(n,r),n}function o_(t,e){return ZS(t,e)}function s_(t,e){return Object.is?Object.is(t,e):t===e?t!==0||1/t===1/e:t!==t&&e!==e}var vd={structural:o_,default:s_};function Pc(t,e,r){return jS(t)?t:Array.isArray(t)?Yt.array(t,{name:r}):hu(t)?Yt.object(t,void 0,{name:r}):Td(t)?Yt.map(t,{name:r}):zs(t)?Yt.set(t,{name:r}):typeof t=="function"&&!bd(t)&&!yp(t)?aS(t)?wd(t):gp(r,t):t}function l_(t,e,r){if(t==null||uo(t)||ts(t)||Fa(t)||Ei(t))return t;if(Array.isArray(t))return Yt.array(t,{name:r,deep:!1});if(hu(t))return Yt.object(t,void 0,{name:r,deep:!1});if(Td(t))return Yt.map(t,{name:r,deep:!1});if(zs(t))return Yt.set(t,{name:r,deep:!1})}function d0(t){return t}function u_(t,e){return ZS(t,e)?e:t}var c_="override";function f_(t){return t.annotationType_===c_}function Lp(t,e){return{annotationType_:t,options_:e,make_:d_,extend_:h_,decorate_20223_:p_}}function d_(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(bd(r.value))return 1;var a=cS(t,this,e,r,!1);return Go(n,e,a),2}function h_(t,e,r,n){var i=cS(t,this,e,r);return t.defineProperty_(e,i,n)}function p_(t,e){var r=e.kind,n=e.name,i=e.addInitializer,a=this,o=function(d){var f,p,h,y;return mu((f=(p=a.options_)==null?void 0:p.name)!=null?f:n.toString(),d,(h=(y=a.options_)==null?void 0:y.autoAction)!=null?h:!1)};if(r=="field")return function(u){var d,f=u;return bd(f)||(f=o(f)),(d=a.options_)!=null&&d.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return bd(t)||(t=o(t)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,d=u[n].bind(u);d.isMobxAction=!0,u[n]=d}),t}Ut("Cannot apply '"+a.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
10
|
+
'`+a.annotationType_+"' can only be used on properties with a function value."))}function m_(t,e,r,n){e.annotationType_,n.value}function cS(t,e,r,n,i){var a,o,s,u,d,f,p;i===void 0&&(i=at.safeDescriptors),m_(t,e,r,n);var h=n.value;if((a=e.options_)!=null&&a.bound){var y;h=h.bind((y=t.proxy_)!=null?y:t.target_)}return{value:mu((o=(s=e.options_)==null?void 0:s.name)!=null?o:r.toString(),h,(u=(d=e.options_)==null?void 0:d.autoAction)!=null?u:!1,(f=e.options_)!=null&&f.bound?(p=t.proxy_)!=null?p:t.target_:void 0),configurable:i?t.isPlainObject_:!0,enumerable:!1,writable:!i}}function fS(t,e){return{annotationType_:t,options_:e,make_:g_,extend_:y_,decorate_20223_:v_}}function g_(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&&(!Vs(t.target_,e)||!yp(t.target_[e]))&&this.extend_(t,e,r,!1)===null)return 0;if(yp(r.value))return 1;var a=dS(t,this,e,r,!1,!1);return Go(n,e,a),2}function y_(t,e,r,n){var i,a=dS(t,this,e,r,(i=this.options_)==null?void 0:i.bound);return t.defineProperty_(e,a,n)}function v_(t,e){var r,n=e.name,i=e.addInitializer;return yp(t)||(t=wd(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 b_(t,e,r,n){e.annotationType_,n.value}function dS(t,e,r,n,i,a){a===void 0&&(a=at.safeDescriptors),b_(t,e,r,n);var o=n.value;if(yp(o)||(o=wd(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 y2(t,e){return{annotationType_:t,options_:e,make_:w_,extend_:x_,decorate_20223_:S_}}function w_(t,e,r){return this.extend_(t,e,r,!1)===null?0:1}function x_(t,e,r,n){return k_(t,this,e,r),t.defineComputedProperty_(e,pu({},this.options_,{get:r.get,set:r.set}),n)}function S_(t,e){var r=this,n=e.name,i=e.addInitializer;return i(function(){var a=Od(this)[Ot],o=pu({},r.options_,{get:t,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new oo(o))}),function(){return this[Ot].getObservablePropValue_(n)}}function k_(t,e,r,n){e.annotationType_,n.get}function h0(t,e){return{annotationType_:t,options_:e,make_:__,extend_:P_,decorate_20223_:E_}}function __(t,e,r){return this.extend_(t,e,r,!1)===null?0:1}function P_(t,e,r,n){var i,a;return T_(t,this),t.defineObservableProperty_(e,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:Pc,n)}function E_(t,e){var r=this,n=e.kind,i=e.name,a=new WeakSet;function o(s,u){var d,f,p=Od(s)[Ot],h=new fu(u,(d=(f=r.options_)==null?void 0:f.enhancer)!=null?d:Pc,"ObservableObject."+i.toString(),!1);p.values_.set(i,h),a.add(s)}if(n=="accessor")return{get:function(){return a.has(this)||o(this,t.get.call(this)),this[Ot].getObservablePropValue_(i)},set:function(u){return a.has(this)||o(this,u),this[Ot].setObservablePropValue_(i,u)},init:function(u){return a.has(this)||o(this,u),u}}}function T_(t,e,r,n){e.annotationType_}var C_="true",O_=hS();function hS(t){return{annotationType_:C_,options_:t,make_:A_,extend_:I_,decorate_20223_:R_}}function A_(t,e,r,n){var i,a;if(r.get)return Ac.make_(t,e,r,n);if(r.set){var o=bd(r.set)?r.set:mu(e.toString(),r.set);return n===t.target_?t.defineProperty_(e,{configurable:at.safeDescriptors?t.isPlainObject_:!0,set:o})===null?0:2:(Go(n,e,{configurable:!0,set:o}),2)}if(n!==t.target_&&typeof r.value=="function"){var s;if(aS(r.value)){var u,d=(u=this.options_)!=null&&u.autoBind?wd.bound:wd;return d.make_(t,e,r,n)}var f=(s=this.options_)!=null&&s.autoBind?gp.bound:gp;return f.make_(t,e,r,n)}var p=((i=this.options_)==null?void 0:i.deep)===!1?Yt.ref:Yt;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var h;r.value=r.value.bind((h=t.proxy_)!=null?h:t.target_)}return p.make_(t,e,r,n)}function I_(t,e,r,n){var i,a;if(r.get)return Ac.extend_(t,e,r,n);if(r.set)return t.defineProperty_(e,{configurable:at.safeDescriptors?t.isPlainObject_:!0,set:mu(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?Yt.ref:Yt;return s.extend_(t,e,r,n)}function R_(t,e){Ut("'"+this.annotationType_+"' cannot be used as a decorator")}var M_="observable",D_="observable.ref",N_="observable.shallow",L_="observable.struct",pS={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(pS);function Qm(t){return t||pS}var _v=h0(M_),F_=h0(D_,{enhancer:d0}),B_=h0(N_,{enhancer:l_}),z_=h0(L_,{enhancer:u_}),mS=Xo(_v);function Zm(t){return t.deep===!0?Pc:t.deep===!1?d0:U_(t.defaultDecorator)}function j_(t){var e;return t?(e=t.defaultDecorator)!=null?e:hS(t):void 0}function U_(t){var e,r;return t&&(e=(r=t.options_)==null?void 0:r.enhancer)!=null?e:Pc}function gS(t,e,r){if(Np(e))return _v.decorate_20223_(t,e);if(_c(e)){Dp(t,e,_v);return}return jS(t)?t:hu(t)?Yt.object(t,e,r):Array.isArray(t)?Yt.array(t,e):Td(t)?Yt.map(t,e):zs(t)?Yt.set(t,e):typeof t=="object"&&t!==null?t:Yt.box(t,e)}rS(gS,mS);var H_={box:function(e,r){var n=Qm(r);return new fu(e,Zm(n),n.name,!0,n.equals)},array:function(e,r){var n=Qm(r);return(at.useProxies===!1||n.proxy===!1?q9:D9)(e,Zm(n),n.name)},map:function(e,r){var n=Qm(r);return new S2(e,Zm(n),n.name)},set:function(e,r){var n=Qm(r);return new GS(e,Zm(n),n.name)},object:function(e,r,n){return Rc(function(){return v9(at.useProxies===!1||n?.proxy===!1?Od({},n):I9({},n),e,r)})},ref:Xo(F_),shallow:Xo(B_),deep:mS,struct:Xo(z_)},Yt=rS(gS,H_),yS="computed",$_="computed.struct",Pv=y2(yS),q_=y2($_,{equals:vd.structural}),Ac=function(e,r){if(Np(r))return Pv.decorate_20223_(e,r);if(_c(r))return Dp(e,r,Pv);if(hu(e))return Xo(y2(yS,e));var n=hu(r)?r:{};return n.get=e,n.name||(n.name=e.name||""),new oo(n)};Object.assign(Ac,Pv);Ac.struct=Xo(q_);var Zb,Jb,Dg=0,V_=1,W_=(Zb=(Jb=Rg(function(){},"name"))==null?void 0:Jb.configurable)!=null?Zb:!1,ew={value:"action",configurable:!0,writable:!1,enumerable:!1};function mu(t,e,r,n){r===void 0&&(r=!1);function i(){return vS(t,r,e,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return e.toString()},W_&&(ew.value=t,Go(i,"name",ew)),i}function vS(t,e,r,n,i){var a=G_(t,e);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{X_(a)}}function G_(t,e,r,n){var i=!1,a=0,o=at.trackingDerivation,s=!e||!o;Bi();var u=at.allowStateChanges;s&&(Ic(),u=p0(!0));var d=v2(!0),f={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:u,prevAllowStateReads_:d,notifySpy_:i,startTime_:a,actionId_:V_++,parentActionId_:Dg};return Dg=f.actionId_,f}function X_(t){Dg!==t.actionId_&&Ut(30),Dg=t.parentActionId_,t.error_!==void 0&&(at.suppressReactionErrors=!0),m0(t.prevAllowStateChanges_),tp(t.prevAllowStateReads_),zi(),t.runAsAction_&&Ws(t.prevDerivation_),at.suppressReactionErrors=!1}function bS(t,e){var r=p0(t);try{return e()}finally{m0(r)}}function p0(t){var e=at.allowStateChanges;return at.allowStateChanges=t,e}function m0(t){at.allowStateChanges=t}var fu=(function(t){function e(n,i,a,o,s){var u;return a===void 0&&(a="ObservableValue"),s===void 0&&(s=vd.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}uS(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!==at.UNCHANGED&&this.setNewValue_(i)},r.prepareNewValue_=function(i){if(Oa(this)){var a=Aa(this,{object:this,type:Yo,newValue:i});if(!a)return at.UNCHANGED;i=a.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?at.UNCHANGED:i},r.setNewValue_=function(i){var a=this.value_;this.value_=i,this.reportChanged(),io(this)&&ao(this,{type:Yo,object:this,newValue:i,oldValue:a})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return Fp(this,i)},r.observe_=function(i,a){return a&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Yo,newValue:this.value_,oldValue:void 0}),Bp(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 lS(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},e})(vu),Y_=yu("ObservableValue",fu),oo=(function(){function t(r){this.dependenciesState_=ar.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ar.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Lg(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ng.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||Ut(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=mu("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?vd.structural:vd.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var e=t.prototype;return e.onBecomeStale_=function(){t9(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&&Ut(32,this.name_,this.derivation),at.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ev(this)&&(this.warnAboutUntrackedRead_(),Bi(),this.value_=this.computeValue_(!1),zi());else if(ES(this),Ev(this)){var n=at.trackingContext;this.keepAlive_&&!n&&(at.trackingContext=this),this.trackAndCompute()&&e9(this),at.trackingContext=n}var i=this.value_;if(vg(i))throw i.cause;return i},e.set=function(n){if(this.setter_){this.isRunningSetter&&Ut(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter=!1}}else Ut(34,this.name_)},e.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===ar.NOT_TRACKING_,a=this.computeValue_(!0),o=i||vg(n)||vg(a)||!this.equals_(n,a);return o&&(this.value_=a),o},e.computeValue_=function(n){this.isComputing=!0;var i=p0(!1),a;if(n)a=wS(this,this.derivation,this.scope_);else if(at.disableErrorBoundaries===!0)a=this.derivation.call(this.scope_);else try{a=this.derivation.call(this.scope_)}catch(o){a=new Lg(o)}return m0(i),this.isComputing=!1,a},e.suspend_=function(){this.keepAlive_||(Tv(this),this.value_=void 0)},e.observe_=function(n,i){var a=this,o=!0,s=void 0;return so(function(){var u=a.get();if(!o||i){var d=Ic();n({observableKind:"computed",debugObjectName:a.name_,type:Yo,object:a,newValue:u,oldValue:s}),Ws(d)}o=!1,s=u})},e.warnAboutUntrackedRead_=function(){},e.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},e.valueOf=function(){return lS(this.get())},e[Symbol.toPrimitive]=function(){return this.valueOf()},Cd(t,[{key:"isComputing",get:function(){return aa(this.flags_,t.isComputingMask_)},set:function(n){this.flags_=oa(this.flags_,t.isComputingMask_,n)}},{key:"isRunningSetter",get:function(){return aa(this.flags_,t.isRunningSetterMask_)},set:function(n){this.flags_=oa(this.flags_,t.isRunningSetterMask_,n)}},{key:"isBeingObserved",get:function(){return aa(this.flags_,t.isBeingObservedMask_)},set:function(n){this.flags_=oa(this.flags_,t.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return aa(this.flags_,t.isPendingUnobservationMask_)},set:function(n){this.flags_=oa(this.flags_,t.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return aa(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=oa(this.flags_,t.diffValueMask_,n===1)}}])})();oo.isComputingMask_=1;oo.isRunningSetterMask_=2;oo.isBeingObservedMask_=4;oo.isPendingUnobservationMask_=8;oo.diffValueMask_=16;var g0=yu("ComputedValue",oo),ar;(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_"})(ar||(ar={}));var Ng;(function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"})(Ng||(Ng={}));var Lg=function(e){this.cause=void 0,this.cause=e};function vg(t){return t instanceof Lg}function Ev(t){switch(t.dependenciesState_){case ar.UP_TO_DATE_:return!1;case ar.NOT_TRACKING_:case ar.STALE_:return!0;case ar.POSSIBLY_STALE_:{for(var e=v2(!0),r=Ic(),n=t.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(g0(o)){if(at.disableErrorBoundaries)o.get();else try{o.get()}catch{return Ws(r),tp(e),!0}if(t.dependenciesState_===ar.STALE_)return Ws(r),tp(e),!0}}return SS(t),Ws(r),tp(e),!1}}}function wS(t,e,r){var n=v2(!0);SS(t),t.newObserving_=new Array(t.runId_===0?100:t.observing_.length),t.unboundDepsCount_=0,t.runId_=++at.runId;var i=at.trackingDerivation;at.trackingDerivation=t,at.inBatch++;var a;if(at.disableErrorBoundaries===!0)a=e.call(r);else try{a=e.call(r)}catch(o){a=new Lg(o)}return at.inBatch--,at.trackingDerivation=i,K_(t),tp(n),a}function K_(t){for(var e=t.observing_,r=t.observing_=t.newObserving_,n=ar.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&&_S(u,t),u.diffValue=0}for(;i--;){var d=r[i];d.diffValue===1&&(d.diffValue=0,J_(d,t))}n!==ar.UP_TO_DATE_&&(t.dependenciesState_=n,t.onBecomeStale_())}function Tv(t){var e=t.observing_;t.observing_=[];for(var r=e.length;r--;)_S(e[r],t);t.dependenciesState_=ar.NOT_TRACKING_}function xS(t){var e=Ic();try{return t()}finally{Ws(e)}}function Ic(){var t=at.trackingDerivation;return at.trackingDerivation=null,t}function Ws(t){at.trackingDerivation=t}function v2(t){var e=at.allowStateReads;return at.allowStateReads=t,e}function tp(t){at.allowStateReads=t}function SS(t){if(t.dependenciesState_!==ar.UP_TO_DATE_){t.dependenciesState_=ar.UP_TO_DATE_;for(var e=t.observing_,r=e.length;r--;)e[r].lowestObserverState_=ar.UP_TO_DATE_}}var bg=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},wg=!0,kS=!1,at=(function(){var t=s0();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(wg=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==new bg().version&&(wg=!1),wg?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new bg):(setTimeout(function(){kS||Ut(35)},1),new bg)})();function Q_(){if((at.pendingReactions.length||at.inBatch||at.isRunningReactions)&&Ut(36),kS=!0,wg){var t=s0();--t.__mobxInstanceCount===0&&(t.__mobxGlobals=void 0),at=new bg}}function Z_(){return at}function J_(t,e){t.observers_.add(e),t.lowestObserverState_>e.dependenciesState_&&(t.lowestObserverState_=e.dependenciesState_)}function _S(t,e){t.observers_.delete(e),t.observers_.size===0&&PS(t)}function PS(t){t.isPendingUnobservation===!1&&(t.isPendingUnobservation=!0,at.pendingUnobservations.push(t))}function Bi(){at.inBatch++}function zi(){if(--at.inBatch===0){CS();for(var t=at.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 oo&&r.suspend_())}at.pendingUnobservations=[]}}function ES(t){var e=at.trackingDerivation;return e!==null?(e.runId_!==t.lastAccessedBy_&&(t.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=t,!t.isBeingObserved&&at.trackingContext&&(t.isBeingObserved=!0,t.onBO())),t.isBeingObserved):(t.observers_.size===0&&at.inBatch>0&&PS(t),!1)}function TS(t){t.lowestObserverState_!==ar.STALE_&&(t.lowestObserverState_=ar.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===ar.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=ar.STALE_}))}function e9(t){t.lowestObserverState_!==ar.STALE_&&(t.lowestObserverState_=ar.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===ar.POSSIBLY_STALE_?e.dependenciesState_=ar.STALE_:e.dependenciesState_===ar.UP_TO_DATE_&&(t.lowestObserverState_=ar.UP_TO_DATE_)}))}function t9(t){t.lowestObserverState_===ar.UP_TO_DATE_&&(t.lowestObserverState_=ar.POSSIBLY_STALE_,t.observers_.forEach(function(e){e.dependenciesState_===ar.UP_TO_DATE_&&(e.dependenciesState_=ar.POSSIBLY_STALE_,e.onBecomeStale_())}))}var Ko=(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_=ar.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Ng.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,at.pendingReactions.push(this),CS())},e.runReaction_=function(){if(!this.isDisposed){Bi(),this.isScheduled=!1;var n=at.trackingContext;if(at.trackingContext=this,Ev(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}at.trackingContext=n,zi()}},e.track=function(n){if(!this.isDisposed){Bi(),this.isRunning=!0;var i=at.trackingContext;at.trackingContext=this;var a=wS(this,n,void 0);at.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Tv(this),vg(a)&&this.reportExceptionInDerivation_(a.cause),zi()}},e.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(at.disableErrorBoundaries)throw n;var a="[mobx] uncaught error in '"+this+"'";at.suppressReactionErrors||console.error(a,n),at.globalReactionErrorHandlers.forEach(function(o){return o(n,i)})},e.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Bi(),Tv(this),zi()))},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[Ot]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(a[Symbol.dispose]=a),a},e.toString=function(){return"Reaction["+this.name_+"]"},e.trace=function(n){},Cd(t,[{key:"isDisposed",get:function(){return aa(this.flags_,t.isDisposedMask_)},set:function(n){this.flags_=oa(this.flags_,t.isDisposedMask_,n)}},{key:"isScheduled",get:function(){return aa(this.flags_,t.isScheduledMask_)},set:function(n){this.flags_=oa(this.flags_,t.isScheduledMask_,n)}},{key:"isTrackPending",get:function(){return aa(this.flags_,t.isTrackPendingMask_)},set:function(n){this.flags_=oa(this.flags_,t.isTrackPendingMask_,n)}},{key:"isRunning",get:function(){return aa(this.flags_,t.isRunningMask_)},set:function(n){this.flags_=oa(this.flags_,t.isRunningMask_,n)}},{key:"diffValue",get:function(){return aa(this.flags_,t.diffValueMask_)?1:0},set:function(n){this.flags_=oa(this.flags_,t.diffValueMask_,n===1)}}])})();Ko.isDisposedMask_=1;Ko.isScheduledMask_=2;Ko.isTrackPendingMask_=4;Ko.isRunningMask_=8;Ko.diffValueMask_=16;var r9=100,Cv=function(e){return e()};function CS(){at.inBatch>0||at.isRunningReactions||Cv(n9)}function n9(){at.isRunningReactions=!0;for(var t=at.pendingReactions,e=0;t.length>0;){++e===r9&&(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_()}at.isRunningReactions=!1}var Fg=yu("Reaction",Ko);function i9(t){var e=Cv;Cv=function(n){return t(function(){return e(n)})}}function rp(){return!1}function a9(t){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var OS="action",o9="action.bound",AS="autoAction",s9="autoAction.bound",IS="<unnamed action>",Ov=Lp(OS),l9=Lp(o9,{bound:!0}),Av=Lp(AS,{autoAction:!0}),u9=Lp(s9,{autoAction:!0,bound:!0});function RS(t){var e=function(n,i){if(ua(n))return mu(n.name||IS,n,t);if(ua(i))return mu(n,i,t);if(Np(i))return(t?Av:Ov).decorate_20223_(n,i);if(_c(i))return Dp(n,i,t?Av:Ov);if(_c(n))return Xo(Lp(t?AS:OS,{name:n,autoAction:t}))};return e}var jt=RS(!1);Object.assign(jt,Ov);var gp=RS(!0);Object.assign(gp,Av);jt.bound=Xo(l9);gp.bound=Xo(u9);function Ca(t){return vS(t.name||IS,!1,t,this,void 0)}function bd(t){return ua(t)&&t.isMobxAction===!0}function so(t,e){var r,n,i,a;e===void 0&&(e=m2);var o=(r=(n=e)==null?void 0:n.name)!=null?r:"Autorun",s=!e.scheduler&&!e.delay,u;if(s)u=new Ko(o,function(){this.track(p)},e.onError,e.requiresObservable);else{var d=MS(e),f=!1;u=new Ko(o,function(){f||(f=!0,d(function(){f=!1,u.isDisposed||u.track(p)}))},e.onError,e.requiresObservable)}function p(){t(u)}return(i=e)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((a=e)==null?void 0:a.signal)}var c9=function(e){return e()};function MS(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:c9}function DS(t,e,r){var n,i,a;r===void 0&&(r=m2);var o=(n=r.name)!=null?n:"Reaction",s=jt(o,r.onError?f9(r.onError,e):e),u=!r.scheduler&&!r.delay,d=MS(r),f=!0,p=!1,h,y=r.compareStructural?vd.structural:r.equals||vd.default,v=new Ko(o,function(){f||u?b():p||(p=!0,d(b))},r.onError,r.requiresObservable);function b(){if(p=!1,!v.isDisposed){var x=!1,k=h;v.track(function(){var S=bS(!1,function(){return t(v)});x=f||!y(h,S),h=S}),(f&&r.fireImmediately||!f&&x)&&s(h,k,v),f=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||v.schedule_(),v.getDisposer_((a=r)==null?void 0:a.signal)}function f9(t,e){return function(){try{return e.apply(this,arguments)}catch(r){t.call(this,r)}}}var d9="onBO",h9="onBUO";function p9(t,e,r){return LS(d9,t,e,r)}function NS(t,e,r){return LS(h9,t,e,r)}function LS(t,e,r,n){var i=xd(e),a=ua(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 m9="never",Jm="always",g9="observed";function y9(t){t.isolateGlobalState===!0&&Q_();var e=t.useProxies,r=t.enforceActions;if(e!==void 0&&(at.useProxies=e===Jm?!0:e===m9?!1:typeof Proxy<"u"),e==="ifavailable"&&(at.verifyProxies=!0),r!==void 0){var n=r===Jm?Jm:r===g9;at.enforceActions=n,at.allowStateChanges=!(n===!0||n===Jm)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in t&&(at[i]=!!t[i])}),at.allowStateReads=!at.observableRequiresReaction,t.reactionScheduler&&i9(t.reactionScheduler)}function v9(t,e,r,n){var i=e_(e);return Rc(function(){var a=Od(t,n)[Ot];f0(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),t}function b9(t,e){return FS(xd(t,e))}function FS(t){var e={name:t.name_};return t.observing_&&t.observing_.length>0&&(e.dependencies=w9(t.observing_).map(FS)),e}function w9(t){return Array.from(new Set(t))}var x9=0;function BS(){this.message="FLOW_CANCELLED"}BS.prototype=Object.create(Error.prototype);var b1=fS("flow"),S9=fS("flow.bound",{bound:!0}),wd=Object.assign(function(e,r){if(Np(r))return b1.decorate_20223_(e,r);if(_c(r))return Dp(e,r,b1);var n=e,i=n.name||"<unnamed flow>",a=function(){var s=this,u=arguments,d=++x9,f=jt(i+" - runid: "+d+" - init",n).apply(s,u),p,h=void 0,y=new Promise(function(v,b){var x=0;p=b;function k(_){h=void 0;var E;try{E=jt(i+" - runid: "+d+" - yield "+x++,f.next).call(f,_)}catch(A){return b(A)}P(E)}function S(_){h=void 0;var E;try{E=jt(i+" - runid: "+d+" - yield "+x++,f.throw).call(f,_)}catch(A){return b(A)}P(E)}function P(_){if(ua(_?.then)){_.then(P,b);return}return _.done?v(_.value):(h=Promise.resolve(_.value),h.then(k,S))}k(void 0)});return y.cancel=jt(i+" - runid: "+d+" - cancel",function(){try{h&&tw(h);var v=f.return(void 0),b=Promise.resolve(v.value);b.then(Jf,Jf),tw(b),p(new BS)}catch(x){p(x)}}),y};return a.isMobXFlow=!0,a},b1);wd.bound=Xo(S9);function tw(t){ua(t.cancel)&&t.cancel()}function yp(t){return t?.isMobXFlow===!0}function zS(t,e,r){var n;return Fa(t)||ts(t)||Y_(t)?n=Qo(t):uo(t)&&(n=Qo(t,e)),n.dehancer=typeof e=="function"?e:r,function(){n.dehancer=void 0}}function b2(t,e,r){return ua(r)?_9(t,e,r):k9(t,e)}function k9(t,e){return Qo(t).intercept_(e)}function _9(t,e,r){return Qo(t,e).intercept_(r)}function P9(t,e){return t?uo(t)||!!t[Ot]||g2(t)||Fg(t)||g0(t):!1}function jS(t){return P9(t)}function Bg(t){if(uo(t))return t[Ot].keys_();if(Fa(t)||Ei(t))return Array.from(t.keys());if(ts(t))return t.map(function(e,r){return r});Ut(5)}function US(t){if(uo(t))return Bg(t).map(function(e){return t[e]});if(Fa(t))return Bg(t).map(function(e){return t.get(e)});if(Ei(t))return Array.from(t.values());if(ts(t))return t.slice();Ut(6)}function E9(t){if(uo(t))return Bg(t).map(function(e){return[e,t[e]]});if(Fa(t))return Bg(t).map(function(e){return[e,t.get(e)]});if(Ei(t))return Array.from(t.entries());if(ts(t))return t.map(function(e,r){return[r,e]});Ut(7)}function HS(t,e,r){if(arguments.length===2&&!Ei(t)){Bi();var n=e;try{for(var i in n)HS(t,i,n[i])}finally{zi()}return}uo(t)?t[Ot].set_(e,r):Fa(t)?t.set(e,r):Ei(t)?t.add(e):ts(t)?(typeof e!="number"&&(e=parseInt(e,10)),e<0&&Ut("Invalid index: '"+e+"'"),Bi(),e>=t.length&&(t.length=e+1),t[e]=r,zi()):Ut(8)}function $S(t,e,r){if(uo(t))return t[Ot].defineProperty_(e,r);Ut(39)}function w2(t,e,r,n){return ua(r)?C9(t,e,r,n):T9(t,e,r)}function T9(t,e,r){return Qo(t).observe_(e,r)}function C9(t,e,r,n){return Qo(t,e).observe_(r,n)}function js(t,e){e===void 0&&(e=void 0),Bi();try{return t.apply(e)}finally{zi()}}function rw(t,e,r){return arguments.length===1||e&&typeof e=="object"?O9(t,e):qS(t,e,{})}function qS(t,e,r){var n;if(typeof r.timeout=="number"){var i=new Error("WHEN_TIMEOUT");n=setTimeout(function(){if(!o[Ot].isDisposed)if(o(),r.onError)r.onError(i);else throw i},r.timeout)}r.name="When";var a=mu("When-effect",e),o=so(function(s){var u=bS(!1,t);u&&(s.dispose(),n&&clearTimeout(n),a())},r);return o}function O9(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,d=qS(t,o,pu({},e,{onError:s}));n=function(){d(),s(new Error("WHEN_CANCELLED"))},i=function(){d(),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 zf(t){return t[Ot]}var A9={has:function(e,r){return zf(e).has_(r)},get:function(e,r){return zf(e).get_(r)},set:function(e,r,n){var i;return _c(r)?(i=zf(e).set_(r,n,!0))!=null?i:!0:!1},deleteProperty:function(e,r){var n;return _c(r)?(n=zf(e).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(e,r,n){var i;return(i=zf(e).defineProperty_(r,n))!=null?i:!0},ownKeys:function(e){return zf(e).ownKeys_()},preventExtensions:function(e){Ut(13)}};function I9(t,e){var r,n;return nS(),t=Od(t,e),(n=(r=t[Ot]).proxy_)!=null?n:r.proxy_=new Proxy(t,A9)}function Oa(t){return t.interceptors_!==void 0&&t.interceptors_.length>0}function Fp(t,e){var r=t.interceptors_||(t.interceptors_=[]);return r.push(e),iS(function(){var n=r.indexOf(e);n!==-1&&r.splice(n,1)})}function Aa(t,e){var r=Ic();try{for(var n=[].concat(t.interceptors_||[]),i=0,a=n.length;i<a&&(e=n[i](e),e&&!e.type&&Ut(14),!!e);i++);return e}finally{Ws(r)}}function io(t){return t.changeListeners_!==void 0&&t.changeListeners_.length>0}function Bp(t,e){var r=t.changeListeners_||(t.changeListeners_=[]);return r.push(e),iS(function(){var n=r.indexOf(e);n!==-1&&r.splice(n,1)})}function ao(t,e){var r=Ic(),n=t.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](e);Ws(r)}}function VS(t,e,r){return Rc(function(){var n,i=Od(t,r)[Ot];(n=e)!=null||(e=a_(t)),f0(e).forEach(function(a){return i.make_(a,e[a])})}),t}var nw="splice",Yo="update",R9=1e4,M9={get:function(e,r){var n=e[Ot];return r===Ot?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):Vs(zg,r)?zg[r]:e[r]},set:function(e,r,n){var i=e[Ot];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?e[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){Ut(15)}},x2=(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 vu(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 Fp(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}),Bp(this,n)},e.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},e.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&Ut("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_&&Ut(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&QS(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=Sv),Oa(this)){var u=Aa(this,{object:this.proxy_,type:nw,index:n,removedCount:i,added:a});if(!u)return Sv;i=u.removedCount,a=u.added}if(a=a.length===0?a:a.map(function(p){return o.enhancer_(p,void 0)}),this.legacyMode_){var d=a.length-i;this.updateArrayLength_(s,d)}var f=this.spliceItemsIntoValues_(n,i,a);return(i!==0||a.length!==0)&&this.notifyArraySplice_(n,a,f),this.dehanceValues_(f)},e.spliceItemsIntoValues_=function(n,i,a){if(a.length<R9){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 d=0;d<a.length;d++)this.values_[n+d]=a[d];for(var f=0;f<u.length;f++)this.values_[n+a.length+f]=u[f];return s}},e.notifyArrayChildUpdate_=function(n,i,a){var o=!this.owned_&&rp(),s=io(this),u=s||o?{observableKind:"array",object:this.proxy_,type:Yo,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:a}:null;this.atom_.reportChanged(),s&&ao(this,u)},e.notifyArraySplice_=function(n,i,a){var o=!this.owned_&&rp(),s=io(this),u=s||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:nw,index:n,removed:a,added:i,removedCount:a.length,addedCount:i.length}:null;this.atom_.reportChanged(),s&&ao(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&&Ut(17,n,a.length),n<a.length){this.atom_;var o=a[n];if(Oa(this)){var s=Aa(this,{type:Yo,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 d=new Array(n+1-a.length),f=0;f<d.length-1;f++)d[f]=void 0;d[d.length-1]=i,this.spliceWithArray_(a.length,0,d)}},t})();function D9(t,e,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),nS(),Rc(function(){var i=new x2(r,e,n,!1);oS(i.values_,Ot,i);var a=new Proxy(i.values_,M9);return i.proxy_=a,t&&t.length&&i.spliceWithArray_(0,0,t),a})}var zg={clear:function(){return this.splice(0)},replace:function(e){var r=this[Ot];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[Ot];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[Ot].spliceWithArray_(e,r,n)},push:function(){for(var e=this[Ot],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[Ot].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ot],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 at.trackingDerivation&&Ut(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){at.trackingDerivation&&Ut(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var r=this[Ot],n=r.dehanceValues_(r.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};Lr("at",fa);Lr("concat",fa);Lr("flat",fa);Lr("includes",fa);Lr("indexOf",fa);Lr("join",fa);Lr("lastIndexOf",fa);Lr("slice",fa);Lr("toString",fa);Lr("toLocaleString",fa);Lr("toSorted",fa);Lr("toSpliced",fa);Lr("with",fa);Lr("every",lo);Lr("filter",lo);Lr("find",lo);Lr("findIndex",lo);Lr("findLast",lo);Lr("findLastIndex",lo);Lr("flatMap",lo);Lr("forEach",lo);Lr("map",lo);Lr("some",lo);Lr("toReversed",lo);Lr("reduce",WS);Lr("reduceRight",WS);function Lr(t,e){typeof Array.prototype[t]=="function"&&(zg[t]=e(t))}function fa(t){return function(){var e=this[Ot];e.atom_.reportObserved();var r=e.dehanceValues_(e.values_);return r[t].apply(r,arguments)}}function lo(t){return function(e,r){var n=this,i=this[Ot];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[t](function(o,s){return e.call(r,o,s,n)})}}function WS(t){return function(){var e=this,r=this[Ot];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 N9=yu("ObservableArrayAdministration",x2);function ts(t){return u0(t)&&N9(t[Ot])}var L9={},iu="add",jg="delete",S2=(function(){function t(r,n,i){var a=this;n===void 0&&(n=Pc),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ot]=L9,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,ua(Map)||Ut(18),Rc(function(){a.keysAtom_=Mg("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(!at.trackingDerivation)return this.has_(n);var a=this.hasMap_.get(n);if(!a){var o=a=new fu(this.has_(n),d0,"ObservableMap.key?",!1);this.hasMap_.set(n,o),NS(o,function(){return i.hasMap_.delete(n)})}return a.get()},e.set=function(n,i){var a=this.has_(n);if(Oa(this)){var o=Aa(this,{type:a?Yo:iu,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_,Oa(this)){var a=Aa(this,{type:jg,object:this,name:n});if(!a)return!1}if(this.has_(n)){var o=rp(),s=io(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:jg,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return js(function(){var d;i.keysAtom_.reportChanged(),(d=i.hasMap_.get(n))==null||d.setNewValue_(!1);var f=i.data_.get(n);f.setNewValue_(void 0),i.data_.delete(n)}),s&&ao(this,u),!0}return!1},e.updateValue_=function(n,i){var a=this.data_.get(n);if(i=a.prepareNewValue_(i),i!==at.UNCHANGED){var o=rp(),s=io(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:Yo,object:this,oldValue:a.value_,name:n,newValue:i}:null;a.setNewValue_(i),s&&ao(this,u)}},e.addValue_=function(n,i){var a=this;this.keysAtom_,js(function(){var d,f=new fu(i,a.enhancer_,"ObservableMap.key",!1);a.data_.set(n,f),i=f.value_,(d=a.hasMap_.get(n))==null||d.setNewValue_(!0),a.keysAtom_.reportChanged()});var o=rp(),s=io(this),u=s||o?{observableKind:"map",debugObjectName:this.name_,type:iu,object:this,name:n,newValue:i}:null;s&&ao(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 iw({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 iw({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=ed(this),o;!(o=a()).done;){var s=o.value,u=s[0],d=s[1];n.call(i,d,u,this)}},e.merge=function(n){var i=this;return Fa(n)&&(n=new Map(n)),js(function(){hu(n)?J6(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)}):Td(n)?(Z6(n)||Ut(19,n),n.forEach(function(a,o){return i.set(o,a)})):n!=null&&Ut(20,n)}),this},e.clear=function(){var n=this;js(function(){xS(function(){for(var i=ed(n.keys()),a;!(a=i()).done;){var o=a.value;n.delete(o)}})})},e.replace=function(n){var i=this;return js(function(){for(var a=F9(n),o=new Map,s=!1,u=ed(i.data_.keys()),d;!(d=u()).done;){var f=d.value;if(!a.has(f)){var p=i.delete(f);if(p)s=!0;else{var h=i.data_.get(f);o.set(f,h)}}}for(var y=ed(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 Bp(this,n)},e.intercept_=function(n){return Fp(this,n)},Cd(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),Fa=yu("ObservableMap",S2);function iw(t){return t[Symbol.toStringTag]="MapIterator",_2(t)}function F9(t){if(Td(t)||Fa(t))return t;if(Array.isArray(t))return new Map(t);if(hu(t)){var e=new Map;for(var r in t)e.set(r,t[r]);return e}else return Ut(21,t)}var B9={},GS=(function(){function t(r,n,i){var a=this;n===void 0&&(n=Pc),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[Ot]=B9,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,ua(Set)||Ut(22),this.enhancer_=function(o,s){return n(o,s,i)},Rc(function(){a.atom_=Mg(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;js(function(){xS(function(){for(var i=ed(n.data_.values()),a;!(a=i()).done;){var o=a.value;n.delete(o)}})})},e.forEach=function(n,i){for(var a=ed(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_,Oa(this)){var a=Aa(this,{type:iu,object:this,newValue:n});if(!a)return this;n=a.newValue}if(!this.has(n)){js(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var o=!1,s=io(this),u=s||o?{observableKind:"set",debugObjectName:this.name_,type:iu,object:this,newValue:n}:null;s&&ao(this,u)}return this},e.delete=function(n){var i=this;if(Oa(this)){var a=Aa(this,{type:jg,object:this,oldValue:n});if(!a)return!1}if(this.has(n)){var o=!1,s=io(this),u=s||o?{observableKind:"set",debugObjectName:this.name_,type:jg,object:this,oldValue:n}:null;return js(function(){i.atom_.reportChanged(),i.data_.delete(n)}),s&&ao(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 aw({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 aw({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(zs(n)&&!Ei(n))return n.intersection(this);var i=new Set(this);return i.intersection(n)},e.union=function(n){if(zs(n)&&!Ei(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(zs(n)&&!Ei(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(zs(n)&&!Ei(n))return n.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(n)},e.replace=function(n){var i=this;return Ei(n)&&(n=new Set(n)),js(function(){Array.isArray(n)?(i.clear(),n.forEach(function(a){return i.add(a)})):zs(n)?(i.clear(),n.forEach(function(a){return i.add(a)})):n!=null&&Ut("Cannot initialize set from "+n)}),this},e.observe_=function(n,i){return Bp(this,n)},e.intercept_=function(n){return Fp(this,n)},e.toJSON=function(){return Array.from(this)},e.toString=function(){return"[object ObservableSet]"},e[Symbol.iterator]=function(){return this.values()},Cd(t,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),Ei=yu("ObservableSet",GS);function aw(t){return t[Symbol.toStringTag]="SetIterator",_2(t)}var ow=Object.create(null),sw="remove",XS=(function(){function t(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=O_),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 vu("ObservableObject.keys"),this.isPlainObject_=hu(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 oo)return a.set(i),!0;if(Oa(this)){var o=Aa(this,{type:Yo,object:this.proxy_||this.target_,name:n,newValue:i});if(!o)return null;i=o.newValue}if(i=a.prepareNewValue_(i),i!==at.UNCHANGED){var s=io(this),u=!1,d=s||u?{type:Yo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:a.value_,name:n,newValue:i}:null;a.setNewValue_(i),s&&ao(this,d)}return!0},e.get_=function(n){return at.trackingDerivation&&!Vs(this.target_,n)&&this.has_(n),this.target_[n]},e.set_=function(n,i,a){return a===void 0&&(a=!1),Vs(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(!at.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new fu(n in this.target_,d0,"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_[qo])!=null&&a[n])return;Ut(1,i.annotationType_,this.name_+"."+n.toString())}for(var o=this.target_;o&&o!==l0;){var s=Rg(o,n);if(s){var u=i.make_(this,n,s,o);if(u===0)return;if(u===1)break}o=Object.getPrototypeOf(o)}uw(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&&uw(this,a,n),s},e.defineProperty_=function(n,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Bi();var o=this.delete_(n);if(!o)return o;if(Oa(this)){var s=Aa(this,{object:this.proxy_||this.target_,name:n,type:iu,newValue:i.value});if(!s)return null;var u=s.newValue;i.value!==u&&(i=pu({},i,{value:u}))}if(a){if(!Reflect.defineProperty(this.target_,n,i))return!1}else Go(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{zi()}return!0},e.defineObservableProperty_=function(n,i,a,o){o===void 0&&(o=!1),this.keysAtom_;try{Bi();var s=this.delete_(n);if(!s)return s;if(Oa(this)){var u=Aa(this,{object:this.proxy_||this.target_,name:n,type:iu,newValue:i});if(!u)return null;i=u.newValue}var d=lw(n),f={configurable:at.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:d.get,set:d.set};if(o){if(!Reflect.defineProperty(this.target_,n,f))return!1}else Go(this.target_,n,f);var p=new fu(i,a,"ObservableObject.key",!1);this.values_.set(n,p),this.notifyPropertyAddition_(n,p.value_)}finally{zi()}return!0},e.defineComputedProperty_=function(n,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Bi();var o=this.delete_(n);if(!o)return o;if(Oa(this)){var s=Aa(this,{object:this.proxy_||this.target_,name:n,type:iu,newValue:void 0});if(!s)return null}i.name||(i.name="ObservableObject.key"),i.context=this.proxy_||this.target_;var u=lw(n),d={configurable:at.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,n,d))return!1}else Go(this.target_,n,d);this.values_.set(n,new oo(i)),this.notifyPropertyAddition_(n,void 0)}finally{zi()}return!0},e.delete_=function(n,i){if(i===void 0&&(i=!1),this.keysAtom_,!Vs(this.target_,n))return!0;if(Oa(this)){var a=Aa(this,{object:this.proxy_||this.target_,name:n,type:sw});if(!a)return null}try{var o;Bi();var s=io(this),u=!1,d=this.values_.get(n),f=void 0;if(!d&&(s||u)){var p;f=(p=Rg(this.target_,n))==null?void 0:p.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(d&&(this.values_.delete(n),d instanceof fu&&(f=d.value_),TS(d)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(n))==null||o.set(n in this.target_),s||u){var h={type:sw,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:n};s&&ao(this,h)}}finally{zi()}return!0},e.observe_=function(n,i){return Bp(this,n)},e.intercept_=function(n){return Fp(this,n)},e.notifyPropertyAddition_=function(n,i){var a,o=io(this),s=!1;if(o||s){var u=o||s?{type:iu,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;o&&ao(this,u)}(a=this.pendingKeys_)==null||(a=a.get(n))==null||a.set(!0),this.keysAtom_.reportChanged()},e.ownKeys_=function(){return this.keysAtom_.reportObserved(),f0(this.target_)},e.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},t})();function Od(t,e){var r;if(Vs(t,Ot))return t;var n=(r=e?.name)!=null?r:"ObservableObject",i=new XS(t,new Map,String(n),j_(e));return c0(t,Ot,i),t}var z9=yu("ObservableObjectAdministration",XS);function lw(t){return ow[t]||(ow[t]={get:function(){return this[Ot].getObservablePropValue_(t)},set:function(r){return this[Ot].setObservablePropValue_(t,r)}})}function uo(t){return u0(t)?z9(t[Ot]):!1}function uw(t,e,r){var n;(n=t.target_[qo])==null||delete n[r]}var j9=KS(0),U9=(function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,t===!1})(),w1=0,YS=function(){};function H9(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t.prototype,e):t.prototype.__proto__!==void 0?t.prototype.__proto__=e:t.prototype=e}H9(YS,Array.prototype);var k2=(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,Rc(function(){var u=new x2(a,i,o,!0);u.proxy_=s,oS(s,Ot,u),n&&n.length&&s.spliceWithArray(0,0,n),U9&&Object.defineProperty(s,"0",j9)}),s}uS(e,t);var r=e.prototype;return r.concat=function(){this[Ot].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 ts(s)?s.slice():s}))},r[Symbol.iterator]=function(){var n=this,i=0;return _2({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},Cd(e,[{key:"length",get:function(){return this[Ot].getArrayLength_()},set:function(i){this[Ot].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(YS);Object.entries(zg).forEach(function(t){var e=t[0],r=t[1];e!=="concat"&&c0(k2.prototype,e,r)});function KS(t){return{enumerable:!1,configurable:!0,get:function(){return this[Ot].get_(t)},set:function(r){this[Ot].set_(t,r)}}}function $9(t){Go(k2.prototype,""+t,KS(t))}function QS(t){if(t>w1){for(var e=w1;e<t+100;e++)$9(e);w1=t}}QS(1e3);function q9(t,e,r){return new k2(t,e,r)}function xd(t,e){if(typeof t=="object"&&t!==null){if(ts(t))return e!==void 0&&Ut(23),t[Ot].atom_;if(Ei(t))return t.atom_;if(Fa(t)){if(e===void 0)return t.keysAtom_;var r=t.data_.get(e)||t.hasMap_.get(e);return r||Ut(25,e,Iv(t)),r}if(uo(t)){if(!e)return Ut(26);var n=t[Ot].values_.get(e);return n||Ut(27,e,Iv(t)),n}if(g2(t)||g0(t)||Fg(t))return t}else if(ua(t)&&Fg(t[Ot]))return t[Ot];Ut(28)}function Qo(t,e){if(t||Ut(29),e!==void 0)return Qo(xd(t,e));if(g2(t)||g0(t)||Fg(t)||Fa(t)||Ei(t))return t;if(t[Ot])return t[Ot];Ut(24,t)}function Iv(t,e){var r;if(e!==void 0)r=xd(t,e);else{if(bd(t))return t.name;uo(t)||Fa(t)||Ei(t)?r=Qo(t):r=xd(t)}return r.name_}function Rc(t){var e=Ic(),r=p0(!0);Bi();try{return t()}finally{zi(),m0(r),Ws(e)}}var cw=l0.toString;function ZS(t,e,r){return r===void 0&&(r=-1),Rv(t,e,r)}function Rv(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=cw.call(t);if(o!==cw.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=fw(t),e=fw(e);var s=o==="[object Array]";if(!s){if(typeof t!="object"||typeof e!="object")return!1;var u=t.constructor,d=e.constructor;if(u!==d&&!(ua(u)&&u instanceof u&&ua(d)&&d instanceof d)&&"constructor"in t&&"constructor"in e)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var f=n.length;f--;)if(n[f]===t)return i[f]===e;if(n.push(t),i.push(e),s){if(f=t.length,f!==e.length)return!1;for(;f--;)if(!Rv(t[f],e[f],r-1,n,i))return!1}else{var p=Object.keys(t),h=p.length;if(Object.keys(e).length!==h)return!1;for(var y=0;y<h;y++){var v=p[y];if(!(Vs(e,v)&&Rv(t[v],e[v],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function fw(t){return ts(t)?t.slice():Td(t)||Fa(t)||zs(t)||Ei(t)?Array.from(t.entries()):t}var dw,V9=((dw=s0().Iterator)==null?void 0:dw.prototype)||{};function _2(t){return t[Symbol.iterator]=W9,Object.assign(Object.create(V9),t)}function W9(){return this}["Symbol","Map","Set"].forEach(function(t){var e=s0();typeof e[t]>"u"&&Ut("MobX requires global '"+t+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:a9,extras:{getDebugName:Iv},$mobx:Ot});if(!Xr.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!VS)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var JS=eS();function G9(t){t()}function X9(t){t||(t=G9),y9({reactionScheduler:t})}function Y9(t){return b9(t)}var K9=1e4,Q9=1e4,Z9=(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=K9),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,Q9))}}),t})(),J9=typeof FinalizationRegistry<"u"?FinalizationRegistry:Z9,Mv=new J9(function(t){var e;(e=t.reaction)===null||e===void 0||e.dispose(),t.reaction=null}),x1={exports:{}},S1={};var hw;function eP(){if(hw)return S1;hw=1;var t=Mp();function e(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function s(p,h){var y=h(),v=n({inst:{value:y,getSnapshot:h}}),b=v[0].inst,x=v[1];return a(function(){b.value=y,b.getSnapshot=h,u(b)&&x({inst:b})},[p,y,h]),i(function(){return u(b)&&x({inst:b}),p(function(){u(b)&&x({inst:b})})},[p]),o(y),y}function u(p){var h=p.getSnapshot;p=p.value;try{var y=h();return!r(p,y)}catch{return!0}}function d(p,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:s;return S1.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,S1}var pw;function tP(){return pw||(pw=1,x1.exports=eP()),x1.exports}var rP=tP();function mw(t){t.reaction=new Ko("observer".concat(t.name),function(){var e;t.stateVersion=Symbol(),(e=t.onStoreChange)===null||e===void 0||e.call(t)})}function nP(t,e){e===void 0&&(e="observed");var r=X.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:e,subscribe:function(s){return Mv.unregister(n),n.onStoreChange=s,n.reaction||(mw(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||(mw(i),Mv.register(r,i,i)),X.useDebugValue(i.reaction,Y9),rP.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 k1,_1,e5=typeof Symbol=="function"&&Symbol.for,iP=(_1=(k1=Object.getOwnPropertyDescriptor(function(){},"name"))===null||k1===void 0?void 0:k1.configurable)!==null&&_1!==void 0?_1:!1,gw=e5?Symbol.for("react.forward_ref"):typeof Xr.forwardRef=="function"&&Xr.forwardRef(function(t){return null}).$$typeof,yw=e5?Symbol.for("react.memo"):typeof Xr.memo=="function"&&Xr.memo(function(t){return null}).$$typeof;function Pr(t,e){var r;if(yw&&t.$$typeof===yw)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(gw&&t.$$typeof===gw&&(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 nP(function(){return i(s,u)},a)};return o.displayName=t.displayName,iP&&Object.defineProperty(o,"name",{value:t.name,writable:!0,configurable:!0}),t.contextTypes&&(o.contextTypes=t.contextTypes),n&&(o=Xr.forwardRef(o)),o=Xr.memo(o),oP(t,o),o}var aP={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function oP(t,e){Object.keys(t).forEach(function(r){aP[r]||Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}function sP(t,e){return Xr.useState(function(){return Yt(t(),e,{autoBind:!0})})[0]}var P1;X9(JS.unstable_batchedUpdates);P1=Mv.finalizeAllImmediately;const lP=Math.PI/180;function uP(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const mc=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},et={_global:mc,version:"10.2.0",isBrowser:uP(),isUnminified:/param/.test((function(t){}).toString()),dblClickWindow:400,getAngle(t){return et.angleDeg?t*lP: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:mc.document,_injectGlobal(t){typeof mc.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),mc.Konva=t}},Kr=t=>{et[t.prototype.getClassName()]=t};et._injectGlobal(et);const cP=`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
|
+
`,vw=()=>{if(typeof document>"u")throw new Error(cP)};class sa{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 sa(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 d=Math.sqrt(e*e+r*r);u.rotation=r>0?Math.acos(e/d):-Math.acos(e/d),u.scaleX=d,u.scaleY=s/d,u.skewX=(e*n+r*i)/s,u.skewY=0}else if(n!=0||i!=0){const d=Math.sqrt(n*n+i*i);u.rotation=Math.PI/2-(i>0?Math.acos(-n/d):-Math.acos(n/d)),u.scaleX=s/d,u.scaleY=d,u.skewX=0,u.skewY=(e*n+r*i)/s}return u.rotation=Te._getRotation(u.rotation),u}}const fP="[object Array]",dP="[object Number]",hP="[object String]",pP="[object Boolean]",mP=Math.PI/180,gP=180/Math.PI,Oh="#",yP="",vP="0",bP="Konva warning: ",bw="Konva error: ",wP="rgb(",E1={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]},xP=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let eg=[],Ah=null;const SP=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,16)},Te={_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)===fP},_isNumber(t){return Object.prototype.toString.call(t)===dP&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===hP},_isBoolean(t){return Object.prototype.toString.call(t)===pP},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){eg.push(t),eg.length===1&&SP(function(){const e=eg;eg=[],e.forEach(function(r){r()})})},createCanvasElement(){vw();const t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return vw(),document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){const r=Te.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(Oh,yP);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=vP+t;return Oh+t},isCanvasFarblingActive(){if(Ah!==null)return Ah;if(typeof document>"u")return Ah=!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 Ah=n,this.releaseCanvas(t),Ah},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),Oh+this._rgbToHex(t,e,r)},getSnappedHexColor(t){const e=this._hexToRgb(t);return Oh+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 E1?(e=E1[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Oh?this._hexToRgb(t.substring(1)):t.substr(0,4)===wP?(e=xP.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",Te._namedColorToRBA(t)||Te._hex3ColorToRGBA(t)||Te._hex4ColorToRGBA(t)||Te._hex6ColorToRGBA(t)||Te._hex8ColorToRGBA(t)||Te._rgbColorToRGBA(t)||Te._rgbaColorToRGBA(t)||Te._hslColorToRGBA(t)},_namedColorToRBA(t){const e=E1[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 d=2*a-o,f=[0,0,0];for(let p=0;p<3;p++)s=n+1/3*-(p-1),s<0&&s++,s>1&&s--,6*s<1?u=d+(o-d)*6*s:2*s<1?u=o:3*s<2?u=d+(o-d)*(2/3-s)*6:u=d,f[p]=u*255;return{r:Math.round(f[0]),g:Math.round(f[1]),b:Math.round(f[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*mP},radToDeg(t){return t*gP},_degToRad(t){return Te.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Te.degToRad(t)},_radToDeg(t){return Te.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Te.radToDeg(t)},_getRotation(t){return et.angleDeg?Te.radToDeg(t):t},_capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw(t){throw new Error(bw+t)},error(t){console.error(bw+t)},warn(t){et.showWarnings&&console.warn(bP+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 d=(t-r)*(t-r)+(e-n)*(e-n);if(d==0)o=t,s=e,u=(i-r)*(i-r)+(a-n)*(a-n);else{const f=((i-t)*(r-t)+(a-e)*(n-e))/d;f<0?(o=t,s=e,u=(t-i)*(t-i)+(e-a)*(e-a)):f>1?(o=r,s=n,u=(r-i)*(r-i)+(n-a)*(n-a)):(o=t+f*(r-t),s=e+f*(n-e),u=(o-i)*(o-i)+(s-a)*(s-a))}return[o,s,u]},_getProjectionToLine(t,e,r){const n=Te.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=Te._getProjectionToSegment(a.x,a.y,s.x,s.y,t.x,t.y),d=u[0],f=u[1],p=u[2];p<i&&(n.x=d,n.y=f,i=p)}),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=Te._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||Te._isElement(t[r]))if(e.configurable)delete t[r];else return null;else if(Te._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,d=0;typeof n=="number"?o=s=u=d=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),d=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-d),t.arc(i+e-d,a+r-d,d,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],d={x:s.x-o.x,y:s.y-o.y},f={x:u.x-s.x,y:u.y-s.y},p=Math.hypot(d.x,d.y),h=Math.hypot(f.x,f.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:d.x/p,y:d.y/p},x={x:f.x/h,y:f.y/h},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 kP(t){const e=[],r=t.length,n=Te;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 ww=",",_P="(",PP=")",EP="([",TP="])",CP=";",OP="()",AP="=",xw=["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"],IP=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],RP=100;let tg=null;function Sw(){if(tg!==null)return tg;try{const e=Te.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(tg=!1,!1)}catch{return tg=!1,!1}}class y0{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,d;for(o=0;o<i;o++)s=n[o],u=s.method,u?(d=s.args,a+=u,e?a+=OP:Te._isArray(d[0])?a+=EP+d.join(ww)+TP:(r&&(d=d.map(f=>typeof f=="number"?Math.floor(f):f)),a+=_P+d.join(ww)+PP)):(a+=s.property,e||(a+=AP+s.val)),a+=CP;return a}clearTrace(){this.traceArr=[]}_trace(e){let r=this.traceArr,n;r.push(e),n=r.length,n>=RP&&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,d){const f=arguments,p=this._context;f.length===3?p.drawImage(e,r,n):f.length===5?p.drawImage(e,r,n,i,a):f.length===9&&p.drawImage(e,r,n,i,a,o,s,u,d)}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=xw.length,n=this.setAttr,i,a;const o=function(s){let u=e[s],d;e[s]=function(){return a=kP(Array.prototype.slice.call(arguments,0)),d=u.apply(e,arguments),e._trace({method:s,args:a}),d}};for(i=0;i<r;i++)o(xw[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)}}IP.forEach(function(t){Object.defineProperty(y0.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class MP extends y0{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(),d=this.canvas.getPixelRatio(),f=u.x*d,p=u.y*d;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",o*Math.min(Math.abs(f),Math.abs(p))),this.setAttr("shadowOffsetX",s.x*f),this.setAttr("shadowOffsetY",s.y*p)}}class DP extends y0{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 rg;function NP(){if(rg)return rg;const t=Te.createCanvasElement(),e=t.getContext("2d");return rg=(function(){const r=et._global.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return r/n})(),Te.releaseCanvas(t),rg}class P2{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const n=(e||{}).pixelRatio||et.pixelRatio||NP();this.pixelRatio=n,this._canvas=Te.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 Te.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Ia extends P2{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new MP(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}class E2 extends P2{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new DP(this),this.setSize(e.width,e.height)}}const lr={get isDragging(){let t=!1;return lr._dragElements.forEach(e=>{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){let t;return lr._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];lr._dragElements.forEach((r,n)=>{const{node:i}=r,a=i.getStage();a.setPointersPositions(t),r.pointerId===void 0&&(r.pointerId=Te._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=[];lr._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")&&(lr.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){lr._dragElements.forEach((e,r)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&lr._dragElements.delete(r)})}};et.isBrowser&&(window.addEventListener("mouseup",lr._endDragBefore,!0),window.addEventListener("touchend",lr._endDragBefore,!0),window.addEventListener("touchcancel",lr._endDragBefore,!0),window.addEventListener("mousemove",lr._drag),window.addEventListener("touchmove",lr._drag),window.addEventListener("mouseup",lr._endDragAfter,!1),window.addEventListener("touchend",lr._endDragAfter,!1),window.addEventListener("touchcancel",lr._endDragAfter,!1));function bu(t){return Te._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||Te._isBoolean(t)?t:Object.prototype.toString.call(t)}function t5(t){return t>255?255:t<0?0:Math.round(t)}function Ze(){if(et.isUnminified)return function(t,e){return Te._isNumber(t)||Te.warn(bu(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function v0(t){if(et.isUnminified)return function(e,r){let n=Te._isNumber(e),i=Te._isArray(e)&&e.length==t;return!n&&!i&&Te.warn(bu(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function T2(){if(et.isUnminified)return function(t,e){return Te._isNumber(t)||t==="auto"||Te.warn(bu(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function Mc(){if(et.isUnminified)return function(t,e){return Te._isString(t)||Te.warn(bu(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function r5(){if(et.isUnminified)return function(t,e){const r=Te._isString(t),n=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return r||n||Te.warn(bu(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function LP(){if(et.isUnminified)return function(t,e){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&t instanceof r||(Te._isArray(t)?t.forEach(function(n){Te._isNumber(n)||Te.warn('"'+e+'" attribute has non numeric element '+n+". Make sure that all elements are numbers.")}):Te.warn(bu(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function co(){if(et.isUnminified)return function(t,e){return t===!0||t===!1||Te.warn(bu(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function FP(t){if(et.isUnminified)return function(e,r){return e==null||Te.isObject(e)||Te.warn(bu(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+t),e}}const Ih="get",Rh="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=Ih+Te._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=Rh+Te._capitalize(e);t.prototype[i]||fe.overWriteSetter(t,e,r,n)},overWriteSetter(t,e,r,n){const i=Rh+Te._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=Te._capitalize,s=Ih+o(e),u=Rh+o(e);t.prototype[s]=function(){const f={};for(let p=0;p<a;p++){const h=r[p];f[h]=this.getAttr(e+o(h))}return f};const d=FP(r);t.prototype[u]=function(f){const p=this.attrs[e];n&&(f=n.call(this,f,e)),d&&d.call(this,f,e);for(const h in f)f.hasOwnProperty(h)&&this._setAttr(e+o(h),f[h]);return f||r.forEach(h=>{this._setAttr(e+o(h),void 0)}),this._fireChangeEvent(e,p,f),i&&i.call(this),this},fe.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){const r=Te._capitalize(e),n=Rh+r,i=Ih+r;t.prototype[e]=function(){return arguments.length?(this[n](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,r,n){Te.error("Adding deprecated "+e);const i=Ih+Te._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){Te.error(a);const o=this.attrs[e];return o===void 0?r:o},fe.addSetter(t,e,n,function(){Te.error(a)}),fe.addOverloadedGetterSetter(t,e)},backCompat(t,e){Te.each(e,function(r,n){const i=t.prototype[n],a=Ih+Te._capitalize(r),o=Rh+Te._capitalize(r);function s(){i.apply(this,arguments),Te.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 BP(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:Te.warn(`CSS filter "${n}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}const xg="absoluteOpacity",kw="allEventListeners",Ms="absoluteTransform",_w="absoluteScale",ac="canvas",zP="Change",jP="children",UP="konva",Dv="listening",HP="mouseenter",$P="mouseleave",qP="pointerenter",VP="pointerleave",WP="touchenter",GP="touchleave",Pw="set",Ew="Shape",Sg=" ",Tw="stage",Zl="transform",XP="Stage",Nv="visible",YP=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Sg);let KP=1,Je=class $h{constructor(e){this._id=KP++,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===Zl||e===Ms)&&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===Zl||e===Ms)&&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(Sg);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(ac)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ms&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ac)){const{scene:e,filter:r,hit:n}=this._cache.get(ac);Te.releaseCanvas(e._canvas,r._canvas,n._canvas),this._cache.delete(ac)}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,d=r.offset||0,f=r.drawBorder||!1,p=r.hitCanvasPixelRatio||1;if(!i||!a){Te.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const h=Math.abs(Math.round(n.x)-s)>.5?1:0,y=Math.abs(Math.round(n.y)-u)>.5?1:0;i+=d*2+h,a+=d*2+y,s-=d,u-=d;const v=new Ia({pixelRatio:o,width:i,height:a}),b=new Ia({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),x=new E2({pixelRatio:p,width:i,height:a}),k=v.getContext(),S=x.getContext(),P=new Ia({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(ac),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(xg),this._clearSelfAndDescendantCache(_w),this.drawScene(v,this,P),this.drawHit(x,this),this._isUnderCache=!1,k.restore(),S.restore(),f&&(k.save(),k.beginPath(),k.rect(0,0,i,a),k.closePath(),k.setAttr("strokeStyle","red"),k.setAttr("lineWidth",5),k.stroke(),k.restore()),Te.releaseCanvas(P._canvas),this._cache.set(ac,{scene:v,filter:b,hit:x,x:s,y:u}),this._requestDraw(),this}isCached(){return this._cache.has(ac)}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(d){const f=u.point(d);i===void 0&&(i=o=f.x,a=s=f.y),i=Math.min(i,f.x),a=Math.min(a,f.y),o=Math.max(o,f.x),s=Math.max(s,f.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,d;if(!e||e.length===0)return n;if(this._filterUpToDate)return i;let f=!0;for(let h=0;h<e.length;h++)if(typeof e[h]=="string"&&Sw(),typeof e[h]!="string"||!Sw()){f=!1;break}const p=n.pixelRatio;if(i.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio),f){const h=e.join(" ");return a.save(),a.setAttr("filter",h),a.drawImage(n._canvas,0,0,n.getWidth()/p,n.getHeight()/p),a.restore(),this._filterUpToDate=!0,i}try{for(o=e.length,a.clear(),a.drawImage(n._canvas,0,0,n.getWidth()/p,n.getHeight()/p),s=a.getImageData(0,0,i.getWidth(),i.getHeight()),u=0;u<o;u++)d=e[u],typeof d=="string"&&(d=BP(d)),d.call(this,s),a.putImageData(s,0,0)}catch(h){Te.error("Unable to apply filter. "+h.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(kw),arguments.length===3)return this._delegate.apply(this,arguments);const n=e.split(Sg);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(Sg),i=n.length,a,o,s,u,d,f;if(this._cache&&this._cache.delete(kw),!e)for(o in this.eventListeners)this._off(o);for(a=0;a<i;a++)if(s=n[a],u=s.split("."),d=u[0],f=u[1],d)this.eventListeners[d]&&this._off(d,f,r);else for(o in this.eventListeners)this._off(o,f,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=Te.cloneObject(a),a.currentTarget=o[s],n.call(o[s],a)})}remove(){return this.isDragging()&&this.stopDrag(),lr._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Ms),this._clearSelfAndDescendantCache(xg),this._clearSelfAndDescendantCache(_w),this._clearSelfAndDescendantCache(Tw),this._clearSelfAndDescendantCache(Nv),this._clearSelfAndDescendantCache(Dv)}_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"+Te._capitalize(e);return Te._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!==jP&&(n=Pw+Te._capitalize(r),Te._isFunction(this[n])?this[n](e[r]):this._setAttr(r,e[r]))}),this}isListening(){return this._getCache(Dv,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(Nv,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;lr._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(f){for(i=[],a=f.length,o=0;o<a;o++)s=f[o],n++,s.nodeType!==Ew&&(i=i.concat(s.getChildren().slice())),s._id===r._id&&(o=a);i.length>0&&i[0].getDepth()<=e&&u(i)}const d=this.getStage();return r.nodeType!==XP&&d&&u(d.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(Zl),this._clearSelfAndDescendantCache(Ms)),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 sa,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(Zl);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(Zl),this._clearSelfAndDescendantCache(Ms),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 Te.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 Te.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 Te.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 Te.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 Te.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Te.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(xg,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=Te.isObject(n)&&!Te._isPlainObject(n)&&!Te._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 Te._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],Te.isValidSelector(a)||(Te.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Te.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Te.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(Tw,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(Ms,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let r;if(e)return r=new sa,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(Ms)||new sa,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(Zl,this._getTransform)}_getTransform(){var e,r;const n=this._cache.get(Zl)||new sa;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,d=this.attrs.skewX||0,f=this.attrs.skewY||0,p=this.attrs.offsetX||0,h=this.attrs.offsetY||0;return(i!==0||a!==0)&&n.translate(i,a),o!==0&&n.rotate(o),(d!==0||f!==0)&&n.skew(d,f),(s!==1||u!==1)&&n.scale(s,u),(p!==0||h!==0)&&n.translate(-1*p,-1*h),n.dirty=!1,n}clone(e){let r=Te.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(UP)<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 Ia({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(),d=new Ia({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,d),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,Te._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+zP,{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[Pw+Te._capitalize(e)];return Te._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&&!Te.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===Ew&&(r.target=this);const i=[HP,$P,qP,VP,WP,GP];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=$h.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,$h.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;lr._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){lr._dragElements.has(this._id)||this._createDragElement(e);const n=lr._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:Te.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=lr._dragElements.get(this._id);r&&(r.dragStatus="stopped"),lr._endDragBefore(e),lr._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=lr._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;lr._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=lr._dragElements.get(this._id),n=r&&r.dragStatus==="dragging",i=r&&r.dragStatus==="ready";n?this.stopDrag():i&&lr._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 Te.haveIntersection(n,this.getClientRect())}static create(e,r){return Te._isString(e)&&(e=JSON.parse(e)),this._createNode(e,r)}static _createNode(e,r){let n=$h.prototype.getClassName.call(e),i=e.children,a,o,s;r&&(e.attrs.container=r),et[n]||(Te.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($h._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,YP,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Zl),this._clearSelfAndDescendantCache(Ms)});Je.prototype.on.call(Je.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Nv)});Je.prototype.on.call(Je.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Dv)});Je.prototype.on.call(Je.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(xg)});const Er=fe.addGetterSetter;Er(Je,"zIndex");Er(Je,"absolutePosition");Er(Je,"position");Er(Je,"x",0,Ze());Er(Je,"y",0,Ze());Er(Je,"globalCompositeOperation","source-over",Mc());Er(Je,"opacity",1,Ze());Er(Je,"name","",Mc());Er(Je,"id","",Mc());Er(Je,"rotation",0,Ze());fe.addComponentsGetterSetter(Je,"scale",["x","y"]);Er(Je,"scaleX",1,Ze());Er(Je,"scaleY",1,Ze());fe.addComponentsGetterSetter(Je,"skew",["x","y"]);Er(Je,"skewX",0,Ze());Er(Je,"skewY",0,Ze());fe.addComponentsGetterSetter(Je,"offset",["x","y"]);Er(Je,"offsetX",0,Ze());Er(Je,"offsetY",0,Ze());Er(Je,"dragDistance",void 0,Ze());Er(Je,"width",0,Ze());Er(Je,"height",0,Ze());Er(Je,"listening",!0,co());Er(Je,"preventDefault",!0,co());Er(Je,"filters",void 0,function(t){return this._filterUpToDate=!1,t});Er(Je,"visible",!0,co());Er(Je,"transformsEnabled","all",Mc());Er(Je,"size");Er(Je,"dragBoundFunc");Er(Je,"draggable",!1,co());fe.backCompat(Je,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class la 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,d=a&&a.isCache;if(!this.isVisible()&&!d)return this;if(u){o.save();const f=this.getAbsoluteTransform(r).getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[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(),d=this.clipFunc(),f=typeof s=="number"&&typeof u=="number"||d,p=n===this;if(f){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(d)b=d.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 h=!p&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";h&&(o.save(),o._applyGlobalCompositeOperation(this)),(a=this.children)===null||a===void 0||a.forEach(function(y){y[e](r,n,i)}),h&&o.restore(),f&&o.restore()}getClientRect(e={}){var r;const n=e.skipTransform,i=e.relativeTo;let a,o,s,u,d={x:1/0,y:1/0,width:0,height:0};const f=this;(r=this.children)===null||r===void 0||r.forEach(function(y){if(!y.visible())return;const v=y.getClientRect({relativeTo:f,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 p=this.find("Shape");let h=!1;for(let y=0;y<p.length;y++)if(p[y]._isVisible(this)){h=!0;break}return h&&a!==void 0?d={x:a,y:o,width:s-a,height:u-o}:d={x:0,y:0,width:0,height:0},n?d:this._transformedRect(d,i)}}fe.addComponentsGetterSetter(la,"clip",["x","y","width","height"]);fe.addGetterSetter(la,"clipX",void 0,Ze());fe.addGetterSetter(la,"clipY",void 0,Ze());fe.addGetterSetter(la,"clipWidth",void 0,Ze());fe.addGetterSetter(la,"clipHeight",void 0,Ze());fe.addGetterSetter(la,"clipFunc");const vp=new Map,n5=et._global.PointerEvent!==void 0;function T1(t){return vp.get(t)}function C2(t){return{evt:t,pointerId:t.pointerId}}function i5(t,e){return vp.get(t)===e}function a5(t,e){np(t),e.getStage()&&(vp.set(t,e),n5&&e._fire("gotpointercapture",C2(new PointerEvent("gotpointercapture"))))}function np(t,e){const r=vp.get(t);if(!r)return;const n=r.getStage();n&&n.content,vp.delete(t),n5&&r._fire("lostpointercapture",C2(new PointerEvent("lostpointercapture")))}const QP="Stage",ZP="string",Cw="px",JP="mouseout",o5="mouseleave",s5="mouseover",l5="mouseenter",u5="mousemove",c5="mousedown",f5="mouseup",qh="pointermove",Vh="pointerdown",td="pointerup",Wh="pointercancel",eE="lostpointercapture",ng="pointerout",Gh="pointerleave",ig="pointerover",ag="pointerenter",Lv="contextmenu",d5="touchstart",h5="touchend",p5="touchmove",m5="touchcancel",Fv="wheel",tE=5,rE=[[l5,"_pointerenter"],[c5,"_pointerdown"],[u5,"_pointermove"],[f5,"_pointerup"],[o5,"_pointerleave"],[d5,"_pointerdown"],[p5,"_pointermove"],[h5,"_pointerup"],[m5,"_pointercancel"],[s5,"_pointerover"],[Fv,"_wheel"],[Lv,"_contextmenu"],[Vh,"_pointerdown"],[qh,"_pointermove"],[td,"_pointerup"],[Wh,"_pointercancel"],[Gh,"_pointerleave"],[eE,"_lostpointercapture"]],C1={mouse:{[ng]:JP,[Gh]:o5,[ig]:s5,[ag]:l5,[qh]:u5,[Vh]:c5,[td]:f5,[Wh]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[ng]:"touchout",[Gh]:"touchleave",[ig]:"touchover",[ag]:"touchenter",[qh]:p5,[Vh]:d5,[td]:h5,[Wh]:m5,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[ng]:ng,[Gh]:Gh,[ig]:ig,[ag]:ag,[qh]:qh,[Vh]:Vh,[td]:td,[Wh]:Wh,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Xh=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",jf=t=>{const e=Xh(t);if(e==="pointer")return et.pointerEventsEnabled&&C1.pointer;if(e==="touch")return C1.touch;if(e==="mouse")return C1.mouse};function Ow(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&Te.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const nE="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);",ip=[];let b0=class extends la{constructor(e){super(Ow(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),ip.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Ow(this.attrs)}),this._checkVisibility()}_validateAdd(e){const r=e.getType()==="Layer",n=e.getType()==="FastLayer";r||n||Te.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===ZP){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"),la.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Te._isInDocument(e)&&this.container().removeChild(e);const r=ip.indexOf(this);return r>-1&&ip.splice(r,1),Te.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}:(Te.warn(nE),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 Ia({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+Cw,this.content.style.height=r+Cw),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>tE&&Te.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 i5(e,this)}setPointerCapture(e){a5(e,this)}releaseCapture(e){np(e)}getLayers(){return this.children}_bindContentEvents(){et.isBrowser&&rE.forEach(([e,r])=>{this.content.addEventListener(e,n=>{this[r](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const r=jf(e.type);r&&this._fire(r.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const r=jf(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=jf(e.type),n=Xh(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=jf(e.type),n=Xh(e.type);if(!r)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(a=>{const o=this.getIntersection(a);if(lr.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=jf(e.type),n=Xh(e.type);if(!r)return;const i=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(et.isDragging()&&lr.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(d=>{const f=T1(d.id)||this.getIntersection(d),p=d.id,h={evt:e,pointerId:p},y=u!==f;if(y&&u&&(u._fireAndBubble(r.pointerout,{...h},f),u._fireAndBubble(r.pointerleave,{...h},f)),f){if(o[f._id])return;o[f._id]=!0}f&&f.isListening()?(s=!0,y&&(f._fireAndBubble(r.pointerover,{...h},u),f._fireAndBubble(r.pointerenter,{...h},u),this[n+"targetShape"]=f),f._fireAndBubble(r.pointermove,{...h})):u&&(this._fire(r.pointerover,{evt:e,target:this,currentTarget:this,pointerId:p}),this[n+"targetShape"]=null)}),s||this._fire(r.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const r=jf(e.type),n=Xh(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 d=T1(u.id)||this.getIntersection(u);if(d){if(d.releaseCapture(u.id),o[d._id])return;o[d._id]=!0}const f=u.id,p={evt:e,pointerId:f};let h=!1;et["_"+n+"InDblClickWindow"]?(h=!0,clearTimeout(this[n+"DblTimeout"])):lr.justDragged||(et["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){et["_"+n+"InDblClickWindow"]=!1},et.dblClickWindow),d&&d.isListening()?(s=!0,this[n+"ClickEndShape"]=d,d._fireAndBubble(r.pointerup,{...p}),et["_"+n+"ListenClick"]&&i&&i===d&&(d._fireAndBubble(r.pointerclick,{...p}),h&&a&&a===d&&d._fireAndBubble(r.pointerdblclick,{...p}))):(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:f}),h&&this._fire(r.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:f}))}),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(Lv,{evt:e}):this._fire(Lv,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const r=this.getIntersection(this.getPointerPosition());r&&r.isListening()?r._fireAndBubble(Fv,{evt:e}):this._fire(Fv,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const r=T1(e.pointerId)||this.getIntersection(this.getPointerPosition());r&&r._fireAndBubble(td,C2(e)),np(e.pointerId)}_lostpointercapture(e){np(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:Te._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:i,id:Te._getFirstPointerId(e)}])}_setPointerPosition(e){Te.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 Ia({width:this.width(),height:this.height()}),this.bufferHitCanvas=new E2({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 Te.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}};b0.prototype.nodeType=QP;Kr(b0);fe.addGetterSetter(b0,"container");et.isBrowser&&document.addEventListener("visibilitychange",()=>{ip.forEach(t=>{t.batchDraw()})});const g5="hasShadow",y5="shadowRGBA",v5="patternImage",b5="linearGradient",w5="radialGradient";let og;function O1(){return og||(og=Te.createCanvasElement().getContext("2d"),og)}const ap={};function iE(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function aE(t){t.stroke()}function oE(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function sE(t){t.stroke()}function lE(){this._clearCache(g5)}function uE(){this._clearCache(y5)}function cE(){this._clearCache(v5)}function fE(){this._clearCache(b5)}function dE(){this._clearCache(w5)}let Ge=class extends Je{constructor(e){super(e);let r,n=0;for(;r=Te.getHitColor(),!(r&&!(r in ap));)if(n++,n>=1e4){Te.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=Te.getRandomColor();break}this.colorKey=r,ap[r]=this}getContext(){return Te.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Te.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(g5,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(v5,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const r=O1().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(r&&r.setTransform){const n=new sa;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(b5,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const r=O1(),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(w5,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const r=O1(),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(y5,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Te.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 ap[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){Te.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,d=o.width+u,f=o.height+u,p=!e.skipShadow&&this.hasShadow(),h=p?this.shadowOffsetX():0,y=p?this.shadowOffsetY():0,v=d+Math.abs(h),b=f+Math.abs(y),x=p&&this.shadowBlur()||0,k=v+x*2,S=b+x*2,P={width:k,height:S,x:-(u/2+x)+Math.min(h,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(),d=this.hasShadow();let f;const p=r===this;if(!this.isVisible()&&!p)return this;if(s){o.save();const h=this.getAbsoluteTransform(r).getMatrix();return o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!u)return this;if(o.save(),this._useBufferCanvas()){f=this.getStage();const h=n||f.bufferCanvas,y=h.getContext();n?(y.save(),y.setTransform(1,0,0,1,0,0),y.clearRect(0,0,h.width,h.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=h.pixelRatio;d&&o._applyShadow(this),p||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(h._canvas,h.x||0,h.y||0,h.width/b,h.height/b)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!p){const h=this.getAbsoluteTransform(r).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}d&&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(),d=u&&u.hit;if(this.colorKey||Te.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()"),d){o.save();const p=this.getAbsoluteTransform(r).getMatrix();return o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),o._applyLineJoin(this),o._applyMiterLimit(this),!(this===r)){const p=this.getAbsoluteTransform(r).getMatrix();o.transform(p[0],p[1],p[2],p[3],p[4],p[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),d=u.data,f=d.length,p=Te._hexToRgb(this.colorKey);for(let h=0;h<f;h+=4)d[h+3]>e?(d[h]=p.r,d[h+1]=p.g,d[h+2]=p.b,d[h+3]=255):d[h+3]=0;a.putImageData(u,0,0)}catch(u){Te.error("Unable to draw hit graph from cached scene canvas. "+u.message)}return this}hasPointerCapture(e){return i5(e,this)}setPointerCapture(e){a5(e,this)}releaseCapture(e){np(e)}};Ge.prototype._fillFunc=iE;Ge.prototype._strokeFunc=aE;Ge.prototype._fillFuncHit=oE;Ge.prototype._strokeFuncHit=sE;Ge.prototype._centroid=!1;Ge.prototype.nodeType="Shape";Kr(Ge);Ge.prototype.eventListeners={};Ge.prototype.on.call(Ge.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",lE);Ge.prototype.on.call(Ge.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",uE);Ge.prototype.on.call(Ge.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",cE);Ge.prototype.on.call(Ge.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",fE);Ge.prototype.on.call(Ge.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",dE);fe.addGetterSetter(Ge,"stroke",void 0,r5());fe.addGetterSetter(Ge,"strokeWidth",2,Ze());fe.addGetterSetter(Ge,"fillAfterStrokeEnabled",!1);fe.addGetterSetter(Ge,"hitStrokeWidth","auto",T2());fe.addGetterSetter(Ge,"strokeHitEnabled",!0,co());fe.addGetterSetter(Ge,"perfectDrawEnabled",!0,co());fe.addGetterSetter(Ge,"shadowForStrokeEnabled",!0,co());fe.addGetterSetter(Ge,"lineJoin");fe.addGetterSetter(Ge,"lineCap");fe.addGetterSetter(Ge,"miterLimit");fe.addGetterSetter(Ge,"sceneFunc");fe.addGetterSetter(Ge,"hitFunc");fe.addGetterSetter(Ge,"dash");fe.addGetterSetter(Ge,"dashOffset",0,Ze());fe.addGetterSetter(Ge,"shadowColor",void 0,Mc());fe.addGetterSetter(Ge,"shadowBlur",0,Ze());fe.addGetterSetter(Ge,"shadowOpacity",1,Ze());fe.addComponentsGetterSetter(Ge,"shadowOffset",["x","y"]);fe.addGetterSetter(Ge,"shadowOffsetX",0,Ze());fe.addGetterSetter(Ge,"shadowOffsetY",0,Ze());fe.addGetterSetter(Ge,"fillPatternImage");fe.addGetterSetter(Ge,"fill",void 0,r5());fe.addGetterSetter(Ge,"fillPatternX",0,Ze());fe.addGetterSetter(Ge,"fillPatternY",0,Ze());fe.addGetterSetter(Ge,"fillLinearGradientColorStops");fe.addGetterSetter(Ge,"strokeLinearGradientColorStops");fe.addGetterSetter(Ge,"fillRadialGradientStartRadius",0);fe.addGetterSetter(Ge,"fillRadialGradientEndRadius",0);fe.addGetterSetter(Ge,"fillRadialGradientColorStops");fe.addGetterSetter(Ge,"fillPatternRepeat","repeat");fe.addGetterSetter(Ge,"fillEnabled",!0);fe.addGetterSetter(Ge,"strokeEnabled",!0);fe.addGetterSetter(Ge,"shadowEnabled",!0);fe.addGetterSetter(Ge,"dashEnabled",!0);fe.addGetterSetter(Ge,"strokeScaleEnabled",!0);fe.addGetterSetter(Ge,"fillPriority","color");fe.addComponentsGetterSetter(Ge,"fillPatternOffset",["x","y"]);fe.addGetterSetter(Ge,"fillPatternOffsetX",0,Ze());fe.addGetterSetter(Ge,"fillPatternOffsetY",0,Ze());fe.addComponentsGetterSetter(Ge,"fillPatternScale",["x","y"]);fe.addGetterSetter(Ge,"fillPatternScaleX",1,Ze());fe.addGetterSetter(Ge,"fillPatternScaleY",1,Ze());fe.addComponentsGetterSetter(Ge,"fillLinearGradientStartPoint",["x","y"]);fe.addComponentsGetterSetter(Ge,"strokeLinearGradientStartPoint",["x","y"]);fe.addGetterSetter(Ge,"fillLinearGradientStartPointX",0);fe.addGetterSetter(Ge,"strokeLinearGradientStartPointX",0);fe.addGetterSetter(Ge,"fillLinearGradientStartPointY",0);fe.addGetterSetter(Ge,"strokeLinearGradientStartPointY",0);fe.addComponentsGetterSetter(Ge,"fillLinearGradientEndPoint",["x","y"]);fe.addComponentsGetterSetter(Ge,"strokeLinearGradientEndPoint",["x","y"]);fe.addGetterSetter(Ge,"fillLinearGradientEndPointX",0);fe.addGetterSetter(Ge,"strokeLinearGradientEndPointX",0);fe.addGetterSetter(Ge,"fillLinearGradientEndPointY",0);fe.addGetterSetter(Ge,"strokeLinearGradientEndPointY",0);fe.addComponentsGetterSetter(Ge,"fillRadialGradientStartPoint",["x","y"]);fe.addGetterSetter(Ge,"fillRadialGradientStartPointX",0);fe.addGetterSetter(Ge,"fillRadialGradientStartPointY",0);fe.addComponentsGetterSetter(Ge,"fillRadialGradientEndPoint",["x","y"]);fe.addGetterSetter(Ge,"fillRadialGradientEndPointX",0);fe.addGetterSetter(Ge,"fillRadialGradientEndPointY",0);fe.addGetterSetter(Ge,"fillPatternRotation",0);fe.addGetterSetter(Ge,"fillRule",void 0,Mc());fe.backCompat(Ge,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});const hE="beforeDraw",pE="draw",x5=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],mE=x5.length;let Dc=class extends la{constructor(e){super(e),this.canvas=new Ia,this.hitCanvas=new E2({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&&Te._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"&&Te.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(){Te.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Te.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Te.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<mE;i++){const a=x5[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=Te.getHitColorKey(n[0],n[1],n[2]),o=ap[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(hE,{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),la.prototype.drawScene.call(this,a,r,n),this._fire(pE,{node:this}),this}drawHit(e,r){const n=this.getLayer(),i=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),la.prototype.drawHit.call(this,i,r),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Te.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Te.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 Te.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Dc.prototype.nodeType="Layer";Kr(Dc);fe.addGetterSetter(Dc,"imageSmoothingEnabled",!0);fe.addGetterSetter(Dc,"clearBeforeDraw",!0);fe.addGetterSetter(Dc,"hitGraphEnabled",!0,co());class O2 extends Dc{constructor(e){super(e),this.listening(!1),Te.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}O2.prototype.nodeType="FastLayer";Kr(O2);let Sd=class extends la{_validateAdd(e){const r=e.getType();r!=="Group"&&r!=="Shape"&&Te.throw("You may only add groups and shapes to groups.")}};Sd.prototype.nodeType="Group";Kr(Sd);const A1=(function(){return mc.performance&&mc.performance.now?function(){return mc.performance.now()}:function(){return new Date().getTime()}})();let Ad=class Wf{constructor(e,r){this.id=Wf.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:A1(),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=Wf.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=A1(),Wf._addAnimation(this),this}stop(){return Wf._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(A1());const s=a.length;let u;if(o?u=o.call(i,i.frame)!==!1:u=!0,!!u)for(let d=0;d<s;d++){const f=a[d];f._id!==void 0&&(e[f._id]=f)}}for(const n in e)e.hasOwnProperty(n)&&e[n].batchDraw()}static _animationLoop(){const e=Wf;e.animations.length?(e._runFrames(),Te.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Te.requestAnimFrame(this._animationLoop))}};Ad.animations=[];Ad.animIdCounter=0;Ad.animRunning=!1;const gE={node:1,duration:1,easing:1,onFinish:1,yoyo:1},yE=1,Aw=2,Iw=3,Rw=["fill","stroke","shadowColor"];let vE=0;class bE{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=Aw,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Iw,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===Aw?this.setTime(e):this.state===Iw&&this.setTime(this.duration-e)}pause(){this.state=yE,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Dr{constructor(e){const r=this,n=e.node,i=n._id,a=e.easing||op.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=vE++;const d=n.getLayer()||(n instanceof et.Stage?n.getLayers():null);d||Te.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Ad(function(){r.tween.onEnterFrame()},d),this.tween=new bE(u,function(f){r._tweenFunc(f)},a,0,1,s*1e3,o),this._addListeners(),Dr.attrs[i]||(Dr.attrs[i]={}),Dr.attrs[i][this._id]||(Dr.attrs[i][this._id]={}),Dr.tweens[i]||(Dr.tweens[i]={});for(u in e)gE[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,d;const f=Dr.tweens[i][e];f&&delete Dr.attrs[i][f][e];let p=n.getAttr(e);if(Te._isArray(r))if(a=[],o=Math.max(r.length,p.length),e==="points"&&r.length!==p.length&&(r.length>p.length?(u=p,p=Te._prepareArrayForTween(p,r,n.closed())):(s=r,r=Te._prepareArrayForTween(r,p,n.closed()))),e.indexOf("fill")===0)for(let h=0;h<o;h++)if(h%2===0)a.push(r[h]-p[h]);else{const y=Te.colorToRGBA(p[h]);d=Te.colorToRGBA(r[h]),p[h]=y,a.push({r:d.r-y.r,g:d.g-y.g,b:d.b-y.b,a:d.a-y.a})}else for(let h=0;h<o;h++)a.push(r[h]-p[h]);else Rw.indexOf(e)!==-1?(p=Te.colorToRGBA(p),d=Te.colorToRGBA(r),a={r:d.r-p.r,g:d.g-p.g,b:d.b-p.b,a:d.a-p.a}):a=r-p;Dr.attrs[i][this._id][e]={start:p,diff:a,end:r,trueEnd:s,trueStart:u},Dr.tweens[i][e]=this._id}_tweenFunc(e){const r=this.node,n=Dr.attrs[r._id][this._id];let i,a,o,s,u,d,f,p;for(i in n){if(a=n[i],o=a.start,s=a.diff,p=a.end,Te._isArray(o))if(u=[],f=Math.max(o.length,p.length),i.indexOf("fill")===0)for(d=0;d<f;d++)d%2===0?u.push((o[d]||0)+s[d]*e):u.push("rgba("+Math.round(o[d].r+s[d].r*e)+","+Math.round(o[d].g+s[d].g*e)+","+Math.round(o[d].b+s[d].b*e)+","+(o[d].a+s[d].a*e)+")");else for(d=0;d<f;d++)u.push((o[d]||0)+s[d]*e);else Rw.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=Dr.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=Dr.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=Dr.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const i in n)delete Dr.tweens[e][i];delete Dr.attrs[e][r],Dr.tweens[e]&&(Object.keys(Dr.tweens[e]).length===0&&delete Dr.tweens[e],Object.keys(Dr.attrs[e]).length===0&&delete Dr.attrs[e])}}Dr.attrs={};Dr.tweens={};Je.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Dr(t).play()};const op={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-op.BounceEaseOut(n-t,0,r,n)+e},BounceEaseInOut(t,e,r,n){return t<n/2?op.BounceEaseIn(t*2,0,r,n)*.5+e:op.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}},Ec=Te._assign(et,{Util:Te,Transform:sa,Node:Je,Container:la,Stage:b0,stages:ip,Layer:Dc,FastLayer:O2,Group:Sd,DD:lr,Shape:Ge,shapes:ap,Animation:Ad,Tween:Dr,Easings:op,Context:y0,Canvas:P2});let Js=class extends Ge{_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)),d=a*(a>0?e:r),f=o*r,p=s*(s>0?e:r),h=u*(u>0?r:e);return{x:d,y:n?-1*h:p,width:f-d,height:h-p}}};Js.prototype._centroid=!0;Js.prototype.className="Arc";Js.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];Kr(Js);fe.addGetterSetter(Js,"innerRadius",0,Ze());fe.addGetterSetter(Js,"outerRadius",0,Ze());fe.addGetterSetter(Js,"angle",0,Ze());fe.addGetterSetter(Js,"clockwise",!1,co());function Bv(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)),d=o*s/(s+u),f=o*u/(s+u),p=r-d*(i-t),h=n-d*(a-e),y=r+f*(i-t),v=n+f*(a-e);return[p,h,y,v]}function Mw(t,e){const r=t.length,n=[];for(let i=2;i<r-2;i+=2){const a=Bv(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 wE(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 el=class extends Ge{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(),d=u.length;for(s=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);s<d-2;)e.bezierCurveTo(u[s++],u[s++],u[s++],u[s++],u[s++],u[s++]);a||e.quadraticCurveTo(u[d-2],u[d-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():Mw(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),r=e.length,n=this.tension(),i=Bv(e[r-2],e[r-1],e[0],e[1],e[2],e[3],n),a=Bv(e[r-4],e[r-3],e[r-2],e[r-1],e[0],e[1],n),o=Mw(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],...wE(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}}};el.prototype.className="Line";el.prototype._attrsAffectingSize=["points","bezier","tension"];Kr(el);fe.addGetterSetter(el,"closed",!1);fe.addGetterSetter(el,"bezier",!1);fe.addGetterSetter(el,"tension",0,Ze());fe.addGetterSetter(el,"points",[],LP());const xE=[[],[],[-.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]],SE=[[],[],[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]],kE=[[1],[1,1],[1,2,1],[1,3,3,1]],Dw=(t,e,r)=>{let n,i;const o=r/2;n=0;for(let s=0;s<20;s++)i=o*xE[20][s]+o,n+=SE[20][s]*_E(t,e,i);return o*n},Nw=(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),d=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 f=u/(2*s),p=d/s,h=r+f,y=p-f*f,v=h*h+y>0?Math.sqrt(h*h+y):0,b=f*f+y>0?Math.sqrt(f*f+y):0,x=f+Math.sqrt(f*f+y)!==0?y*Math.log(Math.abs((h+v)/(f+b))):0;return Math.sqrt(s)/2*(h*v-f*b+x)};function _E(t,e,r){const n=zv(1,r,t),i=zv(1,r,e),a=n*n+i*i;return Math.sqrt(a)}const zv=(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+=kE[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 zv(t-1,e,i)}},Lw=(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 d=r(i-a),f=Math.abs(t-d)/e;f<n?(n=f,i-=a):a/=2}if(o++,o>500)break}return i};let Ra=class Fi extends Ge{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Fi.parsePathData(this.data()),this.pathLength=Fi.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],d=o[2],f=o[3],p=o[4],h=o[5],y=o[6],v=o[7],b=d>f?d:f,x=d>f?1:d/f,k=d>f?f/d:1;e.translate(s,u),e.rotate(y),e.scale(x,k),e.arc(0,0,b,p,p+h,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 d=u.points[4],f=u.points[5],p=u.points[4]+f;let h=Math.PI/180;if(Math.abs(d-p)<h&&(h=Math.abs(d-p)),f<0)for(let y=d-h;y>p;y-=h){const v=Fi.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=d+h;y<p;y+=h){const v=Fi.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 d=0;d<=1;d+=.01){const f=Fi.getPointOnCubicBezier(d,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(f.x,f.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 Fi.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 Fi.getPointOnLine(e,o.start.x,o.start.y,s[0],s[1]);case"C":return Fi.getPointOnCubicBezier(Lw(e,Fi.getPathLength(r),b=>Dw([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 Fi.getPointOnQuadraticBezier(Lw(e,Fi.getPathLength(r),b=>Nw([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],d=s[1],f=s[2],p=s[3],h=s[5],y=s[6];let v=s[4];return v+=h*e/o.pathLength,Fi.getPointOnEllipticalArc(u,d,f,p,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 d=(a-n)/(i-r),f=Math.sqrt(e*e/(1+d*d))*(i<r?-1:1),p=d*f;if(Math.abs(s-n-d*(o-r))<1e-10)return{x:o+f,y:s+p};const h=((o-r)*(i-r)+(s-n)*(a-n))/(u*u),y=r+h*(i-r),v=n+h*(a-n),b=this.getLineLength(o,s,y,v),x=Math.sqrt(e*e-b*b),k=Math.sqrt(x*x/(1+d*d))*(i<r?-1:1),S=d*k;return{x:y+k,y:v+S}}static getPointOnCubicBezier(e,r,n,i,a,o,s,u,d){function f(x){return x*x*x}function p(x){return 3*x*x*(1-x)}function h(x){return 3*x*(1-x)*(1-x)}function y(x){return(1-x)*(1-x)*(1-x)}const v=u*f(e)+o*p(e)+i*h(e)+r*y(e),b=d*f(e)+s*p(e)+a*h(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 d(y){return 2*y*(1-y)}function f(y){return(1-y)*(1-y)}const p=o*u(e)+i*d(e)+r*f(e),h=s*u(e)+a*d(e)+n*f(e);return{x:p,y:h}}static getPointOnEllipticalArc(e,r,n,i,a,o){const s=Math.cos(o),u=Math.sin(o),d={x:n*Math.cos(a),y:i*Math.sin(a)};return{x:e+(d.x*s-d.y*u),y:r+(d.x*u+d.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 p=0;p<n.length;p++)r=r.replace(new RegExp(n[p],"g"),"|"+n[p]);const i=r.split("|"),a=[],o=[];let s=0,u=0;const d=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let f;for(let p=1;p<i.length;p++){let h=i[p],y=h.charAt(0);for(h=h.slice(1),o.length=0;f=d.exec(h);)o.push(f[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,M,R,N,B,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(),G=v.shift();if(s+=$,u+=G,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]+G;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(),M=v.shift(),R=v.shift(),N=v.shift(),B=s,H=u,s=v.shift(),u=v.shift(),x="A",k=this.convertEndpointToCenterParameterization(B,H,s,u,R,N,T,I,M);break;case"a":T=v.shift(),I=v.shift(),M=v.shift(),R=v.shift(),N=v.shift(),B=s,H=u,s+=v.shift(),u+=v.shift(),x="A",k=this.convertEndpointToCenterParameterization(B,H,s,u,R,N,T,I,M);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 d=Fi;switch(n){case"L":return d.getLineLength(e,r,i[0],i[1]);case"C":return Dw([e,i[0],i[2],i[4]],[r,i[1],i[3],i[5]],1);case"Q":return Nw([e,i[0],i[2]],[r,i[1],i[3]],1);case"A":a=0;const f=i[4],p=i[5],h=i[4]+p;let y=Math.PI/180;if(Math.abs(f-h)<y&&(y=Math.abs(f-h)),o=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],f,0),p<0)for(u=f-y;u>h;u-=y)s=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=d.getLineLength(o.x,o.y,s.x,s.y),o=s;else for(u=f+y;u<h;u+=y)s=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=d.getLineLength(o.x,o.y,s.x,s.y),o=s;return s=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),a+=d.getLineLength(o.x,o.y,s.x,s.y),a}return 0}static convertEndpointToCenterParameterization(e,r,n,i,a,o,s,u,d){const f=d*(Math.PI/180),p=Math.cos(f)*(e-n)/2+Math.sin(f)*(r-i)/2,h=-1*Math.sin(f)*(e-n)/2+Math.cos(f)*(r-i)/2,y=p*p/(s*s)+h*h/(u*u);y>1&&(s*=Math.sqrt(y),u*=Math.sqrt(y));let v=Math.sqrt((s*s*(u*u)-s*s*(h*h)-u*u*(p*p))/(s*s*(h*h)+u*u*(p*p)));a===o&&(v*=-1),isNaN(v)&&(v=0);const b=v*s*h/u,x=v*-u*p/s,k=(e+n)/2+Math.cos(f)*b-Math.sin(f)*x,S=(r+i)/2+Math.sin(f)*b+Math.cos(f)*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],[(p-b)/s,(h-x)/u]),T=[(p-b)/s,(h-x)/u],I=[(-1*p-b)/s,(-1*h-x)/u];let M=E(T,I);return _(T,I)<=-1&&(M=Math.PI),_(T,I)>=1&&(M=0),o===0&&M>0&&(M=M-2*Math.PI),o===1&&M<0&&(M=M+2*Math.PI),[k,S,s,u,A,M,f,o]}};Ra.prototype.className="Path";Ra.prototype._attrsAffectingSize=["data"];Kr(Ra);fe.addGetterSetter(Ra,"data");class Nc extends el{_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,d;if(a){const h=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],n[s-2],n[s-1]],y=Ra.calcLength(i[i.length-4],i[i.length-3],"C",h),v=Ra.getPointOnQuadraticBezier(Math.min(1,1-o/y),h[0],h[1],h[2],h[3],h[4],h[5]);u=n[s-2]-v.x,d=n[s-1]-v.y}else u=n[s-2]-n[s-4],d=n[s-1]-n[s-3];const f=(Math.atan2(d,u)+r)%r,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(f),e.moveTo(0,0),e.lineTo(-o,p/2),e.lineTo(-o,-p/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],d=(i[1]+i[3])/2-n[1]):(u=n[2]-n[0],d=n[3]-n[1]),e.rotate((Math.atan2(-d,-u)+r)%r),e.moveTo(0,0),e.lineTo(-o,p/2),e.lineTo(-o,-p/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}}}Nc.prototype.className="Arrow";Kr(Nc);fe.addGetterSetter(Nc,"pointerLength",10,Ze());fe.addGetterSetter(Nc,"pointerWidth",10,Ze());fe.addGetterSetter(Nc,"pointerAtBeginning",!1);fe.addGetterSetter(Nc,"pointerAtEnding",!0);let Id=class extends Ge{_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)}};Id.prototype._centroid=!0;Id.prototype.className="Circle";Id.prototype._attrsAffectingSize=["radius"];Kr(Id);fe.addGetterSetter(Id,"radius",0,Ze());class wu extends Ge{_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)}}wu.prototype.className="Ellipse";wu.prototype._centroid=!0;wu.prototype._attrsAffectingSize=["radiusX","radiusY"];Kr(wu);fe.addComponentsGetterSetter(wu,"radius",["x","y"]);fe.addGetterSetter(wu,"radiusX",0,Ze());fe.addGetterSetter(wu,"radiusY",0,Ze());let fo=class S5 extends Ge{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?Te.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?Te.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=Te.createImageElement();i.onload=function(){const a=new S5({image:i});r(a)},i.onerror=n,i.crossOrigin="Anonymous",i.src=e}};fo.prototype.className="Image";fo.prototype._attrsAffectingSize=["image"];Kr(fo);fe.addGetterSetter(fo,"cornerRadius",0,v0(4));fe.addGetterSetter(fo,"image");fe.addComponentsGetterSetter(fo,"crop",["x","y","width","height"]);fe.addGetterSetter(fo,"cropX",0,Ze());fe.addGetterSetter(fo,"cropY",0,Ze());fe.addGetterSetter(fo,"cropWidth",0,Ze());fe.addGetterSetter(fo,"cropHeight",0,Ze());const k5=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],PE="Change.konva",EE="none",jv="up",Uv="right",Hv="down",$v="left",TE=k5.length;let A2=class extends Sd{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<TE;n++)e.on(k5[n]+PE,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,d;if(e&&r){switch(n=e.width(),i=e.height(),a=r.pointerDirection(),o=r.pointerWidth(),d=r.pointerHeight(),s=0,u=0,a){case jv:s=n/2,u=-1*d;break;case Uv:s=n+o,u=i/2;break;case Hv:s=n/2,u=i+d;break;case $v: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})}}};A2.prototype.className="Label";Kr(A2);let Lc=class extends Ge{_sceneFunc(e){const r=this.width(),n=this.height(),i=this.pointerDirection(),a=this.pointerWidth(),o=this.pointerHeight(),s=this.cornerRadius();let u=0,d=0,f=0,p=0;typeof s=="number"?u=d=f=p=Math.min(s,r/2,n/2):(u=Math.min(s[0]||0,r/2,n/2),d=Math.min(s[1]||0,r/2,n/2),p=Math.min(s[2]||0,r/2,n/2),f=Math.min(s[3]||0,r/2,n/2)),e.beginPath(),e.moveTo(u,0),i===jv&&(e.lineTo((r-a)/2,0),e.lineTo(r/2,-1*o),e.lineTo((r+a)/2,0)),e.lineTo(r-d,0),e.arc(r-d,d,d,Math.PI*3/2,0,!1),i===Uv&&(e.lineTo(r,(n-o)/2),e.lineTo(r+a,n/2),e.lineTo(r,(n+o)/2)),e.lineTo(r,n-p),e.arc(r-p,n-p,p,0,Math.PI/2,!1),i===Hv&&(e.lineTo((r+a)/2,n),e.lineTo(r/2,n+o),e.lineTo((r-a)/2,n)),e.lineTo(f,n),e.arc(f,n-f,f,Math.PI/2,Math.PI,!1),i===$v&&(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===jv?(r-=i,s+=i):a===Hv?s+=i:a===$v?(e-=n*1.5,o+=n):a===Uv&&(o+=n*1.5),{x:e,y:r,width:o,height:s}}};Lc.prototype.className="Tag";Kr(Lc);fe.addGetterSetter(Lc,"pointerDirection",EE);fe.addGetterSetter(Lc,"pointerWidth",0,Ze());fe.addGetterSetter(Lc,"pointerHeight",0,Ze());fe.addGetterSetter(Lc,"cornerRadius",0,v0(4));let zp=class extends Ge{_sceneFunc(e){const r=this.cornerRadius(),n=this.width(),i=this.height();e.beginPath(),r?Te.drawRoundedRectPath(e,n,i,r):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}};zp.prototype.className="Rect";Kr(zp);fe.addGetterSetter(zp,"cornerRadius",0,v0(4));class xu extends Ge{_sceneFunc(e){const r=this._getPoints(),n=this.radius(),i=this.sides(),a=this.cornerRadius();if(e.beginPath(),a)Te.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)}}xu.prototype.className="RegularPolygon";xu.prototype._centroid=!0;xu.prototype._attrsAffectingSize=["radius"];Kr(xu);fe.addGetterSetter(xu,"radius",0,Ze());fe.addGetterSetter(xu,"sides",0,Ze());fe.addGetterSetter(xu,"cornerRadius",0,v0(4));const Fw=Math.PI*2;class Fc extends Ge{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Fw,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Fw,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)}}Fc.prototype.className="Ring";Fc.prototype._centroid=!0;Fc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Kr(Fc);fe.addGetterSetter(Fc,"innerRadius",0,Ze());fe.addGetterSetter(Fc,"outerRadius",0,Ze());class rs extends Ge{constructor(e){super(e),this._updated=!0,this.anim=new Ad(()=>{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],d=a[i+2],f=a[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,d,f),e.closePath(),e.fillStrokeShape(this)),p)if(o){const h=o[r],y=n*2;e.drawImage(p,s,u,d,f,h[y+0],h[y+1],d,f)}else e.drawImage(p,s,u,d,f,0,0,d,f)}_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 d=o[r],f=n*2;e.rect(d[f+0],d[f+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)}}rs.prototype.className="Sprite";Kr(rs);fe.addGetterSetter(rs,"animation");fe.addGetterSetter(rs,"animations");fe.addGetterSetter(rs,"frameOffsets");fe.addGetterSetter(rs,"image");fe.addGetterSetter(rs,"frameIndex",0,Ze());fe.addGetterSetter(rs,"frameRate",17,Ze());fe.backCompat(rs,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Su extends Ge{_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)}}Su.prototype.className="Star";Su.prototype._centroid=!0;Su.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Kr(Su);fe.addGetterSetter(Su,"numPoints",5,Ze());fe.addGetterSetter(Su,"innerRadius",0,Ze());fe.addGetterSetter(Su,"outerRadius",0,Ze());function Jl(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 Uf="auto",CE="center",_5="inherit",Mh="justify",OE="Change.konva",AE="2d",Bw="-",P5="left",IE="text",RE="Text",ME="top",DE="bottom",zw="middle",E5="normal",NE="px ",sg=" ",LE="right",jw="rtl",FE="word",BE="char",Uw="none",I1="…",T5=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],zE=T5.length;function jE(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 lg;function R1(){return lg||(lg=Te.createCanvasElement().getContext(AE),lg)}function UE(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function HE(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function $E(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let Nr=class extends Ge{constructor(e){super($E(e)),this._partialTextX=0,this._partialTextY=0;for(let r=0;r<zE;r++)this.on(T5[r]+OE,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,d=this.verticalAlign(),f=this.direction(),p=0,h=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;f=f===_5?e.direction:f;let A=u/2,T=zw;if(!et.legacyTextRendering){const I=this.measureSize("M");T="alphabetic";const M=(r=I.fontBoundingBoxAscent)!==null&&r!==void 0?r:I.actualBoundingBoxAscent,R=(n=I.fontBoundingBoxDescent)!==null&&n!==void 0?n:I.actualBoundingBoxDescent;A=(M-R)/2+u/2}for(f===jw&&e.setAttr("direction",f),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",T),e.setAttr("textAlign",P5),d===zw?p=(this.getHeight()-a*u-o*2)/2:d===DE&&(p=this.getHeight()-a*u-o*2),e.translate(o,p+o),E=0;E<a;E++){let I=0,M=0;const R=i[E],N=R.text,B=R.width,H=R.lastInParagraph;if(e.save(),h===LE?I+=y-B-o*2:h===CE&&(I+=(y-B-o*2)/2),P){e.save(),e.beginPath();const G=S??(et.legacyTextRendering?Math.round(s/2):Math.round(s/4)),Z=I,J=A+M+G;e.moveTo(Z,J);const q=h===Mh&&!H?y-o*2:B;e.lineTo(Z+Math.round(q),J),e.lineWidth=s/15;const Q=this._getLinearGradient();e.strokeStyle=Q||x,e.stroke(),e.restore()}const $=I;if(f!==jw&&(v!==0||h===Mh||b)){const G=N.split(" ").length-1,Z=Jl(N);for(let J=0;J<Z.length;J++){const q=Z[J];if(q===" "&&!H&&h===Mh&&(I+=(y-o*2-B)/G),this._partialTextX=I,this._partialTextY=A+M,this._partialText=q,b){e.save();const U=i.slice(0,E).reduce((W,V)=>W+Jl(V.text).length,0),L=J+U;b({char:q,index:L,x:I,y:A+M,lineIndex:E,column:J,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+M,this._partialText=N,e.fillStrokeShape(this);if(_){e.save(),e.beginPath();const G=et.legacyTextRendering?0:-Math.round(s/4),Z=$;e.moveTo(Z,A+M+G);const J=h===Mh&&!H?y-o*2:B;e.lineTo(Z+Math.round(J),A+M+G),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=Te._isString(e)?e:e==null?"":e+"";return this._setAttr(IE,r),this}getWidth(){return this.attrs.width===Uf||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Uf||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Te.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,d,f,p,h;let y=R1(),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:(d=b.fontBoundingBoxAscent)!==null&&d!==void 0?d:91*x,fontBoundingBoxDescent:(f=b.fontBoundingBoxDescent)!==null&&f!==void 0?f:21*x,hangingBaseline:(p=b.hangingBaseline)!==null&&p!==void 0?p:72.80000305175781*x,ideographicBaseline:(h=b.ideographicBaseline)!==null&&h!==void 0?h:-21*x,width:b.width,height:v}}_getContextFont(){return this.fontStyle()+sg+this.fontVariant()+sg+(this.fontSize()+NE)+jE(this.fontFamily())}_addTextLine(e){this.align()===Mh&&(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 R1().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!==Uf&&a!==void 0,u=o!==Uf&&o!==void 0,d=this.padding(),f=a-d*2,p=o-d*2,h=0,y=this.wrap(),v=y!==Uw,b=y!==BE&&v,x=this.ellipsis();this.textArr=[],R1().font=this._getContextFont();const k=x?this._getTextWidth(I1):0;for(let S=0,P=e.length;S<P;++S){let _=e[S],E=this._getTextWidth(_);if(s&&E>f)for(;_.length>0;){let A=0,T=Jl(_).length,I="",M=0;for(;A<T;){const R=A+T>>>1,N=Jl(_),B=N.slice(0,R+1).join(""),H=this._getTextWidth(B);(x&&u&&h+i>p?H+k:H)<=f?(A=R+1,I=B,M=H):T=R}if(I){if(b){const B=Jl(_),H=Jl(I),$=B[H.length],G=$===sg||$===Bw;let Z;if(G&&M<=f)Z=H.length;else{const J=H.lastIndexOf(sg),q=H.lastIndexOf(Bw);Z=Math.max(J,q)+1}Z>0&&(A=Z,I=B.slice(0,A).join(""),M=this._getTextWidth(I))}if(I=I.trimRight(),this._addTextLine(I),n=Math.max(n,M),h+=i,this._shouldHandleEllipsis(h)){this._tryToAddEllipsisToLastLine();break}if(_=Jl(_).slice(A).join("").trimLeft(),_.length>0&&(E=this._getTextWidth(_),E<=f)){this._addTextLine(_),h+=i,n=Math.max(n,E);break}}else break}else this._addTextLine(_),h+=i,n=Math.max(n,E),this._shouldHandleEllipsis(h)&&S<P-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),u&&h+i>p)break}this.textHeight=r,this.textWidth=n}_shouldHandleEllipsis(e){const r=+this.fontSize(),n=this.lineHeight()*r,i=this.attrs.height,a=i!==Uf&&i!==void 0,o=this.padding(),s=i-o*2;return!(this.wrap()!==Uw)||a&&e+n>s}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,r=e!==Uf&&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+I1)<i||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+I1))}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()}};Nr.prototype._fillFunc=UE;Nr.prototype._strokeFunc=HE;Nr.prototype.className=RE;Nr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];Kr(Nr);fe.overWriteSetter(Nr,"width",T2());fe.overWriteSetter(Nr,"height",T2());fe.addGetterSetter(Nr,"direction",_5);fe.addGetterSetter(Nr,"fontFamily","Arial");fe.addGetterSetter(Nr,"fontSize",12,Ze());fe.addGetterSetter(Nr,"fontStyle",E5);fe.addGetterSetter(Nr,"fontVariant",E5);fe.addGetterSetter(Nr,"padding",0,Ze());fe.addGetterSetter(Nr,"align",P5);fe.addGetterSetter(Nr,"verticalAlign",ME);fe.addGetterSetter(Nr,"lineHeight",1,Ze());fe.addGetterSetter(Nr,"wrap",FE);fe.addGetterSetter(Nr,"ellipsis",!1,co());fe.addGetterSetter(Nr,"letterSpacing",0,Ze());fe.addGetterSetter(Nr,"text","",Mc());fe.addGetterSetter(Nr,"textDecoration","");fe.addGetterSetter(Nr,"underlineOffset",void 0,Ze());fe.addGetterSetter(Nr,"charRenderFunc",void 0);const qE="",C5="normal";function O5(t){t.fillText(this.partialText,0,0)}function A5(t){t.strokeText(this.partialText,0,0)}let En=class extends Ge{constructor(e){super(e),this.dummyCanvas=Te.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 Ra.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const r=this.pathLength;return e>r?null:Ra.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Ra.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 d=a[u].p0;e.translate(d.x,d.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 d=a[u].p0;e.translate(d.x,d.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 Te.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Nr.prototype.setText.call(this,e)}_getContextFont(){return Nr.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=Jl(this.text()),r=[];let n=0;for(let p=0;p<e.length;p++)r.push({char:e[p],width:this._getTextSize(e[p]).width}),n+=r[p].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 d=0;o==="center"&&(d=Math.max(0,this.pathLength/2-u/2)),o==="right"&&(d=Math.max(0,this.pathLength-u));let f=d;for(let p=0;p<r.length;p++){const h=this._getPointAtLength(f);if(!h)return;const y=r[p].char;let v=r[p].width+a;if(y===" "&&o==="justify"){const _=this.text().split(" ").length-1;v+=(this.pathLength-u)/_}const b=this._getPointAtLength(f+v);if(!b)return;const x=Ra.getLineLength(h.x,h.y,b.x,b.y);let k=0;if(s)try{k=s(r[p-1].char,y)*this.fontSize()}catch{k=0}h.x+=k,b.x+=k,this.textWidth+=k;const S=Ra.getPointOnLine(k+x/2,h.x,h.y,b.x,b.y),P=Math.atan2(b.y-h.y,b.x-h.x);this.glyphInfo.push({transposeX:S.x,transposeY:S.y,text:e[p],rotation:P,p0:h,p1:b,width:x}),f+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(d){e.push(d.p0.x),e.push(d.p0.y),e.push(d.p1.x),e.push(d.p1.y)});let r=e[0]||0,n=e[0]||0,i=e[1]||0,a=e[1]||0,o,s;for(let d=0;d<e.length/2;d++)o=e[d*2],s=e[d*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 Te.releaseCanvas(this.dummyCanvas),super.destroy()}};En.prototype._fillFunc=O5;En.prototype._strokeFunc=A5;En.prototype._fillFuncHit=O5;En.prototype._strokeFuncHit=A5;En.prototype.className="TextPath";En.prototype._attrsAffectingSize=["text","fontSize","data"];Kr(En);fe.addGetterSetter(En,"data");fe.addGetterSetter(En,"fontFamily","Arial");fe.addGetterSetter(En,"fontSize",12,Ze());fe.addGetterSetter(En,"fontStyle",C5);fe.addGetterSetter(En,"align","left");fe.addGetterSetter(En,"letterSpacing",0,Ze());fe.addGetterSetter(En,"textBaseline","middle");fe.addGetterSetter(En,"fontVariant",C5);fe.addGetterSetter(En,"text",qE);fe.addGetterSetter(En,"textDecoration","");fe.addGetterSetter(En,"kerningFunc",void 0);const I5="tr-konva",VE=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${I5}`).join(" "),Hw="nodesRect",WE=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],GE={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},XE="ontouchstart"in et._global;function YE(t,e,r){if(t==="rotater")return r;e+=Te.degToRad(GE[t]||0);const n=(Te.radToDeg(e)%360+360)%360;return Te._inRange(n,315+22.5,360)||Te._inRange(n,0,22.5)?"ns-resize":Te._inRange(n,45-22.5,45+22.5)?"nesw-resize":Te._inRange(n,90-22.5,90+22.5)?"ew-resize":Te._inRange(n,135-22.5,135+22.5)?"nwse-resize":Te._inRange(n,180-22.5,180+22.5)?"ns-resize":Te._inRange(n,225-22.5,225+22.5)?"nesw-resize":Te._inRange(n,270-22.5,270+22.5)?"ew-resize":Te._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Te.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}const Ug=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function KE(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 R5(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 QE(t,e){const r=KE(t);return R5(t,e,r)}function ZE(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 qv=0,Qt=class extends Sd{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(VE,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Te.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 I5+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const r=e.filter(i=>i.isAncestorOf(this)?(Te.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(WE.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(Hw),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Hw,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,d=(et.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),f={x:o.x+s*Math.cos(d)+u*Math.sin(-d),y:o.y+u*Math.cos(d)+s*Math.sin(d),width:i.width*a.x,height:i.height*a.y,rotation:d};return R5(f,-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(d=>{const f=d.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),p=[{x:f.x,y:f.y},{x:f.x+f.width,y:f.y},{x:f.x+f.width,y:f.y+f.height},{x:f.x,y:f.y+f.height}],h=d.getAbsoluteTransform();p.forEach(function(y){const v=h.point(y);r.push(v)})});const n=new sa;n.rotate(-et.getAngle(this.rotation()));let i=1/0,a=1/0,o=-1/0,s=-1/0;r.forEach(function(d){const f=n.point(d);i===void 0&&(i=o=f.x,a=s=f.y),i=Math.min(i,f.x),a=Math.min(a,f.y),o=Math.max(o,f.x),s=Math.max(s,f.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(),Ug.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const r=new zp({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:XE?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=YE(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 Ge({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(),d=i.rotateAnchorOffset(),f=Te.degToRad(u),p=Math.sin(f),h=-Math.cos(f),y=o/2,v=s/2;let b=1/0;h<0?b=Math.min(b,-v/h):h>0&&(b=Math.min(b,(s-v)/h)),p<0?b=Math.min(b,-y/p):p>0&&(b=Math.min(b,(o-y)/p));const x=y+p*b,k=v+h*b,S=Te._sign(s),P=x+p*d*S,_=k+h*d*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},qv++,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 d=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(u=this.anchorDragBoundFunc()(d,u,e)),a.setAbsolutePosition(u);const f=a.getAbsolutePosition();if(d.x===f.x&&d.y===f.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()),M=ZE(this.rotationSnaps(),A,T)-S.rotation,R=QE(S,M);this._fitNodesInto(R,e);return}const p=this.shiftBehavior();let h;p==="inverted"?h=this.keepRatio()&&!e.shiftKey:p==="none"?h=this.keepRatio():h=this.keepRatio()||e.shiftKey;let y=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(h){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(h){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(h){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(h){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();qv--,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(Te._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(Te._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=new sa;if(a.rotate(et.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const h=a.point({x:-this.padding()*2,y:0});e.x+=h.x,e.y+=h.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const h=a.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const h=a.point({x:0,y:-this.padding()*2});e.x+=h.x,e.y+=h.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const h=a.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const h=this.boundBoxFunc()(n,e);h?e=h:Te.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,s=new sa;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/o,n.height/o);const u=new sa,d=e.width/o,f=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(d),Math.abs(f))):(u.translate(e.x,e.y),u.rotate(e.rotation),u.scale(d,f));const p=u.multiply(s.invert());this._nodes.forEach(h=>{var y;if(!h.getStage())return;const v=h.getParent().getAbsoluteTransform(),b=h.getTransform().copy();b.translate(h.offsetX(),h.offsetY());const x=new sa;x.multiply(v.copy().invert()).multiply(p).multiply(v).multiply(b);const k=x.decompose();h.setAttrs(k),(y=h.getLayer())===null||y===void 0||y.batchDraw()}),this.rotation(Te._getRotation(e.rotation)),this._nodes.forEach(h=>{this._fire("transform",{evt:r,target:h}),h._fire("transform",{evt:r,target:h})}),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(Te._getRotation(r.rotation));const n=r.width,i=r.height,a=this.enabledAnchors(),o=this.resizeEnabled(),s=this.padding(),u=this.anchorSize(),d=this.find("._anchor");d.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 f=this.rotateAnchorAngle(),p=this.rotateAnchorOffset(),h=Te.degToRad(f),y=Math.sin(h),v=-Math.cos(h),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,_=Te._sign(i);this._batchChangeChild(".rotater",{x:S+y*p*_,y:P+v*p*_-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&&d.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=""),Sd.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}}};Qt.isTransforming=()=>qv>0;function JE(t){return t instanceof Array||Te.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){Ug.indexOf(e)===-1&&Te.warn("Unknown anchor name: "+e+". Available names are: "+Ug.join(", "))}),t||[]}Qt.prototype.className="Transformer";Kr(Qt);fe.addGetterSetter(Qt,"enabledAnchors",Ug,JE);fe.addGetterSetter(Qt,"flipEnabled",!0,co());fe.addGetterSetter(Qt,"resizeEnabled",!0);fe.addGetterSetter(Qt,"anchorSize",10,Ze());fe.addGetterSetter(Qt,"rotateEnabled",!0);fe.addGetterSetter(Qt,"rotateLineVisible",!0);fe.addGetterSetter(Qt,"rotationSnaps",[]);fe.addGetterSetter(Qt,"rotateAnchorOffset",50,Ze());fe.addGetterSetter(Qt,"rotateAnchorAngle",0,Ze());fe.addGetterSetter(Qt,"rotateAnchorCursor","crosshair");fe.addGetterSetter(Qt,"rotationSnapTolerance",5,Ze());fe.addGetterSetter(Qt,"borderEnabled",!0);fe.addGetterSetter(Qt,"anchorStroke","rgb(0, 161, 255)");fe.addGetterSetter(Qt,"anchorStrokeWidth",1,Ze());fe.addGetterSetter(Qt,"anchorFill","white");fe.addGetterSetter(Qt,"anchorCornerRadius",0,Ze());fe.addGetterSetter(Qt,"borderStroke","rgb(0, 161, 255)");fe.addGetterSetter(Qt,"borderStrokeWidth",1,Ze());fe.addGetterSetter(Qt,"borderDash");fe.addGetterSetter(Qt,"keepRatio",!0);fe.addGetterSetter(Qt,"shiftBehavior","default");fe.addGetterSetter(Qt,"centeredScaling",!1);fe.addGetterSetter(Qt,"ignoreStroke",!1);fe.addGetterSetter(Qt,"padding",0,Ze());fe.addGetterSetter(Qt,"nodes");fe.addGetterSetter(Qt,"node");fe.addGetterSetter(Qt,"boundBoxFunc");fe.addGetterSetter(Qt,"anchorDragBoundFunc");fe.addGetterSetter(Qt,"anchorStyleFunc");fe.addGetterSetter(Qt,"shouldOverdrawWholeArea",!1);fe.addGetterSetter(Qt,"useSingleNodeRotation",!0);fe.backCompat(Qt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class tl extends Ge{_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)}}tl.prototype.className="Wedge";tl.prototype._centroid=!0;tl.prototype._attrsAffectingSize=["radius"];Kr(tl);fe.addGetterSetter(tl,"radius",0,Ze());fe.addGetterSetter(tl,"angle",0,Ze());fe.addGetterSetter(tl,"clockwise",!1);fe.backCompat(tl,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function $w(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const e7=[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],t7=[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 r7(t,e){const r=t.data,n=t.width,i=t.height;let a,o,s,u,d,f,p,h,y,v,b,x,k,S,P,_,E,A,T,I;const M=e+e+1,R=n-1,N=i-1,B=e+1,H=B*(B+1)/2,$=new $w,G=e7[e],Z=t7[e];let J=null,q=$,Q=null,U=null;for(let L=1;L<M;L++)q=q.next=new $w,L===B&&(J=q);q.next=$,s=o=0;for(let L=0;L<i;L++){x=k=S=P=u=d=f=p=0,h=B*(_=r[o]),y=B*(E=r[o+1]),v=B*(A=r[o+2]),b=B*(T=r[o+3]),u+=H*_,d+=H*E,f+=H*A,p+=H*T,q=$;for(let W=0;W<B;W++)q.r=_,q.g=E,q.b=A,q.a=T,q=q.next;for(let W=1;W<B;W++)a=o+((R<W?R:W)<<2),u+=(q.r=_=r[a])*(I=B-W),d+=(q.g=E=r[a+1])*I,f+=(q.b=A=r[a+2])*I,p+=(q.a=T=r[a+3])*I,x+=_,k+=E,S+=A,P+=T,q=q.next;Q=$,U=J;for(let W=0;W<n;W++)r[o+3]=T=p*G>>Z,T!==0?(T=255/T,r[o]=(u*G>>Z)*T,r[o+1]=(d*G>>Z)*T,r[o+2]=(f*G>>Z)*T):r[o]=r[o+1]=r[o+2]=0,u-=h,d-=y,f-=v,p-=b,h-=Q.r,y-=Q.g,v-=Q.b,b-=Q.a,a=s+((a=W+e+1)<R?a:R)<<2,x+=Q.r=r[a],k+=Q.g=r[a+1],S+=Q.b=r[a+2],P+=Q.a=r[a+3],u+=x,d+=k,f+=S,p+=P,Q=Q.next,h+=_=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 L=0;L<n;L++){k=S=P=x=d=f=p=u=0,o=L<<2,h=B*(_=r[o]),y=B*(E=r[o+1]),v=B*(A=r[o+2]),b=B*(T=r[o+3]),u+=H*_,d+=H*E,f+=H*A,p+=H*T,q=$;for(let V=0;V<B;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+L<<2,u+=(q.r=_=r[o])*(I=B-V),d+=(q.g=E=r[o+1])*I,f+=(q.b=A=r[o+2])*I,p+=(q.a=T=r[o+3])*I,x+=_,k+=E,S+=A,P+=T,q=q.next,V<N&&(W+=n);o=L,Q=$,U=J;for(let V=0;V<i;V++)a=o<<2,r[a+3]=T=p*G>>Z,T>0?(T=255/T,r[a]=(u*G>>Z)*T,r[a+1]=(d*G>>Z)*T,r[a+2]=(f*G>>Z)*T):r[a]=r[a+1]=r[a+2]=0,u-=h,d-=y,f-=v,p-=b,h-=Q.r,y-=Q.g,v-=Q.b,b-=Q.a,a=L+((a=V+B)<N?a:N)*n<<2,u+=x+=Q.r=r[a],d+=k+=Q.g=r[a+1],f+=S+=Q.b=r[a+2],p+=P+=Q.a=r[a+3],Q=Q.next,h+=_=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 n7=function(e){const r=Math.round(this.blurRadius());r>0&&r7(e,r)};fe.addGetterSetter(Je,"blurRadius",0,Ze(),fe.afterSetFilter);const i7=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,Ze(),fe.afterSetFilter);const a7=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)},o7=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,Ze(),fe.afterSetFilter);const s7=function(t){var e,r,n,i,a,o,s,u,d;const f=t.data,p=t.width,h=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=!!((d=(u=this.embossBlend)===null||u===void 0?void 0:u.call(this))!==null&&d!==void 0&&d),S=y*10,P=v*255,_=x*Math.PI/180,E=Math.cos(_),A=Math.sin(_),T=128/1020*S,I=new Uint8ClampedArray(f),M=new Float32Array(p*h);for(let $=0,G=0;G<f.length;G+=4,$++)M[$]=.2126*I[G]+.7152*I[G+1]+.0722*I[G+2];const R=[-1,0,1,-2,0,2,-1,0,1],N=[-1,-2,-1,0,0,0,1,2,1],B=[-p-1,-p,-p+1,-1,0,1,p-1,p,p+1],H=$=>$<0?0:$>255?255:$;for(let $=1;$<h-1;$++)for(let G=1;G<p-1;G++){const Z=$*p+G;let J=0,q=0;J+=M[Z+B[0]]*R[0],q+=M[Z+B[0]]*N[0],J+=M[Z+B[1]]*R[1],q+=M[Z+B[1]]*N[1],J+=M[Z+B[2]]*R[2],q+=M[Z+B[2]]*N[2],J+=M[Z+B[3]]*R[3],q+=M[Z+B[3]]*N[3],J+=M[Z+B[5]]*R[5],q+=M[Z+B[5]]*N[5],J+=M[Z+B[6]]*R[6],q+=M[Z+B[6]]*N[6],J+=M[Z+B[7]]*R[7],q+=M[Z+B[7]]*N[7],J+=M[Z+B[8]]*R[8],q+=M[Z+B[8]]*N[8];const Q=E*J+A*q,U=H(P+Q*T),L=Z*4;if(k){const W=U-P;f[L]=H(I[L]+W),f[L+1]=H(I[L+1]+W),f[L+2]=H(I[L+2]+W),f[L+3]=I[L+3]}else f[L]=f[L+1]=f[L+2]=U,f[L+3]=I[L+3]}for(let $=0;$<p;$++){let G=$*4,Z=((h-1)*p+$)*4;f[G]=I[G],f[G+1]=I[G+1],f[G+2]=I[G+2],f[G+3]=I[G+3],f[Z]=I[Z],f[Z+1]=I[Z+1],f[Z+2]=I[Z+2],f[Z+3]=I[Z+3]}for(let $=1;$<h-1;$++){let G=$*p*4,Z=($*p+(p-1))*4;f[G]=I[G],f[G+1]=I[G+1],f[G+2]=I[G+2],f[G+3]=I[G+3],f[Z]=I[Z],f[Z+1]=I[Z+1],f[Z+2]=I[Z+2],f[Z+3]=I[Z+3]}return t};fe.addGetterSetter(Je,"embossStrength",.5,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"embossWhiteLevel",.5,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"embossDirection","top-left",void 0,fe.afterSetFilter);fe.addGetterSetter(Je,"embossBlend",!1,void 0,fe.afterSetFilter);function M1(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 l7=function(t){const e=t.data,r=e.length;let n=e[0],i=n,a,o=e[1],s=o,u,d=e[2],f=d,p;const h=this.enhance();if(h===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),p=e[P+2],p<d?d=p:p>f&&(f=p);i===n&&(i=255,n=0),s===o&&(s=255,o=0),f===d&&(f=255,d=0);let y,v,b,x,k,S;if(h>0)y=i+h*(255-i),v=n-h*(n-0),b=s+h*(255-s),x=o-h*(o-0),k=f+h*(255-f),S=d-h*(d-0);else{const P=(i+n)*.5;y=i+h*(i-P),v=n+h*(n-P);const _=(s+o)*.5;b=s+h*(s-_),x=o+h*(o-_);const E=(f+d)*.5;k=f+h*(f-E),S=d+h*(d-E)}for(let P=0;P<r;P+=4)e[P+0]=M1(e[P+0],n,i,v,y),e[P+1]=M1(e[P+1],o,s,x,b),e[P+2]=M1(e[P+2],d,f,S,k)};fe.addGetterSetter(Je,"enhance",0,Ze(),fe.afterSetFilter);const u7=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,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"saturation",0,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"luminance",0,Ze(),fe.afterSetFilter);const c7=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),d=.299*n+.701*s+.167*u,f=.587*n-.587*s+.33*u,p=.114*n-.114*s-.497*u,h=.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]=d*S+f*P+p*_+o,e[A+1]=h*S+y*P+v*_+o,e[A+2]=b*S+x*P+k*_+o,e[A+3]=E},f7=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,d=.587*n-.587*o+.33*s,f=.114*n-.114*o-.497*s,p=.299*n-.299*o-.328*s,h=.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+d*P+f*_,e[k+1]=p*S+h*P+y*_,e[k+2]=v*S+b*P+x*_,e[k+3]=E}};fe.addGetterSetter(Je,"hue",0,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"saturation",0,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"value",0,Ze(),fe.afterSetFilter);const d7=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]},h7=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 d=Math.sqrt(s*s+u*u),f=a-s,p=o-u;const h=Math.sqrt(f*f+p*p);d=h>d?h:d;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){f=Math.floor(s+d*P/y*S),p=Math.floor(u+d*P/y*k);let _=(p*a+f)*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}}},p7=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 d=Math.sqrt(s*s+u*u),f=a-s,p=o-u;const h=Math.sqrt(f*f+p*p);d=h>d?h:d;const y=o,v=a,b=0;let x,k;for(f=0;f<a;f+=1)for(p=0;p<o;p+=1){const S=f-s,P=p-u,_=Math.sqrt(S*S+P*P)*y/d;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],M=n[A+2],R=n[A+3];A=(p*a+f)*4,i[A+0]=T,i[A+1]=I,i[A+2]=M,i[A+3]=R}},m7=function(t){const e=t.width,r=t.height;let n,i,a,o,s,u,d,f,p,h,y=Math.round(this.kaleidoscopePower());const v=Math.round(this.kaleidoscopeAngle()),b=Math.floor(e*(v%360)/360);if(y<1)return;const x=Te.createCanvasElement();x.width=e,x.height=r;const k=x.getContext("2d").getImageData(0,0,e,r);Te.releaseCanvas(x),h7(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,p=(e*i+a)*4,s=k.data[p+0],u=k.data[p+1],d=k.data[p+2],f=k.data[p+3],h=(e*i+n)*4,k.data[h+0]=s,k.data[h+1]=u,k.data[h+2]=d,k.data[h+3]=f;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)p=(e*i+n)*4,s=k.data[p+0],u=k.data[p+1],d=k.data[p+2],f=k.data[p+3],h=(e*i+P*2-n-1)*4,k.data[h+0]=s,k.data[h+1]=u,k.data[h+2]=d,k.data[h+3]=f;P*=2}p7(k,t,{})};fe.addGetterSetter(Je,"kaleidoscopePower",2,Ze(),fe.afterSetFilter);fe.addGetterSetter(Je,"kaleidoscopeAngle",0,Ze(),fe.afterSetFilter);function ug(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 Dh(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 g7(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 y7(t,e){const r=ug(t,0,0),n=ug(t,t.width-1,0),i=ug(t,0,t.height-1),a=ug(t,t.width-1,t.height-1),o=e||10;if(Dh(r,n)<o&&Dh(n,a)<o&&Dh(a,i)<o&&Dh(i,r)<o){const s=g7([n,r,a,i]),u=[];for(let d=0;d<t.width*t.height;d++){const f=Dh(s,[t.data[d*4],t.data[d*4+1],t.data[d*4+2]]);u[d]=f<o?0:255}return u}}function v7(t,e){for(let r=0;r<t.width*t.height;r++)t.data[4*r+3]=e[r]}function b7(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 d=s*e+u;let f=0;for(let p=0;p<i;p++)for(let h=0;h<i;h++){const y=s+p-a,v=u+h-a;if(y>=0&&y<r&&v>=0&&v<e){const b=y*e+v,x=n[p*i+h];f+=t[b]*x}}o[d]=f===2040?255:0}return o}function w7(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 d=s*e+u;let f=0;for(let p=0;p<i;p++)for(let h=0;h<i;h++){const y=s+p-a,v=u+h-a;if(y>=0&&y<r&&v>=0&&v<e){const b=y*e+v,x=n[p*i+h];f+=t[b]*x}}o[d]=f>=1020?255:0}return o}function x7(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 d=s*e+u;let f=0;for(let p=0;p<i;p++)for(let h=0;h<i;h++){const y=s+p-a,v=u+h-a;if(y>=0&&y<r&&v>=0&&v<e){const b=y*e+v,x=n[p*i+h];f+=t[b]*x}}o[d]=f}return o}const S7=function(t){const e=this.threshold();let r=y7(t,e);return r&&(r=b7(r,t.width,t.height),r=w7(r,t.width,t.height),r=x7(r,t.width,t.height),v7(t,r)),t};fe.addGetterSetter(Je,"threshold",0,Ze(),fe.afterSetFilter);const k7=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,Ze(),fe.afterSetFilter);const _7=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){Te.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 d=0,f=0,p=0,h=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;d+=o[_+0],f+=o[_+1],p+=o[_+2],h+=o[_+3],k+=1}d=d/k,f=f/k,p=p/k,h=h/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]=d,o[_+1]=f,o[_+2]=p,o[_+3]=h}}};fe.addGetterSetter(Je,"pixelSize",8,Ze(),fe.afterSetFilter);const P7=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,Ze(),fe.afterSetFilter);const E7=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,t5,fe.afterSetFilter);const T7=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,t5,fe.afterSetFilter);fe.addGetterSetter(Je,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const C7=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)}},O7=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},A7=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,Ze(),fe.afterSetFilter);const Et=Ec.Util._assign(Ec,{Arc:Js,Arrow:Nc,Circle:Id,Ellipse:wu,Image:fo,Label:A2,Tag:Lc,Line:el,Path:Ra,Rect:zp,RegularPolygon:xu,Ring:Fc,Sprite:rs,Star:Su,Text:Nr,TextPath:En,Transformer:Qt,Wedge:tl,Filters:{Blur:n7,Brightness:a7,Brighten:i7,Contrast:o7,Emboss:s7,Enhance:l7,Grayscale:u7,HSL:c7,HSV:f7,Invert:d7,Kaleidoscope:m7,Mask:S7,Noise:k7,Pixelate:_7,Posterize:P7,RGB:E7,RGBA:T7,Sepia:C7,Solarize:O7,Threshold:A7}});var D1={exports:{}};var N1,qw;function I7(){return qw||(qw=1,N1=function(e){var r={},n=Mp(),i=p2(),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"),d=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),h=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 f:return"Fragment";case d:return"Portal";case h:return"Profiler";case p: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===p?"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 M(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(M(m)!==m)throw Error(o(188))}function N(m){var g=m.alternate;if(!g){if(g=M(m),g===null)throw Error(o(188));return g!==m?null:m}for(var C=m,D=g;;){var z=C.return;if(z===null)break;var Y=z.alternate;if(Y===null){if(D=z.return,D!==null){C=D;continue}break}if(z.child===Y.child){for(Y=z.child;Y;){if(Y===C)return R(z),m;if(Y===D)return R(z),g;Y=Y.sibling}throw Error(o(188))}if(C.return!==D.return)C=z,D=Y;else{for(var ie=!1,Pe=z.child;Pe;){if(Pe===C){ie=!0,C=z,D=Y;break}if(Pe===D){ie=!0,D=z,C=Y;break}Pe=Pe.sibling}if(!ie){for(Pe=Y.child;Pe;){if(Pe===C){ie=!0,C=Y,D=z;break}if(Pe===D){ie=!0,D=Y,C=z;break}Pe=Pe.sibling}if(!ie)throw Error(o(189))}}if(C.alternate!==D)throw Error(o(190))}if(C.tag!==3)throw Error(o(188));return C.stateNode.current===C?m:g}function B(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 G=Array.isArray,Z=e.getPublicInstance,J=e.getRootHostContext,q=e.getChildHostContext,Q=e.prepareForCommit,U=e.resetAfterCommit,L=e.createInstance,W=e.appendInitialChild,V=e.finalizeInitialChildren,ee=e.prepareUpdate,re=e.shouldSetTextContent,K=e.createTextInstance,ne=e.scheduleTimeout,le=e.cancelTimeout,ae=e.noTimeout,ue=e.isPrimaryRenderer,ye=e.supportsMutation,Ie=e.supportsPersistence,Le=e.supportsHydration,Ue=e.getInstanceFromNode,$e=e.preparePortalMount,rt=e.getCurrentEventPriority,Se=e.detachDeletedInstance,de=e.supportsMicrotasks,se=e.scheduleMicrotask,he=e.supportsTestSelectors,Ce=e.findFiberRoot,oe=e.getBoundingRect,ke=e.getTextContent,Oe=e.isHiddenSubtree,Be=e.matchAccessibilityRole,dt=e.setFocusIfFocusable,nt=e.setupIntersectionObserver,xe=e.appendChild,me=e.appendChildToContainer,je=e.commitTextUpdate,ve=e.commitMount,qe=e.commitUpdate,ht=e.insertBefore,gt=e.insertInContainerBefore,At=e.removeChild,be=e.removeChildFromContainer,_e=e.resetTextContent,ze=e.hideInstance,Ye=e.hideTextInstance,xt=e.unhideInstance,ot=e.unhideTextInstance,It=e.clearContainer,Ft=e.cloneInstance,Ht=e.createContainerChildSet,wr=e.appendChildToContainerChildSet,Tr=e.finalizeContainerChildren,mr=e.replaceContainerChildren,zt=e.cloneHiddenInstance,Cr=e.cloneHiddenTextInstance,qr=e.canHydrateInstance,Zn=e.canHydrateTextInstance,Or=e.canHydrateSuspenseInstance,Tn=e.isSuspenseInstancePending,Vr=e.isSuspenseInstanceFallback,Jn=e.getSuspenseInstanceFallbackErrorDetails,Fn=e.registerSuspenseInstanceRetry,Ti=e.getNextHydratableSibling,Vi=e.getFirstHydratableChild,po=e.getFirstHydratableChildWithinContainer,al=e.getFirstHydratableChildWithinSuspenseInstance,Bn=e.hydrateInstance,ns=e.hydrateTextInstance,Ba=e.hydrateSuspenseInstance,mo=e.getNextHydratableInstanceAfterSuspenseInstance,fi=e.commitHydratedContainer,za=e.commitHydratedSuspenseInstance,go=e.clearSuspenseBoundary,yo=e.clearSuspenseBoundaryFromContainer,jc=e.shouldDeleteUnhydratedTailInstances,Fd=e.didNotMatchHydratedContainerTextInstance,rr=e.didNotMatchHydratedTextInstance,ol;function da(m){if(ol===void 0)try{throw Error()}catch(C){var g=C.stack.trim().match(/\n( *(at )?)/);ol=g&&g[1]||""}return`
|
|
25
|
+
`+ol+m}var sl=!1;function ll(m,g){if(!m||sl)return"";sl=!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(Ke){var D=Ke}Reflect.construct(m,[],g)}else{try{g.call()}catch(Ke){D=Ke}m.call(g.prototype)}else{try{throw Error()}catch(Ke){D=Ke}m()}}catch(Ke){if(Ke&&D&&typeof Ke.stack=="string"){for(var z=Ke.stack.split(`
|
|
26
|
+
`),Y=D.stack.split(`
|
|
27
|
+
`),ie=z.length-1,Pe=Y.length-1;1<=ie&&0<=Pe&&z[ie]!==Y[Pe];)Pe--;for(;1<=ie&&0<=Pe;ie--,Pe--)if(z[ie]!==Y[Pe]){if(ie!==1||Pe!==1)do if(ie--,Pe--,0>Pe||z[ie]!==Y[Pe]){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<=Pe);break}}}finally{sl=!1,Error.prepareStackTrace=C}return(m=m?m.displayName||m.name:"")?da(m):""}var F0=Object.prototype.hasOwnProperty,Uc=[],ja=-1;function yn(m){return{current:m}}function xr(m){0>ja||(m.current=Uc[ja],Uc[ja]=null,ja--)}function $t(m,g){ja++,Uc[ja]=m.current,m.current=g}var vo={},Cn=yn(vo),ei=yn(!1),ha=vo;function Ua(m,g){var C=m.type.contextTypes;if(!C)return vo;var D=m.stateNode;if(D&&D.__reactInternalMemoizedUnmaskedChildContext===g)return D.__reactInternalMemoizedMaskedChildContext;var z={},Y;for(Y in C)z[Y]=g[Y];return D&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=g,m.__reactInternalMemoizedMaskedChildContext=z),z}function fn(m){return m=m.childContextTypes,m!=null}function is(){xr(ei),xr(Cn)}function Xp(m,g,C){if(Cn.current!==vo)throw Error(o(168));$t(Cn,g),$t(ei,C)}function Yp(m,g,C){var D=m.stateNode;if(g=g.childContextTypes,typeof D.getChildContext!="function")return C;D=D.getChildContext();for(var z in D)if(!(z in g))throw Error(o(108,I(m)||"Unknown",z));return a({},C,D)}function ul(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||vo,ha=Cn.current,$t(Cn,m),$t(ei,ei.current),!0}function Bd(m,g,C){var D=m.stateNode;if(!D)throw Error(o(169));C?(m=Yp(m,g,ha),D.__reactInternalMemoizedMergedChildContext=m,xr(ei),xr(Cn),$t(Cn,m)):xr(ei),$t(ei,C)}var di=Math.clz32?Math.clz32:zd,Cu=Math.log,B0=Math.LN2;function zd(m){return m>>>=0,m===0?32:31-(Cu(m)/B0|0)|0}var Jt=64,Ou=4194304;function cl(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 fl(m,g){var C=m.pendingLanes;if(C===0)return 0;var D=0,z=m.suspendedLanes,Y=m.pingedLanes,ie=C&268435455;if(ie!==0){var Pe=ie&~z;Pe!==0?D=cl(Pe):(Y&=ie,Y!==0&&(D=cl(Y)))}else ie=C&~z,ie!==0?D=cl(ie):Y!==0&&(D=cl(Y));if(D===0)return 0;if(g!==0&&g!==D&&(g&z)===0&&(z=D&-D,Y=g&-g,z>=Y||z===16&&(Y&4194240)!==0))return g;if((D&4)!==0&&(D|=C&16),g=m.entangledLanes,g!==0)for(m=m.entanglements,g&=D;0<g;)C=31-di(g),z=1<<C,D|=m[C],g&=~z;return D}function Kp(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 Qp(m,g){for(var C=m.suspendedLanes,D=m.pingedLanes,z=m.expirationTimes,Y=m.pendingLanes;0<Y;){var ie=31-di(Y),Pe=1<<ie,Ne=z[ie];Ne===-1?((Pe&C)===0||(Pe&D)!==0)&&(z[ie]=Kp(Pe,g)):Ne<=g&&(m.expiredLanes|=Pe),Y&=~Pe}}function Hc(m){return m=m.pendingLanes&-1073741825,m!==0?m:m&1073741824?1073741824:0}function $c(){var m=Jt;return Jt<<=1,(Jt&4194240)===0&&(Jt=64),m}function dl(m){for(var g=[],C=0;31>C;C++)g.push(m);return g}function Ci(m,g,C){m.pendingLanes|=g,g!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,g=31-di(g),m[g]=C}function bo(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 D=m.eventTimes;for(m=m.expirationTimes;0<C;){var z=31-di(C),Y=1<<z;g[z]=0,D[z]=-1,m[z]=-1,C&=~Y}}function pa(m,g){var C=m.entangledLanes|=g;for(m=m.entanglements;C;){var D=31-di(C),z=1<<D;z&g|m[D]&g&&(m[D]|=g),C&=~z}}var qt=0;function hl(m){return m&=-m,1<m?4<m?(m&268435455)!==0?16:536870912:4:1}var ma=i.unstable_scheduleCallback,Zp=i.unstable_cancelCallback,Jp=i.unstable_shouldYield,Au=i.unstable_requestPaint,dn=i.unstable_now,qc=i.unstable_ImmediatePriority,Vc=i.unstable_UserBlockingPriority,Wc=i.unstable_NormalPriority,z0=i.unstable_IdlePriority,wo=null,ti=null;function pl(m){if(ti&&typeof ti.onCommitFiberRoot=="function")try{ti.onCommitFiberRoot(wo,m,void 0,(m.current.flags&128)===128)}catch{}}function Gc(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var Wi=typeof Object.is=="function"?Object.is:Gc,Ha=null,ml=!1,gl=!1;function Xc(m){Ha===null?Ha=[m]:Ha.push(m)}function em(m){ml=!0,Xc(m)}function vn(){if(!gl&&Ha!==null){gl=!0;var m=0,g=qt;try{var C=Ha;for(qt=1;m<C.length;m++){var D=C[m];do D=D(!0);while(D!==null)}Ha=null,ml=!1}catch(z){throw Ha!==null&&(Ha=Ha.slice(m+1)),ma(qc,vn),z}finally{qt=g,gl=!1}}return null}var xo=[],$a=0,Iu=null,as=0,zn=[],hi=0,tn=null,ri=1,Gi="";function Xi(m,g){xo[$a++]=as,xo[$a++]=Iu,Iu=m,as=g}function tm(m,g,C){zn[hi++]=ri,zn[hi++]=Gi,zn[hi++]=tn,tn=m;var D=ri;m=Gi;var z=32-di(D)-1;D&=~(1<<z),C+=1;var Y=32-di(g)+z;if(30<Y){var ie=z-z%5;Y=(D&(1<<ie)-1).toString(32),D>>=ie,z-=ie,ri=1<<32-di(g)+z|C<<z|D,Gi=Y+m}else ri=1<<Y|C<<z|D,Gi=m}function Ru(m){m.return!==null&&(Xi(m,1),tm(m,1,0))}function Mu(m){for(;m===Iu;)Iu=xo[--$a],xo[$a]=null,as=xo[--$a],xo[$a]=null;for(;m===tn;)tn=zn[--hi],zn[hi]=null,Gi=zn[--hi],zn[hi]=null,ri=zn[--hi],zn[hi]=null}var bn=null,jn=null,Sr=!1,Du=!1,Yi=null;function rm(m,g){var C=ki(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 Yc(m,g){switch(m.tag){case 5:return g=qr(g,m.type,m.pendingProps),g!==null?(m.stateNode=g,bn=m,jn=Vi(g),!0):!1;case 6:return g=Zn(g,m.pendingProps),g!==null?(m.stateNode=g,bn=m,jn=null,!0):!1;case 13:if(g=Or(g),g!==null){var C=tn!==null?{id:ri,overflow:Gi}:null;return m.memoizedState={dehydrated:g,treeContext:C,retryLane:1073741824},C=ki(18,null,null,0),C.stateNode=g,C.return=m,m.child=C,bn=m,jn=null,!0}return!1;default:return!1}}function jd(m){return(m.mode&1)!==0&&(m.flags&128)===0}function Ud(m){if(Sr){var g=jn;if(g){var C=g;if(!Yc(m,g)){if(jd(m))throw Error(o(418));g=Ti(C);var D=bn;g&&Yc(m,g)?rm(D,C):(m.flags=m.flags&-4097|2,Sr=!1,bn=m)}}else{if(jd(m))throw Error(o(418));m.flags=m.flags&-4097|2,Sr=!1,bn=m}}}function nm(m){for(m=m.return;m!==null&&m.tag!==5&&m.tag!==3&&m.tag!==13;)m=m.return;bn=m}function Kc(m){if(!Le||m!==bn)return!1;if(!Sr)return nm(m),Sr=!0,!1;if(m.tag!==3&&(m.tag!==5||jc(m.type)&&!re(m.type,m.memoizedProps))){var g=jn;if(g){if(jd(m))throw im(),Error(o(418));for(;g;)rm(m,g),g=Ti(g)}}if(nm(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));jn=mo(m)}else jn=bn?Ti(m.stateNode):null;return!0}function im(){for(var m=jn;m;)m=Ti(m)}function os(){Le&&(jn=bn=null,Du=Sr=!1)}function Hd(m){Yi===null?Yi=[m]:Yi.push(m)}var j0=s.ReactCurrentBatchConfig;function Qc(m,g){if(Wi(m,g))return!0;if(typeof m!="object"||m===null||typeof g!="object"||g===null)return!1;var C=Object.keys(m),D=Object.keys(g);if(C.length!==D.length)return!1;for(D=0;D<C.length;D++){var z=C[D];if(!F0.call(g,z)||!Wi(m[z],g[z]))return!1}return!0}function U0(m){switch(m.tag){case 5:return da(m.type);case 16:return da("Lazy");case 13:return da("Suspense");case 19:return da("SuspenseList");case 0:case 2:case 15:return m=ll(m.type,!1),m;case 11:return m=ll(m.type.render,!1),m;case 1:return m=ll(m.type,!0),m;default:return""}}function ss(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 D=C.stateNode}if(!D)throw Error(o(147,m));var z=D,Y=""+m;return g!==null&&g.ref!==null&&typeof g.ref=="function"&&g.ref._stringRef===Y?g.ref:(g=function(ie){var Pe=z.refs;ie===null?delete Pe[Y]:Pe[Y]=ie},g._stringRef=Y,g)}if(typeof m!="string")throw Error(o(284));if(!C._owner)throw Error(o(290,m))}return m}function Zc(m,g){throw m=Object.prototype.toString.call(g),Error(o(31,m==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":m))}function am(m){var g=m._init;return g(m._payload)}function om(m){function g(Me,Ee){if(m){var Fe=Me.deletions;Fe===null?(Me.deletions=[Ee],Me.flags|=16):Fe.push(Ee)}}function C(Me,Ee){if(!m)return null;for(;Ee!==null;)g(Me,Ee),Ee=Ee.sibling;return null}function D(Me,Ee){for(Me=new Map;Ee!==null;)Ee.key!==null?Me.set(Ee.key,Ee):Me.set(Ee.index,Ee),Ee=Ee.sibling;return Me}function z(Me,Ee){return Me=zo(Me,Ee),Me.index=0,Me.sibling=null,Me}function Y(Me,Ee,Fe){return Me.index=Fe,m?(Fe=Me.alternate,Fe!==null?(Fe=Fe.index,Fe<Ee?(Me.flags|=2,Ee):Fe):(Me.flags|=2,Ee)):(Me.flags|=1048576,Ee)}function ie(Me){return m&&Me.alternate===null&&(Me.flags|=2),Me}function Pe(Me,Ee,Fe,ut){return Ee===null||Ee.tag!==6?(Ee=Ul(Fe,Me.mode,ut),Ee.return=Me,Ee):(Ee=z(Ee,Fe),Ee.return=Me,Ee)}function Ne(Me,Ee,Fe,ut){var _t=Fe.type;return _t===f?mt(Me,Ee,Fe.props.children,ut,Fe.key):Ee!==null&&(Ee.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===P&&am(_t)===Ee.type)?(ut=z(Ee,Fe.props),ut.ref=ss(Me,Ee,Fe),ut.return=Me,ut):(ut=If(Fe.type,Fe.key,Fe.props,null,Me.mode,ut),ut.ref=ss(Me,Ee,Fe),ut.return=Me,ut)}function Ke(Me,Ee,Fe,ut){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==Fe.containerInfo||Ee.stateNode.implementation!==Fe.implementation?(Ee=Rf(Fe,Me.mode,ut),Ee.return=Me,Ee):(Ee=z(Ee,Fe.children||[]),Ee.return=Me,Ee)}function mt(Me,Ee,Fe,ut,_t){return Ee===null||Ee.tag!==7?(Ee=Sn(Fe,Me.mode,ut,_t),Ee.return=Me,Ee):(Ee=z(Ee,Fe),Ee.return=Me,Ee)}function Dt(Me,Ee,Fe){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return Ee=Ul(""+Ee,Me.mode,Fe),Ee.return=Me,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case u:return Fe=If(Ee.type,Ee.key,Ee.props,null,Me.mode,Fe),Fe.ref=ss(Me,null,Ee),Fe.return=Me,Fe;case d:return Ee=Rf(Ee,Me.mode,Fe),Ee.return=Me,Ee;case P:var ut=Ee._init;return Dt(Me,ut(Ee._payload),Fe)}if(G(Ee)||A(Ee))return Ee=Sn(Ee,Me.mode,Fe,null),Ee.return=Me,Ee;Zc(Me,Ee)}return null}function lt(Me,Ee,Fe,ut){var _t=Ee!==null?Ee.key:null;if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number")return _t!==null?null:Pe(Me,Ee,""+Fe,ut);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case u:return Fe.key===_t?Ne(Me,Ee,Fe,ut):null;case d:return Fe.key===_t?Ke(Me,Ee,Fe,ut):null;case P:return _t=Fe._init,lt(Me,Ee,_t(Fe._payload),ut)}if(G(Fe)||A(Fe))return _t!==null?null:mt(Me,Ee,Fe,ut,null);Zc(Me,Fe)}return null}function br(Me,Ee,Fe,ut,_t){if(typeof ut=="string"&&ut!==""||typeof ut=="number")return Me=Me.get(Fe)||null,Pe(Ee,Me,""+ut,_t);if(typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case u:return Me=Me.get(ut.key===null?Fe:ut.key)||null,Ne(Ee,Me,ut,_t);case d:return Me=Me.get(ut.key===null?Fe:ut.key)||null,Ke(Ee,Me,ut,_t);case P:var Bt=ut._init;return br(Me,Ee,Fe,Bt(ut._payload),_t)}if(G(ut)||A(ut))return Me=Me.get(Fe)||null,mt(Ee,Me,ut,_t,null);Zc(Ee,ut)}return null}function sr(Me,Ee,Fe,ut){for(var _t=null,Bt=null,Nt=Ee,Kt=Ee=0,sn=null;Nt!==null&&Kt<Fe.length;Kt++){Nt.index>Kt?(sn=Nt,Nt=null):sn=Nt.sibling;var Gt=lt(Me,Nt,Fe[Kt],ut);if(Gt===null){Nt===null&&(Nt=sn);break}m&&Nt&&Gt.alternate===null&&g(Me,Nt),Ee=Y(Gt,Ee,Kt),Bt===null?_t=Gt:Bt.sibling=Gt,Bt=Gt,Nt=sn}if(Kt===Fe.length)return C(Me,Nt),Sr&&Xi(Me,Kt),_t;if(Nt===null){for(;Kt<Fe.length;Kt++)Nt=Dt(Me,Fe[Kt],ut),Nt!==null&&(Ee=Y(Nt,Ee,Kt),Bt===null?_t=Nt:Bt.sibling=Nt,Bt=Nt);return Sr&&Xi(Me,Kt),_t}for(Nt=D(Me,Nt);Kt<Fe.length;Kt++)sn=br(Nt,Me,Kt,Fe[Kt],ut),sn!==null&&(m&&sn.alternate!==null&&Nt.delete(sn.key===null?Kt:sn.key),Ee=Y(sn,Ee,Kt),Bt===null?_t=sn:Bt.sibling=sn,Bt=sn);return m&&Nt.forEach(function(Dn){return g(Me,Dn)}),Sr&&Xi(Me,Kt),_t}function Wn(Me,Ee,Fe,ut){var _t=A(Fe);if(typeof _t!="function")throw Error(o(150));if(Fe=_t.call(Fe),Fe==null)throw Error(o(151));for(var Bt=_t=null,Nt=Ee,Kt=Ee=0,sn=null,Gt=Fe.next();Nt!==null&&!Gt.done;Kt++,Gt=Fe.next()){Nt.index>Kt?(sn=Nt,Nt=null):sn=Nt.sibling;var Dn=lt(Me,Nt,Gt.value,ut);if(Dn===null){Nt===null&&(Nt=sn);break}m&&Nt&&Dn.alternate===null&&g(Me,Nt),Ee=Y(Dn,Ee,Kt),Bt===null?_t=Dn:Bt.sibling=Dn,Bt=Dn,Nt=sn}if(Gt.done)return C(Me,Nt),Sr&&Xi(Me,Kt),_t;if(Nt===null){for(;!Gt.done;Kt++,Gt=Fe.next())Gt=Dt(Me,Gt.value,ut),Gt!==null&&(Ee=Y(Gt,Ee,Kt),Bt===null?_t=Gt:Bt.sibling=Gt,Bt=Gt);return Sr&&Xi(Me,Kt),_t}for(Nt=D(Me,Nt);!Gt.done;Kt++,Gt=Fe.next())Gt=br(Nt,Me,Kt,Gt.value,ut),Gt!==null&&(m&&Gt.alternate!==null&&Nt.delete(Gt.key===null?Kt:Gt.key),Ee=Y(Gt,Ee,Kt),Bt===null?_t=Gt:Bt.sibling=Gt,Bt=Gt);return m&&Nt.forEach(function(W0){return g(Me,W0)}),Sr&&Xi(Me,Kt),_t}function _a(Me,Ee,Fe,ut){if(typeof Fe=="object"&&Fe!==null&&Fe.type===f&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case u:e:{for(var _t=Fe.key,Bt=Ee;Bt!==null;){if(Bt.key===_t){if(_t=Fe.type,_t===f){if(Bt.tag===7){C(Me,Bt.sibling),Ee=z(Bt,Fe.props.children),Ee.return=Me,Me=Ee;break e}}else if(Bt.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===P&&am(_t)===Bt.type){C(Me,Bt.sibling),Ee=z(Bt,Fe.props),Ee.ref=ss(Me,Bt,Fe),Ee.return=Me,Me=Ee;break e}C(Me,Bt);break}else g(Me,Bt);Bt=Bt.sibling}Fe.type===f?(Ee=Sn(Fe.props.children,Me.mode,ut,Fe.key),Ee.return=Me,Me=Ee):(ut=If(Fe.type,Fe.key,Fe.props,null,Me.mode,ut),ut.ref=ss(Me,Ee,Fe),ut.return=Me,Me=ut)}return ie(Me);case d:e:{for(Bt=Fe.key;Ee!==null;){if(Ee.key===Bt)if(Ee.tag===4&&Ee.stateNode.containerInfo===Fe.containerInfo&&Ee.stateNode.implementation===Fe.implementation){C(Me,Ee.sibling),Ee=z(Ee,Fe.children||[]),Ee.return=Me,Me=Ee;break e}else{C(Me,Ee);break}else g(Me,Ee);Ee=Ee.sibling}Ee=Rf(Fe,Me.mode,ut),Ee.return=Me,Me=Ee}return ie(Me);case P:return Bt=Fe._init,_a(Me,Ee,Bt(Fe._payload),ut)}if(G(Fe))return sr(Me,Ee,Fe,ut);if(A(Fe))return Wn(Me,Ee,Fe,ut);Zc(Me,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"?(Fe=""+Fe,Ee!==null&&Ee.tag===6?(C(Me,Ee.sibling),Ee=z(Ee,Fe),Ee.return=Me,Me=Ee):(C(Me,Ee),Ee=Ul(Fe,Me.mode,ut),Ee.return=Me,Me=Ee),ie(Me)):C(Me,Ee)}return _a}var ls=om(!0),sm=om(!1),Jc=yn(null),ef=null,yl=null,$d=null;function qd(){$d=yl=ef=null}function lm(m,g,C){ue?($t(Jc,g._currentValue),g._currentValue=C):($t(Jc,g._currentValue2),g._currentValue2=C)}function Nu(m){var g=Jc.current;xr(Jc),ue?m._currentValue=g:m._currentValue2=g}function us(m,g,C){for(;m!==null;){var D=m.alternate;if((m.childLanes&g)!==g?(m.childLanes|=g,D!==null&&(D.childLanes|=g)):D!==null&&(D.childLanes&g)!==g&&(D.childLanes|=g),m===C)break;m=m.return}}function vl(m,g){ef=m,$d=yl=null,m=m.dependencies,m!==null&&m.firstContext!==null&&((m.lanes&g)!==0&&(nn=!0),m.firstContext=null)}function pi(m){var g=ue?m._currentValue:m._currentValue2;if($d!==m)if(m={context:m,memoizedValue:g,next:null},yl===null){if(ef===null)throw Error(o(308));yl=m,ef.dependencies={lanes:0,firstContext:m}}else yl=yl.next=m;return g}var So=null;function tf(m){So===null?So=[m]:So.push(m)}function Vd(m,g,C,D){var z=g.interleaved;return z===null?(C.next=C,tf(g)):(C.next=z.next,z.next=C),g.interleaved=C,Ki(m,D)}function Ki(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 mi=!1;function Wd(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function um(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 qa(m,g){return{eventTime:m,lane:g,tag:0,payload:null,callback:null,next:null}}function Va(m,g,C){var D=m.updateQueue;if(D===null)return null;if(D=D.shared,(Lt&2)!==0){var z=D.pending;return z===null?g.next=g:(g.next=z.next,z.next=g),D.pending=g,Ki(m,C)}return z=D.interleaved,z===null?(g.next=g,tf(D)):(g.next=z.next,z.next=g),D.interleaved=g,Ki(m,C)}function Lu(m,g,C){if(g=g.updateQueue,g!==null&&(g=g.shared,(C&4194240)!==0)){var D=g.lanes;D&=m.pendingLanes,C|=D,g.lanes=C,pa(m,C)}}function bl(m,g){var C=m.updateQueue,D=m.alternate;if(D!==null&&(D=D.updateQueue,C===D)){var z=null,Y=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};Y===null?z=Y=ie:Y=Y.next=ie,C=C.next}while(C!==null);Y===null?z=Y=g:Y=Y.next=g}else z=Y=g;C={baseState:D.baseState,firstBaseUpdate:z,lastBaseUpdate:Y,shared:D.shared,effects:D.effects},m.updateQueue=C;return}m=C.lastBaseUpdate,m===null?C.firstBaseUpdate=g:m.next=g,C.lastBaseUpdate=g}function ko(m,g,C,D){var z=m.updateQueue;mi=!1;var Y=z.firstBaseUpdate,ie=z.lastBaseUpdate,Pe=z.shared.pending;if(Pe!==null){z.shared.pending=null;var Ne=Pe,Ke=Ne.next;Ne.next=null,ie===null?Y=Ke:ie.next=Ke,ie=Ne;var mt=m.alternate;mt!==null&&(mt=mt.updateQueue,Pe=mt.lastBaseUpdate,Pe!==ie&&(Pe===null?mt.firstBaseUpdate=Ke:Pe.next=Ke,mt.lastBaseUpdate=Ne))}if(Y!==null){var Dt=z.baseState;ie=0,mt=Ke=Ne=null,Pe=Y;do{var lt=Pe.lane,br=Pe.eventTime;if((D<)===lt){mt!==null&&(mt=mt.next={eventTime:br,lane:0,tag:Pe.tag,payload:Pe.payload,callback:Pe.callback,next:null});e:{var sr=m,Wn=Pe;switch(lt=g,br=C,Wn.tag){case 1:if(sr=Wn.payload,typeof sr=="function"){Dt=sr.call(br,Dt,lt);break e}Dt=sr;break e;case 3:sr.flags=sr.flags&-65537|128;case 0:if(sr=Wn.payload,lt=typeof sr=="function"?sr.call(br,Dt,lt):sr,lt==null)break e;Dt=a({},Dt,lt);break e;case 2:mi=!0}}Pe.callback!==null&&Pe.lane!==0&&(m.flags|=64,lt=z.effects,lt===null?z.effects=[Pe]:lt.push(Pe))}else br={eventTime:br,lane:lt,tag:Pe.tag,payload:Pe.payload,callback:Pe.callback,next:null},mt===null?(Ke=mt=br,Ne=Dt):mt=mt.next=br,ie|=lt;if(Pe=Pe.next,Pe===null){if(Pe=z.shared.pending,Pe===null)break;lt=Pe,Pe=lt.next,lt.next=null,z.lastBaseUpdate=lt,z.shared.pending=null}}while(!0);if(mt===null&&(Ne=Dt),z.baseState=Ne,z.firstBaseUpdate=Ke,z.lastBaseUpdate=mt,g=z.shared.interleaved,g!==null){z=g;do ie|=z.lane,z=z.next;while(z!==g)}else Y===null&&(z.shared.lanes=0);Ka|=ie,m.lanes=ie,m.memoizedState=Dt}}function cm(m,g,C){if(m=g.effects,g.effects=null,m!==null)for(g=0;g<m.length;g++){var D=m[g],z=D.callback;if(z!==null){if(D.callback=null,D=C,typeof z!="function")throw Error(o(191,z));z.call(D)}}}var _o={},Oi=yn(_o),wl=yn(_o),Po=yn(_o);function Ai(m){if(m===_o)throw Error(o(174));return m}function rf(m,g){$t(Po,g),$t(wl,m),$t(Oi,_o),m=J(g),xr(Oi),$t(Oi,m)}function cs(){xr(Oi),xr(wl),xr(Po)}function Gd(m){var g=Ai(Po.current),C=Ai(Oi.current);g=q(C,m.type,g),C!==g&&($t(wl,m),$t(Oi,g))}function Xd(m){wl.current===m&&(xr(Oi),xr(wl))}var Br=yn(0);function nf(m){for(var g=m;g!==null;){if(g.tag===13){var C=g.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||Tn(C)||Vr(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 Yd=[];function Kd(){for(var m=0;m<Yd.length;m++){var g=Yd[m];ue?g._workInProgressVersionPrimary=null:g._workInProgressVersionSecondary=null}Yd.length=0}var ni=s.ReactCurrentDispatcher,fs=s.ReactCurrentBatchConfig,Eo=0,Ar=null,Qr=null,rn=null,xl=!1,Fu=!1,Bu=0,Sl=0;function hn(){throw Error(o(321))}function ds(m,g){if(g===null)return!1;for(var C=0;C<g.length&&C<m.length;C++)if(!Wi(m[C],g[C]))return!1;return!0}function zu(m,g,C,D,z,Y){if(Eo=Y,Ar=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,ni.current=m===null||m.memoizedState===null?oh:sh,m=C(D,z),Fu){Y=0;do{if(Fu=!1,Bu=0,25<=Y)throw Error(o(301));Y+=1,rn=Qr=null,g.updateQueue=null,ni.current=lh,m=C(D,z)}while(Fu)}if(ni.current=ys,g=Qr!==null&&Qr.next!==null,Eo=0,rn=Qr=Ar=null,xl=!1,g)throw Error(o(300));return m}function af(){var m=Bu!==0;return Bu=0,m}function gi(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?Ar.memoizedState=rn=m:rn=rn.next=m,rn}function wn(){if(Qr===null){var m=Ar.alternate;m=m!==null?m.memoizedState:null}else m=Qr.next;var g=rn===null?Ar.memoizedState:rn.next;if(g!==null)rn=g,Qr=m;else{if(m===null)throw Error(o(310));Qr=m,m={memoizedState:Qr.memoizedState,baseState:Qr.baseState,baseQueue:Qr.baseQueue,queue:Qr.queue,next:null},rn===null?Ar.memoizedState=rn=m:rn=rn.next=m}return rn}function hs(m,g){return typeof g=="function"?g(m):g}function of(m){var g=wn(),C=g.queue;if(C===null)throw Error(o(311));C.lastRenderedReducer=m;var D=Qr,z=D.baseQueue,Y=C.pending;if(Y!==null){if(z!==null){var ie=z.next;z.next=Y.next,Y.next=ie}D.baseQueue=z=Y,C.pending=null}if(z!==null){Y=z.next,D=D.baseState;var Pe=ie=null,Ne=null,Ke=Y;do{var mt=Ke.lane;if((Eo&mt)===mt)Ne!==null&&(Ne=Ne.next={lane:0,action:Ke.action,hasEagerState:Ke.hasEagerState,eagerState:Ke.eagerState,next:null}),D=Ke.hasEagerState?Ke.eagerState:m(D,Ke.action);else{var Dt={lane:mt,action:Ke.action,hasEagerState:Ke.hasEagerState,eagerState:Ke.eagerState,next:null};Ne===null?(Pe=Ne=Dt,ie=D):Ne=Ne.next=Dt,Ar.lanes|=mt,Ka|=mt}Ke=Ke.next}while(Ke!==null&&Ke!==Y);Ne===null?ie=D:Ne.next=Pe,Wi(D,g.memoizedState)||(nn=!0),g.memoizedState=D,g.baseState=ie,g.baseQueue=Ne,C.lastRenderedState=D}if(m=C.interleaved,m!==null){z=m;do Y=z.lane,Ar.lanes|=Y,Ka|=Y,z=z.next;while(z!==m)}else z===null&&(C.lanes=0);return[g.memoizedState,C.dispatch]}function kl(m){var g=wn(),C=g.queue;if(C===null)throw Error(o(311));C.lastRenderedReducer=m;var D=C.dispatch,z=C.pending,Y=g.memoizedState;if(z!==null){C.pending=null;var ie=z=z.next;do Y=m(Y,ie.action),ie=ie.next;while(ie!==z);Wi(Y,g.memoizedState)||(nn=!0),g.memoizedState=Y,g.baseQueue===null&&(g.baseState=Y),C.lastRenderedState=Y}return[Y,D]}function Qd(){}function Zd(m,g){var C=Ar,D=wn(),z=g(),Y=!Wi(D.memoizedState,z);if(Y&&(D.memoizedState=z,nn=!0),D=D.queue,uf(th.bind(null,C,D,m),[m]),D.getSnapshot!==g||Y||rn!==null&&rn.memoizedState.tag&1){if(C.flags|=2048,ps(9,eh.bind(null,C,D,z,g),void 0,null),pr===null)throw Error(o(349));(Eo&30)!==0||Jd(C,g,z)}return z}function Jd(m,g,C){m.flags|=16384,m={getSnapshot:g,value:C},g=Ar.updateQueue,g===null?(g={lastEffect:null,stores:null},Ar.updateQueue=g,g.stores=[m]):(C=g.stores,C===null?g.stores=[m]:C.push(m))}function eh(m,g,C,D){g.value=C,g.getSnapshot=D,rh(g)&&Wa(m)}function th(m,g,C){return C(function(){rh(g)&&Wa(m)})}function rh(m){var g=m.getSnapshot;m=m.value;try{var C=g();return!Wi(m,C)}catch{return!0}}function Wa(m){var g=Ki(m,1);g!==null&&Rn(g,m,1,-1)}function sf(m){var g=gi();return typeof m=="function"&&(m=m()),g.memoizedState=g.baseState=m,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:m},g.queue=m,m=m.dispatch=H0.bind(null,Ar,m),[g.memoizedState,m]}function ps(m,g,C,D){return m={tag:m,create:g,destroy:C,deps:D,next:null},g=Ar.updateQueue,g===null?(g={lastEffect:null,stores:null},Ar.updateQueue=g,g.lastEffect=m.next=m):(C=g.lastEffect,C===null?g.lastEffect=m.next=m:(D=C.next,C.next=m,m.next=D,g.lastEffect=m)),m}function fm(){return wn().memoizedState}function lf(m,g,C,D){var z=gi();Ar.flags|=m,z.memoizedState=ps(1|g,C,void 0,D===void 0?null:D)}function To(m,g,C,D){var z=wn();D=D===void 0?null:D;var Y=void 0;if(Qr!==null){var ie=Qr.memoizedState;if(Y=ie.destroy,D!==null&&ds(D,ie.deps)){z.memoizedState=ps(g,C,Y,D);return}}Ar.flags|=m,z.memoizedState=ps(1|g,C,Y,D)}function dm(m,g){return lf(8390656,8,m,g)}function uf(m,g){return To(2048,8,m,g)}function nh(m,g){return To(4,2,m,g)}function gr(m,g){return To(4,4,m,g)}function cf(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 ju(m,g,C){return C=C!=null?C.concat([m]):null,To(4,4,cf.bind(null,g,m),C)}function ms(){}function ih(m,g){var C=wn();g=g===void 0?null:g;var D=C.memoizedState;return D!==null&&g!==null&&ds(g,D[1])?D[0]:(C.memoizedState=[m,g],m)}function ff(m,g){var C=wn();g=g===void 0?null:g;var D=C.memoizedState;return D!==null&&g!==null&&ds(g,D[1])?D[0]:(m=m(),C.memoizedState=[m,g],m)}function _l(m,g,C){return(Eo&21)===0?(m.baseState&&(m.baseState=!1,nn=!0),m.memoizedState=C):(Wi(C,g)||(C=$c(),Ar.lanes|=C,Ka|=C,m.baseState=!0),g)}function df(m,g){var C=qt;qt=C!==0&&4>C?C:4,m(!0);var D=fs.transition;fs.transition={};try{m(!1),g()}finally{qt=C,fs.transition=D}}function gs(){return wn().memoizedState}function hm(m,g,C){var D=on(m);if(C={lane:D,action:C,hasEagerState:!1,eagerState:null,next:null},pm(m))ah(g,C);else if(C=Vd(m,g,C,D),C!==null){var z=kr();Rn(C,m,D,z),Uu(C,g,D)}}function H0(m,g,C){var D=on(m),z={lane:D,action:C,hasEagerState:!1,eagerState:null,next:null};if(pm(m))ah(g,z);else{var Y=m.alternate;if(m.lanes===0&&(Y===null||Y.lanes===0)&&(Y=g.lastRenderedReducer,Y!==null))try{var ie=g.lastRenderedState,Pe=Y(ie,C);if(z.hasEagerState=!0,z.eagerState=Pe,Wi(Pe,ie)){var Ne=g.interleaved;Ne===null?(z.next=z,tf(g)):(z.next=Ne.next,Ne.next=z),g.interleaved=z;return}}catch{}C=Vd(m,g,z,D),C!==null&&(z=kr(),Rn(C,m,D,z),Uu(C,g,D))}}function pm(m){var g=m.alternate;return m===Ar||g!==null&&g===Ar}function ah(m,g){Fu=xl=!0;var C=m.pending;C===null?g.next=g:(g.next=C.next,C.next=g),m.pending=g}function Uu(m,g,C){if((C&4194240)!==0){var D=g.lanes;D&=m.pendingLanes,C|=D,g.lanes=C,pa(m,C)}}var ys={readContext:pi,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},oh={readContext:pi,useCallback:function(m,g){return gi().memoizedState=[m,g===void 0?null:g],m},useContext:pi,useEffect:dm,useImperativeHandle:function(m,g,C){return C=C!=null?C.concat([m]):null,lf(4194308,4,cf.bind(null,g,m),C)},useLayoutEffect:function(m,g){return lf(4194308,4,m,g)},useInsertionEffect:function(m,g){return lf(4,2,m,g)},useMemo:function(m,g){var C=gi();return g=g===void 0?null:g,m=m(),C.memoizedState=[m,g],m},useReducer:function(m,g,C){var D=gi();return g=C!==void 0?C(g):g,D.memoizedState=D.baseState=g,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:g},D.queue=m,m=m.dispatch=hm.bind(null,Ar,m),[D.memoizedState,m]},useRef:function(m){var g=gi();return m={current:m},g.memoizedState=m},useState:sf,useDebugValue:ms,useDeferredValue:function(m){return gi().memoizedState=m},useTransition:function(){var m=sf(!1),g=m[0];return m=df.bind(null,m[1]),gi().memoizedState=m,[g,m]},useMutableSource:function(){},useSyncExternalStore:function(m,g,C){var D=Ar,z=gi();if(Sr){if(C===void 0)throw Error(o(407));C=C()}else{if(C=g(),pr===null)throw Error(o(349));(Eo&30)!==0||Jd(D,g,C)}z.memoizedState=C;var Y={value:C,getSnapshot:g};return z.queue=Y,dm(th.bind(null,D,Y,m),[m]),D.flags|=2048,ps(9,eh.bind(null,D,Y,C,g),void 0,null),C},useId:function(){var m=gi(),g=pr.identifierPrefix;if(Sr){var C=Gi,D=ri;C=(D&~(1<<32-di(D)-1)).toString(32)+C,g=":"+g+"R"+C,C=Bu++,0<C&&(g+="H"+C.toString(32)),g+=":"}else C=Sl++,g=":"+g+"r"+C.toString(32)+":";return m.memoizedState=g},unstable_isNewReconciler:!1},sh={readContext:pi,useCallback:ih,useContext:pi,useEffect:uf,useImperativeHandle:ju,useInsertionEffect:nh,useLayoutEffect:gr,useMemo:ff,useReducer:of,useRef:fm,useState:function(){return of(hs)},useDebugValue:ms,useDeferredValue:function(m){var g=wn();return _l(g,Qr.memoizedState,m)},useTransition:function(){var m=of(hs)[0],g=wn().memoizedState;return[m,g]},useMutableSource:Qd,useSyncExternalStore:Zd,useId:gs,unstable_isNewReconciler:!1},lh={readContext:pi,useCallback:ih,useContext:pi,useEffect:uf,useImperativeHandle:ju,useInsertionEffect:nh,useLayoutEffect:gr,useMemo:ff,useReducer:kl,useRef:fm,useState:function(){return kl(hs)},useDebugValue:ms,useDeferredValue:function(m){var g=wn();return Qr===null?g.memoizedState=m:_l(g,Qr.memoizedState,m)},useTransition:function(){var m=kl(hs)[0],g=wn().memoizedState;return[m,g]},useMutableSource:Qd,useSyncExternalStore:Zd,useId:gs,unstable_isNewReconciler:!1};function yi(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 uh(m,g,C,D){g=m.memoizedState,C=C(D,g),C=C==null?g:a({},g,C),m.memoizedState=C,m.lanes===0&&(m.updateQueue.baseState=C)}var Hu={isMounted:function(m){return(m=m._reactInternals)?M(m)===m:!1},enqueueSetState:function(m,g,C){m=m._reactInternals;var D=kr(),z=on(m),Y=qa(D,z);Y.payload=g,C!=null&&(Y.callback=C),g=Va(m,Y,z),g!==null&&(Rn(g,m,z,D),Lu(g,m,z))},enqueueReplaceState:function(m,g,C){m=m._reactInternals;var D=kr(),z=on(m),Y=qa(D,z);Y.tag=1,Y.payload=g,C!=null&&(Y.callback=C),g=Va(m,Y,z),g!==null&&(Rn(g,m,z,D),Lu(g,m,z))},enqueueForceUpdate:function(m,g){m=m._reactInternals;var C=kr(),D=on(m),z=qa(C,D);z.tag=2,g!=null&&(z.callback=g),g=Va(m,z,D),g!==null&&(Rn(g,m,D,C),Lu(g,m,D))}};function mm(m,g,C,D,z,Y,ie){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(D,Y,ie):g.prototype&&g.prototype.isPureReactComponent?!Qc(C,D)||!Qc(z,Y):!0}function gm(m,g,C){var D=!1,z=vo,Y=g.contextType;return typeof Y=="object"&&Y!==null?Y=pi(Y):(z=fn(g)?ha:Cn.current,D=g.contextTypes,Y=(D=D!=null)?Ua(m,z):vo),g=new g(C,Y),m.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Hu,m.stateNode=g,g._reactInternals=m,D&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=z,m.__reactInternalMemoizedMaskedChildContext=Y),g}function hf(m,g,C,D){m=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(C,D),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(C,D),g.state!==m&&Hu.enqueueReplaceState(g,g.state,null)}function ga(m,g,C,D){var z=m.stateNode;z.props=C,z.state=m.memoizedState,z.refs={},Wd(m);var Y=g.contextType;typeof Y=="object"&&Y!==null?z.context=pi(Y):(Y=fn(g)?ha:Cn.current,z.context=Ua(m,Y)),z.state=m.memoizedState,Y=g.getDerivedStateFromProps,typeof Y=="function"&&(uh(m,g,Y,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&&Hu.enqueueReplaceState(z,z.state,null),ko(m,C,z,D),z.state=m.memoizedState),typeof z.componentDidMount=="function"&&(m.flags|=4194308)}function vs(m,g){try{var C="",D=g;do C+=U0(D),D=D.return;while(D);var z=C}catch(Y){z=`
|
|
29
|
+
Error generating stack: `+Y.message+`
|
|
30
|
+
`+Y.stack}return{value:m,source:g,stack:z,digest:null}}function Co(m,g,C){return{value:m,source:null,stack:C??null,digest:g??null}}function Ii(m,g){try{console.error(g.value)}catch(C){setTimeout(function(){throw C})}}var $u=typeof WeakMap=="function"?WeakMap:Map;function ya(m,g,C){C=qa(-1,C),C.tag=3,C.payload={element:null};var D=g.value;return C.callback=function(){Hr||(Hr=!0,Zr=D),Ii(m,g)},C}function pf(m,g,C){C=qa(-1,C),C.tag=3;var D=m.type.getDerivedStateFromError;if(typeof D=="function"){var z=g.value;C.payload=function(){return D(z)},C.callback=function(){Ii(m,g)}}var Y=m.stateNode;return Y!==null&&typeof Y.componentDidCatch=="function"&&(C.callback=function(){Ii(m,g),typeof D!="function"&&(Zi===null?Zi=new Set([this]):Zi.add(this));var ie=g.stack;this.componentDidCatch(g.value,{componentStack:ie!==null?ie:""})}),C}function ym(m,g,C){var D=m.pingCache;if(D===null){D=m.pingCache=new $u;var z=new Set;D.set(g,z)}else z=D.get(g),z===void 0&&(z=new Set,D.set(g,z));z.has(C)||(z.add(C),m=Pm.bind(null,m,g,C),g.then(m,m))}function vm(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 Oo(m,g,C,D,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=qa(-1,1),g.tag=2,Va(C,g,1))),C.lanes|=1),m):(m.flags|=65536,m.lanes=z,m)}var qu=s.ReactCurrentOwner,nn=!1;function pn(m,g,C,D){g.child=m===null?sm(g,null,C,D):ls(g,m.child,C,D)}function mf(m,g,C,D,z){C=C.render;var Y=g.ref;return vl(g,z),D=zu(m,g,C,D,Y,z),C=af(),m!==null&&!nn?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~z,Xa(m,g,z)):(Sr&&C&&Ru(g),g.flags|=1,pn(m,g,D,z),g.child)}function bs(m,g,C,D,z){if(m===null){var Y=C.type;return typeof Y=="function"&&!zl(Y)&&Y.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(g.tag=15,g.type=Y,Ga(m,g,Y,D,z)):(m=If(C.type,null,D,g,g.mode,z),m.ref=g.ref,m.return=g,g.child=m)}if(Y=m.child,(m.lanes&z)===0){var ie=Y.memoizedProps;if(C=C.compare,C=C!==null?C:Qc,C(ie,D)&&m.ref===g.ref)return Xa(m,g,z)}return g.flags|=1,m=zo(Y,D),m.ref=g.ref,m.return=g,g.child=m}function Ga(m,g,C,D,z){if(m!==null){var Y=m.memoizedProps;if(Qc(Y,D)&&m.ref===g.ref)if(nn=!1,g.pendingProps=D=Y,(m.lanes&z)!==0)(m.flags&131072)!==0&&(nn=!0);else return g.lanes=m.lanes,Xa(m,g,z)}return va(m,g,C,D,z)}function yr(m,g,C){var D=g.pendingProps,z=D.children,Y=m!==null?m.memoizedState:null;if(D.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null,transitions:null},$t(No,an),an|=C;else{if((C&1073741824)===0)return m=Y!==null?Y.baseLanes|C:C,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:m,cachePool:null,transitions:null},g.updateQueue=null,$t(No,an),an|=m,null;g.memoizedState={baseLanes:0,cachePool:null,transitions:null},D=Y!==null?Y.baseLanes:C,$t(No,an),an|=D}else Y!==null?(D=Y.baseLanes|C,g.memoizedState=null):D=C,$t(No,an),an|=D;return pn(m,g,z,C),g.child}function hr(m,g){var C=g.ref;(m===null&&C!==null||m!==null&&m.ref!==C)&&(g.flags|=512,g.flags|=2097152)}function va(m,g,C,D,z){var Y=fn(C)?ha:Cn.current;return Y=Ua(g,Y),vl(g,z),C=zu(m,g,C,D,Y,z),D=af(),m!==null&&!nn?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~z,Xa(m,g,z)):(Sr&&D&&Ru(g),g.flags|=1,pn(m,g,C,z),g.child)}function xn(m,g,C,D,z){if(fn(C)){var Y=!0;ul(g)}else Y=!1;if(vl(g,z),g.stateNode===null)Vu(m,g),gm(g,C,D),ga(g,C,D,z),D=!0;else if(m===null){var ie=g.stateNode,Pe=g.memoizedProps;ie.props=Pe;var Ne=ie.context,Ke=C.contextType;typeof Ke=="object"&&Ke!==null?Ke=pi(Ke):(Ke=fn(C)?ha:Cn.current,Ke=Ua(g,Ke));var mt=C.getDerivedStateFromProps,Dt=typeof mt=="function"||typeof ie.getSnapshotBeforeUpdate=="function";Dt||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(Pe!==D||Ne!==Ke)&&hf(g,ie,D,Ke),mi=!1;var lt=g.memoizedState;ie.state=lt,ko(g,D,ie,z),Ne=g.memoizedState,Pe!==D||lt!==Ne||ei.current||mi?(typeof mt=="function"&&(uh(g,C,mt,D),Ne=g.memoizedState),(Pe=mi||mm(g,C,Pe,D,lt,Ne,Ke))?(Dt||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=D,g.memoizedState=Ne),ie.props=D,ie.state=Ne,ie.context=Ke,D=Pe):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),D=!1)}else{ie=g.stateNode,um(m,g),Pe=g.memoizedProps,Ke=g.type===g.elementType?Pe:yi(g.type,Pe),ie.props=Ke,Dt=g.pendingProps,lt=ie.context,Ne=C.contextType,typeof Ne=="object"&&Ne!==null?Ne=pi(Ne):(Ne=fn(C)?ha:Cn.current,Ne=Ua(g,Ne));var br=C.getDerivedStateFromProps;(mt=typeof br=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(Pe!==Dt||lt!==Ne)&&hf(g,ie,D,Ne),mi=!1,lt=g.memoizedState,ie.state=lt,ko(g,D,ie,z);var sr=g.memoizedState;Pe!==Dt||lt!==sr||ei.current||mi?(typeof br=="function"&&(uh(g,C,br,D),sr=g.memoizedState),(Ke=mi||mm(g,C,Ke,D,lt,sr,Ne)||!1)?(mt||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(D,sr,Ne),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(D,sr,Ne)),typeof ie.componentDidUpdate=="function"&&(g.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof ie.componentDidUpdate!="function"||Pe===m.memoizedProps&<===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||Pe===m.memoizedProps&<===m.memoizedState||(g.flags|=1024),g.memoizedProps=D,g.memoizedState=sr),ie.props=D,ie.state=sr,ie.context=Ne,D=Ke):(typeof ie.componentDidUpdate!="function"||Pe===m.memoizedProps&<===m.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||Pe===m.memoizedProps&<===m.memoizedState||(g.flags|=1024),D=!1)}return On(m,g,C,D,Y,z)}function On(m,g,C,D,z,Y){hr(m,g);var ie=(g.flags&128)!==0;if(!D&&!ie)return z&&Bd(g,C,!1),Xa(m,g,Y);D=g.stateNode,qu.current=g;var Pe=ie&&typeof C.getDerivedStateFromError!="function"?null:D.render();return g.flags|=1,m!==null&&ie?(g.child=ls(g,m.child,null,Y),g.child=ls(g,null,Pe,Y)):pn(m,g,Pe,Y),g.memoizedState=D.state,z&&Bd(g,C,!0),g.child}function Ao(m){var g=m.stateNode;g.pendingContext?Xp(m,g.pendingContext,g.pendingContext!==g.context):g.context&&Xp(m,g.context,!1),rf(m,g.containerInfo)}function ws(m,g,C,D,z){return os(),Hd(z),g.flags|=256,pn(m,g,C,D),g.child}var An={dehydrated:null,treeContext:null,retryLane:0};function Pl(m){return{baseLanes:m,cachePool:null,transitions:null}}function ch(m,g,C){var D=g.pendingProps,z=Br.current,Y=!1,ie=(g.flags&128)!==0,Pe;if((Pe=ie)||(Pe=m!==null&&m.memoizedState===null?!1:(z&2)!==0),Pe?(Y=!0,g.flags&=-129):(m===null||m.memoizedState!==null)&&(z|=1),$t(Br,z&1),m===null)return Ud(g),m=g.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((g.mode&1)===0?g.lanes=1:Vr(m)?g.lanes=8:g.lanes=1073741824,null):(ie=D.children,m=D.fallback,Y?(D=g.mode,Y=g.child,ie={mode:"hidden",children:ie},(D&1)===0&&Y!==null?(Y.childLanes=0,Y.pendingProps=ie):Y=jl(ie,D,0,null),m=Sn(m,D,C,null),Y.return=g,m.return=g,Y.sibling=m,g.child=Y,g.child.memoizedState=Pl(C),g.memoizedState=An,m):gf(g,ie));if(z=m.memoizedState,z!==null&&(Pe=z.dehydrated,Pe!==null))return bm(m,g,ie,D,Pe,z,C);if(Y){Y=D.fallback,ie=g.mode,z=m.child,Pe=z.sibling;var Ne={mode:"hidden",children:D.children};return(ie&1)===0&&g.child!==z?(D=g.child,D.childLanes=0,D.pendingProps=Ne,g.deletions=null):(D=zo(z,Ne),D.subtreeFlags=z.subtreeFlags&14680064),Pe!==null?Y=zo(Pe,Y):(Y=Sn(Y,ie,C,null),Y.flags|=2),Y.return=g,D.return=g,D.sibling=Y,g.child=D,D=Y,Y=g.child,ie=m.child.memoizedState,ie=ie===null?Pl(C):{baseLanes:ie.baseLanes|C,cachePool:null,transitions:ie.transitions},Y.memoizedState=ie,Y.childLanes=m.childLanes&~C,g.memoizedState=An,D}return Y=m.child,m=Y.sibling,D=zo(Y,{mode:"visible",children:D.children}),(g.mode&1)===0&&(D.lanes=C),D.return=g,D.sibling=null,m!==null&&(C=g.deletions,C===null?(g.deletions=[m],g.flags|=16):C.push(m)),g.child=D,g.memoizedState=null,D}function gf(m,g){return g=jl({mode:"visible",children:g},m.mode,0,null),g.return=m,m.child=g}function xs(m,g,C,D){return D!==null&&Hd(D),ls(g,m.child,null,C),m=gf(g,g.pendingProps.children),m.flags|=2,g.memoizedState=null,m}function bm(m,g,C,D,z,Y,ie){if(C)return g.flags&256?(g.flags&=-257,D=Co(Error(o(422))),xs(m,g,ie,D)):g.memoizedState!==null?(g.child=m.child,g.flags|=128,null):(Y=D.fallback,z=g.mode,D=jl({mode:"visible",children:D.children},z,0,null),Y=Sn(Y,z,ie,null),Y.flags|=2,D.return=g,Y.return=g,D.sibling=Y,g.child=D,(g.mode&1)!==0&&ls(g,m.child,null,ie),g.child.memoizedState=Pl(ie),g.memoizedState=An,Y);if((g.mode&1)===0)return xs(m,g,ie,null);if(Vr(z))return D=Jn(z).digest,Y=Error(o(419)),D=Co(Y,D,void 0),xs(m,g,ie,D);if(C=(ie&m.childLanes)!==0,nn||C){if(D=pr,D!==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&(D.suspendedLanes|ie))!==0?0:z,z!==0&&z!==Y.retryLane&&(Y.retryLane=z,Ki(m,z),Rn(D,m,z,-1))}return Bl(),D=Co(Error(o(421))),xs(m,g,ie,D)}return Tn(z)?(g.flags|=128,g.child=m.child,g=Tm.bind(null,m),Fn(z,g),null):(m=Y.treeContext,Le&&(jn=al(z),bn=g,Sr=!0,Yi=null,Du=!1,m!==null&&(zn[hi++]=ri,zn[hi++]=Gi,zn[hi++]=tn,ri=m.id,Gi=m.overflow,tn=g)),g=gf(g,D.children),g.flags|=4096,g)}function ba(m,g,C){m.lanes|=g;var D=m.alternate;D!==null&&(D.lanes|=g),us(m.return,g,C)}function El(m,g,C,D,z){var Y=m.memoizedState;Y===null?m.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:D,tail:C,tailMode:z}:(Y.isBackwards=g,Y.rendering=null,Y.renderingStartTime=0,Y.last=D,Y.tail=C,Y.tailMode=z)}function yf(m,g,C){var D=g.pendingProps,z=D.revealOrder,Y=D.tail;if(pn(m,g,D.children,C),D=Br.current,(D&2)!==0)D=D&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&&ba(m,C,g);else if(m.tag===19)ba(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}D&=1}if($t(Br,D),(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&&nf(m)===null&&(z=C),C=C.sibling;C=z,C===null?(z=g.child,g.child=null):(z=C.sibling,C.sibling=null),El(g,!1,z,C,Y);break;case"backwards":for(C=null,z=g.child,g.child=null;z!==null;){if(m=z.alternate,m!==null&&nf(m)===null){g.child=z;break}m=z.sibling,z.sibling=C,C=z,z=m}El(g,!0,C,null,Y);break;case"together":El(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function Vu(m,g){(g.mode&1)===0&&m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2)}function Xa(m,g,C){if(m!==null&&(g.dependencies=m.dependencies),Ka|=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=zo(m,m.pendingProps),g.child=C,C.return=g;m.sibling!==null;)m=m.sibling,C=C.sibling=zo(m,m.pendingProps),C.return=g;C.sibling=null}return g.child}function Io(m,g,C){switch(g.tag){case 3:Ao(g),os();break;case 5:Gd(g);break;case 1:fn(g.type)&&ul(g);break;case 4:rf(g,g.stateNode.containerInfo);break;case 10:lm(g,g.type._context,g.memoizedProps.value);break;case 13:var D=g.memoizedState;if(D!==null)return D.dehydrated!==null?($t(Br,Br.current&1),g.flags|=128,null):(C&g.child.childLanes)!==0?ch(m,g,C):($t(Br,Br.current&1),m=Xa(m,g,C),m!==null?m.sibling:null);$t(Br,Br.current&1);break;case 19:if(D=(C&g.childLanes)!==0,(m.flags&128)!==0){if(D)return yf(m,g,C);g.flags|=128}var z=g.memoizedState;if(z!==null&&(z.rendering=null,z.tail=null,z.lastEffect=null),$t(Br,Br.current),D)break;return null;case 22:case 23:return g.lanes=0,yr(m,g,C)}return Xa(m,g,C)}function Un(m){m.flags|=4}function Ss(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 Ro,Mo,Hn,$n;if(ye)Ro=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}},Mo=function(){},Hn=function(m,g,C,D,z){if(m=m.memoizedProps,m!==D){var Y=g.stateNode,ie=Ai(Oi.current);C=ee(Y,C,m,D,z,ie),(g.updateQueue=C)&&Un(g)}},$n=function(m,g,C,D){C!==D&&Un(g)};else if(Ie){Ro=function(m,g,C,D){for(var z=g.child;z!==null;){if(z.tag===5){var Y=z.stateNode;C&&D&&(Y=zt(Y,z.type,z.memoizedProps,z)),W(m,Y)}else if(z.tag===6)Y=z.stateNode,C&&D&&(Y=Cr(Y,z.memoizedProps,z)),W(m,Y);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)Y=z.child,Y!==null&&(Y.return=z),Ro(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 Do=function(m,g,C,D){for(var z=g.child;z!==null;){if(z.tag===5){var Y=z.stateNode;C&&D&&(Y=zt(Y,z.type,z.memoizedProps,z)),wr(m,Y)}else if(z.tag===6)Y=z.stateNode,C&&D&&(Y=Cr(Y,z.memoizedProps,z)),wr(m,Y);else if(z.tag!==4){if(z.tag===22&&z.memoizedState!==null)Y=z.child,Y!==null&&(Y.return=z),Do(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}};Mo=function(m,g){var C=g.stateNode;if(!Ss(m,g)){m=C.containerInfo;var D=Ht(m);Do(D,g,!1,!1),C.pendingChildren=D,Un(g),Tr(m,D)}},Hn=function(m,g,C,D,z){var Y=m.stateNode,ie=m.memoizedProps;if((m=Ss(m,g))&&ie===D)g.stateNode=Y;else{var Pe=g.stateNode,Ne=Ai(Oi.current),Ke=null;ie!==D&&(Ke=ee(Pe,C,ie,D,z,Ne)),m&&Ke===null?g.stateNode=Y:(Y=Ft(Y,Ke,C,ie,D,g,m,Pe),V(Y,C,D,z,Ne)&&Un(g),g.stateNode=Y,m?Un(g):Ro(Y,g,!1,!1))}},$n=function(m,g,C,D){C!==D?(m=Ai(Po.current),C=Ai(Oi.current),g.stateNode=K(D,m,C,g),Un(g)):g.stateNode=m.stateNode}}else Mo=function(){},Hn=function(){},$n=function(){};function vi(m,g){if(!Sr)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 D=null;C!==null;)C.alternate!==null&&(D=C),C=C.sibling;D===null?g||m.tail===null?m.tail=null:m.tail.sibling=null:D.sibling=null}}function Ir(m){var g=m.alternate!==null&&m.alternate.child===m.child,C=0,D=0;if(g)for(var z=m.child;z!==null;)C|=z.lanes|z.childLanes,D|=z.subtreeFlags&14680064,D|=z.flags&14680064,z.return=m,z=z.sibling;else for(z=m.child;z!==null;)C|=z.lanes|z.childLanes,D|=z.subtreeFlags,D|=z.flags,z.return=m,z=z.sibling;return m.subtreeFlags|=D,m.childLanes=C,g}function ks(m,g,C){var D=g.pendingProps;switch(Mu(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ir(g),null;case 1:return fn(g.type)&&is(),Ir(g),null;case 3:return C=g.stateNode,cs(),xr(ei),xr(Cn),Kd(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(Kc(g)?Un(g):m===null||m.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,Yi!==null&&(Of(Yi),Yi=null))),Mo(m,g),Ir(g),null;case 5:Xd(g),C=Ai(Po.current);var z=g.type;if(m!==null&&g.stateNode!=null)Hn(m,g,z,D,C),m.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!D){if(g.stateNode===null)throw Error(o(166));return Ir(g),null}if(m=Ai(Oi.current),Kc(g)){if(!Le)throw Error(o(175));m=Bn(g.stateNode,g.type,g.memoizedProps,C,m,g,!Du),g.updateQueue=m,m!==null&&Un(g)}else{var Y=L(z,D,C,m,g);Ro(Y,g,!1,!1),g.stateNode=Y,V(Y,z,D,C,m)&&Un(g)}g.ref!==null&&(g.flags|=512,g.flags|=2097152)}return Ir(g),null;case 6:if(m&&g.stateNode!=null)$n(m,g,m.memoizedProps,D);else{if(typeof D!="string"&&g.stateNode===null)throw Error(o(166));if(m=Ai(Po.current),C=Ai(Oi.current),Kc(g)){if(!Le)throw Error(o(176));if(m=g.stateNode,C=g.memoizedProps,(D=ns(m,C,g,!Du))&&(z=bn,z!==null))switch(z.tag){case 3:Fd(z.stateNode.containerInfo,m,C,(z.mode&1)!==0);break;case 5:rr(z.type,z.memoizedProps,z.stateNode,m,C,(z.mode&1)!==0)}D&&Un(g)}else g.stateNode=K(D,m,C,g)}return Ir(g),null;case 13:if(xr(Br),D=g.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if(Sr&&jn!==null&&(g.mode&1)!==0&&(g.flags&128)===0)im(),os(),g.flags|=98560,z=!1;else if(z=Kc(g),D!==null&&D.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));Ba(z,g)}else os(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Ir(g),z=!1}else Yi!==null&&(Of(Yi),Yi=null),z=!0;if(!z)return g.flags&65536?g:null}return(g.flags&128)!==0?(g.lanes=C,g):(C=D!==null,C!==(m!==null&&m.memoizedState!==null)&&C&&(g.child.flags|=8192,(g.mode&1)!==0&&(m===null||(Br.current&1)!==0?Mr===0&&(Mr=3):Bl())),g.updateQueue!==null&&(g.flags|=4),Ir(g),null);case 4:return cs(),Mo(m,g),m===null&&$e(g.stateNode.containerInfo),Ir(g),null;case 10:return Nu(g.type._context),Ir(g),null;case 17:return fn(g.type)&&is(),Ir(g),null;case 19:if(xr(Br),z=g.memoizedState,z===null)return Ir(g),null;if(D=(g.flags&128)!==0,Y=z.rendering,Y===null)if(D)vi(z,!1);else{if(Mr!==0||m!==null&&(m.flags&128)!==0)for(m=g.child;m!==null;){if(Y=nf(m),Y!==null){for(g.flags|=128,vi(z,!1),m=Y.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),g.subtreeFlags=0,m=C,C=g.child;C!==null;)D=C,z=m,D.flags&=14680066,Y=D.alternate,Y===null?(D.childLanes=0,D.lanes=z,D.child=null,D.subtreeFlags=0,D.memoizedProps=null,D.memoizedState=null,D.updateQueue=null,D.dependencies=null,D.stateNode=null):(D.childLanes=Y.childLanes,D.lanes=Y.lanes,D.child=Y.child,D.subtreeFlags=0,D.deletions=null,D.memoizedProps=Y.memoizedProps,D.memoizedState=Y.memoizedState,D.updateQueue=Y.updateQueue,D.type=Y.type,z=Y.dependencies,D.dependencies=z===null?null:{lanes:z.lanes,firstContext:z.firstContext}),C=C.sibling;return $t(Br,Br.current&1|2),g.child}m=m.sibling}z.tail!==null&&dn()>Zu&&(g.flags|=128,D=!0,vi(z,!1),g.lanes=4194304)}else{if(!D)if(m=nf(Y),m!==null){if(g.flags|=128,D=!0,m=m.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),vi(z,!0),z.tail===null&&z.tailMode==="hidden"&&!Y.alternate&&!Sr)return Ir(g),null}else 2*dn()-z.renderingStartTime>Zu&&C!==1073741824&&(g.flags|=128,D=!0,vi(z,!1),g.lanes=4194304);z.isBackwards?(Y.sibling=g.child,g.child=Y):(m=z.last,m!==null?m.sibling=Y:g.child=Y,z.last=Y)}return z.tail!==null?(g=z.tail,z.rendering=g,z.tail=g.sibling,z.renderingStartTime=dn(),g.sibling=null,m=Br.current,$t(Br,D?m&1|2:m&1),g):(Ir(g),null);case 22:case 23:return Af(),C=g.memoizedState!==null,m!==null&&m.memoizedState!==null!==C&&(g.flags|=8192),C&&(g.mode&1)!==0?(an&1073741824)!==0&&(Ir(g),ye&&g.subtreeFlags&6&&(g.flags|=8192)):Ir(g),null;case 24:return null;case 25:return null}throw Error(o(156,g.tag))}function wm(m,g){switch(Mu(g),g.tag){case 1:return fn(g.type)&&is(),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return cs(),xr(ei),xr(Cn),Kd(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 5:return Xd(g),null;case 13:if(xr(Br),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(o(340));os()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return xr(Br),null;case 4:return cs(),null;case 10:return Nu(g.type._context),null;case 22:case 23:return Af(),null;case 24:return null;default:return null}}var Tl=!1,mn=!1,bi=typeof WeakSet=="function"?WeakSet:Set,it=null;function or(m,g){var C=m.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(D){_r(m,g,D)}else C.current=null}function wi(m,g,C){try{C()}catch(D){_r(m,g,D)}}var fh=!1;function xm(m,g){for(Q(m.containerInfo),it=g;it!==null;)if(m=it,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,it=g;else for(;it!==null;){m=it;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 D=C.memoizedProps,z=C.memoizedState,Y=m.stateNode,ie=Y.getSnapshotBeforeUpdate(m.elementType===m.type?D:yi(m.type,D),z);Y.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:ye&&It(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Pe){_r(m,m.return,Pe)}if(g=m.sibling,g!==null){g.return=m.return,it=g;break}it=m.return}return C=fh,fh=!1,C}function _s(m,g,C){var D=g.updateQueue;if(D=D!==null?D.lastEffect:null,D!==null){var z=D=D.next;do{if((z.tag&m)===m){var Y=z.destroy;z.destroy=void 0,Y!==void 0&&wi(g,C,Y)}z=z.next}while(z!==D)}}function Cl(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 D=C.create;C.destroy=D()}C=C.next}while(C!==g)}}function vf(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 Wu(m){var g=m.alternate;g!==null&&(m.alternate=null,Wu(g)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(g=m.stateNode,g!==null&&Se(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 dh(m){return m.tag===5||m.tag===3||m.tag===4}function Ps(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||dh(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 Gu(m,g,C){var D=m.tag;if(D===5||D===6)m=m.stateNode,g?gt(C,m,g):me(C,m);else if(D!==4&&(m=m.child,m!==null))for(Gu(m,g,C),m=m.sibling;m!==null;)Gu(m,g,C),m=m.sibling}function hh(m,g,C){var D=m.tag;if(D===5||D===6)m=m.stateNode,g?ht(C,m,g):xe(C,m);else if(D!==4&&(m=m.child,m!==null))for(hh(m,g,C),m=m.sibling;m!==null;)hh(m,g,C),m=m.sibling}var Wr=null,ii=!1;function Qi(m,g,C){for(C=C.child;C!==null;)bf(m,g,C),C=C.sibling}function bf(m,g,C){if(ti&&typeof ti.onCommitFiberUnmount=="function")try{ti.onCommitFiberUnmount(wo,C)}catch{}switch(C.tag){case 5:mn||or(C,g);case 6:if(ye){var D=Wr,z=ii;Wr=null,Qi(m,g,C),Wr=D,ii=z,Wr!==null&&(ii?be(Wr,C.stateNode):At(Wr,C.stateNode))}else Qi(m,g,C);break;case 18:ye&&Wr!==null&&(ii?yo(Wr,C.stateNode):go(Wr,C.stateNode));break;case 4:ye?(D=Wr,z=ii,Wr=C.stateNode.containerInfo,ii=!0,Qi(m,g,C),Wr=D,ii=z):(Ie&&(D=C.stateNode.containerInfo,z=Ht(D),mr(D,z)),Qi(m,g,C));break;case 0:case 11:case 14:case 15:if(!mn&&(D=C.updateQueue,D!==null&&(D=D.lastEffect,D!==null))){z=D=D.next;do{var Y=z,ie=Y.destroy;Y=Y.tag,ie!==void 0&&((Y&2)!==0||(Y&4)!==0)&&wi(C,g,ie),z=z.next}while(z!==D)}Qi(m,g,C);break;case 1:if(!mn&&(or(C,g),D=C.stateNode,typeof D.componentWillUnmount=="function"))try{D.props=C.memoizedProps,D.state=C.memoizedState,D.componentWillUnmount()}catch(Pe){_r(C,g,Pe)}Qi(m,g,C);break;case 21:Qi(m,g,C);break;case 22:C.mode&1?(mn=(D=mn)||C.memoizedState!==null,Qi(m,g,C),mn=D):Qi(m,g,C);break;default:Qi(m,g,C)}}function Es(m){var g=m.updateQueue;if(g!==null){m.updateQueue=null;var C=m.stateNode;C===null&&(C=m.stateNode=new bi),g.forEach(function(D){var z=$0.bind(null,m,D);C.has(D)||(C.add(D),D.then(z,z))})}}function Ri(m,g){var C=g.deletions;if(C!==null)for(var D=0;D<C.length;D++){var z=C[D];try{var Y=m,ie=g;if(ye){var Pe=ie;e:for(;Pe!==null;){switch(Pe.tag){case 5:Wr=Pe.stateNode,ii=!1;break e;case 3:Wr=Pe.stateNode.containerInfo,ii=!0;break e;case 4:Wr=Pe.stateNode.containerInfo,ii=!0;break e}Pe=Pe.return}if(Wr===null)throw Error(o(160));bf(Y,ie,z),Wr=null,ii=!1}else bf(Y,ie,z);var Ne=z.alternate;Ne!==null&&(Ne.return=null),z.return=null}catch(Ke){_r(z,g,Ke)}}if(g.subtreeFlags&12854)for(g=g.child;g!==null;)Xu(g,m),g=g.sibling}function Xu(m,g){var C=m.alternate,D=m.flags;switch(m.tag){case 0:case 11:case 14:case 15:if(Ri(g,m),xi(m),D&4){try{_s(3,m,m.return),Cl(3,m)}catch(lt){_r(m,m.return,lt)}try{_s(5,m,m.return)}catch(lt){_r(m,m.return,lt)}}break;case 1:Ri(g,m),xi(m),D&512&&C!==null&&or(C,C.return);break;case 5:if(Ri(g,m),xi(m),D&512&&C!==null&&or(C,C.return),ye){if(m.flags&32){var z=m.stateNode;try{_e(z)}catch(lt){_r(m,m.return,lt)}}if(D&4&&(z=m.stateNode,z!=null)){var Y=m.memoizedProps;if(C=C!==null?C.memoizedProps:Y,D=m.type,g=m.updateQueue,m.updateQueue=null,g!==null)try{qe(z,g,D,C,Y,m)}catch(lt){_r(m,m.return,lt)}}}break;case 6:if(Ri(g,m),xi(m),D&4&&ye){if(m.stateNode===null)throw Error(o(162));z=m.stateNode,Y=m.memoizedProps,C=C!==null?C.memoizedProps:Y;try{je(z,C,Y)}catch(lt){_r(m,m.return,lt)}}break;case 3:if(Ri(g,m),xi(m),D&4){if(ye&&Le&&C!==null&&C.memoizedState.isDehydrated)try{fi(g.containerInfo)}catch(lt){_r(m,m.return,lt)}if(Ie){z=g.containerInfo,Y=g.pendingChildren;try{mr(z,Y)}catch(lt){_r(m,m.return,lt)}}}break;case 4:if(Ri(g,m),xi(m),D&4&&Ie){Y=m.stateNode,z=Y.containerInfo,Y=Y.pendingChildren;try{mr(z,Y)}catch(lt){_r(m,m.return,lt)}}break;case 13:Ri(g,m),xi(m),z=m.child,z.flags&8192&&(Y=z.memoizedState!==null,z.stateNode.isHidden=Y,!Y||z.alternate!==null&&z.alternate.memoizedState!==null||(Dl=dn())),D&4&&Es(m);break;case 22:var ie=C!==null&&C.memoizedState!==null;if(m.mode&1?(mn=(C=mn)||ie,Ri(g,m),mn=C):Ri(g,m),xi(m),D&8192){if(C=m.memoizedState!==null,(m.stateNode.isHidden=C)&&!ie&&(m.mode&1)!==0)for(it=m,D=m.child;D!==null;){for(g=it=D;it!==null;){ie=it;var Pe=ie.child;switch(ie.tag){case 0:case 11:case 14:case 15:_s(4,ie,ie.return);break;case 1:or(ie,ie.return);var Ne=ie.stateNode;if(typeof Ne.componentWillUnmount=="function"){var Ke=ie,mt=ie.return;try{var Dt=Ke;Ne.props=Dt.memoizedProps,Ne.state=Dt.memoizedState,Ne.componentWillUnmount()}catch(lt){_r(Ke,mt,lt)}}break;case 5:or(ie,ie.return);break;case 22:if(ie.memoizedState!==null){Sf(g);continue}}Pe!==null?(Pe.return=ie,it=Pe):Sf(g)}D=D.sibling}if(ye){e:if(D=null,ye)for(g=m;;){if(g.tag===5){if(D===null){D=g;try{z=g.stateNode,C?ze(z):xt(g.stateNode,g.memoizedProps)}catch(lt){_r(m,m.return,lt)}}}else if(g.tag===6){if(D===null)try{Y=g.stateNode,C?Ye(Y):ot(Y,g.memoizedProps)}catch(lt){_r(m,m.return,lt)}}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;D===g&&(D=null),g=g.return}D===g&&(D=null),g.sibling.return=g.return,g=g.sibling}}}break;case 19:Ri(g,m),xi(m),D&4&&Es(m);break;case 21:break;default:Ri(g,m),xi(m)}}function xi(m){var g=m.flags;if(g&2){try{if(ye){e:{for(var C=m.return;C!==null;){if(dh(C)){var D=C;break e}C=C.return}throw Error(o(160))}switch(D.tag){case 5:var z=D.stateNode;D.flags&32&&(_e(z),D.flags&=-33);var Y=Ps(m);hh(m,Y,z);break;case 3:case 4:var ie=D.stateNode.containerInfo,Pe=Ps(m);Gu(m,Pe,ie);break;default:throw Error(o(161))}}}catch(Ne){_r(m,m.return,Ne)}m.flags&=-3}g&4096&&(m.flags&=-4097)}function Ol(m,g,C){it=m,wf(m)}function wf(m,g,C){for(var D=(m.mode&1)!==0;it!==null;){var z=it,Y=z.child;if(z.tag===22&&D){var ie=z.memoizedState!==null||Tl;if(!ie){var Pe=z.alternate,Ne=Pe!==null&&Pe.memoizedState!==null||mn;Pe=Tl;var Ke=mn;if(Tl=ie,(mn=Ne)&&!Ke)for(it=z;it!==null;)ie=it,Ne=ie.child,ie.tag===22&&ie.memoizedState!==null?kf(z):Ne!==null?(Ne.return=ie,it=Ne):kf(z);for(;Y!==null;)it=Y,wf(Y),Y=Y.sibling;it=z,Tl=Pe,mn=Ke}xf(m)}else(z.subtreeFlags&8772)!==0&&Y!==null?(Y.return=z,it=Y):xf(m)}}function xf(m){for(;it!==null;){var g=it;if((g.flags&8772)!==0){var C=g.alternate;try{if((g.flags&8772)!==0)switch(g.tag){case 0:case 11:case 15:mn||Cl(5,g);break;case 1:var D=g.stateNode;if(g.flags&4&&!mn)if(C===null)D.componentDidMount();else{var z=g.elementType===g.type?C.memoizedProps:yi(g.type,C.memoizedProps);D.componentDidUpdate(z,C.memoizedState,D.__reactInternalSnapshotBeforeUpdate)}var Y=g.updateQueue;Y!==null&&cm(g,Y,D);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}cm(g,ie,C)}break;case 5:var Pe=g.stateNode;C===null&&g.flags&4&&ve(Pe,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 Ke=Ne.memoizedState;if(Ke!==null){var mt=Ke.dehydrated;mt!==null&&za(mt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}mn||g.flags&512&&vf(g)}catch(Dt){_r(g,g.return,Dt)}}if(g===m){it=null;break}if(C=g.sibling,C!==null){C.return=g.return,it=C;break}it=g.return}}function Sf(m){for(;it!==null;){var g=it;if(g===m){it=null;break}var C=g.sibling;if(C!==null){C.return=g.return,it=C;break}it=g.return}}function kf(m){for(;it!==null;){var g=it;try{switch(g.tag){case 0:case 11:case 15:var C=g.return;try{Cl(4,g)}catch(Ne){_r(g,C,Ne)}break;case 1:var D=g.stateNode;if(typeof D.componentDidMount=="function"){var z=g.return;try{D.componentDidMount()}catch(Ne){_r(g,z,Ne)}}var Y=g.return;try{vf(g)}catch(Ne){_r(g,Y,Ne)}break;case 5:var ie=g.return;try{vf(g)}catch(Ne){_r(g,ie,Ne)}}}catch(Ne){_r(g,g.return,Ne)}if(g===m){it=null;break}var Pe=g.sibling;if(Pe!==null){Pe.return=g.return,it=Pe;break}it=g.return}}var Ya=0,qn=1,wa=2,Al=3,Yu=4;if(typeof Symbol=="function"&&Symbol.for){var Si=Symbol.for;Ya=Si("selector.component"),qn=Si("selector.has_pseudo_class"),wa=Si("selector.role"),Al=Si("selector.test_id"),Yu=Si("selector.text")}function xa(m){var g=Ue(m);if(g!=null){if(typeof g.memoizedProps["data-testname"]!="string")throw Error(o(364));return g}if(m=Ce(m),m===null)throw Error(o(362));return m.stateNode.current}function Ku(m,g){switch(g.$$typeof){case Ya:if(m.type===g.value)return!0;break;case qn:e:{g=g.value,m=[m,0];for(var C=0;C<m.length;){var D=m[C++],z=m[C++],Y=g[z];if(D.tag!==5||!Oe(D)){for(;Y!=null&&Ku(D,Y);)z++,Y=g[z];if(z===g.length){g=!0;break e}else for(D=D.child;D!==null;)m.push(D,z),D=D.sibling}}g=!1}return g;case wa:if(m.tag===5&&Be(m.stateNode,g.value))return!0;break;case Yu:if((m.tag===5||m.tag===6)&&(m=ke(m),m!==null&&0<=m.indexOf(g.value)))return!0;break;case Al: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 _f(m){switch(m.$$typeof){case Ya:return"<"+(T(m.value)||"Unknown")+">";case qn:return":has("+(_f(m)||"")+")";case wa:return'[role="'+m.value+'"]';case Yu:return'"'+m.value+'"';case Al:return'[data-testname="'+m.value+'"]';default:throw Error(o(365))}}function Sa(m,g){var C=[];m=[m,0];for(var D=0;D<m.length;){var z=m[D++],Y=m[D++],ie=g[Y];if(z.tag!==5||!Oe(z)){for(;ie!=null&&Ku(z,ie);)Y++,ie=g[Y];if(Y===g.length)C.push(z);else for(z=z.child;z!==null;)m.push(z,Y),z=z.sibling}}return C}function ka(m,g){if(!he)throw Error(o(363));m=xa(m),m=Sa(m,g),g=[],m=Array.from(m);for(var C=0;C<m.length;){var D=m[C++];if(D.tag===5)Oe(D)||g.push(D.stateNode);else for(D=D.child;D!==null;)m.push(D),D=D.sibling}return g}var Pf=Math.ceil,Qu=s.ReactCurrentDispatcher,Il=s.ReactCurrentOwner,Ur=s.ReactCurrentBatchConfig,Lt=0,pr=null,Rr=null,Gr=0,an=0,No=yn(0),Mr=0,Rl=null,Ka=0,vr=0,Ml=0,Ts=null,In=null,Dl=0,Zu=1/0,Vn=null;function fr(){Zu=dn()+500}var Hr=!1,Zr=null,Zi=null,Lo=!1,Mi=null,Ef=0,Jr=0,Ju=null,Nl=-1,Ll=0;function kr(){return(Lt&6)!==0?dn():Nl!==-1?Nl:Nl=dn()}function on(m){return(m.mode&1)===0?1:(Lt&2)!==0&&Gr!==0?Gr&-Gr:j0.transition!==null?(Ll===0&&(Ll=$c()),Ll):(m=qt,m!==0?m:rt())}function Rn(m,g,C,D){if(50<Jr)throw Jr=0,Ju=null,Error(o(185));Ci(m,C,D),((Lt&2)===0||m!==pr)&&(m===pr&&((Lt&2)===0&&(vr|=C),Mr===4&&Qa(m,Gr)),Mn(m,D),C===1&&Lt===0&&(g.mode&1)===0&&(fr(),ml&&vn()))}function Mn(m,g){var C=m.callbackNode;Qp(m,g);var D=fl(m,m===pr?Gr:0);if(D===0)C!==null&&Zp(C),m.callbackNode=null,m.callbackPriority=0;else if(g=D&-D,m.callbackPriority!==g){if(C!=null&&Zp(C),g===1)m.tag===0?em(ph.bind(null,m)):Xc(ph.bind(null,m)),de?se(function(){(Lt&6)===0&&vn()}):ma(qc,vn),C=null;else{switch(hl(D)){case 1:C=qc;break;case 4:C=Vc;break;case 16:C=Wc;break;case 536870912:C=z0;break;default:C=Wc}C=xh(C,Tf.bind(null,m))}m.callbackPriority=g,m.callbackNode=C}}function Tf(m,g){if(Nl=-1,Ll=0,(Lt&6)!==0)throw Error(o(327));var C=m.callbackNode;if(Za()&&m.callbackNode!==C)return null;var D=fl(m,m===pr?Gr:0);if(D===0)return null;if((D&30)!==0||(D&m.expiredLanes)!==0||g)g=Cs(m,D);else{g=D;var z=Lt;Lt|=2;var Y=gh();(pr!==m||Gr!==g)&&(Vn=null,fr(),Fo(m,g));do try{yh();break}catch(Pe){Fl(m,Pe)}while(!0);qd(),Qu.current=Y,Lt=z,Rr!==null?g=0:(pr=null,Gr=0,g=Mr)}if(g!==0){if(g===2&&(z=Hc(m),z!==0&&(D=z,g=Cf(m,z))),g===1)throw C=Rl,Fo(m,0),Qa(m,D),Mn(m,dn()),C;if(g===6)Qa(m,D);else{if(z=m.current.alternate,(D&30)===0&&!Sm(z)&&(g=Cs(m,D),g===2&&(Y=Hc(m),Y!==0&&(D=Y,g=Cf(m,Y))),g===1))throw C=Rl,Fo(m,0),Qa(m,D),Mn(m,dn()),C;switch(m.finishedWork=z,m.finishedLanes=D,g){case 0:case 1:throw Error(o(345));case 2:Bo(m,In,Vn);break;case 3:if(Qa(m,D),(D&130023424)===D&&(g=Dl+500-dn(),10<g)){if(fl(m,0)!==0)break;if(z=m.suspendedLanes,(z&D)!==D){kr(),m.pingedLanes|=m.suspendedLanes&z;break}m.timeoutHandle=ne(Bo.bind(null,m,In,Vn),g);break}Bo(m,In,Vn);break;case 4:if(Qa(m,D),(D&4194240)===D)break;for(g=m.eventTimes,z=-1;0<D;){var ie=31-di(D);Y=1<<ie,ie=g[ie],ie>z&&(z=ie),D&=~Y}if(D=z,D=dn()-D,D=(120>D?120:480>D?480:1080>D?1080:1920>D?1920:3e3>D?3e3:4320>D?4320:1960*Pf(D/1960))-D,10<D){m.timeoutHandle=ne(Bo.bind(null,m,In,Vn),D);break}Bo(m,In,Vn);break;case 5:Bo(m,In,Vn);break;default:throw Error(o(329))}}}return Mn(m,dn()),m.callbackNode===C?Tf.bind(null,m):null}function Cf(m,g){var C=Ts;return m.current.memoizedState.isDehydrated&&(Fo(m,g).flags|=256),m=Cs(m,g),m!==2&&(g=In,In=C,g!==null&&Of(g)),m}function Of(m){In===null?In=m:In.push.apply(In,m)}function Sm(m){for(var g=m;;){if(g.flags&16384){var C=g.updateQueue;if(C!==null&&(C=C.stores,C!==null))for(var D=0;D<C.length;D++){var z=C[D],Y=z.getSnapshot;z=z.value;try{if(!Wi(Y(),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 Qa(m,g){for(g&=~Ml,g&=~vr,m.suspendedLanes|=g,m.pingedLanes&=~g,m=m.expirationTimes;0<g;){var C=31-di(g),D=1<<C;m[C]=-1,g&=~D}}function ph(m){if((Lt&6)!==0)throw Error(o(327));Za();var g=fl(m,0);if((g&1)===0)return Mn(m,dn()),null;var C=Cs(m,g);if(m.tag!==0&&C===2){var D=Hc(m);D!==0&&(g=D,C=Cf(m,D))}if(C===1)throw C=Rl,Fo(m,0),Qa(m,g),Mn(m,dn()),C;if(C===6)throw Error(o(345));return m.finishedWork=m.current.alternate,m.finishedLanes=g,Bo(m,In,Vn),Mn(m,dn()),null}function mh(m){Mi!==null&&Mi.tag===0&&(Lt&6)===0&&Za();var g=Lt;Lt|=1;var C=Ur.transition,D=qt;try{if(Ur.transition=null,qt=1,m)return m()}finally{qt=D,Ur.transition=C,Lt=g,(Lt&6)===0&&vn()}}function Af(){an=No.current,xr(No)}function Fo(m,g){m.finishedWork=null,m.finishedLanes=0;var C=m.timeoutHandle;if(C!==ae&&(m.timeoutHandle=ae,le(C)),Rr!==null)for(C=Rr.return;C!==null;){var D=C;switch(Mu(D),D.tag){case 1:D=D.type.childContextTypes,D!=null&&is();break;case 3:cs(),xr(ei),xr(Cn),Kd();break;case 5:Xd(D);break;case 4:cs();break;case 13:xr(Br);break;case 19:xr(Br);break;case 10:Nu(D.type._context);break;case 22:case 23:Af()}C=C.return}if(pr=m,Rr=m=zo(m.current,null),Gr=an=g,Mr=0,Rl=null,Ml=vr=Ka=0,In=Ts=null,So!==null){for(g=0;g<So.length;g++)if(C=So[g],D=C.interleaved,D!==null){C.interleaved=null;var z=D.next,Y=C.pending;if(Y!==null){var ie=Y.next;Y.next=z,D.next=ie}C.pending=D}So=null}return m}function Fl(m,g){do{var C=Rr;try{if(qd(),ni.current=ys,xl){for(var D=Ar.memoizedState;D!==null;){var z=D.queue;z!==null&&(z.pending=null),D=D.next}xl=!1}if(Eo=0,rn=Qr=Ar=null,Fu=!1,Bu=0,Il.current=null,C===null||C.return===null){Mr=1,Rl=g,Rr=null;break}e:{var Y=m,ie=C.return,Pe=C,Ne=g;if(g=Gr,Pe.flags|=32768,Ne!==null&&typeof Ne=="object"&&typeof Ne.then=="function"){var Ke=Ne,mt=Pe,Dt=mt.tag;if((mt.mode&1)===0&&(Dt===0||Dt===11||Dt===15)){var lt=mt.alternate;lt?(mt.updateQueue=lt.updateQueue,mt.memoizedState=lt.memoizedState,mt.lanes=lt.lanes):(mt.updateQueue=null,mt.memoizedState=null)}var br=vm(ie);if(br!==null){br.flags&=-257,Oo(br,ie,Pe,Y,g),br.mode&1&&ym(Y,Ke,g),g=br,Ne=Ke;var sr=g.updateQueue;if(sr===null){var Wn=new Set;Wn.add(Ne),g.updateQueue=Wn}else sr.add(Ne);break e}else{if((g&1)===0){ym(Y,Ke,g),Bl();break e}Ne=Error(o(426))}}else if(Sr&&Pe.mode&1){var _a=vm(ie);if(_a!==null){(_a.flags&65536)===0&&(_a.flags|=256),Oo(_a,ie,Pe,Y,g),Hd(vs(Ne,Pe));break e}}Y=Ne=vs(Ne,Pe),Mr!==4&&(Mr=2),Ts===null?Ts=[Y]:Ts.push(Y),Y=ie;do{switch(Y.tag){case 3:Y.flags|=65536,g&=-g,Y.lanes|=g;var Me=ya(Y,Ne,g);bl(Y,Me);break e;case 1:Pe=Ne;var Ee=Y.type,Fe=Y.stateNode;if((Y.flags&128)===0&&(typeof Ee.getDerivedStateFromError=="function"||Fe!==null&&typeof Fe.componentDidCatch=="function"&&(Zi===null||!Zi.has(Fe)))){Y.flags|=65536,g&=-g,Y.lanes|=g;var ut=pf(Y,Pe,g);bl(Y,ut);break e}}Y=Y.return}while(Y!==null)}bh(C)}catch(_t){g=_t,Rr===C&&C!==null&&(Rr=C=C.return);continue}break}while(!0)}function gh(){var m=Qu.current;return Qu.current=ys,m===null?ys:m}function Bl(){(Mr===0||Mr===3||Mr===2)&&(Mr=4),pr===null||(Ka&268435455)===0&&(vr&268435455)===0||Qa(pr,Gr)}function Cs(m,g){var C=Lt;Lt|=2;var D=gh();(pr!==m||Gr!==g)&&(Vn=null,Fo(m,g));do try{km();break}catch(z){Fl(m,z)}while(!0);if(qd(),Lt=C,Qu.current=D,Rr!==null)throw Error(o(261));return pr=null,Gr=0,Mr}function km(){for(;Rr!==null;)vh(Rr)}function yh(){for(;Rr!==null&&!Jp();)vh(Rr)}function vh(m){var g=Cm(m.alternate,m,an);m.memoizedProps=m.pendingProps,g===null?bh(m):Rr=g,Il.current=null}function bh(m){var g=m;do{var C=g.alternate;if(m=g.return,(g.flags&32768)===0){if(C=ks(C,g,an),C!==null){Rr=C;return}}else{if(C=wm(C,g),C!==null){C.flags&=32767,Rr=C;return}if(m!==null)m.flags|=32768,m.subtreeFlags=0,m.deletions=null;else{Mr=6,Rr=null;return}}if(g=g.sibling,g!==null){Rr=g;return}Rr=g=m}while(g!==null);Mr===0&&(Mr=5)}function Bo(m,g,C){var D=qt,z=Ur.transition;try{Ur.transition=null,qt=1,_m(m,g,C,D)}finally{Ur.transition=z,qt=D}return null}function _m(m,g,C,D){do Za();while(Mi!==null);if((Lt&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 Y=C.lanes|C.childLanes;if(bo(m,Y),m===pr&&(Rr=pr=null,Gr=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||Lo||(Lo=!0,xh(Wc,function(){return Za(),null})),Y=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||Y){Y=Ur.transition,Ur.transition=null;var ie=qt;qt=1;var Pe=Lt;Lt|=4,Il.current=null,xm(m,C),Xu(C,m),U(m.containerInfo),m.current=C,Ol(C),Au(),Lt=Pe,qt=ie,Ur.transition=Y}else m.current=C;if(Lo&&(Lo=!1,Mi=m,Ef=z),Y=m.pendingLanes,Y===0&&(Zi=null),pl(C.stateNode),Mn(m,dn()),g!==null)for(D=m.onRecoverableError,C=0;C<g.length;C++)z=g[C],D(z.value,{componentStack:z.stack,digest:z.digest});if(Hr)throw Hr=!1,m=Zr,Zr=null,m;return(Ef&1)!==0&&m.tag!==0&&Za(),Y=m.pendingLanes,(Y&1)!==0?m===Ju?Jr++:(Jr=0,Ju=m):Jr=0,vn(),null}function Za(){if(Mi!==null){var m=hl(Ef),g=Ur.transition,C=qt;try{if(Ur.transition=null,qt=16>m?16:m,Mi===null)var D=!1;else{if(m=Mi,Mi=null,Ef=0,(Lt&6)!==0)throw Error(o(331));var z=Lt;for(Lt|=4,it=m.current;it!==null;){var Y=it,ie=Y.child;if((it.flags&16)!==0){var Pe=Y.deletions;if(Pe!==null){for(var Ne=0;Ne<Pe.length;Ne++){var Ke=Pe[Ne];for(it=Ke;it!==null;){var mt=it;switch(mt.tag){case 0:case 11:case 15:_s(8,mt,Y)}var Dt=mt.child;if(Dt!==null)Dt.return=mt,it=Dt;else for(;it!==null;){mt=it;var lt=mt.sibling,br=mt.return;if(Wu(mt),mt===Ke){it=null;break}if(lt!==null){lt.return=br,it=lt;break}it=br}}}var sr=Y.alternate;if(sr!==null){var Wn=sr.child;if(Wn!==null){sr.child=null;do{var _a=Wn.sibling;Wn.sibling=null,Wn=_a}while(Wn!==null)}}it=Y}}if((Y.subtreeFlags&2064)!==0&&ie!==null)ie.return=Y,it=ie;else e:for(;it!==null;){if(Y=it,(Y.flags&2048)!==0)switch(Y.tag){case 0:case 11:case 15:_s(9,Y,Y.return)}var Me=Y.sibling;if(Me!==null){Me.return=Y.return,it=Me;break e}it=Y.return}}var Ee=m.current;for(it=Ee;it!==null;){ie=it;var Fe=ie.child;if((ie.subtreeFlags&2064)!==0&&Fe!==null)Fe.return=ie,it=Fe;else e:for(ie=Ee;it!==null;){if(Pe=it,(Pe.flags&2048)!==0)try{switch(Pe.tag){case 0:case 11:case 15:Cl(9,Pe)}}catch(_t){_r(Pe,Pe.return,_t)}if(Pe===ie){it=null;break e}var ut=Pe.sibling;if(ut!==null){ut.return=Pe.return,it=ut;break e}it=Pe.return}}if(Lt=z,vn(),ti&&typeof ti.onPostCommitFiberRoot=="function")try{ti.onPostCommitFiberRoot(wo,m)}catch{}D=!0}return D}finally{qt=C,Ur.transition=g}}return!1}function wh(m,g,C){g=vs(C,g),g=ya(m,g,1),m=Va(m,g,1),g=kr(),m!==null&&(Ci(m,1,g),Mn(m,g))}function _r(m,g,C){if(m.tag===3)wh(m,m,C);else for(;g!==null;){if(g.tag===3){wh(g,m,C);break}else if(g.tag===1){var D=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof D.componentDidCatch=="function"&&(Zi===null||!Zi.has(D))){m=vs(C,m),m=pf(g,m,1),g=Va(g,m,1),m=kr(),g!==null&&(Ci(g,1,m),Mn(g,m));break}}g=g.return}}function Pm(m,g,C){var D=m.pingCache;D!==null&&D.delete(g),g=kr(),m.pingedLanes|=m.suspendedLanes&C,pr===m&&(Gr&C)===C&&(Mr===4||Mr===3&&(Gr&130023424)===Gr&&500>dn()-Dl?Fo(m,0):Ml|=C),Mn(m,g)}function Em(m,g){g===0&&((m.mode&1)===0?g=1:(g=Ou,Ou<<=1,(Ou&130023424)===0&&(Ou=4194304)));var C=kr();m=Ki(m,g),m!==null&&(Ci(m,g,C),Mn(m,C))}function Tm(m){var g=m.memoizedState,C=0;g!==null&&(C=g.retryLane),Em(m,C)}function $0(m,g){var C=0;switch(m.tag){case 13:var D=m.stateNode,z=m.memoizedState;z!==null&&(C=z.retryLane);break;case 19:D=m.stateNode;break;default:throw Error(o(314))}D!==null&&D.delete(g),Em(m,C)}var Cm;Cm=function(m,g,C){if(m!==null)if(m.memoizedProps!==g.pendingProps||ei.current)nn=!0;else{if((m.lanes&C)===0&&(g.flags&128)===0)return nn=!1,Io(m,g,C);nn=(m.flags&131072)!==0}else nn=!1,Sr&&(g.flags&1048576)!==0&&tm(g,as,g.index);switch(g.lanes=0,g.tag){case 2:var D=g.type;Vu(m,g),m=g.pendingProps;var z=Ua(g,Cn.current);vl(g,C),z=zu(null,g,D,m,z,C);var Y=af();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,fn(D)?(Y=!0,ul(g)):Y=!1,g.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,Wd(g),z.updater=Hu,g.stateNode=z,z._reactInternals=g,ga(g,D,m,C),g=On(null,g,D,!0,Y,C)):(g.tag=0,Sr&&Y&&Ru(g),pn(null,g,z,C),g=g.child),g;case 16:D=g.elementType;e:{switch(Vu(m,g),m=g.pendingProps,z=D._init,D=z(D._payload),g.type=D,z=g.tag=q0(D),m=yi(D,m),z){case 0:g=va(null,g,D,m,C);break e;case 1:g=xn(null,g,D,m,C);break e;case 11:g=mf(null,g,D,m,C);break e;case 14:g=bs(null,g,D,yi(D.type,m),C);break e}throw Error(o(306,D,""))}return g;case 0:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:yi(D,z),va(m,g,D,z,C);case 1:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:yi(D,z),xn(m,g,D,z,C);case 3:e:{if(Ao(g),m===null)throw Error(o(387));D=g.pendingProps,Y=g.memoizedState,z=Y.element,um(m,g),ko(g,D,null,C);var ie=g.memoizedState;if(D=ie.element,Le&&Y.isDehydrated)if(Y={element:D,isDehydrated:!1,cache:ie.cache,pendingSuspenseBoundaries:ie.pendingSuspenseBoundaries,transitions:ie.transitions},g.updateQueue.baseState=Y,g.memoizedState=Y,g.flags&256){z=vs(Error(o(423)),g),g=ws(m,g,D,C,z);break e}else if(D!==z){z=vs(Error(o(424)),g),g=ws(m,g,D,C,z);break e}else for(Le&&(jn=po(g.stateNode.containerInfo),bn=g,Sr=!0,Yi=null,Du=!1),C=sm(g,null,D,C),g.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(os(),D===z){g=Xa(m,g,C);break e}pn(m,g,D,C)}g=g.child}return g;case 5:return Gd(g),m===null&&Ud(g),D=g.type,z=g.pendingProps,Y=m!==null?m.memoizedProps:null,ie=z.children,re(D,z)?ie=null:Y!==null&&re(D,Y)&&(g.flags|=32),hr(m,g),pn(m,g,ie,C),g.child;case 6:return m===null&&Ud(g),null;case 13:return ch(m,g,C);case 4:return rf(g,g.stateNode.containerInfo),D=g.pendingProps,m===null?g.child=ls(g,null,D,C):pn(m,g,D,C),g.child;case 11:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:yi(D,z),mf(m,g,D,z,C);case 7:return pn(m,g,g.pendingProps,C),g.child;case 8:return pn(m,g,g.pendingProps.children,C),g.child;case 12:return pn(m,g,g.pendingProps.children,C),g.child;case 10:e:{if(D=g.type._context,z=g.pendingProps,Y=g.memoizedProps,ie=z.value,lm(g,D,ie),Y!==null)if(Wi(Y.value,ie)){if(Y.children===z.children&&!ei.current){g=Xa(m,g,C);break e}}else for(Y=g.child,Y!==null&&(Y.return=g);Y!==null;){var Pe=Y.dependencies;if(Pe!==null){ie=Y.child;for(var Ne=Pe.firstContext;Ne!==null;){if(Ne.context===D){if(Y.tag===1){Ne=qa(-1,C&-C),Ne.tag=2;var Ke=Y.updateQueue;if(Ke!==null){Ke=Ke.shared;var mt=Ke.pending;mt===null?Ne.next=Ne:(Ne.next=mt.next,mt.next=Ne),Ke.pending=Ne}}Y.lanes|=C,Ne=Y.alternate,Ne!==null&&(Ne.lanes|=C),us(Y.return,C,g),Pe.lanes|=C;break}Ne=Ne.next}}else if(Y.tag===10)ie=Y.type===g.type?null:Y.child;else if(Y.tag===18){if(ie=Y.return,ie===null)throw Error(o(341));ie.lanes|=C,Pe=ie.alternate,Pe!==null&&(Pe.lanes|=C),us(ie,C,g),ie=Y.sibling}else ie=Y.child;if(ie!==null)ie.return=Y;else for(ie=Y;ie!==null;){if(ie===g){ie=null;break}if(Y=ie.sibling,Y!==null){Y.return=ie.return,ie=Y;break}ie=ie.return}Y=ie}pn(m,g,z.children,C),g=g.child}return g;case 9:return z=g.type,D=g.pendingProps.children,vl(g,C),z=pi(z),D=D(z),g.flags|=1,pn(m,g,D,C),g.child;case 14:return D=g.type,z=yi(D,g.pendingProps),z=yi(D.type,z),bs(m,g,D,z,C);case 15:return Ga(m,g,g.type,g.pendingProps,C);case 17:return D=g.type,z=g.pendingProps,z=g.elementType===D?z:yi(D,z),Vu(m,g),g.tag=1,fn(D)?(m=!0,ul(g)):m=!1,vl(g,C),gm(g,D,z),ga(g,D,z,C),On(null,g,D,!0,m,C);case 19:return yf(m,g,C);case 22:return yr(m,g,C)}throw Error(o(156,g.tag))};function xh(m,g){return ma(m,g)}function Om(m,g,C,D){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=D,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ki(m,g,C,D){return new Om(m,g,C,D)}function zl(m){return m=m.prototype,!(!m||!m.isReactComponent)}function q0(m){if(typeof m=="function")return zl(m)?1:0;if(m!=null){if(m=m.$$typeof,m===b)return 11;if(m===S)return 14}return 2}function zo(m,g){var C=m.alternate;return C===null?(C=ki(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 If(m,g,C,D,z,Y){var ie=2;if(D=m,typeof m=="function")zl(m)&&(ie=1);else if(typeof m=="string")ie=5;else e:switch(m){case f:return Sn(C.children,z,Y,g);case p:ie=8,z|=8;break;case h:return m=ki(12,C,g,z|2),m.elementType=h,m.lanes=Y,m;case x:return m=ki(13,C,g,z),m.elementType=x,m.lanes=Y,m;case k:return m=ki(19,C,g,z),m.elementType=k,m.lanes=Y,m;case _:return jl(C,z,Y,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,D=null;break e}throw Error(o(130,m==null?m:typeof m,""))}return g=ki(ie,C,g,z),g.elementType=m,g.type=D,g.lanes=Y,g}function Sn(m,g,C,D){return m=ki(7,m,D,g),m.lanes=C,m}function jl(m,g,C,D){return m=ki(22,m,D,g),m.elementType=_,m.lanes=C,m.stateNode={isHidden:!1},m}function Ul(m,g,C){return m=ki(6,m,null,g),m.lanes=C,m}function Rf(m,g,C){return g=ki(4,m.children!==null?m.children:[],m.key,g),g.lanes=C,g.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},g}function Am(m,g,C,D,z){this.tag=g,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ae,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=D,this.onRecoverableError=z,Le&&(this.mutableSourceEagerHydrationData=null)}function Sh(m,g,C,D,z,Y,ie,Pe,Ne){return m=new Am(m,g,C,Pe,Ne),g===1?(g=1,Y===!0&&(g|=8)):g=0,Y=ki(3,null,null,g),m.current=Y,Y.stateNode=m,Y.memoizedState={element:D,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wd(Y),m}function Mf(m){if(!m)return vo;m=m._reactInternals;e:{if(M(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(fn(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(fn(C))return Yp(m,C,g)}return g}function Os(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=B(g),m===null?null:m.stateNode}function Df(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var C=m.retryLane;m.retryLane=C!==0&&C<g?C:g}}function Hl(m,g){Df(m,g),(m=m.alternate)&&Df(m,g)}function V0(m){return m=B(m),m===null?null:m.stateNode}function Im(){return null}return r.attemptContinuousHydration=function(m){if(m.tag===13){var g=Ki(m,134217728);if(g!==null){var C=kr();Rn(g,m,134217728,C)}Hl(m,134217728)}},r.attemptDiscreteHydration=function(m){if(m.tag===13){var g=Ki(m,1);if(g!==null){var C=kr();Rn(g,m,1,C)}Hl(m,1)}},r.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13){var g=on(m),C=Ki(m,g);if(C!==null){var D=kr();Rn(C,m,g,D)}Hl(m,g)}},r.attemptSynchronousHydration=function(m){switch(m.tag){case 3:var g=m.stateNode;if(g.current.memoizedState.isDehydrated){var C=cl(g.pendingLanes);C!==0&&(pa(g,C|1),Mn(g,dn()),(Lt&6)===0&&(fr(),vn()))}break;case 13:mh(function(){var D=Ki(m,1);if(D!==null){var z=kr();Rn(D,m,1,z)}}),Hl(m,1)}},r.batchedUpdates=function(m,g){var C=Lt;Lt|=1;try{return m(g)}finally{Lt=C,Lt===0&&(fr(),ml&&vn())}},r.createComponentSelector=function(m){return{$$typeof:Ya,value:m}},r.createContainer=function(m,g,C,D,z,Y,ie){return Sh(m,g,!1,null,C,D,z,Y,ie)},r.createHasPseudoClassSelector=function(m){return{$$typeof:qn,value:m}},r.createHydrationContainer=function(m,g,C,D,z,Y,ie,Pe,Ne){return m=Sh(C,D,!0,m,z,Y,ie,Pe,Ne),m.context=Mf(null),C=m.current,D=kr(),z=on(C),Y=qa(D,z),Y.callback=g??null,Va(C,Y,z),m.current.lanes=z,Ci(m,z,D),Mn(m,D),m},r.createPortal=function(m,g,C){var D=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:D==null?null:""+D,children:m,containerInfo:g,implementation:C}},r.createRoleSelector=function(m){return{$$typeof:wa,value:m}},r.createTestNameSelector=function(m){return{$$typeof:Al,value:m}},r.createTextSelector=function(m){return{$$typeof:Yu,value:m}},r.deferredUpdates=function(m){var g=qt,C=Ur.transition;try{return Ur.transition=null,qt=16,m()}finally{qt=g,Ur.transition=C}},r.discreteUpdates=function(m,g,C,D,z){var Y=qt,ie=Ur.transition;try{return Ur.transition=null,qt=1,m(g,C,D,z)}finally{qt=Y,Ur.transition=ie,Lt===0&&fr()}},r.findAllNodes=ka,r.findBoundingRects=function(m,g){if(!he)throw Error(o(363));g=ka(m,g),m=[];for(var C=0;C<g.length;C++)m.push(oe(g[C]));for(g=m.length-1;0<g;g--){C=m[g];for(var D=C.x,z=D+C.width,Y=C.y,ie=Y+C.height,Pe=g-1;0<=Pe;Pe--)if(g!==Pe){var Ne=m[Pe],Ke=Ne.x,mt=Ke+Ne.width,Dt=Ne.y,lt=Dt+Ne.height;if(D>=Ke&&Y>=Dt&&z<=mt&&ie<=lt){m.splice(g,1);break}else if(D!==Ke||C.width!==Ne.width||lt<Y||Dt>ie){if(!(Y!==Dt||C.height!==Ne.height||mt<D||Ke>z)){Ke>D&&(Ne.width+=Ke-D,Ne.x=D),mt<z&&(Ne.width=z-Ke),m.splice(g,1);break}}else{Dt>Y&&(Ne.height+=Dt-Y,Ne.y=Y),lt<ie&&(Ne.height=ie-Dt),m.splice(g,1);break}}}return m},r.findHostInstance=Os,r.findHostInstanceWithNoPortals=function(m){return m=N(m),m=m!==null?$(m):null,m===null?null:m.stateNode},r.findHostInstanceWithWarning=function(m){return Os(m)},r.flushControlled=function(m){var g=Lt;Lt|=1;var C=Ur.transition,D=qt;try{Ur.transition=null,qt=1,m()}finally{qt=D,Ur.transition=C,Lt=g,Lt===0&&(fr(),vn())}},r.flushPassiveEffects=Za,r.flushSync=mh,r.focusWithin=function(m,g){if(!he)throw Error(o(363));for(m=xa(m),g=Sa(m,g),g=Array.from(g),m=0;m<g.length;){var C=g[m++];if(!Oe(C)){if(C.tag===5&&dt(C.stateNode))return!0;for(C=C.child;C!==null;)g.push(C),C=C.sibling}}return!1},r.getCurrentUpdatePriority=function(){return qt},r.getFindAllNodesFailureDescription=function(m,g){if(!he)throw Error(o(363));var C=0,D=[];m=[xa(m),0];for(var z=0;z<m.length;){var Y=m[z++],ie=m[z++],Pe=g[ie];if((Y.tag!==5||!Oe(Y))&&(Ku(Y,Pe)&&(D.push(_f(Pe)),ie++,ie>C&&(C=ie)),ie<g.length))for(Y=Y.child;Y!==null;)m.push(Y,ie),Y=Y.sibling}if(C<g.length){for(m=[];C<g.length;C++)m.push(_f(g[C]));return`findAllNodes was able to match part of the selector:
|
|
31
|
+
`+(D.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:V0,findFiberByHostInstance:m.findFiberByHostInstance||Im,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{wo=g.inject(m),ti=g}catch{}m=!!g.checkDCE}}return m},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(m,g,C,D){if(!he)throw Error(o(363));m=ka(m,g);var z=nt(m,C,D).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=qt;try{return qt=m,g()}finally{qt=C}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(m,g,C,D){var z=g.current,Y=kr(),ie=on(z);return C=Mf(C),g.context===null?g.context=C:g.pendingContext=C,g=qa(Y,ie),g.payload={element:m},D=D===void 0?null:D,D!==null&&(g.callback=D),m=Va(z,g,ie),m!==null&&(Rn(m,z,ie,Y),Lu(m,z,ie)),ie},r}),N1}var Vw;function R7(){return Vw||(Vw=1,D1.exports=I7()),D1.exports}var M7=R7();const D7=Oc(M7);var L1={exports:{}},Kl={};var Ww;function N7(){return Ww||(Ww=1,Kl.ConcurrentRoot=1,Kl.ContinuousEventPriority=4,Kl.DefaultEventPriority=16,Kl.DiscreteEventPriority=1,Kl.IdleEventPriority=536870912,Kl.LegacyRoot=0),Kl}var Gw;function L7(){return Gw||(Gw=1,L1.exports=N7()),L1.exports}var M5=L7();const Xw={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let Yw=!1,Kw=!1;const I2=".react-konva-event",F7=`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
|
+
`,B7=`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
|
+
`,z7={};function w0(t,e,r=z7){if(!Yw&&"zIndex"in e&&(console.warn(B7),Yw=!0),!Kw&&e.draggable){var n=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;n&&!i&&(console.warn(F7),Kw=!0)}for(var a in r)if(!Xw[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 d=!e.hasOwnProperty(a);d&&t.setAttr(a,void 0)}var f=e._useStrictMode,p={},h=!1;const y={};for(var a in e)if(!Xw[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]||f&&e[a]!==t.getAttr(a))&&(h=!0,p[a]=e[a])}h&&(t.setAttrs(p),ku(t));for(var u in y)t.on(u+I2,y[u])}function ku(t){if(!et.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}var F1=p2();const D5={},j7={};Ec.Node.prototype._applyProps=w0;function U7(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),ku(t)}function H7(t,e,r){let n=Ec[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=Ec.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 w0(u,a),u}function $7(t,e,r){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function q7(t,e,r){return!1}function V7(t){return t}function W7(){return null}function G7(){return null}function X7(t,e,r,n){return j7}function Y7(){}function K7(t){}function Q7(t,e){return!1}function Z7(){return D5}function J7(){return D5}const eT=setTimeout,tT=clearTimeout,rT=-1;function nT(t,e){return!1}const iT=!1,aT=!0,oT=!0;function sT(t,e){e.parent===t?e.moveToTop():t.add(e),ku(t)}function lT(t,e){e.parent===t?e.moveToTop():t.add(e),ku(t)}function N5(t,e,r){e._remove(),t.add(e),e.setZIndex(r.getZIndex()),ku(t)}function uT(t,e,r){N5(t,e,r)}function cT(t,e){e.destroy(),e.off(I2),ku(t)}function fT(t,e){e.destroy(),e.off(I2),ku(t)}function dT(t,e,r){console.error(`Text components are not yet supported in ReactKonva. You text is: "${r}"`)}function hT(t,e,r){}function pT(t,e,r,n,i){w0(t,i,n)}function mT(t){t.hide(),ku(t)}function gT(t){}function yT(t,e){(e.visible==null||e.visible)&&t.show()}function vT(t,e){}function bT(t){}function wT(){}const xT=()=>M5.DefaultEventPriority,ST=Object.freeze(Object.defineProperty({__proto__:null,appendChild:sT,appendChildToContainer:lT,appendInitialChild:U7,cancelTimeout:tT,clearContainer:bT,commitMount:hT,commitTextUpdate:dT,commitUpdate:pT,createInstance:H7,createTextInstance:$7,detachDeletedInstance:wT,finalizeInitialChildren:q7,getChildHostContext:J7,getCurrentEventPriority:xT,getPublicInstance:V7,getRootHostContext:Z7,hideInstance:mT,hideTextInstance:gT,idlePriority:F1.unstable_IdlePriority,insertBefore:N5,insertInContainerBefore:uT,isPrimaryRenderer:iT,noTimeout:rT,now:F1.unstable_now,prepareForCommit:W7,preparePortalMount:G7,prepareUpdate:X7,removeChild:cT,removeChildFromContainer:fT,resetAfterCommit:Y7,resetTextContent:K7,run:F1.unstable_runWithPriority,scheduleTimeout:eT,shouldDeprioritizeSubtree:Q7,shouldSetTextContent:nT,supportsMutation:oT,unhideInstance:yT,unhideTextInstance:vT,warnsIfNotActing:aT},Symbol.toStringTag,{value:"Module"}));var kT=Object.defineProperty,_T=Object.defineProperties,PT=Object.getOwnPropertyDescriptors,Qw=Object.getOwnPropertySymbols,ET=Object.prototype.hasOwnProperty,TT=Object.prototype.propertyIsEnumerable,Zw=(t,e,r)=>e in t?kT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jw=(t,e)=>{for(var r in e||(e={}))ET.call(e,r)&&Zw(t,r,e[r]);if(Qw)for(var r of Qw(e))TT.call(e,r)&&Zw(t,r,e[r]);return t},CT=(t,e)=>_T(t,PT(e)),e3,t3;typeof window<"u"&&((e3=window.document)!=null&&e3.createElement||((t3=window.navigator)==null?void 0:t3.product)==="ReactNative")?Xr.useLayoutEffect:Xr.useEffect;function L5(t,e,r){if(!t)return;if(r(t)===!0)return t;let n=t.child;for(;n;){const i=L5(n,e,r);if(i)return i;n=n.sibling}}function F5(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const r3=console.error;console.error=function(){const t=[...arguments].join("");if(t?.startsWith("Warning:")&&t.includes("useContext")){console.error=r3;return}return r3.apply(this,arguments)};const R2=F5(Xr.createContext(null));class B5 extends Xr.Component{render(){return Xr.createElement(R2.Provider,{value:this._reactInternals},this.props.children)}}function OT(){const t=Xr.useContext(R2);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=Xr.useId();return Xr.useMemo(()=>{for(const n of[t,t?.alternate]){if(!n)continue;const i=L5(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 AT(){const t=OT(),[e]=Xr.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!==R2&&!e.has(i)&&e.set(i,Xr.useContext(F5(i)))}r=r.return}return e}function z5(){const t=AT();return Xr.useMemo(()=>Array.from(t.keys()).reduce((e,r)=>n=>Xr.createElement(e,null,Xr.createElement(r.Provider,CT(Jw({},n),{value:t.get(r)}))),e=>Xr.createElement(B5,Jw({},e))),[t])}function IT(t){const e=X.useRef({});return X.useLayoutEffect(()=>{e.current=t}),X.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const RT=t=>{const e=X.useRef(null),r=X.useRef(null),n=X.useRef(null),i=IT(t),a=z5(),o=s=>{const{forwardedRef:u}=t;u&&(typeof u=="function"?u(s):u.current=s)};return X.useLayoutEffect(()=>(r.current=new Ec.Stage({width:t.width,height:t.height,container:e.current}),o(r.current),n.current=Yh.createContainer(r.current,M5.LegacyRoot,!1,null),Yh.updateContainer(X.createElement(a,{},t.children),n.current),()=>{Ec.isBrowser&&(o(null),Yh.updateContainer(null,n.current,null),r.current.destroy())}),[]),X.useLayoutEffect(()=>{o(r.current),w0(r.current,t,i),Yh.updateContainer(X.createElement(a,{},t.children),n.current,null)}),X.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})},MT="Layer",Zt="Group",Hg="Label",ur="Rect",DT="Circle",$s="Line",Vo="Image",Na="Text",NT="TextPath",M2="Arc",$g="Tag",bp="Path",wp="Transformer",Yh=D7(ST);Yh.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:X.version,rendererPackageName:"react-konva"});const LT=X.forwardRef((t,e)=>X.createElement(B5,{},X.createElement(RT,{...t,forwardedRef:e})));var B1,n3;function FT(){if(n3)return B1;n3=1;var t=Mp();return B1=function(r,n,i){const a=t.useRef("loading"),o=t.useRef(),[s,u]=t.useState(0),d=t.useRef(),f=t.useRef(),p=t.useRef();return(d.current!==r||f.current!==n||p.current!==i)&&(a.current="loading",o.current=void 0,d.current=r,f.current=n,p.current=i),t.useLayoutEffect(function(){if(!r)return;var h=document.createElement("img");function y(){h.decode().catch(()=>{}).finally(()=>{a.current="loaded",o.current=h,u(Math.random())})}function v(){a.current="failed",o.current=void 0,u(Math.random())}return h.addEventListener("load",y),h.addEventListener("error",v),n&&(h.crossOrigin=n),i&&(h.referrerPolicy=i),h.src=r,function(){h.removeEventListener("load",y),h.removeEventListener("error",v)}},[r,n,i]),[o.current,a.current]},B1}var BT=FT();const D2=Oc(BT);var zT=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 jT=t=>{const e=window.getComputedStyle(t).position;return!(e==="absolute"||e==="relative")};function UT(t=()=>{}){const e=X.useRef(t);return e.current=t,X.useCallback((...r)=>e.current.apply(null,r),[])}const qg=({children:t,groupProps:e,divProps:r,transform:n,transformFunc:i,parentNodeFunc:a})=>{const o=z5(),s=X.useRef(null),[u]=X.useState(()=>document.createElement("div")),d=X.useMemo(()=>tS.createRoot(u),[u]),f=n??!0,p=UT(()=>{if(f&&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 h=r||{},{style:y}=h,v=zT(h,["style"]);Object.assign(u.style,y),Object.assign(u,v)});return X.useLayoutEffect(()=>{var h;const y=s.current;if(!y)return;const v=a?a({stage:y.getStage()}):(h=y.getStage())===null||h===void 0?void 0:h.container();if(v)return v.appendChild(u),f&&jT(v)&&(v.style.position="relative"),y.on("absoluteTransformChange",p),p(),()=>{var b;y.off("absoluteTransformChange",p),(b=u.parentNode)===null||b===void 0||b.removeChild(u)}},[f,a]),X.useLayoutEffect(()=>{p()},[r,i]),X.useLayoutEffect(()=>{queueMicrotask(()=>{JS.flushSync(()=>{d.render(X.createElement(o,null,t))})})}),X.useLayoutEffect(()=>()=>{setTimeout(()=>{d.unmount()})},[]),X.createElement(Zt,Object.assign({ref:s},e))},N2=({selector:t,enabled:e,children:r})=>{const n=X.useRef(null),i=X.useRef(null),a=X.useRef(null),o=e??!0;return X.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 d=n.current.getLayer();if(d&&(d.batchDraw(),u)){const f=u.getLayer();if(!f)return;f.batchDraw()}},[t,o]),X.useEffect(()=>()=>{var s;(s=a.current)===null||s===void 0||s.destroy()},[]),X.createElement(Zt,{name:"_outer_portal",ref:n},X.createElement(Zt,{name:"_inner_portal",ref:i},r))};function j5(t,e,r){const n=e-1,i=r[H5(n,r.length)];return i.marker!=="Z"?i:j5(t,n,r)}function U5(t,e,r){const n=e+1,i=r[H5(n,r.length)];return i.marker==="Z"?U5(t,n,r):i}function HT(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 $T(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 H5(t,e){return(t%e+e)%e}function qT(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 Vv(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,Vv(t,e-1)),t[e].marker==="Z"&&Vv(t,e-1)}function VT(t,e,r){const n=a3(t.values,r.values),i=a3(e.values,t.values);return Math.min(i,n)}function i3(t,e){return Math.atan2(e.x-t.x,e.y-t.y)}function a3(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 o3(t,e){return Math.sin(t)*e}function s3(t,e){return Math.cos(t)*e}function l3(t,e){const r=e/Math.tan(t);return r===1/0||r===-1/0||isNaN(r)?e:r}function WT(t,e){return e*Math.tan(t)}function GT(t,e){let r,n=0,i=t*(180/Math.PI);return i<0&&i>=-180||i>180&&i<360?r=l3(t/2,-e):(r=l3(t/2,e),n=1,r===1/0&&(r=e)),{offset:r,sweepFlag:n}}function XT(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 u3(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 $T(n.marker,a)}).map(HT)}function c3(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(qT),Vv(a,a.length-1);const o=a[a.length-1].marker=="Z";a.filter(s=>!s.overlap).map((s,u,d)=>{const p=j5(s,u,d),h=U5(s,u,d),y=i3(s.values,p.values),v=i3(s.values,h.values),b=v-y,x=b*(180/Math.PI),k=VT(s,p,h),S=Math.abs(WT(b/2,k/2)),P=Math.min(e,S),_=GT(b,P),E=_.offset,A=_.sweepFlag,T=(u==0||u==d.length-1)&&!o;switch(s.marker){case"M":case"L":const I=[s.values.x+o3(y,E),s.values.y+s3(y,E)],M=[s.values.x+o3(v,E),s.values.y+s3(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&&(h.marker==="L"||h.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(M[0].toFixed(3)),y:parseFloat(M[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:XT(i),commands:i}}var cg={},f3;function YT(){if(f3)return cg;f3=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,d)||s("repeating-linear-gradient",e.repeatingLinearGradient,d)||s("radial-gradient",e.radialGradient,h)||s("repeating-radial-gradient",e.repeatingRadialGradient,h)}function s(V,ee,re){return u(ee,function(K){var ne=re();return ne&&(L(e.comma)||n("Missing comma before color stops")),{type:V,orientation:ne,colorStops:_(E)}})}function u(V,ee){var re=L(V);if(re){L(e.startCall)||n("Missing (");var K=ee(re);return L(e.endCall)||n("Missing )"),K}}function d(){var V=f();if(V)return V;var ee=U("position-keyword",e.positionKeywords,1);return ee?{type:"directional",value:ee.value}:p()}function f(){return U("directional",e.sideOrCorner,1)}function p(){return U("angular",e.angleValue,1)||U("angular",e.radianValue,1)}function h(){var V,ee=y(),re;return ee&&(V=[],V.push(ee),re=r,L(e.comma)&&(ee=y(),ee?V.push(ee):r=re)),V}function y(){var V=v()||b();if(V)V.at=k();else{var ee=x();if(ee){V=ee;var re=k();re&&(V.at=re)}else{var K=k();if(K)V={type:"default-radial",at:K};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=Q()||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(),re=[];if(ee)for(re.push(ee);L(e.comma);)ee=V(),ee?re.push(ee):n("One extra comma");return re}function E(){var V=A();return V||n("Expected color definition"),V.length=Z(),V}function A(){return I()||H()||B()||R()||M()||N()||T()}function T(){return U("literal",e.literalColor,0)}function I(){return U("hex",e.hexColor,1)}function M(){return u(e.rgbColor,function(){return{type:"rgb",value:_(G)}})}function R(){return u(e.rgbaColor,function(){return{type:"rgba",value:_(G)}})}function N(){return u(e.varColor,function(){return{type:"var",value:$()}})}function B(){return u(e.hslColor,function(){var V=L(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=G();L(e.comma);var re=L(e.percentageValue),K=re?re[1]:null;L(e.comma),re=L(e.percentageValue);var ne=re?re[1]:null;return(!K||!ne)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[ee,K,ne]}})}function H(){return u(e.hslaColor,function(){var V=G();L(e.comma);var ee=L(e.percentageValue),re=ee?ee[1]:null;L(e.comma),ee=L(e.percentageValue);var K=ee?ee[1]:null;L(e.comma);var ne=G();return(!re||!K)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[V,re,K,ne]}})}function $(){return L(e.variableName)[1]}function G(){return L(e.number)[1]}function Z(){return U("%",e.percentageValue,1)||J()||q()||Q()}function J(){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 re=r.charAt(ee);re==="("?V++:re===")"&&V--,ee++}V>0&&n("Missing closing parenthesis in calc() expression");var K=r.substring(0,ee-1);return W(ee-1),{type:"calc",value:K}})}function Q(){return U("px",e.pixelValue,1)||U("em",e.emValue,1)}function U(V,ee,re){var K=L(ee);if(K)return{type:V,value:K[re]}}function L(V){var ee,re;return re=/^[\n\r\t\s]+/.exec(r),re&&W(re[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()}})(),cg.parse=t.parse,cg.stringify=t.stringify,cg}var KT=YT();const QT=Oc(KT),cn=t=>t.indexOf("linear-gradient")>=0,ZT=t=>t.type==="hex"?"#"+t.value:t.type==="literal"?t.value:`${t.type}(${t.value.join(",")})`,jp=t=>{if(!cn(t))return{rotation:0,stops:[{offset:0,color:t},{offset:1,color:t}]};const e=QT.parse(t)[0];return{rotation:e.orientation&&"value"in e.orientation?parseFloat(e.orientation.value):0,stops:e.colorStops.map((r,n)=>({color:ZT(r),offset:r.length?parseFloat(r.length.value)/100:n/(e.colorStops.length-1)}))}},Zo=(t,e,r)=>{var n;return e===void 0&&(e=(n=t.fill)!==null&&n!==void 0?n:""),r===void 0&&(r="fill"),X.useMemo(()=>{if(!cn(e))return{[r]:e};const{stops:i,rotation:a}=jp(e),o=t.a.width/2,s=t.a.height/2,u=(a%180+180)%180,d=u>45&&u<135?t.a.width:t.a.height,f=Et.Util.degToRad(a)-Math.PI/2,p=[];return i.forEach(({offset:h,color:y})=>{p.push(h,y)}),r==="fill"?{fillLinearGradientStartPointX:o-d/2*Math.cos(f),fillLinearGradientStartPointY:s-d/2*Math.sin(f),fillLinearGradientColorStops:p,fillLinearGradientEndPointX:o+d/2*Math.cos(f),fillLinearGradientEndPointY:s+d/2*Math.sin(f),fill:i[1].color,fillPriority:"linear-gradient"}:{strokeLinearGradientStartPointX:o-d/2*Math.cos(f),strokeLinearGradientStartPointY:s-d/2*Math.sin(f),strokeLinearGradientColorStops:p,strokeLinearGradientEndPointX:o+d/2*Math.cos(f),strokeLinearGradientEndPointY:s+d/2*Math.sin(f)}},[e,t.width,t.height])};let Vg=!1;const JT=(t=!Vg)=>{Vg=t},eC=()=>Vg;function Up(t,e){const r=X.useRef();X.useLayoutEffect(()=>{r.current&&r.current.destroy()},[e]),X.useLayoutEffect(()=>{if(!Vg)return;const n=t.current.opacity();return n?(t.current.opacity(0),r.current=new Et.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 Wg=0,Wv=[],$5=3e4;const tC=t=>{$5=t};let q5=6e3;const rC=t=>{q5=t},nC=()=>q5;function Jo(t){Wg+=1;let e=!1,r=!1;const n=setTimeout(()=>{e||(Rd(`Timeout loading asset ${t}`),console.error("Timeout triggered for loader. Some assets may not have loaded.",t),e=!0,d3())},$5);return()=>{r?console.error("Finish called twice! That is not expected. id: ",t):(r=!0,e||(clearTimeout(n),d3()))}}function d3(){Wg-=1,Wg===0&&(Wv.forEach(t=>t()),Wv=[])}function iC(){return new Promise(t=>{return e=()=>{eC()?setTimeout(t,300):t(!0)},void(Wg===0?e():Wv.push(e));var e})}let V5=[];function aC(t){V5.push(t)}function Rd(t){V5.forEach(e=>e(t))}Yt(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]);Yt({value:!1});const L2=Yt([]);function oC(t){L2.push(t)}var Gv="Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1";let Fs;function fg(t,e="sans-serif",r="normal",n="normal"){Fs||(Fs=document.createElement("canvas"));var i=Fs.getContext("2d");return i.font=`${r} ${n} 40px '${t}', ${e}`,i.measureText(Gv).width}const dd={Arial:!0},h3=(t,e,r)=>e&&r?!!dd[`${t}_${e}_${r}`]:Object.keys(dd).some(n=>n.startsWith(t+"_"))||!!dd[t];async function sC(t,e,r){var n;const i=`${t}_${e}_${r}`;if(dd[i])return;const a=!!(!((n=document.fonts)===null||n===void 0)&&n.load),o=(function(f="normal",p="normal"){Fs||(Fs=document.createElement("canvas"));var h=Fs.getContext("2d");return h.font=`${f} ${p} 40px sans-serif`,h.measureText(Gv).width})(e,r);if(a)try{if(await document.fonts.load(`${e} ${r} 16px '${t}'`),o!==fg(t,"sans-serif",e,r))return void(dd[i]=!0)}catch{}const s=(function(f="normal",p="normal"){Fs||(Fs=document.createElement("canvas"));var h=Fs.getContext("2d");return h.font=`${f} ${p} 40px serif`,h.measureText(Gv).width})(e,r),u=fg(t,"sans-serif",e,r),d=Math.min(6e3,nC())/60;for(let f=0;f<d;f++){const p=fg(t,"sans-serif",e,r),h=fg(t,"serif",e,r);if(p!==u||p!==o||h!==s)return await new Promise(y=>setTimeout(y,100)),void(dd[i]=!0);await new Promise(y=>setTimeout(y,60))}console.warn(`Timeout for loading font "${t}". Looks like polotno can't load it. Is it a correct font family?`),Rd(`Timeout for loading font "${t}"`)}const p3={};let W5="400,400italic,700,700italic";function lC(){return W5}function G5(t){return`https://fonts.googleapis.com/css?family=${t.replace(/ /g,"+")}:${W5}`}function uC(t){if(p3[t])return;const e=G5(t),r=document.createElement("link");r.type="text/css",r.href=e,r.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(r),p3[t]=!0}const m3={};let oc;function cC(t){const e=t.fontFamily;if(m3[e]||!t.url&&!t.styles)return;const r=t.styles||(t.url?[{src:`url("${t.url}")`}]:[]),n=(oc||(oc=document.getElementById("polotno-font-style"),oc||(oc=document.createElement("style"),oc.id="polotno-font-style",document.head.appendChild(oc)),oc)).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)}),m3[t.fontFamily]=!0}const dr=Yt({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:"resize",textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),fC=typeof window<"u"&&window.location.hostname==="localhost",dC=typeof process<"u"&&!1,X5=fC||dC,hC=jt(t=>{dr.textVerticalResizeEnabled=t}),Y5=jt(t=>{dr.removeBackgroundEnabled=t});jt(t=>{X5&&console.warn("useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead."),Y5(t)});jt(t=>{dr.aiTextEnabled=t});jt(t=>{X5&&console.warn("useHtmlTextRender is deprecated. Use setRichTextEnabled instead."),dr.htmlRenderEnabled=t});const pC=jt(t=>{dr.htmlRenderEnabled=t}),mC=jt(t=>{dr.imageDownScalingEnabled=t});jt(t=>{console.warn("useDownScaling is deprecated. Use setDownScalingEnabled instead."),mC(t)});jt(t=>{console.warn("setForceTextFit is deprecated. Use setTextOverflow instead."),dr.textOverflow="change-font-size"});const K5=jt(t=>{dr.textOverflow=t}),gC=jt(t=>{dr.textSplitAllowed=t});jt(t=>{dr.animationsEnabled=t});jt(t=>{dr.autoDeleteEmptyText=t});function li(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(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/ /g," ")}function g3(t){return t?/<[a-z][a-z0-9]*(\s[^>]*)?>[^<]*<\/[a-z][a-z0-9]*>/i.test(t)?t=(t=t.replace(/<(?![a-z/!])/gi,"<")).replace(/([^a-z0-9"'\s/])>/gi,"$1>"):t.replace(/</g,"<").replace(/>/g,">"):""}const yC={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 Q5(t){return Object.assign(Object.assign({},yC),t)}function vC(t){var e="֑-߿יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+e+"]*?["+e+"]").test(t)}function xp(t){return(function(e){e=e.replace(/\s/g,"");let r=0;for(var n=0;n<e.length;n++)vC(e[n])&&(r+=1);return r>e.length/2})(t)?"rtl":"ltr"}function Tc(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 rd(t,e,r,n){if(!cn(t))return"";const{stops:i,rotation:a}=jp(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 bC(t){var e,r,n,i,a,o;const s=t.a?t.a:t,u=Q5(t),d=new Et.TextPath({data:Tc((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:li(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}),f=d.getSelfRect().height;return d.destroy(),f}function z1(t,{fontFamily:e="",color:r="black",forEditor:n=!1}={}){const i=Q5(t),a=e||i.fontFamily,o=cn(i.fill),s=cn(i.stroke),u=dr.textOverflow==="ellipsis"&&!n&&!i.curveEnabled&&!!i.height,d=(()=>{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}`]})(),f=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 p=`color: ${r||i.fill}`,h="";s&&i.strokeWidth?(p=`color: ${r||i.fill}; ${f(i.stroke)}`,h=`-webkit-text-stroke: ${i.strokeWidth}px transparent`):o&&(p=f(i.fill));const y=["white-space: pre-wrap","word-break: break-word",`width: ${Math.round(i.width||100)}px`,...d,p,`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}`:"",h||(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=bC(t),b=Math.round(i.width||100),x=Tc(b,v,i.curvePower,i.fontSize),k=li(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"}`;_+=rd(i.fill,E)}if(s&&i.strokeWidth){const E=`curve-stroke-grad-${i.id||"temp"}`;_+=rd(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=g3(i.text).replace(/\n/g,"<br/>"),b=Math.round(i.width||100),x=["white-space: pre-wrap","word-break: break-word",`width: ${b}px`,...d,`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}; ${f(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?f(i.fill):`color: ${r||i.fill}`}; position: relative;" contentEditable dir="${xp(li(i.text))}">${v}</div>
|
|
88
|
+
</div>
|
|
89
|
+
`}return`<div style="${y}" contentEditable dir="${xp(li(i.text))}">${g3(i.text).replace(/\n/g,"</br>")}</div>`}function wC({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 xC={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 ji(t,e){var r;const n={filters:[]},i={};e.brightnessEnabled&&(n.filters.push(Et.Filters.Brighten),n.brightness=e.brightness),e.blurEnabled&&(n.filters.push(Et.Filters.Blur),n.blurRadius=e.blurRadius,e.type==="text"&&e.lineHeight<1&&(i.offset=e.fontSize)),e.sepiaEnabled&&n.filters.push(Et.Filters.Sepia),e.grayscaleEnabled&&n.filters.push(Et.Filters.Grayscale),e.filters.forEach((a,o)=>{const s=xC[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 _u=()=>"ontouchstart"in window||navigator.maxTouchPoints>0;var y3={},Z5="warn";function SC(t){Z5=t}function kC(){return Z5}var _n;(function(t){t.afterCreate="afterCreate",t.afterAttach="afterAttach",t.afterCreationFinalization="afterCreationFinalization",t.beforeDetach="beforeDetach",t.beforeDestroy="beforeDestroy"})(_n||(_n={}));var Xv=function(t,e){return Xv=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])},Xv(t,e)};function Fr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Xv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var es=function(){return es=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},es.apply(this,arguments)};function _C(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 sp(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 gu(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 Cc(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 J5(t){return Wt(t).type}function ek(t,e){return Wt(t).onSnapshot(e)}function v3(t,e){Wt(t).applyPatches(uk(e))}function Yv(t,e){return Wt(t).applySnapshot(e)}function $o(t,e){e===void 0&&(e=!0);var r=Wt(t);return e?r.snapshot:r.type.getSnapshot(r,!1)}function dg(t,e){for(var r=Wt(t).parent;r;){if(e.is(r.storedValue))return!0;r=r.parent}return!1}function dc(t,e){for(var r=Wt(t).parent;r;){if(e.is(r.storedValue))return r.storedValue;r=r.parent}throw new kt("Failed to find the parent of ".concat(Wt(t)," of a given type"))}function PC(t){return Wt(t).root.storedValue}function EC(t){return Wt(t).path}function TC(t,e){var r=XC(Wt(t),e);return r?r.value:void 0}function CC(t){return Wt(t).identifier}function bc(t){return Wt(t).detach(),t}function j1(t){var e=Wt(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)}function b3(t){return Wt(t).observableIsAlive}var tk=(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:Kn.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 dk),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=Mg("path")),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?xc(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!==Kn.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDetaching",{get:function(){return this.state===Kn.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=Mg("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===Kn.CREATED){if(this.parent){if(this.parent.state!==Kn.FINALIZED)return;this.fireHook(_n.afterAttach)}this.state=Kn.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=Kn.DEAD}}),Object.defineProperty(t.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(_n.beforeDestroy)}}),t})(),Sp=(function(t){Fr(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=Kn.DEAD,u}return s.state=Kn.CREATED,s.finalizeCreation(),s}return Object.defineProperty(e.prototype,"root",{get:function(){if(!this.parent)throw new kt("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===Kn.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})(tk);Sp.prototype.die=jt(Sp.prototype.die);var OC=1,no;(function(t){t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.CREATING=1]="CREATING",t[t.CREATED=2]="CREATED"})(no||(no={}));var ea;(function(t){t.Dispose="dispose",t.Patch="patch",t.Snapshot="snapshot"})(ea||(ea={}));var AC={onError:function(t){throw t}},Ui=(function(t){Fr(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:++OC}),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:no.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=Ac(function(){return s.getSnapshot()}),s.unbox=s.unbox.bind(s),s._initialSnapshot=o,s.identifierAttribute=r.identifierAttribute,n||(s.identifierCache=new VC),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 d=s._childNodes[s.identifierAttribute];d&&(u=d.value)}if(typeof u!="string"&&typeof u!="number")throw new kt("Instance identifier '".concat(s.identifierAttribute,"' for type '").concat(s.type.name,"' must be a string or a number"));s.identifier=Hp(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===no.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=no.CREATING;for(var s=[],u=this.parent;u&&u._observableInstanceState===no.UNINITIALIZED;)s.unshift(u),u=u.parent;try{for(var d=sp(s),f=d.next();!f.done;f=d.next()){var p=f.value;p.createObservableInstanceIfNeeded(!1)}}catch(b){n={error:b}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}var h=this.type;try{this.storedValue=h.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,h.finalizeNewInstance(this,this.storedValue)}catch(b){throw this.state=Kn.DEAD,b}finally{this._isRunningAction=!1}if(this._observableInstanceState=no.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=Pd,this.state=Kn.CREATED,r){this.fireHook(_n.afterCreate),this.finalizeCreation();try{for(var y=sp(s.reverse()),v=y.next();!v.done;v=y.next()){var p=v.value;p.fireHook(_n.afterCreate),p.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(_n.beforeDetach);var r=this.state;this.state=Kn.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(_n.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"&&(Ca?Ca(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===no.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=kC();if(!this.isAlive&&n!=="ignore"){var i=this._getAssertAliveError(r);switch(n){case"error":throw new kt(i);case"warn":iO(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&&xc(r.subpath)||"",a=r.actionContext||MC();a&&a.type!=="action"&&a.parentActionEvent&&(a=a.parentActionEvent);var o="";if(a&&a.name!=null){var s=a&&a.context&&EC(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===no.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(Pd),this._autoUnbox=!1;try{return this._observableInstanceState===no.CREATED?this.type.getChildren(this):sk(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 kt("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=sp(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(_n.afterCreationFinalization)})}}),Object.defineProperty(e.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new kt("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=kp(this.storedValue,"@APPLY_PATCHES",function(n){n.forEach(function(i){if(!i.path){r.type.applySnapshot(r,i.value);return}var a=hk(i.path),o=ok(r,a.slice(0,-1));o.applyPatchLocally(a[a.length-1],i)})}),this._applySnapshot=kp(this.storedValue,"@APPLY_SNAPSHOT",function(n){if(n!==r.snapshot)return r.type.applySnapshot(r,n)}),wc(this.storedValue,"$treenode",this),wc(this.storedValue,"toJSON",GC)}}),Object.defineProperty(e.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Kn.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(e.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==no.UNINITIALIZED&&(this.getChildren().forEach(function(r){r.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(ea.Dispose),this._internalEventsClear(ea.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(ea.Snapshot,r)}}),Object.defineProperty(e.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r){this._internalEventsEmit(ea.Snapshot,r)}}),Object.defineProperty(e.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(r){return this._internalEventsRegister(ea.Patch,r)}}),Object.defineProperty(e.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){if(this._internalEventsHasSubscribers(ea.Patch)){var i=n.path.substr(this.path.length)+(r.path?"/"+r.path:""),a=eO({},r,{path:i}),o=gu(oO(a),2),s=o[0],u=o[1];this._internalEventsEmit(ea.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(ea.Dispose,r)}}),Object.defineProperty(e.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(r){if(!this.hasDisposer(r)){this._internalEventsRegister(ea.Dispose,r,!0);return}throw new kt("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(ea.Dispose,r))throw new kt("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister(ea.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=DS(function(){return r.snapshot},function(i){return r.emitSnapshot(i)},AC);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 dk),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,Cc([r],gu(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})(tk);Ui.prototype.createObservableInstance=jt(Ui.prototype.createObservableInstance);Ui.prototype.detach=jt(Ui.prototype.detach);Ui.prototype.die=jt(Ui.prototype.die);var rk,er;(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"})(er||(er={}));var nk="cannotDetermine",IC=Symbol("$type"),Ys=(function(){function t(e){Object.defineProperty(this,rk,{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 Gs(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 kt("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=ak(e);if(n){var i=J5(e);return this.isAssignableFrom(i)?Hi():$i(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 kt("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 kt("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 kt("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 kt("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})();rk=IC;Ys.prototype.create=jt(Ys.prototype.create);var kd=(function(t){Fr(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===Hp(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||Yr(n)&&Wt(n)===r?!0:r.type===this&&ck(n)&&!Yr(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(),Yr(n)&&this.isAssignableFrom(J5(n))){var s=Wt(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})(Ys);kd.prototype.create=jt(kd.prototype.create);var Bc=(function(t){Fr(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})(Ys);function Ks(t){return typeof t=="object"&&t&&t.isType===!0}var RC=1,lp;function MC(){return lp}function DC(){return RC++}function NC(t,e){var r=Wt(t.context);t.type==="action"&&r.assertAlive({actionContext:t});var n=r._isRunningAction;r._isRunningAction=!0;var i=lp;lp=t;try{return BC(r,t,e)}finally{lp=i,r._isRunningAction=n}}function LC(t){if(t)return t.type==="action"?t:t.parentActionEvent}function kp(t,e,r){var n=function(){var i=DC(),a=lp,o=LC(a);return NC({type:"action",name:e,id:i,args:nO(arguments),context:t,tree:PC(t),rootId:a?a.rootId:i,parentId:a?a.id:0,allParentIds:a?Cc(Cc([],gu(a.allParentIds),!1),[a.id],!1):[],parentEvent:a,parentActionEvent:o},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var FC=(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 BC(t,e,r){var n=new FC(t,r);if(n.isEmpty)return jt(r).apply(null,e.args);var i=null;function a(o){var s=n.getNextMiddleware(),u=s&&s.handler;if(!u)return jt(r).apply(null,o.args);if(!s.includeHooks&&_n[o.name])return a(o);function d(p,h){i=a(p),h&&(i=h(i))}function f(p){i=p}return u(o,d,f),i}return a(e)}function zC(t){try{return JSON.stringify(t)}catch(e){return"<Unserializable: ".concat(e,">")}}function ik(t){return typeof t=="function"?"<function".concat(t.name?" "+t.name:"",">"):Yr(t)?"<".concat(t,">"):"`".concat(zC(t),"`")}function jC(t){return t.length<280?t:"".concat(t.substring(0,272),"......").concat(t.substring(t.length-8))}function UC(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=Yr(e)?"value of type ".concat(Wt(e).type.name,":"):_p(e)?"value":"snapshot",o=r&&Yr(e)&&r.is(Wt(e).snapshot);return"".concat(i).concat(a," ").concat(ik(e)," is not assignable ").concat(r?"to type: `".concat(r.name,"`"):"")+(t.message?" (".concat(t.message,")"):"")+(r?EO(r)||_p(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 F2(t,e,r){return t.concat([{path:e,type:r}])}function Hi(){return _d}function $i(t,e,r){return[{context:t,value:e,message:r}]}function x0(t){return t.reduce(function(e,r){return e.concat(r)},[])}function Gs(t,e){aO()&&HC(t,e)}function HC(t,e){var r=t.validate(e,[{path:"",type:t}]);if(r.length>0)throw new kt($C(t,e,r))}function $C(t,e,r){if(r.length!==0)return"Error while converting ".concat(jC(ik(e))," to `").concat(t.name,`\`:
|
|
90
|
+
|
|
91
|
+
`)+r.map(UC).join(`
|
|
92
|
+
`)}var qC=0,VC=(function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qC++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Yt.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Yt.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,Yt.array([],S0));var i=this.cache.get(n);if(i.indexOf(e)!==-1)throw new kt("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;US(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 E9(this.cache).forEach(function(a){for(var o=gu(a,2),s=o[0],u=o[1],d=!1,f=u.length-1;f>=0;f--){var p=u[f];(p===e||p.path.indexOf(i)===0)&&(n.addNodeToCache(p,!1),u.splice(f,1),u.length||r.cache.delete(s),d=!0)}d&&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 kt("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 B2(t,e,r,n,i){var a=ak(i);if(a){if(a.parent)throw new kt("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 Ui(t,e,r,n,i)}function Pu(t,e,r,n,i){return new Sp(t,e,r,n,i)}function WC(t){return t instanceof Sp||t instanceof Ui}var Kn;(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"})(Kn||(Kn={}));function Yr(t){return!!(t&&t.$treenode)}function Wt(t){if(!Yr(t))throw new kt("Value ".concat(t," is no MST Node"));return t.$treenode}function ak(t){return t&&t.$treenode||null}function GC(){return Wt(this).snapshot}function XC(t,e,r){return r===void 0&&(r=!0),ok(t,hk(e),r)}function ok(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 Sp){var o=n.value;Yr(o)&&(n=Wt(o))}if(n instanceof Ui){var s=n.getChildType(a);if(s&&(n=n.getChildNode(a),n))continue}}}throw new kt("Could not resolve '".concat(a,"' in path '").concat(w3(e.slice(0,i))||"/","' while resolving '").concat(w3(e),"'"))}}catch(u){if(!r)return;throw u}return n}function sk(t){if(!t)return _d;var e=Object.keys(t);if(!e.length)return _d;var r=new Array(e.length);return e.forEach(function(n,i){r[i]=t[n]}),r}var YC=Object.toString(),_d=Object.freeze([]),Pd=Object.freeze({}),S0=Z_().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(S0);var kt=(function(t){Fr(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 KC(t){return t}var QC=Number.isInteger;function ZC(t){return Number(t)===t&&t%1!==0}function JC(t){return Number.isFinite(t)}function lk(t){return Array.isArray(t)||ts(t)}function uk(t){return t?lk(t)?t:[t]:_d}function eO(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 nd(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())===YC}function ck(t){return t!==null&&typeof t=="object"&&!(t instanceof Date)&&!(t instanceof RegExp)}function _p(t,e){return e===void 0&&(e=!0),t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||e&&t instanceof Date}function fk(t){return typeof t!="function"}function tO(t,e,r){uo(t)?$S(t,e,r):Object.defineProperty(t,e,r)}function wc(t,e,r){tO(t,e,{enumerable:!1,writable:!1,configurable:!0,value:r})}var rO=(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,Cc([],gu(e),!1))})}}),t})(),dk=(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 rO),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,Cc([],gu(n),!1))}}),t})();function nO(t){for(var e=new Array(t.length),r=0;r<t.length;r++)e[r]=t[r];return e}function U1(t,e){return t.indexOf(e)===0}function iO(t){console.warn(new Error("[mobx-state-tree] ".concat(t)))}function aO(){return typeof process<"u"&&y3&&y3.ENABLE_TYPE_CHECK==="true"}function oO(t){if(!("oldValue"in t))throw new kt("Patches without `oldValue` field cannot be inversed");return[sO(t),lO(t)]}function sO(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 lO(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 uO(t){return typeof t=="number"}function xc(t){return uO(t)===!0?""+t:t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function cO(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function w3(t){if(t.length===0)return"";var e=function(r){return r.map(xc).join("/")};return t[0]==="."||t[0]===".."?e(t):"/"+e(t)}function hk(t){var e=t.split("/").map(cO),r=t===""||t==="."||t===".."||U1(t,"/")||U1(t,"./")||U1(t,"../");if(!r)throw new kt("a json path must be either rooted, empty or relative, but got '".concat(t,"'"));return e[0]===""&&e.shift(),e}var H1=Symbol("$preProcessorFailed"),fO=(function(t){Fr(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|er.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 H1}}}),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;dO(r.type,this,"create"),r instanceof Ui&&(r.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=r.getSnapshot;r.getSnapshot=function(){return n.postProcessSnapshot(i.call(r),r)},RO(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=Yr(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,Yr(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===H1?$i(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=Ks(r)?this._subtype:Yr(r)?r:this.preProcessSnapshotSafe(r);return n===H1?!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 kd))return!1;var i=this.preProcessSnapshot(n);return this._subtype.isMatchingSnapshotId(r,i)}}),e})(Ys);function dO(t,e){for(var r,n,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var o=sp(i),s=o.next();!s.done;s=o.next()){var u=s.value;t[u]=e[u].bind(e)}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}function hO(t,e,r){return new fO(t,e,r)}var x3="Map.put can only be used to store complex values that have an identifier type attribute";function pk(t,e){var r,n,i=t.getSubTypes();if(i===nk)return!1;if(i){var a=uk(i);try{for(var o=sp(a),s=o.next();!s.done;s=o.next()){var u=s.value;if(!pk(u,e))return!1}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return t instanceof Pp&&e.push(t),!0}var ru;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.YES=1]="YES",t[t.NO=2]="NO"})(ru||(ru={}));var pO=(function(t){Fr(e,t);function e(r,n){return t.call(this,r,Yt.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 kt("Map.put cannot be used to set empty values");if(Yr(r)){var n=Wt(r);if(n.identifier===null)throw new kt(x3);return this.set(n.identifier,r),r}else if(ck(r)){var i=Wt(this),a=i.type;if(a.identifierMode!==ru.YES)throw new kt(x3);var o=a.mapIdentifierAttribute,s=r[o];if(!z2(s)){var u=this.put(a.getChildType().create(r,i.environment));return this.put($o(u))}var d=Hp(s);return this.set(d,r),this.get(d)}else throw new kt("Map.put can only be used to store complex values")}}),e})(S2),Gg=(function(t){Fr(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:ru.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:er.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(),B2(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===ru.UNKNOWN){var r=[];if(pk(this._subType,r)){var n=r.reduce(function(i,a){if(!a.identifierAttribute)return i;if(i&&i!==a.identifierAttribute)throw new kt("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=ru.YES,this.mapIdentifierAttribute=n):this.identifierMode=ru.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 pO(r,this.name)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){zS(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],d=kp(n,s,u);wc(n,s,d)})}),b2(n,this.willChange),w2(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 US(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 kt("Not a child "+n);return i}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=Wt(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;Gs(o,s),r.newValue=o.reconcile(n.getChildNode(i),r.newValue,n,i),a.processIdentifier(i,r.newValue)}break;case"add":Gs(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===ru.YES&&n instanceof Ui){var i=n.identifier;if(i!==r)throw new kt("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=Wt(r.object);switch(r.type){case"update":return void n.emitPatch({op:"replace",path:xc(r.name),value:r.newValue.snapshot,oldValue:r.oldValue?r.oldValue.snapshot:void 0},n);case"add":return void n.emitPatch({op:"add",path:xc(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:xc(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){Gs(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 nd(r)?x0(Object.keys(r).map(function(a){return i._subType.validate(r[a],F2(n,a,i._subType))})):$i(n,r,"Value is not a plain object")}}),Object.defineProperty(e.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Pd}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue.delete(n)}}),e})(kd);Gg.prototype.applySnapshot=jt(Gg.prototype.applySnapshot);function mO(t){return new Gg("Map<string, ".concat(t.name,">"),t)}var Xg=(function(t){Fr(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:er.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 B2(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=es(es({},S0),{name:this.name});return Yt.array(sk(r),n)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){Qo(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],d=kp(n,s,u);wc(n,s,d)})}),b2(n,this.willChange),w2(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 kt("Not a child: "+n)}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=Wt(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=S3(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,d=r.added,f=S3(n,i,a.slice(s,s+u),d,d.map(function(h,y){return s+y}));if(!f)return null;r.added=f;for(var p=s+u;p<a.length;p++)a[p].setParent(n,""+(p+d.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=Wt(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){Gs(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 lk(r)?x0(r.map(function(a,o){return i._subType.validate(a,F2(n,""+o,i._subType))})):$i(n,r,"Value is not an array")}}),Object.defineProperty(e.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _d}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue.splice(Number(n),1)}}),e})(kd);Xg.prototype.applySnapshot=jt(Xg.prototype.applySnapshot);function gO(t){return new Xg("".concat(t.name,"[]"),t)}function S3(t,e,r,n,i){for(var a=!0,o=0;;o++){var s=o<=n.length-1,u=r[o],d=s?n[o]:void 0,f=""+i[o];if(WC(d)&&(d=d.storedValue),!u&&!s)break;if(!s)a=!1,r.splice(o,1),u instanceof Ui&&u.createObservableInstanceIfNeeded(),u.die(),o--;else if(u)if(k3(u,d))r[o]=$1(e,t,f,d,u);else{for(var h=void 0,y=o;y<r.length;y++)if(k3(r[y],d)){h=r.splice(y,1)[0];break}a=!1;var p=$1(e,t,f,d,h);r.splice(o,0,p)}else{if(Yr(d)&&Wt(d).parent===t)throw new kt("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(f,"', but it lives already at '").concat(Wt(d).path,"'"));a=!1;var p=$1(e,t,f,d);r.splice(o,0,p)}}return a?null:r}function $1(t,e,r,n,i){Gs(t,n);function a(){if(Yr(n)){var s=Wt(n);if(s.assertAlive(Pd),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 Ui&&i.createObservableInstanceIfNeeded(),i.die()),o}function k3(t,e){if(!t.isAlive)return!1;if(Yr(e)){var r=Wt(e);return r.isAlive&&r===t}if(t.snapshot===e)return!0;if(!(t instanceof Ui))return!1;var n=t.getReconciliationType();return t.identifier!==null&&t.identifierAttribute&&nd(e)&&n.is(e)&&n.isMatchingSnapshotId(t,e)}var _3="preProcessSnapshot",P3="postProcessSnapshot";function yO(){return Wt(this).toString()}var E3={name:"AnonymousModel",properties:{},initializers:_d};function vO(t){var e=Object.keys(t),r=new Set;return e.forEach(function(n){if(r.has(n))throw new kt("".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 _n)throw new kt("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 kt("Getters are not supported as properties. Please use views instead");var o=a.value;if(o==null)throw new kt("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(_p(o))n[i]=Sc(PO(o),o);else if(o instanceof Gg)n[i]=Sc(o,{});else if(o instanceof Xg)n[i]=Sc(o,[]);else if(!Ks(o))throw new kt("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(o,"' (").concat(typeof o,")"));return n},es({},t))}var Pp=(function(t){Fr(e,t);function e(r){var n=t.call(this,r.name||E3.name)||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:er.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,E3,r),n.properties=vO(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&er.Identifier){if(r)throw new kt("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(!nd(n))throw new kt("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(n).forEach(function(a){if(a in i.properties)throw new kt("'".concat(a,"' is a property and cannot be declared as an action"));if(a===_3)throw new kt("Cannot define action '".concat(_3,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===P3)throw new kt("Cannot define action '".concat(P3,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var o=n[a],s=r[a];if(a in _n&&s){var u=o;o=function(){s.apply(null,arguments),u.apply(null,arguments)}}var d=o.$mst_middleware,f=o.bind(n);f._isFlowAction=o._isFlowAction||!1,f.$mst_middleware=d;var p=kp(r,a,f);n[a]=p,wc(r,a,p)})}}),Object.defineProperty(e.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=this;if(typeof r!="function")throw new kt("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(!nd(n))throw new kt("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(n).forEach(function(a){if(a in i.properties)throw new kt("'".concat(a,"' is a property and cannot be declared as volatile state"));HS(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,d=o.state,f=_C(o,["actions","views","state"]);for(var p in f)throw new kt("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(p,"'"));return d&&n.instantiateVolatileState(a,d),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(!nd(n))throw new kt("views initializer should return a plain object containing views");Object.getOwnPropertyNames(n).forEach(function(a){var o;if(a in i.properties)throw new kt("'".concat(a,"' is a property and cannot be declared as a view"));var s=Object.getOwnPropertyDescriptor(n,a);if("get"in s)$S(r,a,s),VS(r,(o={},o[a]=Ac,o));else if(typeof s.value=="function")wc(r,a,s.value);else throw new kt("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=Yr(a)?a:this.applySnapshotPreProcessor(a);return B2(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=es(es({},S0),{name:this.name});return Yt.object(r,Pd,n)}}),Object.defineProperty(e.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){wc(n,"toString",yO),this.forAllProps(function(i){zS(n,i,r.unbox)}),this.initializers.reduce(function(i,a){return a(i)},n),b2(n,this.willChange),w2(n,this.didChange)}}),Object.defineProperty(e.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(r){var n=r,i=Wt(n.object),a=n.name;i.assertWritable({subpath:a});var o=i.type.properties[a];return o&&(Gs(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=Wt(n.object),a=i.type.properties[n.name];if(a){var o=n.oldValue?n.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:xc(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 kt("Not a value property: "+n);var a=Qo(r.storedValue,n),o=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!o)throw new kt("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=xd(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 kt("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){Gs(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 nd(a)?x0(this.propertyNames.map(function(o){return i.properties[o].validate(a[o],F2(n,o,i.properties[o]))})):$i(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 Pd}}),Object.defineProperty(e.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){r.storedValue[n]=void 0}}),e})(kd);Pp.prototype.applySnapshot=jt(Pp.prototype.applySnapshot);function bO(){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 Pp({name:r,properties:n})}function wO(){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 xO(t){return Ks(t)&&(t.flags&er.Object)>0}var rl=(function(t){Fr(e,t);function e(r,n,i,a){a===void 0&&(a=KC);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 Pu(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(_p(r)&&this.checker(r))return Hi();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return $i(n,r,"Value is not a ".concat(i))}}),e})(Bc),mk=new rl("string",er.String,function(t){return typeof t=="string"}),gk=new rl("number",er.Number,function(t){return typeof t=="number"}),SO=new rl("integer",er.Integer,function(t){return QC(t)}),kO=new rl("float",er.Float,function(t){return ZC(t)}),_O=new rl("finite",er.Finite,function(t){return JC(t)}),yk=new rl("boolean",er.Boolean,function(t){return typeof t=="boolean"}),vk=new rl("null",er.Null,function(t){return t===null}),bk=new rl("undefined",er.Undefined,function(t){return t===void 0}),wk=new rl("Date",er.Date,function(t){return typeof t=="number"||t instanceof Date},function(t){return t instanceof Date?t:new Date(t)});wk.getSnapshot=function(t){return t.storedValue.getTime()};var xk=wk;function PO(t){switch(typeof t){case"string":return mk;case"number":return gk;case"boolean":return yk;case"object":if(t instanceof Date)return xk}throw new kt("Cannot determine primitive type from value "+t)}function EO(t){return Ks(t)&&(t.flags&(er.String|er.Number|er.Integer|er.Boolean|er.Date))>0}var TO=(function(t){Fr(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:er.Literal}),n.value=r,n}return Object.defineProperty(e.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n,i,a){return Pu(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 _p(r)&&r===this.value?Hi():$i(n,r,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),e})(Bc);function Sk(t){return new TO(t)}var CO=(function(t){Fr(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|er.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=Yr(r)?Wt(r).snapshot:r;return this._predicate(a)?Hi():$i(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})(Ys);function OO(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=typeof t[0]=="string"?t.shift():Ks(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 CO(r,n,i,a)}function AO(t,e){var r=typeof t=="string"?e:t,n=k0.apply(void 0,Cc([],gu(r.map(function(i){return Sk(""+i)})),!1));return typeof t=="string"&&(n.name=t),n}var IO=(function(t){Fr(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=es({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=er.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 kt("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 kt("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 Hi();a++}else i.push(u)}return a===1?Hi():$i(n,r,"No type is applicable for the union").concat(x0(i))}}),Object.defineProperty(e.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),e})(Ys);function k0(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=Ks(t)?void 0:t,i=Ks(t)?Cc([t],gu(e),!1):e,a="("+i.map(function(o){return o.name}).join(" | ")+")";return new IO(a,i,n)}function RO(t){return Ks(t)&&(t.flags&er.Union)>0}var MO=(function(t){Fr(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|er.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"&&Gs(this,r),r}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return this.optionalValues.indexOf(r)>=0?Hi():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})(Ys);function DO(t,e){if(typeof e!="function"&&Yr(e))throw new kt("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function Sc(t,e,r){return DO(t,e),new MO(t,e,r||NO)}var NO=[void 0],LO=Sc(bk,void 0),FO=Sc(vk,null);function kk(t){return k0(t,LO)}function BO(t){return k0(t,FO)}var zO=(function(t){Fr(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)|er.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 kt("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):Hi()}}),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||nk}}),e})(Ys);function jO(t,e){var r=typeof t=="string"?t:"late(".concat(t.toString(),")"),n=typeof t=="string"?e:t;return new zO(r,n)}function UO(t,e){return new HO(t,e)}var HO=(function(t){Fr(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:er.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Yt.array()}),rw(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(jt(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=Pu(this,r,n,i,a);return this.pendingNodeList.push(s),rw(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):fk(r)?Hi():$i(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})(Bc),_k=(function(t){Fr(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:er.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 Pu(this,r,n,i,a)}}),Object.defineProperty(e.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(r,n){return fk(r)?this.subType?this.subType.validate(r,n):Hi():$i(n,r,"Value is not serializable and cannot be frozen")}}),e})(Bc),T3=new _k;function $O(t){return arguments.length===0?T3:Ks(t)?new _k(t):Sc(T3,t)}function qO(t){switch(t){case _n.beforeDestroy:return"destroy";case _n.beforeDetach:return"detach";default:return}}var VO=(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}),z2(e))this.identifier=e;else if(Yr(e)){var n=Wt(e);if(!n.identifierAttribute)throw new kt("Can only store references with a defined identifier attribute.");var i=n.unnormalizedIdentifier;if(i==null)throw new kt("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new kt("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=Hp(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 WO("[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})(),WO=(function(t){Fr(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return e})(Error),Pk=(function(t){Fr(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:er.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 z2(r)?Hi():$i(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){v3(n.root.storedValue,{op:"replace",value:u,path:n.path})},removeRef:function(){xO(o.type)?this.replaceRef(void 0):v3(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=Wt(a),s=function(f,p){var h=qO(p);h&&i.fireInvalidated(h,r,n,o)},u=o.registerHook(_n.beforeDetach,s),d=o.registerHook(_n.beforeDestroy,s);return function(){u(),d()}}}}),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(_n.beforeDestroy,function(){o&&o()});var s=function(u){o&&o();var d=r.parent,f=d&&d.storedValue;if(d&&d.isAlive&&f){var p=void 0;i?p=!!i.get(n,f):p=r.root.identifierCache.has(a.targetType,Hp(n)),p?o=a.addTargetNodeWatcher(r,n):u||a.fireInvalidated("invalidSnapshotReference",r,n,null)}};r.state===Kn.FINALIZED?s(!0):(r.isRoot||r.root.registerHook(_n.afterCreationFinalization,function(){r.parent&&r.parent.createObservableInstanceIfNeeded()}),r.registerHook(_n.afterAttach,function(){s(!1)}))}}}),e})(Bc),GO=(function(t){Fr(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=Yr(a)?CC(a):a,s=new VO(a,this.targetType),u=Pu(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=Yr(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})(Pk),XO=(function(t){Fr(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=Yr(a)?this.options.set(a,r?r.storedValue:null):a,s=Pu(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=Yr(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})(Pk);function Ek(t,e){var r=e||void 0,n=e?e.onInvalidated:void 0;return r&&(r.get||r.set)?new XO(t,{get:r.get,set:r.set},n):new GO(t,n)}function YO(t,e){var r=Ek(t,es(es({},e),{onInvalidated:function(n){e&&e.onInvalidated&&e.onInvalidated(n),n.removeRef()}}));return e&&e.acceptsUndefined===!1?r:kk(r)}var Tk=(function(t){Fr(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:er.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 Pp))throw new kt("Identifier types can only be instantiated as direct child of a model type");return Pu(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 kt("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?$i(n,r,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):Hi()}}),e})(Bc),KO=(function(t){Fr(e,t);function e(){var r=t.call(this,"identifier","string")||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:er.Identifier}),r}return Object.defineProperty(e.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),e})(Tk),QO=(function(t){Fr(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})(Tk),ZO=new KO,JO=new QO;function Hp(t){return""+t}function z2(t){return typeof t=="string"||typeof t=="number"}function eA(t){return new tA(t)}var tA=(function(t){Fr(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:er.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 Hi();var i=this.options.getValidationMessage(r);return i?$i(n,r,"Invalid value for type '".concat(this.name,"': ").concat(i)):Hi()}}),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 Pu(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,d=this.instantiate(i,a,void 0,u);return r.die(),d}}),e})(Bc),ft={enumeration:AO,model:bO,compose:wO,custom:eA,reference:Ek,safeReference:YO,union:k0,optional:Sc,literal:Sk,maybe:kk,maybeNull:BO,refinement:OO,string:mk,boolean:yk,number:gk,integer:SO,float:kO,finite:_O,Date:xk,map:mO,array:gO,frozen:$O,identifier:ZO,identifierNumber:JO,late:jO,lazy:UO,undefined:bk,null:vk,snapshotProcessor:hO};function Ck({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 rA(t){try{const{stops:e}=jp(t);if(e.length===0)return 127.5;let r=0,n=0;for(const i of e)try{const a=Et.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 C3(t){if(cn(t))return rA(t);const e=Et.Util.colorToRGBA(t);if(!e)return 127.5;const{r,g:n,b:i}=e;return(299*r+587*n+114*i)/1e3}function Ok(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=C3(t.fill),i=C3(r);return Math.abs(n-i)>=50?r:t.fill}let sc;function nA(){return sc||(sc=document.getElementById("polotno-text-style"),sc||(sc=document.createElement("style"),sc.id="polotno-text-style",document.head.appendChild(sc)),sc)}Et._fixTextRendering=!0;const O3={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal",textTransform:"none"},iA=Pr(({textNodeRef:t,element:e,onBlur:r,selectAll:n,cursorPosition:i})=>{const[a,o]=X.useState(O3),s=t.current;X.useLayoutEffect(()=>{if(!s)return;const h={};h.width=s.width()-2*s.padding()+"px",h.height=s.height()-2*s.padding()+s.fontSize()*s.lineHeight()+"px",h.fontSize=s.fontSize()+"px",h.lineHeight=s.lineHeight()+.01,h.fontFamily=s.fontFamily(),h.textAlign=s.align(),h.color=s.fill(),h.fontWeight=e.fontWeight,h.fontStyle=e.fontStyle,h.letterSpacing=e.letterSpacing+"em",h.opacity=Math.max(e.a.opacity,.2),h.textTransform=e.textTransform,h.caretColor=Ok(e);const y=`
|
|
93
|
+
.polotno-input::placeholder {
|
|
94
|
+
color: ${a.color};
|
|
95
|
+
opacity: 0.6;
|
|
96
|
+
}
|
|
97
|
+
`,v=nA();v.innerHTML="",v.appendChild(document.createTextNode(y)),JSON.stringify(h)!==JSON.stringify(a)&&o(h)});const u=X.useRef(null);if(X.useLayoutEffect(()=>{var h;const y=u.current;if(!y)return;(h=u.current)===null||h===void 0||h.focus();const v=i||y.value.length;y.selectionStart=y.selectionEnd=v,n&&(y?.select(),document.execCommand("selectAll",!1,void 0))},[]),X.useEffect(()=>{window.addEventListener("blur",r);const h=y=>{var v;!((v=u.current)===null||v===void 0)&&v.contains(y.target)||r()};return window.addEventListener("touchstart",h),()=>{window.removeEventListener("blur",r),window.removeEventListener("touchstart",h)}},[]),!s)return null;let d=0;const f=s.textArr.length*s.lineHeight()*s.fontSize();e.verticalAlign==="middle"&&(d=(e.a.height-f)/2),e.verticalAlign==="bottom"&&(d=e.a.height-f);const p=li(e.text);return X.createElement("textarea",{className:"polotno-input",ref:u,dir:xp(p),style:Object.assign(Object.assign(Object.assign({},O3),a),{paddingTop:d+"px"}),value:p,onChange:h=>{const y=Ck({oldText:e.text,newText:h.target.value,element:e});e.set({text:h.target.value,fontSize:y})},placeholder:e.placeholder,onBlur:r})}),aA=t=>X.createElement(qg,null,X.createElement(iA,Object.assign({},t))),Ak=(t,e,r,n)=>{const[i,a]=X.useReducer(u=>u+1,0),o=X.useRef(h3(e,r,n)),s=X.useRef(null);return X.useLayoutEffect(()=>{if(o.current=h3(e,r,n),o.current)return;let u=!0;return(async()=>{o.current=!1,a();const d=Jo(`text ${e}`);await t.loadFont(e,r,n),u?(s.current=d,o.current=!0,a()):d()})(),()=>{s.current&&(s.current(),s.current=null),u=!1}},[e,r,n]),X.useEffect(()=>{o.current&&setTimeout(()=>{s.current&&(s.current(),s.current=null)})},[o.current]),[o.current]},Ik=({fontLoaded:t,fontFamily:e,fontSize:r,lineHeight:n})=>X.useMemo(()=>wC({fontFamily:e,fontSize:r,lineHeight:n}),[t,e,r,n]);function Yg(t){const e=X.useRef(t),r=X.useRef(t);return X.useMemo(()=>{r.current=e.current,e.current=t},[t]),r.current}const oA=Pr(({element:t,store:e})=>{const r=X.useRef(null),n=X.useRef(null),i=X.useRef(null),a=X.useRef([]),[,o]=X.useReducer(Q=>Q+1,0),{editorEnabled:s,selectAll:u}=(Q=>{const[U,L]=X.useState(!1),W=X.useRef(!1);return X.useEffect(()=>{var V=!0;return setTimeout(()=>{V&&(Q._editModeEnabled&&(W.current=!0),L(!0),setTimeout(()=>{W.current=!1},50))},50),()=>{V=!1}},[]),{editorEnabled:U&&Q._editModeEnabled,selectAll:W.current}})(t),[d,f]=X.useState(!1),p=X.useRef(t.a.height),h=e.selectedShapes.indexOf(t)>=0&&t.selectable,y=Yg(h),{textVerticalResizeEnabled:v}=dr,b=dr.autoDeleteEmptyText,x=Yg(t.fontFamily),[k,S]=X.useState([]);X.useEffect(()=>{var Q,U;const L=(U=(Q=r.current)===null||Q===void 0?void 0:Q.textArr)!==null&&U!==void 0?U:[];JSON.stringify(L)!==JSON.stringify(k)&&S(L)}),X.useEffect(()=>{if(t.a.width)return;const Q=r.current;Q.width(600),t.set({width:1.4*Q.getTextWidth()})},[]),X.useEffect(()=>{y&&!h&&b&&t.text===""&&t.removable&&!t.placeholder&&e.deleteElements([t.id])},[b,t.placeholder,t.removable,t.text,h,y]),X.useLayoutEffect(()=>so(()=>{const Q=r.current;ji(Q,t)})),X.useEffect(()=>{const Q=a.current;Q.length>0&&(a.current=[],Q.forEach(U=>U()))});const[P]=Ak(e,t.fontFamily,t.fontStyle,t.fontWeight);let _=li(t.text);t.textTransform==="uppercase"&&(_=_.toUpperCase());const E=()=>{if(t.curveEnabled){const L=n.current;return L.getSelfRect().height||L.fontSize()}const Q=r.current.clone({height:void 0}),U=Math.ceil(Q.fontSize()*Q.lineHeight()*Q.textArr.length+1);return Q.destroy(),U};X.useLayoutEffect(()=>{if(!P)return;const{textOverflow:Q,textSplitAllowed:U}=dr,L=(W,V,ee,re)=>{const K=Jo(`text ${t.id}`),ne=()=>{e.history.ignore(W,V,ee).then(()=>{a.current.push(K),o()})};re?queueMicrotask(ne):ne()};if(!t.height){const W=E();return void L(()=>{t.height||t.set({height:W})},void 0,void 0,!0)}if(!e.isPlaying)if(Q!=="change-font-size"||d){if(Q==="resize"){const W=E();v&&t.height<W&&!d&&L(()=>{var V;b3(t)&&t.set({height:W}),(V=r.current)===null||V===void 0||V.height(W)},!1,!0),v||t.height===W||d||L(()=>{var V;b3(t)&&t.set({height:W}),(V=r.current)===null||V===void 0||V.height(W)},!1,!0)}}else{const W=(function(ee,re,K=!1){const ne=ee.fontSize(),le=ee.height(),ae=li(re.text);let ue=re.a.fontSize;ee.height(void 0);const ye=Math.round(2*re.a.fontSize)-1;for(let Ie=1;Ie<ye;Ie++){const Le=re.a.height&&ee.height()>re.a.height;let Ue=ae.split(`
|
|
98
|
+
`).join(" ").split(/[\s-]+/).reduce((Se,de)=>(de=de.toLowerCase(),/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(de)?Se.concat(de.split("")):Se.concat(de)),[]),$e=ee.textArr.map(Se=>Se.text.toLowerCase()).join(";");const rt=Ue.find(Se=>!$e.includes(Se)||($e=$e.replace(Se,""),!1));if(!(Le||rt&&!K))break;ue-=.5,ee.fontSize(ue)}return ee.fontSize(ne),ee.height(le),ue})(r.current,t,U);if(W!==t.fontSize)return void L(()=>{t.set({fontSize:W})},!1,!0);const V=E();t.height===V||v||L(()=>{t.set({height:V})},!1,!0)}}),X.useLayoutEffect(()=>{var Q;if(P&&t.curveEnabled){const U=(Q=n.current)===null||Q===void 0?void 0:Q.getSelfRect().width;if(U){const L=U-t.a.width,W=t.a.rotation*Math.PI/180,V=-L/2*Math.cos(W),ee=-L/2*Math.sin(W);t.set({width:U,x:t.a.x+V,y:t.a.y+ee})}}},[P,t.curveEnabled,t.curvePower,t.text,t.fontSize,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing]),X.useLayoutEffect(()=>{const Q=r.current;Q&&(Q.width(Q.width()+1e-8),Q.width(Q.width()-1e-8),Q._setTextData(),ji(Q,t))},[P]);const A=X.useRef(null),T=X.useRef(0),I=Q=>{Q.evt.preventDefault(),e.selectedShapes.find(L=>L===t)&&t.contentEditable&&(T.current=(function(L){var W;const V=L.target,ee=(function(ue){var ye=ue.getAbsoluteTransform().copy();ye.invert();var Ie=ue.getStage().getPointerPosition();return ye.point(Ie)})(V),re=V.textArr,K=Math.floor(ee.y/(V.fontSize()*V.lineHeight())),ne=re.slice(0,K).reduce((ue,ye)=>ue+ye.text.length,K),le=(W=re[K])!==null&&W!==void 0?W:re[0];let ae=0;return V.align()==="right"?ae=V.width()-le.width:V.align()==="center"&&(ae=V.width()/2-le.width/2),ne+Math.round((ee.x-ae)/le.width*le.text.length)})(Q),t.toggleEditMode())},M=!_&&t.placeholder?.6:t.a.opacity;Up(r,M);const R=Ik({fontLoaded:P,fontFamily:t.fontFamily,fontSize:t.a.fontSize,lineHeight:t.lineHeight}),N=t.selectable||e.role==="admin",B=Zo(t),H=Zo(t,t.stroke,"stroke"),$=X.useMemo(()=>t.backgroundEnabled?t.curveEnabled?(function({width:Q,height:U,padding:L=0,cornerRadius:W=0}){const V=-L,ee=-L,re=Q+L,K=U+L,ne=u3(`M ${V} ${ee} L ${re} ${ee} L ${re} ${K} L ${V} ${K} Z`);return c3(ne,W).path})({width:t.a.width,height:t.a.height,cornerRadius:t.backgroundCornerRadius*(t.a.fontSize*R*.5),padding:t.backgroundPadding*(t.a.fontSize*R*.5)}):(function({lines:Q,lineHeight:U,width:L,align:W="left",padding:V=0,cornerRadius:ee=0}){var re;Q.forEach((ae,ue)=>{ae.cx=L/2,W==="right"?ae.cx=L-ae.width/2:W==="left"&&(ae.cx=ae.width/2),W!=="justify"||ae.lastInParagraph||(ae.width=L),W==="justify"&&(ae.cx=ae.width/2)});let K=`M ${(re=Q[0])===null||re===void 0?void 0:re.cx} ${-V}`;Q.forEach((ae,ue)=>{const{cx:ye}=ae,Ie=Q[ue-1];Ie&&Ie.width>ae.width?K+=` L ${ye+ae.width/2+V} ${ue*U+V}`:K+=` L ${ye+ae.width/2+V} ${ue*U-V}`;const Le=Q[ue+1];Le&&Le.width>ae.width?K+=` L ${ye+ae.width/2+V} ${(ue+1)*U-V}`:K+=` L ${ye+ae.width/2+V} ${(ue+1)*U+V}`});for(var ne=Q.length-1;ne>=0;ne--){const ae=Q[ne],{cx:ue}=ae,ye=Q[ne+1];ye&&ye.width>ae.width?K+=` L ${ue-ae.width/2-V} ${(ne+1)*U-V}`:K+=` L ${ue-ae.width/2-V} ${(ne+1)*U+V}`;const Ie=Q[ne-1];Ie&&Ie.width>ae.width?K+=` L ${ue-ae.width/2-V} ${ne*U+V}`:K+=` L ${ue-ae.width/2-V} ${ne*U-V}`}K+=" Z";const le=u3(K);return c3(le,ee).path})({lines:JSON.parse(JSON.stringify(k)),cornerRadius:t.backgroundCornerRadius*(t.a.fontSize*R*.5),lineHeight:R*t.a.fontSize,padding:t.backgroundPadding*(t.a.fontSize*R*.5),width:t.a.width,align:t.align}):"",[t.backgroundEnabled,t.curveEnabled,t.backgroundCornerRadius,t.a.fontSize,t.a.height,R,t.backgroundPadding,t.a.width,t.align,k]),G=_u();let Z=0;t.curveEnabled||(t.verticalAlign==="middle"?Z=(t.a.height-k.length*R*t.a.fontSize)/2:t.verticalAlign==="bottom"&&(Z=t.a.height-k.length*R*t.a.fontSize));const J=t.curveEnabled?Tc(t.a.width,t.a.height,t.curvePower,t.a.fontSize):"",q=P?'"'+t.fontFamily+'"':x===t.fontFamily?"Arial":'"'+x+'"';return X.createElement(X.Fragment,null,X.createElement(bp,{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*M,data:$,fill:t.backgroundColor,offsetY:-Z}),X.createElement(bp,{data:J,stroke:"red",strokeWidth:1,x:t.a.x,y:t.a.y,rotation:t.a.rotation,visible:!1}),X.createElement(NT,Object.assign({ref:n,visible:t.curveEnabled,data:J,text:_||t.placeholder,listening:!1,align:"center",textBaseline:"middle"},B,H,{strokeWidth:t.strokeWidth,lineJoin:"round",fillAfterStrokeEnabled:!0,fontSize:t.a.fontSize,fontFamily:`"${t.fontFamily}", "${x}"`,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:M,hideInExport:!t.showInExport,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity})),X.createElement(Na,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:_||t.placeholder,direction:xp(_)},B,H,{lineJoin:"round",strokeWidth:t.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:t.a.fontSize,fontFamily:q,fontStyle:t.fontStyle+" "+t.fontWeight,textDecoration:t.textDecoration,align:t.align,verticalAlign:t.verticalAlign,draggable:G?t.draggable&&h:t.draggable,preventDefault:!G||h,opacity:t.curveEnabled?0:M,visible:!t._editModeEnabled,ellipsis:dr.textOverflow==="ellipsis",shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,lineHeight:R,letterSpacing:t.letterSpacing*t.a.fontSize,listening:N,onDragMove:Q=>{t.set({x:Q.target.x(),y:Q.target.y()})},onDragEnd:Q=>{t.set({x:Q.target.x(),y:Q.target.y()})},onClick:I,onTap:I,onTransformStart:()=>{f(!0),p.current=r.current.height()},onTransform:Q=>{var U,L,W;const V=Q.target;(U=i.current)===null||U===void 0||U.setAttrs({x:V.x(),y:V.y(),rotation:V.rotation(),scale:V.scale()});const ee=((L=V.getStage())===null||L===void 0?void 0:L.findOne("Transformer")).getActiveAnchor();if(ee==="middle-left"||ee==="middle-right"){const K=V.scaleX(),ne=V.width()*K,le=t.a.fontSize;let ae=ne;ne<le&&(ae=le,A.current&&V.position(A.current)),V.width(ae),V.scaleX(1),V.scaleY(1);let ue=E();if(dr.textOverflow==="ellipsis")ue=p.current;else{const Ie=Math.max(ue,p.current);V.height(Ie),t.set({height:V.height()})}const ye=dr.textVerticalResizeEnabled?Math.max(ue,p.current):E();t.set({x:V.x(),width:V.width(),rotation:V.rotation(),height:ye}),ji(V,t)}if(ee==="top-center"||ee==="bottom-center"){let K=dr.textOverflow==="resize"?E():R*t.a.fontSize;Q.target.height(Math.max(K,Q.target.height()*Q.target.scaleY())),Q.target.scaleY(1)}A.current=Q.target.position();const re=Q.target.scaleX();(W=i.current)===null||W===void 0||W.setAttrs({scaleX:1,scaleY:1}),Q.target.scaleX(1),Q.target.scaleY(1),t.set({fontSize:t.a.fontSize*re,width:Q.target.width()*re,x:Q.target.x(),y:Q.target.y(),rotation:Q.target.rotation(),height:Q.target.height()*re,shadowBlur:t.shadowBlur*re,shadowOffsetX:t.shadowOffsetX*re,shadowOffsetY:t.shadowOffsetY*re,strokeWidth:t.strokeWidth*re})},onTransformEnd:Q=>{var U;const L=Q.target.scaleX();Q.target.scaleX(1),Q.target.scaleY(1),t.set({fontSize:Math.round(t.a.fontSize*L),width:Math.ceil(Q.target.width()*L),x:Q.target.x(),y:Q.target.y(),rotation:Q.target.rotation(),height:Q.target.height()*L,shadowBlur:t.shadowBlur*L,shadowOffsetX:t.shadowOffsetX*L,shadowOffsetY:t.shadowOffsetY*L,strokeWidth:t.strokeWidth*L}),(U=i.current)===null||U===void 0||U.setAttrs({scaleX:1,scaleY:1}),f(!1)}})),s&&X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation},X.createElement(aA,{textNodeRef:r,element:t,selectAll:u,cursorPosition:T.current,onBlur:()=>{t.toggleEditMode(!1)}})))});var q1={exports:{}},V1={exports:{}},A3;function j2(){return A3||(A3=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
|
+
`)}})(V1)),V1.exports}var I3;function Rk(){return I3||(I3=1,(function(t,e){j2()("lex"),t.exports=r;function r(n){var i="",a,o=0,s=-1,u=0,d=1,f="before-selector",p=[f],h={},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(J){return J?p[p.length-1-J]:f}function k(J){var q=s+1;return J===n.slice(q,q+J.length)}function S(J){var q=n.slice(s).indexOf(J);return q>0?q:!1}function P(J){return J===_(1)}function _(J){return n[s+(J||1)]}function E(){var J=p.pop();return f=p[p.length-1],J}function A(J){return f=J,p.push(f),p.length}function T(J){var q=f;return p[p.length-1]=f=J,q}function I(J){if((J||1)==1)n[s]==`
|
|
100
|
+
`?(d++,o=1):o++,s++;else{var q=n.slice(s,s+J).split(`
|
|
101
|
+
`);q.length>1&&(d+=q.length-1,o=1),o+=q[q.length-1].length,s=s+J}}function M(){h.end={line:d,col:o},y.push(h),i="",h={}}function R(J){h={type:J,start:{line:d,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
|
+
`&&(h.value=i.trim(),M(),E());break}break;case":":switch(x()){case"name":h.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&&(h.value=i.trim(),M()),T("before-name");break;case"value-paren":i+=a;break;case"at-value":h.value=i.trim(),M(),E();break;case"before-name":break;default:i+=a;break}break;case"{":switch(x()){case"selector":if(_(-1)==="\\"){i+=a;break}h.text=i.trim(),M(),T("before-name"),u=u+1;break;case"at-group":switch(h.name=i.trim(),h.type){case"font-face":case"viewport":case"page":A("before-name");break;default:A("before-selector")}M(),u=u+1;break;case"name":case"at-rule":h.name=i.trim(),M(),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&&(h.value=i.trim()),h.name&&h.value&&M(),R("end"),M(),E(),x()==="at-group"&&(R("at-group-end"),M(),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"),M()),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("/")?(h.text=i,I(),M(),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 B=!1,H,$,G=0,Z=v.length;!B&&G<Z;++G)$=v[G],H=$.name||$,k(H)&&(B=!0,R(H),A($.state||"at-group"),I(H.length),$.prefix&&(h.prefix=$.prefix),$.type&&(h.type=$.type));B||(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}})(q1)),q1.exports}var W1={exports:{}},R3;function sA(){return R3||(R3=1,(function(t,e){j2()("parse");var r=Rk();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=[],M;M=d();)T=k(M),T&&I.push(T);return{type:"stylesheet",stylesheet:{rules:I}}}function u(E,A){A||(A={});for(var T,I=["type","name","value"],M={},R=0;R<I.length;++R)T=I[R],E[T]&&(M[T]=A[T]||E[T]);for(I=Object.keys(A),R=0;R<I.length;++R)T=I[R],M[T]||(M[T]=A[T]);return a&&(M.position={start:E.start,end:E.end}),M}function d(){var E=o.shift();return E}function f(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 p(E){return u(E)}function h(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 f(E);case"comment":if(n)return y(E);break;case"charset":return h(E);case"import":return p(E);case"namespace":return v(E);case"font-face":case"supports":case"viewport":case"document":case"page":return f(E)}}function S(E){for(var A,T=[],I;(I=d())&&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})}})(W1)),W1.exports}var G1={exports:{}},M3;function lA(){return M3||(M3=1,(function(t,e){j2()("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 d(_){if(_){a+=_;return}return n?"":Array(a).join(i||"")}function f(_){return"@"+_.type+" "+_.value+";"+o}function p(_){var E="",A=_.prefix||"";_.name&&(E=" "+_.name);var T=_.type!=="page";return"@"+A+_.type+E+s+b(_,T)+o}function h(_){return r?"/*"+(_.text||"")+"*/"+o:""}function y(_){var E;return _.selectors?E=_.selectors.join(","+o):(E="@"+_.type,E+=_.name?" "+_.name:""),d()+E+s+b(_)+o}function v(_,E){return _.reduce(function(A,T){var I=T.type==="comment"?h(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+d()+"}"}function x(_,E){if(!_)return"";d(1);var A=v(_,E);return d(-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 p(_);case"comment":return h(_);case"import":case"charset":case"namespace":return f(_);case"font-face":case"supports":case"viewport":case"document":case"page":return p(_)}}function P(_){var E=_.name?_.name+":"+s:"";return d()+E+_.value+";"}})(G1)),G1.exports}var X1,D3;function uA(){return D3||(D3=1,X1={lex:Rk(),parse:sA(),stringify:lA()}),X1}var cA=uA();const fA=Oc(cA);function dA(t){for(;t.parentNode;){if(t.nodeName==="defs")return!0;t=t.parentNode}return!1}function hA(t){const e={};return t.querySelectorAll("style").forEach(r=>{const n=fA.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 Mk(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(d=>{e[`.${d}`]&&(o=Object.assign(Object.assign({},o),e[`.${d}`]))}),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 d=t.ownerSVGElement,f=d&&d!==t?Mk(d,e):null;f?.fill==="currentColor"||f?.stroke==="currentColor"||(n.fill="black")}return n}const pA=["path","rect","circle","line","polygon","polyline","ellipse","text"];function mA(t){for(var e=[],r=t.getElementsByTagName("*"),n=0,i=r.length;n<i;n++){const a=r[n];dA(a)||(a.getAttribute("fill")!==null&&e.push(a),(a.getAttribute("stroke")!==null||a.style&&a.style.fill||pA.indexOf(a.nodeName)>=0)&&e.push(a))}return e}async function N3(t){const e=await fetch(t);return nl(await e.text())}async function $p(t){return await(await fetch(t,{mode:"cors"})).text()}function nl(t){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t)))}function U2(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 d=parseFloat(u)/parseFloat(o);e.documentElement.setAttribute("width",d*parseFloat(a)+"px")}if(u&&u.indexOf("%")>=0&&s&&s.indexOf("%")===-1){const d=parseFloat(s)/parseFloat(a);e.documentElement.setAttribute("height",d*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 gA=(t,e)=>{if(!t||!e)return!1;if(e==="currentColor"&&t==="black")return!0;const r=Et.Util.colorToRGBA(t),n=Et.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 H2(t,e){var r=new DOMParser().parseFromString(t,"image/svg+xml");const n=mA(r),i=Array.from(e.keys()),a=hA(r);return n.forEach(o=>{const{fill:s,stroke:u}=Mk(o,a);[{prop:"fill",color:s},{prop:"stroke",color:u}].forEach(({prop:d,color:f})=>{const p=i.find(h=>gA(h,f));if(p){const h=e.get(p);if(cn(h)){const{rotation:y,stops:v}=jp(h),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=Et.Util.degToRad(P+90),I=(Math.cos(T)+1)/2,M=(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*M+"%"),A.setAttribute("x2",100*R+"%"),A.setAttribute("y2",100*N+"%"),A.setAttribute("gradientUnits","userSpaceOnUse"),A.setAttribute("id",S);for(var B=0;B<_.length;B++){var H=_[B],$=document.createElementNS(E,"stop");for(var G in H)H.hasOwnProperty(G)&&$.setAttribute(G,H[G]);A.appendChild($)}(k.querySelector("defs")||k.insertBefore(document.createElementNS(E,"defs"),k.firstChild)).appendChild(A)})(r.children[0],x,y,b),o.style[d]=null,o.setAttribute(d,`url('#${x}')`)}else o.style[d]=e.get(p)}})}),nl(new XMLSerializer().serializeToString(r))}const $2=(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 yA(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),d=s/o,f=u/o;let p=e.sceneCanvas;p?(p.width!==s||p.height!==u||p.pixelRatio!==o)&&(p.setSize(d,f),p.setPixelRatio(o)):p=new Ia({width:d,height:f,pixelRatio:o});const h=p.getContext(),y=p.width/p.pixelRatio+Math.abs(i),v=p.height/p.pixelRatio+Math.abs(a);let b=e.bufferCanvas;if(b){const x=Math.round(y*p.pixelRatio),k=Math.round(v*p.pixelRatio);(b.width!==x||b.height!==k||b.pixelRatio!==p.pixelRatio)&&(b.setSize(y,v),b.setPixelRatio(p.pixelRatio))}else b=new Ia({width:y,height:v,pixelRatio:p.pixelRatio});return e.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(i||a)&&h.translate(-1*i,-1*a),t.drawScene(p,void 0,b),h.restore(),p}function vL(){return{sceneCanvas:new Ia({width:1,height:1,pixelRatio:1}),bufferCanvas:new Ia({width:1,height:1,pixelRatio:1})}}const Kv=(t,e=100,r=!1,n)=>{const i=X.useRef(n??t),[,a]=X.useReducer(u=>u+1,0),o=X.useCallback(u=>{i.current!==u&&(i.current=u,a())},[i]),s=X.useRef(null);return t===r&&(s.current&&(clearTimeout(s.current),s.current=null),i.current=r),X.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 gc(){return document.createElement("canvas")}const Dk=t=>t.indexOf("data:image/svg+xml")>=0||t.indexOf(".svg")>=0,L3=t=>{const[e,r]=X.useState(t);return X.useEffect(()=>{(async()=>{const n=await(async function(i){if(!Dk(i))return i;const a=await $p(i),o=U2(a);return nl(o)})(t);n!==e&&r(n)})()},[t]),e};function F3(t,e){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}const vA={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},bA={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},B3=(t,e,r)=>Math.max(e,Math.min(r,t)),wA=(t,e,r,n,i=0,a=!1,o=!0)=>{const s=Math.floor(B3(t.a.width*n,1,1e4)),u=Math.floor(B3(t.a.height*n,1,1e4)),d=Math.min(i*n,s/2,u/2),f=Math.max(t.a.width/r.width,t.a.height/r.height)*n,p=t.page._exportingOrRendering&&dr.imageDownScalingEnabled&&f<1&&!a,h=r.x===0&&r.y===0&&r.width===e?.width&&r.height===e?.height,y=X.useMemo(()=>{if(e&&e.width&&e.height)return h&&d===0&&!p?void 0:gc()},[e,d,p,h]);return X.useLayoutEffect(()=>{if(!y||!e)return;$2(y,s,u);const v=y.getContext("2d");if(!v)return;d&&(v.beginPath(),v.moveTo(d,0),v.lineTo(s-d,0),v.arc(s-d,d,d,3*Math.PI/2,0,!1),v.lineTo(s,u-d),v.arc(s-d,u-d,d,0,Math.PI/2,!1),v.lineTo(d,u),v.arc(d,u-d,d,Math.PI/2,Math.PI,!1),v.lineTo(0,d),v.arc(d,d,d,Math.PI,3*Math.PI/2,!1),v.clip());const b=p?(function(k,S){var P,_;const E=gc();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(M,R,N,B,H,$,G){for(var Z=new ImageData(R,N),J=new Int32Array(M.data.buffer),q=M.width,Q=new Int32Array(Z.data.buffer),U=Z.width,L=R/$,W=N/G,V=Math.round(1/L),ee=Math.round(1/W),re=V*ee,K=0;K<Z.height;K++)for(var ne=0;ne<U;ne++){for(var le=0+Math.round(ne/L)+(0+Math.round(K/W))*q,ae=0,ue=0,ye=0,Ie=0,Le=0;Le<ee;Le++)for(var Ue=0;Ue<V;Ue++){var $e=J[le+Ue+Le*q];ae+=$e<<24>>>24,ue+=$e<<16>>>24,ye+=$e<<8>>>24,Ie+=$e>>>24}ae=Math.round(ae/re),ue=Math.round(ue/re),ye=Math.round(ye/re),Ie=Math.round(Ie/re),Q[ne+K*U]=Ie<<24|ye<<16|ue<<8|ae}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,f):e,x=p?{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;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,p]),X.useEffect(()=>()=>{y&&y.nodeName==="CANVAS"&&Et.Util.releaseCanvas(y)},[y]),y||e},xA=gc(),SA=Pr(({element:t})=>{const e=Math.min(30,t.a.width/4,t.a.height/4),r=X.useRef(null);return X.useEffect(()=>{const n=r.current;if(!n)return;const i=new Et.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}}),X.createElement(Zt,{x:t.x,y:t.y,rotation:t.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},X.createElement(ur,{width:t.a.width,height:t.a.height,fill:"rgba(124, 173, 212, 0.8)"}),X.createElement(M2,{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}))}),kA=Pr(({element:t})=>{const e=Math.max(10,Math.min(30,t.a.width/25));return X.createElement(Zt,{x:t.x,y:t.y,rotation:t.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},X.createElement(ur,{width:t.a.width,height:t.a.height,fill:"rgba(223, 102, 102, 0.8)"}),X.createElement(Na,{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 Y1=D2;const up=(t,e="",r="")=>{const n=X.useRef(),i=()=>{var a;(a=n.current)===null||a===void 0||a.call(n),n.current=void 0};X.useEffect(()=>i,[]),X.useLayoutEffect(()=>{const a=e.slice(0,200),o=`image with id ${r} url: ${a}`;t!=="loading"||n.current||(n.current=Jo(o)),t!=="loading"&&i(),t==="failed"&&Rd(o)},[t])},z3=Pr(({element:t,store:e})=>{var r;const[n,i]=X.useState(!1),a=X.useRef(null),o=X.useRef(null),s=e.selectedShapes.indexOf(t)>=0&&t.selectable,[u,d]=(Se=>{const[de,se]=X.useReducer(Oe=>Oe+1,0),he=X.useRef("loading"),Ce=X.useRef(Se.src),oe=X.useRef(Se.src);oe.current!==Se.src&&(oe.current=Se.src,he.current="loading");const ke=X.useMemo(()=>Dk(Se.src)||Se.type==="svg",[Se.src,Se.type]);return X.useEffect(()=>{if(!ke||!Se.src)return;let Oe=!1;return(async()=>{he.current="loading",se();const Be=await $p(Se.src),dt=U2(Be);let nt;nt=Se.colorsReplace?H2(dt,Se.colorsReplace||new Map):nl(dt),Oe||(Ce.current=nt,he.current="loaded",se())})(),()=>{Oe=!0}},[Se.src,JSON.stringify(Se.colorsReplace)]),ke?[Ce.current,he.current]:[Se.src,"loaded"]})(t),[f,p]=Y1(u,"anonymous"),h=t.type!=="svg"||d==="loaded"?p:"loading";up(h,t.src,t.id);const y=t.page._exportingOrRendering?1:Math.max(1,e.scale),v=e._elementsPixelRatio*y,b=(({image:Se,status:de,type:se})=>{const he=X.useRef();return X.useEffect(()=>{he.current=Se||he.current},[Se]),de!=="failed"||de!=="failed"&&se==="svg"?he.current:void 0})({image:f,status:p,type:t.type}),x=((Se,de,se)=>{const he=X.useMemo(()=>{var Ce,oe;const{flipX:ke,flipY:Oe}=Se,Be=Se.type==="svg"||Se.src.indexOf("data:image/svg+xml")>=0||Se.src.indexOf(".svg")>=0,dt=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,nt=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||dt)&&Be||Se.maskSrc;if(!ke&&!Oe&&!nt)return de;if(!de||!de.width||!de.height)return null;const xe=gc();let me=1;Se.type==="svg"&&(me=Math.max(Se.a.width/de.width*se,Se.a.height/de.height*se)),$2(xe,Math.max(de.width*me,1),Math.max(de.height*me,1));let je=ke?-xe.width:0,ve=Oe?-xe.height:0;return(Ce=xe.getContext("2d"))===null||Ce===void 0||Ce.scale(ke?-1:1,Oe?-1:1),(oe=xe.getContext("2d"))===null||oe===void 0||oe.drawImage(de,je,ve,xe.width,xe.height),xe},[Se.maskSrc,Se.flipX,Se.flipY,de,Se.a.width,Se.a.height,se]);return X.useEffect(()=>()=>{he&&he.nodeName==="CANVAS"&&Et.Util.releaseCanvas(he)},[he]),he})(t,f||b,v),k=((Se,de)=>{const se=L3(Se.maskSrc||""),[he,Ce]=Y1(se,"anonymous");return up(se?Ce:"loaded",se||"",Se.id),X.useMemo(()=>{if(!he||!de||!de.width||!de.height)return de;const oe=gc();oe.width=Math.max(de.width,1),oe.height=Math.max(de.height,1);const ke=oe.getContext("2d");if(!ke)return de;ke.drawImage(de,0,0),ke.globalCompositeOperation="source-in";const Oe=(function(Be,dt){const nt=dt.width/dt.height;let xe,me;return nt>=Be.width/Be.height?(xe=Be.width,me=Be.width/nt):(xe=Be.height*nt,me=Be.height),{x:(Be.width-xe)/2,y:(Be.height-me)/2,width:xe,height:me}})(he,Se);return ke.drawImage(he,Oe.x,Oe.y,Oe.width,Oe.height,0,0,de.width,de.height),oe},[de,he,Se.a.width,Se.a.height])})(t,x)||xA;let{cropX:S,cropY:P,cropWidth:_,cropHeight:E}=t.a;p!=="loaded"&&(S=P=0,_=E=1);const A=k.width*_,T=k.height*E,I=t.a.width/t.a.height;let M,R;const N=A/T,B=t.stretchEnabled;B?(M=A,R=T):I>=N?(M=A,R=A/I):(M=T*I,R=T);const H={x:k.width*S,y:k.height*P,width:M,height:R},$=(r=t.cornerRadius)!==null&&r!==void 0?r:0,G=t.page._exportingOrRendering?1:Math.min(2,e.scale),Z=e._elementsPixelRatio*G;let J=((Se,de,se,he)=>{const Ce=L3(Se.clipSrc||""),[oe,ke]=Y1(Ce,"anonymous"),Oe=Se.clipSrc?ke:"loaded";up(Oe,Se.clipSrc,Se.id);const Be=X.useMemo(()=>{if(de&&oe)return gc()},[de,oe]);return X.useLayoutEffect(()=>{var dt;if(!oe||!de||!de.width||!de.height||!oe||!oe.width||!oe.height||!Be)return;const nt=gc(),xe=Math.max(Se.a.width/oe.width*se,Se.a.height/oe.height*se);nt.width=Math.max(oe.width*xe,1),nt.height=Math.max(oe.height*xe,1),(dt=nt.getContext("2d"))===null||dt===void 0||dt.drawImage(oe,0,0,nt.width,nt.height),Be.width=Math.max(de.width,1),Be.height=Math.max(de.height,1);const me=Be.getContext("2d");me&&(me.save(),me.drawImage(nt,0,0,de.width,de.height),Et.Util.releaseCanvas(nt),me.globalCompositeOperation="source-in",me.drawImage(de,0,0,Be.width,Be.height),me.restore())},[Be,de,oe,Se.a.width,Se.a.height,se,...he]),Se.clipSrc&&oe?Be:de})(t,wA(t,k,H,Z,$,n||t._cropModeEnabled||t.type==="svg",!0),Z,[H,$,Z]);const q=Math.max(t.a.width/M,t.a.height/R);X.useEffect(()=>{var Se;if(!t._cropModeEnabled)return;const de=(Se=a.current)===null||Se===void 0?void 0:Se.getStage();function se(Ce){t._cropModeEnabled&&Ce.target!==o.current&&t.toggleCropMode(!1)}function he(Ce){t._cropModeEnabled&&Ce.target.parentNode!==de?.content&&t.toggleCropMode(!1)}return document.body.addEventListener("click",he),de?.on("click",se),de?.on("tap",se),()=>{document.body.removeEventListener("click",he),document.body.removeEventListener("touchstart",he),de?.off("click",se),de?.off("click",se)}},[t._cropModeEnabled]),X.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled)return ji(a.current,t),so(()=>{ji(a.current,t)},{delay:100})},[J,t.page._exportingOrRendering,n,_,E,t._cropModeEnabled]),X.useLayoutEffect(()=>{var Se;n||t._cropModeEnabled?(Se=a.current)===null||Se===void 0||Se.clearCache():ji(a.current,t)},[n,t.a.width,t.a.height,t._cropModeEnabled]),X.useEffect(()=>{ji(a.current,t)},[t.shadowEnabled,t.shadowBlur,t.cornerRadius,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]);const Q=X.useRef(null),U=X.useRef(null),L=X.useRef(null);X.useLayoutEffect(()=>{t._cropModeEnabled&&(U.current.nodes([Q.current]),L.current.nodes([o.current]))},[t._cropModeEnabled]);var W=X.useRef(null),V=X.useRef(0),ee=X.useRef(!1);const re=Se=>{var de;((de=Se.evt.touches)===null||de===void 0?void 0:de.length)>2&&Se.target.stopDrag(),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 se=Se.target.width()*Se.target.scaleX(),he=Se.target.height()*Se.target.scaleY(),Ce=Math.min(1,M/se),oe=Math.min(1,R/he),ke=1-Ce,Oe=Math.min(ke,Math.max(0,Math.round(-Se.target.x())/se)),Be=1-oe,dt=Math.min(Be,Math.max(0,Math.round(-Se.target.y())/he));Se.target.setAttrs({x:-Oe*k.width,y:-dt*k.height,scaleX:1,scaleY:1}),t.set({cropX:Oe,cropY:dt,cropWidth:Ce,cropHeight:oe})},K=()=>{t.type!=="svg"&&t.contentEditable&&(t.stretchEnabled||setTimeout(()=>{t.toggleCropMode(!0)}))},ne=t.type==="svg"&&b,le=p==="loading"&&!ne,[ae]=Kv(le,100,!1,!1),ue=p==="failed",ye=!ae&&!ue,Ie=X.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Le=ye?t.a.opacity:0;Up(a,Le);const Ue=t.selectable||e.role==="admin",$e=_u(),rt=Zo(t,t.borderColor,"stroke");return X.createElement(X.Fragment,null,ae&&X.createElement(SA,{element:t}),ue&&X.createElement(kA,{element:t}),X.createElement(Vo,{ref:a,name:"element",id:t.id,image:J,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:Ue,draggable:$e?t.draggable&&s:t.draggable,preventDefault:!$e||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:K,onDblTap:K,onTransformStart:()=>{i(!0),Ie.current={cropX:t.cropX,cropY:t.cropY,cropWidth:t.cropWidth,cropHeight:t.cropHeight}},onTransform:Se=>{var de;const se=Se.currentTarget,he=Math.abs(se.scaleX()-1)<1e-7?1:se.scaleX(),Ce=Math.abs(se.scaleY()-1)<1e-7?1:se.scaleY();se.scaleX(1),se.scaleY(1);const oe=(de=Se.target.getStage())===null||de===void 0?void 0:de.findOne("Transformer"),ke=1-M/k.width,Oe=Math.min(ke,Math.max(0,t.cropX)),Be=1-R/k.height,dt=Math.min(Be,Math.max(0,t.cropY)),nt=oe.getActiveAnchor(),xe=!(nt.indexOf("middle")>=0||nt.indexOf("center")>=0),me=!xe&&he<1&&Ie.current.cropHeight>R/k.height;let je=xe?t.cropWidth:t.cropWidth*he;me&&(je=t.cropWidth);const ve=!xe&&Ce<1&&Ie.current.cropWidth>M/k.width;let qe=xe?t.cropHeight:t.cropHeight*Ce;ve&&(qe=t.cropHeight),B&&(je=t.cropWidth,qe=t.cropHeight),t.set({cropX:Oe,cropY:dt,x:se.x(),y:se.y(),width:se.width()*he,height:se.height()*Ce,rotation:Se.target.rotation(),cropWidth:Math.min(je,1-Oe),cropHeight:Math.min(qe,1-dt)})},onTransformEnd:Se=>{const de=Se.currentTarget;t.set({width:de.width(),height:de.height(),x:de.x(),y:de.y(),rotation:Se.target.rotation(),cropWidth:M/k.width,cropHeight:R/k.height}),i(!1)}}),X.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},rt,{strokeWidth:t.borderSize,listening:!1,visible:!!t.borderSize,rotation:t.rotation,cornerRadius:Math.max(0,$-t.borderSize),hideInExport:!t.showInExport})),t._cropModeEnabled&&X.createElement(N2,{selector:".page-abs-container",enabled:!0},X.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)"}),X.createElement(Vo,{listening:!1,image:J,x:t.x,y:t.y,width:t.a.width,height:t.a.height,rotation:t.rotation,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur}),X.createElement(Zt,{x:t.x,y:t.y,rotation:t.rotation,scaleX:q,scaleY:q},X.createElement(Vo,{image:k,ref:o,opacity:.4,draggable:!0,x:-t.cropX*k.width,y:-t.cropY*k.height,onDragMove:re,onTransform:re,onTouchMove:Se=>{Se.evt.preventDefault();const de=Se.target.getStage().getPointersPositions();var se=de[0],he=de[1];const Ce=Se.target;if(se&&!he&&!Ce.isDragging()&&ee.current&&(Ce.startDrag(),ee.current=!1),se&&he){Et.hitOnDragEnabled=!0,Ce.isDragging()&&(ee.current=!0,Ce.stopDrag());const ve=Se.target.getAbsoluteTransform().copy();ve.invert();var oe={x:se.x,y:se.y},ke={x:he.x,y:he.y};if(!W.current)return void(W.current=F3(oe,ke));var Oe=F3(oe,ke),Be=(function(At,be){return Math.sqrt(Math.pow(be.x-At.x,2)+Math.pow(be.y-At.y,2))})(oe,ke);V.current||(V.current=Be);const qe=Ce.position();var dt={x:Oe.x-qe.x,y:Oe.y-qe.y},nt=Be/V.current;Ce.scaleX(nt),Ce.scaleY(nt);const ht=ve.point(Oe),gt=ve.point(W.current);var xe=ht.x-gt.x,me=ht.y-gt.y,je={x:Math.min(0,Oe.x-dt.x*nt+xe),y:Math.min(0,Oe.y-dt.y*nt+me)};Ce.position(je),V.current=Be,W.current=Oe,re(Se)}},onTouchEnd:Se=>{V.current=0,W.current=null,Et.hitOnDragEnabled=!1}}),X.createElement(wp,Object.assign({ref:L},bA)),X.createElement(ur,{width:M,height:R,ref:Q,listening:!1,onTransform:Se=>{if(t.cropX<Math.abs(Se.target.x()/k.width)&&Se.target.x()<0&&t.cropX>0){const Be=(t.cropWidth+t.cropX)*k.width;Se.target.scaleX(1),Se.target.width(Be)}if(t.cropY<Math.abs(Se.target.y()/k.height)&&Se.target.y()<0&&t.cropY>0){const Be=(t.cropHeight+t.cropY)*k.height;Se.target.scaleY(1),Se.target.height(Be)}Se.target.x()<-t.cropX*k.width-1e-9&&(Se.target.x(-t.cropX*k.width),Se.target.scaleX(1)),Se.target.y()<-t.cropY*k.height-1e-9&&(Se.target.y(-t.cropY*k.height),Se.target.scaleY(1));const de=Math.min(1,Math.max(0,t.cropX+Se.target.x()/k.width)),se=Math.min(1,Math.max(0,Se.target.y()/k.height+t.cropY)),he=Se.target.width()*Se.target.scaleX(),Ce=Se.target.height()*Se.target.scaleY(),oe=Math.min(1-de,he/k.width),ke=Math.min(1-se,Ce/k.height),Oe=Se.target.getAbsolutePosition(Se.target.getParent().getParent());Se.target.scale({x:1,y:1}),Se.target.position({x:0,y:0}),t.set({x:Oe.x,y:Oe.y,cropX:de,cropY:se,cropWidth:oe,cropHeight:ke,width:Math.min(he*q,k.width*(1-de)*q),height:Math.min(Ce*q,k.height*(1-se)*q)})}}),X.createElement(wp,Object.assign({ref:U},vA,{visible:t.resizable})))))});var kg={exports:{}};var _A=kg.exports,j3;function PA(){return j3||(j3=1,(function(t,e){(function(n,i){t.exports=i()})(typeof self<"u"?self:_A,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),d=i(46),f=i(47),p=i(48),h=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:p.default,Scroll:u.default,Block:f.default,Inline:d.default,Text:h.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={},d={},f={};n.DATA_KEY="__blot";var p;(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"})(p=n.Scope||(n.Scope={}));function h(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=h;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=p.ANY);var S;if(typeof x=="string")S=f[x]||s[x];else if(x instanceof Text||x.nodeType===Node.TEXT_NODE)S=f.text;else if(typeof x=="number")x&p.LEVEL&p.BLOCK?S=f.block:x&p.LEVEL&p.INLINE&&(S=f.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||d[x.tagName]}return S==null?null:k&p.LEVEL&S.scope&&k&p.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(f[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(_){(d[_]==null||S.className==null)&&(d[_]=S)})}return S}n.register=b}),(function(r,n,i){var a=i(51),o=i(11),s=i(3),u=i(20),d="\0",f=function(p){Array.isArray(p)?this.ops=p:p!=null&&Array.isArray(p.ops)?this.ops=p.ops:this.ops=[]};f.prototype.insert=function(p,h){var y={};return p.length===0?this:(y.insert=p,h!=null&&typeof h=="object"&&Object.keys(h).length>0&&(y.attributes=h),this.push(y))},f.prototype.delete=function(p){return p<=0?this:this.push({delete:p})},f.prototype.retain=function(p,h){if(p<=0)return this;var y={retain:p};return h!=null&&typeof h=="object"&&Object.keys(h).length>0&&(y.attributes=h),this.push(y)},f.prototype.push=function(p){var h=this.ops.length,y=this.ops[h-1];if(p=s(!0,{},p),typeof y=="object"){if(typeof p.delete=="number"&&typeof y.delete=="number")return this.ops[h-1]={delete:y.delete+p.delete},this;if(typeof y.delete=="number"&&p.insert!=null&&(h-=1,y=this.ops[h-1],typeof y!="object"))return this.ops.unshift(p),this;if(o(p.attributes,y.attributes)){if(typeof p.insert=="string"&&typeof y.insert=="string")return this.ops[h-1]={insert:y.insert+p.insert},typeof p.attributes=="object"&&(this.ops[h-1].attributes=p.attributes),this;if(typeof p.retain=="number"&&typeof y.retain=="number")return this.ops[h-1]={retain:y.retain+p.retain},typeof p.attributes=="object"&&(this.ops[h-1].attributes=p.attributes),this}}return h===this.ops.length?this.ops.push(p):this.ops.splice(h,0,p),this},f.prototype.chop=function(){var p=this.ops[this.ops.length-1];return p&&p.retain&&!p.attributes&&this.ops.pop(),this},f.prototype.filter=function(p){return this.ops.filter(p)},f.prototype.forEach=function(p){this.ops.forEach(p)},f.prototype.map=function(p){return this.ops.map(p)},f.prototype.partition=function(p){var h=[],y=[];return this.forEach(function(v){var b=p(v)?h:y;b.push(v)}),[h,y]},f.prototype.reduce=function(p,h){return this.ops.reduce(p,h)},f.prototype.changeLength=function(){return this.reduce(function(p,h){return h.insert?p+u.length(h):h.delete?p-h.delete:p},0)},f.prototype.length=function(){return this.reduce(function(p,h){return p+u.length(h)},0)},f.prototype.slice=function(p,h){p=p||0,typeof h!="number"&&(h=1/0);for(var y=[],v=u.iterator(this.ops),b=0;b<h&&v.hasNext();){var x;b<p?x=v.next(p-b):(x=v.next(h-b),y.push(x)),b+=u.length(x)}return new f(y)},f.prototype.compose=function(p){var h=u.iterator(this.ops),y=u.iterator(p.ops),v=[],b=y.peek();if(b!=null&&typeof b.retain=="number"&&b.attributes==null){for(var x=b.retain;h.peekType()==="insert"&&h.peekLength()<=x;)x-=h.peekLength(),v.push(h.next());b.retain-x>0&&y.next(b.retain-x)}for(var k=new f(v);h.hasNext()||y.hasNext();)if(y.peekType()==="insert")k.push(y.next());else if(h.peekType()==="delete")k.push(h.next());else{var S=Math.min(h.peekLength(),y.peekLength()),P=h.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 f(h.rest());return k.concat(T).chop()}}else typeof _.delete=="number"&&typeof P.retain=="number"&&k.push(_)}return k.chop()},f.prototype.concat=function(p){var h=new f(this.ops.slice());return p.ops.length>0&&(h.push(p.ops[0]),h.ops=h.ops.concat(p.ops.slice(1))),h},f.prototype.diff=function(p,h){if(this.ops===p.ops)return new f;var y=[this,p].map(function(S){return S.map(function(P){if(P.insert!=null)return typeof P.insert=="string"?P.insert:d;var _=S===p?"on":"with";throw new Error("diff() called "+_+" non-document")}).join("")}),v=new f,b=a(y[0],y[1],h),x=u.iterator(this.ops),k=u.iterator(p.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()},f.prototype.eachLine=function(p,h){h=h||`
|
|
106
|
+
`;for(var y=u.iterator(this.ops),v=new f,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(h,k)-k:-1;if(S<0)v.push(y.next());else if(S>0)v.push(y.next(S));else{if(p(v,y.next(1).attributes||{},b)===!1)return;b+=1,v=new f}}v.length()>0&&p(v,{},b)},f.prototype.transform=function(p,h){if(h=!!h,typeof p=="number")return this.transformPosition(p,h);for(var y=u.iterator(this.ops),v=u.iterator(p.ops),b=new f;y.hasNext()||v.hasNext();)if(y.peekType()==="insert"&&(h||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,h))}return b.chop()},f.prototype.transformPosition=function(p,h){h=!!h;for(var y=u.iterator(this.ops),v=0;y.hasNext()&&v<=p;){var b=y.peekLength(),x=y.peekType();if(y.next(),x==="delete"){p-=Math.min(b,p-v);continue}else x==="insert"&&(v<p||!h)&&(p+=b);v+=b}return p},r.exports=f}),(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]"},d=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)},f=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},p=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 h(){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=p(P,v),x=p(y,v),P!==x&&(A&&x&&(d(x)||(k=u(x)))?(k?(k=!1,S=b&&u(b)?b:[]):S=b&&d(b)?b:{},f(P,{name:v,newValue:h(A,S,x)})):typeof x<"u"&&f(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(B,H){for(var $=0;$<H.length;$++){var G=H[$];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(B,G.key,G)}}return function(B,H,$){return H&&N(B.prototype,H),$&&N(B,$),B}})(),o=function N(B,H,$){B===null&&(B=Function.prototype);var G=Object.getOwnPropertyDescriptor(B,H);if(G===void 0){var Z=Object.getPrototypeOf(B);return Z===null?void 0:N(Z,H,$)}else{if("value"in G)return G.value;var J=G.get;return J===void 0?void 0:J.call($)}},s=i(3),u=P(s),d=i(2),f=P(d),p=i(0),h=P(p),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,B){if(!(N instanceof B))throw new TypeError("Cannot call a class as a function")}function E(N,B){if(!N)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B&&(typeof B=="object"||typeof B=="function")?B:N}function A(N,B){if(typeof B!="function"&&B!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof B);N.prototype=Object.create(B&&B.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),B&&(Object.setPrototypeOf?Object.setPrototypeOf(N,B):N.__proto__=B)}var T=1,I=(function(N){A(B,N);function B(){return _(this,B),E(this,(B.__proto__||Object.getPrototypeOf(B)).apply(this,arguments))}return a(B,[{key:"attach",value:function(){o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"attach",this).call(this),this.attributes=new h.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return new f.default().insert(this.value(),(0,u.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function($,G){var Z=h.default.query($,h.default.Scope.BLOCK_ATTRIBUTE);Z!=null&&this.attributes.attribute(Z,G)}},{key:"formatAt",value:function($,G,Z,J){this.format(Z,J)}},{key:"insertAt",value:function($,G,Z){if(typeof G=="string"&&G.endsWith(`
|
|
107
|
+
`)){var J=h.default.create(M.blotName);this.parent.insertBefore(J,$===0?this:this.next),J.insertAt(0,G.slice(0,-1))}else o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"insertAt",this).call(this,$,G,Z)}}]),B})(h.default.Embed);I.scope=h.default.Scope.BLOCK_BLOT;var M=(function(N){A(B,N);function B(H){_(this,B);var $=E(this,(B.__proto__||Object.getPrototypeOf(B)).call(this,H));return $.cache={},$}return a(B,[{key:"delta",value:function(){return this.cache.delta==null&&(this.cache.delta=this.descendants(h.default.Leaf).reduce(function($,G){return G.length()===0?$:$.insert(G.value(),R(G))},new f.default).insert(`
|
|
108
|
+
`,R(this))),this.cache.delta}},{key:"deleteAt",value:function($,G){o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"deleteAt",this).call(this,$,G),this.cache={}}},{key:"formatAt",value:function($,G,Z,J){G<=0||(h.default.query(Z,h.default.Scope.BLOCK)?$+G===this.length()&&this.format(Z,J):o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"formatAt",this).call(this,$,Math.min(G,this.length()-$-1),Z,J),this.cache={})}},{key:"insertAt",value:function($,G,Z){if(Z!=null)return o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"insertAt",this).call(this,$,G,Z);if(G.length!==0){var J=G.split(`
|
|
109
|
+
`),q=J.shift();q.length>0&&($<this.length()-1||this.children.tail==null?o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"insertAt",this).call(this,Math.min($,this.length()-1),q):this.children.tail.insertAt(this.children.tail.length(),q),this.cache={});var Q=this;J.reduce(function(U,L){return Q=Q.split(U,!0),Q.insertAt(0,L),L.length},$+q.length)}}},{key:"insertBefore",value:function($,G){var Z=this.children.head;o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"insertBefore",this).call(this,$,G),Z instanceof v.default&&Z.remove(),this.cache={}}},{key:"length",value:function(){return this.cache.length==null&&(this.cache.length=o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"length",this).call(this)+T),this.cache.length}},{key:"moveChildren",value:function($,G){o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"moveChildren",this).call(this,$,G),this.cache={}}},{key:"optimize",value:function($){o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"optimize",this).call(this,$),this.cache={}}},{key:"path",value:function($){return o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"path",this).call(this,$,!0)}},{key:"removeChild",value:function($){o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"removeChild",this).call(this,$),this.cache={}}},{key:"split",value:function($){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(G&&($===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 J=o(B.prototype.__proto__||Object.getPrototypeOf(B.prototype),"split",this).call(this,$,G);return this.cache={},J}}}]),B})(h.default.Block);M.blotName="block",M.tagName="P",M.defaultChild="break",M.allowedChildren=[x.default,h.default.Embed,S.default];function R(N){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return N==null||(typeof N.formats=="function"&&(B=(0,u.default)(B,N.formats())),N.parent==null||N.parent.blotName=="scroll"||N.parent.statics.scope!==N.statics.scope)?B:R(N.parent,B)}n.bubbleFormats=R,n.BlockEmbed=I,n.default=M}),(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(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},o=(function(){function Q(U,L){var W=[],V=!0,ee=!1,re=void 0;try{for(var K=U[Symbol.iterator](),ne;!(V=(ne=K.next()).done)&&(W.push(ne.value),!(L&&W.length===L));V=!0);}catch(le){ee=!0,re=le}finally{try{!V&&K.return&&K.return()}finally{if(ee)throw re}}return W}return function(U,L){if(Array.isArray(U))return U;if(Symbol.iterator in Object(U))return Q(U,L);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function Q(U,L){for(var W=0;W<L.length;W++){var V=L[W];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(U,V.key,V)}}return function(U,L,W){return L&&Q(U.prototype,L),W&&Q(U,W),U}})();i(50);var u=i(2),d=R(u),f=i(14),p=R(f),h=i(8),y=R(h),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),M=R(I);function R(Q){return Q&&Q.__esModule?Q:{default:Q}}function N(Q,U,L){return U in Q?Object.defineProperty(Q,U,{value:L,enumerable:!0,configurable:!0,writable:!0}):Q[U]=L,Q}function B(Q,U){if(!(Q instanceof U))throw new TypeError("Cannot call a class as a function")}var H=(0,T.default)("quill"),$=(function(){s(Q,null,[{key:"debug",value:function(L){L===!0&&(L="log"),T.default.level(L)}},{key:"find",value:function(L){return L.__quill||k.default.find(L)}},{key:"import",value:function(L){return this.imports[L]==null&&H.error("Cannot import "+L+". Are you sure it was registered?"),this.imports[L]}},{key:"register",value:function(L,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof L!="string"){var re=L.attrName||L.blotName;typeof re=="string"?this.register("formats/"+re,L,W):Object.keys(L).forEach(function(K){V.register(K,L[K],W)})}else this.imports[L]!=null&&!ee&&H.warn("Overwriting "+L+" with",W),this.imports[L]=W,(L.startsWith("blots/")||L.startsWith("formats/"))&&W.blotName!=="abstract"?k.default.register(W):L.startsWith("modules")&&typeof W.register=="function"&&W.register()}}]);function Q(U){var L=this,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(B(this,Q),this.options=G(U,W),this.container=this.options.container,this.container==null)return H.error("Invalid Quill container",U);this.options.debug&&Q.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 p.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(re){re===y.default.events.TEXT_CHANGE&&L.root.classList.toggle("ql-blank",L.editor.isBlank())}),this.emitter.on(y.default.events.SCROLL_UPDATE,function(re,K){var ne=L.selection.lastRange,le=ne&&ne.length===0?ne.index:void 0;Z.call(L,function(){return L.editor.update(null,K,le)},re)});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(Q,[{key:"addContainer",value:function(L){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof L=="string"){var V=L;L=document.createElement("div"),L.classList.add(V)}return this.container.insertBefore(L,W),L}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(L,W,V){var ee=this,re=J(L,W,V),K=o(re,4);return L=K[0],W=K[1],V=K[3],Z.call(this,function(){return ee.editor.deleteText(L,W)},V,L,-1*W)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(L),this.container.classList.toggle("ql-disabled",!L)}},{key:"focus",value:function(){var L=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=L,this.scrollIntoView()}},{key:"format",value:function(L,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.default.sources.API;return Z.call(this,function(){var re=V.getSelection(!0),K=new d.default;if(re==null)return K;if(k.default.query(L,k.default.Scope.BLOCK))K=V.editor.formatLine(re.index,re.length,N({},L,W));else{if(re.length===0)return V.selection.format(L,W),K;K=V.editor.formatText(re.index,re.length,N({},L,W))}return V.setSelection(re,y.default.sources.SILENT),K},ee)}},{key:"formatLine",value:function(L,W,V,ee,re){var K=this,ne=void 0,le=J(L,W,V,ee,re),ae=o(le,4);return L=ae[0],W=ae[1],ne=ae[2],re=ae[3],Z.call(this,function(){return K.editor.formatLine(L,W,ne)},re,L,0)}},{key:"formatText",value:function(L,W,V,ee,re){var K=this,ne=void 0,le=J(L,W,V,ee,re),ae=o(le,4);return L=ae[0],W=ae[1],ne=ae[2],re=ae[3],Z.call(this,function(){return K.editor.formatText(L,W,ne)},re,L,0)}},{key:"getBounds",value:function(L){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=void 0;typeof L=="number"?V=this.selection.getBounds(L,W):V=this.selection.getBounds(L.index,L.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 L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-L,V=J(L,W),ee=o(V,2);return L=ee[0],W=ee[1],this.editor.getContents(L,W)}},{key:"getFormat",value:function(){var L=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 L=="number"?this.editor.getFormat(L,W):this.editor.getFormat(L.index,L.length)}},{key:"getIndex",value:function(L){return L.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(L){return this.scroll.leaf(L)}},{key:"getLine",value:function(L){return this.scroll.line(L)}},{key:"getLines",value:function(){var L=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 L!="number"?this.scroll.lines(L.index,L.length):this.scroll.lines(L,W)}},{key:"getModule",value:function(L){return this.theme.modules[L]}},{key:"getSelection",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return L&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-L,V=J(L,W),ee=o(V,2);return L=ee[0],W=ee[1],this.editor.getText(L,W)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(L,W,V){var ee=this,re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Q.sources.API;return Z.call(this,function(){return ee.editor.insertEmbed(L,W,V)},re,L)}},{key:"insertText",value:function(L,W,V,ee,re){var K=this,ne=void 0,le=J(L,0,V,ee,re),ae=o(le,4);return L=ae[0],ne=ae[2],re=ae[3],Z.call(this,function(){return K.editor.insertText(L,W,ne)},re,L,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(L,W,V){this.clipboard.dangerouslyPasteHTML(L,W,V)}},{key:"removeFormat",value:function(L,W,V){var ee=this,re=J(L,W,V),K=o(re,4);return L=K[0],W=K[1],V=K[3],Z.call(this,function(){return ee.editor.removeFormat(L,W)},V,L)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(L){var W=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API;return Z.call(this,function(){L=new d.default(L);var ee=W.getLength(),re=W.editor.deleteText(0,ee),K=W.editor.applyDelta(L),ne=K.ops[K.ops.length-1];ne!=null&&typeof ne.insert=="string"&&ne.insert[ne.insert.length-1]===`
|
|
110
|
+
`&&(W.editor.deleteText(W.getLength()-1,1),K.delete(1));var le=re.compose(K);return le},V)}},{key:"setSelection",value:function(L,W,V){if(L==null)this.selection.setRange(null,W||Q.sources.API);else{var ee=J(L,W,V),re=o(ee,4);L=re[0],W=re[1],V=re[3],this.selection.setRange(new S.Range(L,W),V),V!==y.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(L){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API,V=new d.default().insert(L);return this.setContents(V,W)}},{key:"update",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y.default.sources.USER,W=this.scroll.update(L);return this.selection.update(L),W}},{key:"updateContents",value:function(L){var W=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y.default.sources.API;return Z.call(this,function(){return L=new d.default(L),W.editor.applyDelta(L,V)},V,!0)}}]),Q})();$.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:d.default,parchment:k.default,"core/module":b.default,"core/theme":M.default};function G(Q,U){if(U=(0,E.default)(!0,{container:Q,modules:{clipboard:!0,keyboard:!0,history:!0}},U),!U.theme||U.theme===$.DEFAULTS.theme)U.theme=M.default;else if(U.theme=$.import("themes/"+U.theme),U.theme==null)throw new Error("Invalid theme "+U.theme+". Did you register it?");var L=(0,E.default)(!0,{},U.theme.DEFAULTS);[L,U].forEach(function(ee){ee.modules=ee.modules||{},Object.keys(ee.modules).forEach(function(re){ee.modules[re]===!0&&(ee.modules[re]={})})});var W=Object.keys(L.modules).concat(Object.keys(U.modules)),V=W.reduce(function(ee,re){var K=$.import("modules/"+re);return K==null?H.error("Cannot load "+re+" module. Are you sure you registered it?"):ee[re]=K.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},L,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,re){return U.modules[re]&&(ee[re]=U.modules[re]),ee},{}),U}function Z(Q,U,L,W){if(this.options.strict&&!this.isEnabled()&&U===y.default.sources.USER)return new d.default;var V=L==null?null:this.getSelection(),ee=this.editor.delta,re=Q();if(V!=null&&(L===!0&&(L=V.index),W==null?V=q(V,re,U):W!==0&&(V=q(V,L,W,U)),this.setSelection(V,y.default.sources.SILENT)),re.length()>0){var K,ne=[y.default.events.TEXT_CHANGE,re,ee,U];if((K=this.emitter).emit.apply(K,[y.default.events.EDITOR_CHANGE].concat(ne)),U!==y.default.sources.SILENT){var le;(le=this.emitter).emit.apply(le,ne)}}return re}function J(Q,U,L,W,V){var ee={};return typeof Q.index=="number"&&typeof Q.length=="number"?typeof U!="number"?(V=W,W=L,L=U,U=Q.length,Q=Q.index):(U=Q.length,Q=Q.index):typeof U!="number"&&(V=W,W=L,L=U,U=0),(typeof L>"u"?"undefined":a(L))==="object"?(ee=L,V=W):typeof L=="string"&&(W!=null?ee[L]=W:V=L),V=V||y.default.sources.API,[Q,U,ee,V]}function q(Q,U,L,W){if(Q==null)return null;var V=void 0,ee=void 0;if(U instanceof d.default){var re=[Q.index,Q.index+Q.length].map(function(ae){return U.transformPosition(ae,W!==y.default.sources.USER)}),K=o(re,2);V=K[0],ee=K[1]}else{var ne=[Q.index,Q.index+Q.length].map(function(ae){return ae<U||ae===U&&W===y.default.sources.USER?ae:L>=0?ae+L:Math.max(U,ae+L)}),le=o(ne,2);V=le[0],ee=le[1]}return new S.Range(V,ee-V)}n.expandConfig=G,n.overload=J,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=p(s),d=i(0),f=p(d);function p(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 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 h(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&&f.default.query(E,f.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})(f.default.Inline);b.allowedChildren=[b,f.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(h){return h&&h.__esModule?h:{default:h}}function u(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function d(h,y){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:h}function f(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(h,y):h.__proto__=y)}var p=(function(h){f(y,h);function y(){return u(this,y),d(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default.Text);n.default=p}),(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=p(s),d=i(10),f=p(d);function p(S){return S&&S.__esModule?S:{default:S}}function h(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,f.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(){h(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(M){var R=M.node,N=M.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 d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};a(this,s),this.quill=u,this.options=d};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(d){if(a.indexOf(d)<=a.indexOf(o)){for(var f,p=arguments.length,h=Array(p>1?p-1:0),y=1;y<p;y++)h[y-1]=arguments[y];(f=console)[d].apply(f,h)}}function u(d){return a.reduce(function(f,p){return f[p]=s.bind(console,p,d),f},{})}s.level=u.level=function(d){o=d},n.default=u}),(function(r,n,i){var a=Array.prototype.slice,o=i(52),s=i(53),u=r.exports=function(h,y,v){return v||(v={}),h===y?!0:h instanceof Date&&y instanceof Date?h.getTime()===y.getTime():!h||!y||typeof h!="object"&&typeof y!="object"?v.strict?h===y:h==y:p(h,y,v)};function d(h){return h==null}function f(h){return!(!h||typeof h!="object"||typeof h.length!="number"||typeof h.copy!="function"||typeof h.slice!="function"||h.length>0&&typeof h[0]!="number")}function p(h,y,v){var b,x;if(d(h)||d(y)||h.prototype!==y.prototype)return!1;if(s(h))return s(y)?(h=a.call(h),y=a.call(y),u(h,y,v)):!1;if(f(h)){if(!f(y)||h.length!==y.length)return!1;for(b=0;b<h.length;b++)if(h[b]!==y[b])return!1;return!0}try{var k=o(h),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(h[x],y[x],v))return!1;return typeof h==typeof y}}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(1),o=(function(){function s(u,d,f){f===void 0&&(f={}),this.attrName=u,this.keyName=d;var p=a.Scope.TYPE&a.Scope.ATTRIBUTE;f.scope!=null?this.scope=f.scope&a.Scope.LEVEL|p:this.scope=a.Scope.ATTRIBUTE,f.whitelist!=null&&(this.whitelist=f.whitelist)}return s.keys=function(u){return[].map.call(u.attributes,function(d){return d.name})},s.prototype.add=function(u,d){return this.canAdd(u,d)?(u.setAttribute(this.keyName,d),!0):!1},s.prototype.canAdd=function(u,d){var f=a.query(u,a.Scope.BLOT&(this.scope|a.Scope.TYPE));return f==null?!1:this.whitelist==null?!0:typeof d=="string"?this.whitelist.indexOf(d.replace(/["']/g,""))>-1:this.whitelist.indexOf(d)>-1},s.prototype.remove=function(u){u.removeAttribute(this.keyName)},s.prototype.value=function(u){var d=u.getAttribute(this.keyName);return this.canAdd(u,d)&&d?d:""},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(M,R){var N=[],B=!0,H=!1,$=void 0;try{for(var G=M[Symbol.iterator](),Z;!(B=(Z=G.next()).done)&&(N.push(Z.value),!(R&&N.length===R));B=!0);}catch(J){H=!0,$=J}finally{try{!B&&G.return&&G.return()}finally{if(H)throw $}}return N}return function(M,R){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return I(M,R);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function I(M,R){for(var N=0;N<R.length;N++){var B=R[N];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(M,B.key,B)}}return function(M,R,N){return R&&I(M.prototype,R),N&&I(M,N),M}})(),s=function I(M,R,N){M===null&&(M=Function.prototype);var B=Object.getOwnPropertyDescriptor(M,R);if(B===void 0){var H=Object.getPrototypeOf(M);return H===null?void 0:I(H,R,N)}else{if("value"in B)return B.value;var $=B.get;return $===void 0?void 0:$.call(N)}},u=i(2),d=S(u),f=i(0),p=S(f),h=i(4),y=S(h),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,M){if(!(I instanceof M))throw new TypeError("Cannot call a class as a function")}function _(I,M){if(!I)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:I}function E(I,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);I.prototype=Object.create(M&&M.prototype,{constructor:{value:I,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(I,M):I.__proto__=M)}var A=(function(I){E(M,I);function M(){return P(this,M),_(this,(M.__proto__||Object.getPrototypeOf(M)).apply(this,arguments))}return M})(b.default);A.blotName="code",A.tagName="CODE";var T=(function(I){E(M,I);function M(){return P(this,M),_(this,(M.__proto__||Object.getPrototypeOf(M)).apply(this,arguments))}return o(M,[{key:"delta",value:function(){var N=this,B=this.domNode.textContent;return B.endsWith(`
|
|
111
|
+
`)&&(B=B.slice(0,-1)),B.split(`
|
|
112
|
+
`).reduce(function(H,$){return H.insert($).insert(`
|
|
113
|
+
`,N.formats())},new d.default)}},{key:"format",value:function(N,B){if(!(N===this.statics.blotName&&B)){var H=this.descendant(k.default,this.length()-1),$=a(H,1),G=$[0];G?.deleteAt(G.length()-1,1),s(M.prototype.__proto__||Object.getPrototypeOf(M.prototype),"format",this).call(this,N,B)}}},{key:"formatAt",value:function(N,B,H,$){if(B!==0&&!(p.default.query(H,p.default.Scope.BLOCK)==null||H===this.statics.blotName&&$===this.statics.formats(this.domNode))){var G=this.newlineIndex(N);if(!(G<0||G>=N+B)){var Z=this.newlineIndex(N,!0)+1,J=G-Z+1,q=this.isolate(Z,J),Q=q.next;q.format(H,$),Q instanceof M&&Q.formatAt(0,N-Z+B-J,H,$)}}}},{key:"insertAt",value:function(N,B,H){if(H==null){var $=this.descendant(k.default,N),G=a($,2),Z=G[0],J=G[1];Z.insertAt(J,B)}}},{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 B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(B)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(p.default.create("text",`
|
|
118
|
+
`)),s(M.prototype.__proto__||Object.getPrototypeOf(M.prototype),"optimize",this).call(this,N);var B=this.next;B!=null&&B.prev===this&&B.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===B.statics.formats(B.domNode)&&(B.optimize(N),B.moveChildren(this),B.remove())}},{key:"replace",value:function(N){s(M.prototype.__proto__||Object.getPrototypeOf(M.prototype),"replace",this).call(this,N),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(B){var H=p.default.find(B);H==null?B.parentNode.removeChild(B):H instanceof p.default.Embed?H.remove():H.unwrap()})}}],[{key:"create",value:function(N){var B=s(M.__proto__||Object.getPrototypeOf(M),"create",this).call(this,N);return B.setAttribute("spellcheck",!1),B}},{key:"formats",value:function(){return!0}}]),M})(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(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},o=(function(){function Q(U,L){var W=[],V=!0,ee=!1,re=void 0;try{for(var K=U[Symbol.iterator](),ne;!(V=(ne=K.next()).done)&&(W.push(ne.value),!(L&&W.length===L));V=!0);}catch(le){ee=!0,re=le}finally{try{!V&&K.return&&K.return()}finally{if(ee)throw re}}return W}return function(U,L){if(Array.isArray(U))return U;if(Symbol.iterator in Object(U))return Q(U,L);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function Q(U,L){for(var W=0;W<L.length;W++){var V=L[W];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(U,V.key,V)}}return function(U,L,W){return L&&Q(U.prototype,L),W&&Q(U,W),U}})(),u=i(2),d=B(u),f=i(20),p=B(f),h=i(0),y=B(h),v=i(13),b=B(v),x=i(24),k=B(x),S=i(4),P=B(S),_=i(16),E=B(_),A=i(21),T=B(A),I=i(11),M=B(I),R=i(3),N=B(R);function B(Q){return Q&&Q.__esModule?Q:{default:Q}}function H(Q,U,L){return U in Q?Object.defineProperty(Q,U,{value:L,enumerable:!0,configurable:!0,writable:!0}):Q[U]=L,Q}function $(Q,U){if(!(Q instanceof U))throw new TypeError("Cannot call a class as a function")}var G=/^[ -~]*$/,Z=(function(){function Q(U){$(this,Q),this.scroll=U,this.delta=this.getDelta()}return s(Q,[{key:"applyDelta",value:function(L){var W=this,V=!1;this.scroll.update();var ee=this.scroll.length();return this.scroll.batchStart(),L=q(L),L.reduce(function(re,K){var ne=K.retain||K.delete||K.insert.length||1,le=K.attributes||{};if(K.insert!=null){if(typeof K.insert=="string"){var ae=K.insert;ae.endsWith(`
|
|
119
|
+
`)&&V&&(V=!1,ae=ae.slice(0,-1)),re>=ee&&!ae.endsWith(`
|
|
120
|
+
`)&&(V=!0),W.scroll.insertAt(re,ae);var ue=W.scroll.line(re),ye=o(ue,2),Ie=ye[0],Le=ye[1],Ue=(0,N.default)({},(0,S.bubbleFormats)(Ie));if(Ie instanceof P.default){var $e=Ie.descendant(y.default.Leaf,Le),rt=o($e,1),Se=rt[0];Ue=(0,N.default)(Ue,(0,S.bubbleFormats)(Se))}le=p.default.attributes.diff(Ue,le)||{}}else if(a(K.insert)==="object"){var de=Object.keys(K.insert)[0];if(de==null)return re;W.scroll.insertAt(re,de,K.insert[de])}ee+=ne}return Object.keys(le).forEach(function(se){W.scroll.formatAt(re,ne,se,le[se])}),re+ne},0),L.reduce(function(re,K){return typeof K.delete=="number"?(W.scroll.deleteAt(re,K.delete),re):re+(K.retain||K.insert.length||1)},0),this.scroll.batchEnd(),this.update(L)}},{key:"deleteText",value:function(L,W){return this.scroll.deleteAt(L,W),this.update(new d.default().retain(L).delete(W))}},{key:"formatLine",value:function(L,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(ee).forEach(function(re){if(!(V.scroll.whitelist!=null&&!V.scroll.whitelist[re])){var K=V.scroll.lines(L,Math.max(W,1)),ne=W;K.forEach(function(le){var ae=le.length();if(!(le instanceof b.default))le.format(re,ee[re]);else{var ue=L-le.offset(V.scroll),ye=le.newlineIndex(ue+ne)-ue+1;le.formatAt(ue,ye,re,ee[re])}ne-=ae})}}),this.scroll.optimize(),this.update(new d.default().retain(L).retain(W,(0,T.default)(ee)))}},{key:"formatText",value:function(L,W){var V=this,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(ee).forEach(function(re){V.scroll.formatAt(L,W,re,ee[re])}),this.update(new d.default().retain(L).retain(W,(0,T.default)(ee)))}},{key:"getContents",value:function(L,W){return this.delta.slice(L,L+W)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(L,W){return L.concat(W.delta())},new d.default)}},{key:"getFormat",value:function(L){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=[],ee=[];W===0?this.scroll.path(L).forEach(function(K){var ne=o(K,1),le=ne[0];le instanceof P.default?V.push(le):le instanceof y.default.Leaf&&ee.push(le)}):(V=this.scroll.lines(L,W),ee=this.scroll.descendants(y.default.Leaf,L,W));var re=[V,ee].map(function(K){if(K.length===0)return{};for(var ne=(0,S.bubbleFormats)(K.shift());Object.keys(ne).length>0;){var le=K.shift();if(le==null)return ne;ne=J((0,S.bubbleFormats)(le),ne)}return ne});return N.default.apply(N.default,re)}},{key:"getText",value:function(L,W){return this.getContents(L,W).filter(function(V){return typeof V.insert=="string"}).map(function(V){return V.insert}).join("")}},{key:"insertEmbed",value:function(L,W,V){return this.scroll.insertAt(L,W,V),this.update(new d.default().retain(L).insert(H({},W,V)))}},{key:"insertText",value:function(L,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(L,W),Object.keys(ee).forEach(function(re){V.scroll.formatAt(L,W.length,re,ee[re])}),this.update(new d.default().retain(L).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 L=this.scroll.children.head;return L.statics.blotName!==P.default.blotName||L.children.length>1?!1:L.children.head instanceof E.default}},{key:"removeFormat",value:function(L,W){var V=this.getText(L,W),ee=this.scroll.line(L+W),re=o(ee,2),K=re[0],ne=re[1],le=0,ae=new d.default;K!=null&&(K instanceof b.default?le=K.newlineIndex(ne)-ne+1:le=K.length()-ne,ae=K.delta().slice(ne,ne+le-1).insert(`
|
|
123
|
+
`));var ue=this.getContents(L,W+le),ye=ue.diff(new d.default().insert(V).concat(ae)),Ie=new d.default().retain(L).concat(ye);return this.applyDelta(Ie)}},{key:"update",value:function(L){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(G)&&y.default.find(W[0].target)){var re=y.default.find(W[0].target),K=(0,S.bubbleFormats)(re),ne=re.offset(this.scroll),le=W[0].oldValue.replace(k.default.CONTENTS,""),ae=new d.default().insert(le),ue=new d.default().insert(re.value()),ye=new d.default().retain(ne).concat(ae.diff(ue,V));L=ye.reduce(function(Ie,Le){return Le.insert?Ie.insert(Le.insert,K):Ie.push(Le)},new d.default),this.delta=ee.compose(L)}else this.delta=this.getDelta(),(!L||!(0,M.default)(ee.compose(L),this.delta))&&(L=ee.diff(this.delta,V));return L}}]),Q})();function J(Q,U){return Object.keys(U).reduce(function(L,W){return Q[W]==null||(U[W]===Q[W]?L[W]=U[W]:Array.isArray(U[W])?U[W].indexOf(Q[W])<0&&(L[W]=U[W].concat([Q[W]])):L[W]=[U[W],Q[W]]),L},{})}function q(Q){return Q.reduce(function(U,L){if(L.insert===1){var W=(0,T.default)(L.attributes);return delete W.image,U.insert({image:L.attributes.image},W)}if(L.attributes!=null&&(L.attributes.list===!0||L.attributes.bullet===!0)&&(L=(0,T.default)(L),L.attributes.list?L.attributes.list="ordered":(L.attributes.list="bullet",delete L.attributes.bullet)),typeof L.insert=="string"){var V=L.insert.replace(/\r\n/g,`
|
|
124
|
+
`).replace(/\r/g,`
|
|
125
|
+
`);return U.insert(V,L.attributes)}return U.push(L)},new d.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(M,R){var N=[],B=!0,H=!1,$=void 0;try{for(var G=M[Symbol.iterator](),Z;!(B=(Z=G.next()).done)&&(N.push(Z.value),!(R&&N.length===R));B=!0);}catch(J){H=!0,$=J}finally{try{!B&&G.return&&G.return()}finally{if(H)throw $}}return N}return function(M,R){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return I(M,R);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function I(M,R){for(var N=0;N<R.length;N++){var B=R[N];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(M,B.key,B)}}return function(M,R,N){return R&&I(M.prototype,R),N&&I(M,N),M}})(),s=i(0),u=k(s),d=i(21),f=k(d),p=i(11),h=k(p),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 M=0,R=Array(I.length);M<I.length;M++)R[M]=I[M];return R}else return Array.from(I)}function P(I,M){if(!(I instanceof M))throw new TypeError("Cannot call a class as a function")}var _=(0,x.default)("quill:selection"),E=function I(M){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;P(this,I),this.index=M,this.length=R},A=(function(){function I(M,R){var N=this;P(this,I),this.emitter=R,this.scroll=M,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(B,H){B===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 B=N.getNativeRange();B!=null&&B.start.node!==N.cursor.textNode&&N.emitter.once(v.default.events.SCROLL_UPDATE,function(){try{N.setNativeRange(B.start.node,B.start.offset,B.end.node,B.end.offset)}catch{}})}}),this.emitter.on(v.default.events.SCROLL_OPTIMIZE,function(B,H){if(H.range){var $=H.range,G=$.startNode,Z=$.startOffset,J=$.endNode,q=$.endOffset;N.setNativeRange(G,Z,J,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 B=this.getNativeRange();if(!(B==null||!B.native.collapsed||u.default.query(R,u.default.Scope.BLOCK))){if(B.start.node!==this.cursor.textNode){var H=u.default.find(B.start.node,!1);if(H==null)return;if(H instanceof u.default.Leaf){var $=H.split(B.start.offset);H.parent.insertBefore(this.cursor,$)}else H.insertBefore(this.cursor,B.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,B=this.scroll.length();R=Math.min(R,B-1),N=Math.min(R+N,B-1)-R;var H=void 0,$=this.scroll.leaf(R),G=a($,2),Z=G[0],J=G[1];if(Z==null)return null;var q=Z.position(J,!0),Q=a(q,2);H=Q[0],J=Q[1];var U=document.createRange();if(N>0){U.setStart(H,J);var L=this.scroll.leaf(R+N),W=a(L,2);if(Z=W[0],J=W[1],Z==null)return null;var V=Z.position(J,!0),ee=a(V,2);return H=ee[0],J=ee[1],U.setEnd(H,J),U.getBoundingClientRect()}else{var re="left",K=void 0;return H instanceof Text?(J<H.data.length?(U.setStart(H,J),U.setEnd(H,J+1)):(U.setStart(H,J-1),U.setEnd(H,J),re="right"),K=U.getBoundingClientRect()):(K=Z.domNode.getBoundingClientRect(),J>0&&(re="right")),{bottom:K.top+K.height,height:K.height,left:K[re],right:K[re],top:K.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 B=this.normalizeNative(N);return _.info("getNativeRange",B),B}},{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,B=[[R.start.node,R.start.offset]];R.native.collapsed||B.push([R.end.node,R.end.offset]);var H=B.map(function(Z){var J=a(Z,2),q=J[0],Q=J[1],U=u.default.find(q,!0),L=U.offset(N.scroll);return Q===0?L:U instanceof u.default.Container?L+U.length():L+U.index(q,Q)}),$=Math.min(Math.max.apply(Math,S(H)),this.scroll.length()-1),G=Math.min.apply(Math,[$].concat(S(H)));return new E(G,$-G)}},{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(B){for(var H=B.node,$=B.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;B.node=H,B.offset=$}),N}},{key:"rangeToNative",value:function(R){var N=this,B=R.collapsed?[R.index]:[R.index,R.index+R.length],H=[],$=this.scroll.length();return B.forEach(function(G,Z){G=Math.min($-1,G);var J=void 0,q=N.scroll.leaf(G),Q=a(q,2),U=Q[0],L=Q[1],W=U.position(L,Z!==0),V=a(W,2);J=V[0],L=V[1],H.push(J,L)}),H.length<2&&(H=H.concat(H)),H}},{key:"scrollIntoView",value:function(R){var N=this.lastRange;if(N!=null){var B=this.getBounds(N.index,N.length);if(B!=null){var H=this.scroll.length()-1,$=this.scroll.line(Math.min(N.index,H)),G=a($,1),Z=G[0],J=Z;if(N.length>0){var q=this.scroll.line(Math.min(N.index+N.length,H)),Q=a(q,1);J=Q[0]}if(!(Z==null||J==null)){var U=R.getBoundingClientRect();B.top<U.top?R.scrollTop-=U.top-B.top:B.bottom>U.bottom&&(R.scrollTop+=B.bottom-U.bottom)}}}}},{key:"setNativeRange",value:function(R,N){var B=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,B,H),!(R!=null&&(this.root.parentNode==null||R.parentNode==null||B.parentNode==null))){var G=document.getSelection();if(G!=null)if(R!=null){this.hasFocus()||this.root.focus();var Z=(this.getNativeRange()||{}).native;if(Z==null||$||R!==Z.startContainer||N!==Z.startOffset||B!==Z.endContainer||H!==Z.endOffset){R.tagName=="BR"&&(N=[].indexOf.call(R.parentNode.childNodes,R),R=R.parentNode),B.tagName=="BR"&&(H=[].indexOf.call(B.parentNode.childNodes,B),B=B.parentNode);var J=document.createRange();J.setStart(R,N),J.setEnd(B,H),G.removeAllRanges(),G.addRange(J)}}else G.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(R){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v.default.sources.API;if(typeof N=="string"&&(B=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(B)}},{key:"update",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v.default.sources.USER,N=this.lastRange,B=this.getRange(),H=a(B,2),$=H[0],G=H[1];if(this.lastRange=$,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,h.default)(N,this.lastRange)){var Z;!this.composing&&G!=null&&G.native.collapsed&&G.start.node!==this.cursor.textNode&&this.cursor.restore();var J=[v.default.events.SELECTION_CHANGE,(0,f.default)(this.lastRange),(0,f.default)(N),R];if((Z=this.emitter).emit.apply(Z,[v.default.events.EDITOR_CHANGE].concat(J)),R!==v.default.sources.SILENT){var q;(q=this.emitter).emit.apply(q,J)}}}}]),I})();function T(I,M){try{M.parentNode}catch{return!1}return M instanceof Text&&(M=M.parentNode),I.contains(M)}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=d(s);function d(v){return v&&v.__esModule?v:{default:v}}function f(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(b,v);function b(){return f(this,b),p(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 p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,y){h.__proto__=y}||function(h,y){for(var v in y)y.hasOwnProperty(v)&&(h[v]=y[v])};return function(h,y){p(h,y);function v(){this.constructor=h}h.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),d=(function(p){a(h,p);function h(y){var v=p.call(this,y)||this;return v.build(),v}return h.prototype.appendChild=function(y){this.insertBefore(y)},h.prototype.attach=function(){p.prototype.attach.call(this),this.children.forEach(function(y){y.attach()})},h.prototype.build=function(){var y=this;this.children=new o.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(v){try{var b=f(v);y.insertBefore(b,y.children.head||void 0)}catch(x){if(x instanceof u.ParchmentError)return;throw x}})},h.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)})},h.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 h?x.descendant(y,k):[null,-1]},h.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 h&&(x=x.concat(S.descendants(y,P,k))),k-=_}),x},h.prototype.detach=function(){this.children.forEach(function(y){y.detach()}),p.prototype.detach.call(this)},h.prototype.formatAt=function(y,v,b,x){this.children.forEachAt(y,v,function(k,S,P){k.formatAt(S,P,b,x)})},h.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)}},h.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)},h.prototype.length=function(){return this.children.reduce(function(y,v){return y+v.length()},0)},h.prototype.moveChildren=function(y,v){this.children.forEach(function(b){y.insertBefore(b,v)})},h.prototype.optimize=function(y){if(p.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()},h.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 h?S.concat(x.path(k,v)):(x!=null&&S.push([x,k]),S)},h.prototype.removeChild=function(y){this.children.remove(y)},h.prototype.replace=function(y){y instanceof h&&y.moveChildren(this),p.prototype.replace.call(this,y)},h.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},h.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},h.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 _=f(S);(_.next!=P||_.next==null)&&(_.parent!=null&&_.parent.removeChild(b),b.insertBefore(_,P||void 0))})},h})(s.default);function f(p){var h=u.find(p);if(h==null)try{h=u.create(p)}catch{h=u.create(u.Scope.INLINE),[].slice.call(p.childNodes).forEach(function(v){h.domNode.appendChild(v)}),p.parentNode&&p.parentNode.replaceChild(h.domNode,p),h.attach()}return h}n.default=d}),(function(r,n,i){var a=this&&this.__extends||(function(){var p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,y){h.__proto__=y}||function(h,y){for(var v in y)y.hasOwnProperty(v)&&(h[v]=y[v])};return function(h,y){p(h,y);function v(){this.constructor=h}h.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),d=i(1),f=(function(p){a(h,p);function h(y){var v=p.call(this,y)||this;return v.attributes=new s.default(v.domNode),v}return h.formats=function(y){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return y.tagName.toLowerCase()},h.prototype.format=function(y,v){var b=d.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)},h.prototype.formats=function(){var y=this.attributes.values(),v=this.statics.formats(this.domNode);return v!=null&&(y[this.statics.blotName]=v),y},h.prototype.replaceWith=function(y,v){var b=p.prototype.replaceWith.call(this,y,v);return this.attributes.copy(b),b},h.prototype.update=function(y,v){var b=this;p.prototype.update.call(this,y,v),y.some(function(x){return x.target===b.domNode&&x.type==="attributes"})&&this.attributes.build()},h.prototype.wrap=function(y,v){var b=p.prototype.wrap.call(this,y,v);return b instanceof h&&b.statics.scope===this.statics.scope&&this.attributes.move(b),b},h})(u.default);n.default=f}),(function(r,n,i){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var h in p)p.hasOwnProperty(h)&&(f[h]=p[h])};return function(f,p){d(f,p);function h(){this.constructor=f}f.prototype=p===null?Object.create(p):(h.prototype=p.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(30),s=i(1),u=(function(d){a(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.value=function(p){return!0},f.prototype.index=function(p,h){return this.domNode===p||this.domNode.compareDocumentPosition(p)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(h,1):-1},f.prototype.position=function(p,h){var y=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return p>0&&(y+=1),[this.parent.domNode,y]},f.prototype.value=function(){var p;return p={},p[this.statics.blotName]=this.statics.value(this.domNode)||!0,p},f.scope=s.Scope.INLINE_BLOT,f})(o.default);n.default=u}),(function(r,n,i){var a=i(11),o=i(3),s={attributes:{compose:function(d,f,p){typeof d!="object"&&(d={}),typeof f!="object"&&(f={});var h=o(!0,{},f);p||(h=Object.keys(h).reduce(function(v,b){return h[b]!=null&&(v[b]=h[b]),v},{}));for(var y in d)d[y]!==void 0&&f[y]===void 0&&(h[y]=d[y]);return Object.keys(h).length>0?h:void 0},diff:function(d,f){typeof d!="object"&&(d={}),typeof f!="object"&&(f={});var p=Object.keys(d).concat(Object.keys(f)).reduce(function(h,y){return a(d[y],f[y])||(h[y]=f[y]===void 0?null:f[y]),h},{});return Object.keys(p).length>0?p:void 0},transform:function(d,f,p){if(typeof d!="object")return f;if(typeof f=="object"){if(!p)return f;var h=Object.keys(f).reduce(function(y,v){return d[v]===void 0&&(y[v]=f[v]),y},{});return Object.keys(h).length>0?h:void 0}}},iterator:function(d){return new u(d)},length:function(d){return typeof d.delete=="number"?d.delete:typeof d.retain=="number"?d.retain:typeof d.insert=="string"?d.insert.length:1}};function u(d){this.ops=d,this.index=0,this.offset=0}u.prototype.hasNext=function(){return this.peekLength()<1/0},u.prototype.next=function(d){d||(d=1/0);var f=this.ops[this.index];if(f){var p=this.offset,h=s.length(f);if(d>=h-p?(d=h-p,this.index+=1,this.offset=0):this.offset+=d,typeof f.delete=="number")return{delete:d};var y={};return f.attributes&&(y.attributes=f.attributes),typeof f.retain=="number"?y.retain=d:typeof f.insert=="string"?y.insert=f.insert.substr(p,d):y.insert=f.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 d=this.offset,f=this.index,p=this.next(),h=this.ops.slice(this.index);return this.offset=d,this.index=f,[p].concat(h)}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 d(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,M){if(I===null)return null;if(M===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,L){I.then(function(W){U(T(W,M-1))},function(W){L(T(W,M-1))})});else if(d.__isArray(I))R=[];else if(d.__isRegExp(I))R=new RegExp(I.source,v(I)),I.lastIndex&&(R.lastIndex=I.lastIndex);else if(d.__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 B=_.indexOf(I);if(B!=-1)return E[B];_.push(I),E.push(R)}a(I,o)&&I.forEach(function(U,L){var W=T(L,M-1),V=T(U,M-1);R.set(W,V)}),a(I,s)&&I.forEach(function(U){var L=T(U,M-1);R.add(L)});for(var H in I){var $;N&&($=Object.getOwnPropertyDescriptor(N,H)),!($&&$.set==null)&&(R[H]=T(I[H],M-1))}if(Object.getOwnPropertySymbols)for(var G=Object.getOwnPropertySymbols(I),H=0;H<G.length;H++){var Z=G[H],J=Object.getOwnPropertyDescriptor(I,Z);J&&!J.enumerable&&!P||(R[Z]=T(I[Z],M-1),J.enumerable||Object.defineProperty(R,Z,{enumerable:!1}))}if(P)for(var q=Object.getOwnPropertyNames(I),H=0;H<q.length;H++){var Q=q[H],J=Object.getOwnPropertyDescriptor(I,Q);J&&J.enumerable||(R[Q]=T(I[Q],M-1),Object.defineProperty(R,Q,{enumerable:!1}))}return R}return T(b,k)}d.clonePrototype=function(x){if(x===null)return null;var k=function(){};return k.prototype=x,new k};function f(b){return Object.prototype.toString.call(b)}d.__objToStr=f;function p(b){return typeof b=="object"&&f(b)==="[object Date]"}d.__isDate=p;function h(b){return typeof b=="object"&&f(b)==="[object Array]"}d.__isArray=h;function y(b){return typeof b=="object"&&f(b)==="[object RegExp]"}d.__isRegExp=y;function v(b){var x="";return b.global&&(x+="g"),b.ignoreCase&&(x+="i"),b.multiline&&(x+="m"),x}return d.__getRegExpFlags=v,d})();typeof r=="object"&&r.exports&&(r.exports=i)}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function R(N,B){var H=[],$=!0,G=!1,Z=void 0;try{for(var J=N[Symbol.iterator](),q;!($=(q=J.next()).done)&&(H.push(q.value),!(B&&H.length===B));$=!0);}catch(Q){G=!0,Z=Q}finally{try{!$&&J.return&&J.return()}finally{if(G)throw Z}}return H}return function(N,B){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return R(N,B);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function R(N,B){for(var H=0;H<B.length;H++){var $=B[H];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(N,$.key,$)}}return function(N,B,H){return B&&R(N.prototype,B),H&&R(N,H),N}})(),s=function R(N,B,H){N===null&&(N=Function.prototype);var $=Object.getOwnPropertyDescriptor(N,B);if($===void 0){var G=Object.getPrototypeOf(N);return G===null?void 0:R(G,B,H)}else{if("value"in $)return $.value;var Z=$.get;return Z===void 0?void 0:Z.call(H)}},u=i(0),d=_(u),f=i(8),p=_(f),h=i(4),y=_(h),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 h.BlockEmbed}var M=(function(R){T(N,R);function N(B,H){E(this,N);var $=A(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,B));return $.emitter=H.emitter,Array.isArray(H.whitelist)&&($.whitelist=H.whitelist.reduce(function(G,Z){return G[Z]=!0,G},{})),$.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 G=this.line(H),Z=a(G,2),J=Z[0],q=Z[1],Q=this.line(H+$),U=a(Q,1),L=U[0];if(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"deleteAt",this).call(this,H,$),L!=null&&J!==L&&q>0){if(J instanceof h.BlockEmbed||L instanceof h.BlockEmbed){this.optimize();return}if(J instanceof k.default){var W=J.newlineIndex(J.length(),!0);if(W>-1&&(J=J.split(W+1),J===L)){this.optimize();return}}else if(L instanceof k.default){var V=L.newlineIndex(0);V>-1&&L.split(V+1)}var ee=L.children.head instanceof b.default?null:L.children.head;J.moveChildren(L,ee),J.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,$,G,Z){this.whitelist!=null&&!this.whitelist[G]||(s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"formatAt",this).call(this,H,$,G,Z),this.optimize())}},{key:"insertAt",value:function(H,$,G){if(!(G!=null&&this.whitelist!=null&&!this.whitelist[$])){if(H>=this.length())if(G==null||d.default.query($,d.default.Scope.BLOCK)==null){var Z=d.default.create(this.statics.defaultChild);this.appendChild(Z),G==null&&$.endsWith(`
|
|
126
|
+
`)&&($=$.slice(0,-1)),Z.insertAt(0,$,G)}else{var J=d.default.create($,G);this.appendChild(J)}else s(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"insertAt",this).call(this,H,$,G);this.optimize()}}},{key:"insertBefore",value:function(H,$){if(H.statics.scope===d.default.Scope.INLINE_BLOT){var G=d.default.create(this.statics.defaultChild);G.appendChild(H),H=G}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,G=function Z(J,q,Q){var U=[],L=Q;return J.children.forEachAt(q,Q,function(W,V,ee){I(W)?U.push(W):W instanceof d.default.Container&&(U=U.concat(Z(W,V,L))),L-=ee}),U};return G(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(p.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 $=p.default.sources.USER;typeof H=="string"&&($=H),Array.isArray(H)||(H=this.observer.takeRecords()),H.length>0&&this.emitter.emit(p.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(p.default.events.SCROLL_UPDATE,$,H)}}}]),N})(d.default.Scroll);M.blotName="scroll",M.className="ql-editor",M.tagName="DIV",M.defaultChild="block",M.allowedChildren=[y.default,h.BlockEmbed,P.default],n.default=M}),(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(K){return typeof K}:function(K){return K&&typeof Symbol=="function"&&K.constructor===Symbol&&K!==Symbol.prototype?"symbol":typeof K},o=(function(){function K(ne,le){var ae=[],ue=!0,ye=!1,Ie=void 0;try{for(var Le=ne[Symbol.iterator](),Ue;!(ue=(Ue=Le.next()).done)&&(ae.push(Ue.value),!(le&&ae.length===le));ue=!0);}catch($e){ye=!0,Ie=$e}finally{try{!ue&&Le.return&&Le.return()}finally{if(ye)throw Ie}}return ae}return function(ne,le){if(Array.isArray(ne))return ne;if(Symbol.iterator in Object(ne))return K(ne,le);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function K(ne,le){for(var ae=0;ae<le.length;ae++){var ue=le[ae];ue.enumerable=ue.enumerable||!1,ue.configurable=!0,"value"in ue&&(ue.writable=!0),Object.defineProperty(ne,ue.key,ue)}}return function(ne,le,ae){return le&&K(ne.prototype,le),ae&&K(ne,ae),ne}})(),u=i(21),d=R(u),f=i(11),p=R(f),h=i(3),y=R(h),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),M=R(I);function R(K){return K&&K.__esModule?K:{default:K}}function N(K,ne,le){return ne in K?Object.defineProperty(K,ne,{value:le,enumerable:!0,configurable:!0,writable:!0}):K[ne]=le,K}function B(K,ne){if(!(K instanceof ne))throw new TypeError("Cannot call a class as a function")}function H(K,ne){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ne&&(typeof ne=="object"||typeof ne=="function")?ne:K}function $(K,ne){if(typeof ne!="function"&&ne!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ne);K.prototype=Object.create(ne&&ne.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),ne&&(Object.setPrototypeOf?Object.setPrototypeOf(K,ne):K.__proto__=ne)}var G=(0,T.default)("quill:keyboard"),Z=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",J=(function(K){$(ne,K),s(ne,null,[{key:"match",value:function(ae,ue){return ue=re(ue),["altKey","ctrlKey","metaKey","shiftKey"].some(function(ye){return!!ue[ye]!==ae[ye]&&ue[ye]!==null})?!1:ue.key===(ae.which||ae.keyCode)}}]);function ne(le,ae){B(this,ne);var ue=H(this,(ne.__proto__||Object.getPrototypeOf(ne)).call(this,le,ae));return ue.bindings={},Object.keys(ue.options.bindings).forEach(function(ye){ye==="list autofill"&&le.scroll.whitelist!=null&&!le.scroll.whitelist.list||ue.options.bindings[ye]&&ue.addBinding(ue.options.bindings[ye])}),ue.addBinding({key:ne.keys.ENTER,shiftKey:null},W),ue.addBinding({key:ne.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(ue.addBinding({key:ne.keys.BACKSPACE},{collapsed:!0},Q),ue.addBinding({key:ne.keys.DELETE},{collapsed:!0},U)):(ue.addBinding({key:ne.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},Q),ue.addBinding({key:ne.keys.DELETE},{collapsed:!0,suffix:/^.?$/},U)),ue.addBinding({key:ne.keys.BACKSPACE},{collapsed:!1},L),ue.addBinding({key:ne.keys.DELETE},{collapsed:!1},L),ue.addBinding({key:ne.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},Q),ue.listen(),ue}return s(ne,[{key:"addBinding",value:function(ae){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Ie=re(ae);if(Ie==null||Ie.key==null)return G.warn("Attempted to add invalid keyboard binding",Ie);typeof ue=="function"&&(ue={handler:ue}),typeof ye=="function"&&(ye={handler:ye}),Ie=(0,y.default)(Ie,ue,ye),this.bindings[Ie.key]=this.bindings[Ie.key]||[],this.bindings[Ie.key].push(Ie)}},{key:"listen",value:function(){var ae=this;this.quill.root.addEventListener("keydown",function(ue){if(!ue.defaultPrevented){var ye=ue.which||ue.keyCode,Ie=(ae.bindings[ye]||[]).filter(function(je){return ne.match(ue,je)});if(Ie.length!==0){var Le=ae.quill.getSelection();if(!(Le==null||!ae.quill.hasFocus())){var Ue=ae.quill.getLine(Le.index),$e=o(Ue,2),rt=$e[0],Se=$e[1],de=ae.quill.getLeaf(Le.index),se=o(de,2),he=se[0],Ce=se[1],oe=Le.length===0?[he,Ce]:ae.quill.getLeaf(Le.index+Le.length),ke=o(oe,2),Oe=ke[0],Be=ke[1],dt=he instanceof P.default.Text?he.value().slice(0,Ce):"",nt=Oe instanceof P.default.Text?Oe.value().slice(Be):"",xe={collapsed:Le.length===0,empty:Le.length===0&&rt.length()<=1,format:ae.quill.getFormat(Le),offset:Se,prefix:dt,suffix:nt},me=Ie.some(function(je){if(je.collapsed!=null&&je.collapsed!==xe.collapsed||je.empty!=null&&je.empty!==xe.empty||je.offset!=null&&je.offset!==xe.offset)return!1;if(Array.isArray(je.format)){if(je.format.every(function(ve){return xe.format[ve]==null}))return!1}else if(a(je.format)==="object"&&!Object.keys(je.format).every(function(ve){return je.format[ve]===!0?xe.format[ve]!=null:je.format[ve]===!1?xe.format[ve]==null:(0,p.default)(je.format[ve],xe.format[ve])}))return!1;return je.prefix!=null&&!je.prefix.test(xe.prefix)||je.suffix!=null&&!je.suffix.test(xe.suffix)?!1:je.handler.call(ae,Le,xe)!==!0});me&&ue.preventDefault()}}}})}}]),ne})(M.default);J.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},J.DEFAULTS={bindings:{bold:ee("bold"),italic:ee("italic"),underline:ee("underline"),indent:{key:J.keys.TAB,format:["blockquote","indent","list"],handler:function(ne,le){if(le.collapsed&&le.offset!==0)return!0;this.quill.format("indent","+1",E.default.sources.USER)}},outdent:{key:J.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(ne,le){if(le.collapsed&&le.offset!==0)return!0;this.quill.format("indent","-1",E.default.sources.USER)}},"outdent backspace":{key:J.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(ne,le){le.format.indent!=null?this.quill.format("indent","-1",E.default.sources.USER):le.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:J.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(ne){this.quill.deleteText(ne.index-1,1,E.default.sources.USER)}},tab:{key:J.keys.TAB,handler:function(ne){this.quill.history.cutoff();var le=new b.default().retain(ne.index).delete(ne.length).insert(" ");this.quill.updateContents(le,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(ne.index+1,E.default.sources.SILENT)}},"list empty enter":{key:J.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(ne,le){this.quill.format("list",!1,E.default.sources.USER),le.format.indent&&this.quill.format("indent",!1,E.default.sources.USER)}},"checklist enter":{key:J.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(ne){var le=this.quill.getLine(ne.index),ae=o(le,2),ue=ae[0],ye=ae[1],Ie=(0,y.default)({},ue.formats(),{list:"checked"}),Le=new b.default().retain(ne.index).insert(`
|
|
127
|
+
`,Ie).retain(ue.length()-ye-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:J.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(ne,le){var ae=this.quill.getLine(ne.index),ue=o(ae,2),ye=ue[0],Ie=ue[1],Le=new b.default().retain(ne.index).insert(`
|
|
128
|
+
`,le.format).retain(ye.length()-Ie-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,le){var ae=le.prefix.length,ue=this.quill.getLine(ne.index),ye=o(ue,2),Ie=ye[0],Le=ye[1];if(Le>ae)return!0;var Ue=void 0;switch(le.prefix.trim()){case"[]":case"[ ]":Ue="unchecked";break;case"[x]":Ue="checked";break;case"-":case"*":Ue="bullet";break;default:Ue="ordered"}this.quill.insertText(ne.index," ",E.default.sources.USER),this.quill.history.cutoff();var $e=new b.default().retain(ne.index-Le).delete(ae+1).retain(Ie.length()-2-Le).retain(1,{list:Ue});this.quill.updateContents($e,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(ne.index-ae,E.default.sources.SILENT)}},"code exit":{key:J.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(ne){var le=this.quill.getLine(ne.index),ae=o(le,2),ue=ae[0],ye=ae[1],Ie=new b.default().retain(ne.index+ue.length()-ye-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(Ie,E.default.sources.USER)}},"embed left":q(J.keys.LEFT,!1),"embed left shift":q(J.keys.LEFT,!0),"embed right":q(J.keys.RIGHT,!1),"embed right shift":q(J.keys.RIGHT,!0)}};function q(K,ne){var le,ae=K===J.keys.LEFT?"prefix":"suffix";return le={key:K,shiftKey:ne,altKey:null},N(le,ae,/^$/),N(le,"handler",function(ye){var Ie=ye.index;K===J.keys.RIGHT&&(Ie+=ye.length+1);var Le=this.quill.getLeaf(Ie),Ue=o(Le,1),$e=Ue[0];return $e instanceof P.default.Embed?(K===J.keys.LEFT?ne?this.quill.setSelection(ye.index-1,ye.length+1,E.default.sources.USER):this.quill.setSelection(ye.index-1,E.default.sources.USER):ne?this.quill.setSelection(ye.index,ye.length+1,E.default.sources.USER):this.quill.setSelection(ye.index+ye.length+1,E.default.sources.USER),!1):!0}),le}function Q(K,ne){if(!(K.index===0||this.quill.getLength()<=1)){var le=this.quill.getLine(K.index),ae=o(le,1),ue=ae[0],ye={};if(ne.offset===0){var Ie=this.quill.getLine(K.index-1),Le=o(Ie,1),Ue=Le[0];if(Ue!=null&&Ue.length()>1){var $e=ue.formats(),rt=this.quill.getFormat(K.index-1,1);ye=k.default.attributes.diff($e,rt)||{}}}var Se=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(ne.prefix)?2:1;this.quill.deleteText(K.index-Se,Se,E.default.sources.USER),Object.keys(ye).length>0&&this.quill.formatLine(K.index-Se,Se,ye,E.default.sources.USER),this.quill.focus()}}function U(K,ne){var le=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(ne.suffix)?2:1;if(!(K.index>=this.quill.getLength()-le)){var ae={},ue=0,ye=this.quill.getLine(K.index),Ie=o(ye,1),Le=Ie[0];if(ne.offset>=Le.length()-1){var Ue=this.quill.getLine(K.index+1),$e=o(Ue,1),rt=$e[0];if(rt){var Se=Le.formats(),de=this.quill.getFormat(K.index,1);ae=k.default.attributes.diff(Se,de)||{},ue=rt.length()}}this.quill.deleteText(K.index,le,E.default.sources.USER),Object.keys(ae).length>0&&this.quill.formatLine(K.index+ue-1,le,ae,E.default.sources.USER)}}function L(K){var ne=this.quill.getLines(K),le={};if(ne.length>1){var ae=ne[0].formats(),ue=ne[ne.length-1].formats();le=k.default.attributes.diff(ue,ae)||{}}this.quill.deleteText(K,E.default.sources.USER),Object.keys(le).length>0&&this.quill.formatLine(K.index,1,le,E.default.sources.USER),this.quill.setSelection(K.index,E.default.sources.SILENT),this.quill.focus()}function W(K,ne){var le=this;K.length>0&&this.quill.scroll.deleteAt(K.index,K.length);var ae=Object.keys(ne.format).reduce(function(ue,ye){return P.default.query(ye,P.default.Scope.BLOCK)&&!Array.isArray(ne.format[ye])&&(ue[ye]=ne.format[ye]),ue},{});this.quill.insertText(K.index,`
|
|
129
|
+
`,ae,E.default.sources.USER),this.quill.setSelection(K.index+1,E.default.sources.SILENT),this.quill.focus(),Object.keys(ne.format).forEach(function(ue){ae[ue]==null&&(Array.isArray(ne.format[ue])||ue!=="link"&&le.quill.format(ue,ne.format[ue],E.default.sources.USER))})}function V(K){return{key:J.keys.TAB,shiftKey:!K,format:{"code-block":!0},handler:function(le){var ae=P.default.query("code-block"),ue=le.index,ye=le.length,Ie=this.quill.scroll.descendant(ae,ue),Le=o(Ie,2),Ue=Le[0],$e=Le[1];if(Ue!=null){var rt=this.quill.getIndex(Ue),Se=Ue.newlineIndex($e,!0)+1,de=Ue.newlineIndex(rt+$e+ye),se=Ue.domNode.textContent.slice(Se,de).split(`
|
|
130
|
+
`);$e=0,se.forEach(function(he,Ce){K?(Ue.insertAt(Se+$e,ae.TAB),$e+=ae.TAB.length,Ce===0?ue+=ae.TAB.length:ye+=ae.TAB.length):he.startsWith(ae.TAB)&&(Ue.deleteAt(Se+$e,ae.TAB.length),$e-=ae.TAB.length,Ce===0?ue-=ae.TAB.length:ye-=ae.TAB.length),$e+=he.length+1}),this.quill.update(E.default.sources.USER),this.quill.setSelection(ue,ye,E.default.sources.SILENT)}}}}function ee(K){return{key:K[0].toUpperCase(),shortKey:!0,handler:function(le,ae){this.quill.format(K,!ae.format[K],E.default.sources.USER)}}}function re(K){if(typeof K=="string"||typeof K=="number")return re({key:K});if((typeof K>"u"?"undefined":a(K))==="object"&&(K=(0,d.default)(K,!1)),typeof K.key=="string")if(J.keys[K.key.toUpperCase()]!=null)K.key=J.keys[K.key.toUpperCase()];else if(K.key.length===1)K.key=K.key.toUpperCase().charCodeAt(0);else return null;return K.shortKey&&(K[Z]=K.shortKey,delete K.shortKey),K}n.default=J,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](),M;!(E=(M=I.next()).done)&&(_.push(M.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),d=h(u),f=i(7),p=h(f);function h(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!==d.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 M=[_,E.start.offset,E.end.offset];A=M[0],T=M[1],I=M[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 p.default?(A=this.next.domNode,this.next.insertAt(0,R),this.textNode.data=S.CONTENTS):(this.textNode.data=R,this.parent.insertBefore(d.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))}),B=a(N,2);return T=B[0],I=B[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})(d.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=d(a),s=i(4),u=d(s);function d(v){return v&&v.__esModule?v:{default:v}}function f(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(b,v);function b(){return f(this,b),p(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=d(s);function d(x){return x&&x.__esModule?x:{default:x}}function f(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 h(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){h(k,x);function k(){return f(this,k),p(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=d(s);function d(b){return b&&b.__esModule?b:{default:b}}function f(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(x,b);function x(){return f(this,x),p(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=p(s),d=i(107),f=p(d);function p(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")}var y=0;function v(x,k){x.setAttribute(k,x.getAttribute(k)!=="true")}var b=(function(){function x(k){var S=this;h(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=f.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=G(a),s=i(5),u=G(s),d=i(4),f=G(d),p=i(16),h=G(p),y=i(25),v=G(y),b=i(24),x=G(b),k=i(35),S=G(k),P=i(6),_=G(P),E=i(22),A=G(E),T=i(7),I=G(T),M=i(55),R=G(M),N=i(42),B=G(N),H=i(23),$=G(H);function G(Z){return Z&&Z.__esModule?Z:{default:Z}}u.default.register({"blots/block":f.default,"blots/block/embed":d.BlockEmbed,"blots/break":h.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":B.default,"modules/keyboard":$.default}),o.default.register(f.default,h.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 d;return Array.isArray(this.tagName)?(typeof u=="string"&&(u=u.toUpperCase(),parseInt(u).toString()===u&&(u=parseInt(u))),typeof u=="number"?d=document.createElement(this.tagName[u-1]):this.tagName.indexOf(u)>-1?d=document.createElement(u):d=document.createElement(this.tagName[0])):d=document.createElement(this.tagName),this.className&&d.classList.add(this.className),d},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,d){var f=this.isolate(u,d);f.remove()},s.prototype.formatAt=function(u,d,f,p){var h=this.isolate(u,d);if(a.query(f,a.Scope.BLOT)!=null&&p)h.wrap(f,p);else if(a.query(f,a.Scope.ATTRIBUTE)!=null){var y=a.create(this.statics.scope);h.wrap(y),y.format(f,p)}},s.prototype.insertAt=function(u,d,f){var p=f==null?a.create("text",d):a.create(d,f),h=this.split(u);this.parent.insertBefore(p,h)},s.prototype.insertInto=function(u,d){d===void 0&&(d=null),this.parent!=null&&this.parent.children.remove(this);var f=null;u.children.insertBefore(this,d),d!=null&&(f=d.domNode),(this.domNode.parentNode!=u.domNode||this.domNode.nextSibling!=f)&&u.domNode.insertBefore(this.domNode,f),this.parent=u,this.attach()},s.prototype.isolate=function(u,d){var f=this.split(u);return f.split(d),f},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,d){var f=typeof u=="string"?a.create(u,d):u;return f.replace(this),f},s.prototype.split=function(u,d){return u===0?this:this.next},s.prototype.update=function(u,d){},s.prototype.wrap=function(u,d){var f=typeof u=="string"?a.create(u,d):u;return this.parent!=null&&this.parent.insertBefore(f,this.next),f.appendChild(this),f},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),d=(function(){function f(p){this.attributes={},this.domNode=p,this.build()}return f.prototype.attribute=function(p,h){h?p.add(this.domNode,h)&&(p.value(this.domNode)!=null?this.attributes[p.attrName]=p:delete this.attributes[p.attrName]):(p.remove(this.domNode),delete this.attributes[p.attrName])},f.prototype.build=function(){var p=this;this.attributes={};var h=a.default.keys(this.domNode),y=o.default.keys(this.domNode),v=s.default.keys(this.domNode);h.concat(y).concat(v).forEach(function(b){var x=u.query(b,u.Scope.ATTRIBUTE);x instanceof a.default&&(p.attributes[x.attrName]=x)})},f.prototype.copy=function(p){var h=this;Object.keys(this.attributes).forEach(function(y){var v=h.attributes[y].value(h.domNode);p.format(y,v)})},f.prototype.move=function(p){var h=this;this.copy(p),Object.keys(this.attributes).forEach(function(y){h.attributes[y].remove(h.domNode)}),this.attributes={}},f.prototype.values=function(){var p=this;return Object.keys(this.attributes).reduce(function(h,y){return h[y]=p.attributes[y].value(p.domNode),h},{})},f})();n.default=d}),(function(r,n,i){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var h in p)p.hasOwnProperty(h)&&(f[h]=p[h])};return function(f,p){d(f,p);function h(){this.constructor=f}f.prototype=p===null?Object.create(p):(h.prototype=p.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(12);function s(d,f){var p=d.getAttribute("class")||"";return p.split(/\s+/).filter(function(h){return h.indexOf(f+"-")===0})}var u=(function(d){a(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.keys=function(p){return(p.getAttribute("class")||"").split(/\s+/).map(function(h){return h.split("-").slice(0,-1).join("-")})},f.prototype.add=function(p,h){return this.canAdd(p,h)?(this.remove(p),p.classList.add(this.keyName+"-"+h),!0):!1},f.prototype.remove=function(p){var h=s(p,this.keyName);h.forEach(function(y){p.classList.remove(y)}),p.classList.length===0&&p.removeAttribute("class")},f.prototype.value=function(p){var h=s(p,this.keyName)[0]||"",y=h.slice(this.keyName.length+1);return this.canAdd(p,y)?y:""},f})(o.default);n.default=u}),(function(r,n,i){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var h in p)p.hasOwnProperty(h)&&(f[h]=p[h])};return function(f,p){d(f,p);function h(){this.constructor=f}f.prototype=p===null?Object.create(p):(h.prototype=p.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(12);function s(d){var f=d.split("-"),p=f.slice(1).map(function(h){return h[0].toUpperCase()+h.slice(1)}).join("");return f[0]+p}var u=(function(d){a(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.keys=function(p){return(p.getAttribute("style")||"").split(";").map(function(h){var y=h.split(":");return y[0].trim()})},f.prototype.add=function(p,h){return this.canAdd(p,h)?(p.style[s(this.keyName)]=h,!0):!1},f.prototype.remove=function(p){p.style[s(this.keyName)]="",p.getAttribute("style")||p.removeAttribute("style")},f.prototype.value=function(p){var h=p.style[s(this.keyName)];return this.canAdd(p,h)?h:""},f})(o.default);n.default=u}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function u(d,f){for(var p=0;p<f.length;p++){var h=f[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(d,h.key,h)}}return function(d,f,p){return f&&u(d.prototype,f),p&&u(d,p),d}})();function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}var s=(function(){function u(d,f){o(this,u),this.quill=d,this.options=f,this.modules={}}return a(u,[{key:"init",value:function(){var f=this;Object.keys(this.options.modules).forEach(function(p){f.modules[p]==null&&f.addModule(p)})}},{key:"addModule",value:function(f){var p=this.quill.constructor.import("modules/"+f);return this.modules[f]=new p(this.quill,this.options.modules[f]||{}),this.modules[f]}}]),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=p(s),d=i(7),f=p(d);function p(k){return k&&k.__esModule?k:{default:k}}function h(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){h(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 f.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 f.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(h){return h&&h.__esModule?h:{default:h}}var u={scope:o.default.Scope.BLOCK,whitelist:["right","center","justify"]},d=new o.default.Attributor.Attribute("align","align",u),f=new o.default.Attributor.Class("align","ql-align",u),p=new o.default.Attributor.Style("align","text-align",u);n.AlignAttribute=d,n.AlignClass=f,n.AlignStyle=p}),(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(p){return p&&p.__esModule?p:{default:p}}var d=new o.default.Attributor.Class("background","ql-bg",{scope:o.default.Scope.INLINE}),f=new s.ColorAttributor("background","background-color",{scope:o.default.Scope.INLINE});n.BackgroundClass=d,n.BackgroundStyle=f}),(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(h){return h&&h.__esModule?h:{default:h}}var u={scope:o.default.Scope.BLOCK,whitelist:["rtl"]},d=new o.default.Attributor.Attribute("direction","dir",u),f=new o.default.Attributor.Class("direction","ql-direction",u),p=new o.default.Attributor.Style("direction","direction",u);n.DirectionAttribute=d,n.DirectionClass=f,n.DirectionStyle=p}),(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=d(s);function d(k){return k&&k.__esModule?k:{default:k}}function f(k,S){if(!(k instanceof S))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(S,k);function S(){return f(this,S),p(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(f){return f&&f.__esModule?f:{default:f}}var u=new o.default.Attributor.Class("size","ql-size",{scope:o.default.Scope.INLINE,whitelist:["small","large","huge"]}),d=new o.default.Attributor.Style("size","font-size",{scope:o.default.Scope.INLINE,whitelist:["10px","18px","32px"]});n.SizeClass=u,n.SizeStyle=d}),(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=h(o),u=i(5),d=h(u),f=i(9),p=h(f);function h(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(d.default.events.EDITOR_CHANGE,function(I,M,R,N){I!==d.default.events.TEXT_CHANGE||T.ignoreChange||(!T.options.userOnly||N===d.default.sources.USER?T.record(M,R):T.transform(M))}),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],d.default.sources.USER),this.ignoreChange=!1;var M=S(I[A]);this.quill.setSelection(M)}}},{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),M=Date.now();if(this.lastRecorded+this.options.delay>M&&this.stack.undo.length>0){var R=this.stack.undo.pop();I=I.compose(R.undo),A=R.redo.compose(A)}else this.lastRecorded=M;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")}}]),_})(p.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 re=0;re<ee.length;re++){var K=ee[re];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(V,K.key,K)}}return function(V,ee,re){return ee&&W(V.prototype,ee),re&&W(V,re),V}})(),o=function W(V,ee,re){V===null&&(V=Function.prototype);var K=Object.getOwnPropertyDescriptor(V,ee);if(K===void 0){var ne=Object.getPrototypeOf(V);return ne===null?void 0:W(ne,ee,re)}else{if("value"in K)return K.value;var le=K.get;return le===void 0?void 0:le.call(re)}},s=i(3),u=M(s),d=i(2),f=M(d),p=i(8),h=M(p),y=i(23),v=M(y),b=i(34),x=M(b),k=i(59),S=M(k),P=i(60),_=M(P),E=i(28),A=M(E),T=i(61),I=M(T);function M(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 B(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"],G=[!1,"serif","monospace"],Z=["1","2","3",!1],J=["small",!1,"large","huge"],q=(function(W){B(V,W);function V(ee,re){R(this,V);var K=N(this,(V.__proto__||Object.getPrototypeOf(V)).call(this,ee,re)),ne=function le(ae){if(!document.body.contains(ee.root))return document.body.removeEventListener("click",le);K.tooltip!=null&&!K.tooltip.root.contains(ae.target)&&document.activeElement!==K.tooltip.textbox&&!K.quill.hasFocus()&&K.tooltip.hide(),K.pickers!=null&&K.pickers.forEach(function(ue){ue.container.contains(ae.target)||ue.close()})};return ee.emitter.listenDOM("click",document.body,ne),K}return a(V,[{key:"addModule",value:function(re){var K=o(V.prototype.__proto__||Object.getPrototypeOf(V.prototype),"addModule",this).call(this,re);return re==="toolbar"&&this.extendToolbar(K),K}},{key:"buildButtons",value:function(re,K){re.forEach(function(ne){var le=ne.getAttribute("class")||"";le.split(/\s+/).forEach(function(ae){if(ae.startsWith("ql-")&&(ae=ae.slice(3),K[ae]!=null))if(ae==="direction")ne.innerHTML=K[ae][""]+K[ae].rtl;else if(typeof K[ae]=="string")ne.innerHTML=K[ae];else{var ue=ne.value||"";ue!=null&&K[ae][ue]&&(ne.innerHTML=K[ae][ue])}})})}},{key:"buildPickers",value:function(re,K){var ne=this;this.pickers=re.map(function(ae){if(ae.classList.contains("ql-align"))return ae.querySelector("option")==null&&L(ae,H),new _.default(ae,K.align);if(ae.classList.contains("ql-background")||ae.classList.contains("ql-color")){var ue=ae.classList.contains("ql-background")?"background":"color";return ae.querySelector("option")==null&&L(ae,$,ue==="background"?"#ffffff":"#000000"),new S.default(ae,K[ue])}else return ae.querySelector("option")==null&&(ae.classList.contains("ql-font")?L(ae,G):ae.classList.contains("ql-header")?L(ae,Z):ae.classList.contains("ql-size")&&L(ae,J)),new A.default(ae)});var le=function(){ne.pickers.forEach(function(ue){ue.update()})};this.quill.on(h.default.events.EDITOR_CHANGE,le)}}]),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 re=new FileReader;re.onload=function(K){var ne=V.quill.getSelection(!0);V.quill.updateContents(new f.default().retain(ne.index).delete(ne.length).insert({image:K.target.result}),h.default.sources.USER),V.quill.setSelection(ne.index+1,h.default.sources.SILENT),ee.value=""},re.readAsDataURL(ee.files[0])}}),this.container.appendChild(ee)),ee.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var Q=(function(W){B(V,W);function V(ee,re){R(this,V);var K=N(this,(V.__proto__||Object.getPrototypeOf(V)).call(this,ee,re));return K.textbox=K.root.querySelector('input[type="text"]'),K.listen(),K}return a(V,[{key:"listen",value:function(){var re=this;this.textbox.addEventListener("keydown",function(K){v.default.match(K,"enter")?(re.save(),K.preventDefault()):v.default.match(K,"escape")&&(re.cancel(),K.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"link",K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),K!=null?this.textbox.value=K:re!==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-"+re)||""),this.root.setAttribute("data-mode",re)}},{key:"restoreFocus",value:function(){var re=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=re}},{key:"save",value:function(){var re=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var K=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",re,h.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",re,h.default.sources.USER)),this.quill.root.scrollTop=K;break}case"video":re=U(re);case"formula":{if(!re)break;var ne=this.quill.getSelection(!0);if(ne!=null){var le=ne.index+ne.length;this.quill.insertEmbed(le,this.root.getAttribute("data-mode"),re,h.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(le+1," ",h.default.sources.USER),this.quill.setSelection(le+2,h.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 L(W,V){var ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;V.forEach(function(re){var K=document.createElement("option");re===ee?K.setAttribute("selected","selected"):K.setAttribute("value",re),W.appendChild(K)})}n.BaseTooltip=Q,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,d=this.iterator();u=d();)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,d=this.head;d!=null;){if(d===s)return u;u+=d.length(),d=d.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 d,f=this.iterator();d=f();){var p=d.length();if(s<p||u&&s===p&&(d.next==null||d.next.length()!==0))return[d,s];s-=p}return[null,0]},o.prototype.forEach=function(s){for(var u,d=this.iterator();u=d();)s(u)},o.prototype.forEachAt=function(s,u,d){if(!(u<=0))for(var f=this.find(s),p=f[0],h=f[1],y,v=s-h,b=this.iterator(p);(y=b())&&v<s+u;){var x=y.length();s>v?d(y,s-v,Math.min(u,v+x-s)):d(y,0,Math.min(x,s+u-v)),v+=x}},o.prototype.map=function(s){return this.reduce(function(u,d){return u.push(s(d)),u},[])},o.prototype.reduce=function(s,u){for(var d,f=this.iterator();d=f();)u=s(u,d);return u},o})();n.default=a}),(function(r,n,i){var a=this&&this.__extends||(function(){var p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,y){h.__proto__=y}||function(h,y){for(var v in y)y.hasOwnProperty(v)&&(h[v]=y[v])};return function(h,y){p(h,y);function v(){this.constructor=h}h.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},d=100,f=(function(p){a(h,p);function h(y){var v=p.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 h.prototype.detach=function(){p.prototype.detach.call(this),this.observer.disconnect()},h.prototype.deleteAt=function(y,v){this.update(),y===0&&v===this.length()?this.children.forEach(function(b){b.remove()}):p.prototype.deleteAt.call(this,y,v)},h.prototype.formatAt=function(y,v,b,x){this.update(),p.prototype.formatAt.call(this,y,v,b,x)},h.prototype.insertAt=function(y,v,b){this.update(),p.prototype.insertAt.call(this,y,v,b)},h.prototype.optimize=function(y,v){var b=this;y===void 0&&(y=[]),v===void 0&&(v={}),p.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(_>=d)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(M){k(M,!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())}},h.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&&p.prototype.update.call(this,this.domNode[s.DATA_KEY].mutations,v),this.optimize(y,v)},h.blotName="scroll",h.defaultChild="block",h.scope=s.Scope.BLOCK_BLOT,h.tagName="DIV",h})(o.default);n.default=f}),(function(r,n,i){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,h){p.__proto__=h}||function(p,h){for(var y in h)h.hasOwnProperty(y)&&(p[y]=h[y])};return function(p,h){f(p,h);function y(){this.constructor=p}p.prototype=h===null?Object.create(h):(y.prototype=h.prototype,new y)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(18),s=i(1);function u(f,p){if(Object.keys(f).length!==Object.keys(p).length)return!1;for(var h in f)if(f[h]!==p[h])return!1;return!0}var d=(function(f){a(p,f);function p(){return f!==null&&f.apply(this,arguments)||this}return p.formats=function(h){if(h.tagName!==p.tagName)return f.formats.call(this,h)},p.prototype.format=function(h,y){var v=this;h===this.statics.blotName&&!y?(this.children.forEach(function(b){b instanceof o.default||(b=b.wrap(p.blotName,!0)),v.attributes.copy(b)}),this.unwrap()):f.prototype.format.call(this,h,y)},p.prototype.formatAt=function(h,y,v,b){if(this.formats()[v]!=null||s.query(v,s.Scope.ATTRIBUTE)){var x=this.isolate(h,y);x.format(v,b)}else f.prototype.formatAt.call(this,h,y,v,b)},p.prototype.optimize=function(h){f.prototype.optimize.call(this,h);var y=this.formats();if(Object.keys(y).length===0)return this.unwrap();var v=this.next;v instanceof p&&v.prev===this&&u(y,v.formats())&&(v.moveChildren(this),v.remove())},p.blotName="inline",p.scope=s.Scope.INLINE_BLOT,p.tagName="SPAN",p})(o.default);n.default=d}),(function(r,n,i){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var h in p)p.hasOwnProperty(h)&&(f[h]=p[h])};return function(f,p){d(f,p);function h(){this.constructor=f}f.prototype=p===null?Object.create(p):(h.prototype=p.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(18),s=i(1),u=(function(d){a(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.formats=function(p){var h=s.query(f.blotName).tagName;if(p.tagName!==h)return d.formats.call(this,p)},f.prototype.format=function(p,h){s.query(p,s.Scope.BLOCK)!=null&&(p===this.statics.blotName&&!h?this.replaceWith(f.blotName):d.prototype.format.call(this,p,h))},f.prototype.formatAt=function(p,h,y,v){s.query(y,s.Scope.BLOCK)!=null?this.format(y,v):d.prototype.formatAt.call(this,p,h,y,v)},f.prototype.insertAt=function(p,h,y){if(y==null||s.query(h,s.Scope.INLINE)!=null)d.prototype.insertAt.call(this,p,h,y);else{var v=this.split(p),b=s.create(h,y);v.parent.insertBefore(b,v)}},f.prototype.update=function(p,h){navigator.userAgent.match(/Trident/)?this.build():d.prototype.update.call(this,p,h)},f.blotName="block",f.scope=s.Scope.BLOCK_BLOT,f.tagName="P",f})(o.default);n.default=u}),(function(r,n,i){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var p in f)f.hasOwnProperty(p)&&(d[p]=f[p])};return function(d,f){u(d,f);function p(){this.constructor=d}d.prototype=f===null?Object.create(f):(p.prototype=f.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(19),s=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.formats=function(f){},d.prototype.format=function(f,p){u.prototype.formatAt.call(this,0,this.length(),f,p)},d.prototype.formatAt=function(f,p,h,y){f===0&&p===this.length()?this.format(h,y):u.prototype.formatAt.call(this,f,p,h,y)},d.prototype.formats=function(){return this.statics.formats(this.domNode)},d})(o.default);n.default=s}),(function(r,n,i){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var h in p)p.hasOwnProperty(h)&&(f[h]=p[h])};return function(f,p){d(f,p);function h(){this.constructor=f}f.prototype=p===null?Object.create(p):(h.prototype=p.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var o=i(19),s=i(1),u=(function(d){a(f,d);function f(p){var h=d.call(this,p)||this;return h.text=h.statics.value(h.domNode),h}return f.create=function(p){return document.createTextNode(p)},f.value=function(p){var h=p.data;return h.normalize&&(h=h.normalize()),h},f.prototype.deleteAt=function(p,h){this.domNode.data=this.text=this.text.slice(0,p)+this.text.slice(p+h)},f.prototype.index=function(p,h){return this.domNode===p?h:-1},f.prototype.insertAt=function(p,h,y){y==null?(this.text=this.text.slice(0,p)+h+this.text.slice(p),this.domNode.data=this.text):d.prototype.insertAt.call(this,p,h,y)},f.prototype.length=function(){return this.text.length},f.prototype.optimize=function(p){d.prototype.optimize.call(this,p),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof f&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},f.prototype.position=function(p,h){return[this.domNode,p]},f.prototype.split=function(p,h){if(h===void 0&&(h=!1),!h){if(p===0)return this;if(p===this.length())return this.next}var y=s.create(this.domNode.splitText(p));return this.parent.insertBefore(y,this.next),this.text=this.statics.value(this.domNode),y},f.prototype.update=function(p,h){var y=this;p.some(function(v){return v.type==="characterData"&&v.target===y.domNode})&&(this.text=this.statics.value(this.domNode))},f.prototype.value=function(){return this.text},f.blotName="text",f.scope=s.Scope.INLINE_BLOT,f})(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 d=this.toString();(typeof u!="number"||!isFinite(u)||Math.floor(u)!==u||u>d.length)&&(u=d.length),u-=s.length;var f=d.indexOf(s,u);return f!==-1&&f===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 d=Object(this),f=d.length>>>0,p=arguments[1],h,y=0;y<f;y++)if(h=d[y],u.call(p,h,y,d))return h}}),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=p(_,E),I=_.substring(0,T);_=_.substring(T),E=E.substring(T),T=h(_,E);var M=_.substring(_.length-T);_=_.substring(0,_.length-T),E=E.substring(0,E.length-T);var R=u(_,E);return I&&R.unshift([o,I]),M&&R.push([o,M]),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:_,M=T.indexOf(I);if(M!=-1)return A=[[a,T.substring(0,M)],[o,I],[a,T.substring(M+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],B=R[1],H=R[2],$=R[3],G=R[4],Z=s(N,H),J=s(B,$);return Z.concat([[o,G]],J)}return d(_,E)}function d(_,E){for(var A=_.length,T=E.length,I=Math.ceil((A+T)/2),M=I,R=2*I,N=new Array(R),B=new Array(R),H=0;H<R;H++)N[H]=-1,B[H]=-1;N[M+1]=0,B[M+1]=0;for(var $=A-T,G=$%2!=0,Z=0,J=0,q=0,Q=0,U=0;U<I;U++){for(var L=-U+Z;L<=U-J;L+=2){var W=M+L,V;L==-U||L!=U&&N[W-1]<N[W+1]?V=N[W+1]:V=N[W-1]+1;for(var ee=V-L;V<A&&ee<T&&_.charAt(V)==E.charAt(ee);)V++,ee++;if(N[W]=V,V>A)J+=2;else if(ee>T)Z+=2;else if(G){var re=M+$-L;if(re>=0&&re<R&&B[re]!=-1){var K=A-B[re];if(V>=K)return f(_,E,V,ee)}}}for(var ne=-U+q;ne<=U-Q;ne+=2){var re=M+ne,K;ne==-U||ne!=U&&B[re-1]<B[re+1]?K=B[re+1]:K=B[re-1]+1;for(var le=K-ne;K<A&&le<T&&_.charAt(A-K-1)==E.charAt(T-le-1);)K++,le++;if(B[re]=K,K>A)Q+=2;else if(le>T)q+=2;else if(!G){var W=M+$-ne;if(W>=0&&W<R&&N[W]!=-1){var V=N[W],ee=M+V-W;if(K=A-K,V>=K)return f(_,E,V,ee)}}}}return[[i,_],[a,E]]}function f(_,E,A,T){var I=_.substring(0,A),M=E.substring(0,T),R=_.substring(A),N=E.substring(T),B=s(I,M),H=s(R,N);return B.concat(H)}function p(_,E){if(!_||!E||_.charAt(0)!=E.charAt(0))return 0;for(var A=0,T=Math.min(_.length,E.length),I=T,M=0;A<I;)_.substring(M,I)==E.substring(M,I)?(A=I,M=A):T=I,I=Math.floor((T-A)/2+A);return I}function h(_,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,M=0;A<I;)_.substring(_.length-I,_.length-M)==E.substring(E.length-I,E.length-M)?(A=I,M=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(J,q,Q){for(var U=J.substring(Q,Q+Math.floor(J.length/4)),L=-1,W="",V,ee,re,K;(L=q.indexOf(U,L+1))!=-1;){var ne=p(J.substring(Q),q.substring(L)),le=h(J.substring(0,Q),q.substring(0,L));W.length<le+ne&&(W=q.substring(L-le,L)+q.substring(L,L+ne),V=J.substring(0,Q-le),ee=J.substring(Q+ne),re=q.substring(0,L-le),K=q.substring(L+ne))}return W.length*2>=J.length?[V,ee,re,K,W]:null}var M=I(A,T,Math.ceil(A.length/4)),R=I(A,T,Math.ceil(A.length/2)),N;if(!M&&!R)return null;R?M?N=M[4].length>R[4].length?M:R:N=R:N=M;var B,H,$,G;_.length>E.length?(B=N[0],H=N[1],$=N[2],G=N[3]):($=N[0],G=N[1],B=N[2],H=N[3]);var Z=N[4];return[B,H,$,G,Z]}function v(_){_.push([o,""]);for(var E=0,A=0,T=0,I="",M="",R;E<_.length;)switch(_[E][0]){case a:T++,M+=_[E][1],E++;break;case i:A++,I+=_[E][1],E++;break;case o:A+T>1?(A!==0&&T!==0&&(R=p(M,I),R!==0&&(E-A-T>0&&_[E-A-T-1][0]==o?_[E-A-T-1][1]+=M.substring(0,R):(_.splice(0,0,[o,M.substring(0,R)]),E++),M=M.substring(R),I=I.substring(R)),R=h(M,I),R!==0&&(_[E][1]=M.substring(M.length-R)+_[E][1],M=M.substring(0,M.length-R),I=I.substring(0,I.length-R))),A===0?_.splice(E-T,A+T,[a,M]):T===0?_.splice(E-A,A+T,[i,I]):_.splice(E-A-T,A+T,[i,I],[a,M]),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="",M="";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 M=A+I[1].length;if(E===M)return[T+1,_];if(E<M){_=_.slice();var R=E-A,N=[I[0],I[1].slice(0,R)],B=[I[0],I[1].slice(R)];return _.splice(T,1,N,B),[T+1,_]}else A=M}}throw new Error("cursor_pos is out of bounds!")}function k(_,E){var A=x(_,E),T=A[1],I=A[0],M=T[I],R=T[I+1];if(M==null)return _;if(M[0]!==o)return _;if(R!=null&&M[1]+R[1]===R[1]+M[1])return T.splice(I,2,R,M),P(T,I,2);if(R!=null&&R[1].indexOf(M[1])===0){T.splice(I,2,[R[0],M[1]],[0,M[1]]);var N=R[1].slice(M[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 M=[],I=0;I<_.length;I+=1)_[I][1].length>0&&M.push(_[I]);return M}function P(_,E,A){for(var T=E+A-1;T>=0&&T>=E-1;T--)if(T+1<_.length){var I=_[T],M=_[T+1];I[0]===M[1]&&_.splice(T,2,[I[0],I[1]+M[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(d,f,p){this.fn=d,this.context=f,this.once=p||!1}function u(){this._events=new o,this._eventsCount=0}u.prototype.eventNames=function(){var f=[],p,h;if(this._eventsCount===0)return f;for(h in p=this._events)i.call(p,h)&&f.push(a?h.slice(1):h);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(p)):f},u.prototype.listeners=function(f,p){var h=a?a+f:f,y=this._events[h];if(p)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(f,p,h,y,v,b){var x=a?a+f:f;if(!this._events[x])return!1;var k=this._events[x],S=arguments.length,P,_;if(k.fn){switch(k.once&&this.removeListener(f,k.fn,void 0,!0),S){case 1:return k.fn.call(k.context),!0;case 2:return k.fn.call(k.context,p),!0;case 3:return k.fn.call(k.context,p,h),!0;case 4:return k.fn.call(k.context,p,h,y),!0;case 5:return k.fn.call(k.context,p,h,y,v),!0;case 6:return k.fn.call(k.context,p,h,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(f,k[_].fn,void 0,!0),S){case 1:k[_].fn.call(k[_].context);break;case 2:k[_].fn.call(k[_].context,p);break;case 3:k[_].fn.call(k[_].context,p,h);break;case 4:k[_].fn.call(k[_].context,p,h,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(f,p,h){var y=new s(p,h||this),v=a?a+f:f;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(f,p,h){var y=new s(p,h||this,!0),v=a?a+f:f;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(f,p,h,y){var v=a?a+f:f;if(!this._events[v])return this;if(!p)return--this._eventsCount===0?this._events=new o:delete this._events[v],this;var b=this._events[v];if(b.fn)b.fn===p&&(!y||b.once)&&(!h||b.context===h)&&(--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!==p||y&&!b[x].once||h&&b[x].context!==h)&&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(f){var p;return f?(p=a?a+f:f,this._events[p]&&(--this._eventsCount===0?this._events=new o:delete this._events[p])):(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(de){return typeof de}:function(de){return de&&typeof Symbol=="function"&&de.constructor===Symbol&&de!==Symbol.prototype?"symbol":typeof de},o=(function(){function de(se,he){var Ce=[],oe=!0,ke=!1,Oe=void 0;try{for(var Be=se[Symbol.iterator](),dt;!(oe=(dt=Be.next()).done)&&(Ce.push(dt.value),!(he&&Ce.length===he));oe=!0);}catch(nt){ke=!0,Oe=nt}finally{try{!oe&&Be.return&&Be.return()}finally{if(ke)throw Oe}}return Ce}return function(se,he){if(Array.isArray(se))return se;if(Symbol.iterator in Object(se))return de(se,he);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function de(se,he){for(var Ce=0;Ce<he.length;Ce++){var oe=he[Ce];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(se,oe.key,oe)}}return function(se,he,Ce){return he&&de(se.prototype,he),Ce&&de(se,Ce),se}})(),u=i(3),d=B(u),f=i(2),p=B(f),h=i(0),y=B(h),v=i(5),b=B(v),x=i(10),k=B(x),S=i(9),P=B(S),_=i(36),E=i(37),A=i(13),T=B(A),I=i(26),M=i(38),R=i(39),N=i(40);function B(de){return de&&de.__esModule?de:{default:de}}function H(de,se,he){return se in de?Object.defineProperty(de,se,{value:he,enumerable:!0,configurable:!0,writable:!0}):de[se]=he,de}function $(de,se){if(!(de instanceof se))throw new TypeError("Cannot call a class as a function")}function G(de,se){if(!de)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return se&&(typeof se=="object"||typeof se=="function")?se:de}function Z(de,se){if(typeof se!="function"&&se!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof se);de.prototype=Object.create(se&&se.prototype,{constructor:{value:de,enumerable:!1,writable:!0,configurable:!0}}),se&&(Object.setPrototypeOf?Object.setPrototypeOf(de,se):de.__proto__=se)}var J=(0,k.default)("quill:clipboard"),q="__ql-matcher",Q=[[Node.TEXT_NODE,Se],[Node.TEXT_NODE,Ue],["br",ye],[Node.ELEMENT_NODE,Ue],[Node.ELEMENT_NODE,ue],[Node.ELEMENT_NODE,$e],[Node.ELEMENT_NODE,ae],[Node.ELEMENT_NODE,rt],["li",Le],["b",le.bind(le,"bold")],["i",le.bind(le,"italic")],["style",Ie]],U=[_.AlignAttribute,M.DirectionAttribute].reduce(function(de,se){return de[se.keyName]=se,de},{}),L=[_.AlignStyle,E.BackgroundStyle,I.ColorStyle,M.DirectionStyle,R.FontStyle,N.SizeStyle].reduce(function(de,se){return de[se.keyName]=se,de},{}),W=(function(de){Z(se,de);function se(he,Ce){$(this,se);var oe=G(this,(se.__proto__||Object.getPrototypeOf(se)).call(this,he,Ce));return oe.quill.root.addEventListener("paste",oe.onPaste.bind(oe)),oe.container=oe.quill.addContainer("ql-clipboard"),oe.container.setAttribute("contenteditable",!0),oe.container.setAttribute("tabindex",-1),oe.matchers=[],Q.concat(oe.options.matchers).forEach(function(ke){var Oe=o(ke,2),Be=Oe[0],dt=Oe[1];!Ce.matchVisual&&dt===$e||oe.addMatcher(Be,dt)}),oe}return s(se,[{key:"addMatcher",value:function(Ce,oe){this.matchers.push([Ce,oe])}},{key:"convert",value:function(Ce){if(typeof Ce=="string")return this.container.innerHTML=Ce.replace(/\>\r?\n +\</g,"><"),this.convert();var oe=this.quill.getFormat(this.quill.selection.savedRange.index);if(oe[T.default.blotName]){var ke=this.container.innerText;return this.container.innerHTML="",new p.default().insert(ke,H({},T.default.blotName,oe[T.default.blotName]))}var Oe=this.prepareMatching(),Be=o(Oe,2),dt=Be[0],nt=Be[1],xe=ne(this.container,dt,nt);return re(xe,`
|
|
132
|
+
`)&&xe.ops[xe.ops.length-1].attributes==null&&(xe=xe.compose(new p.default().retain(xe.length()-1).delete(1))),J.log("convert",this.container.innerHTML,xe),this.container.innerHTML="",xe}},{key:"dangerouslyPasteHTML",value:function(Ce,oe){var ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:b.default.sources.API;if(typeof Ce=="string")this.quill.setContents(this.convert(Ce),oe),this.quill.setSelection(0,b.default.sources.SILENT);else{var Oe=this.convert(oe);this.quill.updateContents(new p.default().retain(Ce).concat(Oe),ke),this.quill.setSelection(Ce+Oe.length(),b.default.sources.SILENT)}}},{key:"onPaste",value:function(Ce){var oe=this;if(!(Ce.defaultPrevented||!this.quill.isEnabled())){var ke=this.quill.getSelection(),Oe=new p.default().retain(ke.index),Be=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(b.default.sources.SILENT),setTimeout(function(){Oe=Oe.concat(oe.convert()).delete(ke.length),oe.quill.updateContents(Oe,b.default.sources.USER),oe.quill.setSelection(Oe.length()-ke.length,b.default.sources.SILENT),oe.quill.scrollingContainer.scrollTop=Be,oe.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var Ce=this,oe=[],ke=[];return this.matchers.forEach(function(Oe){var Be=o(Oe,2),dt=Be[0],nt=Be[1];switch(dt){case Node.TEXT_NODE:ke.push(nt);break;case Node.ELEMENT_NODE:oe.push(nt);break;default:[].forEach.call(Ce.container.querySelectorAll(dt),function(xe){xe[q]=xe[q]||[],xe[q].push(nt)});break}}),[oe,ke]}}]),se})(P.default);W.DEFAULTS={matchers:[],matchVisual:!0};function V(de,se,he){return(typeof se>"u"?"undefined":a(se))==="object"?Object.keys(se).reduce(function(Ce,oe){return V(Ce,oe,se[oe])},de):de.reduce(function(Ce,oe){return oe.attributes&&oe.attributes[se]?Ce.push(oe):Ce.insert(oe.insert,(0,d.default)({},H({},se,he),oe.attributes))},new p.default)}function ee(de){if(de.nodeType!==Node.ELEMENT_NODE)return{};var se="__ql-computed-style";return de[se]||(de[se]=window.getComputedStyle(de))}function re(de,se){for(var he="",Ce=de.ops.length-1;Ce>=0&&he.length<se.length;--Ce){var oe=de.ops[Ce];if(typeof oe.insert!="string")break;he=oe.insert+he}return he.slice(-1*se.length)===se}function K(de){if(de.childNodes.length===0)return!1;var se=ee(de);return["block","list-item"].indexOf(se.display)>-1}function ne(de,se,he){return de.nodeType===de.TEXT_NODE?he.reduce(function(Ce,oe){return oe(de,Ce)},new p.default):de.nodeType===de.ELEMENT_NODE?[].reduce.call(de.childNodes||[],function(Ce,oe){var ke=ne(oe,se,he);return oe.nodeType===de.ELEMENT_NODE&&(ke=se.reduce(function(Oe,Be){return Be(oe,Oe)},ke),ke=(oe[q]||[]).reduce(function(Oe,Be){return Be(oe,Oe)},ke)),Ce.concat(ke)},new p.default):new p.default}function le(de,se,he){return V(he,de,!0)}function ae(de,se){var he=y.default.Attributor.Attribute.keys(de),Ce=y.default.Attributor.Class.keys(de),oe=y.default.Attributor.Style.keys(de),ke={};return he.concat(Ce).concat(oe).forEach(function(Oe){var Be=y.default.query(Oe,y.default.Scope.ATTRIBUTE);Be!=null&&(ke[Be.attrName]=Be.value(de),ke[Be.attrName])||(Be=U[Oe],Be!=null&&(Be.attrName===Oe||Be.keyName===Oe)&&(ke[Be.attrName]=Be.value(de)||void 0),Be=L[Oe],Be!=null&&(Be.attrName===Oe||Be.keyName===Oe)&&(Be=L[Oe],ke[Be.attrName]=Be.value(de)||void 0))}),Object.keys(ke).length>0&&(se=V(se,ke)),se}function ue(de,se){var he=y.default.query(de);if(he==null)return se;if(he.prototype instanceof y.default.Embed){var Ce={},oe=he.value(de);oe!=null&&(Ce[he.blotName]=oe,se=new p.default().insert(Ce,he.formats(de)))}else typeof he.formats=="function"&&(se=V(se,he.blotName,he.formats(de)));return se}function ye(de,se){return re(se,`
|
|
133
|
+
`)||se.insert(`
|
|
134
|
+
`),se}function Ie(){return new p.default}function Le(de,se){var he=y.default.query(de);if(he==null||he.blotName!=="list-item"||!re(se,`
|
|
135
|
+
`))return se;for(var Ce=-1,oe=de.parentNode;!oe.classList.contains("ql-clipboard");)(y.default.query(oe)||{}).blotName==="list"&&(Ce+=1),oe=oe.parentNode;return Ce<=0?se:se.compose(new p.default().retain(se.length()-1).retain(1,{indent:Ce}))}function Ue(de,se){return re(se,`
|
|
136
|
+
`)||(K(de)||se.length()>0&&de.nextSibling&&K(de.nextSibling))&&se.insert(`
|
|
137
|
+
`),se}function $e(de,se){if(K(de)&&de.nextElementSibling!=null&&!re(se,`
|
|
138
|
+
|
|
139
|
+
`)){var he=de.offsetHeight+parseFloat(ee(de).marginTop)+parseFloat(ee(de).marginBottom);de.nextElementSibling.offsetTop>de.offsetTop+he*1.5&&se.insert(`
|
|
140
|
+
`)}return se}function rt(de,se){var he={},Ce=de.style||{};return Ce.fontStyle&&ee(de).fontStyle==="italic"&&(he.italic=!0),Ce.fontWeight&&(ee(de).fontWeight.startsWith("bold")||parseInt(ee(de).fontWeight)>=700)&&(he.bold=!0),Object.keys(he).length>0&&(se=V(se,he)),parseFloat(Ce.textIndent||0)>0&&(se=new p.default().insert(" ").concat(se)),se}function Se(de,se){var he=de.data;if(de.parentNode.tagName==="O:P")return se.insert(he.trim());if(he.trim().length===0&&de.parentNode.classList.contains("ql-clipboard"))return se;if(!ee(de.parentNode).whiteSpace.startsWith("pre")){var Ce=function(ke,Oe){return Oe=Oe.replace(/[^\u00a0]/g,""),Oe.length<1&&ke?" ":Oe};he=he.replace(/\r\n/g," ").replace(/\n/g," "),he=he.replace(/\s\s+/g,Ce.bind(Ce,!0)),(de.previousSibling==null&&K(de.parentNode)||de.previousSibling!=null&&K(de.previousSibling))&&(he=he.replace(/^\s+/,Ce.bind(Ce,!1))),(de.nextSibling==null&&K(de.parentNode)||de.nextSibling!=null&&K(de.nextSibling))&&(he=he.replace(/\s+$/,Ce.bind(Ce,!1)))}return se.insert(he)}n.default=W,n.matchAttributor=ae,n.matchBlot=ue,n.matchNewline=Ue,n.matchSpacing=$e,n.matchText=Se}),(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=d(s);function d(v){return v&&v.__esModule?v:{default:v}}function f(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(b,v);function b(){return f(this,b),p(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(B,H){var $=[],G=!0,Z=!1,J=void 0;try{for(var q=B[Symbol.iterator](),Q;!(G=(Q=q.next()).done)&&($.push(Q.value),!(H&&$.length===H));G=!0);}catch(U){Z=!0,J=U}finally{try{!G&&q.return&&q.return()}finally{if(Z)throw J}}return $}return function(B,H){if(Array.isArray(B))return B;if(Symbol.iterator in Object(B))return N(B,H);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=(function(){function N(B,H){for(var $=0;$<H.length;$++){var G=H[$];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(B,G.key,G)}}return function(B,H,$){return H&&N(B.prototype,H),$&&N(B,$),B}})(),s=i(2),u=k(s),d=i(0),f=k(d),p=i(5),h=k(p),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,B,H){return B in N?Object.defineProperty(N,B,{value:H,enumerable:!0,configurable:!0,writable:!0}):N[B]=H,N}function P(N,B){if(!(N instanceof B))throw new TypeError("Cannot call a class as a function")}function _(N,B){if(!N)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B&&(typeof B=="object"||typeof B=="function")?B:N}function E(N,B){if(typeof B!="function"&&B!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof B);N.prototype=Object.create(B&&B.prototype,{constructor:{value:N,enumerable:!1,writable:!0,configurable:!0}}),B&&(Object.setPrototypeOf?Object.setPrototypeOf(N,B):N.__proto__=B)}var A=(0,v.default)("quill:toolbar"),T=(function(N){E(B,N);function B(H,$){P(this,B);var G=_(this,(B.__proto__||Object.getPrototypeOf(B)).call(this,H,$));if(Array.isArray(G.options.container)){var Z=document.createElement("div");M(Z,G.options.container),H.container.parentNode.insertBefore(Z,H.container),G.container=Z}else typeof G.options.container=="string"?G.container=document.querySelector(G.options.container):G.container=G.options.container;if(!(G.container instanceof HTMLElement)){var J;return J=A.error("Container required for toolbar",G.options),_(G,J)}return G.container.classList.add("ql-toolbar"),G.controls=[],G.handlers={},Object.keys(G.options.handlers).forEach(function(q){G.addHandler(q,G.options.handlers[q])}),[].forEach.call(G.container.querySelectorAll("button, select"),function(q){G.attach(q)}),G.quill.on(h.default.events.EDITOR_CHANGE,function(q,Q){q===h.default.events.SELECTION_CHANGE&&G.update(Q)}),G.quill.on(h.default.events.SCROLL_OPTIMIZE,function(){var q=G.quill.selection.getRange(),Q=a(q,1),U=Q[0];G.update(U)}),G}return o(B,[{key:"addHandler",value:function($,G){this.handlers[$]=G}},{key:"attach",value:function($){var G=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(f.default.query(Z)==null){A.warn("ignoring attaching to nonexistent format",Z,$);return}}var J=$.tagName==="SELECT"?"change":"click";$.addEventListener(J,function(q){var Q=void 0;if($.tagName==="SELECT"){if($.selectedIndex<0)return;var U=$.options[$.selectedIndex];U.hasAttribute("selected")?Q=!1:Q=U.value||!1}else $.classList.contains("ql-active")?Q=!1:Q=$.value||!$.hasAttribute("value"),q.preventDefault();G.quill.focus();var L=G.quill.selection.getRange(),W=a(L,1),V=W[0];if(G.handlers[Z]!=null)G.handlers[Z].call(G,Q);else if(f.default.query(Z).prototype instanceof f.default.Embed){if(Q=prompt("Enter "+Z),!Q)return;G.quill.updateContents(new u.default().retain(V.index).delete(V.length).insert(S({},Z,Q)),h.default.sources.USER)}else G.quill.format(Z,Q,h.default.sources.USER);G.update(V)}),this.controls.push([Z,$])}}},{key:"update",value:function($){var G=$==null?{}:this.quill.getFormat($);this.controls.forEach(function(Z){var J=a(Z,2),q=J[0],Q=J[1];if(Q.tagName==="SELECT"){var U=void 0;if($==null)U=null;else if(G[q]==null)U=Q.querySelector("option[selected]");else if(!Array.isArray(G[q])){var L=G[q];typeof L=="string"&&(L=L.replace(/\"/g,'\\"')),U=Q.querySelector('option[value="'+L+'"]')}U==null?(Q.value="",Q.selectedIndex=-1):U.selected=!0}else if($==null)Q.classList.remove("ql-active");else if(Q.hasAttribute("value")){var W=G[q]===Q.getAttribute("value")||G[q]!=null&&G[q].toString()===Q.getAttribute("value")||G[q]==null&&!Q.getAttribute("value");Q.classList.toggle("ql-active",W)}else Q.classList.toggle("ql-active",G[q]!=null)})}}]),B})(x.default);T.DEFAULTS={};function I(N,B,H){var $=document.createElement("button");$.setAttribute("type","button"),$.classList.add("ql-"+B),H!=null&&($.value=H),N.appendChild($)}function M(N,B){Array.isArray(B[0])||(B=[B]),B.forEach(function(H){var $=document.createElement("span");$.classList.add("ql-formats"),H.forEach(function(G){if(typeof G=="string")I($,G);else{var Z=Object.keys(G)[0],J=G[Z];Array.isArray(J)?R($,Z,J):I($,Z,J)}}),N.appendChild($)})}function R(N,B,H){var $=document.createElement("select");$.classList.add("ql-"+B),H.forEach(function(G){var Z=document.createElement("option");G!==!1?Z.setAttribute("value",G):Z.setAttribute("selected","selected"),$.appendChild(Z)}),N.appendChild($)}T.DEFAULTS={container:null,handlers:{clean:function(){var B=this,H=this.quill.getSelection();if(H!=null)if(H.length==0){var $=this.quill.getFormat();Object.keys($).forEach(function(G){f.default.query(G,f.default.Scope.INLINE)!=null&&B.quill.format(G,!1)})}else this.quill.removeFormat(H,h.default.sources.USER)},direction:function(B){var H=this.quill.getFormat().align;B==="rtl"&&H==null?this.quill.format("align","right",h.default.sources.USER):!B&&H==="right"&&this.quill.format("align",!1,h.default.sources.USER),this.quill.format("direction",B,h.default.sources.USER)},indent:function(B){var H=this.quill.getSelection(),$=this.quill.getFormat(H),G=parseInt($.indent||0);if(B==="+1"||B==="-1"){var Z=B==="+1"?1:-1;$.direction==="rtl"&&(Z*=-1),this.quill.format("indent",G+Z,h.default.sources.USER)}},link:function(B){B===!0&&(B=prompt("Enter link URL:")),this.quill.format("link",B,h.default.sources.USER)},list:function(B){var H=this.quill.getSelection(),$=this.quill.getFormat(H);B==="check"?$.list==="checked"||$.list==="unchecked"?this.quill.format("list",!1,h.default.sources.USER):this.quill.format("list","unchecked",h.default.sources.USER):this.quill.format("list",B,h.default.sources.USER)}}},n.default=T,n.addControls=M}),(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=d(s);function d(v){return v&&v.__esModule?v:{default:v}}function f(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(b,v);function b(x,k){f(this,b);var S=p(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=d(s);function d(v){return v&&v.__esModule?v:{default:v}}function f(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(b,v);function b(x,k){f(this,b);var S=p(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(d,f){for(var p=0;p<f.length;p++){var h=f[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(d,h.key,h)}}return function(d,f,p){return f&&u(d.prototype,f),p&&u(d,p),d}})();function o(u,d){if(!(u instanceof d))throw new TypeError("Cannot call a class as a function")}var s=(function(){function u(d,f){var p=this;o(this,u),this.quill=d,this.boundsContainer=f||document.body,this.root=d.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){p.root.style.marginTop=-1*p.quill.root.scrollTop+"px"}),this.hide()}return a(u,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(f){var p=f.left+f.width/2-this.root.offsetWidth/2,h=f.bottom+this.quill.root.scrollTop;this.root.style.left=p+"px",this.root.style.top=h+"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=p+b+"px"),v.left<y.left&&(b=y.left-v.left,this.root.style.left=p+b+"px"),v.bottom>y.bottom){var x=v.bottom-v.top,k=f.bottom-f.top+x;this.root.style.top=h-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,B){var H=[],$=!0,G=!1,Z=void 0;try{for(var J=N[Symbol.iterator](),q;!($=(q=J.next()).done)&&(H.push(q.value),!(B&&H.length===B));$=!0);}catch(Q){G=!0,Z=Q}finally{try{!$&&J.return&&J.return()}finally{if(G)throw Z}}return H}return function(N,B){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return R(N,B);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),o=function R(N,B,H){N===null&&(N=Function.prototype);var $=Object.getOwnPropertyDescriptor(N,B);if($===void 0){var G=Object.getPrototypeOf(N);return G===null?void 0:R(G,B,H)}else{if("value"in $)return $.value;var Z=$.get;return Z===void 0?void 0:Z.call(H)}},s=(function(){function R(N,B){for(var H=0;H<B.length;H++){var $=B[H];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(N,$.key,$)}}return function(N,B,H){return B&&R(N.prototype,B),H&&R(N,H),N}})(),u=i(3),d=P(u),f=i(8),p=P(f),h=i(43),y=P(h),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(B,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,B,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 M(this.quill,this.options.bounds),H.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function($,G){H.handlers.link.call(H,!G.format.link)})}}]),N})(y.default);I.DEFAULTS=(0,d.default)(!0,{},y.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(N){if(N){var B=this.quill.getSelection();if(B==null||B.length==0)return;var H=this.quill.getText(B);/^\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 M=(function(R){A(N,R);function N(B,H){_(this,N);var $=E(this,(N.__proto__||Object.getPrototypeOf(N)).call(this,B,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 G=H.linkRange;H.restoreFocus(),H.quill.formatText(G,"link",!1,p.default.sources.USER),delete H.linkRange}$.preventDefault(),H.hide()}),this.quill.on(p.default.events.SELECTION_CHANGE,function($,G,Z){if($!=null){if($.length===0&&Z===p.default.sources.USER){var J=H.quill.scroll.descendant(b.default,$.index),q=a(J,2),Q=q[0],U=q[1];if(Q!=null){H.linkRange=new x.Range($.index-U,Q.length());var L=b.default.formats(Q.domNode);H.preview.textContent=L,H.preview.setAttribute("href",L),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})(h.BaseTooltip);M.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=oe(a),s=i(36),u=i(38),d=i(64),f=i(65),p=oe(f),h=i(66),y=oe(h),v=i(67),b=oe(v),x=i(37),k=i(26),S=i(39),P=i(40),_=i(56),E=oe(_),A=i(68),T=oe(A),I=i(27),M=oe(I),R=i(69),N=oe(R),B=i(70),H=oe(B),$=i(71),G=oe($),Z=i(72),J=oe(Z),q=i(73),Q=oe(q),U=i(13),L=oe(U),W=i(74),V=oe(W),ee=i(75),re=oe(ee),K=i(57),ne=oe(K),le=i(41),ae=oe(le),ue=i(28),ye=oe(ue),Ie=i(59),Le=oe(Ie),Ue=i(60),$e=oe(Ue),rt=i(61),Se=oe(rt),de=i(108),se=oe(de),he=i(62),Ce=oe(he);function oe(ke){return ke&&ke.__esModule?ke:{default:ke}}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":d.IndentClass,"formats/background":x.BackgroundStyle,"formats/color":k.ColorStyle,"formats/font":S.FontClass,"formats/size":P.SizeClass,"formats/blockquote":p.default,"formats/code-block":L.default,"formats/header":y.default,"formats/list":b.default,"formats/bold":E.default,"formats/code":U.Code,"formats/italic":T.default,"formats/link":M.default,"formats/script":N.default,"formats/strike":H.default,"formats/underline":G.default,"formats/image":J.default,"formats/video":Q.default,"formats/list/item":v.ListItem,"modules/formula":V.default,"modules/syntax":re.default,"modules/toolbar":ne.default,"themes/bubble":se.default,"themes/snow":Ce.default,"ui/icons":ae.default,"ui/picker":ye.default,"ui/icon-picker":$e.default,"ui/color-picker":Le.default,"ui/tooltip":Se.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=d(s);function d(b){return b&&b.__esModule?b:{default:b}}function f(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(x,b);function x(){return f(this,x),p(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(h){return h&&h.__esModule?h:{default:h}}function u(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function d(h,y){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:h}function f(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(h,y):h.__proto__=y)}var p=(function(h){f(y,h);function y(){return u(this,y),d(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);p.blotName="blockquote",p.tagName="blockquote",n.default=p}),(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 d(y,v){if(!(y instanceof v))throw new TypeError("Cannot call a class as a function")}function f(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 p(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 h=(function(y){p(v,y);function v(){return d(this,v),f(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);h.blotName="header",h.tagName=["H1","H2","H3","H4","H5","H6"],n.default=h}),(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 M=Object.getPrototypeOf(E);return M===null?void 0:_(M,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),d=i(4),f=y(d),p=i(25),h=y(p);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})(f.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",M=o(E.__proto__||Object.getPrototypeOf(E),"create",this).call(this,I);return(T==="checked"||T==="unchecked")&&M.setAttribute("data-checked",T==="checked"),M}},{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),B=u.default.find(R.target);N==="checked"?B.format("list","unchecked"):N==="unchecked"&&B.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 M=I==null?this.length():I.offset(this),R=this.split(M);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})(h.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(h){return h&&h.__esModule?h:{default:h}}function u(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function d(h,y){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:h}function f(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(h,y):h.__proto__=y)}var p=(function(h){f(y,h);function y(){return u(this,y),d(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);p.blotName="italic",p.tagName=["EM","I"],n.default=p}),(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=d(s);function d(v){return v&&v.__esModule?v:{default:v}}function f(v,b){if(!(v instanceof b))throw new TypeError("Cannot call a class as a function")}function p(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 h(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){h(b,v);function b(){return f(this,b),p(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(h){return h&&h.__esModule?h:{default:h}}function u(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function d(h,y){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:h}function f(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(h,y):h.__proto__=y)}var p=(function(h){f(y,h);function y(){return u(this,y),d(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);p.blotName="strike",p.tagName="S",n.default=p}),(function(r,n,i){Object.defineProperty(n,"__esModule",{value:!0});var a=i(6),o=s(a);function s(h){return h&&h.__esModule?h:{default:h}}function u(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function d(h,y){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:h}function f(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(h,y):h.__proto__=y)}var p=(function(h){f(y,h);function y(){return u(this,y),d(this,(y.__proto__||Object.getPrototypeOf(y)).apply(this,arguments))}return y})(o.default);p.blotName="underline",p.tagName="U",n.default=p}),(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=f(s),d=i(27);function f(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 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 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 p(this,k),h(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,d.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),d=f(u);function f(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 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 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 p(this,k),h(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 d.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 M=T.get;return M===void 0?void 0:M.call(A)}},s=i(35),u=y(s),d=i(5),f=y(d),p=i(9),h=y(p);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(){f.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 _})(h.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 M=0;M<I.length;M++){var R=I[M];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(T,R.key,R)}}return function(T,I,M){return I&&A(T.prototype,I),M&&A(T,M),T}})(),o=function A(T,I,M){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,M)}else{if("value"in R)return R.value;var B=R.get;return B===void 0?void 0:B.call(M)}},s=i(0),u=b(s),d=i(5),f=b(d),p=i(9),h=b(p),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(M){this.domNode.textContent=this.domNode.textContent,this.attach(),o(T.prototype.__proto__||Object.getPrototypeOf(T.prototype),"replaceWith",this).call(this,M)}},{key:"highlight",value:function(M){var R=this.domNode.textContent;this.cachedText!==R&&((R.trim().length>0||this.cachedText==null)&&(this.domNode.innerHTML=M(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(){f.default.register(_,!0),f.default.register(P,!0)}}]);function T(I,M){x(this,T);var R=k(this,(T.__proto__||Object.getPrototypeOf(T)).call(this,I,M));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(f.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 M=this;if(!this.quill.selection.composing){this.quill.update(f.default.sources.USER);var R=this.quill.getSelection();this.quill.scroll.descendants(P).forEach(function(N){N.highlight(M.options.highlight)}),this.quill.update(f.default.sources.SILENT),R!=null&&this.quill.setSelection(R,f.default.sources.SILENT)}}}]),T})(h.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,M,R){I===null&&(I=Function.prototype);var N=Object.getOwnPropertyDescriptor(I,M);if(N===void 0){var B=Object.getPrototypeOf(I);return B===null?void 0:T(B,M,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,M){for(var R=0;R<M.length;R++){var N=M[R];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(I,N.key,N)}}return function(I,M,R){return M&&T(I.prototype,M),R&&T(I,R),I}})(),s=i(3),u=x(s),d=i(8),f=x(d),p=i(43),h=x(p),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(M,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,M,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})(h.default);E.DEFAULTS=(0,u.default)(!0,{},h.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(M,R){k(this,I);var N=S(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,M,R));return N.quill.on(f.default.events.EDITOR_CHANGE,function(B,H,$,G){if(B===f.default.events.SELECTION_CHANGE)if(H!=null&&H.length>0&&G===f.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 J=Z[Z.length-1],q=N.quill.getIndex(J),Q=Math.min(J.length()-1,H.index+H.length-q),U=N.quill.getBounds(new y.Range(q,Q));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(f.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),B=this.root.querySelector(".ql-tooltip-arrow");if(B.style.marginLeft="",N===0)return N;B.style.marginLeft=-1*N-B.offsetWidth/2+"px"}}]),I})(p.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})})(kg)),kg.exports}var EA=PA();const Nk=Oc(EA);var _g={exports:{}},lc={},Kh={exports:{}};var TA=Kh.exports,U3;function CA(){return U3||(U3=1,(function(t,e){(function(r){var n=e&&!e.nodeType&&e,i=t&&!t.nodeType&&t,a=typeof Ig=="object"&&Ig;(a.global===a||a.window===a||a.self===a)&&(r=a);var o,s=2147483647,u=36,d=1,f=26,p=38,h=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-d,E=Math.floor,A=String.fromCharCode,T;function I(U){throw new RangeError(P[U])}function M(U,L){for(var W=U.length,V=[];W--;)V[W]=L(U[W]);return V}function R(U,L){var W=U.split("@"),V="";W.length>1&&(V=W[0]+"@",U=W[1]),U=U.replace(S,".");var ee=U.split("."),re=M(ee,L).join(".");return V+re}function N(U){for(var L=[],W=0,V=U.length,ee,re;W<V;)ee=U.charCodeAt(W++),ee>=55296&&ee<=56319&&W<V?(re=U.charCodeAt(W++),(re&64512)==56320?L.push(((ee&1023)<<10)+(re&1023)+65536):(L.push(ee),W--)):L.push(ee);return L}function B(U){return M(U,function(L){var W="";return L>65535&&(L-=65536,W+=A(L>>>10&1023|55296),L=56320|L&1023),W+=A(L),W}).join("")}function H(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:u}function $(U,L){return U+22+75*(U<26)-((L!=0)<<5)}function G(U,L,W){var V=0;for(U=W?E(U/h):U>>1,U+=E(U/L);U>_*f>>1;V+=u)U=E(U/_);return E(V+(_+1)*U/(U+p))}function Z(U){var L=[],W=U.length,V,ee=0,re=v,K=y,ne,le,ae,ue,ye,Ie,Le,Ue,$e;for(ne=U.lastIndexOf(b),ne<0&&(ne=0),le=0;le<ne;++le)U.charCodeAt(le)>=128&&I("not-basic"),L.push(U.charCodeAt(le));for(ae=ne>0?ne+1:0;ae<W;){for(ue=ee,ye=1,Ie=u;ae>=W&&I("invalid-input"),Le=H(U.charCodeAt(ae++)),(Le>=u||Le>E((s-ee)/ye))&&I("overflow"),ee+=Le*ye,Ue=Ie<=K?d:Ie>=K+f?f:Ie-K,!(Le<Ue);Ie+=u)$e=u-Ue,ye>E(s/$e)&&I("overflow"),ye*=$e;V=L.length+1,K=G(ee-ue,V,ue==0),E(ee/V)>s-re&&I("overflow"),re+=E(ee/V),ee%=V,L.splice(ee++,0,re)}return B(L)}function J(U){var L,W,V,ee,re,K,ne,le,ae,ue,ye,Ie=[],Le,Ue,$e,rt;for(U=N(U),Le=U.length,L=v,W=0,re=y,K=0;K<Le;++K)ye=U[K],ye<128&&Ie.push(A(ye));for(V=ee=Ie.length,ee&&Ie.push(b);V<Le;){for(ne=s,K=0;K<Le;++K)ye=U[K],ye>=L&&ye<ne&&(ne=ye);for(Ue=V+1,ne-L>E((s-W)/Ue)&&I("overflow"),W+=(ne-L)*Ue,L=ne,K=0;K<Le;++K)if(ye=U[K],ye<L&&++W>s&&I("overflow"),ye==L){for(le=W,ae=u;ue=ae<=re?d:ae>=re+f?f:ae-re,!(le<ue);ae+=u)rt=le-ue,$e=u-ue,Ie.push(A($(ue+rt%$e,0))),le=E(rt/$e);Ie.push(A($(le,0))),re=G(W,Ue,V==ee),W=0,++V}++W,++L}return Ie.join("")}function q(U){return R(U,function(L){return x.test(L)?Z(L.slice(4).toLowerCase()):L})}function Q(U){return R(U,function(L){return k.test(L)?"xn--"+J(L):L})}if(o={version:"1.4.1",ucs2:{decode:N,encode:B},decode:Z,encode:J,toASCII:Q,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})(TA)})(Kh,Kh.exports)),Kh.exports}var K1,H3;function Md(){return H3||(H3=1,K1=TypeError),K1}const OA={},AA=Object.freeze(Object.defineProperty({__proto__:null,default:OA},Symbol.toStringTag,{value:"Module"})),IA=$6(AA);var Q1,$3;function _0(){if($3)return Q1;$3=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,d=u?WeakMap.prototype.has:null,f=typeof WeakSet=="function"&&WeakSet.prototype,p=f?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,y=h?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,M=Array.prototype.slice,R=Math.floor,N=typeof BigInt=="function"?BigInt.prototype.valueOf:null,B=Object.getOwnPropertySymbols,H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",G=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===$||!0)?Symbol.toStringTag:null,Z=Object.prototype.propertyIsEnumerable,J=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(be){return be.__proto__}:null);function q(be,_e){if(be===1/0||be===-1/0||be!==be||be&&be>-1e3&&be<1e3||A.call(/e/,_e))return _e;var ze=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof be=="number"){var Ye=be<0?-R(-be):R(be);if(Ye!==be){var xt=String(Ye),ot=S.call(_e,xt.length+1);return P.call(xt,ze,"$&_")+"."+P.call(P.call(ot,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(_e,ze,"$&_")}var Q=IA,U=Q.custom,L=Ue(U)?U:null,W={__proto__:null,double:'"',single:"'"},V={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Q1=function be(_e,ze,Ye,xt){var ot=ze||{};if(Se(ot,"quoteStyle")&&!Se(W,ot.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Se(ot,"maxStringLength")&&(typeof ot.maxStringLength=="number"?ot.maxStringLength<0&&ot.maxStringLength!==1/0:ot.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var It=Se(ot,"customInspect")?ot.customInspect:!0;if(typeof It!="boolean"&&It!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Se(ot,"indent")&&ot.indent!==null&&ot.indent!==" "&&!(parseInt(ot.indent,10)===ot.indent&&ot.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Se(ot,"numericSeparator")&&typeof ot.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ft=ot.numericSeparator;if(typeof _e>"u")return"undefined";if(_e===null)return"null";if(typeof _e=="boolean")return _e?"true":"false";if(typeof _e=="string")return nt(_e,ot);if(typeof _e=="number"){if(_e===0)return 1/0/_e>0?"0":"-0";var Ht=String(_e);return Ft?q(_e,Ht):Ht}if(typeof _e=="bigint"){var wr=String(_e)+"n";return Ft?q(_e,wr):wr}var Tr=typeof ot.depth>"u"?5:ot.depth;if(typeof Ye>"u"&&(Ye=0),Ye>=Tr&&Tr>0&&typeof _e=="object")return ne(_e)?"[Array]":"[Object]";var mr=ht(ot,Ye);if(typeof xt>"u")xt=[];else if(he(xt,_e)>=0)return"[Circular]";function zt(fi,za,go){if(za&&(xt=M.call(xt),xt.push(za)),go){var yo={depth:ot.depth};return Se(ot,"quoteStyle")&&(yo.quoteStyle=ot.quoteStyle),be(fi,yo,Ye+1,xt)}return be(fi,ot,Ye+1,xt)}if(typeof _e=="function"&&!ae(_e)){var Cr=se(_e),qr=At(_e,zt);return"[Function"+(Cr?": "+Cr:" (anonymous)")+"]"+(qr.length>0?" { "+I.call(qr,", ")+" }":"")}if(Ue(_e)){var Zn=$?P.call(String(_e),/^(Symbol\(.*\))_[^)]*$/,"$1"):H.call(_e);return typeof _e=="object"&&!$?me(Zn):Zn}if(dt(_e)){for(var Or="<"+E.call(String(_e.nodeName)),Tn=_e.attributes||[],Vr=0;Vr<Tn.length;Vr++)Or+=" "+Tn[Vr].name+"="+ee(re(Tn[Vr].value),"double",ot);return Or+=">",_e.childNodes&&_e.childNodes.length&&(Or+="..."),Or+="</"+E.call(String(_e.nodeName))+">",Or}if(ne(_e)){if(_e.length===0)return"[]";var Jn=At(_e,zt);return mr&&!qe(Jn)?"["+gt(Jn,mr)+"]":"[ "+I.call(Jn,", ")+" ]"}if(ue(_e)){var Fn=At(_e,zt);return!("cause"in Error.prototype)&&"cause"in _e&&!Z.call(_e,"cause")?"{ ["+String(_e)+"] "+I.call(T.call("[cause]: "+zt(_e.cause),Fn),", ")+" }":Fn.length===0?"["+String(_e)+"]":"{ ["+String(_e)+"] "+I.call(Fn,", ")+" }"}if(typeof _e=="object"&&It){if(L&&typeof _e[L]=="function"&&Q)return Q(_e,{depth:Tr-Ye});if(It!=="symbol"&&typeof _e.inspect=="function")return _e.inspect()}if(Ce(_e)){var Ti=[];return n&&n.call(_e,function(fi,za){Ti.push(zt(za,_e,!0)+" => "+zt(fi,_e))}),ve("Map",r.call(_e),Ti,mr)}if(Oe(_e)){var Vi=[];return s&&s.call(_e,function(fi){Vi.push(zt(fi,_e))}),ve("Set",o.call(_e),Vi,mr)}if(oe(_e))return je("WeakMap");if(Be(_e))return je("WeakSet");if(ke(_e))return je("WeakRef");if(Ie(_e))return me(zt(Number(_e)));if($e(_e))return me(zt(N.call(_e)));if(Le(_e))return me(v.call(_e));if(ye(_e))return me(zt(String(_e)));if(typeof window<"u"&&_e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&_e===globalThis||typeof Ig<"u"&&_e===Ig)return"{ [object globalThis] }";if(!le(_e)&&!ae(_e)){var po=At(_e,zt),al=J?J(_e)===Object.prototype:_e instanceof Object||_e.constructor===Object,Bn=_e instanceof Object?"":"null prototype",ns=!al&&G&&Object(_e)===_e&&G in _e?S.call(de(_e),8,-1):Bn?"Object":"",Ba=al||typeof _e.constructor!="function"?"":_e.constructor.name?_e.constructor.name+" ":"",mo=Ba+(ns||Bn?"["+I.call(T.call([],ns||[],Bn||[]),": ")+"] ":"");return po.length===0?mo+"{}":mr?mo+"{"+gt(po,mr)+"}":mo+"{ "+I.call(po,", ")+" }"}return String(_e)};function ee(be,_e,ze){var Ye=ze.quoteStyle||_e,xt=W[Ye];return xt+be+xt}function re(be){return P.call(String(be),/"/g,""")}function K(be){return!G||!(typeof be=="object"&&(G in be||typeof be[G]<"u"))}function ne(be){return de(be)==="[object Array]"&&K(be)}function le(be){return de(be)==="[object Date]"&&K(be)}function ae(be){return de(be)==="[object RegExp]"&&K(be)}function ue(be){return de(be)==="[object Error]"&&K(be)}function ye(be){return de(be)==="[object String]"&&K(be)}function Ie(be){return de(be)==="[object Number]"&&K(be)}function Le(be){return de(be)==="[object Boolean]"&&K(be)}function Ue(be){if($)return be&&typeof be=="object"&&be instanceof Symbol;if(typeof be=="symbol")return!0;if(!be||typeof be!="object"||!H)return!1;try{return H.call(be),!0}catch{}return!1}function $e(be){if(!be||typeof be!="object"||!N)return!1;try{return N.call(be),!0}catch{}return!1}var rt=Object.prototype.hasOwnProperty||function(be){return be in this};function Se(be,_e){return rt.call(be,_e)}function de(be){return b.call(be)}function se(be){if(be.name)return be.name;var _e=k.call(x.call(be),/^function\s*([\w$]+)/);return _e?_e[1]:null}function he(be,_e){if(be.indexOf)return be.indexOf(_e);for(var ze=0,Ye=be.length;ze<Ye;ze++)if(be[ze]===_e)return ze;return-1}function Ce(be){if(!r||!be||typeof be!="object")return!1;try{r.call(be);try{o.call(be)}catch{return!0}return be instanceof Map}catch{}return!1}function oe(be){if(!d||!be||typeof be!="object")return!1;try{d.call(be,d);try{p.call(be,p)}catch{return!0}return be instanceof WeakMap}catch{}return!1}function ke(be){if(!y||!be||typeof be!="object")return!1;try{return y.call(be),!0}catch{}return!1}function Oe(be){if(!o||!be||typeof be!="object")return!1;try{o.call(be);try{r.call(be)}catch{return!0}return be instanceof Set}catch{}return!1}function Be(be){if(!p||!be||typeof be!="object")return!1;try{p.call(be,p);try{d.call(be,d)}catch{return!0}return be instanceof WeakSet}catch{}return!1}function dt(be){return!be||typeof be!="object"?!1:typeof HTMLElement<"u"&&be instanceof HTMLElement?!0:typeof be.nodeName=="string"&&typeof be.getAttribute=="function"}function nt(be,_e){if(be.length>_e.maxStringLength){var ze=be.length-_e.maxStringLength,Ye="... "+ze+" more character"+(ze>1?"s":"");return nt(S.call(be,0,_e.maxStringLength),_e)+Ye}var xt=V[_e.quoteStyle||"single"];xt.lastIndex=0;var ot=P.call(P.call(be,xt,"\\$1"),/[\x00-\x1f]/g,xe);return ee(ot,"single",_e)}function xe(be){var _e=be.charCodeAt(0),ze={8:"b",9:"t",10:"n",12:"f",13:"r"}[_e];return ze?"\\"+ze:"\\x"+(_e<16?"0":"")+_.call(_e.toString(16))}function me(be){return"Object("+be+")"}function je(be){return be+" { ? }"}function ve(be,_e,ze,Ye){var xt=Ye?gt(ze,Ye):I.call(ze,", ");return be+" ("+_e+") {"+xt+"}"}function qe(be){for(var _e=0;_e<be.length;_e++)if(he(be[_e],`
|
|
141
|
+
`)>=0)return!1;return!0}function ht(be,_e){var ze;if(be.indent===" ")ze=" ";else if(typeof be.indent=="number"&&be.indent>0)ze=I.call(Array(be.indent+1)," ");else return null;return{base:ze,prev:I.call(Array(_e+1),ze)}}function gt(be,_e){if(be.length===0)return"";var ze=`
|
|
142
|
+
`+_e.prev+_e.base;return ze+I.call(be,","+ze)+`
|
|
143
|
+
`+_e.prev}function At(be,_e){var ze=ne(be),Ye=[];if(ze){Ye.length=be.length;for(var xt=0;xt<be.length;xt++)Ye[xt]=Se(be,xt)?_e(be[xt],be):""}var ot=typeof B=="function"?B(be):[],It;if($){It={};for(var Ft=0;Ft<ot.length;Ft++)It["$"+ot[Ft]]=ot[Ft]}for(var Ht in be)Se(be,Ht)&&(ze&&String(Number(Ht))===Ht&&Ht<be.length||$&&It["$"+Ht]instanceof Symbol||(A.call(/[^\w$]/,Ht)?Ye.push(_e(Ht,be)+": "+_e(be[Ht],be)):Ye.push(Ht+": "+_e(be[Ht],be))));if(typeof B=="function")for(var wr=0;wr<ot.length;wr++)Z.call(be,ot[wr])&&Ye.push("["+_e(ot[wr])+"]: "+_e(be[ot[wr]],be));return Ye}return Q1}var Z1,q3;function RA(){if(q3)return Z1;q3=1;var t=_0(),e=Md(),r=function(s,u,d){for(var f=s,p;(p=f.next)!=null;f=p)if(p.key===u)return f.next=p.next,d||(p.next=s.next,s.next=p),p},n=function(s,u){if(s){var d=r(s,u);return d&&d.value}},i=function(s,u,d){var f=r(s,u);f?f.value=d:s.next={key:u,next:s.next,value:d}},a=function(s,u){return s?!!r(s,u):!1},o=function(s,u){if(s)return r(s,u,!0)};return Z1=function(){var u,d={assert:function(f){if(!d.has(f))throw new e("Side channel does not contain "+t(f))},delete:function(f){var p=u&&u.next,h=o(u,f);return h&&p&&p===h&&(u=void 0),!!h},get:function(f){return n(u,f)},has:function(f){return a(u,f)},set:function(f,p){u||(u={next:void 0}),i(u,f,p)}};return d},Z1}var J1,V3;function Lk(){return V3||(V3=1,J1=Object),J1}var ey,W3;function MA(){return W3||(W3=1,ey=Error),ey}var ty,G3;function DA(){return G3||(G3=1,ty=EvalError),ty}var ry,X3;function NA(){return X3||(X3=1,ry=RangeError),ry}var ny,Y3;function LA(){return Y3||(Y3=1,ny=ReferenceError),ny}var iy,K3;function FA(){return K3||(K3=1,iy=SyntaxError),iy}var ay,Q3;function BA(){return Q3||(Q3=1,ay=URIError),ay}var oy,Z3;function zA(){return Z3||(Z3=1,oy=Math.abs),oy}var sy,J3;function jA(){return J3||(J3=1,sy=Math.floor),sy}var ly,e4;function UA(){return e4||(e4=1,ly=Math.max),ly}var uy,t4;function HA(){return t4||(t4=1,uy=Math.min),uy}var cy,r4;function $A(){return r4||(r4=1,cy=Math.pow),cy}var fy,n4;function qA(){return n4||(n4=1,fy=Math.round),fy}var dy,i4;function VA(){return i4||(i4=1,dy=Number.isNaN||function(e){return e!==e}),dy}var hy,a4;function WA(){if(a4)return hy;a4=1;var t=VA();return hy=function(r){return t(r)||r===0?r:r<0?-1:1},hy}var py,o4;function GA(){return o4||(o4=1,py=Object.getOwnPropertyDescriptor),py}var my,s4;function Fk(){if(s4)return my;s4=1;var t=GA();if(t)try{t([],"length")}catch{t=null}return my=t,my}var gy,l4;function XA(){if(l4)return gy;l4=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return gy=t,gy}var yy,u4;function YA(){return u4||(u4=1,yy=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}),yy}var vy,c4;function KA(){if(c4)return vy;c4=1;var t=typeof Symbol<"u"&&Symbol,e=YA();return vy=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},vy}var by,f4;function Bk(){return f4||(f4=1,by=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),by}var wy,d4;function zk(){if(d4)return wy;d4=1;var t=Lk();return wy=t.getPrototypeOf||null,wy}var xy,h4;function QA(){if(h4)return xy;h4=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(u,d){for(var f=[],p=0;p<u.length;p+=1)f[p]=u[p];for(var h=0;h<d.length;h+=1)f[h+u.length]=d[h];return f},a=function(u,d){for(var f=[],p=d,h=0;p<u.length;p+=1,h+=1)f[h]=u[p];return f},o=function(s,u){for(var d="",f=0;f<s.length;f+=1)d+=s[f],f+1<s.length&&(d+=u);return d};return xy=function(u){var d=this;if(typeof d!="function"||e.apply(d)!==n)throw new TypeError(t+d);for(var f=a(arguments,1),p,h=function(){if(this instanceof p){var k=d.apply(this,i(f,arguments));return Object(k)===k?k:this}return d.apply(u,i(f,arguments))},y=r(0,d.length-f.length),v=[],b=0;b<y;b++)v[b]="$"+b;if(p=Function("binder","return function ("+o(v,",")+"){ return binder.apply(this,arguments); }")(h),d.prototype){var x=function(){};x.prototype=d.prototype,p.prototype=new x,x.prototype=null}return p},xy}var Sy,p4;function P0(){if(p4)return Sy;p4=1;var t=QA();return Sy=Function.prototype.bind||t,Sy}var ky,m4;function q2(){return m4||(m4=1,ky=Function.prototype.call),ky}var _y,g4;function jk(){return g4||(g4=1,_y=Function.prototype.apply),_y}var Py,y4;function ZA(){return y4||(y4=1,Py=typeof Reflect<"u"&&Reflect&&Reflect.apply),Py}var Ey,v4;function JA(){if(v4)return Ey;v4=1;var t=P0(),e=jk(),r=q2(),n=ZA();return Ey=n||t.call(r,e),Ey}var Ty,b4;function Uk(){if(b4)return Ty;b4=1;var t=P0(),e=Md(),r=q2(),n=JA();return Ty=function(a){if(a.length<1||typeof a[0]!="function")throw new e("a function is required");return n(t,r,a)},Ty}var Cy,w4;function eI(){if(w4)return Cy;w4=1;var t=Uk(),e=Fk(),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 Cy=n&&typeof n.get=="function"?t([n.get]):typeof a=="function"?function(s){return a(s==null?s:i(s))}:!1,Cy}var Oy,x4;function tI(){if(x4)return Oy;x4=1;var t=Bk(),e=zk(),r=eI();return Oy=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,Oy}var Ay,S4;function rI(){if(S4)return Ay;S4=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=P0();return Ay=r.call(t,e),Ay}var Iy,k4;function V2(){if(k4)return Iy;k4=1;var t,e=Lk(),r=MA(),n=DA(),i=NA(),a=LA(),o=FA(),s=Md(),u=BA(),d=zA(),f=jA(),p=UA(),h=HA(),y=$A(),v=qA(),b=WA(),x=Function,k=function(ae){try{return x('"use strict"; return ('+ae+").constructor;")()}catch{}},S=Fk(),P=XA(),_=function(){throw new s},E=S?(function(){try{return arguments.callee,_}catch{try{return S(arguments,"callee").get}catch{return _}}})():_,A=KA()(),T=tI(),I=zk(),M=Bk(),R=jk(),N=q2(),B={},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%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%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%":B,"%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%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":h,"%Math.pow%":y,"%Math.round%":v,"%Math.sign%":b,"%Reflect.getPrototypeOf%":M};if(T)try{null.error}catch(ae){var G=T(T(ae));$["%Error.prototype%"]=G}var Z=function ae(ue){var ye;if(ue==="%AsyncFunction%")ye=k("async function () {}");else if(ue==="%GeneratorFunction%")ye=k("function* () {}");else if(ue==="%AsyncGeneratorFunction%")ye=k("async function* () {}");else if(ue==="%AsyncGenerator%"){var Ie=ae("%AsyncGeneratorFunction%");Ie&&(ye=Ie.prototype)}else if(ue==="%AsyncIteratorPrototype%"){var Le=ae("%AsyncGenerator%");Le&&T&&(ye=T(Le.prototype))}return $[ue]=ye,ye},J={__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=P0(),Q=rI(),U=q.call(N,Array.prototype.concat),L=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),re=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,ne=function(ue){var ye=V(ue,0,1),Ie=V(ue,-1);if(ye==="%"&&Ie!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(Ie==="%"&&ye!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var Le=[];return W(ue,re,function(Ue,$e,rt,Se){Le[Le.length]=rt?W(Se,K,"$1"):$e||Ue}),Le},le=function(ue,ye){var Ie=ue,Le;if(Q(J,Ie)&&(Le=J[Ie],Ie="%"+Le[0]+"%"),Q($,Ie)){var Ue=$[Ie];if(Ue===B&&(Ue=Z(Ie)),typeof Ue>"u"&&!ye)throw new s("intrinsic "+ue+" exists, but is not available. Please file an issue!");return{alias:Le,name:Ie,value:Ue}}throw new o("intrinsic "+ue+" does not exist!")};return Iy=function(ue,ye){if(typeof ue!="string"||ue.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ye!="boolean")throw new s('"allowMissing" argument must be a boolean');if(ee(/^%?[^%]*%?$/,ue)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Ie=ne(ue),Le=Ie.length>0?Ie[0]:"",Ue=le("%"+Le+"%",ye),$e=Ue.name,rt=Ue.value,Se=!1,de=Ue.alias;de&&(Le=de[0],L(Ie,U([0,1],de)));for(var se=1,he=!0;se<Ie.length;se+=1){var Ce=Ie[se],oe=V(Ce,0,1),ke=V(Ce,-1);if((oe==='"'||oe==="'"||oe==="`"||ke==='"'||ke==="'"||ke==="`")&&oe!==ke)throw new o("property names with quotes must have matching quotes");if((Ce==="constructor"||!he)&&(Se=!0),Le+="."+Ce,$e="%"+Le+"%",Q($,$e))rt=$[$e];else if(rt!=null){if(!(Ce in rt)){if(!ye)throw new s("base intrinsic for "+ue+" exists, but the property is not available.");return}if(S&&se+1>=Ie.length){var Oe=S(rt,Ce);he=!!Oe,he&&"get"in Oe&&!("originalValue"in Oe.get)?rt=Oe.get:rt=rt[Ce]}else he=Q(rt,Ce),rt=rt[Ce];he&&!Se&&($[$e]=rt)}}return rt},Iy}var Ry,_4;function Hk(){if(_4)return Ry;_4=1;var t=V2(),e=Uk(),r=e([t("%String.prototype.indexOf%")]);return Ry=function(i,a){var o=t(i,!!a);return typeof o=="function"&&r(i,".prototype.")>-1?e([o]):o},Ry}var My,P4;function $k(){if(P4)return My;P4=1;var t=V2(),e=Hk(),r=_0(),n=Md(),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),d=e("Map.prototype.size",!0);return My=!!i&&function(){var p,h={assert:function(y){if(!h.has(y))throw new n("Side channel does not contain "+r(y))},delete:function(y){if(p){var v=u(p,y);return d(p)===0&&(p=void 0),v}return!1},get:function(y){if(p)return a(p,y)},has:function(y){return p?s(p,y):!1},set:function(y,v){p||(p=new i),o(p,y,v)}};return h},My}var Dy,E4;function nI(){if(E4)return Dy;E4=1;var t=V2(),e=Hk(),r=_0(),n=$k(),i=Md(),a=t("%WeakMap%",!0),o=e("WeakMap.prototype.get",!0),s=e("WeakMap.prototype.set",!0),u=e("WeakMap.prototype.has",!0),d=e("WeakMap.prototype.delete",!0);return Dy=a?function(){var p,h,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(p)return d(p,v)}else if(n&&h)return h.delete(v);return!1},get:function(v){return a&&v&&(typeof v=="object"||typeof v=="function")&&p?o(p,v):h&&h.get(v)},has:function(v){return a&&v&&(typeof v=="object"||typeof v=="function")&&p?u(p,v):!!h&&h.has(v)},set:function(v,b){a&&v&&(typeof v=="object"||typeof v=="function")?(p||(p=new a),s(p,v,b)):n&&(h||(h=n()),h.set(v,b))}};return y}:n,Dy}var Ny,T4;function qk(){if(T4)return Ny;T4=1;var t=Md(),e=_0(),r=RA(),n=$k(),i=nI(),a=i||n||r;return Ny=function(){var s,u={assert:function(d){if(!u.has(d))throw new t("Side channel does not contain "+e(d))},delete:function(d){return!!s&&s.delete(d)},get:function(d){return s&&s.get(d)},has:function(d){return!!s&&s.has(d)},set:function(d,f){s||(s=a()),s.set(d,f)}};return u},Ny}var Ly,C4;function W2(){if(C4)return Ly;C4=1;var t=String.prototype.replace,e=/%20/g,r={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Ly={default:r.RFC3986,formatters:{RFC1738:function(n){return t.call(n,e,"+")},RFC3986:function(n){return String(n)}},RFC1738:r.RFC1738,RFC3986:r.RFC3986},Ly}var Fy,O4;function Vk(){if(O4)return Fy;O4=1;var t=W2(),e=qk(),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)},d=(function(){for(var A=[],T=0;T<256;++T)A.push("%"+((T<16?"0":"")+T.toString(16)).toUpperCase());return A})(),f=function(T){for(;T.length>1;){var I=T.pop(),M=I.obj[I.prop];if(n(M)){for(var R=[],N=0;N<M.length;++N)typeof M[N]<"u"&&R.push(M[N]);I.obj[I.prop]=R}}},p=function(T,I){for(var M=I&&I.plainObjects?{__proto__:null}:{},R=0;R<T.length;++R)typeof T[R]<"u"&&(M[R]=T[R]);return M},h=function A(T,I,M){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(M&&(M.plainObjects||M.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),B=M&&M.plainObjects?{__proto__:null,0:T}:{0:T},H=0;H<N.length;H++){var $=parseInt(N[H],10);B[$+1]=I[N[H]]}return a(B,s(I)+1)}return[T].concat(I)}var G=T;return n(T)&&!n(I)&&(G=p(T,M)),n(T)&&n(I)?(I.forEach(function(Z,J){if(r.call(T,J)){var q=T[J];q&&typeof q=="object"&&Z&&typeof Z=="object"?T[J]=A(q,Z,M):T.push(Z)}else T[J]=Z}),T):Object.keys(I).reduce(function(Z,J){var q=I[J];return r.call(Z,J)?Z[J]=A(Z[J],q,M):Z[J]=q,Z},G)},y=function(T,I){return Object.keys(I).reduce(function(M,R){return M[R]=I[R],M},T)},v=function(A,T,I){var M=A.replace(/\+/g," ");if(I==="iso-8859-1")return M.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(M)}catch{return M}},b=1024,x=function(T,I,M,R,N){if(T.length===0)return T;var B=T;if(typeof T=="symbol"?B=Symbol.prototype.toString.call(T):typeof T!="string"&&(B=String(T)),M==="iso-8859-1")return escape(B).replace(/%u[0-9a-f]{4}/gi,function(Q){return"%26%23"+parseInt(Q.slice(2),16)+"%3B"});for(var H="",$=0;$<B.length;$+=b){for(var G=B.length>=b?B.slice($,$+b):B,Z=[],J=0;J<G.length;++J){var q=G.charCodeAt(J);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]=G.charAt(J);continue}if(q<128){Z[Z.length]=d[q];continue}if(q<2048){Z[Z.length]=d[192|q>>6]+d[128|q&63];continue}if(q<55296||q>=57344){Z[Z.length]=d[224|q>>12]+d[128|q>>6&63]+d[128|q&63];continue}J+=1,q=65536+((q&1023)<<10|G.charCodeAt(J)&1023),Z[Z.length]=d[240|q>>18]+d[128|q>>12&63]+d[128|q>>6&63]+d[128|q&63]}H+=Z.join("")}return H},k=function(T){for(var I=[{obj:{o:T},prop:"o"}],M=[],R=0;R<I.length;++R)for(var N=I[R],B=N.obj[N.prop],H=Object.keys(B),$=0;$<H.length;++$){var G=H[$],Z=B[G];typeof Z=="object"&&Z!==null&&M.indexOf(Z)===-1&&(I.push({obj:B,prop:G}),M.push(Z))}return f(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,M,R){if(o(T)){var N=s(T)+1;return T[N]=I,u(T,N),T}var B=[].concat(T,I);return B.length>M?a(p(B,{plainObjects:R}),B.length-1):B},E=function(T,I){if(n(T)){for(var M=[],R=0;R<T.length;R+=1)M.push(I(T[R]));return M}return I(T)};return Fy={arrayToObject:p,assign:y,combine:_,compact:k,decode:v,encode:x,isBuffer:P,isOverflow:o,isRegExp:S,maybeMap:E,merge:h},Fy}var By,A4;function iI(){if(A4)return By;A4=1;var t=qk(),e=Vk(),r=W2(),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,d=r.default,f={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:d,formatter:r.formatters[d],indices:!1,serializeDate:function(x){return u.call(x)},skipNulls:!1,strictNullHandling:!1},p=function(x){return typeof x=="string"||typeof x=="number"||typeof x=="boolean"||typeof x=="symbol"||typeof x=="bigint"},h={},y=function b(x,k,S,P,_,E,A,T,I,M,R,N,B,H,$,G,Z,J){for(var q=x,Q=J,U=0,L=!1;(Q=Q.get(h))!==void 0&&!L;){var W=Q.get(x);if(U+=1,typeof W<"u"){if(W===U)throw new RangeError("Cyclic object value");L=!0}typeof Q.get(h)>"u"&&(U=0)}if(typeof M=="function"?q=M(k,q):q instanceof Date?q=B(q):S==="comma"&&a(q)&&(q=e.maybeMap(q,function($e){return $e instanceof Date?B($e):$e})),q===null){if(E)return I&&!G?I(k,f.encoder,Z,"key",H):k;q=""}if(p(q)||e.isBuffer(q)){if(I){var V=G?k:I(k,f.encoder,Z,"key",H);return[$(V)+"="+$(I(q,f.encoder,Z,"value",H))]}return[$(k)+"="+$(String(q))]}var ee=[];if(typeof q>"u")return ee;var re;if(S==="comma"&&a(q))G&&I&&(q=e.maybeMap(q,I)),re=[{value:q.length>0?q.join(",")||null:void 0}];else if(a(M))re=M;else{var K=Object.keys(q);re=R?K.sort(R):K}var ne=T?String(k).replace(/\./g,"%2E"):String(k),le=P&&a(q)&&q.length===1?ne+"[]":ne;if(_&&a(q)&&q.length===0)return le+"[]";for(var ae=0;ae<re.length;++ae){var ue=re[ae],ye=typeof ue=="object"&&ue&&typeof ue.value<"u"?ue.value:q[ue];if(!(A&&ye===null)){var Ie=N&&T?String(ue).replace(/\./g,"%2E"):String(ue),Le=a(q)?typeof S=="function"?S(le,Ie):le:le+(N?"."+Ie:"["+Ie+"]");J.set(x,U);var Ue=t();Ue.set(h,J),s(ee,b(ye,Le,S,P,_,E,A,T,S==="comma"&&G&&a(q)?null:I,M,R,N,B,H,$,G,Z,Ue))}}return ee},v=function(x){if(!x)return f;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||f.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],_=f.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=f.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:f.allowDots:!!x.allowDots;return{addQueryPrefix:typeof x.addQueryPrefix=="boolean"?x.addQueryPrefix:f.addQueryPrefix,allowDots:A,allowEmptyArrays:typeof x.allowEmptyArrays=="boolean"?!!x.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:E,charset:k,charsetSentinel:typeof x.charsetSentinel=="boolean"?x.charsetSentinel:f.charsetSentinel,commaRoundTrip:!!x.commaRoundTrip,delimiter:typeof x.delimiter>"u"?f.delimiter:x.delimiter,encode:typeof x.encode=="boolean"?x.encode:f.encode,encodeDotInKeys:typeof x.encodeDotInKeys=="boolean"?x.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof x.encoder=="function"?x.encoder:f.encoder,encodeValuesOnly:typeof x.encodeValuesOnly=="boolean"?x.encodeValuesOnly:f.encodeValuesOnly,filter:_,format:S,formatter:P,serializeDate:typeof x.serializeDate=="function"?x.serializeDate:f.serializeDate,skipNulls:typeof x.skipNulls=="boolean"?x.skipNulls:f.skipNulls,sort:typeof x.sort=="function"?x.sort:null,strictNullHandling:typeof x.strictNullHandling=="boolean"?x.strictNullHandling:f.strictNullHandling}};return By=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(),M=0;M<P.length;++M){var R=P[M],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 B=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&"),B.length>0?H+B:""},By}var zy,I4;function aI(){if(I4)return zy;I4=1;var t=Vk(),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("]="),M=I===-1?T.indexOf("="):I+1,R,N;if(M===-1?(R=b.decoder(T,n.decoder,A,"key"),N=b.strictNullHandling?null:""):(R=b.decoder(T.slice(0,M),n.decoder,A,"key"),R!==null&&(N=t.maybeMap(a(T.slice(M+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 B=e.call(x,R);B&&b.duplicates==="combine"?x[R]=t.combine(x[R],N,b.arrayLimit,b.plainObjects):(!B||b.duplicates==="last")&&(x[R]=N)}}return x},d=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,M=parseInt(I,10);!b.parseArrays&&I===""?E={0:P}:!isNaN(M)&&A!==I&&String(M)===I&&M>=0&&b.parseArrays&&M<=b.arrayLimit?(E=[],E[M]=P):I!=="__proto__"&&(E[I]=P)}P=E}return P},f=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},p=function(v,b,x,k){if(v){var S=f(v,x);if(S)return d(S,b,x,k)}},h=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 zy=function(y,v){var b=h(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=p(_,x[_],b,typeof y=="string");k=t.merge(k,E,b)}return b.allowSparse===!0?k:t.compact(k)},zy}var jy,R4;function oI(){if(R4)return jy;R4=1;var t=iI(),e=aI(),r=W2();return jy={formats:r,parse:e,stringify:t},jy}var M4;function Wk(){if(M4)return lc;M4=1;var t=CA();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),d=["/","?","#"],f=255,p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+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=oI();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("?"),M=I!==-1&&I<E.indexOf("#")?"?":"#",R=E.split(M),N=/\\/g;R[0]=R[0].replace(N,"/"),E=R.join(M);var B=E;if(B=B.trim(),!T&&E.split("#").length===1){var H=i.exec(B);if(H)return this.path=B,this.href=B,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(B);if($){$=$[0];var G=$.toLowerCase();this.protocol=G,B=B.substr($.length)}if(T||$||B.match(/^\/\/[^@/]+@[^@/]+/)){var Z=B.substr(0,2)==="//";Z&&!($&&v[$])&&(B=B.substr(2),this.slashes=!0)}if(!v[$]&&(Z||$&&!b[$])){for(var J=-1,q=0;q<d.length;q++){var Q=B.indexOf(d[q]);Q!==-1&&(J===-1||Q<J)&&(J=Q)}var U,L;J===-1?L=B.lastIndexOf("@"):L=B.lastIndexOf("@",J),L!==-1&&(U=B.slice(0,L),B=B.slice(L+1),this.auth=decodeURIComponent(U)),J=-1;for(var q=0;q<u.length;q++){var Q=B.indexOf(u[q]);Q!==-1&&(J===-1||Q<J)&&(J=Q)}J===-1&&(J=B.length),this.host=B.slice(0,J),B=B.slice(J),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 re=V[q];if(re&&!re.match(p)){for(var K="",ne=0,le=re.length;ne<le;ne++)re.charCodeAt(ne)>127?K+="x":K+=re[ne];if(!K.match(p)){var ae=V.slice(0,q),ue=V.slice(q+1),ye=re.match(h);ye&&(ae.push(ye[1]),ue.unshift(ye[2])),ue.length&&(B="/"+ue.join(".")+B),this.hostname=ae.join(".");break}}}this.hostname.length>f?this.hostname="":this.hostname=this.hostname.toLowerCase(),W||(this.hostname=t.toASCII(this.hostname));var Ie=this.port?":"+this.port:"",Le=this.hostname||"";this.host=Le+Ie,this.href+=this.host,W&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),B[0]!=="/"&&(B="/"+B))}if(!y[G])for(var q=0,ee=s.length;q<ee;q++){var Ue=s[q];if(B.indexOf(Ue)!==-1){var $e=encodeURIComponent(Ue);$e===Ue&&($e=escape(Ue)),B=B.split(Ue).join($e)}}var rt=B.indexOf("#");rt!==-1&&(this.hash=B.substr(rt),B=B.slice(0,rt));var Se=B.indexOf("?");if(Se!==-1?(this.search=B.substr(Se),this.query=B.substr(Se+1),A&&(this.query=x.parse(this.query)),B=B.slice(0,Se)):A&&(this.search="",this.query={}),B&&(this.pathname=B),b[G]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Ie=this.pathname||"",de=this.search||"";this.path=Ie+de}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||"",M=!1,R="";this.host?M=E+this.host:this.hostname&&(M=E+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(M+=":"+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])&&M!==!1?(M="//"+(M||""),T&&T.charAt(0)!=="/"&&(T="/"+T)):M||(M=""),I&&I.charAt(0)!=="#"&&(I="#"+I),N&&N.charAt(0)!=="?"&&(N="?"+N),T=T.replace(/[?#]/g,function(B){return encodeURIComponent(B)}),N=N.replace("#","%23"),A+M+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),M=0;M<I.length;M++){var R=I[M];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),B=0;B<N.length;B++){var H=N[B];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),G=0;G<$.length;G++){var Z=$[G];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 J=T.pathname||"",q=T.search||"";T.path=J+q}return T.slashes=T.slashes||E.slashes,T.href=T.format(),T}var Q=T.pathname&&T.pathname.charAt(0)==="/",U=E.host||E.pathname&&E.pathname.charAt(0)==="/",L=U||Q||T.host&&E.pathname,W=L,V=T.pathname&&T.pathname.split("/")||[],ee=E.pathname&&E.pathname.split("/")||[],re=T.protocol&&!b[T.protocol];if(re&&(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),L=L&&(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(re){T.host=V.shift(),T.hostname=T.host;var K=T.host&&T.host.indexOf("@")>0?T.host.split("@"):!1;K&&(T.auth=K.shift(),T.hostname=K.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],le=(T.host||E.host||V.length>1)&&(ne==="."||ne==="..")||ne==="",ae=0,ue=V.length;ue>=0;ue--)ne=V[ue],ne==="."?V.splice(ue,1):ne===".."?(V.splice(ue,1),ae++):ae&&(V.splice(ue,1),ae--);if(!L&&!W)for(;ae--;ae)V.unshift("..");L&&V[0]!==""&&(!V[0]||V[0].charAt(0)!=="/")&&V.unshift(""),le&&V.join("/").substr(-1)!=="/"&&V.push("");var ye=V[0]===""||V[0]&&V[0].charAt(0)==="/";if(re){T.hostname=ye?"":V.length?V.shift():"",T.host=T.hostname;var K=T.host&&T.host.indexOf("@")>0?T.host.split("@"):!1;K&&(T.auth=K.shift(),T.hostname=K.shift(),T.host=T.hostname)}return L=L||T.host&&V.length,L&&!ye&&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)},lc.parse=k,lc.resolve=P,lc.resolveObject=_,lc.format=S,lc.Url=e,lc}var Pg={exports:{}},sI=Pg.exports,D4;function lI(){return D4||(D4=1,(function(t){(function(e,r){t.exports?t.exports=r():e.xmlserializer=r()})(sI,function(){var e=function(y){return y.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"")},r=function(y){return y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},n=function(y){return y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},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 h(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},d=function(y){var v=y.nodeValue||y.value||"";return n(v)},f=function(y){return"<!--"+y.data.replace(/-/g,"-")+"-->"},p=function(y){return"<![CDATA["+y.nodeValue+"]]>"},h=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 d(y);if(y.nodeName==="#comment")return f(y);if(y.nodeName==="#cdata-section")return p(y)};return{serializeToString:function(y){return e(h(y,{rootNode:!0}))}}})})(Pg)),Pg.exports}var Uy={},N4;function uI(){if(N4)return Uy;N4=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 Uy.failOnParseError=function(a){return i(a),a},Uy}var Hy={},$y={},L4;function E0(){return L4||(L4=1,(function(t){var e=Wk();t.getDocumentBaseUrl=function(s){return s.baseURI!=="about:blank"?s.baseURI:null},t.clone=function(s){var u={},d;for(d in s)s.hasOwnProperty(d)&&(u[d]=s[d]);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(d){return d.catch(function(f){u.push(f)})})).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(d,f){var p=new window.XMLHttpRequest,h=t.joinUrl(u.baseUrl,s),y,v=function(){f({msg:"Unable to load url",url:h})};y=n(h,u.cache),p.addEventListener("load",function(){p.status===200||p.status===0?d(p.response):v()},!1),p.addEventListener("error",v,!1);try{p.open("GET",y,!0),p.overrideMimeType(u.mimeType),p.send(null)}catch{v()}})},t.binaryAjax=function(s,u){var d=t.clone(u);return d.mimeType="text/plain; charset=x-user-defined",t.ajax(s,d).then(function(f){for(var p="",h=0;h<f.length;h++)p+=String.fromCharCode(f.charCodeAt(h)&255);return p})};var i=function(s){var u=function(d,f){return d.substring(0,f.length)===f};return u(s,"<?xml")||u(s,"<svg")?"image/svg+xml":"image/png"};t.getDataURIForImageURL=function(s,u){return t.binaryAjax(s,u).then(function(d){var f=btoa(d),p=i(d);return"data:"+p+";base64,"+f})};var a=[],o=function(s){return a.indexOf(s)<0&&a.push(s),a.indexOf(s)};t.memoize=function(s,u,d){if(typeof d!="object")throw new Error("cacheBucket is not an object");return function(){var f=Array.prototype.slice.call(arguments),p=u(f),h=o(s),y;return d[h]&&d[h][p]?d[h][p]:(y=s.apply(null,f),d[h]=d[h]||{},d[h][p]=y,y)}}})($y)),$y}var qy={},F4;function cI(){if(F4)return qy;F4=1;var t=E0(),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),d=t.clone(o);return!d.baseUrl&&u&&(d.baseUrl=u),t.getDataURIForImageURL(s,d).then(function(f){return f},function(f){throw{resourceType:"image",url:f.url,msg:"Unable to load image "+f.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 qy.inline=function(a,o){var s=i(a.getElementsByTagName("img")),u=i(a.getElementsByTagName("image")),d=n(a.getElementsByTagName("input"));s=s.concat(u),s=s.concat(d);var f=r(s);return t.collectAndReportErrors(f.map(function(p){return e(p,o).then(function(h){p.attributes.src?p.attributes.src.value=h:p.attributes["xlink:href"]?p.attributes["xlink:href"].value=h:p.attributes.href&&(p.attributes.href.value=h)})}))},qy}var Vy={},B4;function fI(){if(B4)return Vy;B4=1;var t=E0(),e=function(a,o){var s=a.attributes.src.value,u=t.getDocumentBaseUrl(a.ownerDocument),d=t.clone(o);return!d.baseUrl&&u&&(d.baseUrl=u),t.ajax(s,d).catch(function(f){throw{resourceType:"script",url:f.url,msg:"Unable to load script "+f.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 Vy.inline=function(a,o){var s=i(a);return t.collectAndReportErrors(s.map(function(u){return e(u,o).then(function(d){n(u,d)})}))},Vy}var Wy={},Gy={},z4;function G2(){return z4||(z4=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)}})(Gy)),Gy}var Xy={},j4;function dI(){return j4||(j4=1,(function(t){var e=G2(),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+")+",d="^\\s*("+u+")(?:\\s*,\\s*("+u+"))*\\s*$",f=new RegExp(u,"g"),p,h=[],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(d))){for(p=f.exec(a);p;)h.push(y(p[0])),p=f.exec(a);return h}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(", ")}})(Xy)),Xy}function hg(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 Yy={exports:{}},U4;function hI(){return U4||(U4=1,(function(t,e){(function(r){t.exports=r()})(function(){return(function r(n,i,a){function o(d,f){if(!i[d]){if(!n[d]){var p=typeof hg=="function"&&hg;if(!f&&p)return p(d,!0);if(s)return s(d,!0);var h=new Error("Cannot find module '"+d+"'");throw h.code="MODULE_NOT_FOUND",h}var y=i[d]={exports:{}};n[d][0].call(y.exports,function(v){var b=n[d][1][v];return o(b||v)},y,y.exports,r,n,i,a)}return i[d].exports}for(var s=typeof hg=="function"&&hg,u=0;u<a.length;u++)o(a[u]);return o})({1:[function(r,n,i){function a(u,d){function f(){this.constructor=u}f.prototype=d.prototype,u.prototype=new f}function o(u,d,f,p){this.message=u,this.expected=d,this.found=f,this.location=p,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,o)}a(o,Error),o.buildMessage=function(u,d){var f={literal:function(k){return'"'+h(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 p(k){return k.charCodeAt(0).toString(16).toUpperCase()}function h(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"+p(S)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(S){return"\\x"+p(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"+p(S)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(S){return"\\x"+p(S)})}function v(k){return f[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?'"'+h(k)+'"':"end of input"}return"Expected "+b(u)+" but "+x(d)+" found."};function s(u,d){d=d!==void 0?d:{};var f={},p={start:Ie},h=Ie,y="",v=function(){return[]},b=",",x=re(",",!1),k=function(oe,ke){return[oe].concat(ke)},S=function(oe){return[oe]},P=function(oe,ke){return{url:oe,format:ke}},_=function(oe){return{url:oe}},E="url(",A=re("url(",!1),T=")",I=re(")",!1),M=function(oe){return oe},R="format(",N=re("format(",!1),B="local(",H=re("local(",!1),$=function(oe){return{local:oe}},G=/^[^)]/,Z=K([")"],!0,!1),J=function(oe){return Ce.extractValue(oe.join(""))},q=/^[ \t\r\n\f]/,Q=K([" "," ","\r",`
|
|
147
|
+
`,"\f"],!1,!1),U=0,L=[{line:1,column:1}],W=0,V=[],ee;if("startRule"in d){if(!(d.startRule in p))throw new Error(`Can't start parsing from rule "`+d.startRule+'".');h=p[d.startRule]}function re(oe,ke){return{type:"literal",text:oe,ignoreCase:ke}}function K(oe,ke,Oe){return{type:"class",parts:oe,inverted:ke,ignoreCase:Oe}}function ne(){return{type:"end"}}function le(oe){var ke=L[oe],Oe;if(ke)return ke;for(Oe=oe-1;!L[Oe];)Oe--;for(ke=L[Oe],ke={line:ke.line,column:ke.column};Oe<oe;)u.charCodeAt(Oe)===10?(ke.line++,ke.column=1):ke.column++,Oe++;return L[oe]=ke,ke}function ae(oe,ke){var Oe=le(oe),Be=le(ke);return{start:{offset:oe,line:Oe.line,column:Oe.column},end:{offset:ke,line:Be.line,column:Be.column}}}function ue(oe){U<W||(U>W&&(W=U,V=[]),V.push(oe))}function ye(oe,ke,Oe){return new o(o.buildMessage(oe,ke),oe,ke,Oe)}function Ie(){var oe,ke;return oe=Le(),oe===f&&(oe=U,ke=y,ke!==f&&(ke=v()),oe=ke),oe}function Le(){var oe,ke,Oe,Be,dt,nt;if(oe=U,ke=Ue(),ke!==f){for(Oe=[],Be=he();Be!==f;)Oe.push(Be),Be=he();if(Oe!==f)if(u.charCodeAt(U)===44?(Be=b,U++):(Be=f,ue(x)),Be!==f){for(dt=[],nt=he();nt!==f;)dt.push(nt),nt=he();dt!==f?(nt=Le(),nt!==f?(ke=k(ke,nt),oe=ke):(U=oe,oe=f)):(U=oe,oe=f)}else U=oe,oe=f;else U=oe,oe=f}else U=oe,oe=f;return oe===f&&(oe=U,ke=Ue(),ke!==f&&(ke=S(ke)),oe=ke),oe}function Ue(){var oe;return oe=$e(),oe===f&&(oe=de()),oe}function $e(){var oe,ke,Oe,Be;if(oe=U,ke=rt(),ke!==f){if(Oe=[],Be=he(),Be!==f)for(;Be!==f;)Oe.push(Be),Be=he();else Oe=f;Oe!==f?(Be=Se(),Be!==f?(ke=P(ke,Be),oe=ke):(U=oe,oe=f)):(U=oe,oe=f)}else U=oe,oe=f;return oe===f&&(oe=U,ke=rt(),ke!==f&&(ke=_(ke)),oe=ke),oe}function rt(){var oe,ke,Oe,Be;return oe=U,u.substr(U,4)===E?(ke=E,U+=4):(ke=f,ue(A)),ke!==f?(Oe=se(),Oe!==f?(u.charCodeAt(U)===41?(Be=T,U++):(Be=f,ue(I)),Be!==f?(ke=M(Oe),oe=ke):(U=oe,oe=f)):(U=oe,oe=f)):(U=oe,oe=f),oe}function Se(){var oe,ke,Oe,Be;return oe=U,u.substr(U,7)===R?(ke=R,U+=7):(ke=f,ue(N)),ke!==f?(Oe=se(),Oe!==f?(u.charCodeAt(U)===41?(Be=T,U++):(Be=f,ue(I)),Be!==f?(ke=M(Oe),oe=ke):(U=oe,oe=f)):(U=oe,oe=f)):(U=oe,oe=f),oe}function de(){var oe,ke,Oe,Be;return oe=U,u.substr(U,6)===B?(ke=B,U+=6):(ke=f,ue(H)),ke!==f?(Oe=se(),Oe!==f?(u.charCodeAt(U)===41?(Be=T,U++):(Be=f,ue(I)),Be!==f?(ke=$(Oe),oe=ke):(U=oe,oe=f)):(U=oe,oe=f)):(U=oe,oe=f),oe}function se(){var oe,ke,Oe;if(oe=U,ke=[],G.test(u.charAt(U))?(Oe=u.charAt(U),U++):(Oe=f,ue(Z)),Oe!==f)for(;Oe!==f;)ke.push(Oe),G.test(u.charAt(U))?(Oe=u.charAt(U),U++):(Oe=f,ue(Z));else ke=f;return ke!==f&&(ke=J(ke)),oe=ke,oe}function he(){var oe;return q.test(u.charAt(U))?(oe=u.charAt(U),U++):(oe=f,ue(Q)),oe}var Ce=r("../util");if(ee=h(),ee!==f&&U===u.length)return ee;throw ee!==f&&U<u.length&&ue(ne()),ye(V,W<u.length?u.charAt(W):null,W<u.length?ae(W,W+1):ae(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=/^"(.*)"$/,d=/^'(.*)'$/;return u.test(s)?s.replace(u,"$1"):d.test(s)?s.replace(d,"$1"):s};i.extractValue=function(s){return o(a(s))}},{}]},{},[2])(2)})})(Yy)),Yy.exports}var H4;function pI(){return H4||(H4=1,(function(t){var e=E0(),r=G2(),n=dI(),i=hI(),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")})},d=function(S){return S.filter(function(P){return P.type===window.CSSRule.IMPORT_RULE&&P.href})},f=function(S){var P=[];return S.forEach(function(_,E){_.url&&!e.isDataUri(_.url)&&P.push(E)}),P},p=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 M=n.parse(I.value),R=f(M),N;R.length>0&&(R.forEach(function(B){var H=M[B].url,$=e.joinUrl(S,H);M[B].url=$}),N=n.serialize(M),a(I.rule,I.property,N),T=!0)}),u(P).forEach(function(I){var M=I.style.getPropertyValue("src"),R,N;try{R=i.parse(M)}catch{return}N=p(R),N.length>0&&(N.forEach(function(B){var H=R[B].url,$=e.joinUrl(S,H);R[B].url=$}),r.changeFontFaceRuleSrc(P,I,i.serialize(R,_),_),T=!0)}),d(P).forEach(function(I){var M=I.href,R=e.joinUrl(S,M);r.exchangeRule(P,I,"@import url("+R+");",_),T=!0}),T};var h=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?(h(S,P,[]),Promise.resolve([])):(_.push(T),e.ajax(A,E).then(function(I){var M=r.rulesForCssText(I,E);return t.loadCSSImportsForRules(M,_,E).then(function(R){return t.adjustPathsOfCssResources(A,M,E),h(S,P,M),R.errors})},function(I){throw{resourceType:"stylesheet",url:I.url,msg:"Unable to load stylesheet "+I.url}}))};t.loadCSSImportsForRules=function(S,P,_){var E=d(S),A=[],T=!1;return Promise.all(E.map(function(I){return y(S,I,P,_).then(function(M){A=A.concat(M),T=!0},function(M){A.push(M)})})).then(function(){return{hasChanges:T,errors:A}})};var v=function(S,P){var _=n.parse(S),E=f(_),A=!1;return e.collectAndReportErrors(E.map(function(T){var I=_[T].url;return e.getDataURIForImageURL(I,P).then(function(M){_[T].url=M,A=!0},function(M){throw{resourceType:"backgroundImage",url:M.url,msg:"Unable to load background-image "+M.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(M){M.hasChanges&&(a(I.rule,I.property,M.backgroundValue),T=!0),A=A.concat(M.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=p(E),e.collectAndReportErrors(A.map(function(T){var I=E[T],M=I.format||"woff";return e.binaryAjax(I.url,P).then(function(R){var N=btoa(R);I.url="data:font/"+M+";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(M){M.hasChanges&&(r.changeFontFaceRuleSrc(S,T,M.srcDeclarationValue,P),A=!0),E=E.concat(M.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}})}})(Wy)),Wy}var $4;function mI(){return $4||($4=1,(function(t){var e=E0(),r=cI(),n=fI(),i=pI(),a=G2(),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},d=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}})})},f=function(x,k,S){var P=x.textContent,_=u(d,k);return _(P,S,k).then(function(E){return E.hasChanges&&(x.childNodes[0].nodeValue=E.content),e.cloneArray(E.errors)})},p=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=p(x),P=[],_=[],E;return E=e.clone(k),E.baseUrl=E.baseUrl||e.getDocumentBaseUrl(x),Promise.all(S.map(function(A){return f(A,E,_).then(function(T){P=P.concat(T)})})).then(function(){return P})};var h=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){h(_,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})}})(Hy)),Hy}var gI=_g.exports,q4;function yI(){return q4||(q4=1,(function(t){(function(e,r){e===void 0&&window!==void 0&&(e=window),t.exports?t.exports=r(Wk(),lI(),uI(),mI()):e.rasterizeHTML=r(e.url,e.xmlserializer,e.sanedomparsererror,e.inlineresources)})(gI,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(),M=v.joinUrl(S,I);return A.apply(this,[T,M].concat(E))}),_};return P},b.finishNotifyingXhr=function(k){var S=0,P=0,_=!1,E,A=new Promise(function(I){E=function(){var M=S-P;M<=0&&_&&I({totalCount:S})}}),T=function(){var I=new k;return x(I,"send",function(M,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 M=T.parentStyleSheet,R=b(M.cssRules).indexOf(T);M.insertRule(I,R+1),M.deleteRule(R)},k=function(T,I){var M=T.cssText.replace(/^[^\{]+/,""),R=I+" "+M;x(T,R)},S=function(T){return b(T).reduce(function(I,M){return I+M.cssText},"")},P=function(T){T.textContent=S(T.sheet.cssRules)},_=function(T){var I=document.implementation.createHTMLDocument(""),M=document.createElement("style");M.textContent=T.textContent,I.body.appendChild(M),T.sheet=M.sheet},E=function(T){return"((?:^|[^.#:\\w])|(?=\\W))("+T.join("|")+")(?=\\W|$)"},A=function(T,I,M){var R=E(I);b(T.querySelectorAll("style")).forEach(function(N){typeof N.sheet>"u"&&_(N);var B=b(N.sheet.cssRules).filter(function(H){return H.selectorText&&new RegExp(R,"i").test(H.selectorText)});B.length&&(B.forEach(function(H){var $=H.selectorText.replace(new RegExp(R,"gi"),function(G,Z,J){return Z+M(J)});$!==H.selectorText&&k(H,$)}),P(N))})};return v.rewriteCssSelectorWith=function(T,I,M){A(T,[I],function(){return M})},v.lowercaseCssTypeSelectors=function(T,I){A(T,I,function(M){return M.toLowerCase()})},v.findHtmlOnlyNodeNames=function(T){var I=T.ownerDocument.createTreeWalker(T,NodeFilter.SHOW_ELEMENT),M={},R={},N;do N=I.currentNode.tagName.toLowerCase(),I.currentNode.namespaceURI==="http://www.w3.org/1999/xhtml"?M[N]=!0:R[N]=!0;while(I.nextNode());return Object.keys(M).filter(function(B){return!R[B]})},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),d=(function(v,b,x,k){var S={},P=function(J,q,Q,U){var L=J.createElement(q);return L.style.visibility="hidden",L.style.width=Q+"px",L.style.height=U+"px",L.style.position="absolute",L.style.top=-1e4-U+"px",L.style.left=-1e4-Q+"px",J.getElementsByTagName("body")[0].appendChild(L),L},_=function(J){return J>0?new Promise(function(q){setTimeout(q,J)}):Promise.resolve()};S.executeJavascript=function(J,q){return new Promise(function(Q){var U=P(k.document,"iframe",q.width,q.height),L=J.outerHTML,W=[],V=q.executeJsTimeout||0,ee=function(){k.document.getElementsByTagName("body")[0].removeChild(U)},re=function(){var ae=U.contentDocument;Q({document:ae,errors:W,cleanUp:ee})},K=U.contentWindow.XMLHttpRequest,ne=b.finishNotifyingXhr(K),le=b.baseUrlRespectingXhr(ne,q.baseUrl);U.onload=function(){_(V).then(ne.waitForRequestsToFinish).then(re)},U.contentDocument.open(),U.contentWindow.XMLHttpRequest=le,U.contentWindow.onerror=function(ae){W.push({resourceType:"scriptExecution",msg:ae})},U.contentDocument.write("<!DOCTYPE html>"),U.contentDocument.write(L),U.contentDocument.close()})};var E=function(J,q,Q){var U=J.createElement("iframe");return U.style.width=q+"px",U.style.height=Q+"px",U.style.visibility="hidden",U.style.position="absolute",U.style.top=-1e4-Q+"px",U.style.left=-1e4-q+"px",U.style.borderWidth=0,U.sandbox="allow-same-origin",U.scrolling="no",U},A=function(J,q,Q){var U=Math.floor(J/Q),L=Math.floor(q/Q);return E(k.document,U,L)},T=function(J,q,Q,U){return{width:Math.max(J.width*U,q),height:Math.max(J.height*U,Q)}},I=function(J,q){var Q=J.querySelector(q);if(Q)return Q;if(J.ownerDocument.querySelector(q)===J)return J;throw{message:"Clipping selector not found"}},M=function(J,q,Q,U,L){var W=Math.max(J.scrollWidth,J.clientWidth),V=Math.max(J.scrollHeight,J.clientHeight),ee,re,K,ne,le,ae,ue,ye;return q?(ae=I(J,q),ue=ae.getBoundingClientRect(),ee=ue.top,re=ue.left,K=ue.width,ne=ue.height):(ee=0,re=0,K=W,ne=V),ye=T({width:K,height:ne},Q,U,L),le=k.getComputedStyle(J.ownerDocument.documentElement).fontSize,{left:re,top:ee,width:ye.width,height:ye.height,viewportWidth:W,viewportHeight:V,rootFontSize:le}},R=function(J,q){var Q=J.tagName;return q.querySelector(Q)},N=function(J){var q=J.tagName.toLowerCase();return q==="html"||q==="body"?J.outerHTML:'<body style="margin: 0;">'+J.outerHTML+"</body>"};S.calculateDocumentContentSize=function(J,q){return new Promise(function(Q,U){var L=q.zoom||1,W;W=A(q.width,q.height,L),k.document.getElementsByTagName("body")[0].appendChild(W),W.onload=function(){var V=W.contentDocument,ee;try{ee=M(R(J,V),q.clip,q.width,q.height,L),Q(ee)}catch(re){U(re)}finally{k.document.getElementsByTagName("body")[0].removeChild(W)}},W.contentDocument.open(),W.contentDocument.write("<!DOCTYPE html>"),W.contentDocument.write(N(J)),W.contentDocument.close()})},S.parseHtmlFragment=function(J){var q=k.document.implementation.createHTMLDocument("");q.documentElement.innerHTML=J;var Q=q.querySelector("body").firstChild;if(!Q)throw"Invalid source";return Q};var B=function(J,q){var Q=/<html((?:\s+[^>]*)?)>/im.exec(q),U=k.document.implementation.createHTMLDocument(""),L,W,V,ee;if(Q)for(L="<div"+Q[1]+"></div>",U.documentElement.innerHTML=L,V=U.querySelector("div"),W=0;W<V.attributes.length;W++)ee=V.attributes[W],J.documentElement.setAttribute(ee.name,ee.value)};S.parseHTML=function(J){var q=k.document.implementation.createHTMLDocument("");return q.documentElement.innerHTML=J,B(q,J),q};var H=function(J){try{return x.failOnParseError(J)}catch(q){throw{message:"Invalid source",originalError:q}}};S.validateXHTML=function(J){var q=new DOMParser,Q=q.parseFromString(J,"application/xml");H(Q)};var $=null,G=function(J,q){return q==="none"||q==="repeated"?(($===null||q!=="repeated")&&($=Date.now()),J+"?_="+$):J},Z=function(J,q){return new Promise(function(Q,U){var L=new window.XMLHttpRequest,W=v.joinUrl(q.baseUrl,J),V=G(W,q.cache),ee=function(re){U({message:"Unable to load page",originalError:re})};L.addEventListener("load",function(){L.status===200||L.status===0?Q(L.responseXML):ee(L.statusText)},!1),L.addEventListener("error",function(re){ee(re)},!1);try{L.open("GET",V,!0),L.responseType="document",L.send(null)}catch(re){ee(re)}})};return S.loadDocument=function(J,q){return Z(J,q).then(function(Q){return H(Q)})},S})(a,o,n,window),f=(function(){var v={},b=function(I,M){return M?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(M,R){var N=document.createElement("canvas"),B=new Image;B.onload=function(){var H=N.getContext("2d");try{H.drawImage(B,0,0),N.toDataURL("image/png"),M(!0)}catch{M(!1)}},B.onerror=R,B.src=I})},P=function(){var I=b(k,!0);return S(I).then(function(M){return x(I),M?!1:S(b(k,!1)).then(function(R){return R})},function(){return!1})},_=function(){return new Promise(function(I,M){P().then(function(R){I(!R)},function(){M()})})},E,A=function(){return E===void 0&&(E=_()),E},T=function(I){return A().then(function(M){return b(I,M)})};return v.renderSvg=function(I){return new Promise(function(M,R){var N,B,H=function(){B.onload=null,B.onerror=null},$=function(){N&&x(N)};B=new Image,B.onload=function(){H(),$(),M(B)},B.onerror=function(){$(),R()},T(I).then(function(G){N=G,B.src=N},R)})},v})(),p=(function(v,b,x,k){var S={},P=function(R,N){var B=N||1,H={width:R.width,height:R.height,"font-size":R.rootFontSize};return B!==1&&(H.style="transform:scale("+B+"); transform-origin: 0 0;"),H},_=function(R){var N,B,H,$;N=Math.round(R.viewportWidth),B=Math.round(R.viewportHeight),H=-R.left,$=-R.top;var G={x:H,y:$,width:N,height:B};return G},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(B){return B+'="'+R[B]+'"'}).join(" "):""},M=function(R,N,B){var H=k.serializeToString(R);b.validateXHTML(H);var $=_(N);return E($),A($),'<svg xmlns="http://www.w3.org/2000/svg"'+I(P(N,B))+">"+T()+"<foreignObject"+I($)+">"+H+"</foreignObject></svg>"};return S.getSvgForDocument=function(R,N,B){return x.rewriteTagNameSelectorsToLowerCase(R),M(R,N,B)},S.drawDocumentAsSvg=function(R,N){return["hover","active","focus","target"].forEach(function(B){N[B]&&x.fakeUserAction(R,N[B],B)}),b.calculateDocumentContentSize(R,N).then(function(B){return S.getSvgForDocument(R,B,N.zoom)})},S})(a,d,u,r),h=(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(B){throw E(B)}},I=function(R,N,B){return k.drawDocumentAsSvg(R,B).then(A).then(function(H){return N&&T(H.image,N),H})},M=function(R,N){return b.executeJavascript(R,N).then(function(B){var H=B.document;return x.persistInputValues(H),{document:H,errors:B.errors,cleanUp:B.cleanUp}})};return _.rasterize=function(R,N,B){var H;return H=v.clone(B),H.inlineScripts=B.executeJs===!0,P.inlineReferences(R,H).then(function($){return B.executeJs?M(R,B).then(function(G){return{element:G.document.documentElement,errors:$.concat(G.errors),cleanUp:G.cleanUp}}):{element:R,errors:$,cleanUp:function(){}}}).then(function($){return I($.element,N,B).then(function(G){return $.cleanUp(),{image:G.image,svg:G.svg,errors:$.errors}})})},_})(a,d,u,p,f,i),y=(function(v,b,x){var k={},S=function(T,I){var M=300,R=200,N=T?T.width:M,B=T?T.height:R,H=I.width!==void 0?I.width:N,$=I.height!==void 0?I.height:B;return{width:H,height:$}},P=function(T){var I=S(T.canvas,T.options),M;return M=v.clone(T.options),M.width=I.width,M.height=I.height,M};k.drawDocument=function(){var T=arguments[0],I=Array.prototype.slice.call(arguments,1),M=v.parseOptionalParameters(I),R=T.documentElement?T.documentElement:T;return x.rasterize(R,M.canvas,P(M))};var _=function(T,I,M){var R=b.parseHTML(T);return k.drawDocument(R,I,M)};k.drawHTML=function(){var T=arguments[0],I=Array.prototype.slice.call(arguments,1),M=v.parseOptionalParameters(I);return _(T,M.canvas,M.options)};var E=function(T,I,M){var R=document.implementation.createHTMLDocument("");R.replaceChild(T.documentElement,R.documentElement);var N=M?v.clone(M):{};return M.baseUrl||(N.baseUrl=I),{document:R,options:N}},A=function(T,I,M){return b.loadDocument(T,M).then(function(R){var N=E(R,T,M);return k.drawDocument(N.document,I,N.options)})};return k.drawURL=function(){var T=arguments[0],I=Array.prototype.slice.call(arguments,1),M=v.parseOptionalParameters(I);return A(T,M.canvas,M.options)},k})(a,d,h);return y})})(_g)),_g.exports}var vI=yI();function bI(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(d=>{const f=d.split(":")[1].trim();f==="bold"?r.add("700"):f==="normal"?r.add("400"):/^\d+$/.test(f)&&r.add(f)}),(e.match(/font-style:\s*(italic|normal)/gi)||[]).forEach(d=>{d.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=li(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(d=>d.codePointAt(0)).filter(d=>d!==void 0),u=t.split(/}\s*/).map(d=>d&&d+"}").filter(d=>/@font-face/.test(d)&&(f=>{const p=(f.match(/font-weight:\s*(\d+)/)||[])[1];if(p&&!a.has(p)||/font-style:\s*italic/.test(f)&&!o)return!1;const h=f.match(/unicode-range:\s*([^;]+);/);if(!h)return!0;const y=h[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))})(d)).join(`
|
|
149
|
+
`);return u?`<style>${u}</style>`:""}const Ep=`
|
|
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
|
+
`,wI=`
|
|
229
|
+
<style>
|
|
230
|
+
html, body {
|
|
231
|
+
padding: 0;
|
|
232
|
+
margin: 0;
|
|
233
|
+
}
|
|
234
|
+
${Ep}
|
|
235
|
+
</style>
|
|
236
|
+
`;let Ql;const Gk=()=>(Ql||(Ql=document.createElement("div"),Ql.id="polotno-hidden-do-not-touch",Ql.style.overflow="hidden",Ql.style.position="relative",document.body.appendChild(Ql),Ql.innerHTML=`<style>#polotno-hidden-do-not-touch {${Ep}}</style>`),Ql);navigator.userAgent.includes("Firefox");function xI({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=Gk();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 V4(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=Gk();r.appendChild(e);const n=e.getBoundingClientRect();return r.removeChild(e),{width:n.width,height:n.height}}const SI={},Ky={},Qy=new Map;async function W4({html:t,width:e,height:r,fontFamily:n,padding:i,font:a,pixelRatio:o}){let s="";if(n!=="Arial"&&!a){const v=lC();s=await(async function(b,x){const k=`${b}|${x}`;if(Qy.has(k))return Qy.get(k);const S=`https://fonts.googleapis.com/css?family=${b}:${x}&display=swap`,P=await(await fetch(S)).text();return Qy.set(k,P),P})(n,v)}if(a){const v=a.styles||(a.url?[{src:`url("${a.url}")`}]:(b=>{if(Ky[b])return Ky[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 Ky[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=bI(s,t)),t+=u+wI;const d=e+2*i,f=r+2*i,p=document.createElement("canvas"),h=await vI.drawHTML(`<div style="padding: ${i}px;" dir="auto">${t}</div>`,p,{width:d,height:f,cacheBucket:SI});$2(p,d*o,f*o);const y=p.getContext("2d");return y?.drawImage(h.image,0,0,d,f,0,0,p.width,p.height),p}let kI={data:""},_I=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||kI,PI=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,EI=/\/\*[^]*?\*\/|\s\s+|\n/g,nu=(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"?nu(o,a):a+"{"+nu(o,a[1]=="k"?"":e)+"}":typeof o=="object"?n+=nu(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+=nu.p?nu.p(a,o):a+":"+o+";")}return r+(e&&i?e+"{"+i+"}":i)+n},Nh={},Xk=t=>{if(typeof t=="object"){let e="";for(let r in t)e+=r+Xk(t[r]);return e}return t},TI=(t,e,r,n,i)=>{let a=Xk(t),o=Nh[a]||(Nh[a]=(s=>{let u=0,d=11;for(;u<s.length;)d=101*d+s.charCodeAt(u++)>>>0;return"go"+d})(a));if(!Nh[o]){let s=a!==t?t:(u=>{let d,f=[{}];for(;d=PI.exec(u.replace(EI,""));)d[4]?f.shift():d[3]?f.unshift(f[0][d[3]]=f[0][d[3]]||{}):f[0][d[1]]=d[2];return f[0]})(t);Nh[o]=nu(i?{["@keyframes "+o]:s}:s,r?"":"."+o)}return((s,u,d)=>{u.data.indexOf(s)==-1&&(u.data=d?s+u.data:u.data+s)})(Nh[o],e,n),o};function X2(t){let e=this||{},r=t.call?t(e.p):t;return TI(r.unshift?r.raw?((n,i,a)=>n.reduce((o,s,u)=>{let d=i[u];if(d&&d.call){let f=d(a),p=f&&f.props&&f.props.className||/^go/.test(f)&&f;d=p?"."+p:f&&typeof f=="object"?f.props?"":nu(f,""):f===!1?"":f}return o+s+(d??"")},""))(r,[].slice.call(arguments,1),e.p):r.reduce((n,i)=>Object.assign(n,i&&i.call?i(e.p):i),{}):r,_I(e.target),e.g,e.o,e.k)}let Yk,Qv,Zv;X2.bind({g:1});X2.bind({k:1});function CI(t,e,r,n){nu.p=e,Yk=t,Qv=r,Zv=n}function Dd(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:Qv&&Qv()},s),r.o=/ *go\d+/.test(u),s.className=X2.apply(r,n)+(u?" "+u:""),e&&(s.ref=o);let d=t;return t[0]&&(d=s.as||t,delete s.as),Zv&&d[0]&&Zv(s),Yk(d,s)}return e?e(i):i}}CI(X.createElement,void 0,void 0,void 0);function Kk(t,e){if(e===1)return t;const r=Et.Util.colorToRGBA(t);return r?`rgba(${r.r}, ${r.g}, ${r.b}, ${r.a*e})`:t}function G4(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 uc=Yt({enabled:!1,currentFormat:{},editor:Yt.object({instance:null},{},{deep:!1})}),Qk=Dd("div",X.forwardRef)`
|
|
244
|
+
.ql-editor {
|
|
245
|
+
outline: none;
|
|
246
|
+
}
|
|
247
|
+
.ql-clipboard {
|
|
248
|
+
pointer-events: none;
|
|
249
|
+
opacity: 0;
|
|
250
|
+
}
|
|
251
|
+
${Ep}
|
|
252
|
+
strong {
|
|
253
|
+
font-weight: 700;
|
|
254
|
+
}
|
|
255
|
+
.ql-direction-rtl {
|
|
256
|
+
direction: rtl;
|
|
257
|
+
}
|
|
258
|
+
`;let OI=["bold","color","font","italic","size","strike","underline","indent","list","direction"];const X4=(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()},AI=({html:t,onBlur:e,onChange:r,element:n,clickCoords:i})=>{var a;const o=X.useRef(null);X.useEffect(()=>{if(!o.current)return;const d=(f=o.current,new Nk(f,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1},formats:OI}));var f;Ca(()=>{uc.editor.instance=d}),window.__polotnoQuill=d,d.on("text-change",()=>{d.getSelection()&&Ca(()=>{uc.currentFormat=d.getFormat(d.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(G4(x))},10)}),X4(d,t),i?MI(d,i):d.setSelection(0,0,"api"),d.on("selection-change",(v,b,x)=>{v&&Ca(()=>{uc.currentFormat=d.getFormat(d.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 p=o.current.childNodes[0],h=v=>{var b,x;const k=d.getSelection();if(!k||k.length===0)return;const S=d.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=>{h(v);const b=d.getSelection();b&&b.length>0&&d.deleteText(b.index,b.length)};return p.addEventListener("copy",h),p.addEventListener("cut",y),()=>{p.removeEventListener("copy",h),p.removeEventListener("cut",y),Ca(()=>{uc.editor.instance=null,uc.currentFormat={}}),delete window.__polotnoQuill}},[]),X.useEffect(()=>DS(()=>n.text,()=>{var d,f;const p=uc.editor.instance;if(!p)return;const h=p.getSelection(),y=(f=(d=o.current)===null||d===void 0?void 0:d.childNodes)===null||f===void 0?void 0:f[0];G4(y?.innerHTML||"")===n.text||(X4(p,t),h&&(p.setSelection(h.index,h.length),Ca(()=>{uc.currentFormat=p.getFormat(p.getSelection())})))},{fireImmediately:!0}),[]),X.useEffect(()=>{window.addEventListener("blur",e);const d=f=>{var p;!((p=o.current)===null||p===void 0)&&p.contains(f.target)||e()};return window.addEventListener("touchstart",d),()=>{window.removeEventListener("blur",e),window.removeEventListener("touchstart",d)}},[]);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=Ok(n);return X.createElement(Qk,{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 ${Kk(n.shadowColor,(a=n.shadowOpacity)!==null&&a!==void 0?a:1)}`:void 0,caretColor:u}),dir:xp(li(n.text))})};function II(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 Y4=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),RI=Pr(({element:t,store:e})=>{var r,n;const i=X.useRef(null),[a,o]=X.useState(),[s,u]=X.useState(!1),[d,f]=X.useState(!1),p=X.useRef(t.height),h=e.selectedShapes.indexOf(t)>=0&&t.selectable,y=Yg(h),v=t.fontSize/3,{textVerticalResizeEnabled:b}=dr,x=dr.autoDeleteEmptyText,k=Yg(t.fontFamily),[S]=Ak(e,t.fontFamily,t.fontStyle,t.fontWeight),P=t._editModeEnabled;Up(i);const _=S?t.fontFamily:k!==t.fontFamily?k:"Arial",E=Zo(t).fill,A=z1(t,{fontFamily:_,color:E}),T=z1(t,{fontFamily:_,color:E,forEditor:!0}),I=X.useRef([]),[,M]=X.useReducer(K=>K+1,0);X.useEffect(()=>{const K=I.current;K.length>0&&(I.current=[],K.forEach(ne=>ne()))});let{width:R,height:N}=(function(K,ne,le){return X.useMemo(()=>V4(K),[K,ne.width,le])})(A,t,S);X.useEffect(()=>{if(!S)return;const K=(le,ae,ue,ye)=>{const Ie=Jo(`text ${t.id}`),Le=()=>{e.history.ignore(le,ae,ue).then(()=>{I.current.push(Ie),M()})};ye?queueMicrotask(Le):Le()};if(!t.height)return void K(()=>{t.height||t.set({height:N})},void 0,void 0,!0);const{textOverflow:ne}=dr;if(ne!=="change-font-size"||s)ne==="resize"&&(b&&t.height<N&&!s&&K(()=>{t.set({height:N})},!1,!0),b||t.height===N||K(()=>{t.set({height:N})},!1,!0));else{const le=(ae=>{let ue=ae.fontSize;for(let ye=1;ye<50;ye++){const Ie=z1(Object.assign(Object.assign({},ae.toJSON()),{fontSize:ue}),{fontFamily:ae.fontFamily}),{height:Le}=V4(Ie);if(!(ae.height&&Le>ae.height||!dr.textSplitAllowed&&!ae.curveEnabled&&xI({html:Ie})))break;ue-=.5}return ue})(t);le!==t.fontSize?K(()=>{t.set({fontSize:le})},!1,!0):t.height!==N&&(b&&t.height<N?K(()=>{t.set({height:N})},!1,!0):b||K(()=>{t.set({height:N})},!1,!0))}});const B=X.useMemo(()=>{const K={lastArgs:null,lastResult:null};return async function(ne){return K.lastArgs&&K.lastResult&&(le=K.lastArgs,ae=ne,JSON.stringify(le)===JSON.stringify(ae))||(K.lastResult=await W4(ne),K.lastArgs=Object.assign({},ne)),K.lastResult;var le,ae}},[]),H=X.useRef(0),$=X.useRef(null);X.useEffect(()=>{s||P||(async()=>{H.current++;const K=H.current;let ne=Jo(`text ${t.id} ${K}`);$.current&&$.current(),$.current=ne,f(!0);let le=null;const ae=Y4?5:1;for(let ue=0;ue<ae;ue++){const ye=ue>0?B:W4;try{if(le=await ye({skipCache:ue>0,html:A,width:t.width||1,height:t.height||N||1,fontFamily:_,padding:v,pixelRatio:e._elementsPixelRatio,font:e.fonts.find(Ie=>Ie.fontFamily===_)||L2.find(Ie=>Ie.fontFamily===_)}),K!==H.current)return;if(Y4&&le&&II(le)){await new Promise(Ie=>setTimeout(Ie,50*(ue+1)));continue}break}catch(Ie){console.error(Ie),Rd(`Error rendering rich text with id ${t.id}`);break}}le?o(le):ne?(ne(),ne=null):console.error("Finish function is called twice!"),f(!1)})()},[A,s,N,P,_,t.height,e._elementsPixelRatio,S]);const[G,Z]=Kv(d,300),[J]=Kv(s,300,!0),q=J||G;X.useEffect(()=>{var K;if(!q)return so(()=>{const ne=i.current;ji(ne,t)});(K=i.current)===null||K===void 0||K.clearCache()},[a,q,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]),X.useEffect(()=>{a&&!d&&$.current&&($.current(),$.current=null)},[a,d]),X.useLayoutEffect(()=>{if(!S||!t.curveEnabled)return;const K=new Et.TextPath({data:Tc(t.a.width,t.a.height,t.curvePower,t.a.fontSize),text:li(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}),ne=K.getSelfRect().width;if(ne){const le=ne-t.a.width,ae=t.a.rotation*Math.PI/180,ue=-le/2*Math.cos(ae),ye=-le/2*Math.sin(ae);t.set({width:ne,x:t.a.x+ue,y:t.a.y+ye})}K.destroy()},[S,t.curveEnabled,t.curvePower,t.text,t.fontSize,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing]),X.useEffect(()=>()=>{$.current&&$.current()},[]),X.useEffect(()=>{y&&!h&&x&&li(t.text)===""&&t.removable&&!t.placeholder&&e.deleteElements([t.id])},[x,t.placeholder,t.removable,t.text,h,y]);let Q=0;t.verticalAlign==="middle"&&(Q=(t.height-N)/2),t.verticalAlign==="bottom"&&(Q=t.height-N);const U=Ik({fontLoaded:S,fontFamily:t.fontFamily,fontSize:t.fontSize,lineHeight:t.lineHeight}),L=_u(),W=Tc(t.a.width,N,t.curvePower,t.fontSize),V=X.useRef(null),ee=X.useRef(null),re=P&&t.strokeWidth>0&&!t.curveEnabled;return X.createElement(X.Fragment,null,X.createElement(ur,{x:t.a.x,y:t.a.y,offsetX:t.backgroundPadding*(t.fontSize*U*.5),offsetY:t.backgroundPadding*(t.fontSize*U*.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*U),height:t.a.height+t.backgroundPadding*(t.fontSize*U),cornerRadius:t.backgroundCornerRadius*(t.fontSize*U*.5)}),X.createElement(bp,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,data:W,stroke:"red",strokeWidth:1,visible:!1}),X.createElement(ur,{ref:i,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:!q,draggable:L?t.draggable&&h:t.draggable,preventDefault:!L||h,opacity:P?0:t.a.opacity,hideInExport:!t.showInExport,onDragMove:K=>{t.set({x:K.target.x(),y:K.target.y()})},onDragEnd:K=>{t.set({x:K.target.x(),y:K.target.y()})},id:t.id,onDblClick:K=>{t.contentEditable&&(ee.current={x:K.evt.clientX,y:K.evt.clientY},t.toggleEditMode(!0))},onDblTap:K=>{var ne;if(t.contentEditable){const le=(ne=K.evt.changedTouches)===null||ne===void 0?void 0:ne[0];ee.current=le?{x:le.clientX,y:le.clientY}:null,t.toggleEditMode(!0)}},onTransformStart:K=>{u(!0),p.current=t.height},onTransform:K=>{var ne;const le=K.target,ae=((ne=le.getStage())===null||ne===void 0?void 0:ne.findOne("Transformer")).getActiveAnchor(),ue=ae==="middle-left"||ae==="middle-right",ye=ae==="top-center"||ae==="bottom-center",Ie=le.scaleX();if(ue){const Le=le.scaleX(),Ue=le.width()*Le,$e=t.fontSize;let rt=Ue;if(Ue<$e&&(rt=$e,V.current&&le.position(V.current)),le.width(rt),le.scaleX(1),dr.textVerticalResizeEnabled){const Se=Math.max(N,p.current);t.set({height:Se})}t.set({width:le.width(),x:le.x(),y:le.y()})}else if(ye){const Le=dr.textOverflow==="resize",Ue=typeof t.lineHeight=="number"?t.lineHeight:1;let $e=Le?N:Ue*t.fontSize;const rt=Math.max($e,K.target.height()*K.target.scaleY());le.scaleY(1),t.set({x:le.x(),y:le.y(),height:rt,rotation:le.rotation()})}else le.scaleX(1),le.scaleY(1),t.set({fontSize:t.fontSize*Ie,letterSpacing:t.letterSpacing,width:le.width()*Ie,x:le.x(),y:le.y(),rotation:le.rotation(),height:le.height()*Ie});V.current=K.target.position()},onTransformEnd:K=>{u(!1),f(!0);const ne=K.target.scaleX();K.target.scaleX(1),K.target.scaleY(1),t.set({fontSize:t.fontSize*ne,width:K.target.width()*ne,x:K.target.x(),y:K.target.y(),rotation:K.target.rotation(),shadowBlur:t.shadowBlur*ne,shadowOffsetX:t.shadowOffsetX*ne,shadowOffsetY:t.shadowOffsetY*ne,strokeWidth:t.strokeWidth*ne})}}),X.createElement(Vo,{ref:i,image:a,x:t.a.x,y:t.a.y,offsetX:v,offsetY:v-Q,listening:!1,rotation:t.a.rotation,width:t.a.width+2*v,height:(t.a.width+2*v)*(((r=a?.height)!==null&&r!==void 0?r:0)/(a?.width||1)||1),visible:!q&&!P,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||s||q}),(q||re)&&X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,offsetY:-Q},X.createElement(qg,{divProps:{style:{pointerEvents:"none"}}},X.createElement(Qk,{dangerouslySetInnerHTML:{__html:A},style:{pointerEvents:"none",opacity:t.a.opacity,textShadow:t.shadowEnabled?`${t.shadowOffsetX}px ${t.shadowOffsetY}px ${t.shadowBlur}px ${Kk(t.shadowColor,(n=t.shadowOpacity)!==null&&n!==void 0?n:1)}`:void 0}}))),P&&X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,offsetY:-Q},X.createElement(qg,null,X.createElement(AI,{html:T,element:t,onChange:K=>{const ne=Ck({oldText:li(t.text),newText:li(K),element:t});t.set({text:K,fontSize:ne})},onBlur:K=>{t.toggleEditMode(!1),Z(!0)},clickCoords:ee.current}))))});function MI(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=Nk.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 Y2(t){return t/180*Math.PI}function pg(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 Nd(t){const{x:e,y:r,width:n,height:i}=t,a=Y2(t.rotation),o=pg(e,r,0,0,a),s=pg(e,r,n,0,a),u=pg(e,r,n,i,a),d=pg(e,r,0,i,a),f=Math.min(o.x,s.x,u.x,d.x),p=Math.min(o.y,s.y,u.y,d.y),h=Math.max(o.x,s.x,u.x,d.x),y=Math.max(o.y,s.y,u.y,d.y);return{x:f,y:p,width:h-f,height:y-p,minX:f,minY:p,maxX:h,maxY:y}}function T0(t){const e=t.map(o=>Nd(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 DI(t){const e=Y2(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 NI(t,e,r){const n=Y2(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 LI(t,e){return NI(t,e,DI(t))}const Pi={stroke:"rgb(0, 161, 255)",strokeWidth:1,dash:[4,6]},FI=({stroke:t,strokeWidth:e,dash:r})=>{t!==void 0&&(Pi.stroke=t),e!==void 0&&(Pi.strokeWidth=e),r!==void 0&&(Pi.dash=r)};let K4=({targetKonvaNodes:t,guideKonvaNode:e,distance:r,snapDirection:n})=>r<5;function Jv(t,e){var r=[],n=[];t.vertical.forEach(d=>{e.vertical.forEach(f=>{var p=Math.abs(d.offset-f.guide);K4({targetKonvaNodes:f.nodes,guideKonvaNode:d.node,distance:p,snapDirection:d.snap})&&r.push({lineGuide:d.offset,diff:p,snap:f.snap,offset:f.offset})})}),t.horizontal.forEach(d=>{e.horizontal.forEach(f=>{var p=Math.abs(d.offset-f.guide);K4({targetKonvaNodes:f.nodes,guideKonvaNode:d.node,distance:p,snapDirection:d.snap})&&n.push({lineGuide:d.offset,diff:p,snap:f.snap,offset:f.offset})})});var i=[];const a=r.sort((d,f)=>d.diff-f.diff),o=n.sort((d,f)=>d.diff-f.diff);var s=a[0],u=o[0];return s&&a.filter(d=>Math.abs(d.diff-s.diff)<.1).forEach(d=>{i.push(Object.assign({orientation:"V"},d))}),u&&o.filter(d=>Math.abs(d.diff-u.diff)<.1).forEach(d=>{i.push(Object.assign({orientation:"H"},d))}),i}const Zk=()=>{if(Et.DD._dragElements.size===0)return;const t=[...Et.DD._dragElements.entries()],e=t.find(([r,n])=>n.node instanceof Et.Transformer);e&&(t.splice(t.indexOf(e),1),t.unshift(e),Et.DD._dragElements.clear(),t.forEach(([r,n])=>{Et.DD._dragElements.set(r,n)}))};function BI(t,e,r){const n=X.useRef(null);r&&FI(r);const i=f=>f.hasName("element")||f.hasName("page-background")||!n.current&&f.hasName("elements-area");function a(f){var p;const h=(p=t.current)===null||p===void 0?void 0:p.getStage(),y=[],v=[];return h.find(i).forEach(b=>{if(!(f.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(f){var p;const h=(p=t.current)===null||p===void 0?void 0:p.getLayer(),y=h?.children.find(v=>v.name()==="line-guides");f.forEach(v=>{if(v.orientation==="H"){var b=new Et.Line({x:-h.getStage().x(),y:-h.getStage().y(),points:[-6e3,v.lineGuide,6e3,v.lineGuide],stroke:Pi.stroke,strokeWidth:Pi.strokeWidth,name:"guid-line",dash:Pi.dash});y?.add(b),h.batchDraw()}else v.orientation==="V"&&(b=new Et.Line({x:-h.getStage().x(),y:-h.getStage().y(),points:[v.lineGuide,-6e3,v.lineGuide,6e3],stroke:Pi.stroke,strokeWidth:Pi.strokeWidth,name:"guid-line",dash:Pi.dash}),y?.add(b))})}const s=f=>{const p=f.target.getLayer().children.find(P=>P.name()==="line-guides");p?.destroyChildren();var h=a(f.target.nodes()),y=(function(P){const _=P.__getNodeRect(),E=Nd(Object.assign(Object.assign({},_),{rotation:Et.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()}]}})(f.target),v=Jv(h,y);if(!v.length)return;o(v);const b=f.target.getAbsolutePosition(),x=(f.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;f.evt.ctrlKey||f.evt.metaKey||f.target.nodes().forEach(P=>{const _=P.getAbsolutePosition();P.setAbsolutePosition({x:_.x+k,y:_.y+S})})},u=(f,p,h)=>{var y;const v=t.current,b=v.getLayer().children.find(I=>I.name()==="line-guides");if(b?.destroyChildren(),v.getActiveAnchor()==="rotater")return p;const x=v.getActiveAnchor(),k=zI[x],S=(y=v.findOne(`.${k}`))===null||y===void 0?void 0:y.getAbsolutePosition();if(!S)return p;const P={x:f.x-S.x,y:f.y-S.y},_=(function(I,M){const R=Z4(I,M)/Z4(M,M);return{x:R*M.x,y:R*M.y}})({x:p.x-f.x,y:p.y-f.y},P);if(Math.sqrt(Math.pow(_.x,2)+Math.pow(_.y,2))>5)return p;const E={x:f.x+_.x,y:f.y+_.y};var A=Jv(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),h.ctrlKey||h.metaKey))return p;const T=[];if(A.forEach(I=>{const M=(function(R,N,B){if(B.orientation==="V"){const H=B.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=B.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});M&&T.push(M)}),T.length>0){let I=T[0],M=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<M&&(M=N,I=R)}),M<10)return I}return E},d=f=>{if(!f.target)return;const p=f.target.getLayer(),h=p.children.find(y=>y.name()==="line-guides");h?.destroyChildren(),p.batchDraw()};X.useEffect(()=>{t.current&&(t.current.anchorDragBoundFunc(u),t.current.on("dragstart",f=>{setTimeout(()=>{Zk()})}),t.current.on("dragmove",s),t.current.on("dragend",d),t.current.on("transformend",d),t.current.on("transform",f=>{var p,h;f.evt.ctrlKey||f.evt.metaKey?(p=t.current)===null||p===void 0||p.rotationSnapTolerance(0):(h=t.current)===null||h===void 0||h.rotationSnapTolerance(5)}))},[])}function Q4(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,d=Jv((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(!d.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 Et.Line({x:-x.getStage().x(),y:-x.getStage().y(),points:[-6e3,S.lineGuide,6e3,S.lineGuide],stroke:Pi.stroke,strokeWidth:Pi.strokeWidth,name:"guid-line",dash:Pi.dash});k?.add(P),x.batchDraw()}else S.orientation==="V"&&(P=new Et.Line({x:-x.getStage().x(),y:-x.getStage().y(),points:[S.lineGuide,-6e3,S.lineGuide,6e3],stroke:Pi.stroke,strokeWidth:Pi.strokeWidth,name:"guid-line",dash:Pi.dash}),k?.add(P))})})(d);const f=o.target.getAbsolutePosition(),p=Object.assign({},f);d.forEach(v=>{switch(v.snap){case"start":case"center":case"end":switch(v.orientation){case"V":p.x=v.lineGuide+v.offset;break;case"H":p.y=v.lineGuide+v.offset}}});const h=p.x-f.x,y=p.y-f.y;if(!o.evt.ctrlKey&&!o.evt.metaKey){const v=o.target.getAbsolutePosition();o.target.absolutePosition({x:v.x+h,y:v.y+y})}},a=o=>{if(!o.target)return;const s=o.target.getLayer(),u=s.children.find(d=>d.name()==="line-guides");u?.destroyChildren(),s.batchDraw()};X.useEffect(()=>{t.current&&(t.current.on("dragmove",i),t.current.on("dragend",a))},r)}function Z4(t,e){return t.x*e.x+t.y*e.y}const zI={"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 jI(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 J4(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 ex=(t,e)=>{const r=Hs.anchorSize||10;return{offsetX:r/2/t,offsetY:r/2/t,width:r/t,height:r/t,cornerRadius:(Hs.anchorCornerRadius||0)/t,fill:Hs.anchorFill||"white",stroke:Hs.anchorStroke||"rgb(0, 161, 255)",strokeWidth:Hs.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()}}},tx=Pr(({element:t,type:e})=>{const r=Zo(t,t.a.color,"fill"),n=Zo(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 X.createElement(X.Fragment,null,e==="arrow"&&X.createElement($s,Object.assign({points:[3*t.height,2*-t.height,0,0,3*t.height,2*t.height]},i)),e==="triangle"&&X.createElement($s,Object.assign({points:[3*t.height,2*-t.height,0,0,3*t.height,2*t.height],closed:!0},i)),e==="bar"&&X.createElement($s,Object.assign({points:[0,2*-t.height,0,2*t.height],closed:!0},i)),e==="square"&&X.createElement($s,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"&&X.createElement(DT,Object.assign({x:2*t.height,y:0,radius:2*t.height},i)))}),UI=Pr(({element:t,store:e})=>{const r=X.useRef(null),n=X.useRef(null),i=X.useRef(null),a=t.selectable||e.role==="admin",o=_u(),s=e.selectedElements.indexOf(t)>=0&&e.selectedElements.length===1,u=e.selectedShapes.indexOf(t)>=0&&t.selectable,{middleLeft:d,middleRight:f}=jI(t);Q4(n,[r],[s]),Q4(i,[r],[s]);const p=Zo(t,t.a.color,"stroke");return X.createElement(X.Fragment,null,X.createElement($s,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(h=>h*t.a.height)},p,{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:h=>{t.set({x:h.target.x(),y:h.target.y()})},onDragEnd:h=>{t.set({x:h.target.x(),y:h.target.y()})},onTransform:h=>{const y=h.target.scaleX();h.target.scaleX(1),h.target.scaleY(1),t.set({height:t.height*y,width:t.width*y,x:h.target.x(),y:h.target.y(),rotation:h.target.rotation()})}})),X.createElement(Zt,{x:d.x,y:d.y,rotation:t.rotation,hideInExport:!t.showInExport,onClick:h=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("click",h)},onTap:h=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("tap",h)}},X.createElement(tx,{element:t,type:t.startHead})),X.createElement(Zt,{x:f.x,y:f.y,rotation:t.rotation+180,onClick:h=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("click",h)},onTap:h=>{var y;return(y=r.current)===null||y===void 0?void 0:y.fire("tap",h)}},X.createElement(tx,{element:t,type:t.endHead})),s&&t.resizable&&X.createElement(N2,{selector:".page-abs-container",enabled:!0},X.createElement(Zt,{visible:s},X.createElement(ur,Object.assign({x:d.x,y:d.y,ref:n,name:"line-anchor"},ex(e.scale,e),{onDragMove:h=>{const y=J4(h.target.position(),f,t.height);t.set({x:y.x,y:y.y,width:y.width,rotation:y.rotation})}})),X.createElement(ur,Object.assign({x:f.x,y:f.y,ref:i,name:"line-anchor"},ex(e.scale,e),{onDragMove:h=>{const y=J4(d,h.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 Jk=t=>{const e=(t%360+360)%360;if(e===0||e===90||e===180||e===270)return e;throw new Error(`Invalid rotation ${t}.`)},ui=t=>t&&t[t.length-1],bL=t=>t>=0&&t<2**32;class jr{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 jr(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)},qs=t=>{const e=tt(t);return(e&1)===0?-(e>>1):e+1>>1},du=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),$r=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),La=new TextDecoder,wL=new TextEncoder,K2=t=>Object.fromEntries(Object.entries(t).map(([e,r])=>[r,e])),Q2={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},Kg=K2(Q2),Z2={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Qg=K2(Z2),J2={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Zg=K2(J2),xL=t=>!!t&&!!t.primaries&&!!t.transfer&&!!t.matrix&&t.fullRange!==void 0,C0=t=>t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||ArrayBuffer.isView(t);class qp{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 rx=t=>[...t].map(e=>e.toString(16).padStart(2,"0")).join(""),nx=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),Vp=(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},cr=(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},ix=(t,e,r)=>{const n=cr(t,r(e),r);t.splice(n+1,0,e)},na=()=>{let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},e8=(t,e)=>{for(let r=t.length-1;r>=0;r--)if(e(t[r]))return t[r]},eb=(t,e)=>{for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1},HI=async function*(t){Symbol.iterator in t?yield*t[Symbol.iterator]():yield*t[Symbol.asyncIterator]()},$I=t=>{if(!(Symbol.iterator in t)&&!(Symbol.asyncIterator in t))throw new TypeError("Argument must be an iterable or async iterable.")},Tp=t=>{throw new Error(`Unexpected value: ${t}`)},O0=(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},qI=(t,e,r)=>O0(t,e,r)<<8>>8,t8=(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))},SL=(t,e,r,n)=>{r=hd(r,-8388608,8388607),r<0&&(r=r+16777216&16777215),t8(t,e,r,n)},Jg=(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}}),hd=(t,e,r)=>Math.max(e,Math.min(r,t)),Da="und",Cp=t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t},r8=(t,e)=>Math.round(t/e)*e,VI=t=>{let e=0;for(;t;)e++,t>>=1;return e},WI=/^[a-z]{3}$/,n8=t=>WI.test(t),au=1e6*(1+Number.EPSILON),ax=(t,e)=>{const r={...t,...e};if(t.headers||e.headers){const n=t.headers?ox(t.headers):{},i=e.headers?ox(e.headers):{},a={...n};Object.entries(i).forEach(([o,s])=>{const u=Object.keys(a).find(d=>d.toLowerCase()===o.toLowerCase());u&&delete a[u],a[o]=s}),r.headers=a}return r},ox=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},sx=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}},kL=(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),d=u*a+n,f=u*o+i;if(f>e)return{numerator:r*a,denominator:o};if(n=a,i=o,a=d,o=f,s=1/(s-u),!isFinite(s))break}return{numerator:r*a,denominator:o}};class i8{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let Zy=null;const Eg=()=>Zy!==null?Zy:Zy=!!(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 Jy=null;const e2=()=>Jy!==null?Jy:Jy=typeof navigator<"u"&&navigator.userAgent?.includes("Firefox");let ev=null;const t2=()=>ev!==null?ev:ev=!!(typeof navigator<"u"&&(navigator.vendor?.includes("Google Inc")||/Chrome/.test(navigator.userAgent)));let tv=null;const GI=()=>{if(tv!==null)return tv;if(typeof navigator>"u")return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?tv=Number(t[1]):null},Gf=(t,e)=>t!==-1?t:e,r2=(t,e,r,n)=>t<=n&&r<=e,_L=function*(t){for(const e in t){const r=t[e];r!==void 0&&(yield{key:e,value:r})}},XI=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},a8=()=>{Symbol.dispose??=Symbol("Symbol.dispose")},o8=t=>typeof t=="number"&&!Number.isNaN(t);class cp{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 s8{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 PL=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 cp)&&!(e instanceof s8))throw new TypeError("Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, or null.")}},Eu={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1},EL=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 TL=["avc","hevc","vp9","av1","vp8"],Qs=["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"],YI=["aac","opus","mp3","vorbis","flac"],CL=[...YI,...Qs],OL=["webvtt"],e0=[{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}],lx=[{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}],ou=[{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}],ux=[{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}],cx=".01.01.01.01.00",fx=".0.110.01.01.01.0",AL=(t,e,r,n)=>{if(t==="avc"){const a=Math.ceil(e/16)*Math.ceil(r/16),o=e0.find(p=>a<=p.maxMacroblocks&&n<=p.maxBitrate)??ui(e0),s=o?o.level:0,u="64".padStart(2,"0"),d="00",f=s.toString(16).padStart(2,"0");return`avc1.${u}${d}${f}`}else if(t==="hevc"){const s=e*r,u=lx.find(f=>s<=f.maxPictureSize&&n<=f.maxBitrate)??ui(lx);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.${(ou.find(u=>a<=u.maxPictureSize&&n<=u.maxBitrate)??ui(ou)).level.toString().padStart(2,"0")}.08`}else if(t==="av1"){const a=e*r,o=ux.find(d=>a<=d.maxPictureSize&&n<=d.maxBitrate)??ui(ux);return`av01.0.${o.level.toString().padStart(2,"0")}${o.tier}.08`}}throw new TypeError(`Unhandled codec '${t}'.`)},IL=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,d=o.slice(-1)==="H"?1:0,p=Number(e[3])===8?0:1,h=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=(d<<7)+(p<<6)+(h<<5)+(y<<4)+(v<<3)+(b<<2)+x;return[i,u,k,0]},tb=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}.${rx(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}.${rx(r.subarray(1,4))}`}else if(e==="hevc"){let u,d,f,p,h,y;if(a)u=a.generalProfileSpace,d=a.generalProfileIdc,f=nx(a.generalProfileCompatibilityFlags),p=a.generalTierFlag,h=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=$r(r),x=b.getUint8(1);u=x>>6&3,d=x&31,f=nx(b.getUint32(2)),p=x>>5&1,h=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]+d,v+=".",v+=f.toString(16).toUpperCase(),v+=".",v+=p===0?"L":"H",v+=h;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=ui(ou).level;for(const P of ou)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"),d=o.level.toString().padStart(2,"0"),f=o.bitDepth.toString().padStart(2,"0"),p=o.chromaSubsampling.toString().padStart(2,"0"),h=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}.${d}.${f}.${p}`;return x+=`.${h}.${y}.${v}.${b}`,x.endsWith(cx)&&(x=x.slice(0,-cx.length)),x}else if(e==="av1"){if(!s){const P=t.width*t.height;let _=ui(ou).level;for(const E of ou)if(P<=E.maxPictureSize){_=E.level;break}return`av01.0.${_.toString().padStart(2,"0")}M.08`}const u=s.profile,d=s.level.toString().padStart(2,"0"),f=s.tier?"H":"M",p=s.bitDepth.toString().padStart(2,"0"),h=s.monochrome?"1":"0",y=100*s.chromaSubsamplingX+10*s.chromaSubsamplingY+1*(s.chromaSubsamplingX&&s.chromaSubsamplingY?s.chromaSamplePosition:0),v=n?.primaries?Q2[n.primaries]:1,b=n?.transfer?Z2[n.transfer]:1,x=n?.matrix?J2[n.matrix]:1,k=n?.fullRange?1:0;let S=`av01.${u}.${d}${f}.${p}`;return S+=`.${h}.${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(fx)&&(S=S.slice(0,-fx.length)),S}}throw new TypeError(`Unhandled codec '${e}'.`)},RL=(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(Qs.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},rb=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=l8(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&&Qs.includes(e))return e}throw new TypeError(`Unhandled codec '${e}'.`)},Ed=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],A0=[-1,1,2,3,4,5,6,8],l8=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new jr(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<Ed.length&&(i=Ed[n]);const a=e.readBits(4);let o=null;return a>=1&&a<=7&&(o=A0[a]),{objectType:r,frequencyIndex:n,sampleRate:i,channelConfiguration:a,numberOfChannels:o}},ML=t=>{let e=Ed.indexOf(t.sampleRate),r=null;e===-1&&(e=15,r=t.sampleRate);const n=A0.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 jr(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},I0=48e3,u8=/^pcm-([usf])(\d+)+(be)?$/,c8=t=>{if(pe(Qs.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=u8.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}},DL=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":u8.test(t)?t:t==="webvtt"?"webvtt":null,NL=t=>t==="avc"?{avc:{format:"avc"}}:t==="hevc"?{hevc:{format:"hevc"}}:{},LL=t=>t==="aac"?{aac:{format:"aac"}}:t==="opus"?{opus:{format:"opus"}}:{},KI=["avc1","avc3","hev1","hvc1","vp8","vp09","av01"],QI=/^(avc1|avc3)\.[0-9a-fA-F]{6}$/,ZI=/^(hev1|hvc1)\.(?:[ABC]?\d+)\.[0-9a-fA-F]{1,8}\.[LH]\d+(?:\.[0-9a-fA-F]{1,2}){0,6}$/,JI=/^vp09(?:\.\d{2}){3}(?:(?:\.\d{2}){5})?$/,eR=/^av01\.\d\.\d{2}[MH]\.\d{2}(?:\.\d\.\d{3}\.\d{2}\.\d{2}\.\d{2}\.\d)?$/,FL=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(!KI.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&&!C0(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(Q2);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(Z2);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(J2);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(!QI.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(!ZI.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(!JI.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")&&!eR.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/.')},tR=["mp4a","mp3","opus","vorbis","flac","ulaw","alaw","pcm"],BL=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(!tR.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&&!C0(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"))&&!Qs.includes(t.decoderConfig.codec))throw new TypeError(`Audio chunk metadata decoder configuration codec string for PCM must be one of the supported PCM codecs (${Qs.join(", ")}).`)},zL=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 Wo;(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"})(Wo||(Wo={}));var si;(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"})(si||(si={}));const R0=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})},f8=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=O0(n,r,!1):(pe(e===4),i=n.getUint32(r,!1)),r+=e,yield{offset:r,length:i},r+=i}},d8=(t,e)=>{if(e.description){const i=(du(e.description)[4]&3)+1;return f8(t,i)}else return R0(t)},rR=function*(t){yield*R0(t)},M0=t=>t&31,D0=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)},rv=new Uint8Array([0,0,0,1]),nR=t=>{const e=t.reduce((i,a)=>i+rv.byteLength+a.byteLength,0),r=new Uint8Array(e);let n=0;for(const i of t)r.set(rv,n),n+=rv.byteLength,r.set(i,n),n+=i.byteLength;return r},iR=(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:t8(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},aR=(t,e)=>{if(e.description){const i=(du(e.description)[4]&3)+1;return iR(t,i)}else return nR(t)},h8=t=>{try{const e=[],r=[],n=[];for(const s of rR(t)){const u=t.subarray(s.offset,s.offset+s.length),d=M0(u[0]);d===Wo.SPS?e.push(u):d===Wo.PPS?r.push(u):d===Wo.SPS_EXT&&n.push(u)}if(e.length===0||r.length===0)return null;const i=e[0],a=nb(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}},jL=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)},oR=t=>{try{const e=$r(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,d=[];for(let y=0;y<u;y++){const v=e.getUint16(r,!1);r+=2,d.push(t.subarray(r,r+v)),r+=v}const f=e.getUint8(r++),p=[];for(let y=0;y<f;y++){const v=e.getUint16(r,!1);r+=2,p.push(t.subarray(r,r+v)),r+=v}const h={configurationVersion:n,avcProfileIndication:i,profileCompatibility:a,avcLevelIndication:o,lengthSizeMinusOne:s,sequenceParameterSets:d,pictureParameterSets:p,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++);h.chromaFormat=y,h.bitDepthLumaMinus8=v,h.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}h.sequenceParameterSetExt=k}return h}catch(e){return console.error("Error deserializing AVC Decoder Configuration Record:",e),null}},nb=t=>{try{const e=new jr(D0(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,d=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&&(d=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,G=8;for(let Z=0;Z<H;Z++){if(G!==0){const J=qs(e);G=($+J+256)%256}$=G===0?$:G}}}tt(e);const f=tt(e);if(f===0)tt(e);else if(f===1){e.skipBits(1),qs(e),qs(e);const R=tt(e);for(let N=0;N<R;N++)qs(e)}tt(e),e.skipBits(1);const p=tt(e),h=tt(e),y=16*(p+1),v=16*(h+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),B=tt(e),H=tt(e);let $,G;if((d===0?o:0)===0)$=1,G=2-k;else{const J=o===3?1:2,q=o===1?2:1;$=J,G=q*(2-k)}b-=$*(R+N),x-=G*(B+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 G=e.readBits(1);G&&dx(e);const Z=e.readBits(1);Z&&dx(e),(G||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=p+1,B=h+1,H=(2-k)*B,$=e0.find(Z=>Z.level>=a)??ui(e0),G=Math.min(Math.floor($.maxDpbMbs/(N*H)),16);T=G,I=G}}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}},dx=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)},p8=(t,e)=>{if(e.description){const i=(du(e.description)[21]&3)+1;return f8(t,i)}else return R0(t)},sR=function*(t){yield*R0(t)},Op=t=>t>>1&63,m8=t=>{try{const e=new jr(D0(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:d}=lR(e,r);tt(e);const f=tt(e);let p=0;f===3&&(p=e.readBits(1));const h=tt(e),y=tt(e);let v=h,b=y;if(e.readBits(1)){const N=tt(e),B=tt(e),H=tt(e),$=tt(e);let G=1,Z=1;const J=p===0?f:0;J===1?(G=2,Z=2):J===2&&(G=2,Z=1),v-=(N+B)*G,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)&&uR(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(cR(e,E),e.readBits(1)){const N=tt(e);for(let B=0;B<N;B++)tt(e),e.skipBits(1)}e.skipBits(1),e.skipBits(1);let A=2,T=2,I=2,M=0,R=0;if(e.readBits(1)){const N=dR(e,r);A=N.colourPrimaries,T=N.transferCharacteristics,I=N.matrixCoefficients,M=N.fullRangeFlag,R=N.minSpatialSegmentationIdc}return{displayWidth:v,displayHeight:b,colourPrimaries:A,transferCharacteristics:T,matrixCoefficients:I,fullRangeFlag:M,maxDecFrameBuffering:_+1,spsMaxSubLayersMinus1:r,spsTemporalIdNestingFlag:n,generalProfileSpace:i,generalTierFlag:a,generalProfileIdc:o,generalProfileCompatibilityFlags:s,generalConstraintIndicatorFlags:u,generalLevelIdc:d,chromaFormatIdc:f,bitDepthLumaMinus8:x,bitDepthChromaMinus8:k,minSpatialSegmentationIdc:R}}catch(e){return console.error("Error parsing HEVC SPS:",e),null}},g8=t=>{try{const e=[],r=[],n=[],i=[];for(const d of sR(t)){const f=t.subarray(d.offset,d.offset+d.length),p=Op(f[0]);p===si.VPS_NUT?e.push(f):p===si.SPS_NUT?r.push(f):p===si.PPS_NUT?n.push(f):(p===si.PREFIX_SEI_NUT||p===si.SUFFIX_SEI_NUT)&&i.push(f)}if(r.length===0||n.length===0)return null;const a=m8(r[0]);if(!a)return null;let o=0;if(n.length>0){const d=n[0],f=new jr(D0(d));f.skipBits(16),tt(f),tt(f),f.skipBits(1),f.skipBits(1),f.skipBits(3),f.skipBits(1),f.skipBits(1),tt(f),tt(f),qs(f),f.skipBits(1),f.skipBits(1),f.readBits(1)&&tt(f),qs(f),qs(f),f.skipBits(1),f.skipBits(1),f.skipBits(1),f.skipBits(1);const p=f.readBits(1),h=f.readBits(1);!p&&!h?o=0:p&&!h?o=2:!p&&h?o=3:o=0}const s=[...e.length?[{arrayCompleteness:1,nalUnitType:si.VPS_NUT,nalUnits:e}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:si.SPS_NUT,nalUnits:r}]:[],...n.length?[{arrayCompleteness:1,nalUnitType:si.PPS_NUT,nalUnits:n}]:[],...i.length?[{arrayCompleteness:1,nalUnitType:Op(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}},lR=(t,e)=>{const r=t.readBits(2),n=t.readBits(1),i=t.readBits(5);let a=0;for(let f=0;f<32;f++)a=a<<1|t.readBits(1);const o=new Uint8Array(6);for(let f=0;f<6;f++)o[f]=t.readBits(8);const s=t.readBits(8),u=[],d=[];for(let f=0;f<e;f++)u.push(t.readBits(1)),d.push(t.readBits(1));if(e>0)for(let f=e;f<8;f++)t.skipBits(2);for(let f=0;f<e;f++)u[f]&&t.skipBits(88),d[f]&&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}},uR=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&&qs(t);for(let a=0;a<i;a++)qs(t)}},cR=(t,e)=>{const r=[];for(let n=0;n<e;n++)r[n]=fR(t,n,e,r)},fR=(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 d=0;d<s;d++)tt(t),t.readBits(1);for(let d=0;d<u;d++)tt(t),t.readBits(1);i=s+u}return i},dR=(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)&&hR(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}},hR=(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 d=!1;u?tt(t):d=t.readBits(1)===1;let f=1;d||(f=tt(t)+1),n&&hx(t,f,a),i&&hx(t,f,a)}},hx=(t,e,r)=>{for(let n=0;n<e;n++)tt(t),tt(t),r&&(tt(t),tt(t)),t.readBits(1)},UL=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)},y8=t=>{const e=new jr(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 d=8;a>=2&&(d=e.readBits(1)?12:10);const f=e.readBits(3);let p=0,h=0;if(f!==7)if(h=e.readBits(1),a===1||a===3){const T=e.readBits(1),I=e.readBits(1);p=!T&&!I?3:T&&!I?2:1,e.skipBits(1)}else p=1;else p=3,h=1;const y=e.readBits(16),v=e.readBits(16),b=y+1,x=v+1,k=b*x;let S=ui(ou).level;for(const A of ou)if(k<=A.maxPictureSize){S=A.level;break}return{profile:a,level:S,bitDepth:d,chromaSubsampling:p,videoFullRangeFlag:h,colourPrimaries:f===2?1:f===1?6:2,transferCharacteristics:f===2?1:f===1?6:2,matrixCoefficients:f===7?0:f===2?1:f===1?6:2}},v8=function*(t){const e=new jr(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)}},b8=t=>{for(const{type:e,data:r}of v8(t)){if(e!==1)continue;const n=new jr(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 d=n.readBits(4),f=n.readBits(4),p=d+1;n.skipBits(p);const h=f+1;n.skipBits(h);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},pR=t=>{const e=$r(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}},mR=[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],gR=t=>{const e=t[0]>>3;return{durationInSamples:mR[e]}},yR=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 p=0;p<r;p++)n[p]=t[r-1-p];const i=new jr(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 p=i.pos,h=i.readBits(8),y=i.readBits(16),v=i.readBits(16);if(h>63||y!==0||v!==0){i.pos=p;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 d=u;i.pos=0,i.skipBits(a);const f=Array(d).fill(0);for(let p=d-1;p>=0;p--)i.skipBits(40),f[p]=i.readBits(1);return{modeBlockflags:f}},ib=(t,e,r)=>{switch(t){case"avc":{for(const n of d8(r,e)){const i=r[n.offset],a=M0(i);if(a>=Wo.NON_IDR_SLICE&&a<=Wo.SLICE_DPC)return"delta";if(a===Wo.IDR)return"key";if(a===Wo.SEI&&(!t2()||GI()>=144)){const o=r.subarray(n.offset,n.offset+n.length),s=D0(o);let u=1;do{let d=0;for(;;){const h=s[u++];if(h===void 0||(d+=h,h<255))break}let f=0;for(;;){const h=s[u++];if(h===void 0||(f+=h,h<255))break}if(d===6){const h=new jr(s);h.pos=8*u;const y=tt(h),v=h.readBits(1);if(y===0&&v===1)return"key"}u+=f}while(u<s.length-1)}}return"delta"}case"hevc":{for(const n of p8(r,e)){const i=Op(r[n.offset]);if(i<si.BLA_W_LP)return"delta";if(i<=si.RSV_IRAP_VCL23)return"key"}return"delta"}case"vp8":return(r[0]&1)===0?"key":"delta";case"vp9":{const n=new jr(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 v8(r))if(i===1){const o=new jr(a);o.skipBits(4),n=!!o.readBits(1)}else if(i===3||i===6||i===7){if(n)return"key";const o=new jr(a);return o.readBits(1)?null:o.readBits(2)===0?"key":"delta"}return null}default:Tp(t),pe(!1)}};var pd;(function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"})(pd||(pd={}));const n2=(t,e)=>{const r=$r(t);let n=0;const i=r.getUint32(n,!0);n+=4;const a=La.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 d=La.decode(t.subarray(n,n+u));n+=u;const f=d.indexOf("=");if(f===-1)continue;const p=d.slice(0,f).toUpperCase(),h=d.slice(f+1);switch(e.raw??={},e.raw[p]??=h,p){case"TITLE":e.title??=h;break;case"DESCRIPTION":e.description??=h;break;case"ARTIST":e.artist??=h;break;case"ALBUM":e.album??=h;break;case"ALBUMARTIST":e.albumArtist??=h;break;case"COMMENT":e.comment??=h;break;case"LYRICS":e.lyrics??=h;break;case"TRACKNUMBER":{const y=h.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(h,10);Number.isInteger(y)&&y>0&&(e.tracksTotal??=y)}break;case"DISCNUMBER":{const y=h.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(h,10);Number.isInteger(y)&&y>0&&(e.discsTotal??=y)}break;case"DATE":{const y=new Date(h);Number.isNaN(y.getTime())||(e.date??=y)}break;case"GENRE":e.genre??=h;break;case"METADATA_BLOCK_PICTURE":{const y=XI(h),v=$r(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=La.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 Tu{constructor(e){this.input=e}}const w8=[],x8=[],HL=[],$L=[];const ca=new Uint8Array(0);class Pn{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===ca&&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===ca}get microsecondTimestamp(){return Math.trunc(au*this.timestamp)}get microsecondDuration(){return Math.trunc(au*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 Pn(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 Pn(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 qL=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},vR=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},VL=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},bR=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};a8();let px=-1/0,mx=-1/0,Ap=null;typeof FinalizationRegistry<"u"&&(Ap=new FinalizationRegistry(t=>{const e=Date.now();t.type==="video"?(e-px>=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."),px=e),typeof VideoFrame<"u"&&t.data instanceof VideoFrame&&t.data.close()):(e-mx>=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."),mx=e),typeof AudioData<"u"&&t.data instanceof AudioData&&t.data.close())}));const S8=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],wR=new Set(S8);class su{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(au*this.timestamp)}get microsecondDuration(){return Math.trunc(au*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||!wR.has(r.format))throw new TypeError("init.format must be one of: "+S8.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=du(e).slice(),this._layout=r.layout??xR(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 nv(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 nv(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 su(new VideoFrame(e,{timestamp:Math.trunc(r.timestamp*au),duration:Math.trunc((r.duration??0)*au)||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:e2(),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 nv({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw new TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");Ap?.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw new Error("VideoSample is closed.");return pe(this._data!==null),cc(this._data)?new su(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(pe(this._layout),new su(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 su(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||(Ap?.unregister(this),cc(this._data)?this._data.close():this._data=null,this._closed=!0)}allocationSize(e={}){if(gx(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),!cc(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 cc(this._data)?this._data.allocationSize(e):this._data instanceof Uint8Array?this._data.byteLength:this.codedWidth*this.codedHeight*4}async copyTo(e,r={}){if(!C0(e))throw new TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(gx(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),!cc(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(cc(this._data))return this._data.copyTo(e,r);if(this._data instanceof Uint8Array)return pe(this._layout),du(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 du(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),cc(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,d){let f=0,p=0,h=this.displayWidth,y=this.displayHeight,v=0,b=0,x=this.displayWidth,k=this.displayHeight;if(o!==void 0?(f=r,p=n,h=i,y=a,v=o,b=s,u!==void 0?(x=u,k=d):(x=h,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(f))throw new TypeError("sx must be a number.");if(!Number.isFinite(p))throw new TypeError("sy must be a number.");if(!Number.isFinite(h)||h<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:f,sy:p,sWidth:h,sHeight:y}=this._rotateSourceRegion(f,p,h,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,f,p,h,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&&_8(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&&k8(r.crop,o,s);let u,d,f,p;const{sx:h,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,d=0,f=n,p=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);f=k*P,p=S*P,u=(n-f)/2,d=(i-p)/2}e.save();const x=a%180===0?1:f/p;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(),h,y,v,b,u,d,f,p),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 nv{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 cc=t=>typeof VideoFrame<"u"&&t instanceof VideoFrame,k8=(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)},_8=(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.")},gx=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.")}},xR=(t,e,r)=>{const n=SR(t),i=[];let a=0;for(const o of n){const s=Math.ceil(e/o.widthDivisor),u=Math.ceil(r/o.heightDivisor),d=s*o.sampleBytes,f=d*u;i.push({offset:a,stride:d}),a+=f}return i},SR=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:Tp(t),pe(!1)}},iv=new Set(["f32","f32-planar","s16","s16-planar","s32","s32-planar","u8","u8-planar"]);class lu{get microsecondTimestamp(){return Math.trunc(au*this.timestamp)}get microsecondDuration(){return Math.trunc(au*this.duration)}constructor(e){if(this._closed=!1,Lh(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(!iv.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/(pc(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*pc(this.format);if(n.byteLength<i)throw new TypeError("Invalid AudioDataInit: insufficient data size.");this._data=n}Ap?.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&&!iv.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=pc(r),o=id(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(!C0(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&&!iv.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 d=this.numberOfFrames,f=this.numberOfChannels,p=o??0;if(p>=d)throw new RangeError("frameOffset out of range");const h=a!==void 0?a:d-p;if(h>d-p)throw new RangeError("frameCount out of range");const y=pc(u),v=id(u);if(v&&n>=f)throw new RangeError("planeIndex out of range");if(!v&&n!==0)throw new RangeError("planeIndex out of range");const x=(v?h:h*f)*y;if(e.byteLength<x)throw new RangeError("Destination buffer is too small");const k=$r(e),S=E8(u);if(Lh(this._data))Eg()&&f>2&&u!==s?kR(this._data,k,s,u,f,n,p,h):this._data.copyTo(e,{planeIndex:n,frameOffset:p,frameCount:h,format:u});else{const P=this._data,_=$r(P),E=P8(s),A=pc(s),T=id(s);for(let I=0;I<h;I++)if(v){const M=I*y;let R;T?R=(n*d+(I+p))*A:R=((I+p)*f+n)*A;const N=E(_,R);S(k,M,N)}else for(let M=0;M<f;M++){const N=(I*f+M)*y;let B;T?B=(M*d+(I+p))*A:B=((I+p)*f+M)*A;const H=E(_,B);S(k,N,H)}}}clone(){if(this._closed)throw new Error("AudioSample is closed.");if(Lh(this._data)){const e=new lu(this._data.clone());return e.setTimestamp(this.timestamp),e}else return new lu({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data})}close(){this._closed||(Ap?.unregister(this),Lh(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}toAudioData(){if(this._closed)throw new Error("AudioSample is closed.");if(Lh(this._data)){if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(id(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,d=o;for(;d>0;){const f=Math.min(s,d),p=new Float32Array(i*f);for(let h=0;h<i;h++)e.copyFromChannel(p.subarray(h*f,(h+1)*f),h,u);yield new lu({format:"f32-planar",sampleRate:a,numberOfFrames:f,numberOfChannels:i,timestamp:r+u/a,data:p}),u+=f,d-=f}}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,d=o;const f=[];for(;d>0;){const p=Math.min(s,d),h=new Float32Array(i*p);for(let v=0;v<i;v++)e.copyFromChannel(h.subarray(v*p,(v+1)*p),v,u);const y=new lu({format:"f32-planar",sampleRate:a,numberOfFrames:p,numberOfChannels:i,timestamp:r+u/a,data:h});f.push(y),u+=p,d-=p}return f}}const pc=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")}},id=t=>{switch(t){case"u8-planar":case"s16-planar":case"s32-planar":case"f32-planar":return!0;default:return!1}},P8=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)}},E8=t=>{switch(t){case"u8":case"u8-planar":return(e,r,n)=>e.setUint8(r,hd((n+1)*127.5,0,255));case"s16":case"s16-planar":return(e,r,n)=>e.setInt16(r,hd(Math.round(n*32767),-32768,32767),!0);case"s32":case"s32-planar":return(e,r,n)=>e.setInt32(r,hd(Math.round(n*2147483647),-2147483648,2147483647),!0);case"f32":case"f32-planar":return(e,r,n)=>e.setFloat32(r,n,!0)}},Lh=t=>typeof AudioData<"u"&&t instanceof AudioData,kR=(t,e,r,n,i,a,o,s)=>{const u=P8(r),d=E8(n),f=pc(r),p=pc(n),h=id(r);if(id(n))if(h){const v=new ArrayBuffer(s*f),b=$r(v);t.copyTo(v,{planeIndex:a,frameOffset:o,frameCount:s,format:r});for(let x=0;x<s;x++){const k=x*f,S=x*p,P=u(b,k);d(e,S,P)}}else{const v=new ArrayBuffer(s*i*f),b=$r(v);t.copyTo(v,{planeIndex:0,frameOffset:o,frameCount:s,format:r});for(let x=0;x<s;x++){const k=(x*i+a)*f,S=x*p,P=u(b,k);d(e,S,P)}}else if(h){const v=s*f,b=new ArrayBuffer(v),x=$r(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*f,_=(S*i+k)*p,E=u(x,P);d(e,_,E)}}}else{const v=new ArrayBuffer(s*i*f),b=$r(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*f,_=S*p,E=u(b,P);d(e,_,E)}}};const Hf=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.")},Xs=t=>{if(!o8(t))throw new TypeError("timestamp must be a number.")},av=(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 ab{constructor(e){if(!(e instanceof sb))throw new TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(Hf(e),this._track.input._disposed)throw new ia;return av(this._track,this._track._backing.getFirstPacket(e),e)}getPacket(e,r={}){if(Xs(e),Hf(r),this._track.input._disposed)throw new ia;return av(this._track,this._track._backing.getPacket(e,r),r)}getNextPacket(e,r={}){if(!(e instanceof Pn))throw new TypeError("packet must be an EncodedPacket.");if(Hf(r),this._track.input._disposed)throw new ia;return av(this._track,this._track._backing.getNextPacket(e,r),r)}async getKeyPacket(e,r={}){if(Xs(e),Hf(r),this._track.input._disposed)throw new ia;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 Pn))throw new TypeError("packet must be an EncodedPacket.");if(Hf(r),this._track.input._disposed)throw new ia;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 Pn))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 Pn))throw new TypeError("endPacket must be an EncodedPacket.");if(Hf(n),this._track.input._disposed)throw new ia;const i=[];let{promise:a,resolve:o}=na(),{promise:s,resolve:u}=na(),d=!1,f=!1,p=null;const h=[],y=()=>Math.max(2,h.length);(async()=>{let b=e??await this.getFirstPacket(n);for(;b&&!f&&!this._track.input._disposed&&!(r&&b.sequenceNumber>=r?.sequenceNumber);){if(i.length>y()){({promise:s,resolve:u}=na()),await s;continue}i.push(b),o(),{promise:a,resolve:o}=na(),b=await this.getNextPacket(b,n)}d=!0,o()})().catch(b=>{p||(p=b,o())});const v=this._track;return{async next(){for(;;){if(v.input._disposed)throw new ia;if(f)return{value:void 0,done:!0};if(p)throw p;if(i.length>0){const b=i.shift(),x=performance.now();for(h.push(x);h.length>0&&x-h[0]>=1e3;)h.shift();return u(),{value:b,done:!1}}else{if(d)return{value:void 0,done:!0};await a}}},async return(){return f=!0,u(),o(),{value:void 0,done:!0}},async throw(b){throw b},[Symbol.asyncIterator](){return this}}}}class ob{constructor(e,r){this.onSample=e,this.onError=r}}class T8{mediaSamplesInRange(e=0,r=1/0){Xs(e),Xs(r);const n=[];let i=!1,a=null,{promise:o,resolve:s}=na(),{promise:u,resolve:d}=na(),f=!1,p=!1,h=!1,y=null;(async()=>{const x=await this._createDecoder(A=>{if(d(),A.timestamp>=r&&(p=!0),p){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}=na())},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&&!p&&!this._track.input._disposed;){const A=yx(n.length);if(n.length+x.getDecodeQueueSize()>A){({promise:u,resolve:d}=na()),await u;continue}x.decode(P);const T=await E.next();if(T.done)break;P=T.value}await E.return(),!h&&!this._track.input._disposed&&await x.flush(),x.close(),!i&&a&&n.push(a),f=!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 ia;if(h)return{value:void 0,done:!0};if(y)throw b(),y;if(n.length>0){const x=n.shift();return d(),{value:x,done:!1}}else if(!f)await o;else return{value:void 0,done:!0}}},async return(){return h=!0,p=!0,d(),s(),b(),{value:void 0,done:!0}},async throw(x){throw x},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e){$I(e);const r=HI(e),n=[],i=[];let{promise:a,resolve:o}=na(),{promise:s,resolve:u}=na(),d=!1,f=!1,p=null;const h=b=>{i.push(b),o(),{promise:a,resolve:o}=na()};(async()=>{const b=await this._createDecoder(A=>{if(u(),f){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++)h(I<T-1?A.clone():A);else A.close()},A=>{p||(p=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=yx(i.length);for(;i.length+b.getDecodeQueueSize()>T&&!f;)({promise:s,resolve:u}=na()),await s;if(f)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++)h(null);n.length=0};for await(const A of r){if(Xs(A),f||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()),h(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}!f&&!this._track.input._disposed&&(P!==-1&&await _(),await E()),b.close(),d=!0,o()})().catch(b=>{p||(p=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 ia;if(f)return{value:void 0,done:!0};if(p)throw v(),p;if(i.length>0){const b=i.shift();return pe(b!==void 0),u(),{value:b,done:!1}}else if(!d)await a;else return{value:void 0,done:!0}}},async return(){return f=!0,u(),o(),v(),{value:void 0,done:!0}},async throw(b){throw b},[Symbol.asyncIterator](){return this}}}}const yx=t=>t===0?40:8;class _R extends ob{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 i8,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=w8.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 su))throw new TypeError("The argument passed to onSample must be a VideoSample.");this.finalizeAndEmitSample(u)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{const u=f=>{if(this.alphaQueue.length>0){const p=this.alphaQueue.shift();pe(p!==void 0),this.mergeAlpha(f,p)}else this.colorQueue.push(f)};if(n==="avc"&&this.decoderConfig.description&&t2()){const f=oR(du(this.decoderConfig.description));if(f&&f.sequenceParameterSets.length>0){const p=nb(f.sequenceParameterSets[0]);p&&p.frameMbsOnlyFlag===0&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:"prefer-software"})}}const d=new Error("Decoding error").stack;this.decoder=new VideoDecoder({output:f=>{try{u(f)}catch(p){this.onError(p)}},error:f=>{f.stack=d,this.onError(f)}}),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),Eg()||ix(this.inputTimestamps,e.timestamp,r=>r),t2()&&this.currentPacketIndex===0&&this.codec==="avc"){const r=[];for(const i of d8(e.data,this.decoderConfig)){const a=M0(e.data[i.offset]);a>=20&&a<=31||r.push(e.data.subarray(i.offset,i.offset+i.length))}const n=aR(r,this.decoderConfig);e=new Pn(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 PR}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=ib(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 p8(e,this.decoderConfig)){const n=Op(e[r.offset]);if(n===si.RASL_N||n===si.RASL_R)return!0}return!1}sampleHandler(e){if(Eg()){if(this.sampleQueue.length>0&&e.timestamp>=ui(this.sampleQueue).timestamp){for(const r of this.sampleQueue)this.finalizeAndEmitSample(r);this.sampleQueue.length=0}ix(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 su(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 su(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),Eg()){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 PR{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),d=s.length;for(let f=0;f<d;f++)s[f]=s[f]&16777215|(u[f]&255)<<24;this.ctx.putImageData(a,0,0)}close(){this.ctx=null,this.alphaCtx=null,this.colorImageData=null,this.alphaImageData=null}}class ER extends T8{constructor(e){if(!(e instanceof Ld))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 _R(e,r,n,a,i,o)}_createPacketSink(){return new ab(this._track)}async getSample(e){Xs(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 TR{constructor(e,r={}){if(this._nextCanvasIndex=0,!(e instanceof Ld))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&&_8(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&&k8(o,i,a);let[s,u]=o?[o.width,o.height]:[i,a];const d=s/u;r.width!==void 0&&r.height===void 0?(s=r.width,u=Math.round(s/d)):r.width===void 0&&r.height!==void 0?(u=r.height,s=Math.round(u*d)):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 ER(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||e2()});pe(i),i.resetTransform(),n||(!this._alpha&&e2()?(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){Xs(e);const r=await this._videoSampleSink.getSample(e);return r&&this._videoSampleToWrappedCanvas(r)}canvases(e=0,r=1/0){return Jg(this._videoSampleSink.samples(e,r),n=>this._videoSampleToWrappedCanvas(n))}canvasesAtTimestamps(e){return Jg(this._videoSampleSink.samplesAtTimestamps(e),r=>r&&this._videoSampleToWrappedCanvas(r))}}class CR extends ob{constructor(e,r,n,i){super(e,r),this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new i8,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 d=i.sampleRate;s.setTimestamp(Math.round(u*d)/d),e(s)},o=x8.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 lu))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 lu(u))}catch(d){this.onError(d)}},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 OR extends ob{constructor(e,r,n){super(e,r),this.decoderConfig=n,this.currentTimestamp=null,pe(Qs.includes(n.codec)),this.codec=n.codec;const{dataType:i,sampleSize:a,littleEndian:o}=c8(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)=>vR(s.getUint8(u)):i==="alaw"?this.readInputValue=(s,u)=>bR(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)=>O0(s,u,o)-2**23:i==="signed"?this.readInputValue=(s,u)=>qI(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:Tp(a),pe(!1)}switch(a){case 1:i==="ulaw"||i==="alaw"?(this.outputSampleSize=2,this.outputFormat="s16",this.writeOutputValue=(s,u,d)=>s.setInt16(u,d,!0)):(this.outputSampleSize=1,this.outputFormat="u8",this.writeOutputValue=(s,u,d)=>s.setUint8(u,d+2**7));break;case 2:this.outputSampleSize=2,this.outputFormat="s16",this.writeOutputValue=(s,u,d)=>s.setInt16(u,d,!0);break;case 3:this.outputSampleSize=4,this.outputFormat="s32",this.writeOutputValue=(s,u,d)=>s.setInt32(u,d<<8,!0);break;case 4:this.outputSampleSize=4,i==="float"?(this.outputFormat="f32",this.writeOutputValue=(s,u,d)=>s.setFloat32(u,d,!0)):(this.outputFormat="s32",this.writeOutputValue=(s,u,d)=>s.setInt32(u,d,!0));break;case 8:this.outputSampleSize=4,this.outputFormat="f32",this.writeOutputValue=(s,u,d)=>s.setFloat32(u,d,!0);break;default:Tp(a),pe(!1)}}getDecodeQueueSize(){return 0}decode(e){const r=$r(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 f=0;f<n*this.decoderConfig.numberOfChannels;f++){const p=f*this.inputSampleSize,h=f*this.outputSampleSize,y=this.readInputValue(r,p);this.writeOutputValue(o,h,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 d=new lu({format:this.outputFormat,data:a,numberOfChannels:this.decoderConfig.numberOfChannels,sampleRate:this.decoderConfig.sampleRate,numberOfFrames:n,timestamp:u});this.onSample(d)}async flush(){}close(){}}class AR extends T8{constructor(e){if(!(e instanceof ho))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),Qs.includes(i.codec)?new OR(e,r,i):new CR(e,r,n,i)}_createPacketSink(){return new ab(this._track)}async getSample(e){Xs(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 WL{constructor(e){if(!(e instanceof ho))throw new TypeError("audioTrack must be an InputAudioTrack.");this._audioSampleSink=new AR(e)}_audioSampleToWrappedArrayBuffer(e){const r={buffer:e.toAudioBuffer(),timestamp:e.timestamp,duration:e.duration};return e.close(),r}async getBuffer(e){Xs(e);const r=await this._audioSampleSink.getSample(e);return r&&this._audioSampleToWrappedArrayBuffer(r)}buffers(e=0,r=1/0){return Jg(this._audioSampleSink.samples(e,r),n=>this._audioSampleToWrappedArrayBuffer(n))}buffersAtTimestamps(e){return Jg(this._audioSampleSink.samplesAtTimestamps(e),r=>r&&this._audioSampleToWrappedArrayBuffer(r))}}class sb{constructor(e,r){this.input=e,this._backing=r}isVideoTrack(){return this instanceof Ld}isAudioTrack(){return this instanceof ho}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 ab(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 Ld extends sb{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),w8.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 Pn))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),ib(this.codec,r,e.data)}}class ho extends sb{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),x8.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 Pn))throw new TypeError("packet must be an EncodedPacket.");return this.codec===null?null:"key"}}const IR=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 Xf=8,Qh=16,tu=t=>{let e=st(t);const r=Qn(t,4);let n=8;e===1&&(e=ro(t),n=16);const a=e-n;return a<0?null:{name:r,totalSize:e,headerSize:n,contentSize:a}},fc=t=>vc(t)/65536,ov=t=>vc(t)/1073741824,sv=t=>{let e=0;for(let r=0;r<4;r++){e<<=7;const n=Pt(t);if(e|=n&127,(n&128)===0)break}return e},Uo=t=>{let e=Yn(t);return t.skip(2),e=Math.min(e,t.remainingLength),La.decode(Rt(t,e))},RR=t=>{const e=tu(t);if(!e||e.name!=="data"||t.remainingLength<8)return null;const r=st(t);t.skip(4);const n=Rt(t,e.contentSize-8);switch(r){case 1:return La.decode(n);case 2:return new TextDecoder("utf-16be").decode(n);case 13:return new cp(n,"image/jpeg");case 14:return new cp(n,"image/png");case 27:return new cp(n,"image/bmp");default:return n}};class MR extends Tu{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 IR({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,Xf,Qh);if(r instanceof Promise&&(r=await r),!r)break;const n=e,i=tu(r);if(!i)break;if(i.name==="ftyp"){const a=Qn(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=st(r),i=this.reader.fileSize-n;if(i>=0&&i<=this.reader.fileSize-Qh){let a=this.reader.requestSliceRange(i,Xf,Qh);if(a instanceof Promise&&(a=await a),a){const o=tu(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&&Qs.includes(e.info.codec)&&r.sampleCompositionTimeOffsets.length===0){pe(e.info?.type==="audio");const a=c8(e.info.codec),o=[],s=[];for(let u=0;u<r.sampleToChunk.length;u++){const d=r.sampleToChunk[u],f=r.sampleToChunk[u+1],p=(f?f.startChunkIndex:r.chunkOffsets.length)-d.startChunkIndex;for(let h=0;h<p;h++){const y=d.startSampleIndex+h*d.samplesPerChunk,v=y+d.samplesPerChunk,b=cr(r.sampleTimingEntries,y,I=>I.startIndex),x=r.sampleTimingEntries[b],k=cr(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=ui(o);A&&A.delta===E?A.count++:o.push({startIndex:d.startChunkIndex+h,startDecodeTimestamp:P,count:1,delta:E});const T=d.samplesPerChunk*a.sampleSize*e.info.numberOfChannels;s.push(T)}d.startSampleIndex=d.startChunkIndex,d.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,Xf,Qh);r instanceof Promise&&(r=await r),pe(r);const n=tu(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 f=s.fragmentLookupTable.find(p=>p.moofOffset===a.moofOffset);if(f)lv(o,f.timestamp);else{const p=cr(u,a.moofOffset-1,h=>h.moofOffset);if(p!==-1){const h=u[p];lv(o,h.endTimestamp)}}o.startTimestampIsFinal=!0}const d=cr(u,o.startTimestamp,f=>f.startTimestamp);(d===-1||u[d].moofOffset!==a.moofOffset)&&u.splice(d+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-Xf&&this.traverseBox(e););}*iterateContiguousBoxes(e){const r=e.filePos;for(;e.filePos-r<=e.length-Xf;){const n=e.filePos,i=tu(e);if(!i)break;yield{boxInfo:i,slice:e},e.filePos=n+i.totalSize}}traverseBox(e){const r=e.filePos,n=tu(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=Pt(e);e.skip(3),o===1?(e.skip(16),this.movieTimescale=st(e),this.movieDurationInTimescale=ro(e)):(e.skip(8),this.movieTimescale=st(e),this.movieDurationInTimescale=st(e))}break;case"trak":{const o={id:-1,demuxer:this,inputTrack:null,disposition:{...Eu},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:Da,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 Ld(this.input,new DR(s)),this.tracks.push(o)}else if(o.info.type==="audio"&&o.info.numberOfChannels!==-1){const s=o;o.inputTrack=new ho(this.input,new NR(s)),this.tracks.push(o)}}this.currentTrack=null}break;case"tkhd":{const o=this.currentTrack;if(!o)break;const s=Pt(e),d=!!(Zf(e)&1);if(o.disposition.default=d,s===0)e.skip(8),o.id=st(e),e.skip(4),o.durationInMovieTimescale=st(e);else if(s===1)e.skip(16),o.id=st(e),e.skip(4),o.durationInMovieTimescale=ro(e);else throw new Error(`Incorrect track header version ${s}.`);e.skip(16);const f=[fc(e),fc(e),ov(e),fc(e),fc(e),ov(e),fc(e),fc(e),ov(e)],p=Jk(r8(zR(f),90));pe(p===0||p===90||p===180||p===270),o.rotation=p}break;case"elst":{const o=this.currentTrack;if(!o)break;const s=Pt(e);e.skip(3);let u=!1,d=0;const f=st(e);for(let p=0;p<f;p++){const h=s===1?ro(e):st(e),y=s===1?JM(e):vc(e),v=fc(e);if(h!==0){if(u){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(y===-1){d+=h;continue}if(v!==1){console.warn("Unsupported edit list entry: media rate must be 1.");break}o.editListPreviousSegmentDurations=d,o.editListOffset=y,u=!0}}}break;case"mdhd":{const o=this.currentTrack;if(!o)break;const s=Pt(e);e.skip(3),s===0?(e.skip(8),o.timescale=st(e),o.durationInMediaTimescale=st(e)):s===1&&(e.skip(16),o.timescale=st(e),o.durationInMediaTimescale=ro(e));let u=Yn(e);if(u>0){o.languageCode="";for(let d=0;d<3;d++)o.languageCode=String.fromCharCode(96+(u&31))+o.languageCode,u>>=5;n8(o.languageCode)||(o.languageCode=Da)}}break;case"hdlr":{const o=this.currentTrack;if(!o)break;e.skip(8);const s=Qn(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=Pt(e);e.skip(3);const u=st(e);for(let d=0;d<u;d++){const f=e.filePos,p=tu(e);if(!p)break;o.internalCodecId=p.name;const h=p.name.toLowerCase();if(o.info.type==="video")h==="avc1"||h==="avc3"?(o.info.codec="avc",o.info.avcType=h==="avc1"?1:3):h==="hvc1"||h==="hev1"?o.info.codec="hevc":h==="vp08"?o.info.codec="vp8":h==="vp09"?o.info.codec="vp9":h==="av01"?o.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${p.name}').`),e.skip(24),o.info.width=Yn(e),o.info.height=Yn(e),e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,f+p.totalSize-e.filePos));else{h==="mp4a"||(h==="opus"?o.info.codec="opus":h==="flac"?o.info.codec="flac":h==="twos"||h==="sowt"||h==="raw "||h==="in24"||h==="in32"||h==="fl32"||h==="fl64"||h==="lpcm"||h==="ipcm"||h==="fpcm"||(h==="ulaw"?o.info.codec="ulaw":h==="alaw"?o.info.codec="alaw":console.warn(`Unsupported audio codec (sample entry type '${p.name}').`))),e.skip(8);const y=Yn(e);e.skip(6);let v=Yn(e),b=Yn(e);e.skip(4);let x=st(e)/65536;if(s===0&&y>0){if(y===1)e.skip(4),b=8*st(e),e.skip(8);else if(y===2){e.skip(4),x=U8(e),v=st(e),e.skip(4),b=st(e);const k=st(e);if(e.skip(8),h==="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=I0),o.info.numberOfChannels=v,o.info.sampleRate=x,h==="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):h==="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):h==="raw "?o.info.codec="pcm-u8":h==="in24"?o.info.codec="pcm-s24be":h==="in32"?o.info.codec="pcm-s32be":h==="fl32"?o.info.codec="pcm-f32be":h==="fl64"?o.info.codec="pcm-f64be":h==="ipcm"?o.info.codec="pcm-s16be":h==="fpcm"&&(o.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,f+p.totalSize-e.filePos))}}}break;case"avcC":{const o=this.currentTrack;if(!o)break;pe(o.info),o.info.codecDescription=Rt(e,n.contentSize)}break;case"hvcC":{const o=this.currentTrack;if(!o)break;pe(o.info),o.info.codecDescription=Rt(e,n.contentSize)}break;case"vpcC":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="video"),e.skip(4);const s=Pt(e),u=Pt(e),d=Pt(e),f=d>>4,p=d>>1&7,h=d&1,y=Pt(e),v=Pt(e),b=Pt(e);o.info.vp9CodecInfo={profile:s,level:u,bitDepth:f,chromaSubsampling:p,videoFullRangeFlag:h,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=Pt(e),u=s>>5,d=s&31,f=Pt(e),p=f>>7,h=f>>6&1,y=f>>5&1,v=f>>4&1,b=f>>3&1,x=f>>2&1,k=f&3,S=u===2&&h?y?12:10:h?10:8;o.info.av1CodecInfo={profile:u,level:d,tier:p,bitDepth:S,monochrome:v,chromaSubsamplingX:b,chromaSubsamplingY:x,chromaSamplePosition:k}}break;case"colr":{const o=this.currentTrack;if(!o||(pe(o.info?.type==="video"),Qn(e,4)!=="nclx"))break;const u=Yn(e),d=Yn(e),f=Yn(e),p=!!(Pt(e)&128);o.info.colorSpace={primaries:Kg[u],transfer:Qg[d],matrix:Zg[f],fullRange:p}}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=Pt(e);pe(s===3),sv(e),e.skip(2);const u=Pt(e),d=(u&128)!==0,f=(u&64)!==0,p=(u&32)!==0;if(d&&e.skip(2),f){const x=Pt(e);e.skip(x)}p&&e.skip(2);const h=Pt(e);pe(h===4);const y=sv(e),v=e.filePos,b=Pt(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=Pt(e);pe(x===5);const k=sv(e);if(o.info.codecDescription=Rt(e,k),o.info.codec==="aac"){const S=l8(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"),Yn(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=!!(Pt(e)&1),d=Pt(e);o.info.codec==="pcm-s16be"?u?d===16?o.info.codec="pcm-s16":d===24?o.info.codec="pcm-s24":d===32?o.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${d}.`),o.info.codec=null):d===16?o.info.codec="pcm-s16be":d===24?o.info.codec="pcm-s24be":d===32?o.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${d}.`),o.info.codec=null):o.info.codec==="pcm-f32be"&&(u?d===32?o.info.codec="pcm-f32":d===64?o.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${d}.`),o.info.codec=null):d===32?o.info.codec="pcm-f32be":d===64?o.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${d}.`),o.info.codec=null));break}case"dOps":{const o=this.currentTrack;if(!o)break;pe(o.info?.type==="audio"),e.skip(1);const s=Pt(e),u=Yn(e),d=st(e),f=c2(e),p=Pt(e);let h;p!==0?h=Rt(e,2+s):h=new Uint8Array(0);const y=new Uint8Array(19+h.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,d,!0),v.setInt16(16,f,!0),v.setUint8(18,p),y.set(h,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,d=e.filePos;for(;e.filePos<a;){const v=Pt(e),b=Zf(e);if((v&s)===pd.STREAMINFO){e.skip(10);const k=st(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 f=e.filePos;e.filePos=d;const p=Rt(e,f-d),h=new Uint8Array(4+p.byteLength);new DataView(h.buffer).setUint32(0,1716281667,!1),h.set(p,4),o.info.codecDescription=h}break;case"stts":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=st(e);let u=0,d=0;for(let f=0;f<s;f++){const p=st(e),h=st(e);o.sampleTable.sampleTimingEntries.push({startIndex:u,startDecodeTimestamp:d,count:p,delta:h}),u+=p,d+=p*h}}break;case"ctts":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=st(e);let u=0;for(let d=0;d<s;d++){const f=st(e),p=vc(e);o.sampleTable.sampleCompositionTimeOffsets.push({startIndex:u,count:f,offset:p}),u+=f}}break;case"stsz":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=st(e),u=st(e);if(s===0)for(let d=0;d<u;d++){const f=st(e);o.sampleTable.sampleSizes.push(f)}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=Pt(e),u=st(e),d=Rt(e,Math.ceil(u*s/8)),f=new jr(d);for(let p=0;p<u;p++){const h=f.readBits(s);o.sampleTable.sampleSizes.push(h)}}break;case"stss":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4),o.sampleTable.keySampleIndices=[];const s=st(e);for(let u=0;u<s;u++){const d=st(e)-1;o.sampleTable.keySampleIndices.push(d)}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=st(e);for(let d=0;d<s;d++){const f=st(e)-1,p=st(e),h=st(e);o.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:f,samplesPerChunk:p,sampleDescriptionIndex:h})}let u=0;for(let d=0;d<o.sampleTable.sampleToChunk.length;d++)if(o.sampleTable.sampleToChunk[d].startSampleIndex=u,d<o.sampleTable.sampleToChunk.length-1){const p=o.sampleTable.sampleToChunk[d+1].startChunkIndex-o.sampleTable.sampleToChunk[d].startChunkIndex;u+=p*o.sampleTable.sampleToChunk[d].samplesPerChunk}}break;case"stco":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=st(e);for(let u=0;u<s;u++){const d=st(e);o.sampleTable.chunkOffsets.push(d)}}break;case"co64":{const o=this.currentTrack;if(!o||!o.sampleTable)break;e.skip(4);const s=st(e);for(let u=0;u<s;u++){const d=ro(e);o.sampleTable.chunkOffsets.push(d)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(i,n.contentSize));break;case"mehd":{const o=Pt(e);e.skip(3);const s=o===1?ro(e):st(e);this.movieDurationInTimescale=s}break;case"trex":{e.skip(4);const o=st(e),s=st(e),u=st(e),d=st(e),f=st(e);this.fragmentTrackDefaults.push({trackId:o,defaultSampleDescriptionIndex:s,defaultSampleDuration:u,defaultSampleSize:d,defaultSampleFlags:f})}break;case"tfra":{const o=Pt(e);e.skip(3);const s=st(e),u=this.tracks.find(S=>S.id===s);if(!u)break;const d=st(e),f=(d&48)>>4,p=(d&12)>>2,h=d&3,y=[Pt,Yn,Zf,st],v=y[f],b=y[p],x=y[h],k=st(e);for(let S=0;S<k;S++){const P=o===1?ro(e):st(e),_=o===1?ro(e):st(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&&(lv(o,s.startTimestamp),o.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{pe(this.currentFragment),e.skip(1);const o=Zf(e),s=!!(o&1),u=!!(o&2),d=!!(o&8),f=!!(o&16),p=!!(o&32),h=!!(o&65536),y=!!(o&131072),v=st(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=ro(e):y&&(b.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),u&&(b.currentFragmentState.sampleDescriptionIndex=st(e)),d&&(b.currentFragmentState.defaultSampleDuration=st(e)),f&&(b.currentFragmentState.defaultSampleSize=st(e)),p&&(b.currentFragmentState.defaultSampleFlags=st(e)),h&&(b.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const o=this.currentTrack;if(!o)break;pe(o.currentFragmentState);const s=Pt(e);e.skip(3);const u=s===0?st(e):ro(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=Pt(e),u=Zf(e),d=!!(u&1),f=!!(u&4),p=!!(u&256),h=!!(u&512),y=!!(u&1024),v=!!(u&2048),b=st(e);let x=o.currentFragmentState.baseDataOffset;d&&(x+=vc(e));let k=null;f&&(k=st(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;p?I=st(e):(pe(o.currentFragmentState.defaultSampleDuration!==null),I=o.currentFragmentState.defaultSampleDuration);let M;h?M=st(e):(pe(o.currentFragmentState.defaultSampleSize!==null),M=o.currentFragmentState.defaultSampleSize);let R;y?R=st(e):(pe(o.currentFragmentState.defaultSampleFlags!==null),R=o.currentFragmentState.defaultSampleFlags),T===0&&k!==null&&(R=k);let N=0;v&&(s===0?N=st(e):N=vc(e));const B=!(R&65536);_.samples.push({presentationTimestamp:P+N,duration:I,byteOffset:S,byteSize:M,isKeyFrame:B}),S+=M,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],M=_.samples[I.sampleIndex];if(_.firstKeyFrameTimestamp===null&&M.isKeyFrame&&(_.firstKeyFrameTimestamp=M.presentationTimestamp),T<_.presentationTimestamps.length-1){const R=_.presentationTimestamps[T+1];M.duration=R.presentationTimestamp-I.presentationTimestamp}}const E=_.samples[_.presentationTimestamps[0].sampleIndex],A=_.samples[ui(_.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 d=u.filePos;this.metadataTags.raw??={},s.name[0]==="©"?this.metadataTags.raw[s.name]??=Uo(u):this.metadataTags.raw[s.name]??=Rt(u,s.contentSize),u.filePos=d}switch(s.name){case"meta":u.skip(-s.headerSize),this.traverseBox(u);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=La.decode(Rt(u,s.contentSize)):this.metadataTags.title??=Uo(u);break;case"©des":this.currentTrack||(this.metadataTags.description??=Uo(u));break;case"©ART":this.currentTrack||(this.metadataTags.artist??=Uo(u));break;case"©alb":this.currentTrack||(this.metadataTags.album??=Uo(u));break;case"albr":this.currentTrack||(this.metadataTags.albumArtist??=Uo(u));break;case"©gen":this.currentTrack||(this.metadataTags.genre??=Uo(u));break;case"©day":if(!this.currentTrack){const d=new Date(Uo(u));Number.isNaN(d.getTime())||(this.metadataTags.date??=d)}break;case"©cmt":this.currentTrack||(this.metadataTags.comment??=Uo(u));break;case"©lyr":this.currentTrack||(this.metadataTags.lyrics??=Uo(u));break}}}break;case"meta":{if(this.currentTrack)break;const s=st(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=st(e);for(let s=0;s<o;s++){const u=st(e);e.skip(4);const d=La.decode(Rt(e,u-8));this.currentMetadataKeys.set(s+1,d)}}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 d=s.name;const f=(d.charCodeAt(0)<<24)+(d.charCodeAt(1)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3);this.currentMetadataKeys.has(f)&&(d=this.currentMetadataKeys.get(f));const p=RR(u);switch(this.metadataTags.raw??={},this.metadataTags.raw[d]??=p,d){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":typeof p=="string"&&(this.metadataTags.title??=p);break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":typeof p=="string"&&(this.metadataTags.description??=p);break;case"©ART":case"com.apple.quicktime.artist":case"artist":typeof p=="string"&&(this.metadataTags.artist??=p);break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":typeof p=="string"&&(this.metadataTags.album??=p);break;case"aART":case"album_artist":typeof p=="string"&&(this.metadataTags.albumArtist??=p);break;case"©cmt":case"com.apple.quicktime.comment":case"comment":typeof p=="string"&&(this.metadataTags.comment??=p);break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":typeof p=="string"&&(this.metadataTags.genre??=p);break;case"©lyr":case"lyrics":typeof p=="string"&&(this.metadataTags.lyrics??=p);break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if(typeof p=="string"){const h=new Date(p);Number.isNaN(h.getTime())||(this.metadataTags.date??=h)}break;case"covr":case"com.apple.quicktime.artwork":p instanceof cp?(this.metadataTags.images??=[],this.metadataTags.images.push({data:p.data,kind:"coverFront",mimeType:p.mimeType})):p instanceof Uint8Array&&(this.metadataTags.images??=[],this.metadataTags.images.push({data:p,kind:"coverFront",mimeType:"image/*"}));break;case"track":if(typeof p=="string"){const h=p.split("/"),y=Number.parseInt(h[0],10),v=h[1]&&Number.parseInt(h[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(p instanceof Uint8Array&&p.length>=6){const h=$r(p),y=h.getUint16(2,!1),v=h.getUint16(4,!1);y>0&&(this.metadataTags.trackNumber??=y),v>0&&(this.metadataTags.tracksTotal??=v)}break;case"disc":case"disk":if(p instanceof Uint8Array&&p.length>=6){const h=$r(p),y=h.getUint16(2,!1),v=h.getUint16(4,!1);y>0&&(this.metadataTags.discNumber??=y),v>0&&(this.metadataTags.discsTotal??=v)}break}}}break}return e.filePos=a,!0}}class C8{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 Cp(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,r){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),a=i2(i,n),o=await this.fetchPacketForSampleIndex(a,r);return!vx(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 d=cr(u.presentationTimestamps,n,h=>h.presentationTimestamp),f=d!==-1?u.presentationTimestamps[d].sampleIndex:-1,p=d!==-1&&n<u.endTimestamp;return{sampleIndex:f,correctSampleFound:p}},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=LR(i,n),o=await this.fetchPacketForSampleIndex(a,r);return!vx(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 d=eb(u.presentationTimestamps,h=>u.samples[h.sampleIndex].isKeyFrame&&h.presentationTimestamp<=n),f=d!==-1?u.presentationTimestamps[d].sampleIndex:-1,p=d!==-1&&n<u.endTimestamp;return{sampleIndex:f,correctSampleFound:p}},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=BR(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,d)=>u.isKeyFrame&&d>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=FR(n,e);if(!i)return null;let a;if(r.metadataOnly)a=ca;else{let d=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);d instanceof Promise&&(d=await d),pe(d),a=Rt(d,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,u=new Pn(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=ca;else{let f=this.internalTrack.demuxer.reader.requestSlice(a.byteOffset,a.byteSize);f instanceof Promise&&(f=await f),pe(f),o=Rt(f,a.byteSize)}const s=(a.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,u=a.duration/this.internalTrack.timescale,d=new Pn(o,a.isKeyFrame?"key":"delta",s,u,e.moofOffset+r,a.byteSize);return this.packetToFragmentLocation.set(d,{fragment:e,sampleIndex:r}),d}async performFragmentedLookup(e,r,n,i,a){const o=this.internalTrack.demuxer;let s=null,u=null,d=-1;if(e){const{sampleIndex:x,correctSampleFound:k}=r(e);if(k)return this.fetchPacketInFragment(e,x,a);x!==-1&&(u=e,d=x)}const f=cr(this.internalTrack.fragmentLookupTable,n,x=>x.timestamp),p=f!==-1?this.internalTrack.fragmentLookupTable[f]:null,h=cr(this.internalTrack.fragmentPositionCache,n,x=>x.startTimestamp),y=h!==-1?this.internalTrack.fragmentPositionCache[h]:null,v=Math.max(p?.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,Xf,Qh);if(x instanceof Promise&&(x=await x),!x)break;const k=b,S=tu(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,d=P)}b=k+S.totalSize}if(p&&(!u||u.moofOffset<p.moofOffset)){const x=this.internalTrack.fragmentLookupTable[f-1];pe(!x||x.timestamp<p.timestamp);const k=x?.timestamp??-1/0;return this.performFragmentedLookup(null,r,k,i,a)}return u?this.fetchPacketInFragment(u,d,a):null}}class DR extends C8{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&&y8(e.data)}else if(this.internalTrack.info.codec==="av1"&&!this.internalTrack.info.av1CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&b8(e.data)}return{codec:tb(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 NR extends C8{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:rb(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:this.internalTrack.info.codecDescription??void 0}:null}}const i2=(t,e)=>{if(t.presentationTimestamps){const r=cr(t.presentationTimestamps,e,n=>n.presentationTimestamp);return r===-1?-1:t.presentationTimestamps[r].sampleIndex}else{const r=cr(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)}},LR=(t,e)=>{if(!t.keySampleIndices)return i2(t,e);if(t.presentationTimestamps){const r=cr(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(Vp(t.keySampleIndices,i,o=>o)!==-1)return i}return-1}else{const r=i2(t,e),n=cr(t.keySampleIndices,r,i=>i);return t.keySampleIndices[n]??-1}},FR=(t,e)=>{const r=cr(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=cr(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)],d=cr(t.sampleToChunk,e,k=>k.startSampleIndex),f=t.sampleToChunk[d];pe(f);const p=f.startChunkIndex+Math.floor((e-f.startSampleIndex)/f.samplesPerChunk),h=t.chunkOffsets[p],y=f.startSampleIndex+(p-f.startChunkIndex)*f.samplesPerChunk;let v=0,b=h;if(t.sampleSizes.length===1)b+=u*(e-y),v+=u*f.samplesPerChunk;else for(let k=y;k<y+f.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:h,chunkSize:v,isKeyFrame:t.keySampleIndices?Vp(t.keySampleIndices,e,k=>k)!==-1:!0}},BR=(t,e)=>{if(!t.keySampleIndices)return e+1;const r=cr(t.keySampleIndices,e,n=>n);return t.keySampleIndices[r+1]??-1},lv=(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},zR=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},vx=t=>t.sampleSizes.length===0;var He;(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"})(He||(He={}));const jR=[He.EBML,He.Segment],Ip=[He.SeekHead,He.Info,He.Cluster,He.Tracks,He.Cues,He.Attachments,He.Chapters,He.Tags],Tg=[...jR,...Ip],a2=8,Ta=2,Us=2*a2,O8=t=>{if(t.remainingLength<1)return null;const e=Pt(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},Zh=t=>{if(t.remainingLength<1)return null;const e=Pt(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+=Pt(t);return i},Xt=(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+=Pt(t);return r},UR=(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(Pt(t));return r},lb=t=>{const e=O8(t);return e===null||t.remainingLength<e?null:Xt(t,e)},A8=t=>{if(t.remainingLength<1)return null;if(Pt(t)===255)return;t.skip(-1);const r=Zh(t);if(r===null)return null;if(r!==72057594037927940)return r},Bs=t=>{pe(t.remainingLength>=Ta);const e=lb(t);if(e===null)return null;const r=A8(t);return r===null?null:{id:e,size:r}},Yf=(t,e)=>{const r=Rt(t,e);let n=0;for(;n<e&&r[n]!==0;)n+=1;return String.fromCharCode(...r.subarray(0,n))},Fh=(t,e)=>{const r=Rt(t,e);let n=0;for(;n<e&&r[n]!==0;)n+=1;return La.decode(r.subarray(0,n))},uv=(t,e)=>{if(e===0)return 0;if(e!==4&&e!==8)throw new Error("Bad float size "+e);return e===4?tD(t):U8(t)},o2=async(t,e,r,n)=>{const i=new Set(r);let a=e;for(;n===null||a<n;){let o=t.requestSliceRange(a,Ta,Us);if(o instanceof Promise&&(o=await o),!o)break;const s=Bs(o);if(!s)break;if(i.has(s.id))return{pos:a,found:!0};eu(s.size),a=o.filePos+s.size}return{pos:n!==null&&n>a?n:a,found:!1}},I8=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<a2)break;for(let u=0;u<s.length-a2;u++){s.filePos=o;const d=lb(s);if(d!==null&&a.has(d))return o;o++}}return null},Ho={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 eu(t){if(t===void 0)throw new Error("Undefined element size is used in a place where it is not supported.")}const HR=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 Ds;(function(t){t[t.None=0]="None",t[t.Xiph=1]="Xiph",t[t.FixedSize=2]="FixedSize",t[t.Ebml=3]="Ebml"})(Ds||(Ds={}));var t0;(function(t){t[t.Block=1]="Block",t[t.Private=2]="Private",t[t.Next=4]="Next"})(t0||(t0={}));var fp;(function(t){t[t.Zlib=0]="Zlib",t[t.Bzlib=1]="Bzlib",t[t.lzo1x=2]="lzo1x",t[t.HeaderStripping=3]="HeaderStripping"})(fp||(fp={}));const cv=[{id:He.SeekHead,flag:"seekHeadSeen"},{id:He.Info,flag:"infoSeen"},{id:He.Tracks,flag:"tracksSeen"},{id:He.Cues,flag:"cuesSeen"}],R8=10*2**20;class $R extends Tu{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 HR({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,Ta,Us);if(r instanceof Promise&&(r=await r),!r)break;const n=Bs(r);if(!n)break;const i=n.id;let a=n.size;const o=r.filePos;if(i===He.EBML){eu(a);let s=this.reader.requestSlice(o,a);if(s instanceof Promise&&(s=await s),!s)break;this.readContiguousElements(s)}else if(i===He.Segment){if(await this.readSegment(o,a),a===void 0||this.reader.fileSize===null)break}else if(i===He.Cluster){if(this.reader.fileSize===null)break;a===void 0&&(a=(await o2(this.reader,o,Tg,this.reader.fileSize)).pos-o);const s=ui(this.segments);s&&(s.elementEndPos=o+a)}eu(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,Ta,Us);if(s instanceof Promise&&(s=await s),!s)break;const u=n,d=Bs(s);if(!d||!Ip.includes(d.id)&&d.id!==He.Void){const v=await I8(this.reader,u,Ip,Math.min(this.currentSegment.elementEndPos??1/0,u+R8));if(v){n=v;continue}else break}const{id:f,size:p}=d,h=s.filePos,y=cv.findIndex(v=>v.id===f);if(y!==-1){const v=cv[y].flag;this.currentSegment[v]=!0,eu(p);let b=this.reader.requestSlice(h,p);b instanceof Promise&&(b=await b),b&&this.readContiguousElements(b)}else if(f===He.Tags||f===He.Attachments){f===He.Tags?this.currentSegment.tagsSeen=!0:this.currentSegment.attachmentsSeen=!0,eu(p);let v=this.reader.requestSlice(h,p);v instanceof Promise&&(v=await v),v&&this.readContiguousElements(v)}else if(f===He.Cluster){this.currentSegment.clusterSeekStartPos=u;break}if(p===void 0)break;n=h+p}if(this.currentSegment.seekEntries.sort((s,u)=>s.segmentPosition-u.segmentPosition),this.reader.fileSize!==null)for(const s of this.currentSegment.seekEntries){const u=cv.find(v=>v.id===s.id);if(!u||this.currentSegment[u.flag])continue;let d=this.reader.requestSliceRange(e+s.segmentPosition,Ta,Us);if(d instanceof Promise&&(d=await d),!d)continue;const f=Bs(d);if(!f)continue;const{id:p,size:h}=f;if(p!==u.id)continue;eu(h),this.currentSegment[u.flag]=!0;let y=this.reader.requestSlice(d.filePos,h);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,d)=>u.time-d.time);for(let u=0;u<s.cuePoints.length-1;u++){const d=s.cuePoints[u],f=s.cuePoints[u+1];d.time===f.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,Ta,Us);n instanceof Promise&&(n=await n),pe(n);const i=e,a=Bs(n);pe(a);const o=a.id;pe(o===He.Cluster);let s=a.size;const u=n.filePos;s===void 0&&(s=(await o2(this.reader,u,Tg,r.elementEndPos)).pos-u);let d=this.reader.requestSlice(u,s);d instanceof Promise&&(d=await d);const f={segment:r,elementStartPos:i,elementEndPos:u+s,dataStartPos:u,timestamp:-1,trackData:new Map};if(this.currentCluster=f,d){const p=this.readContiguousElements(d,Tg);f.elementEndPos=p}for(const[,p]of f.trackData){const h=p.track;pe(p.blocks.length>0);let y=!1;for(let k=0;k<p.blocks.length;k++){const S=p.blocks[k];S.timestamp+=f.timestamp,y||=S.lacing!==Ds.None}p.presentationTimestamps=p.blocks.map((k,S)=>({timestamp:k.timestamp,blockIndex:S})).sort((k,S)=>k.timestamp-S.timestamp);for(let k=0;k<p.presentationTimestamps.length;k++){const S=p.presentationTimestamps[k],P=p.blocks[S.blockIndex];if(p.firstKeyFrameTimestamp===null&&P.isKeyFrame&&(p.firstKeyFrameTimestamp=P.timestamp),k<p.presentationTimestamps.length-1){const _=p.presentationTimestamps[k+1];P.duration=_.timestamp-P.timestamp}else P.duration===0&&h.defaultDuration!=null&&P.lacing===Ds.None&&(P.duration=h.defaultDuration)}y&&(this.expandLacedBlocks(p.blocks,h),p.presentationTimestamps=p.blocks.map((k,S)=>({timestamp:k.timestamp,blockIndex:S})).sort((k,S)=>k.timestamp-S.timestamp));const v=p.blocks[p.presentationTimestamps[0].blockIndex],b=p.blocks[ui(p.presentationTimestamps).blockIndex];p.startTimestamp=v.timestamp,p.endTimestamp=b.timestamp+b.duration;const x=cr(h.clusterPositionCache,p.startTimestamp,k=>k.startTimestamp);(x===-1||h.clusterPositionCache[x].elementStartPos!==i)&&h.clusterPositionCache.splice(x+1,0,{elementStartPos:f.elementStartPos,startTimestamp:p.startTimestamp})}return r.lastReadCluster=f,f}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===Ds.None)continue;i.decoded||(i.data=this.decodeBlockData(r,i.data),i.decoded=!0);const a=Zs.tempFromBytes(i.data),o=[],s=Pt(a)+1;switch(i.lacing){case Ds.Xiph:{let d=0;for(let f=0;f<s-1;f++){let p=0;for(;a.bufferPos<a.length;){const h=Pt(a);if(p+=h,h<255){o.push(p),d+=p;break}}}o.push(a.length-(a.bufferPos+d))}break;case Ds.FixedSize:{const d=a.length-1,f=Math.floor(d/s);for(let p=0;p<s;p++)o.push(f)}break;case Ds.Ebml:{const d=Zh(a);pe(d!==null);let f=d;o.push(f);let p=f;for(let h=1;h<s-1;h++){const y=a.bufferPos,v=Zh(a);pe(v!==null);const b=v,k=(1<<(a.bufferPos-y)*7-1)-1,S=b-k;f+=S,o.push(f),p+=f}o.push(a.length-(a.bufferPos+p))}break;default:pe(!1)}pe(o.length===s),e.splice(n,1);const u=i.duration||s*(r.defaultDuration??0);for(let d=0;d<s;d++){const f=o[d],p=Rt(a,f),h=i.timestamp+u*d/s,y=u/s;e.splice(n+d,0,{timestamp:h,duration:y,isKeyFrame:i.isKeyFrame,data:p,lacing:Ds.None,decoded:!0,mainAdditional:i.mainAdditional})}n+=s,n--}}async loadSegmentMetadata(e){for(const r of e.seekEntries){if(!(r.id===He.Tags&&!e.tagsSeen)){if(!(r.id===He.Attachments&&!e.attachmentsSeen))continue}let n=this.reader.requestSliceRange(e.dataStartPos+r.segmentPosition,Ta,Us);if(n instanceof Promise&&(n=await n),!n)continue;const i=Bs(n);if(!i||i.id!==r.id)continue;const{size:a}=i;eu(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===He.Tags?e.tagsSeen=!0:r.id===He.Attachments&&(e.attachmentsSeen=!0)}}readContiguousElements(e,r){for(;e.remainingLength>=Ta;){const n=e.filePos;if(!this.traverseElement(e,r))return n}return e.filePos}traverseElement(e,r){const n=Bs(e);if(!n||r&&r.includes(n.id))return!1;const{id:i,size:a}=n,o=e.filePos;switch(eu(a),i){case He.DocType:this.isWebM=Yf(e,a)==="webm";break;case He.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 He.SeekID:{const s=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!s)break;s.id=Xt(e,a)}break;case He.SeekPosition:{const s=this.currentSegment?.seekEntries[this.currentSegment.seekEntries.length-1];if(!s)break;s.segmentPosition=Xt(e,a)}break;case He.TimestampScale:{if(!this.currentSegment)break;this.currentSegment.timestampScale=Xt(e,a),this.currentSegment.timestampFactor=1e9/this.currentSegment.timestampScale}break;case He.Duration:{if(!this.currentSegment)break;this.currentSegment.duration=uv(e,a)}break;case He.TrackEntry:{if(!this.currentSegment||(this.currentTrack={id:-1,segment:this.currentSegment,demuxer:this,clusterPositionCache:[],cuePoints:[],disposition:{...Eu},inputTrack:null,codecId:null,codecPrivate:null,defaultDuration:null,defaultDurationNs:null,name:null,languageCode:Da,decodingInstructions:[],info:null},this.readContiguousElements(e.slice(o,a)),!this.currentTrack))break;if(this.currentTrack.decodingInstructions.some(s=>s.data?.type!=="decompress"||s.scope!==t0.Block||s.data.algorithm!==fp.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===Ho.avc?(this.currentTrack.info.codec="avc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):this.currentTrack.codecId===Ho.hevc?(this.currentTrack.info.codec="hevc",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):u===Ho.vp8?this.currentTrack.info.codec="vp8":u===Ho.vp9?this.currentTrack.info.codec="vp9":u===Ho.av1&&(this.currentTrack.info.codec="av1");const d=this.currentTrack,f=new Ld(this.input,new qR(d));this.currentTrack.inputTrack=f,this.currentSegment.tracks.push(this.currentTrack)}else if(this.currentTrack.info.type==="audio"&&this.currentTrack.info.numberOfChannels!==-1&&this.currentTrack.info.sampleRate!==-1){u===Ho.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===Ho.mp3?this.currentTrack.info.codec="mp3":u===Ho.opus?(this.currentTrack.info.codec="opus",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate,this.currentTrack.info.sampleRate=I0):u===Ho.vorbis?(this.currentTrack.info.codec="vorbis",this.currentTrack.info.codecDescription=this.currentTrack.codecPrivate):u===Ho.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 d=this.currentTrack,f=new ho(this.input,new VR(d));this.currentTrack.inputTrack=f,this.currentSegment.tracks.push(this.currentTrack)}}this.currentTrack=null}break;case He.TrackNumber:{if(!this.currentTrack)break;this.currentTrack.id=Xt(e,a)}break;case He.TrackType:{if(!this.currentTrack)break;const s=Xt(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 He.FlagEnabled:{if(!this.currentTrack)break;Xt(e,a)||(this.currentTrack=null)}break;case He.FlagDefault:{if(!this.currentTrack)break;this.currentTrack.disposition.default=!!Xt(e,a)}break;case He.FlagForced:{if(!this.currentTrack)break;this.currentTrack.disposition.forced=!!Xt(e,a)}break;case He.FlagOriginal:{if(!this.currentTrack)break;this.currentTrack.disposition.original=!!Xt(e,a)}break;case He.FlagHearingImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.hearingImpaired=!!Xt(e,a)}break;case He.FlagVisualImpaired:{if(!this.currentTrack)break;this.currentTrack.disposition.visuallyImpaired=!!Xt(e,a)}break;case He.FlagCommentary:{if(!this.currentTrack)break;this.currentTrack.disposition.commentary=!!Xt(e,a)}break;case He.CodecID:{if(!this.currentTrack)break;this.currentTrack.codecId=Yf(e,a)}break;case He.CodecPrivate:{if(!this.currentTrack)break;this.currentTrack.codecPrivate=Rt(e,a)}break;case He.DefaultDuration:{if(!this.currentTrack)break;this.currentTrack.defaultDurationNs=Xt(e,a)}break;case He.Name:{if(!this.currentTrack)break;this.currentTrack.name=Fh(e,a)}break;case He.Language:{if(!this.currentTrack||this.currentTrack.languageCode!==Da)break;this.currentTrack.languageCode=Yf(e,a),n8(this.currentTrack.languageCode)||(this.currentTrack.languageCode=Da)}break;case He.LanguageBCP47:{if(!this.currentTrack)break;const u=Yf(e,a).split("-")[0];u?this.currentTrack.languageCode=u:this.currentTrack.languageCode=Da}break;case He.Video:{if(this.currentTrack?.info?.type!=="video")break;this.readContiguousElements(e.slice(o,a))}break;case He.PixelWidth:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.width=Xt(e,a)}break;case He.PixelHeight:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.height=Xt(e,a)}break;case He.AlphaMode:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.alphaMode=Xt(e,a)===1}break;case He.Colour:{if(this.currentTrack?.info?.type!=="video")break;this.currentTrack.info.colorSpace={},this.readContiguousElements(e.slice(o,a))}break;case He.MatrixCoefficients:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=Xt(e,a),u=Zg[s]??null;this.currentTrack.info.colorSpace.matrix=u}break;case He.Range:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;this.currentTrack.info.colorSpace.fullRange=Xt(e,a)===2}break;case He.TransferCharacteristics:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=Xt(e,a),u=Qg[s]??null;this.currentTrack.info.colorSpace.transfer=u}break;case He.Primaries:{if(this.currentTrack?.info?.type!=="video"||!this.currentTrack.info.colorSpace)break;const s=Xt(e,a),u=Kg[s]??null;this.currentTrack.info.colorSpace.primaries=u}break;case He.Projection:{if(this.currentTrack?.info?.type!=="video")break;this.readContiguousElements(e.slice(o,a))}break;case He.ProjectionPoseRoll:{if(this.currentTrack?.info?.type!=="video")break;const u=-uv(e,a);try{this.currentTrack.info.rotation=Jk(u)}catch{}}break;case He.Audio:{if(this.currentTrack?.info?.type!=="audio")break;this.readContiguousElements(e.slice(o,a))}break;case He.SamplingFrequency:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.sampleRate=uv(e,a)}break;case He.Channels:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.numberOfChannels=Xt(e,a)}break;case He.BitDepth:{if(this.currentTrack?.info?.type!=="audio")break;this.currentTrack.info.bitDepth=Xt(e,a)}break;case He.CuePoint:{if(!this.currentSegment)break;this.readContiguousElements(e.slice(o,a)),this.currentCueTime=null}break;case He.CueTime:this.currentCueTime=Xt(e,a);break;case He.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 He.CueTrack:{const s=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!s)break;s.trackId=Xt(e,a)}break;case He.CueClusterPosition:{const s=this.currentSegment?.cuePoints[this.currentSegment.cuePoints.length-1];if(!s)break;pe(this.currentSegment),s.clusterPosition=this.currentSegment.dataStartPos+Xt(e,a)}break;case He.Timestamp:{if(!this.currentCluster)break;this.currentCluster.timestamp=Xt(e,a)}break;case He.SimpleBlock:{if(!this.currentCluster)break;const s=Zh(e);if(s===null)break;const u=this.getTrackDataInCluster(this.currentCluster,s);if(!u)break;const d=c2(e),f=Pt(e),p=f>>1&3;let h=!!(f&128);u.track.info?.type==="audio"&&u.track.info.codec&&(h=!0);const y=Rt(e,a-(e.filePos-o)),v=u.track.decodingInstructions.length>0;u.blocks.push({timestamp:d,duration:0,isKeyFrame:h,data:y,lacing:p,decoded:!v,mainAdditional:null})}break;case He.BlockGroup:{if(!this.currentCluster)break;this.readContiguousElements(e.slice(o,a)),this.currentBlock=null}break;case He.Block:{if(!this.currentCluster)break;const s=Zh(e);if(s===null)break;const u=this.getTrackDataInCluster(this.currentCluster,s);if(!u)break;const d=c2(e),p=Pt(e)>>1&3,h=Rt(e,a-(e.filePos-o)),y=u.track.decodingInstructions.length>0;this.currentBlock={timestamp:d,duration:0,isKeyFrame:!0,data:h,lacing:p,decoded:!y,mainAdditional:null},u.blocks.push(this.currentBlock)}break;case He.BlockAdditions:this.readContiguousElements(e.slice(o,a));break;case He.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 He.BlockAdditional:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.data=Rt(e,a)}break;case He.BlockAddID:{if(!this.currentBlockAdditional)break;this.currentBlockAdditional.addId=Xt(e,a)}break;case He.BlockDuration:{if(!this.currentBlock)break;this.currentBlock.duration=Xt(e,a)}break;case He.ReferenceBlock:{if(!this.currentBlock)break;this.currentBlock.isKeyFrame=!1}break;case He.Tag:this.currentTagTargetIsMovie=!0,this.readContiguousElements(e.slice(o,a));break;case He.Targets:this.readContiguousElements(e.slice(o,a));break;case He.TargetTypeValue:Xt(e,a)!==50&&(this.currentTagTargetIsMovie=!1);break;case He.TagTrackUID:case He.TagEditionUID:case He.TagChapterUID:case He.TagAttachmentUID:this.currentTagTargetIsMovie=!1;break;case He.SimpleTag:{if(!this.currentTagTargetIsMovie)break;this.currentSimpleTagName=null,this.readContiguousElements(e.slice(o,a))}break;case He.TagName:this.currentSimpleTagName=Fh(e,a);break;case He.TagString:{if(!this.currentSimpleTagName)break;const s=Fh(e,a);this.processTagValue(this.currentSimpleTagName,s)}break;case He.TagBinary:{if(!this.currentSimpleTagName)break;const s=Rt(e,a);this.processTagValue(this.currentSimpleTagName,s)}break;case He.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 s8(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 d="unknown";if(u){const f=u.toLowerCase();f.startsWith("cover.")?d="coverFront":f.startsWith("back.")&&(d="coverBack")}s.images??=[],s.images.push({data:this.currentAttachedFile.fileData,mimeType:this.currentAttachedFile.fileMediaType,kind:d,name:this.currentAttachedFile.fileName??void 0,description:this.currentAttachedFile.fileDescription??void 0})}this.currentAttachedFile=null}break;case He.FileUID:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileUid=UR(e,a)}break;case He.FileName:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileName=Fh(e,a)}break;case He.FileMediaType:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileMediaType=Yf(e,a)}break;case He.FileData:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileData=Rt(e,a)}break;case He.FileDescription:{if(!this.currentAttachedFile)break;this.currentAttachedFile.fileDescription=Fh(e,a)}break;case He.ContentEncodings:{if(!this.currentTrack)break;this.readContiguousElements(e.slice(o,a)),this.currentTrack.decodingInstructions.sort((s,u)=>u.order-s.order)}break;case He.ContentEncoding:this.currentDecodingInstruction={order:0,scope:t0.Block,data:null},this.readContiguousElements(e.slice(o,a)),this.currentDecodingInstruction.data&&this.currentTrack.decodingInstructions.push(this.currentDecodingInstruction),this.currentDecodingInstruction=null;break;case He.ContentEncodingOrder:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.order=Xt(e,a)}break;case He.ContentEncodingScope:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.scope=Xt(e,a)}break;case He.ContentCompression:{if(!this.currentDecodingInstruction)break;this.currentDecodingInstruction.data={type:"decompress",algorithm:fp.Zlib,settings:null},this.readContiguousElements(e.slice(o,a))}break;case He.ContentCompAlgo:{if(this.currentDecodingInstruction?.data?.type!=="decompress")break;this.currentDecodingInstruction.data.algorithm=Xt(e,a)}break;case He.ContentCompSettings:{if(this.currentDecodingInstruction?.data?.type!=="decompress")break;this.currentDecodingInstruction.data.settings=Rt(e,a)}break;case He.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 fp.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 M8{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 Cp(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=cr(a.presentationTimestamps,n,d=>d.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=eb(a.presentationTimestamps,d=>a.blocks[d.blockIndex].isKeyFrame&&d.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?ca:a.data,s=a.timestamp/this.internalTrack.segment.timestampFactor,u=a.duration/this.internalTrack.segment.timestampFactor,d={};a.mainAdditional&&this.internalTrack.info?.type==="video"&&this.internalTrack.info.alphaMode&&(d.alpha=n.metadataOnly?ca:a.mainAdditional,d.alphaByteLength=a.mainAdditional.byteLength);const f=new Pn(o,a.isKeyFrame?"key":"delta",s,u,e.dataStartPos+r,a.data.byteLength,d);return this.packetToClusterLocation.set(f,{cluster:e,blockIndex:r}),f}async performClusterLookup(e,r,n,i,a){const{demuxer:o,segment:s}=this.internalTrack;let u=null,d=null,f=-1;if(e){const{blockIndex:k,correctBlockFound:S}=r(e);if(S)return this.fetchPacketInCluster(e,k,a);k!==-1&&(d=e,f=k)}const p=cr(this.internalTrack.cuePoints,n,k=>k.time),h=p!==-1?this.internalTrack.cuePoints[p]:null,y=cr(this.internalTrack.clusterPositionCache,n,k=>k.startTimestamp),v=y!==-1?this.internalTrack.clusterPositionCache[y]:null,b=Math.max(h?.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-Ta;){if(u){const I=u.trackData.get(this.internalTrack.id);if(I&&I.startTimestamp>i)break}let k=o.reader.requestSliceRange(x,Ta,Us);if(k instanceof Promise&&(k=await k),!k)break;const S=x,P=Bs(k);if(!P||!Ip.includes(P.id)&&P.id!==He.Void){const I=await I8(o.reader,S,Ip,Math.min(s.elementEndPos??1/0,S+R8));if(I){x=I;continue}else break}const _=P.id;let E=P.size;const A=k.filePos;if(_===He.Cluster){u=await o.readCluster(S,s),E=u.elementEndPos-A;const{blockIndex:I,correctBlockFound:M}=r(u);if(M)return this.fetchPacketInCluster(u,I,a);I!==-1&&(d=u,f=I)}E===void 0&&(pe(_!==He.Cluster),E=(await o2(o.reader,A,Tg,s.elementEndPos)).pos-A);const T=A+E;if(s.elementEndPos===null){let I=o.reader.requestSliceRange(T,Ta,Us);if(I instanceof Promise&&(I=await I),!I)break;if(lb(I)===He.Segment){s.elementEndPos=T;break}}x=T}if(h&&(!d||d.elementStartPos<h.clusterPosition)){const k=this.internalTrack.cuePoints[p-1];pe(!k||k.time<h.time);const S=k?.time??-1/0;return this.performClusterLookup(null,r,S,i,a)}return d?this.fetchPacketInCluster(d,f,a):null}}class qR extends M8{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:tb({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?h8(e.data):null,hevcCodecInfo:this.internalTrack.info.codec==="hevc"&&e?g8(e.data):null,vp9CodecInfo:this.internalTrack.info.codec==="vp9"&&e?y8(e.data):null,av1CodecInfo:this.internalTrack.info.codec==="av1"&&e?b8(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 VR extends M8{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:rb({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 dp=4,WR=[44100,48e3,32e3],GR=[-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],XR=1483304551,YR=1231971951,KR=(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,QR=(t,e)=>t===3?e===3?21:36:e===3?13:21,ub=(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,d=n>>1&3,f=i>>4&15,p=(i>>2&3)%3,h=i>>1&1,y=a>>6&3,v=a>>4&3,b=a>>3&1,x=a>>2&1,k=a&3,S=GR[o*16*4+d*16+f];if(S===-1)return{header:null,bytesAdvanced:1};const P=S*1e3,_=WR[p]>>o+s,E=KR(o,d,P,_,h);if(e!==null&&e<E)return{header:null,bytesAdvanced:1};let A;return u===3?A=d===3?384:1152:d===3?A=384:d===2?A=1152:A=576,{header:{totalSize:E,mpegVersionId:u,layer:d,bitrate:P,frequencyIndex:p,sampleRate:_,channel:y,modeExtension:v,copyright:b,original:x,emphasis:k,audioSamplesInFrame:A},bytesAdvanced:1}},s2=t=>{let e=2130706432,r=0;for(;e!==0;)r>>=1,r|=t&e,e>>=8;return r};var ad;(function(t){t[t.Unsynchronisation=128]="Unsynchronisation",t[t.ExtendedHeader=64]="ExtendedHeader",t[t.ExperimentalIndicator=32]="ExperimentalIndicator",t[t.Footer=16]="Footer"})(ad||(ad={}));var od;(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"})(od||(od={}));const Cg=128,r0=10,sd=["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"],ZR=(t,e)=>{const r=t.filePos;e.raw??={},e.raw.TAG??=Rt(t,Cg-3),t.filePos=r;const n=$f(t,30);n&&(e.title??=n);const i=$f(t,30);i&&(e.artist??=i);const a=$f(t,30);a&&(e.album??=a);const o=$f(t,4),s=Number.parseInt(o,10);Number.isInteger(s)&&s>0&&(e.date??=new Date(s,0,1));const u=Rt(t,30);let d;if(u[28]===0&&u[29]!==0){const p=u[29];p>0&&(e.trackNumber??=p),t.skip(-30),d=$f(t,28),t.skip(2)}else t.skip(-30),d=$f(t,30);d&&(e.comment??=d);const f=Pt(t);f<sd.length&&(e.genre??=sd[f])},$f=(t,e)=>{const r=Rt(t,e),n=Gf(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()},n0=t=>{const e=t.filePos,r=Qn(t,3),n=Pt(t),i=Pt(t),a=Pt(t),o=st(t);if(r!=="ID3"||n===255||i===255||(o&2155905152)!==0)return t.filePos=e,null;const s=s2(o);return{majorVersion:n,revision:i,flags:a,size:s}},D8=(t,e,r)=>{if(![2,3,4].includes(e.majorVersion)){console.warn(`Unsupported ID3v2 major version: ${e.majorVersion}`);return}const n=Rt(t,e.size),i=new JR(e,n);if(e.flags&ad.Footer&&i.removeFooter(),e.flags&ad.Unsynchronisation&&e.majorVersion===3&&i.ununsynchronizeAll(),e.flags&ad.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,d=!1,f=!1;if(e.majorVersion===3?(u=!!(a.flags&64),d=!!(a.flags&128)):e.majorVersion===4&&(u=!!(a.flags&4),d=!!(a.flags&8),f=!!(a.flags&2)||!!(e.flags&ad.Unsynchronisation)),u){console.warn(`Skipping encrypted ID3v2 frame ${a.id}`),i.pos=s;continue}if(d){console.warn(`Skipping compressed ID3v2 frame ${a.id}`),i.pos=s;continue}switch(f&&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 h=i.readId3V2EncodingAndText(s).split("/"),y=Number.parseInt(h[0],10),v=h[1]&&Number.parseInt(h[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 h=i.readId3V2EncodingAndText(s).split("/"),y=Number.parseInt(h[0],10),v=h[1]&&Number.parseInt(h[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 p=i.readId3V2EncodingAndText(s);let h=/^\((\d+)\)/.exec(p);if(h){const y=Number.parseInt(h[1]);if(sd[y]!==void 0){r.genre??=sd[y];break}}if(h=/^\d+$/.exec(p),h){const y=Number.parseInt(h[0]);if(sd[y]!==void 0){r.genre??=sd[y];break}}r.genre??=p}break;case"TDRC":case"TDAT":{const p=i.readId3V2EncodingAndText(s),h=new Date(p);Number.isNaN(h.getTime())||(r.date??=h)}break;case"TYER":case"TYE":{const p=i.readId3V2EncodingAndText(s),h=Number.parseInt(p,10);Number.isInteger(h)&&(r.date??=new Date(h,0,1))}break;case"USLT":case"ULT":{const p=i.readU8();i.pos+=3,i.readId3V2Text(p,s),r.lyrics??=i.readId3V2Text(p,s)}break;case"COMM":case"COM":{const p=i.readU8();i.pos+=3,i.readId3V2Text(p,s),r.comment??=i.readId3V2Text(p,s)}break;case"APIC":case"PIC":{const p=i.readId3V2TextEncoding();let h;if(e.majorVersion===2){const x=i.readAscii(3);h=x==="PNG"?"image/png":x==="JPG"?"image/jpeg":"image/*"}else h=i.readId3V2Text(p,s);const y=i.readU8(),v=i.readId3V2Text(p,s).trimEnd(),b=s-i.pos;if(b>=0){const x=i.readBytes(b);r.images||(r.images=[]),r.images.push({data:x,mimeType:h,kind:y===3?"coverFront":y===4?"coverBack":"unknown",description:v})}}break;default:i.pos+=a.size;break}i.pos=s}};class JR{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-r0),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?s2(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 d=this.readAscii(4);if(d!=="\0\0\0\0"&&!/[0-9A-Z]{4}/.test(d))return!1}return!0};if(!o(n)){const s=this.header.majorVersion===4?r:s2(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 od.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 od.UTF_16_WITH_BOM:if(i[0]===255&&i[1]===254){const a=new TextDecoder("utf-16le"),o=Gf(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=Gf(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=Gf(i.findIndex(o=>o===0),i.length);return this.pos=n+Math.min(a+1,i.length),La.decode(i.subarray(0,a))}case od.UTF_16_BE_NO_BOM:{const a=new TextDecoder("utf-16be"),o=Gf(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 od.UTF_8:{const a=Gf(i.findIndex(o=>o===0),i.length);return this.pos=n+Math.min(a+1,i.length),La.decode(i.subarray(0,a))}}}readId3V2EncodingAndText(e){if(this.pos>=e)return"";const r=this.readId3V2TextEncoding();return this.readId3V2Text(r,e)}}const l2=async(t,e,r)=>{let n=e;for(;r===null||n<r;){let i=t.requestSlice(n,dp);if(i instanceof Promise&&(i=await i),!i)break;const a=st(i),o=ub(a,t.fileSize!==null?t.fileSize-n:null);if(o.header)return{header:o.header,startPos:n};n+=o.bytesAdvanced}return null};class eM extends Tu{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.metadataTags=null,this.tracks=[],this.readingMutex=new qp,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 ho(this.input,new tM(this))]})()}async advanceReader(){if(this.lastLoadedPos===0)for(;;){let s=this.reader.requestSlice(this.lastLoadedPos,r0);if(s instanceof Promise&&(s=await s),!s){this.lastSampleLoaded=!0;return}const u=n0(s);if(!u)break;this.lastLoadedPos=s.filePos+u.size}const e=await l2(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=QR(r.mpegVersionId,r.channel);let i=this.reader.requestSlice(e.startPos+n,4);if(i instanceof Promise&&(i=await i),i){const s=st(i);if(s===XR||s===YR)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,r0);if(i instanceof Promise&&(i=await i),!i)break;const a=n0(i);if(!a)break;n=!0;let o=this.reader.requestSlice(i.filePos,a.size);if(o instanceof Promise&&(o=await o),!o)break;D8(o,a,this.metadataTags),r=i.filePos+a.size}if(!n&&this.reader.fileSize!==null&&this.reader.fileSize>=Cg){let i=this.reader.requestSlice(this.reader.fileSize-Cg,Cg);i instanceof Promise&&(i=await i),pe(i),Qn(i,3)==="TAG"&&ZR(i,this.metadataTags)}return this.metadataTags}finally{e()}}}class tM{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 Da}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{...Eu}}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=ca;else{let a=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(a instanceof Promise&&(a=await a),!a)return null;i=Rt(a,n.dataSize)}return new Pn(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=Vp(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=cr(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 N8=1399285583,rM=79764919,L8=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^rM:e<<1;L8[t]=e>>>0&4294967295}const nM=t=>{const e=$r(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^L8[n>>>24^a])>>>0}return e.setUint32(22,r,!0),n},iM=(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<<VI(a-1))-1<<1,u=(t[0]&s)>>1;if(u>=e.vorbisInfo.modeBlockflags.length)throw new Error("Invalid mode number.");let d=r;const f=e.vorbisInfo.modeBlockflags[u];if(i=e.vorbisInfo.blocksizes[f],f===1){const p=(s|1)+1,h=t[0]&p?1:0;d=e.vorbisInfo.blocksizes[h]}n=d!==null?d+i>>2:0}else e.codec==="opus"&&(n=gR(t).durationInSamples);return{durationInSamples:n,vorbisBlockSize:i}},aM=t=>{let e="audio/ogg";if(t.codecStrings){const r=[...new Set(t.codecStrings)];e+=`; codecs="${r.join(", ")}"`}return e};const yc=27,md=282,oM=md+65025,hp=t=>{const e=t.filePos;if(cd(t)!==N8)return null;t.skip(1);const n=Pt(t),i=eD(t),a=cd(t),o=cd(t),s=cd(t),u=Pt(t),d=new Uint8Array(u);for(let y=0;y<u;y++)d[y]=Pt(t);const f=27+u,p=d.reduce((y,v)=>y+v,0),h=f+p;return{headerStartPos:e,totalSize:h,dataStartPos:e+f,dataSize:p,headerType:n,granulePosition:i,serialNumber:a,sequenceNumber:o,checksum:s,lacingValues:d}},sM=(t,e)=>{for(;t.filePos<e-3;){const r=cd(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===N8)return!0;t.skip(1)}}return!1};class lM extends Tu{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,yc,md);if(r instanceof Promise&&(r=await r),!r)break;const n=hp(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 ho(this.input,new uM(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=p=>{for(;o.push(Math.min(255,p)),!(p<255);)p-=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 d=$r(e.data);r.numberOfChannels=d.getUint8(11),r.sampleRate=d.getUint32(12,!0);const f=d.getUint8(28);r.codecInfo.vorbisInfo={blocksizes:[1<<(f&15),1<<(f>>4)],modeBlockflags:yR(a.data).modeBlockflags},n2(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=pR(e.data);r.numberOfChannels=a.outputChannelCount,r.sampleRate=I0,r.codecInfo.opusInfo={preSkip:a.preSkip},n2(i.data.subarray(8),this.metadataTags)}async readPacket(e,r){pe(r<e.lacingValues.length);let n=0;for(let p=0;p<r;p++)n+=e.lacingValues[p];let i=e,a=n,o=r;const s=[];e:for(;;){let p=this.reader.requestSlice(i.dataStartPos,i.dataSize);p instanceof Promise&&(p=await p),pe(p);const h=Rt(p,i.dataSize);for(;;){if(o===i.lacingValues.length){s.push(h.subarray(n,a));break}const v=i.lacingValues[o];if(a+=v,v<255){s.push(h.subarray(n,a));break e}o++}let y=i.headerStartPos+i.totalSize;for(;;){let v=this.reader.requestSliceRange(y,yc,md);if(v instanceof Promise&&(v=await v),!v)return null;const b=hp(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((p,h)=>p+h.length,0);if(u===0)return null;const d=new Uint8Array(u);let f=0;for(let p=0;p<s.length;p++){const h=s[p];d.set(h,f),f+=h.length}return{data:d,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,yc,md);if(i instanceof Promise&&(i=await i),!i)return null;const a=hp(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 aM({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 uM{constructor(e,r){this.bitstream=e,this.demuxer=r,this.encodedPacketToMetadata=new WeakMap,this.sequentialScanCache=[],this.sequentialScanMutex=new qp,this.internalSampleRate=e.codecInfo.codec==="opus"?I0: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 Da}getDisposition(){return{...Eu}}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}=iM(e.data,this.bitstream.codecInfo,r.vorbisLastBlocksize),o=new Pn(n.metadataOnly?ca: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=Cp(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(_+oM,o-yc);let A=this.demuxer.reader.requestSlice(_,E-_);if(A instanceof Promise&&(A=await A),pe(A),!sM(A,E)){o=P+yc;continue e}let I=this.demuxer.reader.requestSliceRange(A.filePos,yc,md);I instanceof Promise&&(I=await I),pe(I);const M=hp(I);pe(M);let R=!1;if(M.serialNumber===this.bitstream.serialNumber)R=!0;else{let B=this.demuxer.reader.requestSlice(M.headerStartPos,M.totalSize);B instanceof Promise&&(B=await B),pe(B);const H=Rt(B,M.totalSize);R=nM(H)===M.checksum}if(!R){_=M.headerStartPos+4;continue}if(R&&M.serialNumber!==this.bitstream.serialNumber){_=M.headerStartPos+M.totalSize;continue}if(M.granulePosition===-1){_=M.headerStartPos+M.totalSize;continue}this.granulePositionToTimestampInSamples(M.granulePosition)>n?o=M.headerStartPos:(a=M,s.push(M));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 d=u;const f=[d];for(;!(d.serialNumber===this.bitstream.serialNumber&&d.granulePosition===a.granulePosition);){const S=d.headerStartPos+d.totalSize;let P=this.demuxer.reader.requestSliceRange(S,yc,md);P instanceof Promise&&(P=await P),pe(P);const _=hp(P);pe(_),d=_,d.serialNumber===this.bitstream.serialNumber&&f.push(d)}pe(d.granulePosition!==-1);let p=null,h,y,v=d,b=0;if(d.headerStartPos===i.startPage.headerStartPos)h=this.granulePositionToTimestampInSamples(0),y=!0,p=0;else{h=0,y=!1;for(let _=d.lacingValues.length-1;_>=0;_--)if(d.lacingValues[_]<255){p=_+1;break}if(p===null)throw new Error("Invalid page with granule position: no packets end on this page.");b=p-1;const S={data:ca,endPage:v,endSegmentIndex:b};if(await this.demuxer.findNextPacketStart(S)){const _=wx(f,d,p);pe(_);const E=bx(f,_.page,_.segmentIndex);E&&(d=E.page,p=E.segmentIndex)}else for(;;){const _=wx(f,d,p);if(!_)break;const E=bx(f,_.page,_.segmentIndex);if(!E)break;if(d=E.page,p=E.segmentIndex,_.page.headerStartPos!==v.headerStartPos){v=_.page,b=_.segmentIndex;break}}}let x=null,k=null;for(;d!==null;){pe(p!==null);const S=await this.demuxer.readPacket(d,p);if(!S)break;if(!(d.headerStartPos===i.startPage.headerStartPos&&p<i.startSegmentIndex)){let E=this.createEncodedPacketFromOggPacket(S,{timestampInSamples:h,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?(h=this.granulePositionToTimestampInSamples(d.granulePosition),y=!0,E=this.createEncodedPacketFromOggPacket(S,{timestampInSamples:h-A.durationInSamples,vorbisLastBlocksize:k?.vorbisBlockSize??null},r),pe(E),A=this.encodedPacketToMetadata.get(E),pe(A)):h+=A.durationInSamples,x=E,k=A,y&&(Math.max(h,0)>n||Math.max(A.timestampInSamples,0)===n))break}const _=await this.demuxer.findNextPacketStart(S);if(!_)break;d=_.startPage,p=_.startSegmentIndex}return x}async getPacketSequential(e,r){const n=await this.sequentialScanMutex.acquire();try{const i=Cp(e*this.internalSampleRate);e=i/this.internalSampleRate;const a=cr(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 d=this.encodedPacketToMetadata.get(o);pe(d),this.sequentialScanCache.length>0&&pe(ui(this.sequentialScanCache).timestampInSamples<=d.timestampInSamples),this.sequentialScanCache.push(d)}}return o}finally{n()}}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}}const bx=(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=e8(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}},wx=(t,e,r)=>{if(r>0)return{page:e,segmentIndex:r-1};const n=e8(t,i=>i.headerStartPos<e.headerStartPos);return n?{page:n,segmentIndex:n.lacingValues.length-1}:null};var Ns;(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"})(Ns||(Ns={}));class cM extends Tu{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=Qn(e,4),n=r!=="RIFX",i=r==="RF64",a=uu(e,n);let o=i?this.reader.fileSize:Math.min(a+8,this.reader.fileSize??1/0);if(Qn(e,4)!=="WAVE")throw new Error("Invalid WAVE file - wrong format");let u=0,d=null,f=e.filePos;for(;o===null||f<o;){let h=this.reader.requestSlice(f,8);if(h instanceof Promise&&(h=await h),!h)break;const y=Qn(h,4),v=uu(h,n),b=h.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(d??=v,this.dataStart=h.filePos,this.dataSize=Math.min(d,(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=Sx(x,n);d=Sx(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);f=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 p=this.audioInfo.blockSizeInBytes;this.dataSize=Math.floor(this.dataSize/p)*p,this.tracks.push(new ho(this.input,new fM(this)))})()}async parseFmtChunk(e,r,n){let i=this.reader.requestSlice(e,r);if(i instanceof Promise&&(i=await i),!i)return;let a=Bh(i,n);const o=Bh(i,n),s=uu(i,n);i.skip(4);const u=Bh(i,n);let d;if(r===14?d=8:d=Bh(i,n),r>=18&&a!==357){const f=Bh(i,n),p=r-18;if(Math.min(p,f)>=22&&a===Ns.EXTENSIBLE){i.skip(6);const y=Rt(i,16);a=y[0]|y[1]<<8}}(a===Ns.MULAW||a===Ns.ALAW)&&(d=8),this.audioInfo={format:a,numberOfChannels:o,sampleRate:s,sampleSizeInBytes:Math.ceil(d/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=Qn(i,4);if(a!=="INFO"&&a!=="INF0")return;let o=i.filePos;for(;o<=e+r-8;){i.filePos=o;const s=Qn(i,4),u=uu(i,n),d=Rt(i,u);let f=0;for(let h=0;h<d.length&&d[h]!==0;h++)f++;const p=String.fromCharCode(...d.subarray(0,f));switch(this.metadataTags.raw??={},this.metadataTags.raw[s]=p,s){case"INAM":case"TITL":this.metadataTags.title??=p;break;case"TIT3":this.metadataTags.description??=p;break;case"IART":this.metadataTags.artist??=p;break;case"IPRD":this.metadataTags.album??=p;break;case"IPRT":case"ITRK":case"TRCK":{const h=p.split("/"),y=Number.parseInt(h[0],10),v=h[1]&&Number.parseInt(h[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 h=new Date(p);Number.isNaN(h.getTime())||(this.metadataTags.date??=h)}break;case"YEAR":{const h=Number.parseInt(p,10);Number.isInteger(h)&&h>0&&(this.metadataTags.date??=new Date(h,0,1))}break;case"IGNR":case"GENR":this.metadataTags.genre??=p;break;case"ICMT":case"CMNT":case"COMM":this.metadataTags.comment??=p;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=n0(n);if(i){const a=n.slice(e+10,i.size);D8(a,i,this.metadataTags)}}getCodec(){if(pe(this.audioInfo),this.audioInfo.format===Ns.MULAW)return"ulaw";if(this.audioInfo.format===Ns.ALAW)return"alaw";if(this.audioInfo.format===Ns.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===Ns.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 qf=2048;class fM{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 Da}getDisposition(){return{...Eu}}async getFirstTimestamp(){return 0}async getPacketAtIndex(e,r){pe(this.demuxer.audioInfo);const n=e*qf*this.demuxer.audioInfo.blockSizeInBytes;if(n>=this.demuxer.dataSize)return null;const i=Math.min(qf*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=ca;else{let u=this.demuxer.reader.requestSlice(this.demuxer.dataStart+n,i);u instanceof Promise&&(u=await u),pe(u),a=Rt(u,i)}const o=e*qf/this.demuxer.audioInfo.sampleRate,s=i/this.demuxer.audioInfo.blockSizeInBytes/this.demuxer.audioInfo.sampleRate;return this.demuxer.lastKnownPacketIndex=Math.max(e,o),new Pn(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/qf,(this.demuxer.dataSize-1)/(qf*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/qf);return this.getPacketAtIndex(n+1,r)}getKeyPacket(e,r){return this.getPacket(e,r)}getNextKeyPacket(e,r){return this.getNextPacket(e,r)}}const u2=7,gd=9,Rp=t=>{const e=t.filePos,r=Rt(t,9),n=new jr(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 d=n.readBits(3);if(d===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 f=n.readBits(13);n.skipBits(11);const p=n.readBits(2)+1;if(p!==1)throw new Error("ADTS frames with more than one AAC frame are not supported.");let h=null;return o===1?t.filePos-=2:h=n.readBits(16),{objectType:s,samplingFrequencyIndex:u,channelConfiguration:d,frameLength:f,numberOfAacFrames:p,crcCheck:h,startPos:e}};const i0=1024;class dM extends Tu{constructor(e){super(e),this.metadataPromise=null,this.firstFrameHeader=null,this.loadedSamples=[],this.tracks=[],this.readingMutex=new qp,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 ho(this.input,new hM(this))]})()}async advanceReader(){let e=this.reader.requestSliceRange(this.lastLoadedPos,u2,gd);if(e instanceof Promise&&(e=await e),!e){this.lastSampleLoaded=!0;return}const r=Rp(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=Ed[r.samplingFrequencyIndex];pe(n!==void 0);const i=i0/n,a={timestamp:this.nextTimestampInSamples/n,duration:i,dataStart:r.startPos,dataSize:r.frameLength};this.loadedSamples.push(a),this.nextTimestampInSamples+=i0,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 hM{constructor(e){this.demuxer=e}getId(){return 1}async getFirstTimestamp(){return 0}getTimeResolution(){return this.getSampleRate()/i0}async computeDuration(){const e=await this.getPacket(1/0,{metadataOnly:!0});return(e?.timestamp??0)+(e?.duration??0)}getName(){return null}getLanguageCode(){return Da}getCodec(){return"aac"}getInternalCodecId(){return pe(this.demuxer.firstFrameHeader),this.demuxer.firstFrameHeader.objectType}getNumberOfChannels(){pe(this.demuxer.firstFrameHeader);const e=A0[this.demuxer.firstFrameHeader.channelConfiguration];return pe(e!==void 0),e}getSampleRate(){pe(this.demuxer.firstFrameHeader);const e=Ed[this.demuxer.firstFrameHeader.samplingFrequencyIndex];return pe(e!==void 0),e}getDisposition(){return{...Eu}}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=ca;else{let a=this.demuxer.reader.requestSlice(n.dataStart,n.dataSize);if(a instanceof Promise&&(a=await a),!a)return null;i=Rt(a,n.dataSize)}return new Pn(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=Vp(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=cr(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 pM=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,mM=(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}},gM=t=>{let e=0;const r=new jr(Rt(t,1));for(;r.readBits(1)===1;)e++;if(e===0)return r.readBits(7);const n=[],i=e-1,a=new jr(Rt(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 d=0;d<8;d++){const f=a.readBits(1);d<2||n.unshift(f)}return n.reduce((u,d,f)=>u|d<<f,0)},yM=(t,e)=>{if(e==="uncommon-u16")return Yn(t)+1;if(e==="uncommon-u8")return Pt(t)+1;if(typeof e=="number")return e;Tp(e),pe(!1)},vM=(t,e)=>e==="uncommon-u16"?Yn(t):e==="uncommon-u16-10"?Yn(t)*10:e==="uncommon-u8"?Pt(t):typeof e=="number"?e:null,bM=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 wM extends Tu{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 qp,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=Pt(r),i=Zf(r),a=(n&128)!==0;switch(n&127){case pd.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=Rt(s,34),d=new jr(u),f=d.readBits(16),p=d.readBits(16),h=d.readBits(24),y=d.readBits(24),v=d.readBits(20),b=d.readBits(3)+1;d.readBits(5);const x=d.readBits(36);d.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:f,maximumBlockSize:p,minimumFrameSize:h,maximumFrameSize:y,description:k},this.track=new ho(this.input,new xM(this));break}case pd.VORBIS_COMMENT:{let s=this.reader.requestSlice(e,i);s instanceof Promise&&(s=await s),pe(s),n2(Rt(s,i),this.metadataTags);break}case pd.PICTURE:{let s=this.reader.requestSlice(e,i);s instanceof Promise&&(s=await s),pe(s);const u=st(s),d=st(s),f=La.decode(Rt(s,d)),p=st(s),h=La.decode(Rt(s,p));s.skip(16);const y=st(s),v=Rt(s,y);this.metadataTags.images??=[],this.metadataTags.images.push({data:v,mimeType:f,kind:u===3?"coverFront":u===4?"coverBack":"unknown",description:h});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(Pt(o)===255){const d=o.filePos,f=Pt(o),p=this.blockingBit===1?249:248;if(f!==p){o.filePos=d;continue}o.skip(-2);const h=o.filePos-e,y=this.readFlacFrameHeader({slice:o,isFirstPacket:!1});if(!y){o.filePos=d;continue}if(this.blockingBit===0){if(y.num-s.num!==1){o.filePos=d;continue}}else if(y.num-s.num!==s.blockSize){o.filePos=d;continue}return{num:s.num,blockSize:s.blockSize,sampleRate:s.sampleRate,size:h,isLastFrame:!1}}}}readFlacFrameHeader({slice:e,isFirstPacket:r}){const n=e.filePos,i=Rt(e,4),a=new jr(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=pM(a.readBits(4));if(!s)return null;pe(this.audioInfo);const u=mM(a.readBits(4),this.audioInfo.sampleRate);if(!u||(a.readBits(4),a.readBits(3),a.readBits(1)!==0))return null;const f=gM(e),p=yM(e,s),h=vM(e,u);if(h===null||h!==this.audioInfo.sampleRate)return null;const y=e.filePos-n,v=Pt(e);e.skip(-y),e.skip(-1);const b=bM(Rt(e,y));return v!==b?null:{num:f,blockSize:p,sampleRate:h}}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 xM{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 Da}getTimeResolution(){return pe(this.demuxer.audioInfo),this.demuxer.audioInfo.sampleRate}getDisposition(){return{...Eu}}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=cr(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=ca;else{let s=this.demuxer.reader.requestSlice(n.byteOffset,n.byteSize);if(s instanceof Promise&&(s=await s),!s)return null;i=Rt(s,n.byteSize)}pe(this.demuxer.audioInfo);const a=n.blockOffset/this.demuxer.audioInfo.sampleRate,o=n.blockSize/this.demuxer.audioInfo.sampleRate;return new Pn(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 Ls=9e4,ta=188,SM=t=>{let e="video/MP2T";const r=[...new Set(t.filter(Boolean))];return r.length>0&&(e+=`; codecs="${r.join(", ")}"`),e};const Kf="No PES packet found where one was expected.";class kM extends Tu{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=ta+16+1;let r=this.reader.requestSlice(0,e);r instanceof Promise&&(r=await r),pe(r);const n=Rt(r,e);if(n[0]===71&&n[ta]===71)this.packetOffset=0,this.packetStride=ta;else if(n[0]===71&&n[ta+16]===71)this.packetOffset=0,this.packetStride=ta+16;else if(n[4]===71&&n[4+ta]===71)this.packetOffset=4,this.packetStride=ta;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 d=3,f=32;if(u.pid===0&&!o){const h=new jr(u.payload),y=h.readAlignedByte();h.skipBits(8*y),h.skipBits(14);const v=h.readBits(10);for(h.skipBits(40);8*(v+d)-h.pos>f;){const b=h.readBits(16);if(h.skipBits(3),b!==0){if(a!==null)throw new Error("Only files with a single program are supported.");a=h.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 h=new jr(u.payload),y=h.readAlignedByte();h.skipBits(8*y),h.skipBits(12);const v=h.readBits(12);h.skipBits(43),h.readBits(13),h.skipBits(6);const b=h.readBits(10);for(h.skipBits(8*b);8*(v+d)-h.pos>f;){const x=h.readBits(8);h.skipBits(3);const k=h.readBits(13);h.skipBits(6);const S=h.readBits(10);h.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 h=this.elementaryStreams.find(y=>y.pid===u.pid);if(h&&!h.initialized){const y=ld(u);if(!y)throw new Error(`Couldn't read first PES packet for Elementary Stream with PID ${h.pid}`);if(h.firstSection=u,h.info.type==="video")if(h.info.codec==="avc"){if(h.info.avcCodecInfo=h8(y.data),!h.info.avcCodecInfo)throw new Error("Invalid AVC video stream; could not extract AVCDecoderConfigurationRecord from first packet.");const v=h.info.avcCodecInfo.sequenceParameterSets[0];pe(v);const b=nb(v);h.info.width=b.displayWidth,h.info.height=b.displayHeight,h.info.colorSpace={primaries:Kg[b.colourPrimaries],transfer:Qg[b.transferCharacteristics],matrix:Zg[b.matrixCoefficients],fullRange:!!b.fullRangeFlag},h.info.reorderSize=b.maxDecFrameBuffering,h.initialized=!0}else if(h.info.codec==="hevc"){if(h.info.hevcCodecInfo=g8(y.data),!h.info.hevcCodecInfo)throw new Error("Invalid HEVC video stream; could not extract HVCDecoderConfigurationRecord from first packet.");const b=h.info.hevcCodecInfo.arrays.find(k=>k.nalUnitType===si.SPS_NUT).nalUnits[0];pe(b);const x=m8(b);h.info.width=x.displayWidth,h.info.height=x.displayHeight,h.info.colorSpace={primaries:Kg[x.colourPrimaries],transfer:Qg[x.transferCharacteristics],matrix:Zg[x.matrixCoefficients],fullRange:!!x.fullRangeFlag},h.info.reorderSize=x.maxDecFrameBuffering,h.initialized=!0}else throw new Error("Unhandled.");else if(h.info.codec==="aac"){const v=Zs.tempFromBytes(y.data),b=Rp(v);if(!b)throw new Error("Invalid AAC audio stream; could not read ADTS frame header from first packet.");h.info.aacCodecInfo={isMpeg2:!1,objectType:b.objectType},h.info.numberOfChannels=A0[b.channelConfiguration],h.info.sampleRate=Ed[b.samplingFrequencyIndex],h.initialized=!0}else if(h.info.codec==="mp3"){const v=st(Zs.tempFromBytes(y.data)),b=ub(v,y.data.byteLength);if(!b.header)throw new Error("Invalid MP3 audio stream; could not read frame header from first packet.");h.info.numberOfChannels=b.header.channel===3?1:2,h.info.sampleRate=b.header.sampleRate,h.initialized=!0}else throw new Error("Unhandled.")}}if(s&&this.elementaryStreams.every(h=>h.initialized))break;pe(u.endPos!==null),i=u.endPos}for(const u of this.elementaryStreams)u.info.type==="video"?this.tracks.push(new Ld(this.input,new _M(u))):this.tracks.push(new ho(this.input,new PM(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 SM(r)}async readSection(e,r,n=!1){let i=e,a=e;const o=[];let s=0,u=null,d=!0;for(;;){const p=await this.readPacket(a);if(a+=this.packetStride,!p)break;if(u){if(p.pid!==u.pid){if(n)break;continue}if(p.payloadUnitStartIndicator===1)break}else{if(p.payloadUnitStartIndicator===0)break;u=p}const h=!!(p.adaptationFieldControl&2),y=!!(p.adaptationFieldControl&1);let v=0;if(h&&(v=1+p.body[0]),y&&(v===0?(o.push(p.body),s+=p.body.byteLength):(o.push(p.body.subarray(v)),s+=p.body.byteLength-v)),i=a,!r&&s>=64){d=!1;break}if(Vp(this.sectionEndPositions,i,x=>x)!==-1){d=!1;break}}if(d){const p=cr(this.sectionEndPositions,i,h=>h);this.sectionEndPositions.splice(p+1,0,i)}if(!u)return null;let f;if(o.length===1)f=o[0];else{const p=o.reduce((y,v)=>y+v.length,0);f=new Uint8Array(p);let h=0;for(const y of o)f.set(y,h),h+=y.length}return{startPos:e,endPos:r?i:null,pid:u.pid,payload:f}}async readPacketHeader(e){let r=this.reader.requestSlice(e,4);if(r instanceof Promise&&(r=await r),!r)return null;if(Pt(r)!==71)throw new Error("Invalid TS packet sync byte. Likely an internal bug, please report this file.");const i=Yn(r),a=i>>14&1,o=i&8191,u=Pt(r)>>4&3;return{payloadUnitStartIndicator:a,pid:o,adaptationFieldControl:u}}async readPacket(e){let r=this.reader.requestSlice(e,ta);if(r instanceof Promise&&(r=await r),!r)return null;const n=Rt(r,ta);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,d=n[3]>>4&3;return{payloadUnitStartIndicator:o,pid:s,adaptationFieldControl:d,body:n.subarray(4)}}}const Qf=t=>{const e=new jr(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}},ld=t=>{pe(t.endPos!==null);const e=Qf(t);if(!e)return null;const r=new jr(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 F8{constructor(e){this.elementaryStream=e,this.referencePesPackets=[],this.endReferencePesPacketAdded=!1,this.packetBuffers=new WeakMap,this.packetSectionStarts=new WeakMap,this.mutex=new qp}getId(){return this.elementaryStream.pid}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.elementaryStream.streamType}getName(){return null}getLanguageCode(){return Da}getDisposition(){return Eu}getTimeResolution(){return Ls}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 Pn(n.metadataOnly?ca:e.data,this.getPacketType(e.data),e.pts/Ls,Math.max(r/Ls,0),e.sequenceNumber,e.data.byteLength)}maybeInsertReferencePacket(e,r,n){if(n&&this.mutex.pending>0)return;const i=cr(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<Ls/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<Ls/2)return!1}}return this.referencePesPackets.splice(i+1,0,e),!0}async getFirstPacket(e){const r=this.elementaryStream.firstSection;pe(r);const n=ld(r);pe(n);const i=new ud(this,n,!0),a=new mg(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 f=await n.readNext();if(!f)return null;this.packetBuffers.delete(e);const p=this.createEncodedPacket(f.packet,f.duration,r);return this.packetBuffers.set(p,n),this.packetSectionStarts.set(p,f.packet.sectionStartPos),p}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=ld(o);pe(s);const u=new ud(this,s,!0);n=new mg(this,u);const d=e.sequenceNumber;for(;;){const f=await n.readNext();if(!f)return null;if(f.packet.sequenceNumber>d){const p=this.createEncodedPacket(f.packet,f.duration,r);return this.packetBuffers.set(p,n),this.packetSectionStarts.set(p,f.packet.sectionStartPos),p}}}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=Cp(e*Ls),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=Qf(S);pe(P),this.maybeInsertReferencePacket(P,!1,!1),pe(this.referencePesPackets.length===1)}let x=cr(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=Qf(_);if(!E)throw new Error(Kf);this.maybeInsertReferencePacket(E,!0,!1),this.endReferencePesPacketAdded=!0}for(x=cr(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<Ls||!P)break;let E=r8((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=Qf(T);if(!I)throw new Error(Kf);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=Qf(k);if(!S)throw new Error(Kf);if(S.pts>i)break;u=S,o.fileSize===null&&this.maybeInsertReferencePacket(S,!1,!0)}const d=this.getReorderSize();for(let x=0;x<d;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 _=Qf(P);if(!_)throw new Error(Kf);u=_;break}k-=a.packetStride}}const f=await a.readSection(u.sectionStartPos,!0);pe(f);const p=ld(f);pe(p);const h=new ud(this,p,!0),y=new mg(this,h);for(;!((ui(y.presentationOrderPackets)?.pts??-1/0)>=i||!await y.readNextDecodeOrderPacket()););const v=eb(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=ld(k);if(!S)throw new Error(Kf);const P=new ud(this,S,!1);if(await this.markNextPacket(P),!P.suppliedPacket||this.getPacketType(P.suppliedPacket.data)!=="key")continue;P.uncapped=!0;const _=new mg(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 _M extends F8{constructor(e){super(e),this.elementaryStream=e,this.decoderConfig={codec:tb({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 ib(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 d=0;for(;d<u;){const f=s.indexOf(0,d);if(f===-1||f>=u)break;d=f;const p=o+d;if(d+4>=u){e.seekTo(p);break}const h=s[d+1],y=s[d+2],v=s[d+3];let b=0,x=null;if(h===0&&y===0&&v===1?(b=4,x=s[d+4]):h===0&&y===1&&(b=3,x=v),b===0){d++;continue}const k=p;if(i===null){i=k,d+=b;continue}if(x!==null){const S=r==="avc"?M0(x):Op(x);if(r==="avc"?S===Wo.AUD:S===si.AUD_NUT){const _=k-i;return e.seekTo(i),e.supplyPacket(_,0)}}d+=b}if(a<n)break}if(i!==null){const a=e.endPos-i;return e.seekTo(i),e.supplyPacket(a,0)}}}class PM extends F8{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:rb({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(gd);if(u instanceof Promise&&(u=await u),u<gd)return;const d=e.readBytes(gd),f=Rp(Zs.tempFromBytes(d));if(f){e.seekTo(s);let p=e.ensureBuffered(f.frameLength);return p instanceof Promise&&(p=await p),e.supplyPacket(p,Math.round(i0*Ls/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(dp);if(u instanceof Promise&&(u=await u),u<dp)return;const d=e.readBytes(dp),f=$r(d).getUint32(0),p=ub(f,null);if(p.header){e.seekTo(s);let h=e.ensureBuffered(p.header.totalSize);h instanceof Promise&&(h=await h);const y=p.header.audioSamplesInFrame*Ls/this.elementaryStream.info.sampleRate;return e.supplyPacket(h,Math.round(y))}else e.seekTo(s+1)}else throw new Error("Unhandled.")}if(i<n)break}}}class ud{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 ud(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=ui(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=ld(a);if(!o)throw new Error(Kf);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 mg{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 il{}class B8 extends il{async _getMajorBrand(e){let r=e._reader.requestSlice(0,12);return r instanceof Promise&&(r=await r),!r||(r.skip(4),Qn(r,4)!=="ftyp")?null:Qn(r,4)}_createDemuxer(e){return new MR(e)}}class EM extends B8{async _canReadInput(e){const r=await this._getMajorBrand(e);return!!r&&r!=="qt "}get name(){return"MP4"}get mimeType(){return"video/mp4"}}class TM extends B8{async _canReadInput(e){return await this._getMajorBrand(e)==="qt "}get name(){return"QuickTime File Format"}get mimeType(){return"video/quicktime"}}class z8 extends il{async isSupportedEBMLOfDocType(e,r){let n=e._reader.requestSlice(0,Us);if(n instanceof Promise&&(n=await n),!n)return!1;const i=O8(n);if(i===null||i<1||i>8||Xt(n,i)!==He.EBML)return!1;const o=A8(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-Ta;){const d=Bs(s);if(!d)break;const{id:f,size:p}=d,h=s.filePos;if(p===void 0)return!1;switch(f){case He.EBMLVersion:if(Xt(s,p)!==1)return!1;break;case He.EBMLReadVersion:if(Xt(s,p)!==1)return!1;break;case He.DocType:if(Yf(s,p)!==r)return!1;break;case He.DocTypeVersion:if(Xt(s,p)>4)return!1;break}s.filePos=h+p}return!0}_canReadInput(e){return this.isSupportedEBMLOfDocType(e,"matroska")}_createDemuxer(e){return new $R(e)}get name(){return"Matroska"}get mimeType(){return"video/x-matroska"}}class CM extends z8{_canReadInput(e){return this.isSupportedEBMLOfDocType(e,"webm")}get name(){return"WebM"}get mimeType(){return"video/webm"}}class OM extends il{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 d=e._reader.requestSlice(n,r0);if(d instanceof Promise&&(d=await d),!d)break;const f=n0(d);if(!f)break;i=!0,n=d.filePos+f.size}const a=await l2(e._reader,n,n+4096);if(!a)return!1;if(i)return!0;n=a.startPos+a.header.totalSize;const o=await l2(e._reader,n,n+dp);if(!o)return!1;const s=a.header,u=o.header;return!(s.channel!==u.channel||s.sampleRate!==u.sampleRate)}_createDemuxer(e){return new eM(e)}get name(){return"MP3"}get mimeType(){return"audio/mpeg"}}class AM extends il{async _canReadInput(e){let r=e._reader.requestSlice(0,12);if(r instanceof Promise&&(r=await r),!r)return!1;const n=Qn(r,4);return n!=="RIFF"&&n!=="RIFX"&&n!=="RF64"?!1:(r.skip(4),Qn(r,4)==="WAVE")}_createDemuxer(e){return new cM(e)}get name(){return"WAVE"}get mimeType(){return"audio/wav"}}class IM extends il{async _canReadInput(e){let r=e._reader.requestSlice(0,4);return r instanceof Promise&&(r=await r),r?Qn(r,4)==="OggS":!1}_createDemuxer(e){return new lM(e)}get name(){return"Ogg"}get mimeType(){return"application/ogg"}}class RM extends il{async _canReadInput(e){let r=e._reader.requestSlice(0,4);return r instanceof Promise&&(r=await r),r?Qn(r,4)==="fLaC":!1}get name(){return"FLAC"}get mimeType(){return"audio/flac"}_createDemuxer(e){return new wM(e)}}class MM extends il{async _canReadInput(e){let r=e._reader.requestSliceRange(0,u2,gd);if(r instanceof Promise&&(r=await r),!r)return!1;const n=Rp(r);if(!n||(r=e._reader.requestSliceRange(n.frameLength,u2,gd),r instanceof Promise&&(r=await r),!r))return!1;const i=Rp(r);return i?n.objectType===i.objectType&&n.samplingFrequencyIndex===i.samplingFrequencyIndex&&n.channelConfiguration===i.channelConfiguration:!1}_createDemuxer(e){return new dM(e)}get name(){return"ADTS"}get mimeType(){return"audio/aac"}}class DM extends il{async _canReadInput(e){const r=ta+16+1;let n=e._reader.requestSlice(0,r);if(n instanceof Promise&&(n=await n),!n)return!1;const i=Rt(n,r);return i[0]===71&&i[ta]===71||i[0]===71&&i[ta+16]===71?!0:i[4]===71&&i[4+ta]===71}_createDemuxer(e){return new kM(e)}get name(){return"MPEG Transport Stream"}get mimeType(){return"video/MP2T"}}const NM=new EM,LM=new TM,FM=new z8,BM=new CM,zM=new OM,jM=new AM,UM=new IM,HM=new MM,$M=new RM,qM=new DM,VM=[NM,LM,FM,BM,jM,UM,$M,zM,HM,qM];class cb{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){if(this._disposed)throw new ia;return this._sizePromise??=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new ia;const e=await this.getSizeOrNull();if(e===null)throw new Error("Cannot determine the size of an unsized source.");return e}}class xx extends cb{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=du(e),this._view=$r(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 j8=.5*2**20,WM=((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 GM extends cb{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&&(!o8(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??WM,this._orchestrator=new YM({maxCacheSize:r.maxCacheSize??64*2**20,maxWorkerCount:2,runWorker:this._runWorker.bind(this),prefetchProfile:XM.network})}async _retrieveSize(){const e=new AbortController,r=await sx(this._options.fetchFn??fetch,this._url,ax(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,j8));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 sx(this._options.fetchFn??fetch,this._url,ax(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(d){if(this._disposed)throw d;const f=this._getRetryDelay(1,d,this._url);if(f!==null){console.error("Error while reading response stream. Attempting to resume.",d),await new Promise(p=>setTimeout(p,1e3*f));break}else throw d}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 XM={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(r2(t,e,o,i.targetPos)){const s=i.targetPos-i.startPos,u=Math.ceil((s+1)/8388608)*8388608,d=2**Math.ceil(Math.log2(s+1)),f=Math.min(d,u);e=Math.max(e,i.startPos+f)}}return e=Math.max(e,t+j8),{start:t,end:e}}};class YM{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=cr(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 d=cr(this.cache,i,S=>S.start),f=o?null:new Uint8Array(r-e);let p=0,h=i;const y=[];if(d!==-1){for(let S=d;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),h<_&&y.push({start:h,end:_}),h=E,f){const A=Math.max(e,P.start),T=Math.min(r,P.end);if(A<T){const I=A-e;f.set(P.bytes.subarray(A-P.start,T-P.start),I),I===p&&(p=T-e)}}P.age=this.nextAge++}h<a&&y.push({start:h,end:a})}else y.push({start:i,end:a});if(f&&p>=f.length&&(o={bytes:f,view:$r(f),offset:e}),y.length===0)return pe(o),o;const{promise:v,resolve:b,reject:x}=na(),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=f&&{start:e,bytes:f,holes:k,resolve:b,reject:x};let _=!1;for(const E of this.workers)if(r2(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(f),o=v.then(S=>({bytes:S,view:$r(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:$r(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 d=0;d<o.holes.length;d++){const f=o.holes[d];n<=f.start&&i>f.start&&(f.start=i),f.end<=f.start&&(o.holes.splice(d,1),d--)}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||r2(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=cr(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=$r(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=$r(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}}a8();class KM{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 il)))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof cb))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 QM(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 ia extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}class QM{constructor(e){this.source=e}requestSlice(e,r){if(this.source._disposed)throw new ia;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 Zs(a.bytes,a.view,a.offset,e,n):null):i?new Zs(i.bytes,i.view,i.offset,e,n):null}requestSliceRange(e,r,n){if(this.source._disposed)throw new ia;if(e<0)return null;if(this.fileSize!==null)return this.requestSlice(e,hd(this.fileSize-e,r,n));{const i=this.requestSlice(e,n),a=o=>{if(o)return o;const s=d=>(pe(d!==null),this.requestSlice(e,hd(d-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 Zs{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 Zs(e,$r(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 Zs(this.bytes,this.view,this.offset,e,e+r)}}const qi=(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.`)},Rt=(t,e)=>{qi(t,e);const r=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,r},Pt=t=>(qi(t,1),t.view.getUint8(t.bufferPos++)),Bh=(t,e)=>{qi(t,2);const r=t.view.getUint16(t.bufferPos,e);return t.bufferPos+=2,r},Yn=t=>{qi(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},Zf=t=>{qi(t,3);const e=O0(t.view,t.bufferPos,!1);return t.bufferPos+=3,e},c2=t=>{qi(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},uu=(t,e)=>{qi(t,4);const r=t.view.getUint32(t.bufferPos,e);return t.bufferPos+=4,r},st=t=>{qi(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},cd=t=>{qi(t,4);const e=t.view.getUint32(t.bufferPos,!0);return t.bufferPos+=4,e},vc=t=>{qi(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},ZM=t=>{qi(t,4);const e=t.view.getInt32(t.bufferPos,!0);return t.bufferPos+=4,e},Sx=(t,e)=>{let r,n;return e?(r=uu(t,!0),n=uu(t,!0)):(n=uu(t,!1),r=uu(t,!1)),n*4294967296+r},ro=t=>{const e=st(t),r=st(t);return e*4294967296+r},JM=t=>{const e=vc(t),r=st(t);return e*4294967296+r},eD=t=>{const e=cd(t);return ZM(t)*4294967296+e},tD=t=>{qi(t,4);const e=t.view.getFloat32(t.bufferPos,!1);return t.bufferPos+=4,e},U8=t=>{qi(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},Qn=(t,e)=>{qi(t,e);let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t.bytes[t.bufferPos++]);return r},Vf=.05,rD=(t,e,r)=>{const[n,i]=X.useState({input:null,videoSink:null,duration:0,isReady:!1,error:null});X.useRef(n).current=n;const a=X.useRef(0),o=X.useRef(null),s=X.useRef(null),u=X.useRef(null),d=X.useRef(null),f=X.useRef(null),p=X.useRef(null),h=X.useRef(!1),y=X.useRef(null),v=X.useRef([]),b=X.useRef(null),x=X.useRef(!1),[,k]=X.useReducer(S=>S+1,0);return X.useEffect(()=>{if(!r)return;let S=!0;const P=++a.current;let _=null;return(async()=>{try{if(!S||P!==a.current)return;_=Jo(`mediabunny init ${t.id}`);const E=await(async function(N){if((function(B){return B.startsWith("data:")})(N)){const B=(function(H){const $=H.indexOf(",");if($===-1)throw new Error("Invalid data URL format");const G=H.slice($+1),Z=atob(G),J=new Uint8Array(Z.length);for(let q=0;q<Z.length;q++)J[q]=Z.charCodeAt(q);return J.buffer})(N);return new xx(B)}if((function(B){return B.startsWith("file://")})(N))try{const B=await fetch(N),H=await B.arrayBuffer();return new xx(H)}catch(B){throw new Error(`Failed to load file URL: ${N}. File URLs may not be supported in this environment. Error: ${B}`)}return new GM(N)})(t.src);if(!S||P!==a.current)return void(_&&(_(),_=null));const A=new KM({source:E,formats:VM}),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 M=await I.canBeTransparent(),R=new TR(I,{poolSize:5,fit:"contain",alpha:M});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}`;Rd(A),i(T=>Object.assign(Object.assign({},T),{error:String(E),isReady:!1}))}}})(),()=>{S=!1,_&&(_(),_=null)}},[t.src,r]),X.useEffect(()=>()=>{s.current&&(s.current.return(),s.current=null),o.current&&(o.current(),o.current=null),u.current=null,d.current=null,f.current=null,h.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]),X.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,$={},G="debug")=>{let Z="";try{Z=JSON.stringify(Object.assign(Object.assign({},$),{timeCalc:p.current}))}catch(q){Z=`[unserializable extras: ${String(q)}]`}const J=`mediabunny event=${H} elementId=${t.id} targetTime=${f.current} duration=${n.duration} lastFrameTimestamp=${d.current} hasIterator=${!!s.current} prefetchSize=${v.current.length} srcHint=${P} extras=${Z}`;G==="error"?console.error(J):G==="warn"?console.warn(J):console.debug(J)},E=H=>{const $=n.duration||0;if(!$||!Number.isFinite($))return H;const G=$>Vf?$-Vf:$;return Math.max(0,Math.min(H,G))},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 G=$.getContext("2d");G&&(G.clearRect(0,0,$.width,$.height),G.drawImage(H.canvas,0,0)),d.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 G=await $.next();if(H!==a.current)return;if(G.done||!G.value)break;v.current.push({timestamp:G.value.timestamp,frame:G.value})}}catch{}finally{x.current=!1,b.current=null}})()))},M=H=>{const $=v.current;for(let G=0;G<$.length;G++)if(Math.abs($[G].timestamp-H)<Vf){const Z=$[G];return v.current=$.slice(G+1),Z}return null},R=()=>{v.current=[]},N=async(H,$,G=0)=>{const Z=E(H),J=(q=>{const Q=d.current;return Q===null||q<Q-Vf||q>Q+.5})(Z)?"seek":"iterate";try{const q=n.videoSink,Q=d.current;if(Q!==null&&Math.abs(Q-Z)<Vf)return void(f.current=H);const U=M(Z);if(U)return T(U.frame),f.current=H,I($),void k();if(b.current){await b.current;const L=M(Z);if(L)return T(L.frame),f.current=H,I($),void k()}if(R(),J==="seek"){s.current&&(await s.current.return(),s.current=null);const L=q.canvases(Z);s.current=L;const W=await L.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:J,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($),f.current=H,k())}catch{}return}T(W.value),I($)}else{const L=s.current;if(!L)return;let W=!1;for(;$===a.current;){const V=await L.next();if($!==a.current)break;if(V.done||!V.value){if(A(Z)||_("iterator_exhausted",{mode:J,requestedTargetTime:H,clampedTargetTime:Z},"warn"),!W&&!A(Z)){W=!0;try{s.current&&(await s.current.return(),s.current=null),R();const re=q.canvases(Z);s.current=re;const K=await re.next();if($!==a.current||K.done||!K.value)break;T(K.value),I($);break}catch{break}}break}const ee=V.value;if(T(ee),Math.abs(ee.timestamp-Z)<Vf){I($);break}if(ee.timestamp>Z){I($);break}}}f.current=H,k()}catch(q){const Q=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),L=U.includes("Unsupported configuration")||U.includes("isConfigSupported")||U.includes("OperationError");if(_("frame_process_failed",{mode:J,requestedTargetTime:H,clampedTargetTime:Z,unsupportedConfigAttempt:G,isUnsupportedConfig:L,error:Q},"error"),L&&G<1)try{s.current&&(await s.current.return(),s.current=null),R(),b.current=null,x.current=!1,d.current=null,await N(H,$,G+1)}catch{}}},B=so(()=>{const H=n.videoSink,$=n.duration;if(!H||!$)return;const G=t.startTime*$*1e3,Z=$*(t.endTime-t.startTime)*1e3,J=((e.currentTime||t.page.startTime)-t.page.startTime)%Z+G,q=J/1e3,Q=E(q);p.current={pageStartTime:t.page.startTime,storeCurrentTime:e.currentTime,offsetMs:G,durationMs:Z,restMs:J,targetTime:q,clampedTargetTime:Q,startTime:t.startTime,endTime:t.endTime,videoDuration:$},((U,L)=>{h.current?y.current=U:(h.current=!0,o.current||(o.current=Jo(`mediabunny video frame ${t.id}`)),(async()=>{let W=U;for(;W!==null&&L===a.current;)await N(W,L),W=y.current,y.current=null;o.current&&(o.current(),o.current=null),h.current=!1})())})(Q,S)});return()=>{B(),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 yd(){return document.createElement("canvas")}const H8=new window.Image;H8.src=nl(`
|
|
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 $8=new window.Image;$8.src=nl(`
|
|
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 q8=(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),d=Math.max(t.width/r.width,t.height/r.height)*n,f=t.page._exportingOrRendering&&dr.imageDownScalingEnabled&&d<1&&!a,p=e instanceof HTMLVideoElement?e.videoWidth:e?.width,h=e instanceof HTMLVideoElement?e.videoHeight:e?.height,y=r.x===0&&r.y===0&&r.width===p&&r.height===h,v=X.useMemo(()=>{if(e&&p&&h)return y&&u===0&&!f?void 0:yd()},[e,u,f,y,p,h]),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=f?(function(P,_){var E,A;const T=yd(),I=P instanceof HTMLVideoElement?P.videoWidth:P.width,M=P instanceof HTMLVideoElement?P.videoHeight:P.height;T.width=I,T.height=M,(E=T.getContext("2d"))===null||E===void 0||E.drawImage(P,0,0,T.width,T.height);const R=(function(N,B,H,$,G,Z,J){for(var q=new ImageData(B,H),Q=new Int32Array(N.data.buffer),U=N.width,L=new Int32Array(q.data.buffer),W=q.width,V=B/Z,ee=H/J,re=Math.round(1/V),K=Math.round(1/ee),ne=re*K,le=0;le<q.height;le++)for(var ae=0;ae<W;ae++){for(var ue=0+Math.round(ae/V)+(0+Math.round(le/ee))*U,ye=0,Ie=0,Le=0,Ue=0,$e=0;$e<K;$e++)for(var rt=0;rt<re;rt++){var Se=Q[ue+rt+$e*U];ye+=Se<<24>>>24,Ie+=Se<<16>>>24,Le+=Se<<8>>>24,Ue+=Se>>>24}ye=Math.round(ye/ne),Ie=Math.round(Ie/ne),Le=Math.round(Le/ne),Ue=Math.round(Ue/ne),L[ae+le*W]=Ue<<24|Le<<16|Ie<<8|ye}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,d):e,S=f?{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;x.drawImage(k,S.x,S.y,S.width,S.height,0,0,v.width,v.height)};return X.useLayoutEffect(()=>{b()},[v,t.width,t.height,r.x,r.y,r.width,r.height,i,n,a,t.page._exportingOrRendering,f]),X.useEffect(()=>()=>{v&&v.nodeName==="CANVAS"&&Et.Util.releaseCanvas(v)},[v]),[v||e,b]},nD=yd(),iD=Pr(({element:t})=>{const e=Math.min(30,t.width/4,t.height/4),r=X.useRef(null);return X.useEffect(()=>{const n=r.current;if(!n)return;const i=new Et.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}}),X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},X.createElement(ur,{width:t.width,height:t.height,fill:"rgba(124, 173, 212, 0.8)"}),X.createElement(M2,{ref:r,x:t.width/2,y:t.height/2,fill:"white",outerRadius:Math.abs(e),innerRadius:Math.max(1,e-5),angle:270}))}),aD=Pr(({element:t})=>{const e=Math.max(10,Math.min(30,t.width/25));return X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},X.createElement(ur,{width:t.width,height:t.height,fill:"rgba(223, 102, 102, 0.8)"}),X.createElement(Na,{text:"Can not load the video...",fontSize:e,width:t.width,height:t.height,align:"center",fill:"white",verticalAlign:"middle",padding:5}))});let oD=function(t,e,r){const n=X.useRef("loading"),i=X.useRef(void 0),[a,o]=X.useState(0),s=X.useRef(),u=X.useRef(),d=X.useRef();return s.current===t&&u.current===e&&d.current===r||(n.current="loading",i.current=void 0,s.current=t,u.current=e,d.current=r),X.useLayoutEffect(function(){if(t){var f=document.createElement("video");return f.addEventListener("canplay",p),f.addEventListener("error",h),f.crossOrigin=e,f.src=t,f.load(),function(){f.removeEventListener("canplay",p),f.removeEventListener("error",h)}}function p(){n.current="loaded",i.current=f,i.current.currentTime=0,o(Math.random()),i.current.removeEventListener("canplay",p)}function h(y){var v;const b=f.readyState===4,x=f.buffered&&f.buffered.length>0&&f.buffered.end(f.buffered.length-1)/f.duration*100>=100;if(b&&x)return;const k=y.message||((v=f.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 kx(t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}const _x=(t,e,r)=>{const n=X.useRef(),i=()=>{var a;(a=n.current)===null||a===void 0||a.call(n),n.current=void 0};X.useEffect(()=>i,[]),X.useLayoutEffect(()=>{const a=e.slice(0,200),o=`video with id ${r} url: ${a}`;t!=="loading"||n.current||(n.current=Jo(o)),t!=="loading"&&i(),t==="failed"&&Rd(o)},[t])},sD=Pr(({element:t,store:e})=>{var r;const[n,i]=X.useState(!1),a=X.useRef(null),o=X.useRef(null),s=e.selectedShapes.indexOf(t)>=0&&t.selectable,[u,d]=X.useState(!1),[f,p]=oD(t.src,"anonymous"),[h,y]=X.useState(!1),v=e.activePage===t.page,b=t.page._exportingOrRendering&&p==="loaded",x=rD(t,e,b);_x(p,t.src,t.id),f&&(f.playsInline=!0);const k=((se,he,Ce)=>{const oe=X.useMemo(()=>{var ke,Oe;const{flipX:Be,flipY:dt}=se,nt=se.type==="svg"||se.src.indexOf("data:image/svg+xml")>=0||se.src.indexOf(".svg")>=0,xe=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(!(Be||dt||xe&&nt))return he;if(!he)return null;const me=he instanceof HTMLVideoElement?he.videoWidth:he?.width,je=he instanceof HTMLVideoElement?he.videoHeight:he?.height;if(!me||!je)return null;const ve=yd();let qe=1;se.type==="svg"&&(qe=Math.max(se.width/me*Ce,se.height/je*Ce)),ve.width=Math.max(me*qe,1),ve.height=Math.max(je*qe,1);let ht=Be?-ve.width:0,gt=dt?-ve.height:0;return(ke=ve.getContext("2d"))===null||ke===void 0||ke.scale(Be?-1:1,dt?-1:1),(Oe=ve.getContext("2d"))===null||Oe===void 0||Oe.drawImage(he,ht,gt,ve.width,ve.height),ve},[se.flipX,se.flipY,he,se.width,se.height,Ce]);return X.useEffect(()=>()=>{oe&&oe.nodeName==="CANVAS"&&Et.Util.releaseCanvas(oe)},[oe]),oe})(t,f,e._elementsPixelRatio),S=b&&x||k||nD;X.useEffect(()=>{f&&e.history.ignore(()=>{t.set({duration:1e3*f.duration})})},[f]),X.useEffect(()=>{var se;if(!f)return;const he=e.animatedElementsIds,Ce=(!he.length||he.includes(t.id))&&e.isPlaying,oe=v&&(Ce||u);if(!oe)return void f.pause();oe&&(f.currentTime=t.startTime*f.duration,f.play());const ke=new Et.Animation(()=>{re.current()},(se=a.current)===null||se===void 0?void 0:se.getLayer());ke.start();const Oe=()=>{d(!1),f.currentTime=t.startTime*f.duration},Be=()=>{f.currentTime>=t.endTime*f.duration&&(f.pause(),f.currentTime=t.startTime*f.duration,d(!1))};return f.addEventListener("ended",Oe),f.addEventListener("timeupdate",Be),()=>{f.pause(),ke.stop(),f.removeEventListener("ended",Oe),f.removeEventListener("timeupdate",Be)}},[f,u,e.isPlaying,v]),X.useEffect(()=>{f&&(f.volume=t.volume)},[f,t.volume]);const P=X.useRef(null);X.useEffect(()=>{const se=so(()=>{var he,Ce;if(f){if(b&&x)return ee(),void e.currentTime;const oe=e.animatedElementsIds;if(oe.length&&!oe.includes(t.id))return;const ke=e.currentTime>=t.page.startTime&&e.currentTime<t.page.startTime+t.page.duration,Oe=t.startTime*f.duration*1e3,Be=f.duration*(t.endTime-t.startTime)*1e3;let dt=((e.currentTime||t.page.startTime)-t.page.startTime)%Be+Oe;if(ke||(dt=0),Math.abs(1e3*f.currentTime-dt)>500||!e.isPlaying){const nt=dt/1e3;nt!==f.currentTime&&(f.currentTime=nt),!kx(f)&&!e.isPlaying&&!P.current&&(P.current=Jo(`video ${t.id}`))}re.current(),(Ce=(he=a.current)===null||he===void 0?void 0:he.getLayer())===null||Ce===void 0||Ce.batchDraw()}});return()=>{se(),P.current&&(P.current(),P.current=null)}},[e,f,b,x]),X.useEffect(()=>{var se;if(!f)return;if(b)return(se=P.current)===null||se===void 0||se.call(P),void(P.current=null);const he=()=>{var oe,ke;!kx(f)&&t.page._exportingOrRendering||P.current&&(re.current(),(ke=(oe=a.current)===null||oe===void 0?void 0:oe.getLayer())===null||ke===void 0||ke.batchDraw(),P.current(),P.current=null)};let Ce;return t.page._exportingOrRendering&&(Ce=setInterval(he,20)),f.addEventListener("timeupdate",he),f.addEventListener("canplay",he),()=>{clearInterval(Ce),f.removeEventListener("timeupdate",he),f.removeEventListener("canplay",he)}},[t.page._exportingOrRendering,f,t.id,Jo,b]);let{cropX:_,cropY:E,cropWidth:A,cropHeight:T}=t;p!=="loaded"&&(_=E=0,A=T=1);const I=(M=S)instanceof HTMLVideoElement?M.videoWidth:M?.width||0;var M;const R=(se=>se instanceof HTMLVideoElement?se.videoHeight:se?.height||0)(S),N=I*A,B=R*T,H=t.width/t.height;let $,G;const Z=N/B,J=t.type==="svg";J?($=N,G=B):H>=Z?($=N,G=N/H):($=B*H,G=B);const q={x:I*_,y:R*E,width:$,height:G},Q=(r=t.cornerRadius)!==null&&r!==void 0?r:0,[U,L]=q8(t,S,q,e._elementsPixelRatio,Q,!0);let[W,V]=((se,he,Ce,oe)=>{const ke=(me=>{const[je,ve]=X.useState(me);return X.useEffect(()=>{(async()=>{const qe=await(async function(ht){if(!(ht.indexOf("data:image/svg+xml")>=0||ht.indexOf(".svg")>=0))return ht;const gt=await $p(ht),At=U2(gt);return nl(At)})(me);qe!==je&&ve(qe)})()},[me]),je})(se.clipSrc||""),[Oe,Be]=D2(ke,"anonymous"),dt=se.clipSrc?Be:"loaded";_x(dt,se.clipSrc,se.id);const nt=X.useMemo(()=>{if(he&&Oe)return yd()},[he,Oe]);function xe(){var me;if(!Oe)return;const je=he instanceof HTMLVideoElement?he.videoWidth:he?.width,ve=he instanceof HTMLVideoElement?he.videoHeight:he?.height;if(!he||!je||!ve||!Oe||!Oe.width||!Oe.height||!nt)return;const qe=yd(),ht=Math.max(se.width/Oe.width*Ce,se.height/Oe.height*Ce);qe.width=Oe.width*ht,qe.height=Oe.height*ht,(me=qe.getContext("2d"))===null||me===void 0||me.drawImage(Oe,0,0,qe.width,qe.height),nt.width=Math.max(je,1),nt.height=Math.max(ve,1);const gt=nt.getContext("2d");gt&&(gt.save(),gt.drawImage(qe,0,0,je,ve),Et.Util.releaseCanvas(qe),gt.globalCompositeOperation="source-in",gt.drawImage(he,0,0,nt.width,nt.height),gt.restore())}return X.useLayoutEffect(()=>{xe()},[nt,he,Oe,se.width,se.height,Ce,...oe]),[se.clipSrc&&Oe?nt:he,xe]})(t,U,e._elementsPixelRatio,[q,Q,e._elementsPixelRatio]);function ee(){var se,he;L(),V(),(he=(se=a.current)===null||se===void 0?void 0:se.getLayer())===null||he===void 0||he.batchDraw()}X.useEffect(()=>{ee()});const re=X.useRef(ee);re.current=ee;const K=Math.max(t.width/$,t.height/G);X.useEffect(()=>{var se;if(!t._cropModeEnabled)return;const he=(se=a.current)===null||se===void 0?void 0:se.getStage();function Ce(ke){t._cropModeEnabled&&ke.target!==o.current&&t.toggleCropMode(!1)}function oe(ke){t._cropModeEnabled&&ke.target.parentNode!==he?.content&&t.toggleCropMode(!1)}return document.body.addEventListener("click",oe),he?.on("click",Ce),he?.on("tap",Ce),()=>{document.body.removeEventListener("click",oe),document.body.removeEventListener("touchstart",oe),he?.off("click",Ce),he?.off("click",Ce)}},[t._cropModeEnabled]),X.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled)return ji(a.current,t),so(()=>{ji(a.current,t)},{delay:100})},[S,n,A,T,t._cropModeEnabled]),X.useLayoutEffect(()=>{var se;n||t._cropModeEnabled?(se=a.current)===null||se===void 0||se.clearCache():ji(a.current,t)},[n,t.width,t.height,t._cropModeEnabled]),X.useEffect(()=>{ji(a.current,t)},[t.shadowEnabled,t.shadowBlur,t.cornerRadius,t.shadowColor,t.shadowOffsetX,t.shadowOffsetY,t.shadowOpacity]);const ne=X.useRef(null),le=X.useRef(null),ae=X.useRef(null);X.useLayoutEffect(()=>{t._cropModeEnabled&&(le.current.nodes([ne.current]),ae.current.nodes([o.current]))},[t._cropModeEnabled]);const ue=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 he=se.target.width()*se.target.scaleX(),Ce=se.target.height()*se.target.scaleY(),oe=Math.min(1,$/he),ke=Math.min(1,G/Ce),Oe=1-oe,Be=Math.min(Oe,Math.max(0,Math.round(-se.target.x())/he)),dt=1-ke,nt=Math.min(dt,Math.max(0,Math.round(-se.target.y())/Ce));se.target.setAttrs({x:-Be*I,y:-nt*R,scaleX:1,scaleY:1}),t.set({cropX:Be,cropY:nt,cropWidth:oe,cropHeight:ke})},ye=()=>{t.type!=="svg"&&t.contentEditable&&setTimeout(()=>{t.toggleCropMode(!0)})},Ie=p==="loading",Le=p==="failed",Ue=!Ie&&!Le,$e=X.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),rt=Ue?t.a.opacity:0;Up(a,rt);const Se=t.selectable||e.role==="admin",de=_u();return X.createElement(X.Fragment,null,X.createElement(Zt,{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},Ie&&X.createElement(iD,{element:t}),Le&&X.createElement(aD,{element:t}),X.createElement(Vo,{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:rt,shadowEnabled:t.shadowEnabled,shadowBlur:t.shadowBlur,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowColor:t.shadowColor,shadowOpacity:t.shadowOpacity,customCrop:q,listening:Se,draggable:de?t.draggable&&s:t.draggable,preventDefault:!de||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:ye,onDblTap:ye,onTransformStart:()=>{i(!0),$e.current={cropX:t.cropX,cropY:t.cropY,cropWidth:t.cropWidth,cropHeight:t.cropHeight}},onTransform:se=>{var he;const Ce=se.currentTarget,oe=Math.abs(Ce.scaleX()-1)<1e-7?1:Ce.scaleX(),ke=Math.abs(Ce.scaleY()-1)<1e-7?1:Ce.scaleY();Ce.scaleX(1),Ce.scaleY(1);const Oe=(he=se.target.getStage())===null||he===void 0?void 0:he.findOne("Transformer"),Be=1-$/I,dt=Math.min(Be,Math.max(0,t.cropX)),nt=1-G/R,xe=Math.min(nt,Math.max(0,t.cropY)),me=Oe.getActiveAnchor(),je=!(me.indexOf("middle")>=0||me.indexOf("center")>=0),ve=!je&&oe<1&&$e.current.cropHeight>G/R;let qe=je?t.cropWidth:t.cropWidth*oe;ve&&(qe=t.cropWidth);const ht=!je&&ke<1&&$e.current.cropWidth>$/I;let gt=je?t.cropHeight:t.cropHeight*ke;ht&&(gt=t.cropHeight),J&&(qe=t.cropWidth,gt=t.cropHeight),t.set({cropX:dt,cropY:xe,x:Ce.x(),y:Ce.y(),width:Ce.width()*oe,height:Ce.height()*ke,rotation:se.target.rotation(),cropWidth:Math.min(qe,1-dt),cropHeight:Math.min(gt,1-xe)})},onTransformEnd:se=>{const he=se.currentTarget;t.set({width:he.width(),height:he.height(),x:he.x(),y:he.y(),rotation:se.target.rotation(),cropWidth:$/I,cropHeight:G/R}),i(!1)}}),X.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:rt,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,Q-t.borderSize),hideInExport:!t.showInExport}),!e.isPlaying&&X.createElement(Vo,{image:u?h||de?$8:void 0:H8,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:()=>d(!u),onTap:()=>d(!u)}),t._cropModeEnabled&&X.createElement(N2,{selector:".page-abs-container",enabled:!0},X.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)"}),X.createElement(Vo,{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}),X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,scaleX:K,scaleY:K},X.createElement(Vo,{image:S,ref:o,width:I,height:R,opacity:.4,draggable:!0,x:-t.cropX*I,y:-t.cropY*R,onDragMove:ue,onTransform:ue}),X.createElement(wp,{ref:ae,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(se,he)=>he.width<5||he.height<5?se:he,rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2}),X.createElement(ur,{width:$,height:G,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 he=Math.min(1,Math.max(0,t.cropX+se.target.x()/I)),Ce=Math.min(1,Math.max(0,se.target.y()/R+t.cropY)),oe=se.target.width()*se.target.scaleX(),ke=se.target.height()*se.target.scaleY(),Oe=Math.min(1-he,oe/I),Be=Math.min(1-Ce,ke/R),dt=se.target.getAbsolutePosition(se.target.getParent().getParent());se.target.scale({x:1,y:1}),se.target.position({x:0,y:0}),t.set({x:dt.x,y:dt.y,cropX:he,cropY:Ce,cropWidth:Oe,cropHeight:Be,width:Math.min(oe*K,I*(1-he)*K),height:Math.min(ke*K,R*(1-Ce)*K)})}}),X.createElement(wp,{ref:le,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],boundBoxFunc:(se,he)=>he.width<5||he.height<5?se:he,keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2,visible:t.resizable})))))}),fb=({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`},lD=({width:t,height:e})=>`M ${t/2} 0 L ${t} ${e} L 0 ${e} Z`,uD=({width:t,height:e})=>`M 0 0 L ${t} 0 L 0 ${e} Z`,cD=({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 fD({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="",d=Math.PI/5;for(let f=0;f<10;f++){const p=f%2==0?a:s,h=r+(f%2==0?i:o)*Math.sin(f*d),y=n-p*Math.cos(f*d);f===0?u=`M ${h} ${y}`:u+=` L ${h} ${y}`}return u+" Z"}function dD({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 hD({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 d=a,f=r+i*Math.sin(u*s),p=n-d*Math.cos(u*s);u===0?o=`M ${f} ${p}`:o+=` L ${f} ${p}`}return o+" Z"}function pD({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 d=a,f=r+i*Math.sin(u*s),p=n-d*Math.cos(u*s);u===0?o=`M ${f} ${p}`:o+=` L ${f} ${p}`}return o+" Z"}function ct({path:t,aspectRatio:e,width:r,height:n}){return{path:t,scaleX:r/e.width,scaleY:n/e.height}}function mD({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 gD({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,d=a+n/2;let f=`M ${o},0 `;return f+=`H ${s} `,f+=`V ${u} `,f+=`H ${t} `,f+=`V ${d} `,f+=`H ${s} `,f+=`V ${e} `,f+=`H ${o} `,f+=`V ${d} `,f+="H 0 ",f+=`V ${u} `,f+=`H ${o} `,f+="V 0 ",f+="Z",f}const yD={rect:fb,circle:cD,star:fD,triangle:lD,rightTriangle:uD,diamond:dD,pentagon:hD,hexagon:pD,speechBubble:mD,cross:gD,arc:({width:t,height:e})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({path:"M0 0H199V238L99.5 142.8L0 238V0Z",aspectRatio:{width:199,height:238},width:t,height:e}),butterfly:({width:t,height:e})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({path:"M0 0H240L200 88L240 176H0L40 88L0 0Z",aspectRatio:{width:240,height:176},width:t,height:e}),heart1:({width:t,height:e})=>ct({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})=>ct({path:"M0 62.143L95.5 0L191 62.143V195H0V62.143Z",aspectRatio:{width:191,height:195},width:t,height:e}),home2:({width:t,height:e})=>ct({path:"M206 94.076L103 0L0 94.076H31.2377V189H175.607V94.076H206Z",aspectRatio:{width:206,height:189},width:t,height:e}),hourglass:({width:t,height:e})=>ct({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})=>ct({path:"M0 92.367L95 0L190 92.367V223H0V92.367Z",aspectRatio:{width:190,height:223},width:t,height:e}),keyhole:({width:t,height:e})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({path:"M126 0H43L0 120.531H36L6 227L110 80.354H73L126 0Z",aspectRatio:{width:126,height:227},width:t,height:e}),magnet:({width:t,height:e})=>ct({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})=>ct({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})=>ct({path:"M69 0H0V69V138V207H69H138V138H69V69V0Z",aspectRatio:{width:138,height:207},width:t,height:e}),party:({width:t,height:e})=>ct({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})=>ct({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})=>ct({path:"M110 0L219.119 63V189L110 252L0.880798 189V63L110 0Z",aspectRatio:{width:220,height:252},width:t,height:e}),rainbow:({width:t,height:e})=>ct({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})=>ct({path:"M69 0H0V69V138H69V207H138V138V69H69V0Z",aspectRatio:{width:138,height:207},width:t,height:e}),shell:({width:t,height:e})=>ct({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})=>ct({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})=>ct({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})=>ct({path:"M85.9799 0H290L204.02 141H0L85.9799 0Z",aspectRatio:{width:290,height:141},width:t,height:e}),softFlower:({width:t,height:e})=>ct({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})=>ct({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})=>ct({path:"M0 0H67.667V67.667H135.333V135.333H203V203H0V0Z",aspectRatio:{width:203,height:203},width:t,height:e}),stairs2:({width:t,height:e})=>ct({path:"M50 0H0V200H200V150H150V100H100V50H50V0Z",aspectRatio:{width:200,height:200},width:t,height:e}),teewee:({width:t,height:e})=>ct({path:"M69 0H138V69H207V138H138H69H0V69H69V0Z",aspectRatio:{width:207,height:138},width:t,height:e}),blob1:({width:t,height:e})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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})=>ct({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 V8(t){return yD[t]||fb}function W8(t){const{subType:e}=t,r=t,n=V8(e);return n?(function(i,a){const{width:o,height:s,fill:u,stroke:d,strokeWidth:f,dash:p}=i,h=(p||[]).map(k=>k*f);let y=a(i),v=1,b=1;typeof y!="string"&&(v=y.scaleX,b=y.scaleY,y=y.path);const x=`clip-${i.id||Math.random()}`;return`
|
|
271
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${s}">
|
|
272
|
+
<defs>
|
|
273
|
+
<clipPath id="${x}">
|
|
274
|
+
<path d="${y}" />
|
|
275
|
+
</clipPath>
|
|
276
|
+
</defs>
|
|
277
|
+
|
|
278
|
+
<!-- Path for the fill -->
|
|
279
|
+
<path d="${y}" fill="${u}" transform="scale(${v}, ${b})"/>
|
|
280
|
+
|
|
281
|
+
<!-- Path for the stroke, clipped by the star path -->
|
|
282
|
+
<path d="${y}" fill="none" stroke="${d}" stroke-width="${2*f}" clip-path="url(#${x})" transform="scale(${v}, ${b})" stroke-dasharray="${h.join(" ")}"/>
|
|
283
|
+
</svg>
|
|
284
|
+
`})(r,n):(console.error(`Polotno error: Can not convert ${t.subType} figure to svg.`),fb(r))}const fv={},vD=Pr(({element:t,store:e})=>{const r=X.useRef(null),n=t.selectable||e.role==="admin",i=_u(),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=Zo(t,t.a.fill,"fill"),d=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}),f=Zo(t,t.stroke,"stroke"),p=Object.assign(Object.assign({visible:o>0,x:o/2,y:o/2,width:t.a.width-o,height:t.a.height-o},f),{strokeWidth:o,cornerRadius:Math.max(0,s-o),dash:t.dash.map(b=>b*o),opacity:t.animated("opacity"),hideInExport:!t.showInExport,listening:!1}),h=(y=t.subType,fv[y]||(fv[y]=(v=V8(y),Pr(({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=X.useRef(null);return X.createElement(X.Fragment,null,X.createElement(ur,{width:b.width,height:b.height,fill:"transparent"}),X.createElement(bp,Object.assign({},x,{ref:E,data:S,scaleX:P,scaleY:_})),X.createElement(Zt,{clipFunc:A=>{const T=E.current;if(T){var I=T.dataArray;A.beginPath();for(var M=0;M<I.length;M++){var R=I[M].command,N=I[M].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 B=N[0],H=N[1],$=N[2],G=N[3],Z=N[4],J=N[5],q=N[6],Q=N[7],U=$>G?$:G,L=$>G?1:$/G,W=$>G?G/$:1;A.translate(B,H),A.rotate(q),A.scale(L,W),A.arc(0,0,U,Z,Z+J,!Q),A.scale(1/L,1/W),A.rotate(-q),A.translate(-B,-H);break;case"z":A.closePath()}}}},scaleX:P,scaleY:_},X.createElement(bp,Object.assign({},k,{x:0,y:0,data:S,strokeWidth:2*k.strokeWidth,dash:k.dash.map(A=>A)}))))}))),fv[y]||Zt);var y,v;return X.createElement(X.Fragment,null,X.createElement(Zt,{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()})}},X.createElement(h,{element:t,fillProps:d,strokeProps:p})))});var Is={},dv={},Rs={},Px;function G8(){if(Px)return Rs;Px=1,Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.loop=Rs.conditional=Rs.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(d){return n(i,d,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};Rs.parse=t;var e=function(i,a){return function(o,s,u,d){a(o,s,u)&&d(o,i,s,u)}};Rs.conditional=e;var r=function(i,a){return function(o,s,u,d){for(var f=[],p=o.pos;a(o,s,u);){var h={};if(d(o,i,s,h),o.pos===p)break;p=o.pos,f.push(h)}return f}};return Rs.loop=r,Rs}var un={},Ex;function X8(){if(Ex)return un;Ex=1,Object.defineProperty(un,"__esModule",{value:!0}),un.readBits=un.readArray=un.readUnsigned=un.readString=un.peekBytes=un.readBytes=un.peekByte=un.readByte=un.buildStream=void 0;var t=function(p){return{data:p,pos:0}};un.buildStream=t;var e=function(){return function(p){return p.data[p.pos++]}};un.readByte=e;var r=function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(h){return h.data[h.pos+p]}};un.peekByte=r;var n=function(p){return function(h){return h.data.subarray(h.pos,h.pos+=p)}};un.readBytes=n;var i=function(p){return function(h){return h.data.subarray(h.pos,h.pos+p)}};un.peekBytes=i;var a=function(p){return function(h){return Array.from(n(p)(h)).map(function(y){return String.fromCharCode(y)}).join("")}};un.readString=a;var o=function(p){return function(h){var y=n(2)(h);return p?(y[1]<<8)+y[0]:(y[0]<<8)+y[1]}};un.readUnsigned=o;var s=function(p,h){return function(y,v,b){for(var x=typeof h=="function"?h(y,v,b):h,k=n(p),S=new Array(x),P=0;P<x;P++)S[P]=k(y);return S}};un.readArray=s;var u=function(p,h,y){for(var v=0,b=0;b<y;b++)v+=p[h+b]&&Math.pow(2,y-b-1);return v},d=function(p){return function(h){for(var y=e()(h),v=new Array(8),b=0;b<8;b++)v[7-b]=!!(y&1<<b);return Object.keys(p).reduce(function(x,k){var S=p[k];return S.length?x[k]=u(v,S.index,S.length):x[k]=v[S.index],x},{})}};return un.readBits=d,un}var Tx;function bD(){return Tx||(Tx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=G8(),r=X8(),n={blocks:function(h){for(var y=0,v=[],b=h.data.length,x=0,k=(0,r.readByte)()(h);k!==y&&k;k=(0,r.readByte)()(h)){if(h.pos+k>=b){var S=b-h.pos;v.push((0,r.readBytes)(S)(h)),x+=S;break}v.push((0,r.readBytes)(k)(h)),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(p){var h=(0,r.peekBytes)(2)(p);return h[0]===33&&h[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(p,h,y){return Math.pow(2,y.descriptor.lct.size+1)})},function(p,h,y){return y.descriptor.lct.exists}),{data:[{minCodeSize:(0,r.readByte)()},n]}]},function(p){return(0,r.peekByte)()(p)===44}),o=(0,e.conditional)({text:[{codes:(0,r.readBytes)(2)},{blockSize:(0,r.readByte)()},{preData:function(h,y,v){return(0,r.readBytes)(v.text.blockSize)(h)}},n]},function(p){var h=(0,r.peekBytes)(2)(p);return h[0]===33&&h[1]===1}),s=(0,e.conditional)({application:[{codes:(0,r.readBytes)(2)},{blockSize:(0,r.readByte)()},{id:function(h,y,v){return(0,r.readString)(v.blockSize)(h)}},n]},function(p){var h=(0,r.peekBytes)(2)(p);return h[0]===33&&h[1]===255}),u=(0,e.conditional)({comment:[{codes:(0,r.readBytes)(2)},n]},function(p){var h=(0,r.peekBytes)(2)(p);return h[0]===33&&h[1]===254}),d=[{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(p,h){return Math.pow(2,h.lsd.gct.size+1)})},function(p,h){return h.lsd.gct.exists}),{frames:(0,e.loop)([i,s,u,a,o],function(p){var h=(0,r.peekByte)()(p);return h===33||h===44})}],f=d;t.default=f})(dv)),dv}var zh={},Cx;function wD(){if(Cx)return zh;Cx=1,Object.defineProperty(zh,"__esModule",{value:!0}),zh.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],d=0,f=0;f<4;f++)for(var p=s[f];p<a;p+=u[f])o(p,d),d++;return i};return zh.deinterlace=t,zh}var jh={},Ox;function xD(){if(Ox)return jh;Ox=1,Object.defineProperty(jh,"__esModule",{value:!0}),jh.lzw=void 0;var t=function(r,n,i){var a=4096,o=-1,s=i,u,d,f,p,h,y,v,T,b,x,A,k,I,M,N,R,S=new Array(i),P=new Array(a),_=new Array(a),E=new Array(a+1);for(k=r,d=1<<k,h=d+1,u=d+2,v=o,p=k+1,f=(1<<p)-1,b=0;b<d;b++)P[b]=0,_[b]=b;var A,T,I,M,R,N;for(A=T=I=M=R=N=0,x=0;x<s;){if(M===0){if(T<p){A+=n[N]<<T,T+=8,N++;continue}if(b=A&f,A>>=p,T-=p,b>u||b==h)break;if(b==d){p=k+1,f=(1<<p)-1,u=d+2,v=o;continue}if(v==o){E[M++]=_[b],v=b,I=b;continue}for(y=b,b==u&&(E[M++]=I,b=v);b>d;)E[M++]=_[b],b=P[b];I=_[b]&255,E[M++]=I,u<a&&(P[u]=v,_[u]=I,u++,(u&f)===0&&u<a&&(p++,f+=u)),v=y}M--,S[R++]=E[M],x++}for(x=R;x<s;x++)S[x]=0;return S};return jh.lzw=t,jh}var Ax;function SD(){if(Ax)return Is;Ax=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.decompressFrames=Is.decompressFrame=Is.parseGIF=void 0;var t=a(bD()),e=G8(),r=X8(),n=wD(),i=xD();function a(f){return f&&f.__esModule?f:{default:f}}var o=function(p){var h=new Uint8Array(p);return(0,e.parse)((0,r.buildStream)(h),t.default)};Is.parseGIF=o;var s=function(p){for(var h=p.pixels.length,y=new Uint8ClampedArray(h*4),v=0;v<h;v++){var b=v*4,x=p.pixels[v],k=p.colorTable[x]||[0,0,0];y[b]=k[0],y[b+1]=k[1],y[b+2]=k[2],y[b+3]=x!==p.transparentIndex?255:0}return y},u=function(p,h,y){if(!p.image){console.warn("gif frame does not have associated image.");return}var v=p.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:p.image.descriptor.top,left:p.image.descriptor.left,width:p.image.descriptor.width,height:p.image.descriptor.height}};return v.descriptor.lct&&v.descriptor.lct.exists?k.colorTable=v.lct:k.colorTable=h,p.gce&&(k.delay=(p.gce.delay||10)*10,k.disposalType=p.gce.extras.disposal,p.gce.extras.transparentColorGiven&&(k.transparentIndex=p.gce.transparentColorIndex)),y&&(k.patch=s(k)),k};Is.decompressFrame=u;var d=function(p,h){return p.frames.filter(function(y){return y.image}).map(function(y){return u(y,p.gct,h)})};return Is.decompressFrames=d,Is}var Ix=SD();function hv(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 kD=Pr(({element:t})=>{const e=Math.min(30,t.width/4,t.height/4),r=X.useRef(null);return X.useEffect(()=>{const n=r.current;if(!n)return;const i=new Et.Animation(a=>{n.rotate((a?.timeDiff||0)/2)},n.getLayer());return i.start(),()=>{i.stop()}},[]),X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},X.createElement(ur,{width:t.width,height:t.height,fill:"rgba(124, 173, 212, 0.8)"}),X.createElement(M2,{ref:r,x:t.width/2,y:t.height/2,fill:"white",outerRadius:Math.abs(e),innerRadius:Math.max(1,e-5),angle:270}))}),_D=Pr(({element:t})=>{const e=Math.max(10,Math.min(30,t.width/22));return X.createElement(Zt,{x:t.a.x,y:t.a.y,rotation:t.a.rotation,listening:!1,opacity:t.a.opacity,hideInExport:!t.showInExport},X.createElement(ur,{width:t.width,height:t.height,fill:"rgba(223, 102, 102, 0.8)"}),X.createElement(Na,{text:"Cannot load the GIF...",fontSize:e,width:t.width,height:t.height,align:"center",fill:"white",verticalAlign:"middle",padding:5}))}),PD=Pr(({element:t,store:e})=>{var r;const[n,i]=X.useState(!1),a=e.selectedShapes.indexOf(t)>=0&&t.selectable,o=X.useRef(null),s=X.useRef(),[u,d,f,p]=(function(M){const[R,N]=X.useState([]),[B,H]=X.useState(0),[$,G]=X.useState("loading"),[Z,J]=X.useState({width:0,height:0});return X.useEffect(()=>{(async()=>{try{const q=await fetch(M),Q=await q.arrayBuffer(),U=Ix.parseGIF(Q),L=Ix.decompressFrames(U,!0),W=U.lsd.width,V=U.lsd.height;J({width:W,height:V});const ee=L.map(K=>({patch:new Uint8ClampedArray(K.patch),delay:K.delay,width:K.dims.width,height:K.dims.height,left:K.dims.left,top:K.dims.top,disposalType:K.disposalType})),re=ee.reduce((K,ne)=>K+ne.delay,0);N(ee),H(re),G("loaded")}catch(q){console.error("Failed to load GIF:",q),G("failed")}})()},[M]),[R,B,Z,$]})(t.src);up(p,t.src,t.id),X.useEffect(()=>(s.current=document.createElement("canvas"),()=>{s.current&&Et.Util.releaseCanvas(s.current)}),[]),X.useEffect(()=>{if(p==="loaded"&&s.current&&(s.current.width=f.width,s.current.height=f.height,u.length>0)){const M=s.current.getContext("2d");if(M){M.clearRect(0,0,f.width,f.height);const R=document.createElement("canvas");hv(u[0],s.current,R)}}},[f,p,u]),X.useEffect(()=>{if(!u.length||!s.current)return;const M=s.current;M.width=f.width,M.height=f.height;const R=document.createElement("canvas"),N=M.getContext("2d");N&&N.clearRect(0,0,M.width,M.height);let B=-1;hv(u[0],M,R),P(),B=0;const H=$=>{const G=(Z=>{const J=Z%d;let q=0;for(let Q=0;Q<u.length;Q++)if(q+=u[Q].delay,q>J)return Q;return 0})($);G!==B&&(hv(u[G],M,R),P(),o.current.getLayer().draw(),B=G)};if(e.isPlaying||t.page._exportingOrRendering)return so(()=>{H(e.currentTime-t.page.startTime)});{const $=window.setInterval(()=>{H(e.currentTime||performance.now())},16);return()=>{clearInterval($)}}},[e.isPlaying,u,d,t.page._exportingOrRendering]),X.useEffect(()=>{d&&e.history.ignore(()=>{t.set({duration:d})})},[d]);let{cropX:h,cropY:y,cropWidth:v,cropHeight:b}=t;p!=="loaded"&&(h=y=0,v=b=1);const x={x:f.width*h,y:f.height*y,width:f.width*v,height:f.height*b},k=(r=t.cornerRadius)!==null&&r!==void 0?r:0,[S,P]=q8(t,s.current,x,e._elementsPixelRatio,k,n||t._cropModeEnabled);X.useLayoutEffect(()=>{if(!n&&!t._cropModeEnabled&&o.current)return ji(o.current,t),so(()=>{ji(o.current,t)},{delay:100})},[s.current,n,v,b,t._cropModeEnabled,f.width,f.height]);const _=p==="loading",E=p==="failed",A=_||E?0:t.a.opacity;Up(o,A);const T=t.selectable||e.role==="admin",I=_u();return X.createElement(X.Fragment,null,_&&X.createElement(kD,{element:t}),E&&X.createElement(_D,{element:t}),X.createElement(Vo,{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:M=>{t.set({x:M.target.x(),y:M.target.y()})},onDragEnd:M=>{t.set({x:M.target.x(),y:M.target.y()})},onTransformStart:()=>i(!0),onTransform:M=>{const R=M.currentTarget,N=Math.abs(R.scaleX()-1)<1e-7?1:R.scaleX(),B=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()*B,rotation:R.rotation()})},onTransformEnd:()=>i(!1)}),X.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}))}),ED={stroke:"rgb(0, 161, 255)",strokeWidth:2},TD=Pr(({element:t})=>X.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},ED)));let Ma=(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 pp=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)||!pp(t[r],e[r]))return!1;return!0}return!1};Object.assign(ft);const CD=ft.model("UndoManager",{history:ft.array(ft.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 p=$o(e);return{pages:p.pages,width:p.width,height:p.height,custom:p.custom,audios:p.audios}}function d(p){const h=e.pages.map(x=>x.id),y=p.pages.map(x=>x.id),v=!pp(h,y),b=!pp(e.custom,p.custom);v?Yv(e.pages,p.pages):e.pages.forEach((x,k)=>{Yv(x,p.pages[k])}),b&&e.set({custom:p.custom}),e.setSize(p.width,p.height)}const f={startTransaction(){o++},endTransaction(p){o--,p||f.requestAddState(u())},async ignore(p,h=!1,y=!1){y&&await new Promise(P=>setTimeout(P,10));const v=!!a;a&&f.addUndoState();let b=s();f.startTransaction();let x=o;try{await p()}catch(P){setTimeout(()=>{throw P})}const k=x!==o,S=!k;f.endTransaction(S),h||b&&!v||f.replaceState(),k||(clearTimeout(a),a=0)},async transaction(p){await f.ignore(p,!0),f.addUndoState()},requestAddState(p){i=p,a||s()||(n?n=!1:a=setTimeout(()=>{a=0,clearTimeout(a),s()||f.addUndoState()},100))},addUndoState(){if(n)return void(n=!1);const p=t.history[t.undoIdx];!pp(i,p)&&(clearTimeout(a),a=0,t.history.splice(t.undoIdx+1),t.history.push(i),t.undoIdx=t.history.length-1)},afterCreate(){if(e=TC(t,".."),!e)throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");r=ek(e,()=>{f.requestAddState(u())}),t.history.length===0&&f.requestAddState(u())},clear(){clearTimeout(a),a=0,t.history.splice(0,t.history.length),t.undoIdx=-1,f.addUndoState()},beforeDestroy(){r()},undo(){a&&f.addUndoState(),s()?d(t.history[t.undoIdx]):t.canUndo?(t.undoIdx--,n=!0,d(t.history[t.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){a&&f.addUndoState(),t.canRedo?(t.undoIdx++,n=!0,d(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 f});async function gg(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 Uh=null;function OD(){var t;return!((t=window.jspdf)===null||t===void 0)&&t.jsPDF?Promise.resolve(window.jspdf.jsPDF):Uh||(typeof window.__polotnoLoadJspdf=="function"?(Uh=window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e),Uh):(Uh=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)}),Uh))}function AD(){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 ID({width:t,height:e}){return new(await AD())({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 RD="https://api.polotno.com",MD=()=>RD+"/api",Y8=Yt({value:!1}),K8=Yt({value:"v1"}),DD=()=>K8.value,Jh=Yt({value:0}),Og=()=>Jh.value,ND=()=>Y8.value,LD=jt(()=>{Y8.value=!0});let ep=typeof window<"u"?window.location.origin:"";const FD=typeof navigator<"u"&&navigator.userAgent.indexOf("Headless")>-1,BD=typeof navigator<"u"&&navigator.userAgent.indexOf("Electron")>-1;ep==="file://"&&FD&&(ep="headless"),ep==="file://"&&BD&&(ep="electron");const zD=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${ep}" here: https://polotno.com/cabinet`;let jD=fetch;async function UD(t){for(let e=0;e<5;e++)try{const r=await jD(MD()+"/validate-key",{method:"POST",body:JSON.stringify({key:t,site:location.host,skdVersion:"2.36.8"})});if(Ca(()=>{K8.value=r.headers.get("x-api-version")||""}),!t)return console.error("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"),Ca(()=>{Jh.value=1}),!1;if(r.status!==200){await new Promise(i=>setTimeout(i,3e3));continue}const n=await r.json();return n.is_valid||(console.error("Polotno API key is not valid. Please get new API key here: https://polotno.com/cabinet"),Ca(()=>{Jh.value=1})),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;"),Ca(()=>{Jh.value===0&&(Jh.value=2)})),n.is_domain_valid||console.log(zD,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),Y5(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 HD(t,e){await UD(t)&&!e||LD()}const pv=[112,72,89,115],$D=(()=>{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})(),Rx=()=>typeof globalThis<"u"?globalThis.Buffer:void 0,Mx=(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},qD=(t,e,r)=>{const n=t.indexOf(","),i=(o=>{if(typeof atob=="function"){const u=atob(o),d=new Uint8Array(u.length);for(let f=0;f<u.length;f++)d[f]=u.charCodeAt(f);return d}const s=Rx();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=(h=>{const y=new Uint8Array(9),v=new DataView(y.buffer);v.setUint32(0,h,!1),v.setUint32(4,h,!1),y[8]=1;const b=new Uint8Array(8+y.length+4);Mx(b,0,y.length),b.set(pv,4),b.set(y,8);const x=new Uint8Array(4+y.length);return x.set(pv,0),x.set(y,4),Mx(b,8+y.length,(k=>{let S=4294967295;for(let P=0;P<k.length;P++)S=$D[255&(S^k[P])]^S>>>8;return(4294967295^S)>>>0})(x)),b})(Math.round(s/.0254)),d=((h,y)=>{let v=8;for(;v+8<=h.length;){const b=h[v]<<24|h[v+1]<<16|h[v+2]<<8|h[v+3],x=v+4,k=h.subarray(x,x+4),S=8+b+4;if(y.every((P,_)=>k[_]===P))return{offset:v,totalLength:S};v+=S}return null})(o,pv);if(d){const h=new Uint8Array(o.length-d.totalLength+u.length);return h.set(o.slice(0,d.offset),0),h.set(u,d.offset),h.set(o.slice(d.offset+d.totalLength),d.offset+u.length),h}const f=16+(o[8]<<24|o[9]<<16|o[10]<<8|o[11])+4;if(f>o.length)return o;const p=new Uint8Array(o.length+u.length);return p.set(o.slice(0,f),0),p.set(u,f),p.set(o.slice(f),f+u.length),p})(i,r):((o,s)=>{const u=(p=>{let h=2;for(;h+4<p.length;){if(p[h]!==255)return-1;const y=p[h+1];if(y===216||y===217){h+=2;continue}const v=p[h+2]<<8|p[h+3];if(v<2)return-1;if(y===224&&p[h+4]===74&&p[h+5]===70&&p[h+6]===73&&p[h+7]===70&&p[h+8]===0)return h;const b=h+2+v;if(b<=h||b>p.length)return-1;h=b}return-1})(o);if(u>=0){const p=new Uint8Array(o),h=u+11;return p[h]=1,p[h+1]=s>>8&255,p[h+2]=255&s,p[h+3]=s>>8&255,p[h+4]=255&s,p}const d=(p=>{const h=new Uint8Array(18);return h[0]=255,h[1]=224,h[2]=0,h[3]=16,h[4]=74,h[5]=70,h[6]=73,h[7]=70,h[8]=0,h[9]=1,h[10]=1,h[11]=1,h[12]=p>>8&255,h[13]=255&p,h[14]=p>>8&255,h[15]=255&p,h})(s),f=new Uint8Array(o.length+d.length);return f.set(o.subarray(0,2),0),f.set(d,2),f.set(o.subarray(2),2+d.length),f})(i,r);return`data:${e};base64,${(o=>{if(typeof btoa=="function"){let u="";for(let d=0;d<o.length;d++)u+=String.fromCharCode(o[d]);return btoa(u)}const s=Rx();if(s)return s.from(o).toString("base64");throw new Error("No base64 encoder available")})(a)}`},N0=({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}},Dx=({px:t,precious:e=2,dpi:r=72,unit:n="px"})=>parseFloat(N0({px:t,dpi:r,unit:n}).toFixed(e)),Nx=({unitVal:t,dpi:e,unit:r})=>t/N0({px:1,unit:r,dpi:e}),VD=t=>{const e=parseFloat(N0(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 WD(t){for(let e=0;e<30;e++){const r=await t();if(r)return r;await new Promise(n=>setTimeout(n,50))}}function Wp(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 GD(t,e){const r=await Wp(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,d=n.height*e.cropHeight,f=e.width/e.height;let p,h;const y=u/d;return e.type==="svg"?(p=u,h=d):f>=y?(p=u,h=u/f):(p=d*f,h=d),a.drawImage(n,o*n.width,s*n.height,p,h,0,0,i.width,i.height),i.toDataURL("image/png")}function Q8(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 ra;(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"})(ra||(ra={}));function Z8(t,e){let r={filter:"",html:void 0};switch(t){case ra.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 ra.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 ra.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 ra.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 ra.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 ra.white:case ra.black:return null;case ra.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,d=u*i+s,f=u*a,p=u*o,h=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
|
+
${d} ${f} ${p} 0 0
|
|
339
|
+
${h} ${y} ${v} 0 0
|
|
340
|
+
${b} ${x} ${k} 0 0
|
|
341
|
+
0 0 0 1 0" />
|
|
342
|
+
</filter>
|
|
343
|
+
</svg>
|
|
344
|
+
`,r}case ra.saturation:{const o=1+Math.max(-1,Math.min(1,e??0)),s=1-o,u=s*.2126+o,d=s*.7152,f=s*.0722,p=s*.2126,h=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} ${d} ${f} 0 0
|
|
349
|
+
${p} ${h} ${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 XD(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 YD=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 J8(t){return cn(t),t}function KD(t){var e=new DOMParser().parseFromString(t,"image/svg+xml");return e.documentElement.setAttribute("preserveAspectRatio","none"),new XMLSerializer().serializeToString(e)}const Ag=async({element:t,page:e,store:r})=>{let{src:n}=t;if(t.type==="svg"){let R=await $p(n);R=KD(R),n=Object.keys(t.colorsReplace).length?H2(R,new Map(Object.entries(t.colorsReplace))):nl(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 N3(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 N3(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 Wp(n),s=o.width*t.cropWidth,u=o.height*t.cropHeight,d=t.width/t.height;let f,p;const h=s/u,y=t.type==="svg"||t.stretchEnabled;y?(f=s,p=u):d>=h?(f=s,p=s/d):(f=u*d,p=u);const v=f/o.width,b=p/o.height,x=f/p>t.width/t.height?t.height/p:t.width/f,k=y?t.width/f:x,S=y?t.height/p:x,P=f*k/v,_=p*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&&cn(t.borderColor),I=T?Math.max(0,t.cornerRadius-t.borderSize):t.cornerRadius,M=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:J8(t.borderColor),padding:t.borderSize+"px",boxSizing:"border-box"}},M):M},Lx=({element:t,type:e})=>{const r={"stroke-width":t.height,stroke:t.color,"stroke-linecap":"round","stroke-linejoin":"round",opacity:t.opacity},n=Object.assign(Object.assign({},r),{fill:t.color}),i=Object.assign(Object.assign({},r),{fill:"none"});return e==="arrow"?ir("polyline",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},i)):e==="triangle"?ir("polygon",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},n)):e==="bar"?ir("polyline",Object.assign({points:`0,${2*-t.height} 0,${2*t.height}`},i)):e==="circle"?ir("circle",Object.assign({cx:2*t.height,cy:0,r:2*t.height},n)):e==="square"?ir("polygon",Object.assign({points:`0,${2*-t.height} ${4*t.height},${2*-t.height} ${4*t.height},${2*t.height} 0,${2*t.height}`},n)):null},QD={image:Ag,svg:Ag,text:async({element:t,page:e,store:r})=>{const n=cn(t.fill),i=cn(t.stroke);if(t.curveEnabled){const x=Tc(t.width,t.height,t.curvePower,t.fontSize),k=li(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+=rd(t.fill,A)}if(i&&t.strokeWidth){const A=`curve-stroke-grad-${t.id}`;S+=rd(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 d=/<[a-z][\s\S]*>/i.test(t.text),f=d?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,_=d?`<style>#${P} {${Ep}}</style>`:"",E=ir("div",{style:Object.assign(Object.assign({},k),{position:"absolute",top:0,left:0,pointerEvents:"none"}),"aria-hidden":"true",innerHTML:d?`${_}${f}`:f}),A=ir("div",Object.assign(Object.assign({style:Object.assign(Object.assign({},S),{position:"relative"})},d?{id:P}:{}),{innerHTML:d?`${_}${f}`:f}));return ir("div",{style:{position:"relative",width:"100%",height:"100%"}},u,ir("div",{style:{position:"relative",width:t.width+"px"}},E,A))}const p=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}),h="el-"+t.id,y=d?{id:h}:{},v=`<style>#${h} {${Ep}}</style>`,b=ir("div",Object.assign(Object.assign({style:p},y),{innerHTML:d?`${v}${f}`:f}));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("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}),ir("g",{transform:`translate(0 ${t.height/2})`},Lx({element:t,type:t.startHead})),ir("g",{transform:`translate(${t.width} ${t.height/2}) rotate(180)`},Lx({element:t,type:t.endHead}))),figure:async({element:t,page:e,store:r,elementHook:n})=>{let i=W8(t);if(t.strokeWidth&&cn(t.stroke)){const o=`figure-stroke-grad-${t.id}`,s=rd(t.stroke,o);i=i.replace(new RegExp(`stroke="${t.stroke.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"`,"g"),`stroke="url(#${o})"`),i=i.replace("</defs>",`${s}</defs>`)}if(cn(t.fill)){const o=`figure-fill-grad-${t.id}`,s=rd(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=>e6({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 XD(t.src),d=u.width*o,f=u.height*s,p=t.width/t.height;let h,y;p>=d/f?(h=d,y=d/p):(h=f*p,y=f);const v=h/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&&cn(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:J8(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:Ag};async function e6({element:t,page:e,store:r,elementHook:n}){var i;let a=await QD[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[f,p]of Object.entries(t.filters)){const h=Z8(ra[f],p.intensity);h&&(s.push(h.filter),h.html&&u.push(h.html))}if(t.shadowEnabled){const f=(function(p,h){if(h===1)return p;const y=Et.Util.colorToRGBA(p);return y?`rgba(${y.r}, ${y.g}, ${y.b}, ${y.a*h})`:p})(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 ${f})`)}const d=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:d,element:t})||d}async function ZD({json:t,elementHook:e}){const r=await Promise.all(t.pages.map(a=>(async function({page:o,store:s,elementHook:u}){const d=await Promise.all(o.children.map(y=>e6({element:y,page:o,store:s,elementHook:u}))),f=o.width==="auto"?s.width:o.width,p=o.height==="auto"?s.height:o.height;let h={};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 Wp(o.background),b=await Ag({element:Object.assign({x:0,y:0,width:f,height:p,src:o.background,cornerRadius:0},Q8({width:f,height:p},{width:y,height:v})),page:o,store:s});d.unshift(b)}else h=Object.assign(Object.assign({},h),{backgroundColor:o.background});return ir("div",{className:"page",id:o.id,style:Object.assign(Object.assign({},h),{width:f+"px",height:p+"px",overflow:"hidden",position:"relative"})},...d)})({page:a,store:t,elementHook:e}))),n=[];zr({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:G5(a),rel:"stylesheet"})});return ir("div",{className:"design"},...i,...r)}const t6=({dom:t})=>{if(typeof t=="string")return t;if(!t)return"";const e=t.props,{innerHTML:r}=e,n=YD(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)=>s==null||s===""?"":typeof s=="object"?`${o}="${Object.keys(s).map(u=>`${u.replace(/-([a-z])/g,d=>d[1].toUpperCase())}:${s[u]};`).join(" ")}"`:`${o}="${s}"`)(a,n[a])).filter(a=>a&&a.trim().length>0).join(" ");return`<${t.type} ${i}>${r||t.children.map(a=>t6({dom:a})).join("")}</${t.type}>`};async function JD({json:t,elementHook:e}){const r=await ZD({json:t,elementHook:e});return t6({dom:r})}var eN=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 r6=(t,e)=>{if(t.children)for(const r of t.children){if(e(r)===!0)break;r6(r,e)}},wt=(t,e,...r)=>({type:t,props:e,children:r||[]});function hc(t,e){if(!cn(t))return null;const{stops:r,rotation:n}=jp(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),d=r.map(({offset:f,color:p})=>wt("stop",{offset:100*f+"%","stop-color":p}));return wt("linearGradient",{id:e,x1:100*a+"%",y1:100*o+"%",x2:100*s+"%",y2:100*u+"%"},...d)}const mv=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}},gv=async({element:t,page:e,store:r})=>{let{src:n}=t;if(t.type==="svg"){const V=await $p(n);n=H2(V,new Map(Object.entries(t.colorsReplace)))}else n=await mv(n);let i,a,o,s,u="";if(t.flipX||t.flipY){const V=t.flipX?-1:1,ee=t.flipY?-1:1,re=t.width/2,K=t.height/2;u=`translate(${re}, ${K}) scale(${V}, ${ee}) translate(${-re}, ${-K})`}t.clipSrc&&(i=`clip-img-mask-${t.id}`,a=await mv(t.clipSrc)),t.maskSrc&&(o=`mask-img-${t.id}`,s=await mv(t.maskSrc));const d=await Wp(n),f=d.width*t.cropWidth,p=d.height*t.cropHeight,h=t.width/t.height;let y,v;const b=f/p,x=typeof t.stretchEnabled=="boolean"&&t.stretchEnabled||t.type==="svg";x?(y=f,v=p):h>=b?(y=f,v=f/h):(y=p*h,v=p);const k=y/d.width,S=v/d.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*d.width*_,M=t.cropY*d.height*E;t.flipX&&(I=(1-t.cropX-t.cropWidth)*d.width*_),t.flipY&&(M=(1-t.cropY-t.cropHeight)*d.height*E);const R=`clip-${t.id}`,N=t.cornerRadius||0,B=n.replace(/&/g,"&"),H={x:-I,y:-M,width:A,height:T,preserveAspectRatio:"none","clip-path":`url(#${R})`},$=[wt("clipPath",{id:R},wt("rect",{x:0,y:0,width:t.width,height:t.height,rx:N||void 0,ry:N||void 0}))];i&&a&&$.push(wt("mask",{id:i,maskUnits:"userSpaceOnUse","mask-type":"alpha"},wt("image",{href:a.replace(/&/g,"&"),x:0,y:0,width:t.width,height:t.height,preserveAspectRatio:"none"}))),o&&$.push(wt("mask",{id:o,maskUnits:"userSpaceOnUse","mask-type":"alpha"},wt("image",Object.assign({href:B},H))));let G=B;const Z={};o&&s&&(G=s.replace(/&/g,"&"),Z.mask=`url(#${o})`);const J={};i&&(J.mask=`url(#${i})`);const q=t.borderSize||0,Q=q>0&&cn(t.borderColor),U=Q?`border-grad-${t.id}`:null;if(Q){const V=hc(t.borderColor,U);V&&$.push(V)}const L=q>0?wt("rect",{x:q/2,y:q/2,width:Math.max(0,t.width-q),height:Math.max(0,t.height-q),fill:"none",stroke:Q?`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=wt("g",{},wt("defs",{},...$),wt("image",Object.assign(Object.assign({href:G},H),Z)),L);return wt("g",J,u?wt("g",{transform:u},W):W)},Fx=({element:t,type:e})=>{const r={"stroke-width":t.height,stroke:t.color,"stroke-linecap":"round","stroke-linejoin":"round"},n=Object.assign(Object.assign({},r),{fill:t.color}),i=Object.assign(Object.assign({},r),{fill:"none"});return e==="arrow"?wt("polyline",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},i)):e==="triangle"?wt("polygon",Object.assign({points:`${3*t.height},${2*-t.height} 0,0 ${3*t.height},${2*t.height}`},n)):e==="bar"?wt("polyline",Object.assign({points:`0,${2*-t.height} 0,${2*t.height}`},i)):e==="circle"?wt("circle",Object.assign({cx:2*t.height,cy:0,r:2*t.height},n)):e==="square"?wt("polygon",Object.assign({points:`0,${2*-t.height} ${4*t.height},${2*-t.height} ${4*t.height},${2*t.height} 0,${2*t.height}`},n)):null},tN={image:gv,svg:gv,text:async({element:t,page:e,store:r})=>{const n=cn(t.fill),i=cn(t.stroke);if(t.curveEnabled){const P=Tc(t.width,t.height,t.curvePower,t.fontSize),_=`curve-path-${t.id}`,E=li(t.text).replace(/\n/g," "),A=t.backgroundPadding*(t.fontSize*t.lineHeight*.5),T=t.backgroundEnabled?wt("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=[wt("path",{id:_,d:P,fill:"none"})],M=t.strokeWidth&&(i||n&&!i);if(n){const R=`curve-fill-grad-${t.id}`,N=hc(t.fill,R);N&&I.push(N)}if(i&&t.strokeWidth){const R=`curve-stroke-grad-${t.id}`,N=hc(t.stroke,R);N&&I.push(N)}if(M){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,B=wt("text",Object.assign(Object.assign({},R),{fill:N,"stroke-width":t.strokeWidth,stroke:N}),wt("textPath",{href:`#${_}`,startOffset:"50%",innerHTML:E})),H=n?`url(#curve-fill-grad-${t.id})`:t.fill,$=wt("text",Object.assign(Object.assign({},R),{fill:H}),wt("textPath",{href:`#${_}`,startOffset:"50%",innerHTML:E}));return wt("g",{},T,wt("defs",{},...I),B,$)}return wt("g",{},T,wt("defs",{},...I),wt("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},wt("textPath",{href:`#${_}`,startOffset:"50%",innerHTML:E})))}const a=(P,_,E,A,T,I=0)=>{const M=document.createElement("canvas").getContext("2d");return M.font=`${T} ${A} ${_}px ${E}`,M.measureText(P).width+Math.max(0,(P?P.length:0)-1)*I*_},o=(P,_,E,A,T,I,M=0)=>{const R=[];return P.split(`
|
|
381
|
+
`).forEach(N=>{const B=N.split(" ");let H="";for(let $=0;$<B.length;$++){const G=H+B[$]+" ";a(G,E,A,T,I,M)>_+.5&&$>0?(R.push(H.trim()),H=B[$]+" "):H=G}R.push(H.trim())}),R};let s=li(t.text);t.textTransform=="uppercase"&&(s=s.toUpperCase());let u=t.fontSize,d=[];for(;;){d=o(s,t.width,u,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing);const P=Math.max(...d.map(E=>a(E,u,t.fontFamily,t.fontWeight,t.fontStyle,t.letterSpacing))),_=d.length*u*t.lineHeight;if(P<=t.width&&_<=t.height||(u-=1,u<4))break}const f=u*t.lineHeight,p=d.length*f;let h=u;t.verticalAlign==="middle"?h=(t.height-p)/2+u:t.verticalAlign==="bottom"&&(h=t.height-p+u);const y=t.align==="center"?"middle":t.align==="right"?"end":"start",v=d.map((P,_)=>wt("tspan",{x:t.align==="center"?t.width/2:t.align==="right"?t.width:0,dy:_===0?0:f,innerHTML:P})),b=t.backgroundPadding*(u*t.lineHeight*.5),x=t.backgroundEnabled?wt("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}`,_=hc(t.fill,P);_&&k.push(_)}if(i&&t.strokeWidth){const P=`text-stroke-grad-${t.id}`,_=hc(t.stroke,P);_&&k.push(_)}if(S){const P={y:h,"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=wt("text",Object.assign(Object.assign({},P),{fill:_,"stroke-width":t.strokeWidth,stroke:_}),...v.map(I=>wt("tspan",I.props,I.props.innerHTML))),A=n?`url(#text-fill-grad-${t.id})`:t.fill,T=wt("text",Object.assign(Object.assign({},P),{fill:A}),...v.map(I=>wt("tspan",I.props,I.props.innerHTML)));return wt("g",{},x,k.length>0?wt("defs",{},...k):null,E,T)}return wt("g",{},x,k.length>0?wt("defs",{},...k):null,wt("text",{fill:n?`url(#text-fill-grad-${t.id})`:t.fill,y:h,"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})=>wt("g",{},wt("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}),wt("g",{transform:`translate(0 ${t.height/2})`},Fx({element:t,type:t.startHead})),wt("g",{transform:`translate(${t.width} ${t.height/2}) rotate(180)`},Fx({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})(W8(t));const a=[];if(t.strokeWidth&&cn(t.stroke)){const s=`figure-stroke-grad-${t.id}`,u=hc(t.stroke,s);if(u){a.push(u);const d=t.stroke.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i=i.replace(new RegExp(`stroke="${d}"`,"g"),`stroke="url(#${s})"`)}}if(cn(t.fill)){const s=`figure-fill-grad-${t.id}`,u=hc(t.fill,s);if(u){a.push(u);const d=t.fill.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i=i.replace(new RegExp(`fill="${d}"`,"g"),`fill="url(#${s})"`)}}if(a.length>0){const s=wt("g",{},wt("defs",{},...a),wt("g",{innerHTML:i}));return n&&n({dom:s,element:t})||s}const o=wt("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=>n6({element:o,page:e,store:r,elementHook:n}))),a=wt("g",{style:{"transform-origin":"top left"}},...i);return n&&n({dom:a,element:t})||a},gif:gv};async function n6({element:t,page:e,store:r,elementHook:n}){var i;let a=await tN[t.type];a||(a=()=>wt("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[f,p]of Object.entries(t.filters)){const h=Z8(ra[f],p.intensity);if(h&&(s.push(h.filter),h.html)){const y=h.html.replace(/<svg([^>]*)>/,"<g$1>").replace(/<\/svg>/,"</g>");u.push(y)}}const d=wt("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:d,element:t})||d}async function Bx(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 rN({json:t,elementHook:e,fontEmbedding:r="inline"}){const n=[];r6({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 d,f;if(u==="Arial")return null;const p=s.find(h=>h.fontFamily===u);if(p){const h=await Bx(p.url);return wt("style",{},`@font-face { font-family: ${u}; src: url(${h}); }`)}{const h=`https://fonts.googleapis.com/css?family=${u}:bi,normal,i,b`;try{const y=await fetch(h),v=await y.text(),b=(f=(d=v.match(/url\((.*?)\)/g))===null||d===void 0?void 0:d.map(k=>k.replace(/url\((.*?)\)/,"$1")))===null||f===void 0?void 0:f.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 Bx(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 wt("style",{},x.join(`
|
|
387
|
+
`))}catch(y){return console.error("Error embedding Google Font:",y),wt("defs",{},wt("style",{type:"text/css",innerHTML:`@import url('${h}');`.replace(/&/g,"&")}))}}}))})(n,t.fonts):[],a=await Promise.all(t.pages.map(o=>(async function({page:s,store:u,elementHook:d}){const f=await Promise.all(s.children.map(y=>n6({element:y,page:s,store:u,elementHook:d}))),p=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 h;if(p){const y=await Wp(s.background);h=await GD(s.background,Object.assign({width:u.width,height:u.height,x:0,y:0},Q8({width:u.width,height:u.height},{width:y.width,height:y.height})))}return wt("g",{className:"page",style:{}},p?wt("image",{"xlink:href":h,x:0,y:0,width:u.width,height:u.height,preserveAspectRatio:"none"}):wt("rect",{x:0,y:0,width:u.width,height:u.height,fill:p?void 0:s.background}),...f)})({page:o,store:t,elementHook:e})));return wt("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 i6=({dom:t,nestLevel:e=0})=>{if(typeof t=="string")return t;if(!t)return"";const r=t.props,{innerHTML:n}=r,i=eN(r,["innerHTML"]),a=Object.keys(i).map(s=>((u,d)=>typeof d=="object"?`${u}="${Object.keys(d).map(f=>`${f}:${d[f]};`).join(" ")}"`:d==null||d===""?"":`${u}="${d}"`)(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=>i6({dom:s,nestLevel:e+1})).join("")}${o}</${t.type}>
|
|
389
|
+
`};async function nN({json:t,elementHook:e,fontEmbedding:r="inline"}){const n=await rN({json:t,elementHook:e,fontEmbedding:r});return i6({dom:n})}const mp=ft.model("Page",{id:ft.identifier,children:ft.array(ft.late(()=>d6)),width:ft.optional(ft.union(ft.number,ft.literal("auto")),"auto"),height:ft.optional(ft.union(ft.number,ft.literal("auto")),"auto"),background:"white",bleed:0,custom:ft.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 dc(t,kc)}})).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($o(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=Ma(10),zr(s,u=>{u.id=Ma(10)})});const i=Object.assign(Object.assign(Object.assign({},n),{id:Ma(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=db[r.type];if(!i)return void console.error("Can not find model with type "+r.type);"children"in r&&Array.isArray(r.children)&&zr(r,s=>{s.id=s.id||Ma(10)});const a=t.children.reduce((s,u)=>{if(u.type==="group"){const d=u.children.reduce((f,p)=>{var h;const y=(h=p.name)===null||h===void 0?void 0:h.match(new RegExp(`${r.type}-(\\d+)`));if(y){const v=parseInt(y[1],10);return Math.max(f,v||0)}},0);return Math.max(s,d||0)}{const d=u.name.match(new RegExp(`${r.type}-(\\d+)`));if(d){const f=parseInt(d[1],10);return Math.max(s,f||0)}}return s},0),o=i.create(Object.assign({id:Ma(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];bc(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];bc(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&&(bc(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;zr(t,T=>{T.type!=="group"&&(s(T)||o.push(T))});const u=o.length?T0(o):{x:0,y:0,width:t.computedWidth,height:t.computedHeight},d=1/4,f=Math.max(0,Math.min(u.x,t.computedWidth-u.x-u.width)),p=t.computedWidth*d,h=Math.max(0,f-p),y=Math.max(0,Math.min(u.y,t.computedHeight-u.y-u.height)),v=t.computedHeight*d,b=Math.max(0,y-v),x=t.computedWidth-2*h,k=t.computedHeight-2*b,S=r/x,P=n/k,_=Math.min(S,P),E=(r-x*_)/2-h*_,A=(n-k*_)/2-b*_;zr(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})}})),zx=ft.model("Audio",{id:ft.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0,custom:ft.frozen()}).actions(t=>({toJSON:()=>Object.assign({},$o(t))})).actions(t=>({set(e){Object.assign(t,e)}}));var Hh=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};SC("ignore");const iN=ft.model("Font",{fontFamily:ft.string,url:ft.optional(ft.string,""),styles:ft.frozen()}).preProcessSnapshot(t=>Object.assign(Object.assign({},t),{fontFamily:t.fontFamily||t.name})),kc=ft.model("Store",{role:"",pages:ft.array(mp),fonts:ft.array(iN),audios:ft.array(zx),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:ft.optional(ft.enumeration("UnitType",["pt","mm","cm","in","px"]),"px"),dpi:72,schemaVersion:2,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:ft.frozen(),tool:ft.optional(ft.enumeration("Tool",["selection","draw","pan","text","eraser"]),"selection"),toolOptions:ft.optional(ft.model({brushType:ft.optional(ft.enumeration("BrushType",["brush","highlighter"]),"brush"),strokeWidth:ft.optional(ft.number,5),stroke:ft.optional(ft.string,"#000000"),opacity:ft.optional(ft.number,1)}),{}),selectedElementsIds:ft.array(ft.string),animatedElementsIds:ft.array(ft.string),history:ft.optional(CD,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),_activePageId:"",_selectedPagesIds:ft.array(ft.string),_forceShowCredit:!1,_key:"",_validated:!1}).views(t=>{const e=Ac(()=>{const r={};return zr({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 zr({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 zr({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:d=!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=d,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||(HD(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=mp.create(Object.assign({id:Ma(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&&(bc(s),t.pages.remove(s),t.pages.splice(o,0,s))},deletePages(a){const o=t.pages.indexOf(t.activePage);a.forEach(d=>{const f=t.pages.find(p=>p.id===d);j1(f)});const s=Math.min(t.pages.length-1,o),u=t.pages[s];u&&(t._activePageId=u.id),t.selectedElementsIds=t.selectedElementsIds.filter(d=>t.getElementById(d))},groupElements(a,o={}){const s=a.map(p=>t.getElementById(p)),u=s[0].page;if(s.forEach(p=>{p&&bc(p)}),!s.length)return;const d=u.children.reduce((p,h)=>{if(h.type==="group"){const y=h.name.match(/group-(\d+)/);if(y){const v=parseInt(y[1],10);return Math.max(p,v)}}return p},0),f=Object.assign({id:Ma(10),name:`group-${d+1}`,children:s,type:"group"},o);return u.children.push(f),t.selectedElementsIds=[f.id],u.children.find(p=>p.id===f.id)},ungroupElements(a){const o=a.map(u=>t.getElementById(u)),s=[];o.forEach(u=>{if(u&&u.type==="group"){const d=u.page,f=d.children.indexOf(u);u.children.forEach(p=>{s.push(p.id)}),u.children.forEach(p=>{bc(p),d.children.push(p)}),d.children.splice(f,1)}}),t.selectedElementsIds=s},deleteElements(a){const o=[];t.find(s=>(a.includes(s.id)&&o.push(s),!1)),o.forEach(s=>{j1(s)}),t.selectedElementsIds=t.selectedElementsIds.filter(s=>t.getElementById(s))},on(a,o){if(a==="change"){let s=i.toJSON();return ek(t,u=>{const d=i.toJSON();!pp(s,d)&&(s=d,o(d))})}},async _toCanvas({pixelRatio:a,ignoreBackground:o,pageId:s,mimeType:u,includeBleed:d,_skipTimeout:f,quickMode:p=!1,_exportCanvases:h}={}){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),p?b?.set({_forceMount:!0}):b?.set({_exporting:!0});const k=await WD(()=>{const q=Et.stages.filter(Q=>Q.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:f});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 M=P.find(q=>!q.visible()&&q.getAttr("editModeEnabled")&&!q.getAttr("hideInExport"));M.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=d?b.bleed:0;let B=N;!t.bleedVisible&&d||(t.bleedVisible||d?t.bleedVisible&&d?B=0:t.bleedVisible&&!d&&(B=-b.bleed):B=0);const H=b.computedWidth+2*N,$=b.computedHeight+2*N,G=P.scale();P.scale({x:1,y:1});const Z=yA(P,{x:P.x()-B,y:P.y()-B,width:H,height:$,pixelRatio:v,sceneCanvas:h?.sceneCanvas,bufferCanvas:h?.bufferCanvas});P.scale(G);const J=Z._canvas;if(u==="image/jpeg"){const q=J.getContext("2d");q.save(),q.globalCompositeOperation="destination-over",q.fillStyle="white",q.fillRect(0,0,J.width,J.height),q.restore()}return o&&P.find(".page-background").forEach(q=>q.show()),R.forEach(q=>{q.visible(q.getAttr("oldVisible"))}),M.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),J},async toDataURL(a={}){var{mimeType:o,quality:s,dpi:u,dpiMetadata:d="auto"}=a,f=Hh(a,["mimeType","quality","dpi","dpiMetadata"]);const p=await i._toCanvas(Object.assign({mimeType:o},f)),h=o||"image/png",y=p.toDataURL(h,s);Et.Util.releaseCanvas(p);const v=u??t.dpi;return h!=="image/png"&&h!=="image/jpeg"||d==="never"||d==="auto"&&v===72?y:qD(y,h,v)},async toBlob(a={}){var{mimeType:o,quality:s}=a,u=Hh(a,["mimeType","quality"]);const d=await i._toCanvas(Object.assign({mimeType:o},u)),f=await new Promise(p=>{d.toBlob(p,o,s)});return Et.Util.releaseCanvas(d),f},async saveAsImage(a={}){var{fileName:o}=a,s=Hh(a,["fileName"]);const u=(s.mimeType||"image/png").split("/")[1];gg(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),d=a.pixelRatio||1,f=a.pageIds||t.pages.map(T=>T.id),p=t.pages.filter(T=>f.includes(T.id)),h=await OD(),y=T=>N0({px:T,unit:u,dpi:o}),v=a.cropMarkSize||0,b=y(v),x=p[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 h({unit:u,orientation:S>P?"landscape":"portrait",format:[S,P],compress:!0,putOnlyUsedFonts:!0});_.deletePage(1);const E=((T,I)=>{const M=[];for(let R=0;R<T.length;R+=I)M.push(T.slice(R,R+I));return M})(p,s);let A=0;for(const T of E){const I=T.map(async M=>{const R=a.includeBleed?M.bleed:0,N=M.computedWidth+2*R+2*v,B=M.computedHeight+2*R+2*v,H=y(N),$=y(B);let G=0,Z=d;for(;G<10;){G+=1;const J=await i.toDataURL(Object.assign(Object.assign({},a),{pageId:M.id,pixelRatio:Z,dpiMetadata:"never"}));if(J.length>20)return Z!==d&&console.error(`Polotno can not export PDF with current settings. Quality is automatically reduced. pixelRatio was reduced to ${parseFloat(Z.toFixed(3))}.`),a.onProgress&&a.onProgress(++A/f.length*.9),{url:J,width:H,height:$,widthPx:N,heightPx:B};Z*=.8}});(await Promise.all(I)).filter(M=>M!==void 0).forEach(({url:M,width:R,height:N,widthPx:B,heightPx:H})=>{_.addPage([R,N],R>N?"landscape":"portrait");const $=_.getCurrentPageInfo();var G;switch(u){case"pt":G=1;break;case"mm":G=72/25.4;break;case"cm":G=72/2.54;break;case"in":G=72;break;case"px":G=.75;break;default:throw"Invalid unit: "+u}if($.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:R*G,topRightY:N*G},$.pageContext.artBox={bottomLeftX:y(v+k)*G,bottomLeftY:y(v+k)*G,topRightX:y(B-v-k)*G,topRightY:y(H-v-k)*G},$.pageContext.bleedBox={bottomLeftX:y(v+k)*G,bottomLeftY:y(v+k)*G,topRightX:y(B-v-k)*G,topRightY:y(H-v-k)*G},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(M,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 ID({width:t.width*o,height:t.height*o}),u=1e3/(a.fps||10),d=t.duration/u;for(let f=0;f<d-1;f++){const p=f*u||1;i.setCurrentTime(p);let h=0,y="";for(const b of t.pages)if(h+=b.duration,b.set({_rendering:h>p}),h>p){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 f of t.pages)f.set({_rendering:!1});return i.stop(),s.render(),new Promise(f=>{s.on("finished",function(p){(function(h,y){var v=new FileReader;v.onload=function(b){y(b.target.result)},v.readAsDataURL(h)})(p,f)})})},async saveAsGIF(a={}){var{fileName:o}=a,s=Hh(a,["fileName"]);const u=await i.toGIFDataURL(s);gg(u,o||"polotno.gif")},async toHTML({elementHook:a}={}){const o=i.toJSON();return JD({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)));gg(u,a||"polotno.html")},async toSVG({elementHook:a,pageId:o,fontEmbedding:s="inline"}={fontEmbedding:"inline"}){var u;const d=i.toJSON();o=o||((u=d.pages[0])===null||u===void 0?void 0:u.id);const f=d.pages.find(p=>p.id===o);return nN({json:Object.assign(Object.assign({},d),{pages:f?[f]:[]}),elementHook:a,fontEmbedding:s})},async saveAsSVG({fileName:a,elementHook:o,pageId:s,fontEmbedding:u="inline"}={}){const d=await i.toSVG({elementHook:o,pageId:s,fontEmbedding:u}),f="data:text/svg;base64,"+window.btoa(unescape(encodeURIComponent(d)));gg(f,a||"polotno.svg")},async saveAsPDF(a={}){var{fileName:o}=a,s=Hh(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 iC()},toJSON:()=>({width:t.width,height:t.height,fonts:$o(t.fonts),pages:$o(t.pages),audios:$o(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)),d=u.schemaVersion||0;d<1&&dr.htmlRenderEnabled&&zr({children:u.pages},y=>{if(y.type==="text"){const b=y.letterSpacing*16;y.letterSpacing=b/y.fontSize}}),d<2&&zr({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 f=t.activePage?t.pages.indexOf(t.activePage):0;let p=(s=u.pages[f]||u.pages[0])===null||s===void 0?void 0:s.id;u._activePageId=p;const h=Object.assign({},$o(t));Object.assign(h,u),h.history=o?$o(t.history):{history:[],undoIdx:-1,targetPath:""},Yv(t,h)},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=>j1(o))},addAudio(a){const o=zx.create(Object.assign({id:Ma(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,s){const u=t.fonts.find(f=>f.fontFamily===a)||L2.find(f=>f.fontFamily===a);let d=[{fontStyle:"normal",fontWeight:"normal"},{fontStyle:"normal",fontWeight:"bold"}];return u?(u.styles&&(d=u.styles.map(f=>({fontStyle:f.fontStyle||"normal",fontWeight:f.fontWeight||"normal"}))),cC(u)):uC(a),o&&s&&!d.some(f=>f.fontStyle===o&&f.fontWeight===s)&&d.push({fontStyle:o,fontWeight:s}),Promise.all(d.map(f=>sC(a,f.fontStyle,f.fontWeight)))},validate:a=>kc.validate(a,[{path:"",type:kc}]).map(o=>({path:"store"+o.context.map(s=>s.path).join("."),message:o.message}))};return i});function aN({key:t,showCredit:e}={key:"",showCredit:!1}){return kc.create({_forceShowCredit:e,_key:t})}const a6=ft.model("Node",{id:ft.identifier,type:"none",name:"",opacity:1,custom:ft.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 dc(t,mp)},get store(){return dc(t,kc)},get top(){let e=t;for(;;){if(!dg(e,fd))return e;e=dc(e,fd)}},get parent(){if(dg(t,fd)){const e=dc(t,fd);return e&&e.children&&e.children.length,e}if(dg(t,mp)){const e=dc(t,mp);return e&&e.children&&e.children.length,e}if(dg(t,kc)){const e=dc(t,kc);return e&&e.pages&&e.pages.length,e}return null},get zIndex(){return t.parent.children.indexOf(t)}})).actions(t=>({toJSON:()=>Object.assign({},$o(t))})).actions(t=>({clone(e={},{skipSelect:r=!1}={}){const n=JSON.parse(JSON.stringify(t.toJSON()));return e.id=e.id||Ma(10),zr(n,i=>{i.id=Ma(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(){}})),jx={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}}},Ux={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},oN={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 LI({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},d={x:e.x,y:e.y,width:e.width,height:e.height,fontSize:e.fontSize},f=t%i/a,p=f<=1?f:2-f;for(let h in u){const y=u[h],v=d[h]-y;s[h]=y+p*v}return s},move:({dTime:t,element:e,animation:r})=>{var n;const i=jx[r.data.direction]||jx.right,a=(n=r.data.strength)!==null&&n!==void 0?n:1,o={};for(var s in i.from){let u=i.from[s],d=i.to[s];r.type==="exit"&&(u=i.to[s],d=-i.from[s]),u*=a,d*=a;const f=e[s]+u,p=e[s]+d-f;o[s]=f+t/r.duration*p}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),d=e.width*(1-a),f=e.height*(1-a),p=(d*s-f*u)/2,h=(d*u+f*s)/2,y={x:e.x+p,y:e.y+h,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=Ux[s]||Ux.right,d=(n=r.data.movementStrength)!==null&&n!==void 0?n:.1,f=(i=r.data.shakeStrength)!==null&&i!==void 0?i:.015;a=r.data.zoomStrength;const p=t/r.duration,h=f*(1-p),y=Math.sin(12*p)*h*.7+Math.sin(8*p)*h*.3;r.type==="exit"&&Math.max(e.cropWidth||1,e.cropHeight||1),r.type;const v=1-Math.pow(1-p,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 M=u.cropX>0?1-(b+k):b;T=Math.min(M,Math.abs(d))*u.cropX}if(u.cropY){const M=u.cropY>0?1-(x+S):x;I=Math.min(M,Math.abs(d))*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}},yv=({element:t,dTime:e,animation:r})=>{const n=oN[r.name];return n?n({element:t,dTime:e,animation:r}):(console.error("Can not find animation type: "+r.name),{})},sN=ft.model("Animation",{delay:0,duration:500,enabled:!0,type:ft.enumeration("Type",["enter","exit","loop"]),name:"none",data:ft.frozen({})}),vv=(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},lN=ft.model("ShapeFilter",{intensity:1}),Hx=["temperature","contrast","highlights","shadows","white","black","saturation","vibrance"],Gp=a6.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:ft.array(sN),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:ft.map(lN),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=>{var e,r,n,i,a,o;const s=["x","y","width","height","rotation","opacity","color","fontSize","cropX","cropY","cropWidth","cropHeight"],u=t,d={x:(e=u.x)!==null&&e!==void 0?e:0,y:(r=u.y)!==null&&r!==void 0?r:0,width:(n=u.width)!==null&&n!==void 0?n:0,height:(i=u.height)!==null&&i!==void 0?i:0,rotation:(a=u.rotation)!==null&&a!==void 0?a:0,opacity:(o=u.opacity)!==null&&o!==void 0?o:1};for(const v of s)v in t&&(d[v]=u[v]);const f=Yt(d),p=jt(v=>{for(const b in v)f[b]=v[b]}),h=jt(v=>{Object.assign(f,v)}),y=jt(v=>{for(const b in v)typeof f[b]=="number"&&(f[b]=f[b]+v[b])});return{get locked(){return!(t.draggable||t.contentEditable||t.styleEditable||t.resizable)},get a(){const{currentTime:v}=t.store,b={};for(const T in f)b[T]=u[T];if(p(b),v===0)return f;const x=v-t.page.startTime;if(x>t.page.duration||x<0)return f;const k=t.store.animatedElementsIds;if(k.length&&!k.includes(t.id))return f;const S=t.animations.find(T=>T.type==="enter"),P=S?.enabled&&x<S.delay;P&&h({opacity:0});const _=S?.enabled&&x>=S.delay&&x<=S.delay+S.duration;if(_){const T=x-S.delay,I=yv({element:t,animation:S,dTime:T}),M=vv(t,I);y(M)}const E=t.animations.find(T=>T.type==="exit");if(!P&&!_&&E?.enabled&&x>=t.page.duration-E.duration-E.delay&&x<=t.page.duration-E.delay){const T=x-(t.page.duration-E.duration-E.delay),I=yv({element:t,animation:E,dTime:T}),M=vv(t,I);y(M)}E?.enabled&&x>=t.page.duration-E.delay&&h({opacity:0});const A=t.animations.find(T=>T.type==="loop");if(A?.enabled){const T=yv({element:t,animation:A,dTime:x}),I=vv(t,T);y(I)}return f},animated(v){return this.a[v]}}}).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){Hx.includes(e)||t.filters.forEach((n,i)=>{Hx.includes(i.toString())||t.filters.delete(i.toString())}),r==null?t.filters.delete(e):t.filters.set(e,{intensity:r})}})),o6=Gp.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:ft.optional(ft.union(ft.number,ft.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=>({afterCreate(){if(!t.height){const e=t.lineHeight,r=typeof e=="number"?e:parseFloat(e)||1.2;t.height=Math.round(t.fontSize*r)}},toggleEditMode(e){t._editModeEnabled=e??!t._editModeEnabled,t._editModeEnabled?t.store.history.startTransaction():t.store.history.endTransaction()}})),L0=Gp.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=Yt.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)}}}}),s6=L0.named("Video").props({type:"video",duration:0,startTime:0,endTime:1,volume:1}),l6=Gp.named("Line").props({type:"line",width:400,height:10,color:"black",dash:ft.array(ft.number),startHead:"",endHead:""}).actions(t=>({})),u6=Gp.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:ft.map(ft.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)}})),c6=Gp.named("Figure").props({type:"figure",subType:"rect",fill:"rgb(0, 161, 255)",dash:ft.array(ft.number),strokeWidth:0,stroke:"rgba(98, 197, 255, 1)",cornerRadius:0}),f6=L0.named("Gif").props({type:"gif",duration:0,keepRatio:!0});var uN=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 zr=(t,e)=>{if(t.children)for(const r of t.children){if(e(r)===!0)break;zr(r,e)}},cN=[...new Array(20)].map((t,e)=>ft.late(()=>fN[e])),d6=ft.union({dispatcher:t=>{const e=db[t.type];if(!e)throw new Error(`Unknown element type: "${t.type}"`);return e}},u6,o6,L0,l6,s6,c6,f6,ft.late(()=>fd),...cN),fd=a6.named("Group").props({type:"group",children:ft.array(d6)}).views(t=>({get draggable(){let e=!0;return zr(t,r=>{r.draggable||(e=!1)}),e},get resizable(){let e=!0;return zr(t,r=>{r.resizable||(e=!1)}),e},get contentEditable(){let e=!0;return zr(t,r=>{r.contentEditable||(e=!1)}),e},get styleEditable(){let e=!0;return zr(t,r=>{r.styleEditable||(e=!1)}),e},get locked(){let e=!0;return zr(t,r=>{r.locked||(e=!1)}),e}})).actions(t=>({set(e){var{draggable:r,contentEditable:n,styleEditable:i,resizable:a}=e,o=uN(e,["draggable","contentEditable","styleEditable","resizable"]);r!==void 0&&zr(t,s=>{s.set({draggable:r})}),n!==void 0&&zr(t,s=>{s.set({contentEditable:n})}),i!==void 0&&zr(t,s=>{s.set({styleEditable:i})}),a!==void 0&&zr(t,s=>{s.set({resizable:a})}),Object.assign(t,o)},addElement(e,{skipSelect:r=!1}={}){const n=db[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||Ma(10)});const i=n.create(Object.assign({id:Ma(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&&(bc(n),t.children.remove(n),t.children.splice(r,0,n))},setAnimation(e,r){zr(t,n=>{n.setAnimation(e,r)})}})),fN=[],db={svg:u6,text:o6,image:L0,group:fd,line:l6,video:s6,figure:c6,gif:f6},dN={text:oA,image:z3,svg:z3,line:UI,video:sD,figure:vD,group:Pr(t=>{const{element:e,store:r}=t,{children:n}=e,i=e.selectable||r.role==="admin";return X.createElement(Zt,{opacity:e.opacity,listening:i,hideInExport:!e.showInExport,id:e.id},n.map(a=>X.createElement(h6,Object.assign({},t,{key:a.id,store:r,element:a}))))}),gif:PD},hN=(t,e)=>{const r=[];zr(t,f=>{f.type!=="group"&&r.push(f.a)});const n=[];r.forEach(f=>{const p=[{x:0,y:0},{x:0+f.width,y:0},{x:0+f.width,y:0+f.height},{x:0,y:0+f.height}],h=new Et.Transform;h.translate(f.x,f.y),h.rotate(Et.Util.degToRad(f.rotation)),p.forEach(y=>{const v=h.point(y);n.push(v)})});const i=new Et.Transform;i.rotate(-Et.Util.degToRad(e));let a=1/0,o=1/0,s=-1/0,u=-1/0;n.forEach(f=>{const p=i.point(f);a=Math.min(a,p.x),o=Math.min(o,p.y),s=Math.max(s,p.x),u=Math.max(u,p.y)}),i.invert();const d=i.point({x:a,y:o});return{x:d.x,y:d.y,width:s-a,height:u-o,rotation:e}},h6=Pr(t=>{var e;const{element:r,store:n}=t,[i,a]=X.useState(!1),o=n.selectedElements.indexOf(r)>=0&&r.selectable,s=((e=r.parent)===null||e===void 0?void 0:e.type)==="group",u=(p=>{const[h,y]=X.useState();return X.useEffect(()=>{const v=setTimeout(()=>{const b=p.page.id,x=Et.stages.find(k=>k.getAttr("pageId")===b);x||console.error("No stage is found for element",p.id),y(x)});return()=>clearTimeout(v)},[p.id]),h})(r),d=u?.findOne("Transformer");X.useEffect(()=>{if(u){const p=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",p);const h=()=>{a(!1)};return u.on("mouseleave",h),()=>{u.off("mouseover",p),u.off("mouseleave",h)}}},[u]);let f=dN[t.element.type];return t.element.type==="text"&&dr.htmlRenderEnabled&&(f=RI),t.element.visible?f?X.createElement(Zt,{name:"element-container"},X.createElement(f,Object.assign({},t)),i&&!o&&!s&&X.createElement(TD,{element:r.type==="group"?{a:hN(r,d?.rotation()||0)}:r})):(console.error("Can not find component for "+t.element.type),null):null});function pN(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 d=0;d<u;d++){const f=d/u,p=f*f,h=p*f,y=.5*(2*a.x+(-i.x+o.x)*f+(2*i.x-5*a.x+4*o.x-s.x)*p+(-i.x+3*a.x-3*o.x+s.x)*h),v=.5*(2*a.y+(-i.y+o.y)*f+(2*i.y-5*a.y+4*o.y-s.y)*p+(-i.y+3*a.y-3*o.y+s.y)*h);r.push({x:y,y:v})}}return r.push(t[t.length-1]),r}function mN(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 gN(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 yN(t,e){if(t.length===0)throw new Error("Cannot create SVG from empty path");const r=pN(t),n=gN(r),i=e.strokeWidth,a=n.x-i,o=n.y-i,s=n.width+2*i,u=n.height+2*i,d=`
|
|
390
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${u}" viewBox="0 0 ${s} ${u}">
|
|
391
|
+
<path
|
|
392
|
+
d="${mN(r.map(f=>({x:f.x-a,y:f.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:nl(d),x:a,y:o,width:s,height:u}}const vN=Pr(({store:t,page:e,width:r,height:n,scale:i,xPadding:a,yPadding:o,bleed:s})=>{const[u,d]=X.useState(!1),[f,p]=X.useState([]),h=X.useRef(null),y=t.tool==="draw",{strokeWidth:v,stroke:b,opacity:x,brushType:k}=t.toolOptions,S=X.useCallback(A=>{if(!y||(d(!0),A.cancelBubble=!0,!A.target.getStage()))return;const T=h.current.getRelativePointerPosition();T&&p([{x:T.x,y:T.y}])},[y,i,a,o,s]),P=X.useCallback(A=>{if(!y||!u||(A.cancelBubble=!0,!A.target.getStage()))return;const T=h.current.getRelativePointerPosition();T&&p(I=>[...I,{x:T.x,y:T.y}])},[y,u,i,a,o,s]),_=X.useCallback(()=>{if(y&&u){if(d(!1),f.length>=1)try{const A=yN(f,{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)}p([])}},[y,u,f,b,v,x,e,t.history,t]),E=X.useMemo(()=>f.flatMap(A=>[A.x,A.y]),[f]);return X.useEffect(()=>{if(y&&h.current){const A=h.current.getStage();if(!A)return;const T=v*i;if(T>100||T<4)A.container().style.cursor="crosshair";else{const I=T/2,M=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="${M}" cy="${M}" r="${I-1}" fill="${b}" opacity="${x}" stroke="white" stroke-width="1"/>
|
|
402
|
+
<circle cx="${M}" cy="${M}" r="${I-1}" fill="none" stroke="black" stroke-width="1" opacity="0.3"/>
|
|
403
|
+
</svg>`)}`;A.container().style.cursor=`url("${R}") ${M} ${M}, crosshair`}return()=>{A.container()&&(A.container().style.cursor="")}}},[y,b,v,x,i]),y?X.createElement(Zt,{ref:h,listening:y,x:a+s*i,y:o+s*i,scaleX:i,scaleY:i},X.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:_}),f.length>0&&X.createElement($s,{points:E,stroke:b,strokeWidth:v,lineCap:"round",lineJoin:"round",opacity:x,tension:.5,listening:!1})):null});function bN(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 p6=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 $x=Et.DD._drag;window.removeEventListener("mousemove",$x),Et.DD._drag=function(t){Ca(()=>{$x.call(this,t)})},window.addEventListener("mousemove",Et.DD._drag);const f2=new Et.Group,cu=20;f2.add(new Et.Rect({width:cu,height:cu,fill:"white"})),f2.add(new Et.Path({scaleX:cu/24,scaleY:cu/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 wN=f2.toCanvas({pixelRatio:2,width:cu,height:cu}),Hs={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:wN,fillPatternScaleX:20/cu/2,fillPatternScaleY:20/cu/2,fillPriority:"pattern",fillPatternRepeat:"no-repeat"})}},yg={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"]}},xN=t=>X.createElement(ur,Object.assign({},t,{preventDefault:!1})),SN=t=>{var{url:e}=t,r=p6(t,["url"]);const[n,i]=D2(e,"anonymous"),a=n?bN(n,{width:r.width,height:r.height},"center-middle"):{};return up(i,e,"page background"),X.createElement(Vo,Object.assign({image:n},r,a))},kN=t=>{const e=Zo({a:{width:t.width,height:t.height},width:t.width,height:t.height},t.fill);return X.createElement(ur,Object.assign({},t,e))},_N=t=>{const{background:e,scale:r,borderColor:n}=t,i=p6(t,["background","scale","borderColor"]),a=X.useMemo(()=>!!Et.Util.colorToRGBA(e)||cn(e),[e]),o=X.useMemo(()=>{const s=document.createElement("canvas"),u=30;s.width=60,s.height=60;const d=s.getContext("2d");return d&&(d.fillStyle="black",d.fillRect(u,0,u,u),d.fillRect(0,u,u,u)),s},[]);return X.createElement(X.Fragment,null,X.createElement(ur,Object.assign({fillPatternImage:o},i,{opacity:.1,hideInExport:!0})),a?X.createElement(kN,Object.assign({fill:e},i)):X.createElement(SN,Object.assign({url:e},i)))},PN=Pr(({selection:t,fill:e="rgba(0, 161, 255, 0.3)",stroke:r="rgb(0, 161, 255)",strokeWidth:n=1})=>t.visible?X.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 EN(t){let e=180*t/Math.PI;return e%=360,e>180?e-=360:e<-180&&(e+=360),Math.round(e)}const TN=Pr(({x:t,y:e,width:r,height:n,rotation:i,anchor:a,store:o,tagFill:s,textFill:u})=>{if(t===void 0||e===void 0||r===void 0||n===void 0||i===void 0||a===void 0)return null;const d=Nd({x:t,y:e,width:r,height:n,rotation:Et.Util.radToDeg(i)}),f=(n/2+70)*Math.cos(i-Math.PI/2),p=(n/2+70)*Math.sin(i-Math.PI/2),h=Dx({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:o.unit==="px"?0:1})+" x "+Dx({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:o.unit==="px"?0:1})+(o.unit==="px"?"":" "+o.unit);return X.createElement(X.Fragment,null,X.createElement(Hg,{x:(d.minX+d.maxX)/2+f,y:(d.minY+d.maxY)/2+p,offsetX:14,offsetY:14,visible:a==="rotater"},X.createElement($g,{cornerRadius:5,fill:s||"rgb(0, 161, 255)"}),X.createElement(Na,{align:"center",verticalAlign:"middle",fill:u||"white",padding:8,text:EN(i).toString()+"°"})),X.createElement(Hg,{x:(d.minX+d.maxX)/2,y:d.maxY+20,visible:a!=="rotater"},X.createElement($g,{cornerRadius:5,fill:s||"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),X.createElement(Na,{align:"center",verticalAlign:"middle",fill:u||"white",padding:8,text:h})))}),CN=Pr(({elements:t,store:e})=>{const r=t.filter(i=>i.alwaysOnTop),n=t.filter(i=>!i.alwaysOnTop).concat(r);return X.createElement(X.Fragment,null,n.map(i=>X.createElement(h6,{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.")}})))}),ON=({store:t})=>{const[e,r]=X.useState(!1),[n,i]=X.useState({x:0,y:0});return{open:X.useCallback(o=>{r(!0),i(o)},[]),close:X.useCallback(()=>{r(!1)},[]),props:{isOpen:e,offset:n,setIsOpen:r}}},AN=atob("UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4="),d2=atob("I2MwMzkyYg=="),IN=atob("djAuOS4y"),RN=t=>X.createElement(X.Fragment,null,X.createElement(Hg,{fill:d2,height:200},X.createElement($g,{fill:d2}),X.createElement(Na,Object.assign({},t,{fill:"white",text:AN,height:void 0,padding:10,fontSize:20})))),MN=atob("RlJFRSAgVFJJQUwgIExJQ0VOU0U="),DN=(atob("UG93ZXJlZCBieSBQb2xvdG5v"),atob("TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw==")),NN=atob("UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA=="),qx=t=>{const e=Og()===1,r=e?DN:MN,n=e?230:195;return X.createElement(Zt,Object.assign({},t,{listening:!1}),X.createElement(ur,{fill:d2,width:n,height:24,cornerRadius:2}),X.createElement(Na,{text:r,fill:"white",fontSize:13,fontFamily:"monospace",width:n,align:"center",y:5,listening:!1}),e&&X.createElement(Na,{text:NN,fill:"rgba(0,0,0,0.6)",fontSize:14,y:30,listening:!1}))},LN=Pr(({store:t,page:e,width:r,height:n,pageControlsEnabled:i,backColor:a,pageBorderColor:o,activePageBorderColor:s,components:u,bleedColor:d,altCloneEnabled:f,viewportSize:p,selectionRectFill:h,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:M})=>{const R=t.bleedVisible?e.bleed:0,N=e.computedWidth+2*R,B=e.computedHeight+2*R,H=(r-N*t.scale)/2,$=(n-B*t.scale)/2,G=X.useRef(null),Z=X.useRef(null),J=X.useRef(null),q=i==null||i,Q=X.useRef(!1),[U,L]=X.useState(null),[W,V]=X.useState({}),[ee,re]=X.useState(0),K=ON({store:t}),ne=t.selectedElements.find(xe=>xe._cropModeEnabled),le=t.selectedElements.find(xe=>xe.curveEnabled),ae=t.selectedShapes.filter(xe=>!xe.resizable).length>0,ue=t.selectedShapes.filter(xe=>!xe.draggable).length>0,ye=t.selectedElements.filter(xe=>!xe.visible).length>0;X.useLayoutEffect(()=>{var xe,me,je;if(!G.current)return;const ve=G.current.getStage(),qe=t.selectedShapes.map(At=>At._cropModeEnabled?null:ve.findOne("#"+At.id)).filter(At=>!!At),ht=t.selectedElements.length===1,gt=ht&&((xe=t.selectedElements[0])===null||xe===void 0?void 0:xe.type)||"many";yg[gt]?(G.current.setAttrs(Object.assign(Object.assign({},Hs),yg[gt])),gt!=="svg"&>!=="image"&>!=="gif"||t.selectedElements[0].keepRatio||G.current.setAttrs({enabledAnchors:Hs.enabledAnchors}),gt==="text"&&dr.textVerticalResizeEnabled&&G.current.setAttrs({enabledAnchors:(me=yg.text.enabledAnchors)===null||me===void 0?void 0:me.concat(["bottom-center"])}),gt==="text"&&ht&&t.selectedElements[0].curveEnabled&&G.current.setAttrs({enabledAnchors:yg.many.enabledAnchors})):G.current.setAttrs(Hs),ae&&G.current.enabledAnchors([]),ue&&G.current.rotateEnabled(!1),qe.find(At=>At?.isDragging())&&qe.forEach(At=>{At.isDragging()||At==null||At.startDrag()}),G.current.nodes(qe),Zk(),(je=G.current.getLayer())===null||je===void 0||je.batchDraw()},[t.selectedShapes,ne,ae,ye,ue,le]);const Ie=()=>{var xe,me;const je=G.current;if(!je)return;if(!je.isTransforming())return void V({});if(!je.nodes().length||!je.isTransforming())return;const ve=je.__getNodeRect(),qe=je?.getActiveAnchor(),ht=je.getStage();V({anchor:qe,x:ve.x-((xe=ht?.x())!==null&&xe!==void 0?xe:0),y:ve.y-((me=ht?.y())!==null&&me!==void 0?me:0),rotation:ve.rotation,width:ve.width,height:ve.height})},Le=X.useCallback(()=>{var xe;if(!((xe=G.current)===null||xe===void 0)&&xe.isTransforming())return;const me=G.current;if(!me||!me.nodes().length)return void re(0);const je=me.getClientRect();if(!me.getStage())return;const ve=(function(qe,ht,gt,At=0){const be=qe.x+qe.width/2,_e=qe.y+qe.height/2,ze=qe.width/2,Ye=qe.height/2,xt=At*Math.PI/180,ot=Ft=>{const Ht=Ft*Math.PI/180,wr=(Ft%360+360)%360;let Tr;Tr=wr===0||wr===180?Ye:ze;const mr=Math.sin(Ht)*(Tr+gt),zt=-Math.cos(Ht)*(Tr+gt),Cr=mr*Math.cos(xt)-zt*Math.sin(xt),qr=mr*Math.sin(xt)+zt*Math.cos(xt);return{x:be+Cr,y:_e+qr}},It=Ft=>Ft.x>=ht.left&&Ft.x<=ht.right&&Ft.y>=ht.top&&Ft.y<=ht.bottom;if(It(ot(0)))return 0;for(const Ft of[180,270,90])if(It(ot(Ft)))return Ft;return 0})(je,{top:M?.top||0,bottom:n-(M?.bottom||0),left:M?.left||0,right:r-(M?.right||0)},Hs.rotateAnchorOffset||30,me.rotation());re(ve)},[M,r,n]);X.useEffect(()=>{var xe;(xe=G.current)===null||xe===void 0||xe.update(),Ie(),Le()},[t.scale,Le]),X.useEffect(()=>{Le()},[t.selectedShapes,Le]);const Ue=sP(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),$e=X.useRef(!1),rt=_u(),Se=jt(xe=>{var me,je,ve,qe,ht,gt,At;if(rt)return;$e.current=!1;const be=xe.target.findAncestor(".elements-container"),_e=xe.target.findAncestor("Transformer"),ze=xe.target.findAncestor(".page-abs-container");if(be||_e||ze)return;const Ye=(me=xe.target.getStage())===null||me===void 0?void 0:me.getPointerPosition();Ye&&(Ye.x-=(ve=(je=xe.target.getStage())===null||je===void 0?void 0:je.x())!==null&&ve!==void 0?ve:0,Ye.y-=(ht=(qe=xe.target.getStage())===null||qe===void 0?void 0:qe.y())!==null&&ht!==void 0?ht:0,Ue.visible=!0,Ue.x1=Ye.x,Ue.y1=Ye.y,Ue.x2=Ye.x,Ue.y2=Ye.y,((At=(gt=xe.target.getStage())===null||gt===void 0?void 0:gt.getPointersPositions().length)!==null&&At!==void 0?At:0)>=2&&(Ue.visible=!1))});(({stageRef:xe,containerRef:me,viewportSize:je})=>{X.useEffect(()=>{var ve;const qe=(ve=me.current)===null||ve===void 0?void 0:ve.closest(".polotno-workspace-inner");function ht(){var gt;if(!xe.current)return;const At=(gt=me.current)===null||gt===void 0?void 0:gt.getBoundingClientRect(),be=qe?.getBoundingClientRect();if(!At||!be)return;const _e=Math.max(0,be.left-At.left-100),ze=Math.max(0,be.top-At.top-100);xe.current.position({x:-_e,y:-ze}),xe.current.container().style.transform=`translate(${_e}px, ${ze}px)`}return ht(),qe?.addEventListener("scroll",ht),()=>{qe?.removeEventListener("scroll",ht)}},[je.width,je.height])})({stageRef:Z,containerRef:J,viewportSize:p}),X.useEffect(()=>{const xe=jt(je=>{var ve,qe,ht,gt,At,be;if(!Ue.visible)return;(ve=Z.current)===null||ve===void 0||ve.setPointersPositions(je);let _e=(qe=Z.current)===null||qe===void 0?void 0:qe.getPointerPosition();_e?(_e.x-=(gt=(ht=Z.current)===null||ht===void 0?void 0:ht.x())!==null&>!==void 0?gt:0,_e.y-=(be=(At=Z.current)===null||At===void 0?void 0:At.y())!==null&&be!==void 0?be:0):_e={x:Ue.x2,y:Ue.y2},Ue.x2=_e.x,Ue.y2=_e.y}),me=jt(()=>{if(!Ue.visible||!Z.current)return;const je=Z.current.findOne(".selection"),ve=je?je.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(ve.width&&ve.height){const qe=[];Z.current.find(".element").forEach(gt=>{const At=gt.getClientRect(),be=t.getElementById(gt.id()),_e=be?.draggable,ze=be?.selectable;Et.Util.haveIntersection(ve,At)&&_e&&ze&&qe.push(be.top.id)});const ht=[...new Set(qe)];$e.current=!0,t.selectElements(ht)}Ue.visible=!1});return window.addEventListener("mousemove",xe),window.addEventListener("touchmove",xe),window.addEventListener("mouseup",me,{capture:!0}),window.addEventListener("touchend",me,{capture:!0}),()=>{window.removeEventListener("mousemove",xe),window.removeEventListener("touchmove",xe),window.removeEventListener("mouseup",me),window.removeEventListener("touchend",me)}},[]);const de=X.useCallback(xe=>{if(!t.selectedElements[0]||xe&&t.selectedElementsIds.includes(xe))return;const me=T0(t.selectedShapes),je=xe?t.getElementById(xe):{x:0,y:0,width:e.computedWidth,height:e.computedHeight,rotation:0},ve=Nd(je),qe=[];me.minX>ve.maxX&&qe.push({distance:me.minX-ve.maxX,box1:me,box2:ve,points:[{x:me.minX,y:me.minY+me.height/2},{x:ve.maxX,y:me.minY+me.height/2},{x:ve.maxX,y:ve.minY+ve.height/2}]}),me.maxX<ve.minX&&qe.push({distance:ve.minX-me.maxX,box1:me,box2:ve,points:[{x:me.maxX,y:me.minY+me.height/2},{x:ve.minX,y:me.minY+me.height/2},{x:ve.minX,y:ve.minY+ve.height/2}]}),me.minY>ve.maxY&&qe.push({box1:me,box2:ve,distance:me.minY-ve.maxY,points:[{x:me.minX+me.width/2,y:me.minY},{x:me.minX+me.width/2,y:ve.maxY},{x:ve.minX+ve.width/2,y:ve.maxY}]}),me.maxY<ve.minY&&qe.push({box1:me,box2:ve,distance:ve.minY-me.maxY,points:[{x:me.minX+me.width/2,y:me.maxY},{x:me.minX+me.width/2,y:ve.minY},{x:ve.minX+ve.width/2,y:ve.minY}]});const ht=me.minX>=ve.minX&&me.maxX<=ve.maxX&&me.minY>=ve.minY&&me.maxY<=ve.maxY;if(ht&&(qe.push({distance:me.minX-ve.minX,box1:me,box2:ve,points:[{x:me.minX,y:me.minY+me.height/2},{x:ve.minX,y:me.minY+me.height/2},{x:ve.minX,y:ve.minY+ve.height/2}]}),qe.push({distance:ve.maxX-me.maxX,box1:me,box2:ve,points:[{x:me.maxX,y:me.minY+me.height/2},{x:ve.maxX,y:me.minY+me.height/2},{x:ve.maxX,y:ve.minY+ve.height/2}]}),qe.push({box1:me,box2:ve,distance:me.minY-ve.minY,points:[{x:me.minX+me.width/2,y:me.minY},{x:me.minX+me.width/2,y:ve.minY},{x:ve.minX+ve.width/2,y:ve.minY}]}),qe.push({box1:me,box2:ve,distance:ve.maxY-me.maxY,points:[{x:me.minX+me.width/2,y:me.maxY},{x:me.minX+me.width/2,y:ve.maxY},{x:ve.minX+ve.width/2,y:ve.maxY}]})),qe.length===0&&!ht){const gt=me.minX<ve.maxX&&me.maxX>ve.minX,At=me.minY<ve.maxY&&me.maxY>ve.minY;if(gt&&At){const be=(Math.max(me.minY,ve.minY)+Math.min(me.maxY,ve.maxY))/2,_e=(Math.max(me.minX,ve.minX)+Math.min(me.maxX,ve.maxX))/2;me.minX<ve.minX?qe.push({distance:ve.minX-me.minX,box1:me,box2:ve,points:[{x:me.minX,y:be},{x:ve.minX,y:be},{x:ve.minX,y:be}]}):qe.push({distance:me.minX-ve.minX,box1:me,box2:ve,points:[{x:me.minX,y:be},{x:ve.minX,y:be},{x:ve.minX,y:be}]}),me.maxX>ve.maxX?qe.push({distance:me.maxX-ve.maxX,box1:me,box2:ve,points:[{x:ve.maxX,y:be},{x:me.maxX,y:be},{x:ve.maxX,y:be}]}):qe.push({distance:ve.maxX-me.maxX,box1:me,box2:ve,points:[{x:me.maxX,y:be},{x:ve.maxX,y:be},{x:ve.maxX,y:be}]}),me.minY<ve.minY?qe.push({box1:me,box2:ve,distance:ve.minY-me.minY,points:[{x:_e,y:me.minY},{x:_e,y:ve.minY},{x:_e,y:ve.minY}]}):qe.push({box1:me,box2:ve,distance:me.minY-ve.minY,points:[{x:_e,y:me.minY},{x:_e,y:ve.minY},{x:_e,y:ve.minY}]}),me.maxY>ve.maxY?qe.push({box1:me,box2:ve,distance:me.maxY-ve.maxY,points:[{x:_e,y:ve.maxY},{x:_e,y:me.maxY},{x:_e,y:ve.maxY}]}):qe.push({box1:me,box2:ve,distance:ve.maxY-me.maxY,points:[{x:_e,y:me.maxY},{x:_e,y:ve.maxY},{x:_e,y:ve.maxY}]})}}JSON.stringify(U)!==JSON.stringify(qe)&&L(qe)},[t,e]);X.useEffect(()=>{t.distanceGuidesVisible?de():U&&L(null)},[t.distanceGuidesVisible,de,t.selectedShapes.map(xe=>`${xe.x},${xe.y},${xe.width},${xe.height},${xe.rotation}`).join("|")]);const se=X.useRef(!1);X.useEffect(()=>{var xe;let me;const je=(xe=J.current)===null||xe===void 0?void 0:xe.closest(".polotno-workspace-inner"),ve=()=>{se.current=!0,clearTimeout(me),me=setTimeout(()=>{se.current=!1},300)};return je?.addEventListener("scroll",ve),()=>{clearTimeout(me),je?.removeEventListener("scroll",ve)}},[]),X.useEffect(()=>{const xe=Z.current;if(!xe)return;const me=xe.container(),je=ve=>{var qe,ht;ve.touches.length>=2&&(!((qe=G.current)===null||qe===void 0)&&qe.isDragging()&&G.current.stopDrag(),(ht=G.current)===null||ht===void 0||ht.nodes().forEach(gt=>{gt.isDragging()&>.stopDrag()}))};return me.addEventListener("touchstart",je,{passive:!0}),me.addEventListener("touchmove",je,{passive:!0}),()=>{me.removeEventListener("touchstart",je),me.removeEventListener("touchmove",je)}},[]);const he=xe=>{if(t.activePage!==e&&e.select(),se.current||$e.current)return;const me=xe.evt.ctrlKey||xe.evt.metaKey||xe.evt.shiftKey,je=xe.target.findAncestor(".elements-container"),ve=xe.target.findAncestor(".page-abs-container"),qe=xe.target.findAncestor("Transformer");if(!(me||je||qe||ve||Ue.visible))return void t.selectElements([]);const ht=xe.target.findAncestor(".element-container",!0),gt=ht?.findOne(".element")||xe.target.findAncestor(".element",!0),At=t.getElementById(gt?.id()),be=At?.top,_e=be?.id,ze=t.selectedElementsIds.indexOf(_e)>=0,Ye=xe.target.findAncestor(".page-container",!0);_e&&me&&!ze?t.selectElements(t.selectedElementsIds.concat([_e])):_e&&me&&ze?t.selectElements(t.selectedElementsIds.filter(xt=>xt!==_e)):!_e||me||ze?Ye?t.selectPages([e.id]):t.selectPages([]):t.selectElements([_e])};BI(G,t,{stroke:b,strokeWidth:x,dash:k});const Ce=t.activePage===e,oe=t._selectedPagesIds.includes(e.id),ke=u?.PageControls,Oe=u?.Tooltip,Be=u?.ContextMenu,dt=1/t.scale,nt=0/t.scale;return X.createElement("div",{ref:J,onDragOver:xe=>xe.preventDefault(),onDrop:xe=>{if(xe.preventDefault(),!Z.current)return;Z.current.setPointersPositions(xe);const me=Z.current.findOne(".elements-container");me?.getRelativePointerPosition();const je=Z.current.getPointerPosition(),ve=Z.current.getAllIntersections(je).map(ht=>ht.findAncestor(".element",!0)).filter(Boolean);[...new Set(ve.reverse())].map(ht=>t.getElementById(ht.id())).filter(ht=>!!ht)[0]},style:{position:"relative",width:r+"px",height:n+"px",overflow:"hidden",flexShrink:0},className:"polotno-page-container"+(Ce?" active-page":"")},X.createElement(LT,{ref:Z,width:Math.min(r,p.width+200),height:Math.min(p.height+200,n),onClick:he,onTap:he,onContextMenu:xe=>{xe.evt.preventDefault();const me=xe.target.findAncestor(".element",!0),je=t.getElementById(me?.id()),ve=je?.top,qe=ve?.id;qe?t.selectedElementsIds.indexOf(qe)>=0||t.selectElements([qe]):t.selectElements([]),K.open({x:xe.evt.clientX,y:xe.evt.clientY})},onMouseDown:Se,onMouseMove:xe=>{if(!t.distanceGuidesVisible&&!xe.evt.altKey)return void(U&&L(null));const me=xe.target.findAncestor(".element",!0),je=me?.id();de(je)},onDragStart:xe=>{var me;const je=xe.target.getStage();if(je&&je.getPointersPositions().length>=2)return void xe.target.stopDrag();const ve=xe.target.findAncestor(".element",!0);if(ve){const qe=t.getElementById(ve?.id()),ht=qe?.top,gt=ht?.id;!(t.selectedElementsIds.indexOf(gt)>=0)&>&&(t.selectElements([gt]),xe.target.stopDrag(),xe.target.startDrag(xe),(me=G.current)===null||me===void 0||me.startDrag(xe))}U&&L(null)},pageId:e.id,style:{position:"absolute",overflow:"hidden",top:0,left:0}},X.createElement(MT,null,X.createElement(xN,{width:r,height:n,fill:a}),X.createElement(Zt,{x:H,y:$,scaleX:t.scale,scaleY:t.scale,name:"page-container"},X.createElement(Zt,{name:"page-container-2"},X.createElement(Zt,{name:"page-background-group",x:R,y:R},X.createElement(_N,{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})),X.createElement(Zt,{x:R,y:R,name:"elements-container",listening:!t.isPlaying},X.createElement(ur,{name:"elements-area",width:e.computedWidth,height:e.computedHeight,listening:!1}),X.createElement(CN,{elements:e.children,store:t})),X.createElement(ur,{stroke:d,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}),DD()===IN&&X.createElement(RN,{name:"hit-detection",x:-dt/2-nt,y:-dt/2-nt,width:N+dt+2*nt,height:B+dt+2*nt}))),X.createElement($s,{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}),X.createElement(Zt,{x:H,y:$,scaleX:t.scale,scaleY:t.scale},X.createElement(ur,{name:"page-highlight",hideInExport:!0,x:-dt/2-nt,y:-dt/2-nt,width:N+dt+2*nt,height:B+dt+2*nt,stroke:oe?s:o,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})),X.createElement(Zt,{x:H+R*t.scale,y:$+R*t.scale,scaleX:t.scale,scaleY:t.scale,name:"page-abs-container"},X.createElement(wp,{ref:G,rotateAnchorAngle:ee,onDragStart:xe=>{var me;const je=xe.target.getStage();je&&je.getPointersPositions().length>=2?xe.target.stopDrag():(!((me=xe.evt)===null||me===void 0)&&me.altKey&&f&&t.selectedElements.forEach(ve=>{const qe=ve.clone({},{skipSelect:!0}),ht=e.children.indexOf(ve);e.setElementZIndex(qe.id,ht)}),Q.current=!0,t.history.startTransaction())},onDragEnd:()=>{Q.current&&(t.history.endTransaction(),Q.current=!1),Le()},onTransformStart:()=>{t.history.startTransaction(),L(null)},boundBoxFunc:(xe,me)=>{const je=Math.abs(me.width)<1||Math.abs(me.height)<1,ve=Math.abs(xe.width)<1||Math.abs(xe.height)<1;return je&&!ve?xe:me},onTransform:xe=>{const me=G.current.nodes(),je=me[me.length-1];xe.target===je&&setTimeout(()=>{Ie()},0)},onTransformEnd:xe=>{V({}),t.history.endTransaction(),Le()},visible:!t.isPlaying}),U&&U.map(({points:xe,distance:me,box1:je,box2:ve},qe)=>X.createElement(Zt,{name:"distances-container",hideInExport:!0,key:qe,listening:!1},X.createElement(ur,Object.assign({},je,{stroke:_,strokeWidth:1,strokeScaleEnabled:!1})),X.createElement(ur,Object.assign({},ve,{stroke:_,strokeWidth:1,strokeScaleEnabled:!1})),X.createElement($s,{points:[xe[0].x,xe[0].y,xe[1].x,xe[1].y],stroke:_,strokeWidth:1,strokeScaleEnabled:!1}),X.createElement($s,{points:[xe[1].x,xe[1].y,xe[2].x,xe[2].y],stroke:_,strokeWidth:1,strokeScaleEnabled:!1}),X.createElement(Hg,{x:(xe[0].x+xe[1].x)/2,y:(xe[0].y+xe[1].y)/2,offsetY:-10,scaleX:1/t.scale,scaleY:1/t.scale},X.createElement($g,{cornerRadius:5,fill:E,pointerDirection:"down"}),X.createElement(Na,{align:"center",verticalAlign:"middle",fill:A,padding:5,text:VD({unit:t.unit,dpi:t.dpi,px:me})})))),e._rendering&&X.createElement(Zt,null,X.createElement(ur,{width:N,height:B,fill:"rgba(255,255,255,0.9)"}),X.createElement(Na,{text:"Rendering...",fontSize:60,width:N,height:B,align:"center",verticalAlign:"middle"})),Oe&&X.createElement(Oe,{components:u,store:t,page:e,stageRef:Z,tooltipSafeArea:I}),Be&&X.createElement(qg,null,X.createElement(Be,Object.assign({components:u,store:t},K.props)))),X.createElement(vN,{store:t,page:e,width:r,height:n,scale:t.scale,xPadding:H,yPadding:$,bleed:R}),X.createElement(TN,Object.assign({},W,{store:t,tagFill:S,textFill:P})),X.createElement(PN,{selection:Ue,fill:h,stroke:y,strokeWidth:v}),Og()>0&&X.createElement(Zt,{hideInExport:!0},X.createElement(qx,{name:"cache-bounds",x:r-(Og()===1?250:210),y:n-(Og()===1?95:45)}),X.createElement(qx,{name:"cache-bounds-t",x:10,y:10})),ND()&&X.createElement(Na,{text:"Powered by polotno.com",fontSize:14,fill:"rgba(0,0,0,0.6)",x:r-170,y:n-18,onMouseEnter:xe=>{xe.target.getStage().container().style.cursor="pointer"},onMouseLeave:xe=>{xe.target.getStage().container().style.cursor=""},onTouchStart:xe=>{xe.cancelBubble=!0},onMouseDown:xe=>{xe.cancelBubble=!0},onClick:()=>{window.open("https://polotno.com")},onTap:()=>{window.open("https://polotno.com")}}),X.createElement(Zt,{name:"line-guides"}))),q&&ke&&X.createElement(ke,{store:t,page:e,xPadding:H,yPadding:$,layout:T}))}),FN=Dd("div",X.forwardRef)`
|
|
404
|
+
position: absolute;
|
|
405
|
+
top: 0;
|
|
406
|
+
left: 0;
|
|
407
|
+
pointer-events: none;
|
|
408
|
+
`,Vx=Dd("div",X.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
|
+
`,Wx=Dd("div",X.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
|
+
`,Gx=Dd("div",X.forwardRef)`
|
|
430
|
+
position: absolute;
|
|
431
|
+
border-left: 1px solid grey;
|
|
432
|
+
padding-left: 2px;
|
|
433
|
+
`,Xx=Dd("div",X.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
|
+
`,BN=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],zN=Pr(({store:t,width:e,height:r,pageSizes:n,layout:i="vertical",renderOnlyActivePage:a,rulerBackgroundColor:o,rulerTextColor:s,rulerBorderColor:u,rulerBorderSize:d,rulerTickColor:f,rulerTickSize:p})=>{const h=X.useRef(null);if(!t.activePage)return null;const y=i==="horizontal",v=t.activePage,b=(t.bleedVisible&&v.bleed,v.computedWidth*t.scale),x=v.computedHeight*t.scale,k=(e-b)/2,S=(r-x)/2,P=(_=G=>Nx({unitVal:G,dpi:t.dpi,unit:t.unit})*t.scale,BN.find(G=>_(G)>30)||1e4);var _;const E=Nx({unitVal:P,dpi:t.dpi,unit:t.unit})*t.scale,A=Math.round(b/E)+1,T=Math.round(x/E)+1,I=T0(t.selectedShapes),M=o||"#e8e8e8",R=s||"grey",N=u||"grey",B=d??1,H=f||"grey",$=p??1;return X.createElement(FN,{ref:h,className:"polotno-rulers",style:{display:"flex",flexDirection:"column"}},y?X.createElement(X.Fragment,null,X.createElement("div",{style:{display:"flex",flexDirection:"row",position:"sticky",top:0,zIndex:1}},X.createElement("div",{className:"polotno-ruler-corner",style:{width:"14px",height:"14px",flexShrink:0,backgroundColor:M,borderRight:`${B}px solid ${N}`,borderBottom:`${B}px solid ${N}`,position:"sticky",left:0,zIndex:2}}),(a?[t.activePage]:t.pages).map((G,Z)=>{var J;if(!G)return null;const q=n?n[Z]:e,Q=(q-G.computedWidth*t.scale)/2;return X.createElement(Vx,{key:G.id,style:{width:q+"px",flexShrink:0,position:"relative",backgroundColor:M,color:R,borderBottom:`${B}px solid ${N}`},className:"polotno-x-ruler"},[...Array(A)].map((U,L)=>X.createElement(Gx,{key:L,className:"polotno-ruler-tick",style:{left:Q+L*E+"px",width:E+"px",borderLeft:`${$}px solid ${H}`}},t.unit==="px"||P>=1?Math.round(P*L):(P*L).toFixed(1))),((J=t.selectedShapes[0])===null||J===void 0?void 0:J.page)===G&&X.createElement("div",{className:"polotno-ruler-selection",style:{position:"absolute",left:Q+I.x*t.scale+"px",height:"14px",width:I.width*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))})),X.createElement(Wx,{style:{height:r+"px",position:"sticky",left:0,marginTop:"-14px",backgroundColor:M,color:R,borderRight:`${B}px solid ${N}`},className:"polotno-y-ruler"},[...Array(T)].map((G,Z)=>X.createElement(Xx,{key:Z,className:"polotno-ruler-tick",style:{top:S+Z*E+"px",width:E+"px",borderLeft:`${$}px solid ${H}`}},t.unit==="px"||P>=1?Math.round(P*Z):(P*Z).toFixed(1))),!!t.selectedShapes.length&&X.createElement("div",{className:"polotno-ruler-selection",style:{position:"absolute",top:S+I.y*t.scale+"px",width:"14px",height:I.height*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))):X.createElement(X.Fragment,null,X.createElement(Vx,{style:{width:e+"px",backgroundColor:M,color:R,borderBottom:`${B}px solid ${N}`},className:"polotno-x-ruler"},[...Array(A)].map((G,Z)=>X.createElement(Gx,{key:Z,className:"polotno-ruler-tick",style:{left:k+Z*E+"px",width:E+"px",borderLeft:`${$}px solid ${H}`}},t.unit==="px"||P>=1?Math.round(P*Z):(P*Z).toFixed(1))),!!t.selectedShapes.length&&X.createElement("div",{className:"polotno-ruler-selection",style:{position:"absolute",left:k+I.x*t.scale+"px",height:"14px",width:I.width*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}})),(a?[t.activePage]:t.pages).map((G,Z)=>{var J;if(!G)return null;const q=n?n[Z]:r,Q=(q-G.computedHeight*t.scale)/2,U=Z===0?14:0;return X.createElement(Wx,{key:G.id,style:{height:q-U+"px",backgroundColor:M,color:R,borderRight:`${B}px solid ${N}`},className:"polotno-y-ruler"},[...Array(T)].map((L,W)=>X.createElement(Xx,{key:W,className:"polotno-ruler-tick",style:{top:Q+W*E-U+"px",width:E+"px",borderLeft:`${$}px solid ${H}`}},t.unit==="px"||P>=1?Math.round(P*W):(P*W).toFixed(1))),((J=t.selectedShapes[0])===null||J===void 0?void 0:J.page)===G&&X.createElement("div",{className:"polotno-ruler-selection",style:{position:"absolute",top:Q+I.y*t.scale-U+"px",width:"14px",height:I.height*t.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))})))}),jN=Pr(({audio:t,store:e})=>{const[r]=(function(n){const[i,a]=X.useState(null),[o,s]=X.useState("loading");return X.useEffect(()=>{const u=new Audio(n),d=()=>{s("loaded"),a(u)},f=()=>{s("failed"),a(null)};return u.addEventListener("canplay",d),u.addEventListener("error",f),()=>{u.removeEventListener("canplay",d),u.removeEventListener("error",f)}},[n]),[i,o]})(t.src);return X.useEffect(()=>{r&&e.history.ignore(()=>{t.set({duration:1e3*r.duration})})},[r,t,e.history]),X.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=so(()=>{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),d=s>=0&&s<u;if(!e.isPlaying||e.animatedElementsIds.length!==0||!d)return void r.pause();r.volume=t.volume,r.paused&&r.play();const f=s%u/1e3+t.startTime*t.duration/1e3,p=r.currentTime;Math.abs(p-f)>.5&&f!==p&&(r.currentTime=f)});return()=>{r.pause(),r.removeEventListener("ended",n),r.removeEventListener("timeupdate",i),a()}},[e.isPlaying,t.startTime,t.endTime,t.volume,r]),null});let m6={data:[],pageId:""};const a0="polotno_clipboard",hb=(t,e)=>{m6={data:JSON.parse(JSON.stringify(t)),pageId:e||""};try{localStorage.setItem(a0,JSON.stringify(t)),localStorage.setItem(a0+"_page",e||"")}catch{}},UN=()=>{try{const t=localStorage.getItem(a0),e=localStorage.getItem(a0+"_page");if(t)return{data:JSON.parse(t),pageId:e}}catch{}return m6},HN=t=>{var e;t.selectedElements.length!==0&&hb(t.selectedElements.map(r=>r.toJSON()),(e=t.activePage)===null||e===void 0?void 0:e.id)},$N=t=>{var e;hb(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)},qN=t=>{t.history.transaction(()=>{var e,r;let n=0,i=0;const{data:a,pageId:o}=UN();if(o===((e=t.activePage)===null||e===void 0?void 0:e.id))n=t.width/20,i=t.height/20;else{const u=[];zr({children:a},f=>{f.type!=="group"&&u.push(f)});const d=T0(u);d.maxX>t.width&&(n=-d.minX),d.maxY>t.height&&(i=-d.minY)}const s=[];zr({children:a},u=>{delete u.id,u.type!=="group"&&(u.x+=n,u.y+=i)}),a.forEach(u=>{var d;const f=(d=t.activePage)===null||d===void 0?void 0:d.addElement(u);f&&s.push(f.id)}),hb(a,(r=t.activePage)===null||r===void 0?void 0:r.id),t.selectElements(s)})};function VN(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 ci=t=>{if(t.type!=="group")return Nd(t);let e=1/0,r=1/0,n=-1/0,i=-1/0;return t.children.forEach(a=>{const o=ci(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}},zc=(t,e,r)=>{if(t.type!=="group"){const n=Nd(t),i=e-n.x,a=r-n.y;t.set({x:t.x+i,y:t.y+a})}else{const n=e-ci(t).x,i=r-ci(t).y;t.children.forEach(a=>{const o=ci(a);zc(a,o.x+n,o.y+i)})}};function WN(t){var e;let r=(e=t.activePage)===null||e===void 0?void 0:e.computedWidth;t.selectedElements.forEach(n=>{r=Math.min(r,ci(n).x)}),t.selectedElements.length===1&&(r=0),t.selectedElements.forEach(n=>{const i=ci(n);zc(n,i.x-i.x+r,i.y)})}function GN(t){var e;let r=0;t.selectedElements.forEach(n=>{const i=ci(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=ci(n);zc(n,r-i.width,i.y)})}function XN(t){var e;let r=(e=t.activePage)===null||e===void 0?void 0:e.computedHeight;t.selectedElements.forEach(n=>{r=Math.min(r,ci(n).y)}),t.selectedElements.length===1&&(r=0),t.selectedElements.forEach(n=>{const i=ci(n);zc(n,i.x,i.y-i.y+r)})}function YN(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=ci(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=ci(o);zc(o,s.x,a-s.height/2)})}function KN(t){var e;let r=0;t.selectedElements.forEach(n=>{const i=ci(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=ci(n);zc(n,i.x,r-i.height)})}function QN(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=ci(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=ci(o);zc(o,a-s.width/2,s.y)})}const bv="rgba(191, 191, 191, 100)";function ZN(t,e){var r,n,i,a,o,s,u,d,f,p,h,y,v,b,x,k,S,P;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 _=document.querySelector(".polotno-workspace-container");if(document.activeElement!==_&&!_?.contains(document.activeElement)){const M=window.getSelection();if(M&&M.toString().length>0)return}const E=e.selectedElements.filter(M=>M.removable).map(M=>M.id);t.keyCode!==46&&t.keyCode!==8||e.deleteElements(E);const A=t.ctrlKey||t.metaKey,T=t.shiftKey,I=t.altKey;if(t.key==="Escape"&&e.tool==="draw")return t.preventDefault(),void e.setTool("selection");if(!A||T||t.key.toLowerCase()!=="z"&&t.key.toLowerCase()!=="y"||(t.preventDefault(),e.history.undo()),A&&T&&(t.key.toLowerCase()==="z"||t.key.toLowerCase()==="y")&&(t.preventDefault(),e.history.redo()),A&&t.code==="KeyA"){t.preventDefault();const M=(a=e.activePage)===null||a===void 0?void 0:a.children.filter(N=>N.selectable),R=M?.map(N=>N.id)||[];e.selectElements(R)}if(A&&t.code==="KeyC"&&(t.preventDefault(),HN(e)),A&&t.code==="KeyX"&&(t.preventDefault(),$N(e)),A&&t.code==="KeyV"&&(t.preventDefault(),qN(e)),t.code==="ArrowDown"&&(t.preventDefault(),e.selectedShapes.forEach(M=>{M.draggable&&M.set({y:M.y+1})})),t.code==="ArrowUp"&&(t.preventDefault(),e.selectedShapes.forEach(M=>{M.draggable&&M.set({y:M.y-1})})),t.code==="ArrowLeft"&&(t.preventDefault(),e.selectedShapes.forEach(M=>{M.draggable&&M.set({x:M.x-1})})),t.code==="ArrowRight"&&(t.preventDefault(),e.selectedShapes.forEach(M=>{M.draggable&&M.set({x:M.x+1})})),A&&t.code==="KeyG"){t.preventDefault();const M=e.selectedElements[0];if(M&&M.type==="group"){const R=M;e.ungroupElements([R.id])}else e.groupElements(e.selectedElements.map(R=>R.id))}if(A&&t.code==="KeyD"&&(t.preventDefault(),VN(e.selectedElements,e)),t.code==="KeyT"&&!A){t.preventDefault();const M=30,R=e.width/2,N=e.width/2-R/2,B=e.height/2-M/2,H=2160,$=(e.width+e.height)/H;(o=e.activePage)===null||o===void 0||o.addElement({type:"text",x:N,y:B,width:R,fontSize:M*$,text:"Sample Text",fontFamily:"Roboto"})}if(t.code==="KeyR"&&!A){t.preventDefault();const M={type:"figure",x:e.width/4,y:e.height/4,width:300,height:300,fill:bv,stroke:"#0c0c0c",strokeWidth:0,subType:"rect"};(s=e.activePage)===null||s===void 0||s.addElement(M)}if(t.code==="KeyL"&&!A){t.preventDefault();const M=((d=(u=e.activePage)===null||u===void 0?void 0:u.computedWidth)!==null&&d!==void 0?d:0)/3,R={type:"line",x:((p=(f=e.activePage)===null||f===void 0?void 0:f.computedWidth)!==null&&p!==void 0?p:0)/2-M/2,y:((y=(h=e.activePage)===null||h===void 0?void 0:h.computedHeight)!==null&&y!==void 0?y:0)/2,width:M,color:bv};(v=e.activePage)===null||v===void 0||v.addElement(R)}if(t.code==="KeyO"&&!A){t.preventDefault(),t.preventDefault();const M={type:"figure",x:e.width/4,y:e.height/4,width:300,height:300,fill:bv,stroke:"#0c0c0c",strokeWidth:0,subType:"circle"};(b=e.activePage)===null||b===void 0||b.addElement(M)}A&&t.code==="Equal"&&(t.preventDefault(),e.setScale(e.scale+.1)),A&&t.code==="Minus"&&(t.preventDefault(),e.setScale(e.scale-.1)),I&&(t.code==="KeyA"&&(t.preventDefault(),WN(e)),t.code==="KeyD"&&(t.preventDefault(),GN(e)),t.code==="KeyS"&&(t.preventDefault(),KN(e)),t.code==="KeyW"&&(t.preventDefault(),XN(e)),t.code==="KeyV"&&(t.preventDefault(),YN(e)),t.code==="KeyH"&&(t.preventDefault(),QN(e))),t.code==="BracketRight"&&(t.preventDefault(),A?(x=e.activePage)===null||x===void 0||x.moveElementsUp(e.selectedElementsIds):(k=e.activePage)===null||k===void 0||k.moveElementsTop(e.selectedElementsIds)),t.code==="BracketLeft"&&(t.preventDefault(),A?(S=e.activePage)===null||S===void 0||S.moveElementsDown(e.selectedElementsIds):(P=e.activePage)===null||P===void 0||P.moveElementsBottom(e.selectedElementsIds))}const h2=Yt({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",cold:"Cold",natural:"Natural",warm:"Warm",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"}}),o0=t=>t&&typeof t=="object";function g6(t,e){Object.keys(e).forEach(r=>{const n=t[r],i=e[r];o0(i)&&o0(n)?g6(n,i):t[r]=i})}function y6(t,e,r=""){Object.keys(e).forEach(n=>{const i=e[n],a=r?`${r}.${n}`:n;o0(i)?o0(t[n])?y6(t[n],i,a):console.warn(`Missing nested translation object at '${a}'`):t[n]===void 0&&console.warn(`Missing translation '${a}'`)})}jt((t,{validate:e=!1}={})=>{e&&y6(t,h2),g6(h2,t)});const Yx={},Kx=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})(h2,t);if(e!==void 0)return e;Yx[t]||(Yx[t]=!0,console.warn(`Missing translation '${t}'`));const r=t.split("."),n=r[r.length-1]||" ";return n.charAt(0).toUpperCase()+n.slice(1)},Qx=(t,e,r)=>Math.max(e,Math.min(r,t)),Zx=(t,e)=>Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)),JN=({store:t})=>X.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"}},X.createElement("p",null,Kx("workspace.noPages")),X.createElement("button",{onClick:()=>{t.addPage()}},Kx("workspace.addPage"))),eL=({width:t,height:e,xPadding:r,yPadding:n,backgroundColor:i})=>X.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}},X.createElement("div",{style:{width:" 100%",height:"100%",backgroundColor:"white"}})),tL=[4,6],rL=Pr(({store:t,layout:e="vertical",pageControlsEnabled:r,backgroundColor:n,pageBorderColor:i,activePageBorderColor:a,bleedColor:o,snapGuideStroke:s,snapGuideStrokeWidth:u,snapGuideDash:d,selectionRectFill:f,selectionRectStroke:p,selectionRectStrokeWidth:h,transformLabelFill:y,transformLabelTextFill:v,distanceGuideStroke:b,distanceLabelFill:x,distanceLabelTextFill:k,rulerBackgroundColor:S,rulerTextColor:P,rulerBorderColor:_,rulerBorderSize:E,rulerTickColor:A,rulerTickSize:T,components:I,onKeyDown:M,paddingX:R,paddingY:N,pageGap:B,altCloneEnabled:H=!0,visiblePagesOffset:$,renderOnlyActivePage:G,tooltipSafeArea:Z})=>{var J;const q=e==="horizontal",Q=R??20,U=N??55,[L,W]=X.useState({width:100,height:100}),V=X.useRef(L),ee=X.useRef(null),re=X.useRef(null),K=X.useRef(0),ne=t.bleedVisible?Math.max(0,...t.pages.map(ze=>ze.bleed)):0,le=Math.max(...t.pages.map(ze=>ze.computedWidth)),ae=Math.max(...t.pages.map(ze=>ze.computedHeight)),ue=((J=t.activePage)===null||J===void 0?void 0:J.computedHeight)||0,ye=le+2*ne,Ie=(G?ue:ae)+2*ne,Le=async({skipTimeout:ze}={skipTimeout:!1})=>{if(ze||await new Promise(Cr=>setTimeout(Cr,50)),ee.current===null)return;const Ye=ee.current.getBoundingClientRect();Ye.width!==0&&Ye.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(ee.current));const xt=re.current.clientWidth||Ye.width,ot={width:xt,height:Ye.height};(V.current.width!==ot.width||V.current.height!==ot.height)&&(W(ot),V.current=ot);const It=(xt-2*Q)/ye,Ft=t.pages.length>1?3.1:2,Ht=(Ye.height-U*Ft)/Ie,wr=t.pages.length>1?3.1:2,Tr=(xt-Q*wr)/ye,mr=(Ye.height-2*U)/Ie,zt=t.pages.length?Math.max(Math.min(q?Tr:It,q?mr:Ht),.01):1;t.scaleToFit!==zt&&(t.setScale(zt),t._setScaleToFit(zt))};X.useLayoutEffect(()=>{Le({skipTimeout:!0})},[]),X.useEffect(()=>{Le()},[ye,Ie,N,R]),X.useLayoutEffect(()=>{Le({skipTimeout:!0})},[t.openedSidePanel]),X.useEffect(()=>{t.__()},[]),X.useEffect(()=>{const ze=ee.current;if(window.ResizeObserver){const Ye=new ResizeObserver(()=>{Le({skipTimeout:!0})});return Ye.observe(ze),()=>Ye.unobserve(ze)}{const Ye=setInterval(()=>{Le({skipTimeout:!0})},100);return()=>clearInterval(Ye)}},[ye,Ie]);const Ue=G?1:t.pages.length;let $e,rt;if(q){const ze=ye*t.scale*Ue;$e=Math.max(Q,(L.width-ze)/Ue/2),rt=Math.max(U,(L.height-Ie*t.scale)/2)}else{$e=Math.max(Q,(L.width-ye*t.scale)/2);const ze=Ie*t.scale*Ue;rt=Math.max(U,(L.height-ze)/Ue/2)}Number.isNaN($e)&&($e=Q),Number.isNaN(rt)&&(rt=U),X.useEffect(()=>{const ze=Ye=>{(M||ZN)(Ye,t)};return window.addEventListener("keydown",ze),()=>window.removeEventListener("keydown",ze)},[]),X.useEffect(()=>{const ze=xt=>{if(xt.ctrlKey||xt.metaKey){xt.preventDefault();const ot=Math.max(5,t.scaleToFit);let It=Math.min(.1,t.scaleToFit);q&&ye>0&&Number.isFinite(ye)&&(It=Math.max(It,300/ye)),It=Math.max(It,.01);const Ft=.03,Ht=Qx(xt.deltaY<0?t.scale*(1+Ft):t.scale/(1+Ft),It,ot);return void t.setScale(Ht)}},Ye=re.current;return Ye?.addEventListener("wheel",ze),()=>Ye?.removeEventListener("wheel",ze)},[q,ye,t]),X.useEffect(()=>{const ze=re.current;if(!ze)return;const Ye=It=>{It.touches.length===2&&(K.current=Zx(It.touches[0],It.touches[1]))},xt=It=>{if(It.touches.length===2&&K.current>0){It.preventDefault();const Ft=Zx(It.touches[0],It.touches[1]),Ht=Ft/K.current,wr=Math.max(5,t.scaleToFit);let Tr=Math.min(.1,t.scaleToFit);q&&ye>0&&Number.isFinite(ye)&&(Tr=Math.max(Tr,300/ye)),Tr=Math.max(Tr,.01);const mr=t.scale,zt=Qx(mr*Ht,Tr,wr),Cr=zt/mr,qr=ze.getBoundingClientRect(),Zn=(It.touches[0].clientX+It.touches[1].clientX)/2-qr.left,Or=(It.touches[0].clientY+It.touches[1].clientY)/2-qr.top,Tn=ze.scrollLeft+Zn,Vr=ze.scrollTop+Or;ke.current=!0,t.setScale(zt),ze.scrollLeft=Tn*Cr-Zn,ze.scrollTop=Vr*Cr-Or,K.current=Ft}},ot=()=>{K.current=0};return ze.addEventListener("touchstart",Ye,{passive:!0}),ze.addEventListener("touchmove",xt,{passive:!1}),ze.addEventListener("touchend",ot,{passive:!0}),()=>{ze.removeEventListener("touchstart",Ye),ze.removeEventListener("touchmove",xt),ze.removeEventListener("touchend",ot)}},[q,ye,t]);const Se=B!==void 0,de=t.pages.map(ze=>{if(q){const Ye=(ze.computedWidth+2*ne)*t.scale;return Se?Ye+B:Ye+2*$e}{const Ye=(ze.computedHeight+2*ne)*t.scale;return Se?Ye+B:Ye+2*rt}}),se=[];let he=Se?q?$e:rt:0;for(let ze=0;ze<de.length;ze++)se.push(he),he+=de[ze];const Ce=de.reduce((ze,Ye)=>ze+Ye,0),oe=Se?Ce+(q?2*$e:2*rt):Ce,ke=X.useRef(!1),[,Oe]=X.useReducer(ze=>ze+1,0);((ze,Ye,xt,ot,It,Ft)=>{const Ht=X.useRef(Ye),wr=X.useRef(0),Tr=X.useRef(!1),mr=X.useRef(ot.pages.length);Tr.current=mr.current!==ot.pages.length,mr.current=ot.pages.length,X.useEffect(()=>{const zt=ze.current,Cr=qr=>{wr.current=Ft?zt.scrollLeft:zt.scrollTop};return zt.addEventListener("scroll",Cr),()=>{zt.removeEventListener("scroll",Cr)}},[Ft]),X.useLayoutEffect(()=>{if(!ze.current||Tr.current)return;const zt=ze.current,Cr=Ft?zt.offsetWidth:zt.offsetHeight,qr=(wr.current+Cr/2)/Ht.current;It.current=!0;const Zn=qr*Ye-Cr/2;Ft?zt.scrollLeft=Zn:zt.scrollTop=Zn,Ht.current=Ye},[xt,Ye,Ft])})(re,oe,t.scale,t,ke,q);const{handleScroll:Be}=((ze,Ye,xt,ot,It,Ft,Ht,wr,Tr)=>{const mr=X.useRef(!1),zt=X.useRef(null),Cr=X.useRef(!1),qr=wr==="horizontal";X.useEffect(()=>{const Or=ze.current,Tn=()=>{Ft.current};return Or.addEventListener("scroll",Tn),()=>{Or.removeEventListener("scroll",Tn)}},[]);const Zn=ot.pages.indexOf(ot.activePage);return X.useLayoutEffect(()=>{if(Ht||!ot.activePage||!ze.current||mr.current)return;const Or=ze.current,Tn=ot.pages.indexOf(ot.activePage),Vr=Ye[Tn]||0,Jn=qr?Or.scrollLeft:Or.scrollTop,Fn=xt[Tn]||xt[0]||0;let Ti=()=>{};return(Math.abs(Vr-Jn)>.5*Fn||Cr.current)&&(Cr.current=!0,Ti=(({element:Vi,scrollTop:po,scrollLeft:al,duration:Bn=300,onFinish:ns=()=>{}})=>{const Ba=po!==void 0,mo=Ba?Vi.scrollTop:Vi.scrollLeft,fi=Ba?po:al,za=fi-mo;let go=0,yo=!1;if(Bn===0)return Ba?Vi.scrollTop=fi:Vi.scrollLeft=fi,()=>{};const jc=()=>{if(yo)return;go+=20;const rr=Fd(go,mo,za,Bn);Ba?Vi.scrollTop=rr:Vi.scrollLeft=rr,go<Bn?setTimeout(jc,20):ns()},Fd=(rr,ol,da,sl)=>(rr/=sl/2)<1?da/2*rr*rr+ol:-da/2*(--rr*(rr-2)-1)+ol;return jc(),()=>{yo=!0}})(Object.assign(Object.assign({element:Or},qr?{scrollLeft:Vr}:{scrollTop:Vr}),{onFinish:()=>{Cr.current=!1,Tr?.()},duration:ot.isPlaying?0:300}))),Ti},[ot.activePage,Zn,ot.isPlaying,Ht,wr,Ye,xt]),{handleScroll:Or=>{if(Ht||Cr.current)return;mr.current=!0,clearTimeout(zt.current),zt.current=setTimeout(()=>{mr.current=!1},300);const Tn=(qr?Or.currentTarget.scrollLeft:Or.currentTarget.scrollTop)+(qr?It.width:It.height)/3;let Vr=0;for(let Fn=Ye.length-1;Fn>=0;Fn--)if(Tn>=Ye[Fn]){Vr=Fn;break}const Jn=ot.pages[Vr];Jn&&ot.activePage!==Jn&&Jn.select()}}})(re,se,de,t,L,ke,G,e,Oe),dt=L.width>=ye*t.scale+2*$e,nt=L.height>=Ie*t.scale+2*rt,xe=n||"rgba(232, 232, 232, 0.9)",me=I?.NoPages||JN,je=q?L.width:L.height,ve=re.current?q?re.current.scrollLeft:re.current.scrollTop:0,qe=ze=>{for(let Ye=se.length-1;Ye>=0;Ye--)if(ze>=se[Ye])return Ye;return 0},ht=Math.max(0,qe(ve)),gt=Math.min(t.pages.length-1,qe(ve+je)),At=$??1,be=Math.max(0,ht-At),_e=Math.min(t.pages.length-1,gt+At);return X.createElement("div",{ref:ee,style:{width:"100%",height:"100%",position:"relative",outline:"none",flex:1,backgroundColor:xe,overflow:"hidden"},tabIndex:0,className:"polotno-workspace-container"},X.createElement("div",{ref:re,onScroll:Be,style:Object.assign({position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",flexDirection:q?"row":"column",overflow:"auto",overflowX:q?"auto":dt?"hidden":"auto",overflowY:q&&nt?"hidden":"auto"},Se&&{paddingTop:q?0:rt,paddingBottom:q?0:rt,paddingLeft:q?$e:0,paddingRight:q?$e:0,boxSizing:"border-box"}),className:"polotno-workspace-inner"},t.pages.map((ze,Ye)=>{const xt=ze===t.activePage;if(G&&!xt&&!ze._exportingOrRendering&&!ze._forceMount)return null;const ot=xt||Ye>=be&&Ye<=_e||ze._exportingOrRendering||ze._forceMount,It=q?de[Ye]:ye*t.scale+2*$e,Ft=q?Ie*t.scale+2*rt:de[Ye];if(!ot)return X.createElement("div",{key:ze.id,style:{flexShrink:0}},X.createElement(eL,{width:It,height:Ft,backgroundColor:xe,xPadding:$e,yPadding:rt}));const Ht=X.createElement(LN,{key:ze.id,page:ze,xPadding:$e,yPadding:rt,width:It,height:Ft,store:t,pageControlsEnabled:r,backColor:xe,pageBorderColor:i||"lightgrey",activePageBorderColor:a||"rgb(0, 161, 255)",altCloneEnabled:H,bleedColor:o||"rgba(255, 0, 0, 0.1)",selectionRectFill:f,selectionRectStroke:p,selectionRectStrokeWidth:h,snapGuideStroke:s||"rgb(0, 161, 255)",snapGuideStrokeWidth:u||1,snapGuideDash:d||tL,transformLabelFill:y,transformLabelTextFill:v,distanceGuideStroke:b||"rgb(0, 161, 255)",distanceLabelFill:x||"rgb(0, 161, 255)",distanceLabelTextFill:k||"white",components:I,viewportSize:L,layout:e,tooltipSafeArea:Z});return(ze._exportingOrRendering||ze._forceMount)&&!xt&&G?X.createElement("div",{style:{display:"none",flexShrink:0},key:ze.id},Ht):Ht}),t.rulesVisible&&X.createElement(zN,{store:t,xPadding:$e,yPadding:rt,width:ye*t.scale+2*$e,height:Ie*t.scale+2*rt,pageSizes:de,layout:e,renderOnlyActivePage:G,rulerBackgroundColor:S,rulerTextColor:P,rulerBorderColor:_,rulerBorderSize:E,rulerTickColor:A,rulerTickSize:T}),t.pages.length===0&&X.createElement(me,{store:t}),t.audios.map(ze=>X.createElement(jN,{key:ze.id,audio:ze,store:t}))))});Je.prototype._requestDraw=()=>{};JT(!1);K5("change-font-size");const nL=new URLSearchParams(location.search).get("key"),v6=aN({key:nL});window.store=v6;let wv=null;window.__polotnoLoadJspdf=async()=>(wv||(wv=Jx(()=>import("./jspdf.es.min-kqX7i2XY.js").then(t=>t.j),[],import.meta.url)),await wv);let xv=null;window.__polotnoLoadVideoExport=async()=>(xv||(xv=Jx(()=>import("./index-DVjWS8zZ.js"),[],import.meta.url)),await xv);window.config={addGlobalFont:oC,setRichTextEnabled:pC,setTextVerticalResizeEnabled:hC,setTextOverflow:K5,onLoadError:aC,setAssetLoadTimeout:tC,setFontLoadTimeout:rC,unstable_setTextSplitAllowed:gC};const iL=tS.createRoot(document.getElementById("root"));iL.render(X.createElement(rL,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:v6,components:{PageControls:()=>null,Tooltip:()=>null}}));export{lu as $,qp as A,iR as B,Q2 as C,u2 as D,gd as E,Zs as F,Qh as G,Xf as H,CL as I,HL as J,e2 as K,$L as L,J2 as M,YI as N,DL as O,Qs as P,NL as Q,cp as R,OL as S,Z2 as T,Da as U,TL as V,AL as W,LL as X,RL as Y,su as Z,Jx as _,pe as a,i8 as a0,Pn as a1,l8 as a2,hd as a3,t8 as a4,SL as a5,qL as a6,VL as a7,PL as a8,n8 as a9,EL as aa,vL as ab,WL as ac,KM as ad,VM as ae,GM as af,xx as ag,Ig as ah,Oc as ai,Tp as b,xL as c,du as d,pR as e,na as f,IL as g,IR as h,bL as i,h8 as j,_L as k,ui as l,g8 as m,UL as n,kL as o,c8 as p,BL as q,Rp as r,jL as s,wL as t,Ed as u,FL as v,A0 as w,ML as x,zL as y,R0 as z};
|